vmwgfx-xorg: Avoid enabling unwanted outputs in initial configuration
authorThomas Hellstrom <thellstrom@vmware.com>
Tue, 30 Aug 2011 10:22:53 +0000 (12:22 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Wed, 31 Aug 2011 12:39:21 +0000 (14:39 +0200)
Add a hack so that we avoid enabling all connected outputs during the
initial configuration. On older X servers they would be enabled as cloned,
which didn't really cause any problem, but on later X servers they would
initially be enabled next to eachother which looks odd.

A RandR call will still show the disabled outputs as connected, and if there
is a monitor section in the config file for the output in question,
it will also have a connected status, so that it may be explicitly enabled
or disabled from a config file.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
vmwgfx/vmwgfx_driver.c
vmwgfx/vmwgfx_driver.h
vmwgfx/vmwgfx_output.c

index 629638e..a682e55 100644 (file)
@@ -426,10 +426,12 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
     xorg_crtc_init(pScrn);
     xorg_output_init(pScrn);
 
+    ms->initialization = TRUE;
     if (!xf86InitialConfiguration(pScrn, TRUE)) {
        xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
        return FALSE;
     }
+    ms->initialization = FALSE;
 
     /*
      * If the driver can do gamma correction, it should call xf86SetGamma() here.
index cb92bc9..8b3017d 100644 (file)
@@ -112,6 +112,8 @@ typedef struct _modesettingRec
 #ifdef DRI2
     Bool dri2_available;
 #endif
+
+    Bool initialization;
 } modesettingRec, *modesettingPtr;
 
 #define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))
index 2081f2a..5ec84a1 100644 (file)
@@ -104,7 +104,25 @@ output_detect(xf86OutputPtr output)
 
     switch (drm_connector->connection) {
     case DRM_MODE_CONNECTED:
-       status = XF86OutputStatusConnected;
+       /*
+        * Hack to avoid enabling outputs during the intial
+        * configuration that are connected but that we don't
+        * really want to have enabled just yet.
+        *
+        * If we are in initial config, and
+        * an output higher than LVDS1 is connected,
+        * and it has no monitor section in the config file,
+        * status will be reported as unknown, which means
+        * the xorg modesetting code will think it is
+        * disconnected.
+        */
+
+       if (ms->initialization &&
+           drm_connector->connector_type_id != 1 &&
+           !output->conf_monitor)
+           status = XF86OutputStatusUnknown;
+       else
+           status = XF86OutputStatusConnected;
        break;
     case DRM_MODE_DISCONNECTED:
        status = XF86OutputStatusDisconnected;