summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2017-03-01 18:00:40 +0900
committerMichel Dänzer <michel@daenzer.net>2017-03-02 16:05:55 +0900
commit0a12bf1085505017068dfdfd31d23133e51b45b9 (patch)
tree300fd39c0e4b94eaf25598f1e3f157455658ffd0
parentdf2d749a4db33298c8ce9f2cfb77c20c5538c9cc (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 RADEONUnblank -> 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 RADEONBlockHandler_oneshot repeatedly even after we set pScreen->BlockHandler = RADEONBlockHandler_KMS. v2: * Drop spaces between XORG_VERSION_NUMERIC arguments * Call radeon_bo_wait after radeon_cs_flush_indirect Bugzilla: https://bugs.freedesktop.org/99457 Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
-rw-r--r--src/radeon.h1
-rw-r--r--src/radeon_kms.c41
2 files changed, 30 insertions, 12 deletions
diff --git a/src/radeon.h b/src/radeon.h
index bfff232c..815c12a1 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -523,6 +523,7 @@ typedef struct {
CreateScreenResourcesProcPtr CreateScreenResources;
CreateWindowProcPtr CreateWindow;
+ WindowExposuresProcPtr WindowExposures;
Bool IsSecondary;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index 331f3f1c..c2089eba 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1137,17 +1137,6 @@ static void RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS_DECL)
#endif
}
-static void RADEONBlockHandler_oneshot(BLOCKHANDLER_ARGS_DECL)
-{
- SCREEN_PTR(arg);
- ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- RADEONInfoPtr info = RADEONPTR(pScrn);
-
- RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS);
-
- drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
-}
-
static Bool RADEONIsFastFBWorking(ScrnInfoPtr pScrn)
{
RADEONInfoPtr info = RADEONPTR(pScrn);
@@ -1636,6 +1625,32 @@ static Bool RADEONCreateWindow_oneshot(WindowPtr pWin)
return ret;
}
+/* When the root window is mapped, set the initial modes */
+static void RADEONWindowExposures_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);
+ RADEONInfoPtr info = RADEONPTR(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, RegionPtr pBSRegion);
+#else
+ pScreen->WindowExposures(pWin, pRegion);
+#endif
+
+ radeon_cs_flush_indirect(pScrn);
+ radeon_bo_wait(info->front_bo);
+ drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE);
+}
+
Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
{
RADEONInfoPtr info;
@@ -2330,6 +2345,8 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
info->CreateWindow = pScreen->CreateWindow;
pScreen->CreateWindow = RADEONCreateWindow_oneshot;
}
+ info->WindowExposures = pScreen->WindowExposures;
+ pScreen->WindowExposures = RADEONWindowExposures_oneshot;
/* Provide SaveScreen & wrap BlockHandler and CloseScreen */
/* Wrap CloseScreen */
@@ -2337,7 +2354,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
pScreen->CloseScreen = RADEONCloseScreen_KMS;
pScreen->SaveScreen = RADEONSaveScreen_KMS;
info->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = RADEONBlockHandler_oneshot;
+ pScreen->BlockHandler = RADEONBlockHandler_KMS;
info->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = RADEONCreateScreenResources_KMS;