forked from Minki/linux
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: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
This commit is contained in:
parent
3aa2a5c140
commit
e978de5495
@ -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);
|
||||
struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER];
|
||||
struct drm_gem_object *obj;
|
||||
struct drm_framebuffer *fb;
|
||||
int i;
|
||||
int ret;
|
||||
@ -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] +
|
||||
mode_cmd->offsets[i];
|
||||
|
||||
obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[i]);
|
||||
if (!obj) {
|
||||
exynos_gem[i] = exynos_drm_gem_get(file_priv,
|
||||
mode_cmd->handles[i]);
|
||||
if (!exynos_gem[i]) {
|
||||
DRM_ERROR("failed to lookup gem object\n");
|
||||
ret = -ENOENT;
|
||||
goto err;
|
||||
}
|
||||
|
||||
exynos_gem[i] = to_exynos_gem(obj);
|
||||
|
||||
if (size > exynos_gem[i]->size) {
|
||||
i++;
|
||||
ret = -EINVAL;
|
||||
@ -138,7 +136,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
|
||||
|
||||
err:
|
||||
while (i--)
|
||||
drm_gem_object_put_unlocked(&exynos_gem[i]->base);
|
||||
exynos_drm_gem_put(exynos_gem[i]);
|
||||
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
@ -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 :
|
||||
DIV_ROUND_UP(buf->buf.height, buf->format->vsub);
|
||||
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]);
|
||||
if (!obj) {
|
||||
if (!gem) {
|
||||
ret = -ENOENT;
|
||||
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) {
|
||||
i++;
|
||||
@ -370,7 +370,7 @@ static int exynos_drm_ipp_task_setup_buffer(struct exynos_drm_ipp_buffer *buf,
|
||||
return 0;
|
||||
gem_free:
|
||||
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;
|
||||
}
|
||||
return ret;
|
||||
@ -383,7 +383,7 @@ static void exynos_drm_ipp_task_release_buf(struct exynos_drm_ipp_buffer *buf)
|
||||
if (!buf->exynos_gem[0])
|
||||
return;
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user