[PATCH 2/5] Defer initial drmmode_copy_fb call until root window creation

Michel Dänzer michel at daenzer.net
Tue Apr 21 02:49:46 PDT 2015


From: Michel Dänzer <michel.daenzer at amd.com>

That's late enough for acceleration to be fully initialized, but still
early enough to set pScreen->canDoBGNoneRoot.

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c |  6 ------
 src/radeon.h          |  3 +++
 src/radeon_kms.c      | 40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index edeba47..76b2577 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2113,12 +2113,6 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
 {
 	xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
 	int c;
-#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
-	RADEONInfoPtr info = RADEONPTR(pScrn);
-
-	if (bgNoneRoot && info->accelOn && !info->use_glamor)
-		drmmode_copy_fb(pScrn, drmmode);
-#endif
 
 	for (c = 0; c < config->num_crtc; c++) {
 		xf86CrtcPtr	crtc = config->crtc[c];
diff --git a/src/radeon.h b/src/radeon.h
index 1c794ce..962a68d 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -493,6 +493,9 @@ typedef struct {
     DisplayModePtr currentMode;
 
     CreateScreenResourcesProcPtr CreateScreenResources;
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+    CreateWindowProcPtr CreateWindow;
+#endif
 
     Bool              IsSecondary;
     Bool              IsPrimary;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index a85e890..2a84ff6 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1012,6 +1012,34 @@ static void RADEONSetupCapabilities(ScrnInfoPtr pScrn)
 #endif
 }
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+
+/* When the root window is created, initialize the screen contents from
+ * console if -background none was specified on the command line
+ */
+static Bool RADEONCreateWindow(WindowPtr pWin)
+{
+    ScreenPtr pScreen = pWin->drawable.pScreen;
+    ScrnInfoPtr pScrn;
+    RADEONInfoPtr info;
+    Bool ret;
+
+    if (pWin != pScreen->root)
+	ErrorF("%s called for non-root window %p\n", __func__, pWin);
+
+    pScrn = xf86ScreenToScrn(pScreen);
+    info = RADEONPTR(pScrn);
+    pScreen->CreateWindow = info->CreateWindow;
+    ret = pScreen->CreateWindow(pWin);
+
+    if (ret)
+	drmmode_copy_fb(pScrn, &info->drmmode);
+
+    return ret;
+}
+
+#endif
+
 Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 {
     RADEONInfoPtr     info;
@@ -1666,6 +1694,13 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     }
     pScrn->pScreen = pScreen;
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+    if (bgNoneRoot && info->accelOn && !info->use_glamor) {
+	info->CreateWindow = pScreen->CreateWindow;
+	pScreen->CreateWindow = RADEONCreateWindow;
+    }
+#endif
+
     /* Provide SaveScreen & wrap BlockHandler and CloseScreen */
     /* Wrap CloseScreen */
     info->CloseScreen    = pScreen->CloseScreen;
@@ -1725,6 +1760,11 @@ Bool RADEONEnterVT_KMS(VT_FUNC_ARGS_DECL)
 
     pScrn->vtSema = TRUE;
 
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+    if (bgNoneRoot && info->accelOn && !info->use_glamor)
+	drmmode_copy_fb(pScrn, &info->drmmode);
+#endif
+
     if (!drmmode_set_desired_modes(pScrn, &info->drmmode))
 	return FALSE;
 
-- 
2.1.4



More information about the xorg-driver-ati mailing list