Skip to contentSkip to conversation

drm/radeon/kms: check for being in VBLANK on VBLANK interrupt

PATCH In review Rafał Miłecki 2 participants 3 messages Mar 3, 2010 – Mar 4, 2010

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

PATCH 1/1 drm/radeon/kms: check for being in VBLANK on VBLANK interrupt

This is supposed to check if we receive correct interrupt and if out check for VBLANK is correct. If you get warnings with patch applied, it means we have problem in at least one of mentioned places.
---
To provoke VBLANK interrupt appearing, please use dynpm and start/stop for example glxgears few times.

Jaime can you check this? I know you experienced warnings when using check in PM code.

Dave: I believe you reported warnings as well?

---
 drivers/gpu/drm/radeon/r100.c      |    4 ++++
 drivers/gpu/drm/radeon/r600.c      |    4 ++++
 drivers/gpu/drm/radeon/radeon.h    |    2 ++
 drivers/gpu/drm/radeon/radeon_pm.c |    5 +----
 drivers/gpu/drm/radeon/rs600.c     |    4 ++++
 5 files changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/radeon/r100.c +4 -0
index 73f9a79..0ac1651 100644
@@ -311,11 +311,15 @@ int r100_irq_process(struct radeon_device *rdev)
 		}
 		/* Vertical blank interrupts */
 		if (status & RADEON_CRTC_VBLANK_STAT) {
+			if (!rdev->pm.vblank_sync)
+				radeon_pm_debug_check_in_vbl(rdev, false);
 			drm_handle_vblank(rdev->ddev, 0);
 			rdev->pm.vblank_sync = true;
 			wake_up(&rdev->irq.vblank_queue);
 		}
 		if (status & RADEON_CRTC2_VBLANK_STAT) {
+			if (!rdev->pm.vblank_sync)
+				radeon_pm_debug_check_in_vbl(rdev, false);
 			drm_handle_vblank(rdev->ddev, 1);
 			rdev->pm.vblank_sync = true;
 			wake_up(&rdev->irq.vblank_queue);
drivers/gpu/drm/radeon/r600.c +4 -0
index 5b56a1b..a98fb4e 100644
@@ -2764,6 +2764,8 @@ restart_ih:
 			switch (src_data) {
 			case 0: /* D1 vblank */
 				if (disp_int & LB_D1_VBLANK_INTERRUPT) {
+					if (!rdev->pm.vblank_sync)
+						radeon_pm_debug_check_in_vbl(rdev, false);
 					drm_handle_vblank(rdev->ddev, 0);
 					rdev->pm.vblank_sync = true;
 					wake_up(&rdev->irq.vblank_queue);
@@ -2786,6 +2788,8 @@ restart_ih:
 			switch (src_data) {
 			case 0: /* D2 vblank */
 				if (disp_int & LB_D2_VBLANK_INTERRUPT) {
+					if (!rdev->pm.vblank_sync)
+						radeon_pm_debug_check_in_vbl(rdev, false);
 					drm_handle_vblank(rdev->ddev, 1);
 					rdev->pm.vblank_sync = true;
 					wake_up(&rdev->irq.vblank_queue);
drivers/gpu/drm/radeon/radeon.h +2 -0
index 0d7caee..9e103ec 100644
@@ -74,6 +74,8 @@
 #include "radeon_mode.h"
 #include "radeon_reg.h"
 
+bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);
+
 /*
  * Modules parameters.
  */
drivers/gpu/drm/radeon/radeon_pm.c +1 -4
index 4f37b52..6b65f15 100644
@@ -28,7 +28,6 @@
 #define RADEON_RECLOCK_DELAY_MS 200
 #define RADEON_WAIT_VBLANK_TIMEOUT 200
 
-static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish);
 static void radeon_pm_set_clocks_locked(struct radeon_device *rdev);
 static void radeon_pm_set_clocks(struct radeon_device *rdev);
 static void radeon_pm_idle_work_handler(struct work_struct *work);
@@ -209,9 +208,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)
 
 	/* set engine clock */
 	radeon_sync_with_vblank(rdev);
-	radeon_pm_debug_check_in_vbl(rdev, false);
 	radeon_set_engine_clock(rdev, rdev->pm.requested_clock_mode->sclk);
-	radeon_pm_debug_check_in_vbl(rdev, true);
 
 #if 0
 	/* set memory clock */
@@ -322,7 +319,7 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev)
 	mutex_unlock(&rdev->pm.mutex);
 }
 
-static bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish)
+bool radeon_pm_debug_check_in_vbl(struct radeon_device *rdev, bool finish)
 {
 	u32 stat_crtc1 = 0, stat_crtc2 = 0;
 	bool in_vbl = true;
drivers/gpu/drm/radeon/rs600.c +4 -0
index ac7c27a..e1935bb 100644
@@ -391,11 +391,15 @@ int rs600_irq_process(struct radeon_device *rdev)
 			radeon_fence_process(rdev);
 		/* Vertical blank interrupts */
 		if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int)) {
+			if (!rdev->pm.vblank_sync)
+				radeon_pm_debug_check_in_vbl(rdev, false);
 			drm_handle_vblank(rdev->ddev, 0);
 			rdev->pm.vblank_sync = true;
 			wake_up(&rdev->irq.vblank_queue);
 		}
 		if (G_007EDC_LB_D2_VBLANK_INTERRUPT(r500_disp_int)) {
+			if (!rdev->pm.vblank_sync)
+				radeon_pm_debug_check_in_vbl(rdev, false);
 			drm_handle_vblank(rdev->ddev, 1);
 			rdev->pm.vblank_sync = true;
 			wake_up(&rdev->irq.vblank_queue);
Signature · 10 lines
1.6.4.2


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
#1 lore raw
Quoted 7 lines · W dniu 3 marca 2010 23:33 użytkownik Rafał Miłecki <[email protected]> napisał:

This is supposed to check if we receive correct interrupt and if out check for VBLANK is correct. If you get warnings with patch applied, it means we have problem in at least one of mentioned places.
---
To provoke VBLANK interrupt appearing, please use dynpm and start/stop for example glxgears few times.

Quoted 5 lines

Jaime can you check this? I know you experienced warnings when using check in PM code.

Dave: I believe you reported warnings as well?
---

Personally I got following results on my machine:

[   57.981202] [drm] Requested: e: 68000 m: 80000 p: 16
[   57.981212] [drm] Setting: e: 68000 m: 80000 p: 16
[   57.982827] [drm] not in vbl for pm change 00020002 00000000 at entry
[   61.784087] [drm] Requested: e: 11000 m: 40500 p: 16
[   61.784095] [drm] Setting: e: 11000 m: 40500 p: 16
[   61.799187] [drm] not in vbl for pm change 00020002 00000000 at entry
[   66.799047] [drm] Requested: e: 68000 m: 80000 p: 16
[   66.799056] [drm] Setting: e: 68000 m: 80000 p: 16
[   69.916111] [drm] Requested: e: 11000 m: 40500 p: 16
[   69.916119] [drm] Setting: e: 11000 m: 40500 p: 16
[   69.931836] [drm] not in vbl for pm change 00020002 00000000 at entry
[   73.032037] [drm] Requested: e: 68000 m: 80000 p: 16
[   73.032046] [drm] Setting: e: 68000 m: 80000 p: 16
[   76.048056] [drm] Requested: e: 11000 m: 40500 p: 16
[   76.048064] [drm] Setting: e: 11000 m: 40500 p: 16
[   78.964090] [drm] Requested: e: 68000 m: 80000 p: 16
[   78.964099] [drm] Setting: e: 68000 m: 80000 p: 16
[   84.864053] [drm] Requested: e: 11000 m: 40500 p: 16
[   84.864069] [drm] Setting: e: 11000 m: 40500 p: 16
[   84.864102] [drm] not in vbl for pm change 00010002 00000000 at entry
[   93.165037] [drm] Requested: e: 68000 m: 80000 p: 16
[   93.165046] [drm] Setting: e: 68000 m: 80000 p: 16
[   98.080093] [drm] Requested: e: 11000 m: 40500 p: 16
[   98.080102] [drm] Setting: e: 11000 m: 40500 p: 16
[  101.396033] [drm] Requested: e: 68000 m: 80000 p: 16
[  101.396041] [drm] Setting: e: 68000 m: 80000 p: 16
[  105.012113] [drm] Requested: e: 11000 m: 40500 p: 16
[  105.012121] [drm] Setting: e: 11000 m: 40500 p: 16
[  107.613035] [drm] Requested: e: 68000 m: 80000 p: 16
[  107.613044] [drm] Setting: e: 68000 m: 80000 p: 16
[  111.728091] [drm] Requested: e: 11000 m: 40500 p: 16
[  111.728099] [drm] Setting: e: 11000 m: 40500 p: 16
[  114.328054] [drm] Requested: e: 68000 m: 80000 p: 16
[  114.328063] [drm] Setting: e: 68000 m: 80000 p: 16
[  114.328102] [drm] not in vbl for pm change 00020002 00000000 at entry
[  119.328104] [drm] Requested: e: 11000 m: 40500 p: 16
[  119.328117] [drm] Setting: e: 11000 m: 40500 p: 16
[  119.344343] [drm] not in vbl for pm change 00020002 00000000 at entry

So you can see I receive VBLANK when *not* being in VBLANK in about 50% cases.

I don't experience corruptions however.

Signature · 13 lines
Rafał

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel
#2 lore raw
Quoted 11 lines · Rafał Miłecki
Quoted 10 lines · W dniu 3 marca 2010 23:33 użytkownik Rafał Miłecki <[email protected]> napisał:

This is supposed to check if we receive correct interrupt and if out check for VBLANK is correct. If you get warnings with patch applied, it means we have problem in at least one of mentioned places.
---
To provoke VBLANK interrupt appearing, please use dynpm and start/stop for example glxgears few times.

Jaime can you check this? I know you experienced warnings when using check in PM code.

Here are a few tests:

[  169.696784] [drm] Requested: e: 68000 m: 80000 p: 16
[  169.696802] [drm] Setting: e: 68000 m: 80000 p: 16
[  172.700046] [drm] Requested: e: 11000 m: 40500 p: 16
[  172.700055] [drm] Setting: e: 11000 m: 40500 p: 16
[  179.513370] [drm] Requested: e: 68000 m: 80000 p: 16 
[  179.513388] [drm] Setting: e: 68000 m: 80000 p: 16 
[  180.113380] [drm] Requested: e: 11000 m: 40500 p: 16 
[  180.113389] [drm] Setting: e: 11000 m: 40500 p: 16 
[  180.115295] [drm] not in vbl for pm change 00020002 00000000 at entry
[  184.513350] [drm] Requested: e: 68000 m: 80000 p: 16 
[  184.513359] [drm] Setting: e: 68000 m: 80000 p: 16 
[  186.023395] [drm] Requested: e: 11000 m: 40500 p: 16 
[  186.023403] [drm] Setting: e: 11000 m: 40500 p: 16 
[  192.040034] [drm] Requested: e: 68000 m: 80000 p: 16 
[  192.040054] [drm] Setting: e: 68000 m: 80000 p: 16 
[  193.946734] [drm] Requested: e: 11000 m: 40500 p: 16 
[  193.946743] [drm] Setting: e: 11000 m: 40500 p: 16 
[  230.163392] [drm] Requested: e: 68000 m: 80000 p: 16 
[  230.163411] [drm] Setting: e: 68000 m: 80000 p: 16 
[  231.473389] [drm] Requested: e: 11000 m: 40500 p: 16 
[  231.473398] [drm] Setting: e: 11000 m: 40500 p: 16 
[  327.796715] [drm] Requested: e: 68000 m: 80000 p: 16 
[  327.796734] [drm] Setting: e: 68000 m: 80000 p: 16 
[  328.496738] [drm] Requested: e: 11000 m: 40500 p: 16 
[  328.496746] [drm] Setting: e: 11000 m: 40500 p: 16 
[  328.497883] [drm] not in vbl for pm change 00020002 00000000 at entry
Quoted 45 lines
Quoted 2 lines

Dave: I believe you reported warnings as well?
---

Personally I got following results on my machine:

[   57.981202] [drm] Requested: e: 68000 m: 80000 p: 16
[   57.981212] [drm] Setting: e: 68000 m: 80000 p: 16
[   57.982827] [drm] not in vbl for pm change 00020002 00000000 at entry
[   61.784087] [drm] Requested: e: 11000 m: 40500 p: 16
[   61.784095] [drm] Setting: e: 11000 m: 40500 p: 16
[   61.799187] [drm] not in vbl for pm change 00020002 00000000 at entry
[   66.799047] [drm] Requested: e: 68000 m: 80000 p: 16
[   66.799056] [drm] Setting: e: 68000 m: 80000 p: 16
[   69.916111] [drm] Requested: e: 11000 m: 40500 p: 16
[   69.916119] [drm] Setting: e: 11000 m: 40500 p: 16
[   69.931836] [drm] not in vbl for pm change 00020002 00000000 at entry
[   73.032037] [drm] Requested: e: 68000 m: 80000 p: 16
[   73.032046] [drm] Setting: e: 68000 m: 80000 p: 16
[   76.048056] [drm] Requested: e: 11000 m: 40500 p: 16
[   76.048064] [drm] Setting: e: 11000 m: 40500 p: 16
[   78.964090] [drm] Requested: e: 68000 m: 80000 p: 16
[   78.964099] [drm] Setting: e: 68000 m: 80000 p: 16
[   84.864053] [drm] Requested: e: 11000 m: 40500 p: 16
[   84.864069] [drm] Setting: e: 11000 m: 40500 p: 16
[   84.864102] [drm] not in vbl for pm change 00010002 00000000 at entry
[   93.165037] [drm] Requested: e: 68000 m: 80000 p: 16
[   93.165046] [drm] Setting: e: 68000 m: 80000 p: 16
[   98.080093] [drm] Requested: e: 11000 m: 40500 p: 16
[   98.080102] [drm] Setting: e: 11000 m: 40500 p: 16
[  101.396033] [drm] Requested: e: 68000 m: 80000 p: 16
[  101.396041] [drm] Setting: e: 68000 m: 80000 p: 16
[  105.012113] [drm] Requested: e: 11000 m: 40500 p: 16
[  105.012121] [drm] Setting: e: 11000 m: 40500 p: 16
[  107.613035] [drm] Requested: e: 68000 m: 80000 p: 16
[  107.613044] [drm] Setting: e: 68000 m: 80000 p: 16
[  111.728091] [drm] Requested: e: 11000 m: 40500 p: 16
[  111.728099] [drm] Setting: e: 11000 m: 40500 p: 16
[  114.328054] [drm] Requested: e: 68000 m: 80000 p: 16
[  114.328063] [drm] Setting: e: 68000 m: 80000 p: 16
[  114.328102] [drm] not in vbl for pm change 00020002 00000000 at entry
[  119.328104] [drm] Requested: e: 11000 m: 40500 p: 16
[  119.328117] [drm] Setting: e: 11000 m: 40500 p: 16
[  119.344343] [drm] not in vbl for pm change 00020002 00000000 at entry
Quoted 6 lines

So you can see I receive VBLANK when *not* being in VBLANK in about 50% cases.

I don't experience corruptions however.

Signature · 1 line
Rafał

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel