summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-03-03 16:36:24 +0900
committerMichel Dänzer <michel@daenzer.net>2017-03-07 16:54:27 +0900
commit378bd05c849ad3092f138bdc8917d35d0b967389 (patch)
tree82439b90145f6b493e4960893dc82432aa834744
parent8d4d73e05ce34eb353daec7b2c0e7c844113c7de (diff)
Call drmmode_set_desired_modes from a WindowExposures hook
This is the earliest opportunity where the root window contents are guaranteed to be initialized, and prevents drmmode_set_mode_major from getting called before drmmode_set_desired_modes via AMDGPUUnblank -> drmmode_crtc_dpms. Also, in contrast to the BlockHandler hook, this is called when running Xorg with -pogo. Fixes intermittently showing garbage on server startup or after server reset. As a bonus, this avoids trouble due to higher layers (e.g. the tigervnc Xorg module) calling AMDGPUBlockHandler_oneshot repeatedly even after we set pScreen->BlockHandler = AMDGPUBlockHandler_KMS. Bugzilla: https://bugs.freedesktop.org/99457 (Ported from radeon commits 0a12bf1085505017068dfdfd31d23133e51b45b9 and f0e7948e1c0e984fc27f235f365639e9cf628291) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/amdgpu_drv.h1
-rw-r--r--src/amdgpu_kms.c40
2 files changed, 29 insertions, 12 deletions
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 2aaafe4..ae5b6f9 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -230,6 +230,7 @@ typedef struct {
CreateScreenResourcesProcPtr CreateScreenResources;
CreateWindowProcPtr CreateWindow;
+ WindowExposuresProcPtr WindowExposures;
Bool IsSecondary;
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index bafcb9b..ce1ae43 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1039,17 +1039,6 @@ static void AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
#endif
}
-static void AMDGPUBlockHandler_oneshot(BLOCKHANDLER_ARGS_DECL)
-{
- SCREEN_PTR(arg);
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
-
- AMDGPUBlockHandler_KMS(BLOCKHANDLER_ARGS);
-
- drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
-}
-
/* This is called by AMDGPUPreInit to set up the default visual */
static Bool AMDGPUPreInitVisual(ScrnInfoPtr pScrn)
{
@@ -1266,6 +1255,31 @@ static Bool AMDGPUCreateWindow_oneshot(WindowPtr pWin)
return ret;
}
+/* When the root window is mapped, set the initial modes */
+static void AMDGPUWindowExposures_oneshot(WindowPtr pWin, RegionPtr pRegion
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+ , RegionPtr pBSRegion
+#endif
+ )
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+ AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
+
+ if (pWin != pScreen->root)
+ ErrorF("%s called for non-root window %p\n", __func__, pWin);
+
+ pScreen->WindowExposures = info->WindowExposures;
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,16,99,901,0)
+ pScreen->WindowExposures(pWin, pRegion, pBSRegion);
+#else
+ pScreen->WindowExposures(pWin, pRegion);
+#endif
+
+ amdgpu_glamor_finish(pScrn);
+ drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
+}
+
Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
{
AMDGPUInfoPtr info;
@@ -1824,6 +1838,8 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
info->CreateWindow = pScreen->CreateWindow;
pScreen->CreateWindow = AMDGPUCreateWindow_oneshot;
}
+ info->WindowExposures = pScreen->WindowExposures;
+ pScreen->WindowExposures = AMDGPUWindowExposures_oneshot;
/* Provide SaveScreen & wrap BlockHandler and CloseScreen */
/* Wrap CloseScreen */
@@ -1831,7 +1847,7 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
pScreen->CloseScreen = AMDGPUCloseScreen_KMS;
pScreen->SaveScreen = AMDGPUSaveScreen_KMS;
info->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = AMDGPUBlockHandler_oneshot;
+ pScreen->BlockHandler = AMDGPUBlockHandler_KMS;
info->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = AMDGPUCreateScreenResources_KMS;