Commit f3f4c4d6 authored by Daniel Vetter's avatar Daniel Vetter

drm: Allow CAP_PRIME on !MODESET

vgem (and our igt tests using vgem) need this. I suspect etnaviv will
fare similarly.

v2. Make it build. Oops.

Fixes: d5264ed3 ("drm: Return -ENOTSUPP when called for KMS cap with a non-KMS driver")
Cc: Michel Dänzer <michel.daenzer@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMichel Dänzer <michel.daenzer@amd.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20161207144939.22756-1-daniel.vetter@ffwll.ch
parent 35f8cc3b
...@@ -230,10 +230,15 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ ...@@ -230,10 +230,15 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
req->value = 0; req->value = 0;
/* Only one cap makes sense with a UMS driver: */ /* Only some caps make sense with UMS/render-only drivers. */
if (req->capability == DRM_CAP_TIMESTAMP_MONOTONIC) { switch (req->capability) {
case DRM_CAP_TIMESTAMP_MONOTONIC:
req->value = drm_timestamp_monotonic; req->value = drm_timestamp_monotonic;
return 0; return 0;
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;
return 0;
} }
/* Other caps only work with KMS drivers */ /* Other caps only work with KMS drivers */
...@@ -254,10 +259,6 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ ...@@ -254,10 +259,6 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
case DRM_CAP_DUMB_PREFER_SHADOW: case DRM_CAP_DUMB_PREFER_SHADOW:
req->value = dev->mode_config.prefer_shadow; req->value = dev->mode_config.prefer_shadow;
break; 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;
case DRM_CAP_ASYNC_PAGE_FLIP: case DRM_CAP_ASYNC_PAGE_FLIP:
req->value = dev->mode_config.async_page_flip; req->value = dev->mode_config.async_page_flip;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment