Mailinglist Archive: radeonhd (427 mails)

< Previous Next >
Re: [radeonhd] Re: [PATCH] refactored RandR cursor code plus fix for bug #13405
  • From: Yang Zhao <yang@xxxxxxxxxx>
  • Date: Mon, 4 May 2009 18:04:35 -0700
  • Message-id: <40a7b1aa0905041804v4adc3ea6m5b1614bcc9f1428c@xxxxxxxxxxxxxx>
2009/5/4 Alex Deucher <alexdeucher@xxxxxxxxx>:
On Mon, May 4, 2009 at 6:27 PM, Yang Zhao <yang@xxxxxxxxxx> wrote:
Round 2.
...
0003 contains the multiple-of-128px and outside-viewport code with
some tweaks, and is thus different from radeon.  My system that's set
up with dual-screen doesn't seem to be panning capable, so the
viewport part is untested; please scrutinize 0003 with extra
attention.

These look good. Note, that the issue addressed by patch 0003 is only
applicable when both crtcs are enabled.

Right; thanks for the reminder.

New 0003 attached.

--
Yang Zhao
http://yangman.ca
From 8ba142841284364a4924c8bc7a53acc76799c523 Mon Sep 17 00:00:00 2001
From: Yang Zhao <yang@xxxxxxxxxx>
Date: Mon, 4 May 2009 13:38:27 -0700
Subject: [PATCH] Cursor: Fix remaning corruption cases

Port of f668cc06cd7f338888a7dce1507026af0e9e36ad to new code

Found by Alex:
Apparently the cursor image cannot end on a multiple of 128 pixels.
Also, for panning, the end of the cursor image cannot extend past
the end of the viewport.

Signed-off-by: Yang Zhao <yang@xxxxxxxxxx>
---
src/rhd_cursor.c | 32 +++++++++++++++++++++++++++++++-
1 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/src/rhd_cursor.c b/src/rhd_cursor.c
index a2b52b1..16c0b0a 100644
--- a/src/rhd_cursor.c
+++ b/src/rhd_cursor.c
@@ -648,8 +648,9 @@ rhdCrtcHideCursor(struct rhdCrtc *Crtc)
void
rhdCrtcSetCursorPosition(struct rhdCrtc *Crtc, int x, int y)
{
+ RHDPtr rhdPtr = RHDPTRI(Crtc);
struct rhdCursor *Cursor = Crtc->Cursor;
- int hotx, hoty;
+ int hotx, hoty, width, cursor_end, frame_end;

Cursor->X = x;
Cursor->Y = y;
@@ -667,7 +668,36 @@ rhdCrtcSetCursorPosition(struct rhdCrtc *Crtc, int x, int
y)
y = 0;
}

+ /* Work around rare corruption cases by adjusting cursor size;
+ * related to bug #13405
+ * For dual-screen:
+ * - Cursor's right-edge must not end on multiples of 128px.
+ * - For panning, cursor image cannot horizontally extend past end of
viewport.
+ */
+ if (rhdPtr->Crtc[0]->Active && rhdPtr->Crtc[1]->Active) {
+ width = Cursor->Width;
+ cursor_end = x + width;
+ frame_end = Crtc->X + Crtc->Width;
+
+ if (cursor_end > frame_end) {
+ width -= cursor_end - frame_end;
+ cursor_end = x + width;
+ }
+ if (! (cursor_end & 0x7f)) {
+ width--;
+ }
+ /* If the cursor is effectively invisible, move it out of visible area
*/
+ if (width <= 0) {
+ width = 1;
+ x = 0;
+ y = Crtc->Y + Crtc->Height;
+ hotx = 0;
+ hoty = 0;
+ }
+ }
+
lockCursor (Cursor, TRUE);
+ setCursorSize(Cursor, width, Cursor->Height);
RHDRegWrite(Cursor, Cursor->RegOffset + D1CUR_POSITION, x << 16 | y);
RHDRegWrite(Cursor, Cursor->RegOffset + D1CUR_HOT_SPOT, hotx << 16 | hoty);
lockCursor (Cursor, FALSE);
--
1.6.0.6

< Previous Next >
References