xf86-video-intel: 2 commits - src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Nov 15 22:21:25 UTC 2016


 src/sna/sna_display.c |   24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

New commits:
commit 0472b1f0fe1510c9709279d30ae033d766f44118
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 15 22:01:10 2016 +0000

    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 at intel.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 24e3603..ebfeb6a 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;
commit 01114334dd893863ad4bbe72fc94a278aa36bfa5
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Nov 15 21:58:26 2016 +0000

    sna: Recompute the cursor after a modeset
    
    As a modeset may adjust the rotation or the transform of the cursor, we
    may need to recompute the cursor image afterwards.
    
    Reported-by: Matt Roper <matthew.d.roper at intel.com>
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 59ecfd3..24e3603 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2878,6 +2878,13 @@ static void sna_crtc_randr(xf86CrtcPtr crtc)
 	} else
 		crtc->transform_in_use = sna_crtc->rotation != RR_Rotate_0;
 
+	/* Recompute the cursor after a potential change in transform */
+	if (sna_crtc->cursor) {
+		assert(sna_crtc->cursor->ref > 0);
+		sna_crtc->cursor->ref--;
+		sna_crtc->cursor = NULL;
+	}
+
 	if (needs_transform) {
 		sna_crtc->hwcursor = is_affine(&f_fb_to_crtc);
 		sna_crtc->cursor_transform =


More information about the xorg-commit mailing list