Skip to contentSkip to conversation

drm/i915: Fix cursor visibility check with negative coordinates

PATCH In review [email protected] 3 participants 5 messages Sep 2, 2013 – Sep 3, 2013

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

PATCH 1/1 drm/i915: Fix cursor visibility check with negative coordinates

From: Ville Syrjälä <[email protected]>

When the cursor x coordinate is exactly -cursor_width, the cursor is invisible. And obviously the same holds for the y coordinate and cursor_height.

---
 drivers/gpu/drm/i915/intel_display.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
index 17fe7ed..42e65ce 100644
@@ -6857,7 +6857,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 		base = 0;
 
 	if (x < 0) {
-		if (x + intel_crtc->cursor_width < 0)
+		if (x + intel_crtc->cursor_width <= 0)
 			base = 0;
 
 		pos |= CURSOR_POS_SIGN << CURSOR_X_SHIFT;
@@ -6866,7 +6866,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 	pos |= x << CURSOR_X_SHIFT;
 
 	if (y < 0) {
-		if (y + intel_crtc->cursor_height < 0)
+		if (y + intel_crtc->cursor_height <= 0)
 			base = 0;
 
 		pos |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT;
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 5 lines · On Mon, Sep 02, 2013 at 09:16:50PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

When the cursor x coordinate is exactly -cursor_width, the cursor is invisible. And obviously the same holds for the y coordinate and cursor_height.

And similarly for the earlier x == fb->width checks. -Chris

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

PATCH 1/1 drm/i915: Fix cursor visibility checks also for the right/bottom screen edges

From: Ville Syrjälä <[email protected]>

First of all we should not be looking at fb->{width,height} as those do not tell us what the actual pipe size is. Second of all we need to use

Quoted 1 line

= for the comparison.

So fix the comparison, and make use of the new pipe_src_{w,h} to determine the real pipe source dimensions.

---
 drivers/gpu/drm/i915/intel_display.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -9
index bbaa689..5055d2f8 100644
@@ -6847,19 +6847,16 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 	int pipe = intel_crtc->pipe;
 	int x = intel_crtc->cursor_x;
 	int y = intel_crtc->cursor_y;
-	u32 base, pos;
+	u32 base = 0, pos = 0;
 	bool visible;
 
-	pos = 0;
-
-	if (on && crtc->enabled && crtc->fb) {
+	if (on)
 		base = intel_crtc->cursor_addr;
-		if (x > (int) crtc->fb->width)
-			base = 0;
 
-		if (y > (int) crtc->fb->height)
-			base = 0;
-	} else
+	if (x >= intel_crtc->config.pipe_src_w)
+		base = 0;
+
+	if (y >= intel_crtc->config.pipe_src_h)
 		base = 0;
 
 	if (x < 0) {
Signature · 6 lines
1.8.1.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH] drm/i915: Fix cursor visibility checks also for the right/bottom screen edges

Quoted 10 lines · On Tue, Sep 03, 2013 at 11:04:30AM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

First of all we should not be looking at fb->{width,height} as those do not tell us what the actual pipe size is. Second of all we need to use

Quoted 1 line

= for the comparison.

So fix the comparison, and make use of the new pipe_src_{w,h} to determine the real pipe source dimensions.

Whoops.

And r-b for its sibling as well. I am pretty sure there are real-world bugs out there, but they are going to pretty be rare and the same user is never likely to see it twice... And just maybe more recent hw isn't quite so hang-happy!
-Chris

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

Re: [PATCH] drm/i915: Fix cursor visibility checks also for the right/bottom screen edges

Quoted 12 lines · Chris Wilson
Quoted 10 lines · On Tue, Sep 03, 2013 at 11:04:30AM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

First of all we should not be looking at fb->{width,height} as those do not tell us what the actual pipe size is. Second of all we need to use

Quoted 1 line

= for the comparison.

So fix the comparison, and make use of the new pipe_src_{w,h} to determine the real pipe source dimensions.

Quoted 8 lines

Whoops.

And r-b for its sibling as well. I am pretty sure there are real-world bugs out there, but they are going to pretty be rare and the same user is never likely to see it twice... And just maybe more recent hw isn't quite so hang-happy!

Hm, can we have an igt for this? We kinda don't any sprite/cursor test at all right now, but we need to start somewhere ... -Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch