Mailinglist Archive: opensuse-commit (1003 mails)

< Previous Next >
commit xorg-x11-driver-video
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Fri, 08 Jun 2007 00:27:30 +0200
  • Message-id: <20070607222730.ACAC4678168@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package xorg-x11-driver-video
checked in at Fri Jun 8 00:27:30 CEST 2007.

--------
--- xorg-x11-driver-video/xorg-x11-driver-video.changes 2007-06-05 23:37:51.000000000 +0200
+++ /mounts/work_src_done/STABLE/xorg-x11-driver-video/xorg-x11-driver-video.changes    2007-06-07 22:43:05.913797000 +0200
@@ -1,0 +2,14 @@
+Thu Jun  7 22:42:11 CEST 2007 - sndirsch@xxxxxxx
+
+- xf86-video-nv-g80.diff:
+  * G80: Rearrange HW video timing computations
+  * G80: LVDS support
+
+-------------------------------------------------------------------
+Thu Jun  7 14:49:05 CEST 2007 - sndirsch@xxxxxxx
+
+- xf86-video-ati-mergedfb-disable.diff:
+  * disable MergedFB by default (Bug #279961) 
+- radeon-xrandr-dotclock.diff enabled again (Bugs #280362/#135749)
+
+-------------------------------------------------------------------

New:
----
  xf86-video-ati-mergedfb-disable.diff
  xf86-video-nv-g80.diff

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ xorg-x11-driver-video.spec ++++++
--- /var/tmp/diff_new_pack.D30416/_old  2007-06-08 00:27:15.000000000 +0200
+++ /var/tmp/diff_new_pack.D30416/_new  2007-06-08 00:27:15.000000000 +0200
@@ -15,7 +15,7 @@
 BuildRequires:  Mesa-devel libdrm-devel pkgconfig xorg-x11-proto-devel xorg-x11-server-sdk
 URL:            http://xorg.freedesktop.org/
 Version:        7.2
-Release:        116
+Release:        118
 License:        X11/MIT
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Group:          System/X11/Servers/XF86_4
@@ -74,6 +74,7 @@
 Patch1:         radeon-xrandr-dotclock.diff
 Patch2:         radeon_dell.diff
 Patch3:         ps_nv.diff
+Patch4:         xf86-video-nv-g80.diff
 Patch5:         mga-g200se_pci-fix.diff
 Patch9:         xf86-video-sunffb.diff
 Patch10:        xf86-video-tdfx.diff
@@ -86,6 +87,7 @@
 Patch28:        xf86-video-ati.randr12.diff
 Patch29:        xf86-video-ati-rs482-singledac.diff
 Patch30:        xf86-video-mga.randr12.diff
+Patch31:        xf86-video-ati-mergedfb-disable.diff
 Patch33:        bug-263199_radeon-autocrt.diff
 
 %description
@@ -106,8 +108,7 @@
 %patch -p0
 popd
 pushd xf86-video-ati-*/src
-### disabled for now (Bug #135749)
-#%patch1 -p1
+%patch1 -p1
 ### disabled (obsolete?) (Bug #138458)
 #%patch2 -p0
 %patch18 -p1
@@ -116,9 +117,11 @@
 pushd xf86-video-ati-*
 %patch29 -p1
 %patch33 -p1
+%patch31 -p0
 popd
 pushd xf86-video-nv-*/src
 %patch3 -p6
+%patch4 -p2
 popd
 pushd xf86-video-mga-*/src
 tar xzf %{SOURCE44}
@@ -263,6 +266,14 @@
 %{_mandir}/man4/*
 
 %changelog
+* Thu Jun 07 2007 - sndirsch@xxxxxxx
+- xf86-video-nv-g80.diff:
+  * G80: Rearrange HW video timing computations
+  * G80: LVDS support
+* Thu Jun 07 2007 - sndirsch@xxxxxxx
+- xf86-video-ati-mergedfb-disable.diff:
+  * disable MergedFB by default (Bug #279961)
+- radeon-xrandr-dotclock.diff enabled again (Bugs #280362/#135749)
 * Tue Jun 05 2007 - sndirsch@xxxxxxx
 - updated intel driver to current git (2007-06-05)
   * support for 945GME

++++++ radeon-xrandr-dotclock.diff ++++++
--- /var/tmp/diff_new_pack.D30416/_old  2007-06-08 00:27:15.000000000 +0200
+++ /var/tmp/diff_new_pack.D30416/_new  2007-06-08 00:27:15.000000000 +0200
@@ -1,17 +1,18 @@
---- ati/radeon_mergedfb.c.orig 2006-03-06 17:30:42.246867808 +0100
-+++ ati/radeon_mergedfb.c      2006-03-06 17:32:11.155400769 +0100
-@@ -209,12 +209,15 @@
+--- src/radeon_mergedfb.c.orig 2007-06-07 14:53:29.229396334 +0200
++++ src/radeon_mergedfb.c      2007-06-07 14:56:25.737354139 +0200
+@@ -211,6 +211,8 @@
      mode->VSyncEnd += dy;
      mode->VTotal += dy;
  
 +/* fixes dotclock in xrandr output (Bug #135749) */
 +#if 0
-      /* Provide a sophisticated fake DotClock in order to trick the vidmode
+      /* Provide a fake VRefresh/DotClock in order to trick the vidmode
        * extension to allow selecting among a number of modes whose merged result
        * looks identical but consists of different modes for CRT1 and CRT2
-       */
-     mode->Clock = (((i->Clock >> 3) + i->HTotal) << 16) | ((j->Clock >> 2) + j->HTotal);
-     mode->Clock ^= ((i->VTotal << 19) | (j->VTotal << 3));
+@@ -224,6 +226,7 @@
+     }

+     mode->Clock = (int)(mode->VRefresh * 0.001 * mode->HTotal * mode->VTotal);
 +#endif
  
      if( ((mode->HDisplay * ((pScrn->bitsPerPixel + 7) / 8) * mode->VDisplay) > 

++++++ xf86-video-ati-mergedfb-disable.diff ++++++
--- ../xf86-video-ati-6.6.192.orig/src/radeon_driver.c  2007-06-07 14:39:25.254319127 +0200
+++ src/radeon_driver.c 2007-06-07 14:42:56.294582680 +0200
@@ -7113,6 +7113,10 @@
             xf86DrvMsg(pScrn->scrnIndex, X_INFO,
            "MergedFB mode forced off.\n");
         }
+    } else {
+           info->MergedFB = FALSE;
+           xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+           "MergedFB mode disabled by default.\n");
     }
 
     /* Do some MergedFB mode initialisation */
++++++ xf86-video-nv-g80.diff ++++++
commit 70b304cd0df0af515ce8414559f28a7ca7825517
Author: Aaron Plattner <aplattner@xxxxxxxxxx>
Date:   Mon Jun 4 22:38:14 2007 -0700

    G80: Rearrange HW video timing computations.
    
    Compute the HW parameters in G80CrtcModeFixup and stash them in adjusted_mode.
    Move some register writes into G80CreateSor.

diff --git a/src/g80_display.c b/src/g80_display.c
index 652a5a9..d10f2d6 100644
--- a/src/g80_display.c
+++ b/src/g80_display.c
@@ -40,6 +40,7 @@ typedef struct G80CrtcPrivRec {
     Head head;
     int pclk; /* Target pixel clock in kHz */
     Bool cursorVisible;
+    Bool skipModeFixup;
 } G80CrtcPrivRec, *G80CrtcPrivPtr;
 
 static void G80CrtcShowHideCursor(xf86CrtcPtr crtc, Bool show, Bool update);
@@ -234,14 +235,6 @@ G80DispPreInit(ScrnInfoPtr pScrn)
     pNv->reg[0x006101D8/4] = pNv->reg[0x0061B000/4];
     pNv->reg[0x006101E0/4] = pNv->reg[0x0061C000/4];
     pNv->reg[0x006101E4/4] = pNv->reg[0x0061C800/4];
-    pNv->reg[0x0061c00c/4] = 0x03010700;
-    pNv->reg[0x0061c010/4] = 0x0000152f;
-    pNv->reg[0x0061c014/4] = 0x00000000;
-    pNv->reg[0x0061c018/4] = 0x00245af8;
-    pNv->reg[0x0061c80c/4] = 0x03010700;
-    pNv->reg[0x0061c810/4] = 0x0000152f;
-    pNv->reg[0x0061c814/4] = 0x00000000;
-    pNv->reg[0x0061c818/4] = 0x00245af8;
     pNv->reg[0x0061A004/4] = 0x80550000;
     pNv->reg[0x0061A010/4] = 0x00000001;
     pNv->reg[0x0061A804/4] = 0x80550000;
@@ -308,13 +301,35 @@ G80DispShutdown(ScrnInfoPtr pScrn)
     pNv->reg[0x00610200/4] = 0;
     pNv->reg[0x00610300/4] = 0;
     while((pNv->reg[0x00610200/4] & 0x1e0000) != 0);
+    while((pNv->reg[0x61C030/4] & 0x10000000));
+    while((pNv->reg[0x61C830/4] & 0x10000000));
 }
 
 static Bool
 G80CrtcModeFixup(xf86CrtcPtr crtc,
                  DisplayModePtr mode, DisplayModePtr adjusted_mode)
 {
-    // TODO: Fix up the mode here
+    G80CrtcPrivPtr pPriv = crtc->driver_private;
+    int interlaceDiv, fudge;
+
+    if(pPriv->skipModeFixup)
+        return TRUE;
+
+    /* Magic mode timing fudge factor */
+    fudge = ((adjusted_mode->Flags & V_INTERLACE) && (adjusted_mode->Flags & V_DBLSCAN)) ? 2 : 1;
+    interlaceDiv = (adjusted_mode->Flags & V_INTERLACE) ? 2 : 1;
+
+    /* Stash the mode timings in the Crtc fields in adjusted_mode */
+    adjusted_mode->CrtcHBlankStart = mode->CrtcVTotal << 16 | mode->CrtcHTotal;
+    adjusted_mode->CrtcHSyncEnd = ((mode->CrtcVSyncEnd - mode->CrtcVSyncStart) / interlaceDiv - 1) << 16 |
+        (mode->CrtcHSyncEnd - mode->CrtcHSyncStart - 1);
+    adjusted_mode->CrtcHBlankEnd = ((mode->CrtcVBlankEnd - mode->CrtcVSyncStart) / interlaceDiv - fudge) << 16 |
+        (mode->CrtcHBlankEnd - mode->CrtcHSyncStart - 1);
+    adjusted_mode->CrtcHTotal = ((mode->CrtcVTotal - mode->CrtcVSyncStart + mode->CrtcVBlankStart) / interlaceDiv - fudge) << 16 |
+        (mode->CrtcHTotal - mode->CrtcHSyncStart + mode->CrtcHBlankStart - 1);
+    adjusted_mode->CrtcHSkew = ((mode->CrtcVTotal + mode->CrtcVBlankEnd - mode->CrtcVSyncStart) / 2 - 2) << 16 |
+        ((2*mode->CrtcVTotal - mode->CrtcVSyncStart + mode->CrtcVBlankStart) / 2 - 2);
+
     return TRUE;
 }
 
@@ -324,36 +339,21 @@ G80CrtcModeSet(xf86CrtcPtr crtc, DisplayModePtr mode,
 {
     ScrnInfoPtr pScrn = crtc->scrn;
     G80CrtcPrivPtr pPriv = crtc->driver_private;
-    const int HDisplay = mode->HDisplay, VDisplay = mode->VDisplay;
+    const int HDisplay = adjusted_mode->HDisplay, VDisplay = adjusted_mode->VDisplay;
     const int headOff = 0x400 * G80CrtcGetHead(crtc);
-    int interlaceDiv, fudge;
 
-    // TODO: Use adjusted_mode and fix it up in G80CrtcModeFixup
-    pPriv->pclk = mode->Clock;
-
-    /* Magic mode timing fudge factor */
-    fudge = ((mode->Flags & V_INTERLACE) && (mode->Flags & V_DBLSCAN)) ? 2 : 1;
-    interlaceDiv = (mode->Flags & V_INTERLACE) ? 2 : 1;
+    pPriv->pclk = adjusted_mode->Clock;
 
-    C(0x00000804 + headOff, mode->Clock | 0x800000);
-    C(0x00000808 + headOff, (mode->Flags & V_INTERLACE) ? 2 : 0);
+    C(0x00000804 + headOff, adjusted_mode->Clock | 0x800000);
+    C(0x00000808 + headOff, (adjusted_mode->Flags & V_INTERLACE) ? 2 : 0);
     C(0x00000810 + headOff, 0);
     C(0x0000082C + headOff, 0);
-    C(0x00000814 + headOff, mode->CrtcVTotal << 16 | mode->CrtcHTotal);
-    C(0x00000818 + headOff,
-        ((mode->CrtcVSyncEnd - mode->CrtcVSyncStart) / interlaceDiv - 1) << 16 |
-        (mode->CrtcHSyncEnd - mode->CrtcHSyncStart - 1));
-    C(0x0000081C + headOff,
-        ((mode->CrtcVBlankEnd - mode->CrtcVSyncStart) / interlaceDiv - fudge) << 16 |
-        (mode->CrtcHBlankEnd - mode->CrtcHSyncStart - 1));
-    C(0x00000820 + headOff,
-        ((mode->CrtcVTotal - mode->CrtcVSyncStart + mode->CrtcVBlankStart) / interlaceDiv - fudge) << 16 |
-        (mode->CrtcHTotal - mode->CrtcHSyncStart + mode->CrtcHBlankStart - 1));
-    if(mode->Flags & V_INTERLACE) {
-        C(0x00000824 + headOff,
-            ((mode->CrtcVTotal + mode->CrtcVBlankEnd - mode->CrtcVSyncStart) / 2 - 2) << 16 |
-            ((2*mode->CrtcVTotal - mode->CrtcVSyncStart + mode->CrtcVBlankStart) / 2 - 2));
-    }
+    C(0x00000814 + headOff, adjusted_mode->CrtcHBlankStart);
+    C(0x00000818 + headOff, adjusted_mode->CrtcHSyncEnd);
+    C(0x0000081C + headOff, adjusted_mode->CrtcHBlankEnd);
+    C(0x00000820 + headOff, adjusted_mode->CrtcHTotal);
+    if(adjusted_mode->Flags & V_INTERLACE)
+        C(0x00000824 + headOff, adjusted_mode->CrtcHSkew);
     C(0x00000868 + headOff, pScrn->virtualY << 16 | pScrn->virtualX);
     C(0x0000086C + headOff, pScrn->displayWidth * (pScrn->bitsPerPixel / 8) | 0x100000);
     switch(pScrn->depth) {
@@ -362,9 +362,8 @@ G80CrtcModeSet(xf86CrtcPtr crtc, DisplayModePtr mode,
         case 16: C(0x00000870 + headOff, 0xE800); break;
         case 24: C(0x00000870 + headOff, 0xCF00); break;
     }
-    C(0x000008A0 + headOff, 0);
-    if((mode->Flags & V_DBLSCAN) || (mode->Flags & V_INTERLACE) ||
-       mode->CrtcHDisplay != HDisplay || mode->CrtcVDisplay != VDisplay) {
+    if((adjusted_mode->Flags & V_DBLSCAN) || (adjusted_mode->Flags & V_INTERLACE) ||
+       adjusted_mode->CrtcHDisplay != HDisplay || adjusted_mode->CrtcVDisplay != VDisplay) {
         C(0x000008A4 + headOff, 9);
     } else {
         C(0x000008A4 + headOff, 0);
@@ -373,8 +372,8 @@ G80CrtcModeSet(xf86CrtcPtr crtc, DisplayModePtr mode,
     C(0x000008C0 + headOff, y << 16 | x);
     C(0x000008C8 + headOff, VDisplay << 16 | HDisplay);
     C(0x000008D4 + headOff, 0);
-    C(0x000008D8 + headOff, mode->CrtcVDisplay << 16 | mode->CrtcHDisplay);
-    C(0x000008DC + headOff, mode->CrtcVDisplay << 16 | mode->CrtcHDisplay);
+    C(0x000008D8 + headOff, adjusted_mode->CrtcVDisplay << 16 | adjusted_mode->CrtcHDisplay);
+    C(0x000008DC + headOff, adjusted_mode->CrtcVDisplay << 16 | adjusted_mode->CrtcHDisplay);
 
     G80CrtcBlankScreen(crtc, FALSE);
 }
@@ -458,6 +457,7 @@ static void
 G80CrtcPrepare(xf86CrtcPtr crtc)
 {
     ScrnInfoPtr pScrn = crtc->scrn;
+    G80CrtcPrivPtr pPriv = crtc->driver_private;
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
     int i;
 
@@ -467,6 +467,15 @@ G80CrtcPrepare(xf86CrtcPtr crtc)
         if(!output->crtc)
             output->funcs->mode_set(output, NULL, NULL);
     }
+
+    pPriv->skipModeFixup = FALSE;
+}
+
+void
+G80CrtcSkipModeFixup(xf86CrtcPtr crtc)
+{
+    G80CrtcPrivPtr pPriv = crtc->driver_private;
+    pPriv->skipModeFixup = TRUE;
 }
 
 static void
diff --git a/src/g80_display.h b/src/g80_display.h
index fac7877..d6f24f4 100644
--- a/src/g80_display.h
+++ b/src/g80_display.h
@@ -11,5 +11,6 @@ void G80CrtcBlankScreen(xf86CrtcPtr, Bool blank);
 void G80CrtcEnableCursor(xf86CrtcPtr, Bool update);
 void G80CrtcDisableCursor(xf86CrtcPtr, Bool update);
 void G80CrtcSetCursorPosition(xf86CrtcPtr, int x, int y);
+void G80CrtcSkipModeFixup(xf86CrtcPtr);
 
 void G80DispCreateCrtcs(ScrnInfoPtr pScrn);
diff --git a/src/g80_sor.c b/src/g80_sor.c
index 90119f0..ea7e015 100644
--- a/src/g80_sor.c
+++ b/src/g80_sor.c
@@ -129,13 +129,20 @@ static const xf86OutputFuncsRec G80SorOutputFuncs = {
 xf86OutputPtr
 G80CreateSor(ScrnInfoPtr pScrn, ORNum or)
 {
+    G80Ptr pNv = G80PTR(pScrn);
     G80OutputPrivPtr pPriv = xnfcalloc(sizeof(*pPriv), 1);
+    const int off = 0x800 * or;
     xf86OutputPtr output;
     char orName[5];
 
     if(!pPriv)
         return FALSE;
 
+    pNv->reg[(0x61C00C+off)/4] = 0x03010700;
+    pNv->reg[(0x61C010+off)/4] = 0x0000152f;
+    pNv->reg[(0x61C014+off)/4] = 0x00000000;
+    pNv->reg[(0x61C018+off)/4] = 0x00245af8;
+
     snprintf(orName, 5, "DVI%i", or);
     output = xf86OutputCreate(pScrn, &G80SorOutputFuncs, orName);
 
commit 6b71721439802bffd715602af3036083ff442449
Author: Aaron Plattner <aplattner@xxxxxxxxxx>
Date:   Mon Jun 4 23:15:42 2007 -0700

    G80: LVDS support.

diff --git a/src/g80_output.c b/src/g80_output.c
index d68250f..6a2723b 100644
--- a/src/g80_output.c
+++ b/src/g80_output.c
@@ -85,6 +85,7 @@ static Bool G80ReadPortMapping(int scrnIndex, G80Ptr pNv)
                                    "for port %i\n",
                                    or, pNv->i2cMap[port].sor, port);
                     pNv->i2cMap[port].sor = or;
+                    pNv->i2cMap[port].panelType = (type == 2) ? TMDS : LVDS;
                     break;
             }
         }
@@ -317,7 +318,8 @@ G80CreateOutputs(ScrnInfoPtr pScrn)
         if(pNv->i2cMap[i].dac != -1)
             dac = G80CreateDac(pScrn, pNv->i2cMap[i].dac);
         if(pNv->i2cMap[i].sor != -1)
-            sor = G80CreateSor(pScrn, pNv->i2cMap[i].sor);
+            sor = G80CreateSor(pScrn, pNv->i2cMap[i].sor,
+                               pNv->i2cMap[i].panelType);
 
         if(dac) {
             G80OutputPrivPtr pPriv = dac->driver_private;
diff --git a/src/g80_output.h b/src/g80_output.h
index 0b666f5..900b76d 100644
--- a/src/g80_output.h
+++ b/src/g80_output.h
@@ -1,6 +1,8 @@
 typedef struct G80OutputPrivRec {
     ORType type;
     ORNum or;
+    PanelType panelType;
+    DisplayModePtr nativeMode;
 
     xf86OutputPtr partner;
     I2CBusPtr i2c;
@@ -26,4 +28,4 @@ xf86OutputPtr G80CreateDac(ScrnInfoPtr, ORNum);
 Bool G80DacLoadDetect(xf86OutputPtr);
 
 /* g80_sor.c */
-xf86OutputPtr G80CreateSor(ScrnInfoPtr, ORNum);
+xf86OutputPtr G80CreateSor(ScrnInfoPtr, ORNum, PanelType);
diff --git a/src/g80_sor.c b/src/g80_sor.c
index ea7e015..a51e5e0 100644
--- a/src/g80_sor.c
+++ b/src/g80_sor.c
@@ -38,8 +38,9 @@ G80SorSetPClk(xf86OutputPtr output, int pclk)
     G80Ptr pNv = G80PTR(output->scrn);
     G80OutputPrivPtr pPriv = output->driver_private;
     const int orOff = 0x800 * pPriv->or;
+    const int limit = pPriv->panelType == LVDS ? 112000 : 165000;
 
-    pNv->reg[(0x00614300+orOff)/4] = (pclk > 165000) ? 0x101 : 0;
+    pNv->reg[(0x00614300+orOff)/4] = (pclk > limit) ? 0x101 : 0;
 }
 
 static void
@@ -61,6 +62,7 @@ G80SorDPMSSet(xf86OutputPtr output, int mode)
         tmp &= ~1;
 
     pNv->reg[(0x0061C004+off)/4] = tmp;
+    while((pNv->reg[(0x61C030+off)/4] & 0x10000000));
 }
 
 static void
@@ -70,6 +72,7 @@ G80SorModeSet(xf86OutputPtr output, DisplayModePtr mode,
     ScrnInfoPtr pScrn = output->scrn;
     G80OutputPrivPtr pPriv = output->driver_private;
     const int sorOff = 0x40 * pPriv->or;
+    CARD32 type;
 
     if(!adjusted_mode) {
         /* Disconnect the SOR */
@@ -77,6 +80,13 @@ G80SorModeSet(xf86OutputPtr output, DisplayModePtr mode,
         return;
     }
 
+    if(pPriv->panelType == LVDS)
+        type = 0;
+    else if(adjusted_mode->Clock > 165000)
+        type = 0x500;
+    else
+        type = 0x100;
+
     // This wouldn't be necessary, but the server is stupid and calls
     // G80SorDPMSSet after the output is disconnected, even though the hardware
     // turns it off automatically.
@@ -84,7 +94,7 @@ G80SorModeSet(xf86OutputPtr output, DisplayModePtr mode,
 
     C(0x00000600 + sorOff,
         (G80CrtcGetHead(output->crtc) == HEAD0 ? 1 : 2) |
-        (adjusted_mode->Clock > 165000 ? 0x500 : 0x100) |
+        type |
         ((adjusted_mode->Flags & V_NHSYNC) ? 0x1000 : 0) |
         ((adjusted_mode->Flags & V_NVSYNC) ? 0x2000 : 0));
 }
@@ -92,7 +102,6 @@ G80SorModeSet(xf86OutputPtr output, DisplayModePtr mode,
 static xf86OutputStatus
 G80SorDetect(xf86OutputPtr output)
 {
-
     G80OutputPrivPtr pPriv = output->driver_private;
 
     /* Assume physical status isn't going to change before the BlockHandler */
@@ -103,16 +112,71 @@ G80SorDetect(xf86OutputPtr output)
     return pPriv->cached_status;
 }
 
+static xf86OutputStatus
+G80SorLVDSDetect(xf86OutputPtr output)
+{
+    /* Assume LVDS is always connected */
+    return XF86OutputStatusConnected;
+}
+
 static void
 G80SorDestroy(xf86OutputPtr output)
 {
+    G80OutputPrivPtr pPriv = output->driver_private;
+
     G80OutputDestroy(output);
 
+    if(pPriv->nativeMode) {
+        if(pPriv->nativeMode->name)
+            xfree(pPriv->nativeMode->name);
+        xfree(pPriv->nativeMode);
+    }
+
     xfree(output->driver_private);
     output->driver_private = NULL;
 }
 
-static const xf86OutputFuncsRec G80SorOutputFuncs = {
+/******************** LVDS ********************/
+static Bool
+G80SorModeFixupScale(xf86OutputPtr output, DisplayModePtr mode,
+                     DisplayModePtr adjusted_mode)
+{
+    G80OutputPrivPtr pPriv = output->driver_private;
+    DisplayModePtr native = pPriv->nativeMode;
+
+    // Stash the saved mode timings in adjusted_mode
+    adjusted_mode->Clock = native->Clock;
+    adjusted_mode->Flags = native->Flags;
+    adjusted_mode->CrtcHDisplay = native->CrtcHDisplay;
+    adjusted_mode->CrtcHBlankStart = native->CrtcHBlankStart;
+    adjusted_mode->CrtcHSyncStart = native->CrtcHSyncStart;
+    adjusted_mode->CrtcHSyncEnd = native->CrtcHSyncEnd;
+    adjusted_mode->CrtcHBlankEnd = native->CrtcHBlankEnd;
+    adjusted_mode->CrtcHTotal = native->CrtcHTotal;
+    adjusted_mode->CrtcHSkew = native->CrtcHSkew;
+    adjusted_mode->CrtcVDisplay = native->CrtcVDisplay;
+    adjusted_mode->CrtcVBlankStart = native->CrtcVBlankStart;
+    adjusted_mode->CrtcVSyncStart = native->CrtcVSyncStart;
+    adjusted_mode->CrtcVSyncEnd = native->CrtcVSyncEnd;
+    adjusted_mode->CrtcVBlankEnd = native->CrtcVBlankEnd;
+    adjusted_mode->CrtcVTotal = native->CrtcVTotal;
+    adjusted_mode->CrtcHAdjusted = native->CrtcHAdjusted;
+    adjusted_mode->CrtcVAdjusted = native->CrtcVAdjusted;
+
+    // This mode is already "fixed"
+    G80CrtcSkipModeFixup(output->crtc);
+
+    return TRUE;
+}
+
+static DisplayModePtr
+G80SorGetLVDSModes(xf86OutputPtr output)
+{
+    G80OutputPrivPtr pPriv = output->driver_private;
+    return xf86DuplicateMode(pPriv->nativeMode);
+}
+
+static const xf86OutputFuncsRec G80SorTMDSOutputFuncs = {
     .dpms = G80SorDPMSSet,
     .save = NULL,
     .restore = NULL,
@@ -126,33 +190,88 @@ static const xf86OutputFuncsRec G80SorOutputFuncs = {
     .destroy = G80SorDestroy,
 };
 
+static const xf86OutputFuncsRec G80SorLVDSOutputFuncs = {
+    .dpms = G80SorDPMSSet,
+    .save = NULL,
+    .restore = NULL,
+    .mode_valid = G80OutputModeValid,
+    .mode_fixup = G80SorModeFixupScale,
+    .prepare = G80OutputPrepare,
+    .commit = G80OutputCommit,
+    .mode_set = G80SorModeSet,
+    .detect = G80SorLVDSDetect,
+    .get_modes = G80SorGetLVDSModes,
+    .destroy = G80SorDestroy,
+};
+
+static DisplayModePtr
+GetLVDSNativeMode(G80Ptr pNv)
+{
+    DisplayModePtr mode = xnfcalloc(1, sizeof(DisplayModeRec));
+    const CARD32 size = pNv->reg[0x00610B4C/4];
+    const int width = size & 0x3fff;
+    const int height = (size >> 16) & 0x3fff;
+
+    mode->HDisplay = mode->CrtcHDisplay = width;
+    mode->VDisplay = mode->CrtcVDisplay = height;
+    mode->Clock           = pNv->reg[0x610AD4/4] & 0x3fffff;
+    mode->CrtcHBlankStart = pNv->reg[0x610AFC/4];
+    mode->CrtcHSyncEnd    = pNv->reg[0x610B04/4];
+    mode->CrtcHBlankEnd   = pNv->reg[0x610AE8/4];
+    mode->CrtcHTotal      = pNv->reg[0x610AF4/4];
+
+    mode->next = mode->prev = NULL;
+    mode->status = MODE_OK;
+    mode->type = M_T_DRIVER | M_T_PREFERRED;
+
+    xf86SetModeDefaultName(mode);
+
+    return mode;
+}
+
 xf86OutputPtr
-G80CreateSor(ScrnInfoPtr pScrn, ORNum or)
+G80CreateSor(ScrnInfoPtr pScrn, ORNum or, PanelType panelType)
 {
     G80Ptr pNv = G80PTR(pScrn);
     G80OutputPrivPtr pPriv = xnfcalloc(sizeof(*pPriv), 1);
     const int off = 0x800 * or;
     xf86OutputPtr output;
     char orName[5];
+    const xf86OutputFuncsRec *funcs;
 
     if(!pPriv)
         return FALSE;
 
-    pNv->reg[(0x61C00C+off)/4] = 0x03010700;
-    pNv->reg[(0x61C010+off)/4] = 0x0000152f;
-    pNv->reg[(0x61C014+off)/4] = 0x00000000;
-    pNv->reg[(0x61C018+off)/4] = 0x00245af8;
+    if(panelType == LVDS) {
+        strcpy(orName, "LVDS");
+        funcs = &G80SorLVDSOutputFuncs;
+    } else {
+        snprintf(orName, 5, "DVI%d", or);
+        pNv->reg[(0x61C00C+off)/4] = 0x03010700;
+        pNv->reg[(0x61C010+off)/4] = 0x0000152f;
+        pNv->reg[(0x61C014+off)/4] = 0x00000000;
+        pNv->reg[(0x61C018+off)/4] = 0x00245af8;
+        funcs = &G80SorTMDSOutputFuncs;
+    }
 
-    snprintf(orName, 5, "DVI%i", or);
-    output = xf86OutputCreate(pScrn, &G80SorOutputFuncs, orName);
+    output = xf86OutputCreate(pScrn, funcs, orName);
 
     pPriv->type = SOR;
     pPriv->or = or;
+    pPriv->panelType = panelType;
     pPriv->cached_status = XF86OutputStatusUnknown;
     pPriv->set_pclk = G80SorSetPClk;
     output->driver_private = pPriv;
     output->interlaceAllowed = TRUE;
     output->doubleScanAllowed = TRUE;
 
+    if(panelType == LVDS) {
+        pPriv->nativeMode = GetLVDSNativeMode(pNv);
+
+        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s native size %dx%d\n",
+                   orName, pPriv->nativeMode->HDisplay,
+                   pPriv->nativeMode->VDisplay);
+    }
+
     return output;
 }
diff --git a/src/g80_type.h b/src/g80_type.h
index 15b8792..819a9f6 100644
--- a/src/g80_type.h
+++ b/src/g80_type.h
@@ -25,6 +25,11 @@ typedef enum ORNum {
    SOR1 = 1
 } ORNum;
 
+typedef enum PanelType {
+    TMDS,
+    LVDS,
+} PanelType;
+
 typedef enum AccelMethod {
     XAA,
     EXA,
@@ -41,8 +46,9 @@ typedef struct G80Rec {
     const unsigned char*table1;
     int                 offscreenHeight;
     struct {
-        ORNum dac;
-        ORNum sor;
+        ORNum           dac;
+        ORNum           sor;
+        PanelType       panelType;
     } i2cMap[4];
 
     xf86Int10InfoPtr    int10;

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >