summaryrefslogtreecommitdiff
path: root/src/radeon_kms.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-12-27 17:13:30 +0100
committerMichel Dänzer <michel@daenzer.net>2017-12-28 15:17:56 +0100
commit1fe8ca75974c5241c3b556b757f9c966c9ce5002 (patch)
tree09052856b54fea5fe261bb06f397e57614aa6f75 /src/radeon_kms.c
parentb4ce8913ac392df339081f6f3e28bf79a239ee75 (diff)
Keep track of how many SW cursors are visible on each screen
And use this to determine when we cannot use page flipping for DRI clients. We previously did this based on whether the HW cursor cannot be used on at least one CRTC, which had at least two issues: * Even while the HW cursor cannot be used, no SW cursor may actually be visible (e.g. because all cursors are disabled), in which case we can use page flipping for DRI clients anyway * Even while the HW cursor can be used, there may be SW cursors visible from non-core pointer devices, in which case we cannot use page flipping for DRI clients anyway (Ported from amdgpu commit 69e20839bfeb3ee0b0a732d72de0a32d6c5435fc) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/radeon_kms.c')
-rw-r--r--src/radeon_kms.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 602a8fb7..c1f885eb 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -38,6 +38,7 @@
#include "radeon_reg.h"
#include "radeon_probe.h"
#include "micmap.h"
+#include "mipointrst.h"
#include "radeon_version.h"
#include "shadow.h"
@@ -66,6 +67,7 @@
#include "radeon_vbo.h"
static DevScreenPrivateKeyRec radeon_client_private_key;
+DevScreenPrivateKeyRec radeon_device_private_key;
extern SymTabRec RADEONChipsets[];
static Bool radeon_setup_kernel_mem(ScreenPtr pScreen);
@@ -1991,6 +1993,23 @@ static Bool RADEONCursorInit_KMS(ScreenPtr pScreen)
/* Cursor setup */
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+ if (info->allowPageFlip) {
+ miPointerScreenPtr PointPriv =
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ if (!dixRegisterScreenPrivateKey(&radeon_device_private_key, pScreen,
+ PRIVATE_DEVICE,
+ sizeof(struct radeon_device_priv))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "dixRegisterScreenPrivateKey failed\n");
+ 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 (xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE))
return TRUE;
@@ -2147,6 +2166,15 @@ static Bool RADEONCloseScreen_KMS(ScreenPtr pScreen)
pScrn->vtSema = FALSE;
xf86ClearPrimInitDone(info->pEnt->index);
+
+ if (info->allowPageFlip) {
+ miPointerScreenPtr PointPriv =
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ PointPriv->spriteFuncs->SetCursor = info->SetCursor;
+ PointPriv->spriteFuncs->MoveCursor = info->MoveCursor;
+ }
+
pScreen->BlockHandler = info->BlockHandler;
pScreen->CloseScreen = info->CloseScreen;
return pScreen->CloseScreen(pScreen);