summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMartin Peres <martin.peres@linux.intel.com>2020-12-01 11:10:34 +0100
committerMichel Dänzer <mdaenzer@redhat.com>2020-12-01 11:10:34 +0100
commitbd0f53725b581e4698f5f3ec366a9507bd2556e2 (patch)
tree491016ef43b427f2afca6f62647ebe1fa8dce7f9 /hw
parent5c400cae1f9817045378966effa6bca91e45aead (diff)
modesetting: check the kms state on EnterVT
Normally, we would receive a uevent coming from Linux's DRM subsystem, which would trigger the check for disappearing/appearing resources. However, this event is not received when X is not master (another VT is selected), and so the userspace / desktop environment would not be notified about the changes that happened while X wasn't master. To fix the issue, this patch forces a refresh on EnterVT by splitting the kms-checking code from the uevent handling into its own (exported) function called drmmode_update_kms_state. This function is then called from both the uevent-handling function, and on EnterVT right before restoring the modes. Signed-off-by: Martin Peres <martin.peres@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Kishore Kadiyala <kishore.kadiyala@intel.com> Tested-by: Kishore Kadiyala <kishore.kadiyala@intel.com> (cherry picked from commit 293cf660c95d7ba36510bcc4114d7fd5c5f3801c)
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/drivers/modesetting/driver.c2
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.c34
-rw-r--r--hw/xfree86/drivers/modesetting/drmmode_display.h1
3 files changed, 24 insertions, 13 deletions
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 2aaea5f7d..a4d486a67 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -1820,6 +1820,8 @@ EnterVT(ScrnInfoPtr pScrn)
SetMaster(pScrn);
+ drmmode_update_kms_state(&ms->drmmode);
+
if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, TRUE))
return FALSE;
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 9dd8c5573..646bacecb 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -3607,30 +3607,19 @@ drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
return TRUE;
}
-#ifdef CONFIG_UDEV_KMS
-
#define DRM_MODE_LINK_STATUS_GOOD 0
#define DRM_MODE_LINK_STATUS_BAD 1
-static void
-drmmode_handle_uevents(int fd, void *closure)
+void
+drmmode_update_kms_state(drmmode_ptr drmmode)
{
- drmmode_ptr drmmode = closure;
ScrnInfoPtr scrn = drmmode->scrn;
- struct udev_device *dev;
drmModeResPtr mode_res;
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int i, j;
Bool found = FALSE;
Bool changed = FALSE;
- while ((dev = udev_monitor_receive_device(drmmode->uevent_monitor))) {
- udev_device_unref(dev);
- found = TRUE;
- }
- if (!found)
- return;
-
/* Try to re-set the mode on all the connectors with a BAD link-state:
* This may happen if a link degrades and a new modeset is necessary, using
* different link-training parameters. If the kernel found that the current
@@ -3745,6 +3734,25 @@ out:
#undef DRM_MODE_LINK_STATUS_BAD
#undef DRM_MODE_LINK_STATUS_GOOD
+#ifdef CONFIG_UDEV_KMS
+
+static void
+drmmode_handle_uevents(int fd, void *closure)
+{
+ drmmode_ptr drmmode = closure;
+ struct udev_device *dev;
+ Bool found = FALSE;
+
+ while ((dev = udev_monitor_receive_device(drmmode->uevent_monitor))) {
+ udev_device_unref(dev);
+ found = TRUE;
+ }
+ if (!found)
+ return;
+
+ drmmode_update_kms_state(drmmode);
+}
+
#endif
void
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index 4142607fb..6ef8ab9e4 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -281,6 +281,7 @@ 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_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
+extern void drmmode_update_kms_state(drmmode_ptr drmmode);
extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);