summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2015-04-02 17:54:33 +0900
committerMichel Dänzer <michel@daenzer.net>2015-04-23 10:16:17 +0900
commit673e1c7637687c74fc9bdeeeffb7ace0d04b734f (patch)
tree8a64fd5fd12eda1fe73eacdde18e12b879dcda7b
parent37874a4eeace5df04b02c8fc28f67b824e3f0f5f (diff)
Defer initial modeset until the first BlockHandler invocation
This ensures that the screen pixmap contents have been initialized when the initial modes are set. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27757 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/drmmode_display.c44
-rw-r--r--src/drmmode_display.h3
-rw-r--r--src/radeon_kms.c17
3 files changed, 30 insertions, 34 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 76b25779..064a64c1 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -395,8 +395,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
ScreenPtr pScreen = pScrn->pScreen;
int fbcon_id = 0;
int i;
- int pitch;
- uint32_t tiling_flags = 0;
Bool ret;
for (i = 0; i < xf86_config->num_crtc; i++) {
@@ -422,28 +420,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
if (!src)
return;
- 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;
-
+ dst = pScreen->GetScreenPixmap(pScreen);
ret = info->accel_state->exa->PrepareCopy (src, dst,
-1, -1, GXcopy, FB_ALLONES);
if (!ret)
@@ -454,7 +431,6 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
radeon_cs_flush_indirect(pScrn);
pScreen->canDoBGNoneRoot = TRUE;
- drmmode_destroy_bo_pixmap(dst);
out_free_src:
drmmode_destroy_bo_pixmap(src);
return;
@@ -2109,7 +2085,8 @@ void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y)
}
}
-Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
+ Bool set_hw)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c;
@@ -2121,7 +2098,7 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
int o;
/* Skip disabled CRTCs */
- if (!crtc->enabled) {
+ if (set_hw && !crtc->enabled) {
drmmode_do_crtc_dpms(crtc, DPMSModeOff);
drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
0, 0, 0, NULL, 0, NULL);
@@ -2157,9 +2134,16 @@ Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
crtc->desiredY = 0;
}
- if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation,
- crtc->desiredX, crtc->desiredY))
- return FALSE;
+ 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;
+ }
}
return TRUE;
}
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 49b02d63..2fdd3e0d 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -126,7 +126,8 @@ 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);
+extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
+ Bool set_hw);
#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 8ec156fc..5a2d2dae 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -245,7 +245,7 @@ static Bool RADEONCreateScreenResources_KMS(ScreenPtr pScreen)
return FALSE;
pScreen->CreateScreenResources = RADEONCreateScreenResources_KMS;
- if (!drmmode_set_desired_modes(pScrn, &info->drmmode))
+ if (!drmmode_set_desired_modes(pScrn, &info->drmmode, FALSE))
return FALSE;
drmmode_uevent_init(pScrn, &info->drmmode);
@@ -535,6 +535,17 @@ 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)
@@ -1707,7 +1718,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
pScreen->CloseScreen = RADEONCloseScreen_KMS;
pScreen->SaveScreen = RADEONSaveScreen_KMS;
info->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = RADEONBlockHandler_KMS;
+ pScreen->BlockHandler = RADEONBlockHandler_oneshot;
if (!AddCallback(&FlushCallback, radeon_flush_callback, pScrn))
return FALSE;
@@ -1765,7 +1776,7 @@ Bool RADEONEnterVT_KMS(VT_FUNC_ARGS_DECL)
drmmode_copy_fb(pScrn, &info->drmmode);
#endif
- if (!drmmode_set_desired_modes(pScrn, &info->drmmode))
+ if (!drmmode_set_desired_modes(pScrn, &info->drmmode, TRUE))
return FALSE;
return TRUE;