Skip to contentSkip to conversation

drm/cirrus: implement create_handle for framebuffers

PATCH New Nicholas Bishop 1 participant 1 message May 18, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/cirrus: implement create_handle for framebuffers

This fixes the DRM_IOCTL_MODE_GETFB ioctl for cirrus so that it returns an actual handle instead of failing with ENODEV.

Tested in a QEMU VM with "-vga cirrus" by running this script:

https://chromium.googlesource.com/chromiumos/third_party/autotest/+/master/client/bin/screenshot.py

Implementation cargo-culted from radeon_user_framebuffer_create_handle().

---
 drivers/gpu/drm/cirrus/cirrus_main.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/gpu/drm/cirrus/cirrus_main.c +10 -0
index e7fc95f..2b0b27b 100644
@@ -23,8 +23,18 @@ static void cirrus_user_framebuffer_destroy(struct drm_framebuffer *fb)
 	kfree(fb);
 }
 
+static int cirrus_user_framebuffer_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 const struct drm_framebuffer_funcs cirrus_fb_funcs = {
 	.destroy = cirrus_user_framebuffer_destroy,
+	.create_handle = cirrus_user_framebuffer_create_handle,
 };
 
 int cirrus_framebuffer_init(struct drm_device *dev,
Signature · 6 lines
2.9.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel