Skip to contentSkip to conversation

drm/i915: fix per-pipe reads after "cleanup"

PATCH In review Jesse Barnes 3 participants 6 messages Feb 17, 2011

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

PATCH 1/1 drm/i915: fix per-pipe reads after "cleanup"

In a few places I replaced reads of per-pipe registers with the actual register offsets themselves (converting I915_READ(reg) to _PIPE(reg)). Alexey caught this on his 9xx machine because the cursor control write was affected. A quick audit showed a few more places where I'd borked a read, so here's a patch to fix things up.

drivers/gpu/drm/i915/intel_display.c +6 -6
index 0dc5c6f..eadb4b8 100644
@@ -5291,7 +5291,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
 	bool visible = base != 0;
 
 	if (intel_crtc->cursor_visible != visible) {
-		uint32_t cntl = CURCNTR(pipe);
+		uint32_t cntl = I915_READ(CURCNTR(pipe));
 		if (base) {
 			cntl &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT);
 			cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
@@ -5661,7 +5661,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
-	u32 dpll = DPLL(pipe);
+	u32 dpll = I915_READ(DPLL(pipe));
 	u32 fp;
 	intel_clock_t clock;
 
@@ -5749,10 +5749,10 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	struct drm_display_mode *mode;
-	int htot = HTOTAL(pipe);
-	int hsync = HSYNC(pipe);
-	int vtot = VTOTAL(pipe);
-	int vsync = VSYNC(pipe);
+	int htot = I915_READ(HTOTAL(pipe));
+	int hsync = I915_READ(HSYNC(pipe));
+	int vtot = I915_READ(VTOTAL(pipe));
+	int vsync = I915_READ(VSYNC(pipe));
 
 	mode = kzalloc(sizeof(*mode), GFP_KERNEL);
 	if (!mode)
#1 lore raw
Quoted 5 lines · Jesse Barnes

In a few places I replaced reads of per-pipe registers with the actual register offsets themselves (converting I915_READ(reg) to _PIPE(reg)). Alexey caught this on his 9xx machine because the cursor control write was affected. A quick audit showed a few more places where I'd borked a read, so here's a patch to fix things up.

Shoot the reviewer. Thanks for finding those needles in the haystack, -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw

Am Donnerstag, den 17.02.2011, 21:08 +0000 schrieb Chris Wilson:

Quoted 10 lines · Jesse Barnes
Quoted 5 lines

In a few places I replaced reads of per-pipe registers with the actual register offsets themselves (converting I915_READ(reg) to _PIPE(reg)). Alexey caught this on his 9xx machine because the cursor control write was affected. A quick audit showed a few more places where I'd borked a read, so here's a patch to fix things up.

Shoot the reviewer. Thanks for finding those needles in the haystack, -Chris

I get compile error:

/home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c: In function ‘intel_crtc_mode_get’:
/home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c:5718: error:
‘dev_priv’ undeclared (first use in this function) /home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c:5718: error:
(Each undeclared identifier is reported only once /home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c:5718: error:
for each function it appears in.)

The patch is on the top of 9035a97a32836d0e456ddafaaf249a844e6e4b5e (current drm-next)

Signature · 7 lines
Regards,
        Alexey

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 23 lines · On Thu, 17 Feb 2011 22:33:38 +0100 Alexey Fisher <[email protected]>…

Am Donnerstag, den 17.02.2011, 21:08 +0000 schrieb Chris Wilson:

Quoted 10 lines · Jesse Barnes
Quoted 5 lines

In a few places I replaced reads of per-pipe registers with the actual register offsets themselves (converting I915_READ(reg) to _PIPE(reg)). Alexey caught this on his 9xx machine because the cursor control write was affected. A quick audit showed a few more places where I'd borked a read, so here's a patch to fix things up.

Shoot the reviewer. Thanks for finding those needles in the haystack, -Chris

I get compile error:

/home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c: In function ‘intel_crtc_mode_get’:
/home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c:5718: error:
‘dev_priv’ undeclared (first use in this function) /home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c:5718: error:
(Each undeclared identifier is reported only once /home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c:5718: error:
for each function it appears in.)

Quoted 2 lines

The patch is on the top of 9035a97a32836d0e456ddafaaf249a844e6e4b5e (current drm-next)

Huh, I compiled it but I must have mixed in some other changes. You'll need this piece too.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
drivers/gpu/drm/i915/intel_display.c +1 -0
index eadb4b8..2eb251a 100644
@@ -5746,6 +5746,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, st
 struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
                                             struct drm_crtc *crtc)
 {
+       drm_i915_private_t *dev_priv = dev->dev_private;
        struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
        int pipe = intel_crtc->pipe;
        struct drm_display_mode *mode;

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Am Donnerstag, den 17.02.2011, 13:36 -0800 schrieb Jesse Barnes:

Quoted 26 lines
Quoted 23 lines · On Thu, 17 Feb 2011 22:33:38 +0100 Alexey Fisher <[email protected]>…

Am Donnerstag, den 17.02.2011, 21:08 +0000 schrieb Chris Wilson:

Quoted 10 lines · Jesse Barnes
Quoted 5 lines

In a few places I replaced reads of per-pipe registers with the actual register offsets themselves (converting I915_READ(reg) to _PIPE(reg)). Alexey caught this on his 9xx machine because the cursor control write was affected. A quick audit showed a few more places where I'd borked a read, so here's a patch to fix things up.

Shoot the reviewer. Thanks for finding those needles in the haystack, -Chris

I get compile error:

/home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c: In function ‘intel_crtc_mode_get’:
/home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c:5718: error:
‘dev_priv’ undeclared (first use in this function) /home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c:5718: error:
(Each undeclared identifier is reported only once /home/src/linux-2.6/drivers/gpu/drm/i915/intel_display.c:5718: error:
for each function it appears in.)

Quoted 5 lines
Quoted 2 lines

The patch is on the top of 9035a97a32836d0e456ddafaaf249a844e6e4b5e (current drm-next)

Huh, I compiled it but I must have mixed in some other changes. You'll need this piece too.

works fine.

Signature · 7 lines
Regards,
        Alexey

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#5 lore raw
In reply to Jesse Barnes

Am Donnerstag, den 17.02.2011, 10:40 -0800 schrieb Jesse Barnes:

Quoted 5 lines

In a few places I replaced reads of per-pipe registers with the actual register offsets themselves (converting I915_READ(reg) to _PIPE(reg)). Alexey caught this on his 9xx machine because the cursor control write was affected. A quick audit showed a few more places where I'd borked a read, so here's a patch to fix things up.

Quoted 40 lines
drivers/gpu/drm/i915/intel_display.c +6 -6
index 0dc5c6f..eadb4b8 100644
@@ -5291,7 +5291,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
 	bool visible = base != 0;
 
 	if (intel_crtc->cursor_visible != visible) {
-		uint32_t cntl = CURCNTR(pipe);
+		uint32_t cntl = I915_READ(CURCNTR(pipe));
 		if (base) {
 			cntl &= ~(CURSOR_MODE | MCURSOR_PIPE_SELECT);
 			cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
@@ -5661,7 +5661,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
-	u32 dpll = DPLL(pipe);
+	u32 dpll = I915_READ(DPLL(pipe));
 	u32 fp;
 	intel_clock_t clock;
 
@@ -5749,10 +5749,10 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
 	struct drm_display_mode *mode;
-	int htot = HTOTAL(pipe);
-	int hsync = HSYNC(pipe);
-	int vtot = VTOTAL(pipe);
-	int vsync = VSYNC(pipe);
+	int htot = I915_READ(HTOTAL(pipe));
+	int hsync = I915_READ(HSYNC(pipe));
+	int vtot = I915_READ(VTOTAL(pipe));
+	int vsync = I915_READ(VSYNC(pipe));
 
 	mode = kzalloc(sizeof(*mode), GFP_KERNEL);
 	if (!mode)
Signature · 2 lines
Regards,
        Alexey