Commit 813fd67b authored by Joonyoung Shim's avatar Joonyoung Shim Committed by Inki Dae

drm/exynos: cleanup name of gem object for exynos_drm

Struct of gem object in exynos_drm driver is struct exynos_drm_gem_obj.
It's too long and we can know its meaning of name without _obj postfix.

We use several names to variable name of gem object for exynos_drm -
exynos_gem_obj, gem_obj and obj. Especially "obj" name can cause
misunderstanding with variable name "obj" of struct drm_gem_object.

This will clean about name of gem object for exynos_drm as follows.
s/struct exynos_drm_gem_obj/struct exynos_drm_gem
s/exynos_gem_obj or gem_obj or obj/exynos_gem
Signed-off-by: default avatarJoonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 4d91a855
...@@ -32,15 +32,15 @@ ...@@ -32,15 +32,15 @@
* exynos specific framebuffer structure. * exynos specific framebuffer structure.
* *
* @fb: drm framebuffer obejct. * @fb: drm framebuffer obejct.
* @exynos_gem_obj: array of exynos specific gem object containing a gem object. * @exynos_gem: array of exynos specific gem object containing a gem object.
*/ */
struct exynos_drm_fb { struct exynos_drm_fb {
struct drm_framebuffer fb; struct drm_framebuffer fb;
struct exynos_drm_gem_obj *exynos_gem_obj[MAX_FB_BUFFER]; struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER];
}; };
static int check_fb_gem_memory_type(struct drm_device *drm_dev, static int check_fb_gem_memory_type(struct drm_device *drm_dev,
struct exynos_drm_gem_obj *exynos_gem_obj) struct exynos_drm_gem *exynos_gem)
{ {
unsigned int flags; unsigned int flags;
...@@ -51,7 +51,7 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev, ...@@ -51,7 +51,7 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev,
if (is_drm_iommu_supported(drm_dev)) if (is_drm_iommu_supported(drm_dev))
return 0; return 0;
flags = exynos_gem_obj->flags; flags = exynos_gem->flags;
/* /*
* without iommu support, not support physically non-continuous memory * without iommu support, not support physically non-continuous memory
...@@ -75,13 +75,13 @@ static void exynos_drm_fb_destroy(struct drm_framebuffer *fb) ...@@ -75,13 +75,13 @@ static void exynos_drm_fb_destroy(struct drm_framebuffer *fb)
drm_framebuffer_cleanup(fb); drm_framebuffer_cleanup(fb);
for (i = 0; i < ARRAY_SIZE(exynos_fb->exynos_gem_obj); i++) { for (i = 0; i < ARRAY_SIZE(exynos_fb->exynos_gem); i++) {
struct drm_gem_object *obj; struct drm_gem_object *obj;
if (exynos_fb->exynos_gem_obj[i] == NULL) if (exynos_fb->exynos_gem[i] == NULL)
continue; continue;
obj = &exynos_fb->exynos_gem_obj[i]->base; obj = &exynos_fb->exynos_gem[i]->base;
drm_gem_object_unreference_unlocked(obj); drm_gem_object_unreference_unlocked(obj);
} }
...@@ -96,7 +96,7 @@ static int exynos_drm_fb_create_handle(struct drm_framebuffer *fb, ...@@ -96,7 +96,7 @@ static int exynos_drm_fb_create_handle(struct drm_framebuffer *fb,
struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
return drm_gem_handle_create(file_priv, return drm_gem_handle_create(file_priv,
&exynos_fb->exynos_gem_obj[0]->base, handle); &exynos_fb->exynos_gem[0]->base, handle);
} }
static int exynos_drm_fb_dirty(struct drm_framebuffer *fb, static int exynos_drm_fb_dirty(struct drm_framebuffer *fb,
...@@ -118,7 +118,7 @@ static struct drm_framebuffer_funcs exynos_drm_fb_funcs = { ...@@ -118,7 +118,7 @@ static struct drm_framebuffer_funcs exynos_drm_fb_funcs = {
struct drm_framebuffer * struct drm_framebuffer *
exynos_drm_framebuffer_init(struct drm_device *dev, exynos_drm_framebuffer_init(struct drm_device *dev,
struct drm_mode_fb_cmd2 *mode_cmd, struct drm_mode_fb_cmd2 *mode_cmd,
struct exynos_drm_gem_obj **gem_obj, struct exynos_drm_gem **exynos_gem,
int count) int count)
{ {
struct exynos_drm_fb *exynos_fb; struct exynos_drm_fb *exynos_fb;
...@@ -130,11 +130,11 @@ exynos_drm_framebuffer_init(struct drm_device *dev, ...@@ -130,11 +130,11 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
ret = check_fb_gem_memory_type(dev, gem_obj[i]); ret = check_fb_gem_memory_type(dev, exynos_gem[i]);
if (ret < 0) if (ret < 0)
goto err; goto err;
exynos_fb->exynos_gem_obj[i] = gem_obj[i]; exynos_fb->exynos_gem[i] = exynos_gem[i];
} }
drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd);
...@@ -156,7 +156,7 @@ static struct drm_framebuffer * ...@@ -156,7 +156,7 @@ static struct drm_framebuffer *
exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
struct drm_mode_fb_cmd2 *mode_cmd) struct drm_mode_fb_cmd2 *mode_cmd)
{ {
struct exynos_drm_gem_obj *gem_objs[MAX_FB_BUFFER]; struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER];
struct drm_gem_object *obj; struct drm_gem_object *obj;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
int i; int i;
...@@ -171,10 +171,10 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, ...@@ -171,10 +171,10 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
goto err; goto err;
} }
gem_objs[i] = to_exynos_gem_obj(obj); exynos_gem[i] = to_exynos_gem(obj);
} }
fb = exynos_drm_framebuffer_init(dev, mode_cmd, gem_objs, i); fb = exynos_drm_framebuffer_init(dev, mode_cmd, exynos_gem, i);
if (IS_ERR(fb)) { if (IS_ERR(fb)) {
ret = PTR_ERR(fb); ret = PTR_ERR(fb);
goto err; goto err;
...@@ -184,27 +184,26 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, ...@@ -184,27 +184,26 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
err: err:
while (i--) while (i--)
drm_gem_object_unreference_unlocked(&gem_objs[i]->base); drm_gem_object_unreference_unlocked(&exynos_gem[i]->base);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
struct exynos_drm_gem_obj *exynos_drm_fb_gem_obj(struct drm_framebuffer *fb, struct exynos_drm_gem *exynos_drm_fb_gem(struct drm_framebuffer *fb, int index)
int index)
{ {
struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb); struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
struct exynos_drm_gem_obj *obj; struct exynos_drm_gem *exynos_gem;
if (index >= MAX_FB_BUFFER) if (index >= MAX_FB_BUFFER)
return NULL; return NULL;
obj = exynos_fb->exynos_gem_obj[index]; exynos_gem = exynos_fb->exynos_gem[index];
if (!obj) if (!exynos_gem)
return NULL; return NULL;
DRM_DEBUG_KMS("dma_addr = 0x%lx\n", (unsigned long)obj->dma_addr); DRM_DEBUG_KMS("dma_addr: 0x%lx\n", (unsigned long)exynos_gem->dma_addr);
return obj; return exynos_gem;
} }
static void exynos_drm_output_poll_changed(struct drm_device *dev) static void exynos_drm_output_poll_changed(struct drm_device *dev)
......
...@@ -19,12 +19,11 @@ ...@@ -19,12 +19,11 @@
struct drm_framebuffer * struct drm_framebuffer *
exynos_drm_framebuffer_init(struct drm_device *dev, exynos_drm_framebuffer_init(struct drm_device *dev,
struct drm_mode_fb_cmd2 *mode_cmd, struct drm_mode_fb_cmd2 *mode_cmd,
struct exynos_drm_gem_obj **gem_obj, struct exynos_drm_gem **exynos_gem,
int count); int count);
/* get gem object of a drm framebuffer */ /* get gem object of a drm framebuffer */
struct exynos_drm_gem_obj *exynos_drm_fb_gem_obj(struct drm_framebuffer *fb, struct exynos_drm_gem *exynos_drm_fb_gem(struct drm_framebuffer *fb, int index);
int index);
void exynos_drm_mode_config_init(struct drm_device *dev); void exynos_drm_mode_config_init(struct drm_device *dev);
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
drm_fb_helper) drm_fb_helper)
struct exynos_drm_fbdev { struct exynos_drm_fbdev {
struct drm_fb_helper drm_fb_helper; struct drm_fb_helper drm_fb_helper;
struct exynos_drm_gem_obj *obj; struct exynos_drm_gem *exynos_gem;
}; };
static int exynos_drm_fb_mmap(struct fb_info *info, static int exynos_drm_fb_mmap(struct fb_info *info,
...@@ -39,7 +39,7 @@ static int exynos_drm_fb_mmap(struct fb_info *info, ...@@ -39,7 +39,7 @@ static int exynos_drm_fb_mmap(struct fb_info *info,
{ {
struct drm_fb_helper *helper = info->par; struct drm_fb_helper *helper = info->par;
struct exynos_drm_fbdev *exynos_fbd = to_exynos_fbdev(helper); struct exynos_drm_fbdev *exynos_fbd = to_exynos_fbdev(helper);
struct exynos_drm_gem_obj *obj = exynos_fbd->obj; struct exynos_drm_gem *exynos_gem = exynos_fbd->exynos_gem;
unsigned long vm_size; unsigned long vm_size;
int ret; int ret;
...@@ -47,11 +47,12 @@ static int exynos_drm_fb_mmap(struct fb_info *info, ...@@ -47,11 +47,12 @@ static int exynos_drm_fb_mmap(struct fb_info *info,
vm_size = vma->vm_end - vma->vm_start; vm_size = vma->vm_end - vma->vm_start;
if (vm_size > obj->size) if (vm_size > exynos_gem->size)
return -EINVAL; return -EINVAL;
ret = dma_mmap_attrs(helper->dev->dev, vma, obj->pages, obj->dma_addr, ret = dma_mmap_attrs(helper->dev->dev, vma, exynos_gem->pages,
obj->size, &obj->dma_attrs); exynos_gem->dma_addr, exynos_gem->size,
&exynos_gem->dma_attrs);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to mmap.\n"); DRM_ERROR("failed to mmap.\n");
return ret; return ret;
...@@ -75,7 +76,7 @@ static struct fb_ops exynos_drm_fb_ops = { ...@@ -75,7 +76,7 @@ static struct fb_ops exynos_drm_fb_ops = {
static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes, struct drm_fb_helper_surface_size *sizes,
struct exynos_drm_gem_obj *obj) struct exynos_drm_gem *exynos_gem)
{ {
struct fb_info *fbi; struct fb_info *fbi;
struct drm_framebuffer *fb = helper->fb; struct drm_framebuffer *fb = helper->fb;
...@@ -96,11 +97,11 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, ...@@ -96,11 +97,11 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth); drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth);
drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height); drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height);
nr_pages = obj->size >> PAGE_SHIFT; nr_pages = exynos_gem->size >> PAGE_SHIFT;
obj->kvaddr = (void __iomem *) vmap(obj->pages, nr_pages, VM_MAP, exynos_gem->kvaddr = (void __iomem *) vmap(exynos_gem->pages, nr_pages,
pgprot_writecombine(PAGE_KERNEL)); VM_MAP, pgprot_writecombine(PAGE_KERNEL));
if (!obj->kvaddr) { if (!exynos_gem->kvaddr) {
DRM_ERROR("failed to map pages to kernel space.\n"); DRM_ERROR("failed to map pages to kernel space.\n");
drm_fb_helper_release_fbi(helper); drm_fb_helper_release_fbi(helper);
return -EIO; return -EIO;
...@@ -109,7 +110,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, ...@@ -109,7 +110,7 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
offset = fbi->var.xoffset * (fb->bits_per_pixel >> 3); offset = fbi->var.xoffset * (fb->bits_per_pixel >> 3);
offset += fbi->var.yoffset * fb->pitches[0]; offset += fbi->var.yoffset * fb->pitches[0];
fbi->screen_base = obj->kvaddr + offset; fbi->screen_base = exynos_gem->kvaddr + offset;
fbi->screen_size = size; fbi->screen_size = size;
fbi->fix.smem_len = size; fbi->fix.smem_len = size;
...@@ -120,7 +121,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, ...@@ -120,7 +121,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes) struct drm_fb_helper_surface_size *sizes)
{ {
struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper); struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper);
struct exynos_drm_gem_obj *obj; struct exynos_drm_gem *exynos_gem;
struct drm_device *dev = helper->dev; struct drm_device *dev = helper->dev;
struct drm_mode_fb_cmd2 mode_cmd = { 0 }; struct drm_mode_fb_cmd2 mode_cmd = { 0 };
struct platform_device *pdev = dev->platformdev; struct platform_device *pdev = dev->platformdev;
...@@ -141,32 +142,34 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, ...@@ -141,32 +142,34 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
size = mode_cmd.pitches[0] * mode_cmd.height; size = mode_cmd.pitches[0] * mode_cmd.height;
obj = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG, size); exynos_gem = exynos_drm_gem_create(dev, EXYNOS_BO_CONTIG, size);
/* /*
* If physically contiguous memory allocation fails and if IOMMU is * If physically contiguous memory allocation fails and if IOMMU is
* supported then try to get buffer from non physically contiguous * supported then try to get buffer from non physically contiguous
* memory area. * memory area.
*/ */
if (IS_ERR(obj) && is_drm_iommu_supported(dev)) { if (IS_ERR(exynos_gem) && is_drm_iommu_supported(dev)) {
dev_warn(&pdev->dev, "contiguous FB allocation failed, falling back to non-contiguous\n"); dev_warn(&pdev->dev, "contiguous FB allocation failed, falling back to non-contiguous\n");
obj = exynos_drm_gem_create(dev, EXYNOS_BO_NONCONTIG, size); exynos_gem = exynos_drm_gem_create(dev, EXYNOS_BO_NONCONTIG,
size);
} }
if (IS_ERR(obj)) { if (IS_ERR(exynos_gem)) {
ret = PTR_ERR(obj); ret = PTR_ERR(exynos_gem);
goto out; goto out;
} }
exynos_fbdev->obj = obj; exynos_fbdev->exynos_gem = exynos_gem;
helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd, &obj, 1); helper->fb =
exynos_drm_framebuffer_init(dev, &mode_cmd, &exynos_gem, 1);
if (IS_ERR(helper->fb)) { if (IS_ERR(helper->fb)) {
DRM_ERROR("failed to create drm framebuffer.\n"); DRM_ERROR("failed to create drm framebuffer.\n");
ret = PTR_ERR(helper->fb); ret = PTR_ERR(helper->fb);
goto err_destroy_gem; goto err_destroy_gem;
} }
ret = exynos_drm_fbdev_update(helper, sizes, obj); ret = exynos_drm_fbdev_update(helper, sizes, exynos_gem);
if (ret < 0) if (ret < 0)
goto err_destroy_framebuffer; goto err_destroy_framebuffer;
...@@ -176,7 +179,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, ...@@ -176,7 +179,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
err_destroy_framebuffer: err_destroy_framebuffer:
drm_framebuffer_cleanup(helper->fb); drm_framebuffer_cleanup(helper->fb);
err_destroy_gem: err_destroy_gem:
exynos_drm_gem_destroy(obj); exynos_drm_gem_destroy(exynos_gem);
/* /*
* if failed, all resources allocated above would be released by * if failed, all resources allocated above would be released by
...@@ -269,11 +272,11 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, ...@@ -269,11 +272,11 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev,
struct drm_fb_helper *fb_helper) struct drm_fb_helper *fb_helper)
{ {
struct exynos_drm_fbdev *exynos_fbd = to_exynos_fbdev(fb_helper); struct exynos_drm_fbdev *exynos_fbd = to_exynos_fbdev(fb_helper);
struct exynos_drm_gem_obj *obj = exynos_fbd->obj; struct exynos_drm_gem *exynos_gem = exynos_fbd->exynos_gem;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
if (obj->kvaddr) if (exynos_gem->kvaddr)
vunmap(obj->kvaddr); vunmap(exynos_gem->kvaddr);
/* release drm framebuffer and real buffer */ /* release drm framebuffer and real buffer */
if (fb_helper->fb && fb_helper->fb->funcs) { if (fb_helper->fb && fb_helper->fb->funcs) {
......
This diff is collapsed.
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
#include <drm/drm_gem.h> #include <drm/drm_gem.h>
#define to_exynos_gem_obj(x) container_of(x,\ #define to_exynos_gem(x) container_of(x, struct exynos_drm_gem, base)
struct exynos_drm_gem_obj, base)
#define IS_NONCONTIG_BUFFER(f) (f & EXYNOS_BO_NONCONTIG) #define IS_NONCONTIG_BUFFER(f) (f & EXYNOS_BO_NONCONTIG)
...@@ -44,7 +43,7 @@ ...@@ -44,7 +43,7 @@
* P.S. this object would be transferred to user as kms_bo.handle so * P.S. this object would be transferred to user as kms_bo.handle so
* user can access the buffer through kms_bo.handle. * user can access the buffer through kms_bo.handle.
*/ */
struct exynos_drm_gem_obj { struct exynos_drm_gem {
struct drm_gem_object base; struct drm_gem_object base;
unsigned int flags; unsigned int flags;
unsigned long size; unsigned long size;
...@@ -59,12 +58,12 @@ struct exynos_drm_gem_obj { ...@@ -59,12 +58,12 @@ struct exynos_drm_gem_obj {
struct page **exynos_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask); struct page **exynos_gem_get_pages(struct drm_gem_object *obj, gfp_t gfpmask);
/* destroy a buffer with gem object */ /* destroy a buffer with gem object */
void exynos_drm_gem_destroy(struct exynos_drm_gem_obj *exynos_gem_obj); void exynos_drm_gem_destroy(struct exynos_drm_gem *exynos_gem);
/* create a new buffer with gem object */ /* create a new buffer with gem object */
struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
unsigned int flags, unsigned int flags,
unsigned long size); unsigned long size);
/* /*
* request gem object creation and buffer allocation as the size * request gem object creation and buffer allocation as the size
...@@ -106,7 +105,7 @@ unsigned long exynos_drm_gem_get_size(struct drm_device *dev, ...@@ -106,7 +105,7 @@ unsigned long exynos_drm_gem_get_size(struct drm_device *dev,
struct drm_file *file_priv); struct drm_file *file_priv);
/* free gem object. */ /* free gem object. */
void exynos_drm_gem_free_object(struct drm_gem_object *gem_obj); void exynos_drm_gem_free_object(struct drm_gem_object *obj);
/* create memory region for drm framebuffer. */ /* create memory region for drm framebuffer. */
int exynos_drm_gem_dumb_create(struct drm_file *file_priv, int exynos_drm_gem_dumb_create(struct drm_file *file_priv,
......
...@@ -128,15 +128,14 @@ static int exynos_plane_atomic_check(struct drm_plane *plane, ...@@ -128,15 +128,14 @@ static int exynos_plane_atomic_check(struct drm_plane *plane,
nr = drm_format_num_planes(state->fb->pixel_format); nr = drm_format_num_planes(state->fb->pixel_format);
for (i = 0; i < nr; i++) { for (i = 0; i < nr; i++) {
struct exynos_drm_gem_obj *obj = struct exynos_drm_gem *exynos_gem =
exynos_drm_fb_gem_obj(state->fb, i); exynos_drm_fb_gem(state->fb, i);
if (!exynos_gem) {
if (!obj) {
DRM_DEBUG_KMS("gem object is null\n"); DRM_DEBUG_KMS("gem object is null\n");
return -EFAULT; return -EFAULT;
} }
exynos_plane->dma_addr[i] = obj->dma_addr + exynos_plane->dma_addr[i] = exynos_gem->dma_addr +
state->fb->offsets[i]; state->fb->offsets[i];
DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n", DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n",
......
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