summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vkms/vkms_plane.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2020-10-13 13:10:27 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2020-10-15 23:37:58 +0200
commit488c888ae1d4bb7121a2935b5f46aa65bbd62937 (patch)
treeab67fd2128b0a4fa7f1496c56a15a38a23b832d4 /drivers/gpu/drm/vkms/vkms_plane.c
parent063bc37d460990f8c9e6358bd6169809df09ccd3 (diff)
drm/vkms: Switch to shmem helpers
Inspired by a patch by Chris Wilson for vgem. Plus this gives us vmap at the gem bo level, which we need for generic fbdev emulation. Luckily shmem also tracks ->vaddr, so we just need to adjust the code all over a bit to make this fit. Also wire up handle_to_fd, dunno why that was missing. v2: - Drop now unused container_of #define (Melissa) - Make sure we keep creating cached objects, this is for testing (Thomas) Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Cc: Melissa Wen <melissa.srw@gmail.com> Cc: Haneen Mohammed <hamohammed.sa@gmail.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Melissa Wen <melissa.srw@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201013111027.375999-1-daniel.vetter@ffwll.ch
Diffstat (limited to 'drivers/gpu/drm/vkms/vkms_plane.c')
-rw-r--r--drivers/gpu/drm/vkms/vkms_plane.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 6d31265a2ab7..9890137bcb8d 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -5,6 +5,7 @@
#include <drm/drm_fourcc.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_plane_helper.h>
+#include <drm/drm_gem_shmem_helper.h>
#include "vkms_drv.h"
@@ -145,15 +146,15 @@ static int vkms_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *state)
{
struct drm_gem_object *gem_obj;
- int ret;
+ void *vaddr;
if (!state->fb)
return 0;
gem_obj = drm_gem_fb_get_obj(state->fb, 0);
- ret = vkms_gem_vmap(gem_obj);
- if (ret)
- DRM_ERROR("vmap failed: %d\n", ret);
+ vaddr = drm_gem_shmem_vmap(gem_obj);
+ if (IS_ERR(vaddr))
+ DRM_ERROR("vmap failed: %li\n", PTR_ERR(vaddr));
return drm_gem_fb_prepare_fb(plane, state);
}
@@ -162,12 +163,14 @@ static void vkms_cleanup_fb(struct drm_plane *plane,
struct drm_plane_state *old_state)
{
struct drm_gem_object *gem_obj;
+ struct drm_gem_shmem_object *shmem_obj;
if (!old_state->fb)
return;
gem_obj = drm_gem_fb_get_obj(old_state->fb, 0);
- vkms_gem_vunmap(gem_obj);
+ shmem_obj = to_drm_gem_shmem_obj(drm_gem_fb_get_obj(old_state->fb, 0));
+ drm_gem_shmem_vunmap(gem_obj, shmem_obj->vaddr);
}
static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = {