diff options
author | Daniel Stone <daniels@collabora.com> | 2018-03-30 16:11:15 +0200 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2018-05-18 15:52:18 +0200 |
commit | 9d7e70020c244940dc34f19b8d2da6b3f6516946 (patch) | |
tree | ec78b9ac54a798c6a4bb4c678239273c41bf0822 /drivers/gpu/drm/cirrus | |
parent | drm/panel: simple: Fix data type in KEO TX31D200VM0BAA timings (diff) | |
download | linux-9d7e70020c244940dc34f19b8d2da6b3f6516946.tar.xz linux-9d7e70020c244940dc34f19b8d2da6b3f6516946.zip |
drm/cirrus: Place GEM BOs in drm_framebuffer
Since drm_framebuffer can now store GEM objects directly, place them
there rather than in our own subclass. As this makes the framebuffer
create_handle and destroy functions the same as the GEM framebuffer
helper, we can reuse those.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Link: https://patchwork.freedesktop.org/patch/msgid/20180330141138.28987-1-daniels@collabora.com
Diffstat (limited to 'drivers/gpu/drm/cirrus')
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_fbdev.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_main.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/cirrus/cirrus_mode.c | 4 |
4 files changed, 10 insertions, 28 deletions
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.h b/drivers/gpu/drm/cirrus/cirrus_drv.h index be2d7e488062..70b23629be0a 100644 --- a/drivers/gpu/drm/cirrus/cirrus_drv.h +++ b/drivers/gpu/drm/cirrus/cirrus_drv.h @@ -119,7 +119,6 @@ struct cirrus_connector { struct cirrus_framebuffer { struct drm_framebuffer base; - struct drm_gem_object *obj; }; struct cirrus_mc { diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c index 32fbfba2c623..a74d32846958 100644 --- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c +++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c @@ -29,7 +29,7 @@ static void cirrus_dirty_update(struct cirrus_fbdev *afbdev, int x2, y2; unsigned long flags; - obj = afbdev->gfb.obj; + obj = afbdev->gfb.base.obj[0]; bo = gem_to_cirrus_bo(obj); /* @@ -250,9 +250,9 @@ static int cirrus_fbdev_destroy(struct drm_device *dev, drm_fb_helper_unregister_fbi(&gfbdev->helper); - if (gfb->obj) { - drm_gem_object_put_unlocked(gfb->obj); - gfb->obj = NULL; + if (gfb->base.obj[0]) { + drm_gem_object_put_unlocked(gfb->base.obj[0]); + gfb->base.obj[0] = NULL; } vfree(gfbdev->sysram); diff --git a/drivers/gpu/drm/cirrus/cirrus_main.c b/drivers/gpu/drm/cirrus/cirrus_main.c index 26df1e8cd490..f1ee4139ff19 100644 --- a/drivers/gpu/drm/cirrus/cirrus_main.c +++ b/drivers/gpu/drm/cirrus/cirrus_main.c @@ -10,30 +10,13 @@ */ #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include "cirrus_drv.h" -static int cirrus_create_handle(struct drm_framebuffer *fb, - struct drm_file* file_priv, - unsigned int* handle) -{ - struct cirrus_framebuffer *cirrus_fb = to_cirrus_framebuffer(fb); - - return drm_gem_handle_create(file_priv, cirrus_fb->obj, handle); -} - -static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb) -{ - struct cirrus_framebuffer *cirrus_fb = to_cirrus_framebuffer(fb); - - drm_gem_object_put_unlocked(cirrus_fb->obj); - drm_framebuffer_cleanup(fb); - kfree(fb); -} - static const struct drm_framebuffer_funcs cirrus_fb_funcs = { - .create_handle = cirrus_create_handle, - .destroy = cirrus_user_framebuffer_destroy, + .create_handle = drm_gem_fb_create_handle, + .destroy = drm_gem_fb_destroy, }; int cirrus_framebuffer_init(struct drm_device *dev, @@ -44,7 +27,7 @@ int cirrus_framebuffer_init(struct drm_device *dev, int ret; drm_helper_mode_fill_fb_struct(dev, &gfb->base, mode_cmd); - gfb->obj = obj; + gfb->base.obj[0] = obj; ret = drm_framebuffer_init(dev, &gfb->base, &cirrus_fb_funcs); if (ret) { DRM_ERROR("drm_framebuffer_init failed: %d\n", ret); diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index c91b9b054e3f..91b9c42013ff 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c @@ -110,7 +110,7 @@ static int cirrus_crtc_do_set_base(struct drm_crtc *crtc, /* push the previous fb to system ram */ if (!atomic && fb) { cirrus_fb = to_cirrus_framebuffer(fb); - obj = cirrus_fb->obj; + obj = cirrus_fb->base.obj[0]; bo = gem_to_cirrus_bo(obj); ret = cirrus_bo_reserve(bo, false); if (ret) @@ -120,7 +120,7 @@ static int cirrus_crtc_do_set_base(struct drm_crtc *crtc, } cirrus_fb = to_cirrus_framebuffer(crtc->primary->fb); - obj = cirrus_fb->obj; + obj = cirrus_fb->base.obj[0]; bo = gem_to_cirrus_bo(obj); ret = cirrus_bo_reserve(bo, false); |