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

George Sapountzis gsap7 at kemper.freedesktop.org
Fri Feb 8 09:10:06 PST 2008


 src/atipreinit.c |  227 ++++++++++++++++++++++++++++++-------------------------
 1 file changed, 126 insertions(+), 101 deletions(-)

New commits:
commit 8606c1bd175893c77e8c758246a1aed166c8be51
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Fri Feb 8 19:07:03 2008 +0200

    mach64: factor out BIOS panel info parsing

diff --git a/src/atipreinit.c b/src/atipreinit.c
index d980b95..86ef80d 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -371,6 +371,114 @@ ati_bios_mmedia
 }
 
 /*
+ * Determine panel dimensions and model.
+ */
+static void
+ati_bios_panel_info
+(
+    ScrnInfoPtr  pScreenInfo,
+    ATIPtr       pATI,
+    CARD8       *BIOS,
+    unsigned int BIOSSize,
+    unsigned int LCDTable
+)
+{
+    unsigned int LCDPanelInfo = 0;
+    char         Buffer[128];
+    int          i, j;
+
+    if (LCDTable > 0)
+    {
+        LCDPanelInfo = BIOSWord(LCDTable + 0x0AU);
+        if (((LCDPanelInfo + 0x1DU) > BIOSSize) ||
+            ((BIOSByte(LCDPanelInfo) != pATI->LCDPanelID) &&
+             (pATI->LCDPanelID || (BIOSByte(LCDPanelInfo) > 0x1FU) ||
+              (pATI->Chip <= ATI_CHIP_264LTPRO))))
+            LCDPanelInfo = 0;
+    }
+
+    if (!LCDPanelInfo)
+    {
+        /*
+         * Scan BIOS for panel info table.
+         */
+        for (i = 0;  i <= (int)(BIOSSize - 0x1DU);  i++)
+        {
+            /* Look for panel ID ... */
+            if ((BIOSByte(i) != pATI->LCDPanelID) &&
+                (pATI->LCDPanelID || (BIOSByte(i) > 0x1FU) ||
+                 (pATI->Chip <= ATI_CHIP_264LTPRO)))
+                continue;
+
+            /* ... followed by 24-byte panel model name ... */
+            for (j = 0;  j < 24;  j++)
+            {
+                if ((CARD8)(BIOSByte(i + j + 1) - 0x20U) > 0x5FU)
+                {
+                    i += j;
+                    goto NextBIOSByte;
+                }
+            }
+
+            /* ... verify panel width ... */
+            if (pATI->LCDHorizontal &&
+                (pATI->LCDHorizontal != BIOSWord(i + 0x19U)))
+                continue;
+
+            /* ... and verify panel height */
+            if (pATI->LCDVertical &&
+                (pATI->LCDVertical != BIOSWord(i + 0x1BU)))
+                continue;
+
+            if (LCDPanelInfo)
+            {
+                /*
+                 * More than one possibility, but don't care if all
+                 * tables describe panels of the same size.
+                 */
+                if ((BIOSByte(LCDPanelInfo + 0x19U) ==
+                     BIOSByte(i + 0x19U)) &&
+                    (BIOSByte(LCDPanelInfo + 0x1AU) ==
+                     BIOSByte(i + 0x1AU)) &&
+                    (BIOSByte(LCDPanelInfo + 0x1BU) ==
+                     BIOSByte(i + 0x1BU)) &&
+                    (BIOSByte(LCDPanelInfo + 0x1CU) ==
+                     BIOSByte(i + 0x1CU)))
+                    continue;
+
+                LCDPanelInfo = 0;
+                break;
+            }
+
+            LCDPanelInfo = i;
+
+    NextBIOSByte:  ;
+        }
+    }
+
+    if (LCDPanelInfo > 0)
+    {
+        pATI->LCDPanelID = BIOSByte(LCDPanelInfo);
+        pATI->LCDHorizontal = BIOSWord(LCDPanelInfo + 0x19U);
+        pATI->LCDVertical = BIOSWord(LCDPanelInfo + 0x1BU);
+    }
+
+    if (LCDPanelInfo)
+    {
+        for (i = 0;  i < 24;  i++)
+            Buffer[i] = BIOSByte(LCDPanelInfo + 1 + i);
+        for (;  --i >= 0;  )
+            if (Buffer[i] && Buffer[i] != ' ')
+            {
+                Buffer[i + 1] = '\0';
+                xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
+                    "Panel model %s.\n", Buffer);
+                break;
+            }
+    }
+}
+
+/*
  * ATIPreInit --
  *
  * This function is only called once per screen at the start of the first
@@ -386,7 +494,7 @@ ATIPreInit
     CARD8            BIOS[BIOS_SIZE];
     unsigned int     BIOSSize = 0;
     unsigned int     ROMTable = 0, ClockTable = 0, FrequencyTable = 0;
-    unsigned int     LCDTable = 0, LCDPanelInfo = 0, VideoTable = 0;
+    unsigned int     LCDTable = 0, VideoTable = 0;
     unsigned int     HardwareTable = 0;
 
     char             Buffer[128], *Message;
@@ -872,88 +980,13 @@ ATIPreInit
 
         ati_bios_mmedia(pScreenInfo, pATI, BIOS, VideoTable);
 
-        /* Determine panel dimensions */
         if (pATI->LCDPanelID >= 0)
         {
             LCDTable = BIOSWord(0x78U);
             if ((LCDTable + BIOSByte(LCDTable + 5)) > BIOSSize)
                 LCDTable = 0;
 
-            if (LCDTable > 0)
-            {
-                LCDPanelInfo = BIOSWord(LCDTable + 0x0AU);
-                if (((LCDPanelInfo + 0x1DU) > BIOSSize) ||
-                    ((BIOSByte(LCDPanelInfo) != pATI->LCDPanelID) &&
-                     (pATI->LCDPanelID || (BIOSByte(LCDPanelInfo) > 0x1FU) ||
-                      (pATI->Chip <= ATI_CHIP_264LTPRO))))
-                    LCDPanelInfo = 0;
-            }
-
-            if (!LCDPanelInfo)
-            {
-                /*
-                 * Scan BIOS for panel info table.
-                 */
-                for (i = 0;  i <= (int)(BIOSSize - 0x1DU);  i++)
-                {
-                    /* Look for panel ID ... */
-                    if ((BIOSByte(i) != pATI->LCDPanelID) &&
-                        (pATI->LCDPanelID || (BIOSByte(i) > 0x1FU) ||
-                         (pATI->Chip <= ATI_CHIP_264LTPRO)))
-                        continue;
-
-                    /* ... followed by 24-byte panel model name ... */
-                    for (j = 0;  j < 24;  j++)
-                    {
-                        if ((CARD8)(BIOSByte(i + j + 1) - 0x20U) > 0x5FU)
-                        {
-                            i += j;
-                            goto NextBIOSByte;
-                        }
-                    }
-
-                    /* ... verify panel width ... */
-                    if (pATI->LCDHorizontal &&
-                        (pATI->LCDHorizontal != BIOSWord(i + 0x19U)))
-                        continue;
-
-                    /* ... and verify panel height */
-                    if (pATI->LCDVertical &&
-                        (pATI->LCDVertical != BIOSWord(i + 0x1BU)))
-                        continue;
-
-                    if (LCDPanelInfo)
-                    {
-                        /*
-                         * More than one possibility, but don't care if all
-                         * tables describe panels of the same size.
-                         */
-                        if ((BIOSByte(LCDPanelInfo + 0x19U) ==
-                             BIOSByte(i + 0x19U)) &&
-                            (BIOSByte(LCDPanelInfo + 0x1AU) ==
-                             BIOSByte(i + 0x1AU)) &&
-                            (BIOSByte(LCDPanelInfo + 0x1BU) ==
-                             BIOSByte(i + 0x1BU)) &&
-                            (BIOSByte(LCDPanelInfo + 0x1CU) ==
-                             BIOSByte(i + 0x1CU)))
-                            continue;
-
-                        LCDPanelInfo = 0;
-                        break;
-                    }
-
-                    LCDPanelInfo = i;
-
-            NextBIOSByte:  ;
-                }
-            }
-
-            if (LCDPanelInfo > 0)
-            {
-                pATI->LCDPanelID = BIOSByte(LCDPanelInfo);
-                pATI->LCDHorizontal = BIOSWord(LCDPanelInfo + 0x19U);
-                pATI->LCDVertical = BIOSWord(LCDPanelInfo + 0x1BU);
-            }
+            ati_bios_panel_info(pScreenInfo, pATI, BIOS, BIOSSize, LCDTable);
         }
 
         xf86DrvMsgVerb(pScreenInfo->scrnIndex, X_INFO, 3,
@@ -963,8 +996,8 @@ ATIPreInit
             "BIOS Data:  ClockTable=0x%04X, FrequencyTable=0x%04X.\n",
             ClockTable, FrequencyTable);
         xf86DrvMsgVerb(pScreenInfo->scrnIndex, X_INFO, 3,
-            "BIOS Data:  LCDTable=0x%04X, LCDPanelInfo=0x%04X.\n",
-            LCDTable, LCDPanelInfo);
+            "BIOS Data:  LCDTable=0x%04X.\n",
+            LCDTable);
         xf86DrvMsgVerb(pScreenInfo->scrnIndex, X_INFO, 3,
             "BIOS Data:  VideoTable=0x%04X, HardwareTable=0x%04X.\n",
             VideoTable, HardwareTable);
@@ -1725,20 +1758,6 @@ ATIPreInit
                     "%dx%d panel detected.\n",
                     pATI->LCDHorizontal, pATI->LCDVertical);
 
-            if (LCDPanelInfo)
-            {
-                for (i = 0;  i < 24;  i++)
-                    Buffer[i] = BIOSByte(LCDPanelInfo + 1 + i);
-                for (;  --i >= 0;  )
-                    if (Buffer[i] && Buffer[i] != ' ')
-                    {
-                        Buffer[i + 1] = '\0';
-                        xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED,
-                            "Panel model %s.\n", Buffer);
-                        break;
-                    }
-            }
-
             /*
              * Determine panel clock.  This must be done after option
              * processing so that the adapter's reference frequency is always
commit 9f33218c80f5a6d6d9464aa3db8ae25a4759f351
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Fri Feb 8 19:06:41 2008 +0200

    mach64: minor cosmetic, LCD panel id

diff --git a/src/atipreinit.c b/src/atipreinit.c
index 0b0e8ad..d980b95 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -654,7 +654,6 @@ ATIPreInit
 #endif /* AVOID_CPIO */
 
     /* Finish private area initialisation */
-    pATI->LCDPanelID = -1;
     pATI->nFIFOEntries = 16;                    /* For now */
 
     /* Finish probing the adapter */
@@ -739,7 +738,16 @@ ATIPreInit
             if (pATI->Chip >= ATI_CHIP_264CT)
             {
                 pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE_T);
+            }
+            else
+            {
+                pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE);
+            }
+
+            pATI->LCDPanelID = -1;
 
+            if (pATI->Chip >= ATI_CHIP_264CT)
+            {
                 /* Get LCD panel id */
                 if (pATI->Chip == ATI_CHIP_264LT)
                 {
@@ -807,10 +815,6 @@ ATIPreInit
                         pATI->OptionPanelDisplay = FALSE;
                 }
             }
-            else
-            {
-                pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE);
-            }
 
             /* Get DAC type */
             pATI->DAC = GetBits(inr(DAC_CNTL), DAC_TYPE);
commit 8cd5a465a03834b4b2f3a19f8d36fc9d2e18c6d4
Author: George Sapountzis <gsap7 at yahoo.gr>
Date:   Fri Feb 8 19:06:27 2008 +0200

    mach64: minor cosmetic, DAC type

diff --git a/src/atipreinit.c b/src/atipreinit.c
index 8c67932..0b0e8ad 100644
--- a/src/atipreinit.c
+++ b/src/atipreinit.c
@@ -654,8 +654,6 @@ ATIPreInit
 #endif /* AVOID_CPIO */
 
     /* Finish private area initialisation */
-    pATI->DAC = ATI_DAC_GENERIC;
-
     pATI->LCDPanelID = -1;
     pATI->nFIFOEntries = 16;                    /* For now */
 
@@ -737,8 +735,6 @@ ATIPreInit
                     pATI->VideoRAM = (IOValue - 7) * 2048;
             }
 
-            pATI->DAC = GetBits(inr(DAC_CNTL), DAC_TYPE);
-
             IOValue = inr(CONFIG_STATUS64_0);
             if (pATI->Chip >= ATI_CHIP_264CT)
             {
@@ -814,7 +810,13 @@ ATIPreInit
             else
             {
                 pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE);
+            }
 
+            /* Get DAC type */
+            pATI->DAC = GetBits(inr(DAC_CNTL), DAC_TYPE);
+
+            if (pATI->Chip < ATI_CHIP_264CT)
+            {
                 /* Factor in what the BIOS says the DAC is */
                 pATI->DAC = ATI_DAC(pATI->DAC,
                     GetBits(inr(SCRATCH_REG1), BIOS_INIT_DAC_SUBTYPE));


More information about the xorg-commit mailing list