[PATCH 2/2] drm: Return -ENOTSUPP when called for KMS cap with a non-KMS driver
Michel Dänzer
michel at daenzer.net
Wed Nov 30 08:30:02 UTC 2016
From: Michel Dänzer <michel.daenzer at amd.com>
This is an attempt to make the previous fix a bit more robust going
forward.
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
drivers/gpu/drm/drm_ioctl.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 71c3473..32f484b 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -229,6 +229,19 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
struct drm_crtc *crtc;
req->value = 0;
+
+ /* Only allow non-KMS caps with non-KMS drivers */
+ switch (req->capability) {
+ case DRM_CAP_DUMB_BUFFER:
+ case DRM_CAP_VBLANK_HIGH_CRTC:
+ case DRM_CAP_PRIME:
+ case DRM_CAP_TIMESTAMP_MONOTONIC:
+ break;
+ default:
+ if (!drm_core_check_feature(dev, DRIVER_MODESET))
+ return -ENOTSUPP;
+ }
+
switch (req->capability) {
case DRM_CAP_DUMB_BUFFER:
if (dev->driver->dumb_create)
@@ -254,12 +267,10 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
req->value = dev->mode_config.async_page_flip;
break;
case DRM_CAP_PAGE_FLIP_TARGET:
- if (drm_core_check_feature(dev, DRIVER_MODESET)) {
- req->value = 1;
- drm_for_each_crtc(crtc, dev) {
- if (!crtc->funcs->page_flip_target)
- req->value = 0;
- }
+ req->value = 1;
+ drm_for_each_crtc(crtc, dev) {
+ if (!crtc->funcs->page_flip_target)
+ req->value = 0;
}
break;
case DRM_CAP_CURSOR_WIDTH:
--
2.10.2
More information about the dri-devel
mailing list