summaryrefslogtreecommitdiff
path: root/src/amdgpu_kms.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-12-22 18:33:58 +0100
committerMichel Dänzer <michel@daenzer.net>2017-12-27 16:57:17 +0100
commit69e20839bfeb3ee0b0a732d72de0a32d6c5435fc (patch)
tree7731b5dc00f69041610040b33d0088fcf7e86813 /src/amdgpu_kms.c
parentdfccaa7043ccb157a1f8be7313123792bb7e7001 (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 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/amdgpu_kms.c')
-rw-r--r--src/amdgpu_kms.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 58531bf..49044f5 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -37,6 +37,7 @@
#include "amdgpu_glamor.h"
#include "amdgpu_probe.h"
#include "micmap.h"
+#include "mipointrst.h"
#include "amdgpu_version.h"
#include "shadow.h"
@@ -62,6 +63,7 @@
#include <gbm.h>
static DevScreenPrivateKeyRec amdgpu_client_private_key;
+DevScreenPrivateKeyRec amdgpu_device_private_key;
static Bool amdgpu_setup_kernel_mem(ScreenPtr pScreen);
@@ -1532,6 +1534,23 @@ static Bool AMDGPUCursorInit_KMS(ScreenPtr pScreen)
/* Cursor setup */
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+ if (info->allowPageFlip) {
+ miPointerScreenPtr PointPriv =
+ dixLookupPrivate(&pScreen->devPrivates, miPointerScreenKey);
+
+ if (!dixRegisterScreenPrivateKey(&amdgpu_device_private_key, pScreen,
+ PRIVATE_DEVICE,
+ sizeof(struct amdgpu_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;
@@ -1701,6 +1720,15 @@ static Bool AMDGPUCloseScreen_KMS(ScreenPtr pScreen)
amdgpu_glamor_fini(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);