Skip to content

Instantly share code, notes, and snippets.

@dvdhrm
Created Nov 26, 2016
Embed
What would you like to do?
diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 0ad2c47..e32c590 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -225,6 +225,7 @@ static int drm_getstats(struct drm_device *dev, void *data,
*/
static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
{
+ bool is_kms = drm_core_check_feature(dev, DRIVER_MODESET);
struct drm_get_cap *req = data;
struct drm_crtc *crtc;
@@ -238,10 +239,12 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
req->value = 1;
break;
case DRM_CAP_DUMB_PREFERRED_DEPTH:
- req->value = dev->mode_config.preferred_depth;
+ if (is_kms)
+ req->value = dev->mode_config.preferred_depth;
break;
case DRM_CAP_DUMB_PREFER_SHADOW:
- req->value = dev->mode_config.prefer_shadow;
+ if (is_kms)
+ 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;
@@ -251,29 +254,37 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_
req->value = drm_timestamp_monotonic;
break;
case DRM_CAP_ASYNC_PAGE_FLIP:
- req->value = dev->mode_config.async_page_flip;
+ if (is_kms)
+ req->value = dev->mode_config.async_page_flip;
break;
case DRM_CAP_PAGE_FLIP_TARGET:
- req->value = 1;
- drm_for_each_crtc(crtc, dev) {
- if (!crtc->funcs->page_flip_target)
- req->value = 0;
+ if (is_kms) {
+ req->value = 1;
+ drm_for_each_crtc(crtc, dev) {
+ if (!crtc->funcs->page_flip_target)
+ req->value = 0;
+ }
}
break;
case DRM_CAP_CURSOR_WIDTH:
- if (dev->mode_config.cursor_width)
- req->value = dev->mode_config.cursor_width;
- else
- req->value = 64;
+ if (is_kms) {
+ if (dev->mode_config.cursor_width)
+ req->value = dev->mode_config.cursor_width;
+ else
+ req->value = 64;
+ }
break;
case DRM_CAP_CURSOR_HEIGHT:
- if (dev->mode_config.cursor_height)
- req->value = dev->mode_config.cursor_height;
- else
- req->value = 64;
- break;
+ if (is_kms) {
+ if (dev->mode_config.cursor_height)
+ req->value = dev->mode_config.cursor_height;
+ else
+ req->value = 64;
+ break;
+ }
case DRM_CAP_ADDFB2_MODIFIERS:
- req->value = dev->mode_config.allow_fb_modifiers;
+ if (is_kms)
+ req->value = dev->mode_config.allow_fb_modifiers;
break;
default:
return -EINVAL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment