diff options
author | Yang Zhao <yang@yangman.ca> | 2009-04-26 15:31:29 -0700 |
---|---|---|
committer | Matthias Hopf <mhopf@suse.de> | 2009-05-06 12:04:50 +0200 |
commit | 669e0befdf73a6e1502b0f499a4a9d2122929854 (patch) | |
tree | 4b2440ea20b57337d994c79914161f741e7f498d | |
parent | 6f378a0d63df5fad86e16504c9d15c17849a67d3 (diff) |
Cursor: refactor RandR cursor code
Eliminate calls to displayCursor() and generally reduce the number of
register writes.
Signed-off-by: Yang Zhao <yang@yangman.ca>
-rw-r--r-- | src/rhd_cursor.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/rhd_cursor.c b/src/rhd_cursor.c index 3a0c7a9..751c614 100644 --- a/src/rhd_cursor.c +++ b/src/rhd_cursor.c @@ -625,10 +625,9 @@ void rhdCrtcShowCursor(struct rhdCrtc *Crtc) { struct rhdCursor *Cursor = Crtc->Cursor; - - lockCursor (Cursor, TRUE); - displayCursor(Crtc, TRUE); - lockCursor (Cursor, FALSE); + lockCursor (Cursor, TRUE); + enableCursor(Cursor, TRUE); + lockCursor (Cursor, FALSE); } /* @@ -651,11 +650,26 @@ void rhdCrtcSetCursorPosition(struct rhdCrtc *Crtc, int x, int y) { struct rhdCursor *Cursor = Crtc->Cursor; + int hotx, hoty; + Cursor->X = x; Cursor->Y = y; + hotx = 0; + hoty = 0; + + /* Hardware doesn't allow negative cursor pos; compensate using hotspot */ + if (x < 0) { + hotx = -x; + x = 0; + } + if (y < 0) { + hoty = -y; + y = 0; + } + lockCursor (Cursor, TRUE); - displayCursor(Crtc, TRUE); + setCursorPos (Cursor, x, y, hotx, hoty); lockCursor (Cursor, FALSE); } @@ -679,13 +693,14 @@ rhdCrtcLoadCursorARGB(struct rhdCrtc *Crtc, CARD32 *Image) { struct rhdCursor *Cursor = Crtc->Cursor; + /* X server always loads cursors that are the maximum allowed size */ Cursor->Width = MAX_CURSOR_WIDTH; Cursor->Height = MAX_CURSOR_HEIGHT; lockCursor (Cursor, TRUE); uploadCursorImage(Cursor, Image); setCursorImage (Cursor); - displayCursor (Crtc, Crtc->Active); + setCursorSize (Cursor, Cursor->Width, Cursor->Height); lockCursor (Cursor, FALSE); } |