aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2010-05-12 12:01:13 -0400
committerDave Airlie <airlied@redhat.com>2010-05-18 01:59:08 -0400
commitbc35afdb182d4c48c889fe27ba7a5d7ea0c8194d (patch)
tree0e8f87e31a8a979a9c1a3090f9bf9d906981afa6
parent61dd98fad58f945ed720ba132681acb58fcee015 (diff)
drm/radeon/kms: add query for crtc hw id from crtc id to get info V2
Userspace need to know the hw crtc id (0, 1, 2, ...) from the drm crtc id. Bump the minor version so userspace can enable conditionaly features depend on this. V2 use num_crtc and avoid DRM_ERROR Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_kms.c18
-rw-r--r--include/drm/radeon_drm.h1
3 files changed, 21 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 4b05563d99e1..6e22815f7f07 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -44,9 +44,10 @@
44 * - 2.1.0 - add square tiling interface 44 * - 2.1.0 - add square tiling interface
45 * - 2.2.0 - add r6xx/r7xx const buffer support 45 * - 2.2.0 - add r6xx/r7xx const buffer support
46 * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs 46 * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs
47 * - 2.4.0 - add crtc id query
47 */ 48 */
48#define KMS_DRIVER_MAJOR 2 49#define KMS_DRIVER_MAJOR 2
49#define KMS_DRIVER_MINOR 3 50#define KMS_DRIVER_MINOR 4
50#define KMS_DRIVER_PATCHLEVEL 0 51#define KMS_DRIVER_PATCHLEVEL 0
51int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags); 52int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
52int radeon_driver_unload_kms(struct drm_device *dev); 53int radeon_driver_unload_kms(struct drm_device *dev);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index d3657dcfdd26..021572a3dd9c 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -98,11 +98,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
98{ 98{
99 struct radeon_device *rdev = dev->dev_private; 99 struct radeon_device *rdev = dev->dev_private;
100 struct drm_radeon_info *info; 100 struct drm_radeon_info *info;
101 struct radeon_mode_info *minfo = &rdev->mode_info;
101 uint32_t *value_ptr; 102 uint32_t *value_ptr;
102 uint32_t value; 103 uint32_t value;
104 struct drm_crtc *crtc;
105 int i, found;
103 106
104 info = data; 107 info = data;
105 value_ptr = (uint32_t *)((unsigned long)info->value); 108 value_ptr = (uint32_t *)((unsigned long)info->value);
109 value = *value_ptr;
106 switch (info->request) { 110 switch (info->request) {
107 case RADEON_INFO_DEVICE_ID: 111 case RADEON_INFO_DEVICE_ID:
108 value = dev->pci_device; 112 value = dev->pci_device;
@@ -116,6 +120,20 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
116 case RADEON_INFO_ACCEL_WORKING: 120 case RADEON_INFO_ACCEL_WORKING:
117 value = rdev->accel_working; 121 value = rdev->accel_working;
118 break; 122 break;
123 case RADEON_INFO_CRTC_FROM_ID:
124 for (i = 0, found = 0; i < rdev->num_crtc; i++) {
125 crtc = (struct drm_crtc *)minfo->crtcs[i];
126 if (crtc && crtc->base.id == value) {
127 value = i;
128 found = 1;
129 break;
130 }
131 }
132 if (!found) {
133 DRM_DEBUG("unknown crtc id %d\n", value);
134 return -EINVAL;
135 }
136 break;
119 default: 137 default:
120 DRM_DEBUG("Invalid request %d\n", info->request); 138 DRM_DEBUG("Invalid request %d\n", info->request);
121 return -EINVAL; 139 return -EINVAL;
diff --git a/include/drm/radeon_drm.h b/include/drm/radeon_drm.h
index 81e614bf2dc3..3ff9fc071dfe 100644
--- a/include/drm/radeon_drm.h
+++ b/include/drm/radeon_drm.h
@@ -902,6 +902,7 @@ struct drm_radeon_cs {
902#define RADEON_INFO_NUM_GB_PIPES 0x01 902#define RADEON_INFO_NUM_GB_PIPES 0x01
903#define RADEON_INFO_NUM_Z_PIPES 0x02 903#define RADEON_INFO_NUM_Z_PIPES 0x02
904#define RADEON_INFO_ACCEL_WORKING 0x03 904#define RADEON_INFO_ACCEL_WORKING 0x03
905#define RADEON_INFO_CRTC_FROM_ID 0x04
905 906
906struct drm_radeon_info { 907struct drm_radeon_info {
907 uint32_t request; 908 uint32_t request;