[PATCH xf86-video-amdgpu 2/6] Defer initial drmmode_copy_fb call until root window creation
Michel Dänzer
michel at daenzer.net
Thu Aug 6 02:59:32 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.
(Ported from radeon commit 37874a4eeace5df04b02c8fc28f67b824e3f0f5f)
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/amdgpu_drv.h | 3 +++
src/amdgpu_kms.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/drmmode_display.c | 5 -----
3 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index e7bdf7f..f91b6e8 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -214,6 +214,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/amdgpu_kms.c b/src/amdgpu_kms.c
index fb60310..1d2f0d4 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -655,6 +655,34 @@ static void AMDGPUSetupCapabilities(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 AMDGPUCreateWindow(WindowPtr pWin)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScrnInfoPtr pScrn;
+ AMDGPUInfoPtr info;
+ Bool ret;
+
+ if (pWin != pScreen->root)
+ ErrorF("%s called for non-root window %p\n", __func__, pWin);
+
+ pScrn = xf86ScreenToScrn(pScreen);
+ info = AMDGPUPTR(pScrn);
+ pScreen->CreateWindow = info->CreateWindow;
+ ret = pScreen->CreateWindow(pWin);
+
+ if (ret)
+ drmmode_copy_fb(pScrn, &info->drmmode);
+
+ return ret;
+}
+
+#endif
+
Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
{
AMDGPUInfoPtr info;
@@ -1153,6 +1181,13 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
}
pScrn->pScreen = pScreen;
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+ if (bgNoneRoot) {
+ info->CreateWindow = pScreen->CreateWindow;
+ pScreen->CreateWindow = AMDGPUCreateWindow;
+ }
+#endif
+
/* Provide SaveScreen & wrap BlockHandler and CloseScreen */
/* Wrap CloseScreen */
info->CloseScreen = pScreen->CloseScreen;
@@ -1209,6 +1244,11 @@ Bool AMDGPUEnterVT_KMS(VT_FUNC_ARGS_DECL)
pScrn->vtSema = TRUE;
+#if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10
+ if (bgNoneRoot)
+ drmmode_copy_fb(pScrn, &info->drmmode);
+#endif
+
if (!drmmode_set_desired_modes(pScrn, &info->drmmode))
return FALSE;
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index e4fc815..2a5d4ad 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1718,11 +1718,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
- if (bgNoneRoot)
- drmmode_copy_fb(pScrn, drmmode);
-#endif
-
for (c = 0; c < config->num_crtc; c++) {
xf86CrtcPtr crtc = config->crtc[c];
drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
--
2.5.0
More information about the xorg-driver-ati
mailing list