drm/prime: expose capability flags for userspace.
authorDave Airlie <airlied@redhat.com>
Mon, 2 Apr 2012 13:11:50 +0000 (14:11 +0100)
committerDave Airlie <airlied@redhat.com>
Fri, 18 May 2012 10:12:16 +0000 (11:12 +0100)
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.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_ioctl.c
include/drm/drm.h

index cf85155da2a00be52738f4ef9c2e2002b6bf378c..64a62c6973138f71a0627ec6e9a87c129d6e963e 100644 (file)
@@ -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;
        }
index 5b831df15bf1047ca6326a6baa76a19f539a4e95..e51035a3757f476cf4775d91ce5c7e57f53c5222 100644 (file)
@@ -777,6 +777,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__