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

Daniel Martin daniel.martin at secunet.com
Mon Dec 8 03:03:05 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().

v2: Replace 'flags' member and enum with Bool 'need_reprobe'.

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 |  3 +++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index d1284c6..221901f 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.need_reprobe) {
+        drmmode_output_eval(&ms->drmmode);
+        ms->drmmode.need_reprobe = FALSE;
+    }
+
     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..f1ef9bc 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->need_reprobe = TRUE;
+    }
+
     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..a241985 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -57,6 +57,7 @@ typedef struct {
     Bool sw_cursor;
 
     Bool glamor;
+    Bool need_reprobe;
     Bool shadow_enable;
     void *shadow_fb;
 
@@ -139,6 +140,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