xf86-video-r128: Branch 'master' - 3 commits

Connor Behan cbehan at kemper.freedesktop.org
Mon Mar 23 18:57:43 PDT 2015


 src/r128_output.c |   38 +++++++++++++++++++++++++++++++++-----
 src/r128_probe.c  |   32 +++++++++++++++-----------------
 2 files changed, 48 insertions(+), 22 deletions(-)

New commits:
commit d05022a1c398787d3f21d023a8251cb128ba9f9f
Author: Connor Behan <connor.behan at gmail.com>
Date:   Mon Mar 23 21:57:10 2015 -0400

    Update bitmasks for DDC
    
    A RAGE128TR chipset with a VGA port uses different i2c clock bits than
    the VGA cards previously tested. It seems reasonable to assume that
    other Pro2 cards are set up this way as well. In case this is incorrect,
    a newly added xf86I2CProbeAddress() should still allow a monitor to be
    detected.
    
    Signed-off-by: Connor Behan <connor.behan at gmail.com>
    Tested-by: Tobias Powalowski <tobias.powalowski at googlemail.com>

diff --git a/src/r128_output.c b/src/r128_output.c
index 7de4c4a..35aab72 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -240,8 +240,8 @@ static R128MonitorType R128DisplayDDCConnected(xf86OutputPtr output)
     if (r128_output->type == OUTPUT_LVDS) {
         return MT_LCD;
     } else if (r128_output->type == OUTPUT_VGA) {
-        mask1 = R128_GPIO_MONID_MASK_1 | R128_GPIO_MONID_MASK_3;
-        mask2 = R128_GPIO_MONID_A_1    | R128_GPIO_MONID_A_3;
+        mask1 = R128_GPIO_MONID_MASK_1 | (info->isPro2 ? R128_GPIO_MONID_MASK_2 : R128_GPIO_MONID_MASK_3);
+        mask2 = R128_GPIO_MONID_A_1    | (info->isPro2 ? R128_GPIO_MONID_A_2    : R128_GPIO_MONID_A_3);
     } else {
         mask1 = R128_GPIO_MONID_MASK_0 | R128_GPIO_MONID_MASK_3;
         mask2 = R128_GPIO_MONID_A_0    | R128_GPIO_MONID_A_3;
@@ -268,6 +268,9 @@ static R128MonitorType R128DisplayDDCConnected(xf86OutputPtr output)
             else
                 MonType = MT_CRT;
 	}
+    } else if (xf86I2CProbeAddress(r128_output->pI2CBus, 0x0060)) {
+        /* Just in case. */
+        MonType = MT_CRT;
     }
 
     return MonType;
@@ -474,8 +477,13 @@ Bool R128SetupConnectors(ScrnInfoPtr pScrn)
 
         if (otypes[i] != OUTPUT_LVDS && info->DDC) {
             i2c.ddc_reg      = R128_GPIO_MONID;
-            i2c.put_clk_mask = R128_GPIO_MONID_EN_3;
-            i2c.get_clk_mask = R128_GPIO_MONID_Y_3;
+            if (otypes[i] == OUTPUT_VGA && info->isPro2) {
+                i2c.put_clk_mask = R128_GPIO_MONID_EN_2;
+                i2c.get_clk_mask = R128_GPIO_MONID_Y_2;
+            } else {
+                i2c.put_clk_mask = R128_GPIO_MONID_EN_3;
+                i2c.get_clk_mask = R128_GPIO_MONID_Y_3;
+            }
             if (otypes[i] == OUTPUT_VGA) {
                 i2c.put_data_mask = R128_GPIO_MONID_EN_1;
                 i2c.get_data_mask = R128_GPIO_MONID_Y_1;
commit b9c9779398828d4a1491e32f731aad6f79653976
Author: Connor Behan <connor.behan at gmail.com>
Date:   Mon Mar 23 21:51:45 2015 -0400

    Look for VGA ports in the VBIOS
    
    It appears that not all r128 chipsets marked as DFP capable have DVI
    ports. Some have VGA which we should detect. The old driver "detected"
    this by attempting a DVI based probe for monitors. Anything that failed
    this was assumed to be VGA.
    
    Signed-off-by: Connor Behan <connor.behan at gmail.com>
    Tested-by: Tobias Powalowski <tobias.powalowski at googlemail.com>

diff --git a/src/r128_output.c b/src/r128_output.c
index 0160880..7de4c4a 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -390,9 +390,11 @@ void R128SetupGenericConnectors(ScrnInfoPtr pScrn, R128OutputType *otypes)
 
     if (!pR128Ent->HasCRTC2 && !info->isDFP) {
         otypes[0] = OUTPUT_VGA;
+        otypes[1] = OUTPUT_NONE;
         return;
     } else if (!pR128Ent->HasCRTC2) {
         otypes[0] = OUTPUT_DVI;
+        otypes[1] = OUTPUT_NONE;
 	return;
     }
 
@@ -400,6 +402,24 @@ void R128SetupGenericConnectors(ScrnInfoPtr pScrn, R128OutputType *otypes)
     otypes[1] = OUTPUT_VGA;
 }
 
+void R128GetConnectorInfoFromBIOS(ScrnInfoPtr pScrn, R128OutputType *otypes)
+{
+    R128InfoPtr info = R128PTR(pScrn);
+    uint16_t bios_header;
+    int offset;
+
+    /* XXX: Currently, this function only finds VGA ports misidentified as DVI. */
+    if (!info->VBIOS || otypes[0] != OUTPUT_DVI) return;
+
+    bios_header = R128_BIOS16(0x48);
+    offset = R128_BIOS16(bios_header + 0x60);
+
+    if (offset) {
+        otypes[0] = OUTPUT_VGA;
+        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Found CRT table, assuming VGA connector\n");
+    }
+}
+
 Bool R128SetupConnectors(ScrnInfoPtr pScrn)
 {
     R128InfoPtr info    = R128PTR(pScrn);
@@ -411,8 +431,8 @@ Bool R128SetupConnectors(ScrnInfoPtr pScrn)
     int num_dvi = 0;
     int i;
 
-    /* XXX: Can we make R128GetConnectorInfoFromBIOS()? */
     R128SetupGenericConnectors(pScrn, otypes);
+    R128GetConnectorInfoFromBIOS(pScrn, otypes);
 
     for (i = 0; i < R128_MAX_BIOS_CONNECTOR; i++) {
         if (otypes[i] == OUTPUT_VGA)
commit cd72de385b5600229226c3a7248a89569b452136
Author: Connor Behan <connor.behan at gmail.com>
Date:   Mon Mar 23 21:47:52 2015 -0400

    Fix allocation of private entity
    
    In the past, pR128Ent was only used for Xinerama-style dualhead and
    therefore only allocated for cards with two outputs. However, recent
    patches have repurposed pR128Ent as a general struct for things that are
    card-specific instead of instance-specific. It therefore needs to be
    allocated for all cards.
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=89236
    
    Signed-off-by: Connor Behan <connor.behan at gmail.com>
    Tested-by: Tobias Powalowski <tobias.powalowski at googlemail.com>

diff --git a/src/r128_probe.c b/src/r128_probe.c
index 9771d52..363904e 100644
--- a/src/r128_probe.c
+++ b/src/r128_probe.c
@@ -234,6 +234,7 @@ r128_get_scrninfo(int entity_num)
 {
     ScrnInfoPtr   pScrn = NULL;
     EntityInfoPtr pEnt;
+    DevUnion*     pPriv;
 
     pScrn = xf86ConfigPciEntity(pScrn, 0, entity_num, R128PciChipsets,
                                 NULL,
@@ -261,6 +262,20 @@ r128_get_scrninfo(int entity_num)
 
     pEnt = xf86GetEntityInfo(entity_num);
 
+    /* Allocate private entity used for convenience with one or two heads. */
+    if (gR128EntityIndex < 0) {
+        gR128EntityIndex = xf86AllocateEntityPrivateIndex();
+        pPriv = xf86GetEntityPrivate(pScrn->entityList[0], gR128EntityIndex);
+
+        if (!pPriv->ptr) {
+            R128EntPtr pR128Ent;
+            pPriv->ptr = xnfcalloc(sizeof(R128EntRec), 1);
+            pR128Ent = pPriv->ptr;
+            pR128Ent->HasSecondary = FALSE;
+            pR128Ent->IsSecondaryRestored = FALSE;
+        }
+    }
+
     /* mobility cards support Dual-Head, mark the entity as sharable*/
     if (pEnt->chipset == PCI_CHIP_RAGE128LE ||
         pEnt->chipset == PCI_CHIP_RAGE128LF ||
@@ -268,7 +283,6 @@ r128_get_scrninfo(int entity_num)
         pEnt->chipset == PCI_CHIP_RAGE128ML)
     {
         static int instance = 0;
-        DevUnion* pPriv;
 
         xf86SetEntitySharable(entity_num);
 
@@ -276,22 +290,6 @@ r128_get_scrninfo(int entity_num)
                                        pScrn->entityList[0],
                                        instance);
 
-        if (gR128EntityIndex < 0)
-        {
-            gR128EntityIndex = xf86AllocateEntityPrivateIndex();
-
-            pPriv = xf86GetEntityPrivate(pScrn->entityList[0],
-                                         gR128EntityIndex);
-
-            if (!pPriv->ptr)
-            {
-                R128EntPtr pR128Ent;
-                pPriv->ptr = xnfcalloc(sizeof(R128EntRec), 1);
-                pR128Ent = pPriv->ptr;
-                pR128Ent->HasSecondary = FALSE;
-                pR128Ent->IsSecondaryRestored = FALSE;
-            }
-        }
         instance++;
     }
 


More information about the xorg-commit mailing list