modesetting: port clean start code from amdgpu. (v2)
Both radeon and amdgpu don't set the mode until the first blockhandler, this means everything should be rendered on the screen correctly by then. This ports this code, it also removes the tail call of EnterVT from ScreenInit, it really isn't necessary and causes us to set a dirty mode with -modesetting always anyways. v2: reorder set desired modes vs block handler as done for amdgpu. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
caabc4e855
commit
fa02b05645
|
@ -613,6 +613,17 @@ msBlockHandler(ScreenPtr pScreen, void *pTimeout, void *pReadmask)
|
|||
ms_dirty_update(pScreen);
|
||||
}
|
||||
|
||||
static void
|
||||
msBlockHandler_oneshot(ScreenPtr pScreen, void *pTimeout, void *pReadmask)
|
||||
{
|
||||
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
|
||||
modesettingPtr ms = modesettingPTR(pScrn);
|
||||
|
||||
msBlockHandler(pScreen, pTimeout, pReadmask);
|
||||
|
||||
drmmode_set_desired_modes(pScrn, &ms->drmmode, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
FreeRec(ScrnInfoPtr pScrn)
|
||||
{
|
||||
|
@ -972,7 +983,7 @@ CreateScreenResources(ScreenPtr pScreen)
|
|||
ret = pScreen->CreateScreenResources(pScreen);
|
||||
pScreen->CreateScreenResources = CreateScreenResources;
|
||||
|
||||
if (!drmmode_set_desired_modes(pScrn, &ms->drmmode))
|
||||
if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, pScrn->is_gpu))
|
||||
return FALSE;
|
||||
|
||||
if (!drmmode_glamor_handle_new_screen_pixmap(&ms->drmmode))
|
||||
|
@ -1235,7 +1246,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
|||
pScreen->CloseScreen = CloseScreen;
|
||||
|
||||
ms->BlockHandler = pScreen->BlockHandler;
|
||||
pScreen->BlockHandler = msBlockHandler;
|
||||
pScreen->BlockHandler = msBlockHandler_oneshot;
|
||||
|
||||
pScreen->SharePixmapBacking = msSharePixmapBacking;
|
||||
pScreen->SetSharedPixmapBacking = msSetSharedPixmapBacking;
|
||||
|
@ -1289,7 +1300,9 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
|||
}
|
||||
#endif
|
||||
|
||||
return EnterVT(pScrn);
|
||||
pScrn->vtSema = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1336,7 +1349,7 @@ EnterVT(ScrnInfoPtr pScrn)
|
|||
|
||||
SetMaster(pScrn);
|
||||
|
||||
if (!drmmode_set_desired_modes(pScrn, &ms->drmmode))
|
||||
if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, TRUE))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -1853,7 +1853,7 @@ drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y)
|
|||
}
|
||||
|
||||
Bool
|
||||
drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
|
||||
drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, Bool set_hw)
|
||||
{
|
||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||
int c;
|
||||
|
@ -1866,8 +1866,10 @@ drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
|
|||
|
||||
/* Skip disabled CRTCs */
|
||||
if (!crtc->enabled) {
|
||||
drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
|
||||
0, 0, 0, NULL, 0, NULL);
|
||||
if (set_hw) {
|
||||
drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
|
||||
0, 0, 0, NULL, 0, NULL);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1898,10 +1900,19 @@ 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;
|
||||
if (!xf86CrtcRotate(crtc))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -163,7 +163,7 @@ Bool drmmode_SetSlaveBO(PixmapPtr ppix,
|
|||
|
||||
extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
|
||||
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);
|
||||
extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
|
||||
|
||||
extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
|
||||
|
|
Loading…
Reference in New Issue
Block a user