From 986954c80a592b7e8ed8d52bd84e14bcbec62afe Mon Sep 17 00:00:00 2001 From: Jan Burgmeier Date: Fri, 23 Oct 2015 09:49:34 +0200 Subject: [PATCH 1/1] Revert "Defer initial modeset until the first BlockHandler invocation" This reverts commit 673e1c7637687c74fc9bdeeeffb7ace0d04b734f. Conflicts: src/drmmode_display.c src/radeon_kms.c --- src/drmmode_display.c | 55 ++++++++++++++++++++++++++++++++------------------- src/drmmode_display.h | 3 +-- src/radeon_kms.c | 24 +++++++++------------- 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 623124e..c1a8f54 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -429,6 +429,9 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) Bool force; GCPtr gc; int i; + int pitch; + uint32_t tiling_flags = 0; + Bool ret; for (i = 0; i < xf86_config->num_crtc; i++) { drmmode_crtc_private_ptr drmmode_crtc = xf86_config->crtc[i]->driver_private; @@ -453,9 +456,29 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) if (!src) return; - dst = pScreen->GetScreenPixmap(pScreen); + if (info->allowColorTiling) { + if (info->ChipFamily >= CHIP_FAMILY_R600) { + if (info->allowColorTiling2D) { + tiling_flags |= RADEON_TILING_MACRO; + } else { + tiling_flags |= RADEON_TILING_MICRO; + } + } else + tiling_flags |= RADEON_TILING_MACRO; + } + + pitch = RADEON_ALIGN(pScrn->displayWidth, + drmmode_get_pitch_align(pScrn, info->pixel_bytes, tiling_flags)) * + info->pixel_bytes; + + dst = drmmode_create_bo_pixmap(pScrn, pScrn->virtualX, + pScrn->virtualY, pScrn->depth, + pScrn->bitsPerPixel, pitch, + tiling_flags, info->front_bo, &info->front_surface); + if (!dst) + goto out_free_src; - gc = GetScratchGC(pScrn->depth, pScreen); + gc = GetScratchGC(pScrn->depth, pScreen); ValidateGC(&dst->drawable, gc); force = info->accel_state->force; @@ -471,6 +494,9 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode) pScreen->canDoBGNoneRoot = TRUE; destroy_pixmap_for_fbcon(pScrn); + drmmode_destroy_bo_pixmap(dst); + out_free_src: + drmmode_destroy_bo_pixmap(src); return; } @@ -2179,8 +2205,7 @@ void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y) } } -Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, - Bool set_hw) +Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int c; @@ -2193,12 +2218,9 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, /* Skip disabled CRTCs */ if (!crtc->enabled) { - if (set_hw) { - drmmode_do_crtc_dpms(crtc, DPMSModeOff); - drmModeSetCrtc(drmmode->fd, - drmmode_crtc->mode_crtc->crtc_id, - 0, 0, 0, NULL, 0, NULL); - } + drmmode_do_crtc_dpms(crtc, DPMSModeOff); + drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, + 0, 0, 0, NULL, 0, NULL); continue; } @@ -2231,16 +2253,9 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, crtc->desiredY = 0; } - if (set_hw) { - if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation, - crtc->desiredX, crtc->desiredY)) - return FALSE; - } else { - crtc->mode = crtc->desiredMode; - crtc->rotation = crtc->desiredRotation; - crtc->x = crtc->desiredX; - crtc->y = crtc->desiredY; - } + if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation, + crtc->desiredX, crtc->desiredY)) + return FALSE; } return TRUE; } diff --git a/src/drmmode_display.h b/src/drmmode_display.h index ab6c590..5eb7166 100644 --- a/src/drmmode_display.h +++ b/src/drmmode_display.h @@ -132,8 +132,7 @@ extern void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode); extern Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, struct radeon_bo_manager *bufmgr); extern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, struct radeon_bo *bo); void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y); -extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, - Bool set_hw); +extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode); #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 10 extern void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode); #endif diff --git a/src/radeon_kms.c b/src/radeon_kms.c index 8aa7633..4c8c20d 100644 --- a/src/radeon_kms.c +++ b/src/radeon_kms.c @@ -249,7 +249,7 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen) return FALSE; pScreen->CreateScreenResources = RADEONCreateScreenResources_KMS; - if (!drmmode_set_desired_modes(pScrn, &info->drmmode, FALSE)) + if (!drmmode_set_desired_modes(pScrn, &info->drmmode)) return FALSE; drmmode_uevent_init(pScrn, &info->drmmode); @@ -545,17 +545,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); - - drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE); - - RADEONBlockHandler_KMS(BLOCKHANDLER_ARGS); -} - static void radeon_flush_callback(CallbackListPtr *list, pointer user_data, pointer call_data) @@ -1734,7 +1723,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; if (!AddCallback(&FlushCallback, radeon_flush_callback, pScrn)) return FALSE; @@ -1787,8 +1776,13 @@ Bool RADEONEnterVT_KMS(VT_FUNC_ARGS_DECL) pScrn->vtSema = TRUE; - if (!drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE)) - return FALSE; +#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; return TRUE; } -- 2.6.1