xf86-video-ati: Branch 'master'

Michel Dänzer daenzer at kemper.freedesktop.org
Tue Mar 6 16:57:29 UTC 2018


 src/radeon_kms.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

New commits:
commit 504b8721b17a672caf1ed3eab087027c02458cab
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Mon Mar 5 18:41:44 2018 +0100

    Only change Set/MoveCursor hooks from what we expect
    
    Since xf86CursorCloseScreen runs after RADEONCloseScreen_KMS,
    PointPriv->spriteFuncs doesn't point to the same struct in the latter as
    in RADEONCursorInit_KMS. So we were restoring info->Set/MoveCursor to
    the wrong struct. Then in the next server generation,
    info->Set/MoveCursor would end up pointing to
    drmmode_sprite_set/move_cursor, resulting in an infinite loop if one of
    them was called.
    
    To avoid this, only change the Set/MoveCursor hooks if their values
    match our expectations, otherwise leave them as is. This is kind of a
    hack, but the alternative would be invasive and thus risky changes to
    the way we're wrapping CloseScreen, and it's not even clear that can
    work without changing xserver code.
    
    Fixes: 1fe8ca75974c ("Keep track of how many SW cursors are visible on
                          each screen")
    Acked-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 85390e30..790d4be1 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -2017,10 +2017,12 @@ static Bool RADEONCursorInit_KMS(ScreenPtr pScreen)
 	    return FALSE;
 	}
 
-	info->SetCursor = PointPriv->spriteFuncs->SetCursor;
-	info->MoveCursor = PointPriv->spriteFuncs->MoveCursor;
-	PointPriv->spriteFuncs->SetCursor = drmmode_sprite_set_cursor;
-	PointPriv->spriteFuncs->MoveCursor = drmmode_sprite_move_cursor;
+	if (PointPriv->spriteFuncs->SetCursor != drmmode_sprite_set_cursor) {
+	    info->SetCursor = PointPriv->spriteFuncs->SetCursor;
+	    info->MoveCursor = PointPriv->spriteFuncs->MoveCursor;
+	    PointPriv->spriteFuncs->SetCursor = drmmode_sprite_set_cursor;
+	    PointPriv->spriteFuncs->MoveCursor = drmmode_sprite_move_cursor;
+	}
     }
 
     if (xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE))
@@ -2184,8 +2186,10 @@ static Bool RADEONCloseScreen_KMS(ScreenPtr pScreen)
 	miPointerScreenPtr PointPriv =
 	    dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
 
-	PointPriv->spriteFuncs->SetCursor = info->SetCursor;
-	PointPriv->spriteFuncs->MoveCursor = info->MoveCursor;
+	if (PointPriv->spriteFuncs->SetCursor == drmmode_sprite_set_cursor) {
+	    PointPriv->spriteFuncs->SetCursor = info->SetCursor;
+	    PointPriv->spriteFuncs->MoveCursor = info->MoveCursor;
+	}
     }
 
     pScreen->BlockHandler = info->BlockHandler;


More information about the xorg-commit mailing list