Commit b902f8f4 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm: omapdrm: gem: Remove forward declarations

Reorder functions to get rid of forward declarations
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 6405e414
...@@ -113,8 +113,6 @@ struct omap_gem_object { ...@@ -113,8 +113,6 @@ struct omap_gem_object {
} *sync; } *sync;
}; };
static int get_pages(struct drm_gem_object *obj, struct page ***pages);
static uint64_t mmap_offset(struct drm_gem_object *obj);
/* To deal with userspace mmap'ings of 2d tiled buffers, which (a) are /* To deal with userspace mmap'ings of 2d tiled buffers, which (a) are
* not necessarily pinned in TILER all the time, and (b) when they are * not necessarily pinned in TILER all the time, and (b) when they are
...@@ -144,6 +142,30 @@ static struct { ...@@ -144,6 +142,30 @@ static struct {
int last; /* index of last used entry */ int last; /* index of last used entry */
} *usergart; } *usergart;
/* -----------------------------------------------------------------------------
* Helpers
*/
/** get mmap offset */
static uint64_t mmap_offset(struct drm_gem_object *obj)
{
struct drm_device *dev = obj->dev;
int ret;
size_t size;
WARN_ON(!mutex_is_locked(&dev->struct_mutex));
/* Make it mmapable */
size = omap_gem_mmap_size(obj);
ret = drm_gem_create_mmap_offset_size(obj, size);
if (ret) {
dev_err(dev->dev, "could not allocate mmap offset\n");
return 0;
}
return drm_vma_node_offset_addr(&obj->vma_node);
}
static void evict_entry(struct drm_gem_object *obj, static void evict_entry(struct drm_gem_object *obj,
enum tiler_fmt fmt, struct usergart_entry *entry) enum tiler_fmt fmt, struct usergart_entry *entry)
{ {
...@@ -266,6 +288,28 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj) ...@@ -266,6 +288,28 @@ static int omap_gem_attach_pages(struct drm_gem_object *obj)
return ret; return ret;
} }
/* acquire pages when needed (for example, for DMA where physically
* contiguous buffer is not required
*/
static int get_pages(struct drm_gem_object *obj, struct page ***pages)
{
struct omap_gem_object *omap_obj = to_omap_bo(obj);
int ret = 0;
if (is_shmem(obj) && !omap_obj->pages) {
ret = omap_gem_attach_pages(obj);
if (ret) {
dev_err(obj->dev->dev, "could not attach pages\n");
return ret;
}
}
/* TODO: even phys-contig.. we should have a list of pages? */
*pages = omap_obj->pages;
return 0;
}
/** release backing pages */ /** release backing pages */
static void omap_gem_detach_pages(struct drm_gem_object *obj) static void omap_gem_detach_pages(struct drm_gem_object *obj)
{ {
...@@ -295,26 +339,6 @@ uint32_t omap_gem_flags(struct drm_gem_object *obj) ...@@ -295,26 +339,6 @@ uint32_t omap_gem_flags(struct drm_gem_object *obj)
return to_omap_bo(obj)->flags; return to_omap_bo(obj)->flags;
} }
/** get mmap offset */
static uint64_t mmap_offset(struct drm_gem_object *obj)
{
struct drm_device *dev = obj->dev;
int ret;
size_t size;
WARN_ON(!mutex_is_locked(&dev->struct_mutex));
/* Make it mmapable */
size = omap_gem_mmap_size(obj);
ret = drm_gem_create_mmap_offset_size(obj, size);
if (ret) {
dev_err(dev->dev, "could not allocate mmap offset\n");
return 0;
}
return drm_vma_node_offset_addr(&obj->vma_node);
}
uint64_t omap_gem_mmap_offset(struct drm_gem_object *obj) uint64_t omap_gem_mmap_offset(struct drm_gem_object *obj)
{ {
uint64_t offset; uint64_t offset;
...@@ -861,28 +885,6 @@ int omap_gem_tiled_stride(struct drm_gem_object *obj, uint32_t orient) ...@@ -861,28 +885,6 @@ int omap_gem_tiled_stride(struct drm_gem_object *obj, uint32_t orient)
return ret; return ret;
} }
/* acquire pages when needed (for example, for DMA where physically
* contiguous buffer is not required
*/
static int get_pages(struct drm_gem_object *obj, struct page ***pages)
{
struct omap_gem_object *omap_obj = to_omap_bo(obj);
int ret = 0;
if (is_shmem(obj) && !omap_obj->pages) {
ret = omap_gem_attach_pages(obj);
if (ret) {
dev_err(obj->dev->dev, "could not attach pages\n");
return ret;
}
}
/* TODO: even phys-contig.. we should have a list of pages? */
*pages = omap_obj->pages;
return 0;
}
/* if !remap, and we don't have pages backing, then fail, rather than /* if !remap, and we don't have pages backing, then fail, rather than
* increasing the pin count (which we don't really do yet anyways, * increasing the pin count (which we don't really do yet anyways,
* because we don't support swapping pages back out). And 'remap' * because we don't support swapping pages back out). And 'remap'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment