Commit e978de54 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Inki Dae

drm/exynos: Use common exynos_drm_gem_get()/put() functions for GEM lookup

Use recently introduced common helpers to unify GEM handling code.
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 3aa2a5c1
...@@ -101,7 +101,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, ...@@ -101,7 +101,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
{ {
const struct drm_format_info *info = drm_get_format_info(dev, mode_cmd); const struct drm_format_info *info = drm_get_format_info(dev, mode_cmd);
struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER]; struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER];
struct drm_gem_object *obj;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
int i; int i;
int ret; int ret;
...@@ -112,15 +111,14 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, ...@@ -112,15 +111,14 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
unsigned long size = height * mode_cmd->pitches[i] + unsigned long size = height * mode_cmd->pitches[i] +
mode_cmd->offsets[i]; mode_cmd->offsets[i];
obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[i]); exynos_gem[i] = exynos_drm_gem_get(file_priv,
if (!obj) { mode_cmd->handles[i]);
if (!exynos_gem[i]) {
DRM_ERROR("failed to lookup gem object\n"); DRM_ERROR("failed to lookup gem object\n");
ret = -ENOENT; ret = -ENOENT;
goto err; goto err;
} }
exynos_gem[i] = to_exynos_gem(obj);
if (size > exynos_gem[i]->size) { if (size > exynos_gem[i]->size) {
i++; i++;
ret = -EINVAL; ret = -EINVAL;
...@@ -138,7 +136,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, ...@@ -138,7 +136,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
err: err:
while (i--) while (i--)
drm_gem_object_put_unlocked(&exynos_gem[i]->base); exynos_drm_gem_put(exynos_gem[i]);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
......
...@@ -350,13 +350,13 @@ static int exynos_drm_ipp_task_setup_buffer(struct exynos_drm_ipp_buffer *buf, ...@@ -350,13 +350,13 @@ static int exynos_drm_ipp_task_setup_buffer(struct exynos_drm_ipp_buffer *buf,
unsigned int height = (i == 0) ? buf->buf.height : unsigned int height = (i == 0) ? buf->buf.height :
DIV_ROUND_UP(buf->buf.height, buf->format->vsub); DIV_ROUND_UP(buf->buf.height, buf->format->vsub);
unsigned long size = height * buf->buf.pitch[i]; unsigned long size = height * buf->buf.pitch[i];
struct drm_gem_object *obj = drm_gem_object_lookup(filp, struct exynos_drm_gem *gem = exynos_drm_gem_get(filp,
buf->buf.gem_id[i]); buf->buf.gem_id[i]);
if (!obj) { if (!gem) {
ret = -ENOENT; ret = -ENOENT;
goto gem_free; goto gem_free;
} }
buf->exynos_gem[i] = to_exynos_gem(obj); buf->exynos_gem[i] = gem;
if (size + buf->buf.offset[i] > buf->exynos_gem[i]->size) { if (size + buf->buf.offset[i] > buf->exynos_gem[i]->size) {
i++; i++;
...@@ -370,7 +370,7 @@ static int exynos_drm_ipp_task_setup_buffer(struct exynos_drm_ipp_buffer *buf, ...@@ -370,7 +370,7 @@ static int exynos_drm_ipp_task_setup_buffer(struct exynos_drm_ipp_buffer *buf,
return 0; return 0;
gem_free: gem_free:
while (i--) { while (i--) {
drm_gem_object_put_unlocked(&buf->exynos_gem[i]->base); exynos_drm_gem_put(buf->exynos_gem[i]);
buf->exynos_gem[i] = NULL; buf->exynos_gem[i] = NULL;
} }
return ret; return ret;
...@@ -383,7 +383,7 @@ static void exynos_drm_ipp_task_release_buf(struct exynos_drm_ipp_buffer *buf) ...@@ -383,7 +383,7 @@ static void exynos_drm_ipp_task_release_buf(struct exynos_drm_ipp_buffer *buf)
if (!buf->exynos_gem[0]) if (!buf->exynos_gem[0])
return; return;
for (i = 0; i < buf->format->num_planes; i++) for (i = 0; i < buf->format->num_planes; i++)
drm_gem_object_put_unlocked(&buf->exynos_gem[i]->base); exynos_drm_gem_put(buf->exynos_gem[i]);
} }
static void exynos_drm_ipp_task_free(struct exynos_drm_ipp *ipp, static void exynos_drm_ipp_task_free(struct exynos_drm_ipp *ipp,
......
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