dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/radeon: Fix negative cursor position
@ 2016-09-23 13:06 Takashi Iwai
  2016-09-26  8:57 ` Michel Dänzer
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2016-09-23 13:06 UTC (permalink / raw)
  To: Alex Deucher; +Cc: christian.koenig, dri-devel

radeon_cursor_move_unlock() contains a workaround for AVIVO chips that
are older than DCE6 when the cursor ends on 128 pixel boundary.  It
decreases the position when the calculated end position is on 128
pixel boundary.  However, it hits also the condition where x=-1 and
width=1 are passed, since cursor_end is 0 (which is aligned with 128,
too).  Then the value gets decreased and it hits WARN_ON_ONCE()
below, eventually screws up the GPU.

The fix is simply to skip the workaround when x is already zero.
Also, remove the superfluous WARN_ON_ON() for the negative value check
that wouldn't happen any longer after this change.

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1000433
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpu/drm/radeon/radeon_cursor.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index 2a10e24b34b1..4e436eb49a56 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -193,10 +193,8 @@ static int radeon_cursor_move_locked(struct drm_crtc *crtc, int x, int y)
 			if (w <= 0) {
 				w = 1;
 				cursor_end = x - xorigin + w;
-				if (!(cursor_end & 0x7f)) {
+				if (x > 0 && !(cursor_end & 0x7f))
 					x--;
-					WARN_ON_ONCE(x < 0);
-				}
 			}
 		}
 	}
-- 
2.10.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-10-27  9:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-23 13:06 [PATCH] drm/radeon: Fix negative cursor position Takashi Iwai
2016-09-26  8:57 ` Michel Dänzer
2016-09-26  9:42   ` Takashi Iwai
2016-09-26 12:09     ` Takashi Iwai
2016-10-27  9:02       ` Michel Dänzer
2016-10-27  9:39         ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox