drm: add some caps for userspace to discover more info for dumb KMS driver (v2)
authorDave Airlie <airlied@redhat.com>
Thu, 29 Sep 2011 15:20:42 +0000 (16:20 +0100)
committerDave Airlie <airlied@redhat.com>
Thu, 16 Feb 2012 18:35:11 +0000 (18:35 +0000)
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>
drivers/gpu/drm/drm_ioctl.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/radeon/radeon_display.c
include/drm/drm.h
include/drm/drm_crtc.h

index 2300ab1a2a776beca1098bda07fc812c191d99b4..cf85155da2a00be52738f4ef9c2e2002b6bf378c 100644 (file)
@@ -277,6 +277,12 @@ int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
        case DRM_CAP_VBLANK_HIGH_CRTC:
                req->value = 1;
                break;
+       case DRM_CAP_DUMB_PREFERRED_DEPTH:
+               req->value = dev->mode_config.preferred_depth;
+               break;
+       case DRM_CAP_DUMB_PREFER_SHADOW:
+               req->value = dev->mode_config.prefer_shadow;
+               break;
        default:
                return -EINVAL;
        }
index dfa67449827ac2e6771a3bb598ace10ef888721f..0a8a640d36ef23c391ed31723ab5b1d1f8312d78 100644 (file)
@@ -9089,6 +9089,9 @@ void intel_modeset_init(struct drm_device *dev)
        dev->mode_config.min_width = 0;
        dev->mode_config.min_height = 0;
 
+       dev->mode_config.preferred_depth = 24;
+       dev->mode_config.prefer_shadow = 1;
+
        dev->mode_config.funcs = (void *)&intel_mode_funcs;
 
        intel_init_quirks(dev);
index 5515f1054b29331324bdc15c2b27d4ea6c82fe0a..7cb062daa71ea1d6352226d7cbf213fee0f2ea13 100644 (file)
@@ -1240,6 +1240,9 @@ int radeon_modeset_init(struct radeon_device *rdev)
                rdev->ddev->mode_config.max_height = 4096;
        }
 
+       rdev->ddev->mode_config.preferred_depth = 24;
+       rdev->ddev->mode_config.prefer_shadow = 1;
+
        rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
 
        ret = radeon_modeset_create_props(rdev);
index 49d94ede2ec2bc2612271c5a7f046c4d568802a9..34a7b89fd0069841463e8089da0b03eb96bfa5b4 100644 (file)
@@ -761,6 +761,8 @@ struct drm_event_vblank {
 
 #define DRM_CAP_DUMB_BUFFER 0x1
 #define DRM_CAP_VBLANK_HIGH_CRTC 0x2
+#define DRM_CAP_DUMB_PREFERRED_DEPTH 0x3
+#define DRM_CAP_DUMB_PREFER_SHADOW 0x4
 
 /* typedef area */
 #ifndef __KERNEL__
index 823531454799a3ea54bc81bb37cc45d8e5bf9906..2a0872cac333856bf20459060135b9ff4c0e0e80 100644 (file)
@@ -796,6 +796,9 @@ struct drm_mode_config {
        struct drm_property *scaling_mode_property;
        struct drm_property *dithering_mode_property;
        struct drm_property *dirty_info_property;
+
+       /* dumb ioctl parameters */
+       uint32_t preferred_depth, prefer_shadow;
 };
 
 #define obj_to_crtc(x) container_of(x, struct drm_crtc, base)