[PATCH 6/8] modesetting: Only handle hotplug uevent when vtSema

Daniel Martin daniel.martin at secunet.com
Fri Nov 28 02:20:51 PST 2014


From: Daniel Martin <consume.noise at gmail.com>

If the uevent isn't a hotplug event, ignore it, and if !vtSema postpone
the reprobing until EnterVT(). For the latter we add a 'flags' member to
the drmmode struct.

Signed-off-by: Daniel Martin <consume.noise at gmail.com>
---
 hw/xfree86/drivers/modesetting/driver.c          |  5 +++++
 hw/xfree86/drivers/modesetting/drmmode_display.c | 16 +++++++++++++++-
 hw/xfree86/drivers/modesetting/drmmode_display.h |  7 +++++++
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index d1284c6..44e66ce 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -1171,6 +1171,11 @@ EnterVT(ScrnInfoPtr pScrn)
 
     SetMaster(pScrn);
 
+    if (ms->drmmode.flags & DRMMODE_FLAG_REPROBE) {
+        drmmode_output_eval(&ms->drmmode);
+        ms->drmmode.flags &= ~DRMMODE_FLAG_REPROBE;
+    }
+
     if (!drmmode_set_desired_modes(pScrn, &ms->drmmode))
         return FALSE;
 
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index d5b7d00..e93cea5 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1487,6 +1487,14 @@ drmmode_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn)
 }
 
 #ifdef CONFIG_UDEV_KMS
+void
+drmmode_output_eval(drmmode_ptr drmmode)
+{
+    ScrnInfoPtr scrn = drmmode->scrn;
+
+    RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
+}
+
 static void
 drmmode_handle_uevents(int fd, void *closure)
 {
@@ -1498,7 +1506,13 @@ drmmode_handle_uevents(int fd, void *closure)
     if (!dev)
         return;
 
-    RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
+    if (udev_device_get_property_value(dev, "HOTPLUG")) {
+        if (scrn->vtSema)
+            drmmode_output_eval(drmmode);
+        else
+            drmmode->flags |= DRMMODE_FLAG_REPROBE;
+    }
+
     udev_device_unref(dev);
 }
 #endif
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index 92e2816..8455f52 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -40,8 +40,13 @@ struct dumb_bo {
     uint32_t pitch;
 };
 
+enum {
+    DRMMODE_FLAG_REPROBE = (1 << 0)
+} DRMMODE_FLAGS;
+
 typedef struct {
     int fd;
+    unsigned flags;
     unsigned fb_id;
     unsigned old_fb_id;
     drmModeResPtr mode_res;
@@ -139,6 +144,8 @@ 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_setup_colormap(ScreenPtr pScreen, ScrnInfoPtr pScrn);
 
+extern void drmmode_output_eval(drmmode_ptr dmmode);
+
 extern void drmmode_uevent_init(ScrnInfoPtr scrn, drmmode_ptr drmmode);
 extern void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode);
 
-- 
2.1.3



More information about the xorg-devel mailing list