Skip to contentSkip to conversation

drm/prime: expose capability flags for userspace.

PATCH In review Dave Airlie 2 participants 2 messages Apr 2, 2012 – Apr 3, 2012

Subsystems (2)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 drm/prime: expose capability flags for userspace.

From: Dave Airlie <[email protected]>

This lets the kernel tell userspace if the device supports prime import/export.

This is useful for -modesetting at least, but would be nice for other drivers.

---
 drivers/gpu/drm/drm_ioctl.c |    4 ++++
 include/drm/drm.h           |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/gpu/drm/drm_ioctl.c +4 -0
index cf85155..64a62c6 100644
@@ -283,6 +283,10 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
 	case DRM_CAP_DUMB_PREFER_SHADOW:
 		req->value = dev->mode_config.prefer_shadow;
 		break;
+	case DRM_CAP_PRIME:
+		req->value |= dev->driver->prime_fd_to_handle ? DRM_PRIME_CAP_IMPORT : 0;
+		req->value |= dev->driver->prime_handle_to_fd ? DRM_PRIME_CAP_EXPORT : 0;
+		break;
 	default:
 		return -EINVAL;
 	}
include/drm/drm.h +4 -0
index 64ff02d..34d6335 100644
@@ -775,6 +775,10 @@ struct drm_event_vblank {
 #define DRM_CAP_VBLANK_HIGH_CRTC 0x2
 #define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
 #define DRM_CAP_DUMB_PREFER_SHADOW 0x4
+#define DRM_CAP_PRIME 0x5
+
+#define DRM_PRIME_CAP_IMPORT 0x1
+#define DRM_PRIME_CAP_EXPORT 0x2
 
 /* typedef area */
 #ifndef __KERNEL__
Signature · 1 line
1.7.7.6