From 37874a4eeace5df04b02c8fc28f67b824e3f0f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 21 Apr 2015 17:19:15 +0900 Subject: Defer initial drmmode_copy_fb call until root window creation That's late enough for acceleration to be fully initialized, but still early enough to set pScreen->canDoBGNoneRoot. Reviewed-by: Alex Deucher --- 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 edeba478..76b25779 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 1c794ce0..962a68d2 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 dd785f5c..8ec156fc 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; -- cgit v1.2.3