diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-11-15 22:01:10 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-11-15 22:07:35 +0000 |
commit | 0472b1f0fe1510c9709279d30ae033d766f44118 (patch) | |
tree | 3cd9fefb835c6099b31ff83a9f86088075a2e6c0 | |
parent | 01114334dd893863ad4bbe72fc94a278aa36bfa5 (diff) |
sna: Acquire cursor before use in sna_cursor_set_position()
sna_cursor_set_position() requires an already computed cursor
transformation matrix in order to determine whether the cursor is
visible. This is computed in __sna_get_cursor() which is currently only
called for visible cursors - i.e. we were using uninitialised state.
Reported-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_display.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 24e36031..ebfeb6a1 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -6296,6 +6296,14 @@ sna_set_cursor_position(ScrnInfoPtr scrn, int x, int y) if (sna_crtc->bo == NULL) goto disable; + cursor = __sna_get_cursor(sna, crtc); + if (cursor == NULL) + cursor = sna_crtc->cursor; + if (cursor == NULL) { + __DBG(("%s: failed to grab cursor, disabling\n", __FUNCTION__)); + goto disable; + } + if (crtc->transform_in_use) { int xhot = sna->cursor.ref->bits->xhot; int yhot = sna->cursor.ref->bits->yhot; @@ -6320,15 +6328,6 @@ sna_set_cursor_position(ScrnInfoPtr scrn, int x, int y) if (arg.x < crtc->mode.HDisplay && arg.x > -sna->cursor.size && arg.y < crtc->mode.VDisplay && arg.y > -sna->cursor.size) { - cursor = __sna_get_cursor(sna, crtc); - if (cursor == NULL) - cursor = sna_crtc->cursor; - if (cursor == NULL) { - __DBG(("%s: failed to grab cursor, disabling\n", - __FUNCTION__)); - goto disable; - } - if (sna_crtc->cursor != cursor || sna_crtc->last_cursor_size != cursor->size) { arg.flags |= DRM_MODE_CURSOR_BO; arg.handle = cursor->handle; |