|
|
733295 |
From 287a960c316ecae5cb87c9d23dcb25810d67a0d1 Mon Sep 17 00:00:00 2001
|
|
|
733295 |
From: Kishore Kadiyala <kishore.kadiyala@intel.com>
|
|
|
733295 |
Date: Sat, 19 Sep 2020 01:28:14 +0530
|
|
|
733295 |
Subject: [PATCH xserver 2/2] modesetting: keep going if a modeset fails on
|
|
|
733295 |
EnterVT
|
|
|
733295 |
MIME-Version: 1.0
|
|
|
733295 |
Content-Type: text/plain; charset=UTF-8
|
|
|
733295 |
Content-Transfer-Encoding: 8bit
|
|
|
733295 |
|
|
|
733295 |
There was a time when setting a mode on a CRTC would not depend on the
|
|
|
733295 |
associated connector's state. If a mode had been set successfully once,
|
|
|
733295 |
it would mean it would work later on.
|
|
|
733295 |
|
|
|
733295 |
This changed with the introduction of new connectors type that now
|
|
|
733295 |
require a link training sequence (DP, HDMI 2.0), and that means that
|
|
|
733295 |
some events may have happened while the X server was not master that
|
|
|
733295 |
would then prevent the mode from successfully be restored to its
|
|
|
733295 |
previous state.
|
|
|
733295 |
|
|
|
733295 |
This patch relaxes the requirement that all modes should be restored on
|
|
|
733295 |
EnterVT, or the entire X-Server would go down by allowing modesets to
|
|
|
733295 |
fail (with some warnings). If a modeset fails, the CRTC will be
|
|
|
733295 |
disabled, and a RandR event will be sent for the desktop environment to
|
|
|
733295 |
fix the situation as well as possible.
|
|
|
733295 |
|
|
|
733295 |
Additional patches might be needed to make sure that the user would
|
|
|
733295 |
never be left with all screens black in some scenarios.
|
|
|
733295 |
|
|
|
733295 |
v2 (Martin Peres):
|
|
|
733295 |
- whitespace fixes
|
|
|
733295 |
- remove the uevent handling (it is done in a previous patch)
|
|
|
733295 |
- improve the commit message
|
|
|
733295 |
- reduce the size of the patch by not changing lines needlessly
|
|
|
733295 |
- return FALSE if one modeset fails in ignore mode
|
|
|
733295 |
- add comments/todos to explain why we do things
|
|
|
733295 |
- disable the CRTCs that failed the modeset
|
|
|
733295 |
|
|
|
733295 |
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
|
|
|
733295 |
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
|
|
|
733295 |
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
|
|
|
733295 |
Tested-by: Kishore Kadiyala <kishore.kadiyala@intel.com>
|
|
|
733295 |
Closes: #1010
|
|
|
733295 |
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
|
|
|
733295 |
---
|
|
|
733295 |
hw/xfree86/drivers/modesetting/driver.c | 23 +++++++++++++++----
|
|
|
733295 |
.../drivers/modesetting/drmmode_display.c | 19 +++++++++++----
|
|
|
733295 |
.../drivers/modesetting/drmmode_display.h | 3 ++-
|
|
|
733295 |
3 files changed, 36 insertions(+), 9 deletions(-)
|
|
|
733295 |
|
|
|
733295 |
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
|
|
|
733295 |
index a4d486a67..ef4a3147d 100644
|
|
|
733295 |
--- a/hw/xfree86/drivers/modesetting/driver.c
|
|
|
733295 |
+++ b/hw/xfree86/drivers/modesetting/driver.c
|
|
|
733295 |
@@ -705,7 +705,7 @@ msBlockHandler_oneshot(ScreenPtr pScreen, void *pTimeout)
|
|
|
733295 |
|
|
|
733295 |
msBlockHandler(pScreen, pTimeout);
|
|
|
733295 |
|
|
|
733295 |
- drmmode_set_desired_modes(pScrn, &ms->drmmode, TRUE);
|
|
|
733295 |
+ drmmode_set_desired_modes(pScrn, &ms->drmmode, TRUE, FALSE);
|
|
|
733295 |
}
|
|
|
733295 |
|
|
|
733295 |
static void
|
|
|
733295 |
@@ -1348,7 +1348,7 @@ CreateScreenResources(ScreenPtr pScreen)
|
|
|
733295 |
ret = pScreen->CreateScreenResources(pScreen);
|
|
|
733295 |
pScreen->CreateScreenResources = CreateScreenResources;
|
|
|
733295 |
|
|
|
733295 |
- if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, pScrn->is_gpu))
|
|
|
733295 |
+ if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, pScrn->is_gpu, FALSE))
|
|
|
733295 |
return FALSE;
|
|
|
733295 |
|
|
|
733295 |
if (!drmmode_glamor_handle_new_screen_pixmap(&ms->drmmode))
|
|
|
733295 |
@@ -1822,8 +1822,23 @@ EnterVT(ScrnInfoPtr pScrn)
|
|
|
733295 |
|
|
|
733295 |
drmmode_update_kms_state(&ms->drmmode);
|
|
|
733295 |
|
|
|
733295 |
- if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, TRUE))
|
|
|
733295 |
- return FALSE;
|
|
|
733295 |
+ /* allow not all modes to be set successfully since some events might have
|
|
|
733295 |
+ * happened while not being master that could prevent the previous
|
|
|
733295 |
+ * configuration from being re-applied.
|
|
|
733295 |
+ */
|
|
|
733295 |
+ if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, TRUE, TRUE)) {
|
|
|
733295 |
+ xf86DisableUnusedFunctions(pScrn);
|
|
|
733295 |
+
|
|
|
733295 |
+ /* TODO: check that at least one screen is on, to allow the user to fix
|
|
|
733295 |
+ * their setup if all modeset failed...
|
|
|
733295 |
+ */
|
|
|
733295 |
+
|
|
|
733295 |
+ /* Tell the desktop environment that something changed, so that they
|
|
|
733295 |
+ * can hopefully correct the situation
|
|
|
733295 |
+ */
|
|
|
733295 |
+ RRSetChanged(xf86ScrnToScreen(pScrn));
|
|
|
733295 |
+ RRTellChanged(xf86ScrnToScreen(pScrn));
|
|
|
733295 |
+ }
|
|
|
733295 |
|
|
|
733295 |
return TRUE;
|
|
|
733295 |
}
|
|
|
733295 |
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
|
|
|
733295 |
index 646bacecb..88992f521 100644
|
|
|
733295 |
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
|
|
|
733295 |
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
|
|
|
733295 |
@@ -3457,9 +3457,11 @@ drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y)
|
|
|
733295 |
}
|
|
|
733295 |
|
|
|
733295 |
Bool
|
|
|
733295 |
-drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, Bool set_hw)
|
|
|
733295 |
+drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, Bool set_hw,
|
|
|
733295 |
+ Bool ign_err)
|
|
|
733295 |
{
|
|
|
733295 |
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
|
|
733295 |
+ Bool success = TRUE;
|
|
|
733295 |
int c;
|
|
|
733295 |
|
|
|
733295 |
for (c = 0; c < config->num_crtc; c++) {
|
|
|
733295 |
@@ -3507,8 +3509,17 @@ drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, Bool set_hw)
|
|
|
733295 |
if (set_hw) {
|
|
|
733295 |
if (!crtc->funcs->
|
|
|
733295 |
set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation,
|
|
|
733295 |
- crtc->desiredX, crtc->desiredY))
|
|
|
733295 |
- return FALSE;
|
|
|
733295 |
+ crtc->desiredX, crtc->desiredY)) {
|
|
|
733295 |
+ if (!ign_err)
|
|
|
733295 |
+ return FALSE;
|
|
|
733295 |
+ else {
|
|
|
733295 |
+ success = FALSE;
|
|
|
733295 |
+ crtc->enabled = FALSE;
|
|
|
733295 |
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
|
|
|
733295 |
+ "Failed to set the desired mode on connector %s\n",
|
|
|
733295 |
+ output->name);
|
|
|
733295 |
+ }
|
|
|
733295 |
+ }
|
|
|
733295 |
} else {
|
|
|
733295 |
crtc->mode = crtc->desiredMode;
|
|
|
733295 |
crtc->rotation = crtc->desiredRotation;
|
|
|
733295 |
@@ -3522,7 +3533,7 @@ drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, Bool set_hw)
|
|
|
733295 |
/* Validate leases on VT re-entry */
|
|
|
733295 |
drmmode_validate_leases(pScrn);
|
|
|
733295 |
|
|
|
733295 |
- return TRUE;
|
|
|
733295 |
+ return success;
|
|
|
733295 |
}
|
|
|
733295 |
|
|
|
733295 |
static void
|
|
|
733295 |
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
|
|
|
733295 |
index 6ef8ab9e4..59d79e9a0 100644
|
|
|
733295 |
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
|
|
|
733295 |
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
|
|
|
733295 |
@@ -278,7 +278,8 @@ void drmmode_DisableSharedPixmapFlipping(xf86CrtcPtr crtc, drmmode_ptr drmmode);
|
|
|
733295 |
extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
|
|
|
733295 |
extern Bool drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
|
|
|
733295 |
void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y);
|
|
|
733295 |
-extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode, Bool set_hw);
|
|
|
733295 |
+extern Bool drmmode_set_desired_modes(ScrnInfoPtr pScrn, drmmode_ptr drmmode,
|
|
|
733295 |
+ Bool set_hw, Bool ign_err);
|
|
|
733295 |
extern Bool drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
|
|
|
733295 |
|
|
|
733295 |
extern void drmmode_update_kms_state(drmmode_ptr drmmode);
|
|
|
733295 |
--
|
|
|
733295 |
2.28.0
|
|
|
733295 |
|