Skip to content

Commit

Permalink
drm/exynos: Keep a reference to frame buffer GEM objects
Browse files Browse the repository at this point in the history
GEM objects used by frame buffers must be referenced for the whole life
of the frame buffer. Release the references in the frame buffer
destructor instead of its constructor.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
  • Loading branch information
Laurent Pinchart authored and Inki Dae committed Jun 5, 2012
1 parent 6037baf commit 07b6835
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions drivers/gpu/drm/exynos/exynos_drm_fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,22 @@ struct exynos_drm_fb {
static void exynos_drm_fb_destroy(struct drm_framebuffer *fb)
{
struct exynos_drm_fb *exynos_fb = to_exynos_fb(fb);
unsigned int i;

DRM_DEBUG_KMS("%s\n", __FILE__);

drm_framebuffer_cleanup(fb);

for (i = 0; i < ARRAY_SIZE(exynos_fb->exynos_gem_obj); i++) {
struct drm_gem_object *obj;

if (exynos_fb->exynos_gem_obj[i] == NULL)
continue;

obj = &exynos_fb->exynos_gem_obj[i]->base;
drm_gem_object_unreference_unlocked(obj);
}

kfree(exynos_fb);
exynos_fb = NULL;
}
Expand Down Expand Up @@ -134,11 +145,11 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
return ERR_PTR(-ENOENT);
}

drm_gem_object_unreference_unlocked(obj);

fb = exynos_drm_framebuffer_init(dev, mode_cmd, obj);
if (IS_ERR(fb))
if (IS_ERR(fb)) {
drm_gem_object_unreference_unlocked(obj);
return fb;
}

exynos_fb = to_exynos_fb(fb);
nr = exynos_drm_format_num_buffers(fb->pixel_format);
Expand All @@ -152,8 +163,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
return ERR_PTR(-ENOENT);
}

drm_gem_object_unreference_unlocked(obj);

exynos_fb->exynos_gem_obj[i] = to_exynos_gem_obj(obj);
}

Expand Down

0 comments on commit 07b6835

Please sign in to comment.