[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xserver-xorg-video-r128: Changes to 'upstream-unstable'



 configure.ac          |   12 
 man/r128.man          |   18 
 src/Makefile.am       |    5 
 src/r128.h            |  298 +++---
 src/r128_accel.c      |   46 -
 src/r128_crtc.c       |  408 ++++++++
 src/r128_cursor.c     |  349 +++----
 src/r128_dga.c        |  408 --------
 src/r128_dri.c        |   27 
 src/r128_driver.c     | 2290 ++++++++++++++------------------------------------
 src/r128_exa_render.c |   25 
 src/r128_output.c     |  503 ++++++++++
 src/r128_probe.c      |   37 
 src/r128_probe.h      |  117 ++
 src/r128_reg.h        |   16 
 src/r128_video.c      |  165 ++-
 16 files changed, 2144 insertions(+), 2580 deletions(-)

New commits:
commit 0b0f74ac7db42c772c8dda0167154bbdcb904d4f
Author: Connor Behan <connor.behan@gmail.com>
Date:   Fri May 1 19:43:42 2015 -0400

    Bump to version 6.10.0
    
    Signed-off-by: Connor Behan <connor.behan@gmail.com>

diff --git a/configure.ac b/configure.ac
index 7b461c6..51bd90d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
 AC_PREREQ([2.60])
 AC_INIT([xf86-video-r128],
-        [6.9.2],
+        [6.10.0],
         [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
         [xf86-video-r128])
 AC_CONFIG_SRCDIR([Makefile.am])

commit d05022a1c398787d3f21d023a8251cb128ba9f9f
Author: Connor Behan <connor.behan@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@gmail.com>
    Tested-by: Tobias Powalowski <tobias.powalowski@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@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@gmail.com>
    Tested-by: Tobias Powalowski <tobias.powalowski@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@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@gmail.com>
    Tested-by: Tobias Powalowski <tobias.powalowski@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++;
     }
 

commit 8c7daa148796a037ae2518154345719a735833c3
Author: Connor Behan <connor.behan@gmail.com>
Date:   Wed Mar 4 00:31:33 2015 -0500

    Restore PLL0 as well as PLL3
    
    Apparently, the text mode driver can use either register to store the
    pixel clock. The assumption made previously was apparently corrupting
    the console on PowerPC systems. Thanks to Michael Lorenz for the patch.
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=32606
    
    Signed-off-by: Connor Behan <connor.behan@gmail.com>

diff --git a/src/r128.h b/src/r128.h
index 19124bf..e3253a5 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -225,6 +225,7 @@ typedef struct {
 				/* PLL registers */
     uint32_t   ppll_ref_div;
     uint32_t   ppll_div_3;
+    uint32_t   ppll_div_0;
     uint32_t   htotal_cntl;
 
 				/* Computed values for PLL2 */
diff --git a/src/r128_driver.c b/src/r128_driver.c
index e4e43a6..9a676d5 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -2332,6 +2332,15 @@ void R128RestorePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
     R128PLLWriteUpdate(pScrn);
     R128PLLWaitForReadUpdateComplete(pScrn);
 
+    OUTPLLP(pScrn, R128_PPLL_DIV_0,
+	    restore->ppll_div_0, ~R128_PPLL_FB0_DIV_MASK);
+/*    R128PLLWriteUpdate(pScrn);*/
+    OUTPLLP(pScrn, R128_PPLL_DIV_0,
+	    restore->ppll_div_0, ~R128_PPLL_POST0_DIV_MASK);
+
+    R128PLLWriteUpdate(pScrn);
+    R128PLLWaitForReadUpdateComplete(pScrn);
+
     OUTPLL(R128_HTOTAL_CNTL, restore->htotal_cntl);
 /*    R128PLLWriteUpdate(pScrn);*/
 
@@ -2527,6 +2536,7 @@ static void R128SavePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
 {
     save->ppll_ref_div         = INPLL(pScrn, R128_PPLL_REF_DIV);
     save->ppll_div_3           = INPLL(pScrn, R128_PPLL_DIV_3);
+    save->ppll_div_0           = INPLL(pScrn, R128_PPLL_DIV_0);
     save->htotal_cntl          = INPLL(pScrn, R128_HTOTAL_CNTL);
 
     R128TRACE(("Read: 0x%08x 0x%08x 0x%08x\n",
diff --git a/src/r128_reg.h b/src/r128_reg.h
index eee5fb1..b147e00 100644
--- a/src/r128_reg.h
+++ b/src/r128_reg.h
@@ -905,6 +905,8 @@
 #       define R128_PPLL_ATOMIC_UPDATE_EN     (1 << 16)
 #       define R128_PPLL_VGA_ATOMIC_UPDATE_EN (1 << 17)
 #define R128_PPLL_DIV_0                   0x0004 /* PLL */
+#       define R128_PPLL_FB0_DIV_MASK     0x07ff
+#       define R128_PPLL_POST0_DIV_MASK   0x00070000
 #define R128_PPLL_DIV_1                   0x0005 /* PLL */
 #define R128_PPLL_DIV_2                   0x0006 /* PLL */
 #define R128_PPLL_DIV_3                   0x0007 /* PLL */

commit bfff401440c5bb72fb1ce90c804f3a5623d733b0
Author: Connor Behan <connor.behan@gmail.com>
Date:   Mon Mar 2 16:15:16 2015 -0500

    Make it easier to find EXA
    
    As of commit e31564e1a21e73f4d20d6471da4fc7a9b63e4062, the xserver is
    more picky about the order in which headers are included. We need to
    account for this in order for the compile time exa.h check to succeed.
    
    Signed-off-by: Connor Behan <connor.behan@gmail.com>

diff --git a/configure.ac b/configure.ac
index 3cc3113..7b461c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -121,12 +121,7 @@ CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
 AC_MSG_CHECKING([whether to enable EXA support])
 if test "x$EXA" = xyes; then
         AC_MSG_RESULT(yes)
-
-        SAVE_CPPFLAGS="$CPPFLAGS"
-        CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
-        AC_CHECK_HEADER(exa.h,
-                       [have_exa_h="yes"], [have_exa_h="no"])
-        CPPFLAGS="$SAVE_CPPFLAGS"
+        AC_CHECK_FILE(${sdkdir}/exa.h, [have_exa_h="yes"], [have_exa_h="no"])
 else
         AC_MSG_RESULT(no)
 fi
@@ -136,6 +131,7 @@ CPPFLAGS="$CPPFLAGS $XORG_CFLAGS"
 if test "x$have_exa_h" = xyes; then
         AC_MSG_CHECKING([whether EXA version is at least 2.0.0])
         AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#include "xorg-server.h"
 #include "exa.h"
 #if EXA_VERSION_MAJOR < 2
 #error OLD EXA!

commit e13dd1d338e4501c9d98c86c60806cc3d6801ea8
Author: Connor Behan <connor.behan@gmail.com>
Date:   Mon Mar 2 15:21:17 2015 -0500

    Include dpmsconst header
    
    Fixes the build on some systems. Thank-you to Andrew Randrianasulu for
    the patch.
    
    Signed-off-by: Connor Behan <connor.behan@gmail.com>

diff --git a/src/r128_crtc.c b/src/r128_crtc.c
index 26d4414..d62cc6a 100644
--- a/src/r128_crtc.c
+++ b/src/r128_crtc.c
@@ -35,6 +35,7 @@
 
 #include "xf86.h"
 #include "xf86Modes.h"
+#include "X11/extensions/dpmsconst.h"
 
 #include "r128.h"
 #include "r128_probe.h"
diff --git a/src/r128_output.c b/src/r128_output.c
index 6c35e78..0160880 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -35,6 +35,7 @@
 
 #include "xf86.h"
 #include "xf86Modes.h"
+#include "X11/extensions/dpmsconst.h"
 
 #include "r128.h"
 #include "r128_probe.h"

commit 86533afa3dd9a3567330f157d03cd8188f89cc72
Author: Connor Behan <connor.behan@gmail.com>
Date:   Mon Mar 2 15:18:19 2015 -0500

    Typo fix
    
    This only affects XAA builds but still. Thank-you to Andrew
    Randrianasulu for the patch.
    
    Signed-off-by: Connor Behan <connor.behan@gmail.com>

diff --git a/src/r128_accel.c b/src/r128_accel.c
index c88e8f9..7f70220 100644
--- a/src/r128_accel.c
+++ b/src/r128_accel.c
@@ -1851,7 +1851,7 @@ static void R128MMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
 					  | LEFT_EDGE_CLIPPING_NEGATIVE_X
 					  | SCANLINE_PAD_DWORD;
 
-    if (xf86IsEntityShared(info->pEnt-index)) {
+    if (xf86IsEntityShared(info->pEnt->index)) {
         /* If there are more than one devices sharing this entity, we
          * have to assign this call back, otherwise the XAA will be
          * disabled.

commit fcee44e469b22934a04bd3ee19ed101aaa176a54
Author: Connor Behan <connor.behan@gmail.com>
Date:   Sat Aug 23 01:24:42 2014 -0400

    Silence the non-debug warnings
    
    Some declarations of pScrn are only there for debugging purposes. This
    should make gcc quieter on most systems.
    
    Signed-off-by: Connor Behan <connor.behan@gmail.com>

diff --git a/src/r128_driver.c b/src/r128_driver.c
index f00fa1d..e4e43a6 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -3109,7 +3109,9 @@ void R128InitLVDSRegisters(R128SavePtr orig, R128SavePtr save, xf86OutputPtr out
 void R128InitPLLRegisters(xf86CrtcPtr crtc, R128SavePtr save,
 				R128PLLPtr pll, double dot_clock)
 {
+#if R128_DEBUG
     ScrnInfoPtr pScrn  = crtc->scrn;
+#endif
     unsigned long freq = dot_clock * 100;
     struct {
 	int divider;
@@ -3162,7 +3164,9 @@ void R128InitPLLRegisters(xf86CrtcPtr crtc, R128SavePtr save,
 void R128InitPLL2Registers(xf86CrtcPtr crtc, R128SavePtr save,
 				   R128PLLPtr pll, double dot_clock)
 {
+#if R128_DEBUG
     ScrnInfoPtr pScrn  = crtc->scrn;
+#endif
     unsigned long freq = dot_clock * 100;
     struct {
 	int divider;
diff --git a/src/r128_exa_render.c b/src/r128_exa_render.c
index c0d3688..b9601ee 100644
--- a/src/r128_exa_render.c
+++ b/src/r128_exa_render.c
@@ -157,8 +157,10 @@ R128GetDatatypePict2(uint32_t format, uint32_t *type)
 static Bool
 R128CheckCompositeTexture(PicturePtr pPict, PicturePtr pDstPict, int op)
 {
+#if R128_DEBUG
     ScreenPtr     pScreen   = pDstPict->pDrawable->pScreen;
     ScrnInfoPtr   pScrn     = xf86ScreenToScrn(pScreen);
+#endif
 
     unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
     uint32_t tmp1;
@@ -198,8 +200,10 @@ R128CheckCompositeTexture(PicturePtr pPict, PicturePtr pDstPict, int op)
 static Bool
 R128CCECheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture)
 {
+#if R128_DEBUG
     ScreenPtr     pScreen   = pDstPicture->pDrawable->pScreen;
     ScrnInfoPtr   pScrn     = xf86ScreenToScrn(pScreen);
+#endif
 
     PixmapPtr pSrcPixmap, pDstPixmap;
     uint32_t tmp1;

commit 089c81ed6b6efc4610e0c5e5fcb36dfd58b83439
Author: Connor Behan <connor.behan@gmail.com>
Date:   Sat Aug 23 01:19:25 2014 -0400

    Fix whitespace near panel code
    
    This has been bugging me.
    
    Signed-off-by: Connor Behan <connor.behan@gmail.com>

diff --git a/src/r128_driver.c b/src/r128_driver.c
index 98b0644..f00fa1d 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -507,7 +507,7 @@ void R128GetPanelInfoFromBIOS(xf86OutputPtr output)
     if (!FPHeader) return;
 
     /* Assume that only one panel is attached and supported */
-    for (i = FPHeader+20; i < FPHeader+84; i += 2) {
+    for (i = FPHeader + 20; i < FPHeader + 84; i += 2) {
         if (R128_BIOS16(i) != 0) {
             info->FPBIOSstart = R128_BIOS16(i);
             break;
@@ -3409,6 +3409,7 @@ ModeStatus R128DoValidMode(xf86OutputPtr output, DisplayModePtr mode, int flags)
     ScrnInfoPtr pScrn = output->scrn;
     R128InfoPtr info  = R128PTR(pScrn);
     R128OutputPrivatePtr r128_output = output->driver_private;
+    int i, j;
 
     if (r128_output->MonType == MT_CRT)
         return MODE_OK;
@@ -3419,9 +3420,8 @@ ModeStatus R128DoValidMode(xf86OutputPtr output, DisplayModePtr mode, int flags)
     }
 
     if (r128_output->MonType == MT_LCD && info->VBIOS) {
-	int i;
 	for (i = info->FPBIOSstart + 64; R128_BIOS16(i) != 0; i += 2) {
-	    int j = R128_BIOS16(i);
+	    j = R128_BIOS16(i);
 
 	    if (mode->CrtcHDisplay == R128_BIOS16(j) &&
 		mode->CrtcVDisplay == R128_BIOS16(j + 2)) {
@@ -3432,8 +3432,8 @@ ModeStatus R128DoValidMode(xf86OutputPtr output, DisplayModePtr mode, int flags)
 			       (float)mode->Clock / 1000);
 
 		    /* Assume we are using expanded mode */
-		    if (R128_BIOS16(j+5)) j  = R128_BIOS16(j+5);
-		    else                  j += 9;
+		    if (R128_BIOS16(j + 5)) j  = R128_BIOS16(j + 5);
+		    else                    j += 9;
 
 		    mode->Clock = (uint32_t)R128_BIOS16(j) * 10;
 
diff --git a/src/r128_video.c b/src/r128_video.c
index 9da56ff..cac4301 100644
--- a/src/r128_video.c
+++ b/src/r128_video.c
@@ -574,16 +574,16 @@ R128CopyData420(
 
 uint32_t
 R128AllocateMemory(
-   ScrnInfoPtr pScrn,
-   void **mem_struct,
-   int size,
-   int align,
-   Bool need_accel
+    ScrnInfoPtr pScrn,
+    void **mem_struct,
+    int size,
+    int align,
+    Bool need_accel
 ){
-   R128InfoPtr info = R128PTR(pScrn);
-   ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
-   Bool do_linear = !need_accel;
-   uint32_t offset = 0;
+    R128InfoPtr info = R128PTR(pScrn);
+    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+    Bool do_linear = !need_accel;
+    uint32_t offset = 0;
 
 #ifdef HAVE_XAA_H
     if (!info->accel && need_accel)
@@ -608,7 +608,7 @@ R128AllocateMemory(
         offset = area->offset;
     }
 #endif
-   if (!info->useEXA && do_linear) {
+    if (!info->useEXA && do_linear) {
         FBLinearPtr linear = *mem_struct;
         int cpp = info->CurrentLayout.pixel_bytes;
 
@@ -643,9 +643,9 @@ R128AllocateMemory(
         }
 
         offset = linear->offset * cpp;
-   }
+    }
 
-   return offset;
+    return offset;
 }
 
 static void

commit 0519b7b3aac61dfd57cbf3bb0da561ca9bd079cb
Author: Connor Behan <connor.behan@gmail.com>
Date:   Sat Aug 23 01:13:18 2014 -0400

    Improve panel code
    
    Since the driver uses PanelXRes and PanelYRes to calculate stretch
    ratios, it should try harder to set them. For LVDS, we need to move the
    xorg.conf check so that it executes before the BIOS check. For DVI, we
    should read them from the mode that the X server has identified as being
    the native one. Even then, PanelXRes and PanelYRes are not guaranteed to
    be positive, so the driver should verify this before dividing by them.
    
    Another problem with the old panel code was that PanelPwrDly had no sane
    default. It was also missing the check for Rage Pro 2 which lacks RMX.
    
    Signed-off-by: Connor Behan <connor.behan@gmail.com>

diff --git a/src/r128_driver.c b/src/r128_driver.c
index 2cbfc81..98b0644 100644
--- a/src/r128_driver.c
+++ b/src/r128_driver.c
@@ -479,6 +479,10 @@ void R128GetPanelInfoFromBIOS(xf86OutputPtr output)
     int FPHeader = 0;
     int i;
 
+    r128_output->PanelPwrDly = 200;
+    xf86GetOptValInteger(info->Options, OPTION_PANEL_WIDTH,  &(r128_output->PanelXRes));
+    xf86GetOptValInteger(info->Options, OPTION_PANEL_HEIGHT, &(r128_output->PanelYRes));
+
     if (!info->VBIOS) return;
     info->FPBIOSstart = 0;
 
@@ -511,8 +515,6 @@ void R128GetPanelInfoFromBIOS(xf86OutputPtr output)
     }
 
     if (!info->FPBIOSstart) return;
-    xf86GetOptValInteger(info->Options, OPTION_PANEL_WIDTH,  &(r128_output->PanelXRes));
-    xf86GetOptValInteger(info->Options, OPTION_PANEL_HEIGHT, &(r128_output->PanelYRes));
 
     if (!r128_output->PanelXRes)
         r128_output->PanelXRes = R128_BIOS16(info->FPBIOSstart + 25);
@@ -2850,13 +2852,6 @@ Bool R128InitCrtcRegisters(xf86CrtcPtr crtc, R128SavePtr save, DisplayModePtr mo
 
     save->crtc_ext_cntl |= R128_VGA_ATI_LINEAR | R128_XCRT_CNT_EN;
 
-    if (info->isDFP && !info->isPro2) {
-        if (r128_output->PanelXRes < mode->CrtcHDisplay)
-            mode->HDisplay = mode->CrtcHDisplay = r128_output->PanelXRes;
-        if (r128_output->PanelYRes < mode->CrtcVDisplay)
-            mode->VDisplay = mode->CrtcVDisplay = r128_output->PanelYRes;
-    }
-
     save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff)
 			      | (((mode->CrtcHDisplay / 8) - 1) << 16));
 
@@ -3240,7 +3235,7 @@ Bool R128InitDDARegisters(xf86CrtcPtr crtc, R128SavePtr save,
     VclkFreq = R128Div(pll->reference_freq * save->feedback_div,
 		       pll->reference_div * save->post_div);
 
-    if (info->isDFP && !info->isPro2) {
+    if (info->isDFP && !info->isPro2 && r128_output->PanelXRes > 0) {
         if (r128_output->PanelXRes != mode->CrtcHDisplay)
             VclkFreq = (VclkFreq * mode->CrtcHDisplay) / r128_output->PanelXRes;
     }
@@ -3313,7 +3308,7 @@ Bool R128InitDDA2Registers(xf86CrtcPtr crtc, R128SavePtr save,
     VclkFreq = R128Div(pll->reference_freq * save->feedback_div_2,
 		       pll->reference_div * save->post_div_2);
 
-    if (info->isDFP && !info->isPro2) {
+    if (info->isDFP && !info->isPro2 && r128_output->PanelXRes > 0) {
         if (r128_output->PanelXRes != mode->CrtcHDisplay)
             VclkFreq = (VclkFreq * mode->CrtcHDisplay) / r128_output->PanelXRes;
     }
@@ -3418,15 +3413,7 @@ ModeStatus R128DoValidMode(xf86OutputPtr output, DisplayModePtr mode, int flags)
     if (r128_output->MonType == MT_CRT)
         return MODE_OK;
 
-    if (info->isDFP) {
-        if (r128_output->PanelXRes < mode->CrtcHDisplay ||
-            r128_output->PanelYRes < mode->CrtcVDisplay)
-            return MODE_NOMODE;
-        else
-            return MODE_OK;
-    }
-
-    if (r128_output->MonType == MT_LCD) {
+    if (r128_output->MonType == MT_DFP || r128_output->MonType == MT_LCD) {
 	if (mode->Flags & V_INTERLACE) return MODE_NO_INTERLACE;
 	if (mode->Flags & V_DBLSCAN)   return MODE_NO_DBLESCAN;
     }
diff --git a/src/r128_output.c b/src/r128_output.c
index 8ef6d45..6c35e78 100644
--- a/src/r128_output.c
+++ b/src/r128_output.c
@@ -87,7 +87,7 @@ static void r128_mode_set(xf86OutputPtr output, DisplayModePtr mode, DisplayMode
     xf86CrtcPtr crtc = output->crtc;
     R128CrtcPrivatePtr r128_crtc = crtc->driver_private;
 
-    if (r128_crtc->crtc_id == 0)
+    if (r128_crtc->crtc_id == 0 && !info->isPro2)
         R128InitRMXRegisters(&info->SavedReg, &info->ModeReg, output, adjusted_mode);
 
     if (r128_output->MonType == MT_DFP)
@@ -97,7 +97,7 @@ static void r128_mode_set(xf86OutputPtr output, DisplayModePtr mode, DisplayMode
     else if (r128_output->MonType == MT_CRT)
         R128InitDACRegisters(&info->SavedReg, &info->ModeReg, output);
 
-    if (r128_crtc->crtc_id == 0)
+    if (r128_crtc->crtc_id == 0 && !info->isPro2)
         R128RestoreRMXRegisters(pScrn, &info->ModeReg);
 
     if (r128_output->MonType == MT_DFP)
@@ -305,6 +305,13 @@ DisplayModePtr R128ProbeOutputModes(xf86OutputPtr output)
         modes = xf86GetDefaultModes();
 
     for (mode = modes; mode != NULL; mode = mode->next) {
+        if (r128_output->type == OUTPUT_DVI) {
+            if (mode->type & (M_T_DRIVER | M_T_PREFERRED)) {
+                r128_output->PanelXRes = mode->HDisplay;
+                r128_output->PanelYRes = mode->VDisplay;
+            }
+        }
+
 	xf86SetModeCrtc(mode, INTERLACE_HALVE_V);
 	if (mode->status == MODE_OK)
             mode->status = R128DoValidMode(output, mode, MODECHECK_FINAL);
@@ -459,7 +466,7 @@ Bool R128SetupConnectors(ScrnInfoPtr pScrn)
             R128I2CInit(output, &r128_output->pI2CBus, output->name);
         }
 
-        if (otypes[i] != OUTPUT_VGA)
+        if (otypes[i] == OUTPUT_LVDS)
             R128GetPanelInfoFromBIOS(output);
     }
 
diff --git a/src/r128_video.c b/src/r128_video.c
index dc1f25b..9da56ff 100644
--- a/src/r128_video.c
+++ b/src/r128_video.c
@@ -670,7 +670,7 @@ R128DisplayVideo422(
     int v_inc, h_inc, step_by, tmp, v_inc_shift;
     int p1_h_accum_init, p23_h_accum_init;
     int p1_v_accum_init;
-    Bool rmx_active;
+    Bool rmx_active = FALSE;
 
     R128ECP(pScrn, pPriv);
 
@@ -680,7 +680,8 @@ R128DisplayVideo422(
     if (pScrn->currentMode->Flags & V_DBLSCAN)
         v_inc_shift--;
 
-    rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
+    if (r128_output->PanelYRes > 0)
+        rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
     if (rmx_active) {
         v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / r128_output->PanelYRes) << v_inc_shift) / drw_h;
     } else {
@@ -759,7 +760,7 @@ R128DisplayVideo420(
     int v_inc, h_inc, step_by, tmp, leftUV, v_inc_shift;
     int p1_h_accum_init, p23_h_accum_init;
     int p1_v_accum_init, p23_v_accum_init;
-    Bool rmx_active;
+    Bool rmx_active = FALSE;
 
     v_inc_shift = 20;
     if (pScrn->currentMode->Flags & V_INTERLACE)
@@ -767,7 +768,8 @@ R128DisplayVideo420(
     if (pScrn->currentMode->Flags & V_DBLSCAN)
         v_inc_shift--;
 
-    rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
+    if (r128_output->PanelYRes > 0)
+        rmx_active = INREG(R128_FP_VERT_STRETCH) & R128_VERT_STRETCH_ENABLE;
     if (rmx_active) {
         v_inc = ((src_h * pScrn->currentMode->CrtcVDisplay / r128_output->PanelYRes) << v_inc_shift) / drw_h;
     } else {

commit d49c3431e92a6120b054959ce6910e8decf61c67
Author: Connor Behan <connor.behan@gmail.com>
Date:   Fri Jul 25 13:39:08 2014 -0700

    Remove custom DGA code
    
    I have yet to see a use for the DGA code included in the driver.
    According to radeon commits, it should be safe to replace it with DiDGA.
    
    Signed-off-by: Connor Behan <connor.behan@gmail.com>
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

diff --git a/src/Makefile.am b/src/Makefile.am
index e4618ea..05fbe6c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,7 +40,7 @@ r128_drv_la_LTLIBRARIES = r128_drv.la
 r128_drv_la_LDFLAGS = -module -avoid-version
 r128_drv_ladir = @moduledir@/drivers
 r128_drv_la_SOURCES = \
-	r128_accel.c r128_cursor.c r128_dga.c r128_driver.c \
+	r128_accel.c r128_cursor.c r128_driver.c \
 	r128_video.c r128_misc.c r128_crtc.c r128_output.c r128_probe.c \
 	$(R128_EXA_SRCS) $(R128_DRI_SRCS)
 
diff --git a/src/r128.h b/src/r128.h
index 3b1e631..19124bf 100644
--- a/src/r128.h
+++ b/src/r128.h
@@ -343,12 +343,6 @@ typedef struct {
     struct r128_2d_state state_2d;
 #endif
 
-    /*
-     * XAAForceTransBlit is used to change the behavior of the XAA
-     * SetupForScreenToScreenCopy function, to make it DGA-friendly.
-     */
-    Bool              XAAForceTransBlit;
-
     int               fifo_slots;   /* Free slots in the FIFO (64 max)       */
     int               pix24bpp;     /* Depth of pixmap for 24bpp framebuffer */
     Bool              dac6bits;     /* Use 6 bit DAC?                        */
@@ -381,12 +375,6 @@ typedef struct {
     int               scanline_direct;
     int               scanline_bpp; /* Only used for ImageWrite */
 
-    DGAModePtr        DGAModes;
-    int               numDGAModes;
-    Bool              DGAactive;
-    int               DGAViewportStatus;
-    DGAFunctionRec    DGAFuncs;
-
     R128FBLayout      CurrentLayout;
 #ifdef R128DRI
     Bool              directRenderingEnabled;
@@ -525,7 +513,6 @@ extern void        R128WaitForVerticalSync(ScrnInfoPtr pScrn);
 extern Bool        R128AccelInit(ScreenPtr pScreen);
 extern void        R128EngineInit(ScrnInfoPtr pScrn);
 extern Bool        R128CursorInit(ScreenPtr pScreen);
-extern Bool        R128DGAInit(ScreenPtr pScreen);
 
 extern int         R128MinBits(int val);
 extern xf86OutputPtr R128FirstOutput(xf86CrtcPtr crtc);
diff --git a/src/r128_accel.c b/src/r128_accel.c
index fa58327..c88e8f9 100644
--- a/src/r128_accel.c
+++ b/src/r128_accel.c
@@ -590,7 +590,7 @@ static void R128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
 					? R128_DST_Y_TOP_TO_BOTTOM
 					: 0)));
 
-    if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) {
+    if (trans_color != -1) {
 				/* Set up for transparency */
 	R128WaitForFifo(pScrn, 3);
 	OUTREG(R128_CLR_CMP_CLR_SRC, trans_color);
@@ -1182,7 +1182,7 @@ static void R128CCESetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
 
     ADVANCE_RING();
 
-    if ((trans_color != -1) || (info->XAAForceTransBlit == TRUE)) {
+    if (trans_color != -1) {
 	BEGIN_RING( 6 );
 
 	OUT_RING_REG( R128_CLR_CMP_CLR_SRC, trans_color );
diff --git a/src/r128_dga.c b/src/r128_dga.c
deleted file mode 100644
index bb4a1a6..0000000
--- a/src/r128_dga.c
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Authors:
- *   Ove Kåven <ovek@transgaming.com>,
- *    borrowing some code from the Chips and MGA drivers.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-
-				/* Driver data structures */
-#include "r128.h"
-#include "r128_probe.h"
-
-				/* X and server generic header files */
-#include "xf86.h"
-
-				/* DGA support */
-#include "dgaproc.h"
-
-#ifdef R128DRI
-#include "r128_common.h"
-#endif
-
-static Bool R128_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
-					int *, int *, int *);
-static Bool R128_SetMode(ScrnInfoPtr, DGAModePtr);
-static int  R128_GetViewport(ScrnInfoPtr);
-static void R128_SetViewport(ScrnInfoPtr, int, int, int);
-#ifdef HAVE_XAA_H
-static void R128_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
-static void R128_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
-static void R128_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
-			       unsigned long);
-#endif
-
-static DGAModePtr R128SetupDGAMode(ScrnInfoPtr pScrn,
-				     DGAModePtr modes,
-				     int *num,
-				     int bitsPerPixel,
-				     int depth,
-				     Bool pixmap,
-				     int secondPitch,
-				     unsigned long red,
-				     unsigned long green,
-				     unsigned long blue,
-				     short visualClass)
-{
-    R128InfoPtr   info     = R128PTR(pScrn);
-    DGAModePtr      newmodes = NULL;
-    DGAModePtr      currentMode;
-    DisplayModePtr  pMode;
-    DisplayModePtr  firstMode;
-    unsigned int    size;
-    int             pitch;
-    int             Bpp      = bitsPerPixel >> 3;
-
-SECOND_PASS:
-
-    pMode = firstMode = pScrn->modes;
-
-    while (1) {
-	pitch = pScrn->displayWidth;
-	size = pitch * Bpp * pMode->VDisplay;
-
-	if ((!secondPitch || (pitch != secondPitch)) &&
-	    (size <= info->FbMapSize)) {
-
-	    if (secondPitch)
-		pitch = secondPitch;
-
-	    if (!(newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec))))
-		break;
-
-	    modes       = newmodes;
-	    currentMode = modes + *num;
-
-	    currentMode->mode           = pMode;
-	    currentMode->flags          = DGA_CONCURRENT_ACCESS;
-
-	    if (pixmap)
-		currentMode->flags     |= DGA_PIXMAP_AVAILABLE;
-
-#ifdef HAVE_XAA_H
-	    if (info->accel) {
-	      if (info->accel->SetupForSolidFill &&
-		  info->accel->SubsequentSolidFillRect)
-		 currentMode->flags    |= DGA_FILL_RECT;
-	      if (info->accel->SetupForScreenToScreenCopy &&
-		  info->accel->SubsequentScreenToScreenCopy)
-		 currentMode->flags    |= DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS;
-	      if (currentMode->flags &
-		  (DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT |
-		   DGA_BLIT_RECT | DGA_BLIT_RECT_TRANS))
-		  currentMode->flags   &= ~DGA_CONCURRENT_ACCESS;
-	    }
-#endif
-	    if (pMode->Flags & V_DBLSCAN)
-		currentMode->flags     |= DGA_DOUBLESCAN;
-	    if (pMode->Flags & V_INTERLACE)
-		currentMode->flags     |= DGA_INTERLACED;
-
-	    currentMode->byteOrder      = pScrn->imageByteOrder;
-	    currentMode->depth          = depth;
-	    currentMode->bitsPerPixel   = bitsPerPixel;
-	    currentMode->red_mask       = red;
-	    currentMode->green_mask     = green;
-	    currentMode->blue_mask      = blue;
-	    currentMode->visualClass    = visualClass;
-	    currentMode->viewportWidth  = pMode->HDisplay;
-	    currentMode->viewportHeight = pMode->VDisplay;
-	    currentMode->xViewportStep  = 8;
-	    currentMode->yViewportStep  = 1;
-	    currentMode->viewportFlags  = DGA_FLIP_RETRACE;
-	    currentMode->offset         = 0;
-	    currentMode->address        = (unsigned char*)info->LinearAddr;
-	    currentMode->bytesPerScanline = pitch * Bpp;
-	    currentMode->imageWidth     = pitch;
-	    currentMode->imageHeight    = (info->FbMapSize
-					   / currentMode->bytesPerScanline);
-	    currentMode->pixmapWidth    = currentMode->imageWidth;
-	    currentMode->pixmapHeight   = currentMode->imageHeight;
-	    currentMode->maxViewportX   = (currentMode->imageWidth
-					   - currentMode->viewportWidth);
-	    /* this might need to get clamped to some maximum */
-	    currentMode->maxViewportY   = (currentMode->imageHeight
-					   - currentMode->viewportHeight);
-	    (*num)++;
-	}
-
-	pMode = pMode->next;
-	if (pMode == firstMode)
-	    break;
-    }
-
-    if (secondPitch) {
-	secondPitch = 0;
-	goto SECOND_PASS;
-    }
-
-    return modes;
-}
-
-Bool
-R128DGAInit(ScreenPtr pScreen)
-{
-   ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
-   R128InfoPtr info = R128PTR(pScrn);
-   DGAModePtr modes = NULL;


Reply to: