Skip to contentSkip to conversation

drm/radeon/kms: add query for crtc hw id from crtc id to get info V2

PATCH In review Jerome Glisse 2 participants 2 messages May 12, 2010 – May 19, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 drivers/gpu/drm/radeon/radeon_drv.c |    3 ++-
 drivers/gpu/drm/radeon/radeon_kms.c |   18 ++++++++++++++++++
 include/drm/radeon_drm.h            |    1 +
 3 files changed, 21 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +2 -1
index b3749d4..df96ace 100644
@@ -44,9 +44,10 @@
  * - 2.1.0 - add square tiling interface
  * - 2.2.0 - add r6xx/r7xx const buffer support
  * - 2.3.0 - add MSPOS + 3D texture + r500 VAP regs
+ * - 2.4.0 - add crtc id query
  */
 #define KMS_DRIVER_MAJOR	2
-#define KMS_DRIVER_MINOR	3
+#define KMS_DRIVER_MINOR	4
 #define KMS_DRIVER_PATCHLEVEL	0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);
drivers/gpu/drm/radeon/radeon_kms.c +18 -0
index d3657dc..9df2427 100644
@@ -98,11 +98,15 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 {
 	struct radeon_device *rdev = dev->dev_private;
 	struct drm_radeon_info *info;
+	struct radeon_mode_info *minfo = &rdev->mode_info;
 	uint32_t *value_ptr;
 	uint32_t value;
+	struct drm_crtc *crtc;
+	int i, found;
 
 	info = data;
 	value_ptr = (uint32_t *)((unsigned long)info->value);
+	value = *value_ptr;
 	switch (info->request) {
 	case RADEON_INFO_DEVICE_ID:
 		value = dev->pci_device;
@@ -116,6 +120,20 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 	case RADEON_INFO_ACCEL_WORKING:
 		value = rdev->accel_working;
 		break;
+	case RADEON_INFO_CRTC_FROM_ID:
+		for (i = 0, found = 0; i < rdev->num_crtc; i++) {
+			crtc = (struct drm_crtc *)minfo->crtcs[i];
+			if (crtc && crtc->base.id == value) {
+				value = i;
+				found = 1;
+				break;
+			}
+		}
+		if (!found) {
+			DRM_INFO("unknown crtc id %d\n", value);
+			return -EINVAL;
+		}
+		break;
 	default:
 		DRM_DEBUG("Invalid request %d\n", info->request);
 		return -EINVAL;
include/drm/radeon_drm.h +1 -0
index 81e614b..3ff9fc0 100644
@@ -902,6 +902,7 @@ struct drm_radeon_cs {
 #define RADEON_INFO_NUM_GB_PIPES	0x01
 #define RADEON_INFO_NUM_Z_PIPES 	0x02
 #define RADEON_INFO_ACCEL_WORKING	0x03
+#define RADEON_INFO_CRTC_FROM_ID	0x04
 
 struct drm_radeon_info {
 	uint32_t		request;
Signature · 1 line
1.7.0.1
#1 lore raw
Quoted 7 lines · Jerome Glisse

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

Running compiz with this and the corresponding X changes kills my kernel rather quickly (a matter of minutes if not seconds), see below.

[  824.232844] kernel BUG at drivers/gpu/drm/ttm/ttm_bo.c:192!
[  824.232864] Oops: Exception in kernel mode, sig: 5 [#1]
[  824.232876] PowerMac
[  824.232886] last sysfs file: /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
[  824.232898] Modules linked in: netconsole configfs cpufreq_stats sco bnep rfcomm l2cap binfmt_misc fuse ipv6 hfs therm_adt746x pmu_battery snd_aoa_codec_onyx snd_aoa_fabric_layout snd_aoa snd_aoa_i2sbus snd_pcm snd_page_alloc snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event arc4 snd_seq ecb b43 mac80211 snd_timer snd_seq_device btusb cfg80211 snd bluetooth sg joydev rfkill rtc_generic soundcore rtc_core firewire_ohci sungem pmac_zilog sr_mod serial_core snd_aoa_soundbus rtc_lib appletouch evdev firewire_core sungem_phy ssb cdrom crc_itu_t
[  824.233302] NIP: c0228ae4 LR: c0228ad4 CTR: c025e618
[  824.233318] REGS: ebda9d00 TRAP: 0700   Tainted: G        W   (2.6.34)
[  824.233328] MSR: 00029032 <EE,ME,CE,IR,DR>  CR: 24084844  XER: 00000000
[  824.233389] TASK = ee55be70[3200] 'compiz' THREAD: ebda8000
[  824.233402] GPR00: 00000001 ebda9db0 ee55be70 ef9bc138 ffffffff 00000000 00000000 c0646420 
[  824.233462] GPR08: c08c40c0 dead4ead ef8fc400 0000000c 24084848 10052ddc 00000001 00000000 
[  824.233523] GPR16: 1004ae50 1004ae54 1004af24 10037248 1004ae04 1004ae00 deadbeef 108e8020 
[  824.233586] GPR24: c0272bd8 c05e80ec ebda9e00 ebdff480 00000000 ee760720 ebdff430 ef9bc138 
[  824.233851] NIP [c0228ae4] ttm_bo_unreserve+0x3c/0x110
[  824.233864] LR [c0228ad4] ttm_bo_unreserve+0x2c/0x110
[  824.233875] Call Trace:
[  824.233889] [ebda9db0] [c0228ad4] ttm_bo_unreserve+0x2c/0x110 (unreliable)
[  824.233923] [ebda9dd0] [c0272cb4] radeon_gem_wait_idle_ioctl+0xdc/0x134
[  824.233951] [ebda9df0] [c02146f8] drm_ioctl+0x26c/0x3a4
[  824.233975] [ebda9ea0] [c00f4bf8] vfs_ioctl+0x34/0x80
[  824.233995] [ebda9eb0] [c00f53ec] do_vfs_ioctl+0x670/0x714
[  824.234015] [ebda9f10] [c00f54f8] sys_ioctl+0x68/0xa8
[  824.234035] [ebda9f40] [c0014698] ret_from_syscall+0x0/0x38
[  824.234065] --- Exception: c01 at 0xfa52ef8
[  824.234069]     LR = 0xfa52e5c
[  824.234082] Instruction dump:
[  824.234097] 7c7e1b78 90010024 93a10014 93e1001c 83e30000 3bff0078 7fe3fb78 481d0045 
[  824.234153] 815e0004 801e00c8 7c000034 5400d97e <0f000000> 801e0080 74080020 40a20088 
[  824.234215] ---[ end trace 48e9af4ed874743b ]---
[  825.257906] BUG: spinlock lockup on CPU#0, Xorg/1611, ef9bc138
[  825.257934] Call Trace:
[  825.257977] [ee5b5d20] [c0009884] show_stack+0x7c/0x194 (unreliable)
[  825.258020] [ee5b5d60] [c01c2348] do_raw_spin_lock+0x128/0x170
[  825.258053] [ee5b5d90] [c03f8b50] _raw_spin_lock+0x3c/0x50
[  825.258084] [ee5b5da0] [c0229e84] ttm_bo_reserve+0x40/0x114
[  825.258120] [ee5b5dd0] [c0272d6c] radeon_gem_busy_ioctl+0x60/0x150
[  825.258155] [ee5b5df0] [c02146f8] drm_ioctl+0x26c/0x3a4
[  825.258187] [ee5b5ea0] [c00f4bf8] vfs_ioctl+0x34/0x80
[  825.258214] [ee5b5eb0] [c00f53ec] do_vfs_ioctl+0x670/0x714
[  825.258243] [ee5b5f10] [c00f54f8] sys_ioctl+0x68/0xa8
[  825.258271] [ee5b5f40] [c0014698] ret_from_syscall+0x0/0x38
[  825.258324] --- Exception: c01 at 0xfaccef8
[  825.258327]     LR = 0xfacce5c
[  889.061172] BUG: soft lockup - CPU#0 stuck for 61s! [Xorg:1611]
[  889.061188] Modules linked in: netconsole configfs cpufreq_stats sco bnep rfcomm l2cap binfmt_misc fuse ipv6 hfs therm_adt746x pmu_battery snd_aoa_codec_onyx snd_aoa_fabric_layout snd_aoa snd_aoa_i2sbus snd_pcm snd_page_alloc snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event arc4 snd_seq ecb b43 mac80211 snd_timer snd_seq_device btusb cfg80211 snd bluetooth sg joydev rfkill rtc_generic soundcore rtc_core firewire_ohci sungem pmac_zilog sr_mod serial_core snd_aoa_soundbus rtc_lib appletouch evdev firewire_core sungem_phy ssb cdrom crc_itu_t
[  889.061571] irq event stamp: 6080374
[  889.061580] hardirqs last  enabled at (6080373): [<c009e1b0>] rcu_qsctr_help+0x84/0xa4
[  889.061605] hardirqs last disabled at (6080374): [<c03f8c08>] _raw_spin_lock_irq+0x2c/0x68
[  889.061628] softirqs last  enabled at (6080082): [<c0013e64>] call_do_softirq+0x14/0x24
[  889.061659] softirqs last disabled at (6080075): [<c0013e64>] call_do_softirq+0x14/0x24
[  889.061683] NIP: c0010578 LR: c01c2308 CTR: c03f9428
[  889.061696] REGS: ee5b5cb0 TRAP: 0901   Tainted: G      D W   (2.6.34)
[  889.061707] MSR: 00009032 <EE,ME,IR,DR>  CR: 44242828  XER: 00000000
[  889.061763] TASK = eee75340[1611] 'Xorg' THREAD: ee5b4000
[  889.061773] GPR00: cc31eee0 ee5b5d60 eee75340 00000001 eee75340 00000010 00000000 00000002 
[  889.061836] GPR08: 00000000 cc31eee0 c0061acc efff2350 24244884 
[  889.061889] NIP [c0010578] __delay+0x48/0x5c
[  889.061907] LR [c01c2308] do_raw_spin_lock+0xe8/0x170
[  889.061917] Call Trace:
[  889.061932] [ee5b5d60] [c01c2348] do_raw_spin_lock+0x128/0x170 (unreliable)
[  889.061958] [ee5b5d90] [c03f8b50] _raw_spin_lock+0x3c/0x50
[  889.061978] [ee5b5da0] [c0229e84] ttm_bo_reserve+0x40/0x114
[  889.062003] [ee5b5dd0] [c0272d6c] radeon_gem_busy_ioctl+0x60/0x150
[  889.062026] [ee5b5df0] [c02146f8] drm_ioctl+0x26c/0x3a4
[  889.062212] [ee5b5ea0] [c00f4bf8] vfs_ioctl+0x34/0x80
[  889.062231] [ee5b5eb0] [c00f53ec] do_vfs_ioctl+0x670/0x714
[  889.062251] [ee5b5f10] [c00f54f8] sys_ioctl+0x68/0xa8
[  889.062270] [ee5b5f40] [c0014698] ret_from_syscall+0x0/0x38
[  889.062297] --- Exception: c01 at 0xfaccef8
[  889.062300]     LR = 0xfacce5c
[  889.062314] Instruction dump:
[  889.062329] 7d2502a6 7d204851 40a0000c 3d293b9b 3929ca00 7f891840 419cffe8 4e800020 
[  889.062388] 7c0c42e6 48000008 7c210b78 7d2c42e6 <7d204850> 7f891840 419cfff0 7c421378 
Signature · 6 lines
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel