diff mbox

drm: Allow CAP_PRIME on !MODESET

Message ID 20161207144939.22756-1-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Dec. 7, 2016, 2:49 p.m. UTC
vgem (and our igt tests using vgem) need this. I suspect etnaviv will
fare similarly.

v2. Make it build. Oops.

Fixes: d5264ed3823a ("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: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_ioctl.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Comments

Michel Dänzer Dec. 7, 2016, 3:05 p.m. UTC | #1
On 07/12/16 11:49 PM, Daniel Vetter wrote:
> vgem (and our igt tests using vgem) need this. I suspect etnaviv will
> fare similarly.
> 
> v2. Make it build. Oops.
> 
> Fixes: d5264ed3823a ("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: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Thanks Daniel, and sorry I missed this, guess I was thinking of !MODESET
too much in terms of UMS and too little in terms of render-only drivers.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Daniel Vetter Dec. 8, 2016, 9 a.m. UTC | #2
On Thu, Dec 08, 2016 at 12:05:48AM +0900, Michel Dänzer wrote:
> On 07/12/16 11:49 PM, Daniel Vetter wrote:
> > vgem (and our igt tests using vgem) need this. I suspect etnaviv will
> > fare similarly.
> > 
> > v2. Make it build. Oops.
> > 
> > Fixes: d5264ed3823a ("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: Chris Wilson <chris@chris-wilson.co.uk>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> 
> Thanks Daniel, and sorry I missed this, guess I was thinking of !MODESET
> too much in terms of UMS and too little in terms of render-only drivers.
> 
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

Thanks for the review, applied to drm-misc.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 0a900bd4575d..a16b6fbd1004 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -234,10 +234,15 @@  static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 
 	req->value = 0;
 
-	/* Only one cap makes sense with a UMS driver: */
-	if (req->capability == DRM_CAP_TIMESTAMP_MONOTONIC) {
+	/* Only some caps make sense with UMS/render-only drivers. */
+	switch (req->capability) {
+	case DRM_CAP_TIMESTAMP_MONOTONIC:
 		req->value = drm_timestamp_monotonic;
 		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 */
@@ -258,10 +263,6 @@  static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
 	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;
 	case DRM_CAP_ASYNC_PAGE_FLIP:
 		req->value = dev->mode_config.async_page_flip;
 		break;