Commit 019d96cb55ade38a4b4a52bba0304e8cd681f30a

Authored by Dave Airlie
1 parent 466e69b8b0

drm: add some caps for userspace to discover more info for dumb KMS driver (v2)

For the simple KMS driver case we need some more info about what the preferred
depth and if a shadow framebuffer is preferred.

I've only added this for intel/radeon which support the dumb ioctls so far.

If you need something really fancy you should be writing a real X.org driver.

v2: drop cursor information, just return an error from the cursor ioctls
and we can make userspace fallback to sw cursor in that case, cursor
info was getting too messy, best to start smaller.

Signed-off-by: Dave Airlie <airlied@redhat.com>

Showing 5 changed files with 17 additions and 0 deletions Side-by-side Diff

drivers/gpu/drm/drm_ioctl.c
... ... @@ -277,6 +277,12 @@
277 277 case DRM_CAP_VBLANK_HIGH_CRTC:
278 278 req->value = 1;
279 279 break;
  280 + case DRM_CAP_DUMB_PREFERRED_DEPTH:
  281 + req->value = dev->mode_config.preferred_depth;
  282 + break;
  283 + case DRM_CAP_DUMB_PREFER_SHADOW:
  284 + req->value = dev->mode_config.prefer_shadow;
  285 + break;
280 286 default:
281 287 return -EINVAL;
282 288 }
drivers/gpu/drm/i915/intel_display.c
... ... @@ -9089,6 +9089,9 @@
9089 9089 dev->mode_config.min_width = 0;
9090 9090 dev->mode_config.min_height = 0;
9091 9091  
  9092 + dev->mode_config.preferred_depth = 24;
  9093 + dev->mode_config.prefer_shadow = 1;
  9094 +
9092 9095 dev->mode_config.funcs = (void *)&intel_mode_funcs;
9093 9096  
9094 9097 intel_init_quirks(dev);
drivers/gpu/drm/radeon/radeon_display.c
... ... @@ -1240,6 +1240,9 @@
1240 1240 rdev->ddev->mode_config.max_height = 4096;
1241 1241 }
1242 1242  
  1243 + rdev->ddev->mode_config.preferred_depth = 24;
  1244 + rdev->ddev->mode_config.prefer_shadow = 1;
  1245 +
1243 1246 rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
1244 1247  
1245 1248 ret = radeon_modeset_create_props(rdev);
... ... @@ -761,6 +761,8 @@
761 761  
762 762 #define DRM_CAP_DUMB_BUFFER 0x1
763 763 #define DRM_CAP_VBLANK_HIGH_CRTC 0x2
  764 +#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
  765 +#define DRM_CAP_DUMB_PREFER_SHADOW 0x4
764 766  
765 767 /* typedef area */
766 768 #ifndef __KERNEL__
include/drm/drm_crtc.h
... ... @@ -796,6 +796,9 @@
796 796 struct drm_property *scaling_mode_property;
797 797 struct drm_property *dithering_mode_property;
798 798 struct drm_property *dirty_info_property;
  799 +
  800 + /* dumb ioctl parameters */
  801 + uint32_t preferred_depth, prefer_shadow;
799 802 };
800 803  
801 804 #define obj_to_crtc(x) container_of(x, struct drm_crtc, base)