xf86-video-intel: Branch 'xf86-video-intel-2.5-branch' - 22 commits - configure.ac Makefile.am src/bios_reader/bios_reader.c src/bios_reader/Makefile.am src/brw_defines.h src/brw_structs.h src/common.h src/i810_driver.c src/i810.h src/i830_accel.c src/i830_batchbuffer.c src/i830_bios.c src/i830_bios.h src/i830_crt.c src/i830_driver.c src/i830_exa.c src/i830.h src/i830_memory.c src/i830_modes.c src/i830_quirks.c src/i830_render.c src/i915_render.c src/i965_render.c src/i965_video.c src/Makefile.am

Jesse Barnes jbarnes at kemper.freedesktop.org
Mon Oct 13 06:29:29 PDT 2008


 Makefile.am                   |    7 ++++
 configure.ac                  |    9 ++++++
 src/Makefile.am               |    9 ++++--
 src/bios_reader/Makefile.am   |    3 +-
 src/bios_reader/bios_reader.c |    3 ++
 src/brw_defines.h             |    3 ++
 src/brw_structs.h             |   22 ++++++++++++--
 src/common.h                  |   17 -----------
 src/i810.h                    |    3 +-
 src/i810_driver.c             |   10 ------
 src/i830.h                    |    9 ++++--
 src/i830_accel.c              |    6 +++-
 src/i830_batchbuffer.c        |    5 ++-
 src/i830_bios.c               |   53 ++++++++++++++++++++---------------
 src/i830_bios.h               |    4 ++
 src/i830_crt.c                |   22 ++++++++++----
 src/i830_driver.c             |   19 ++++--------
 src/i830_exa.c                |   24 +++++++++++-----
 src/i830_memory.c             |    2 -
 src/i830_modes.c              |    1 
 src/i830_quirks.c             |    2 -
 src/i830_render.c             |   22 ++++++++++++--
 src/i915_render.c             |   23 ++++++++++++---
 src/i965_render.c             |   63 +++++++++++++++++++++++++++---------------
 src/i965_video.c              |    2 -
 25 files changed, 220 insertions(+), 123 deletions(-)

New commits:
commit 1c6ea4ab4772453da915306045add8d147d567f2
Author: Julien Cristau <jcristau at debian.org>
Date:   Sun Oct 12 15:10:22 2008 +0200

    Typo fix
    
    Reported by Tomas Carnecky on IRC

diff --git a/src/i830_memory.c b/src/i830_memory.c
index ecfdf2a..505564f 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -757,7 +757,7 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name,
 	return NULL;
 
     mem->name = xstrdup(name);
-    if (name == NULL) {
+    if (mem->name == NULL) {
 	xfree(mem);
 	return NULL;
     }
commit 6cb4150160bb1e1365773561fb53294ad9248a0e
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Sun Oct 12 08:07:44 2008 +0800

    Bug #17892: Fix possible crash in CRT probe
    
    Introduced in patch for DVI-I CRT probe, if no EDID
    CRT monitor is connected, origin code destroys default
    DDC bus which causes crash in later get_modes call.
    Change it to setup and destroy DDC bus as needed in
    get_modes, so we always reprobe and get current state.

diff --git a/src/i830_crt.c b/src/i830_crt.c
index 2e70eb8..479fbe5 100644
--- a/src/i830_crt.c
+++ b/src/i830_crt.c
@@ -338,13 +338,19 @@ i830_crt_detect_load (xf86CrtcPtr	    crtc,
 static Bool
 i830_crt_detect_ddc(xf86OutputPtr output)
 {
+    ScrnInfoPtr		    pScrn = output->scrn;
     I830OutputPrivatePtr    i830_output = output->driver_private;
+    Bool detect;
 
     /* CRT should always be at 0, but check anyway */
     if (i830_output->type != I830_OUTPUT_ANALOG)
 	return FALSE;
 
-    return xf86I2CProbeAddress(i830_output->pDDCBus, 0x00A0);
+    I830I2CInit(pScrn, &i830_output->pDDCBus, GPIOA, "CRTDDC_A");
+    detect = xf86I2CProbeAddress(i830_output->pDDCBus, 0x00A0);
+    xf86DestroyI2CBusRec(i830_output->pDDCBus, TRUE, TRUE);
+
+    return detect;
 }
 
 /**
@@ -428,18 +434,19 @@ i830_get_edid(xf86OutputPtr output, int gpio_reg, char *gpio_str)
     xf86MonPtr		    edid_mon = NULL;
 
     /* Set up the DDC bus. */
-    if (gpio_reg != GPIOA)
-	I830I2CInit(output->scrn, &intel_output->pDDCBus, gpio_reg, gpio_str);
+    I830I2CInit(output->scrn, &intel_output->pDDCBus, gpio_reg, gpio_str);
 
     edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
 
     if (!edid_mon || DIGITAL(edid_mon->features.input_type)) {
 	xf86DestroyI2CBusRec(intel_output->pDDCBus, TRUE, TRUE);
+	intel_output->pDDCBus = NULL;
 	if (edid_mon) {
 	    xfree(edid_mon);
 	    edid_mon = NULL;
 	}
     }
+
     return edid_mon;
 }
 
@@ -448,6 +455,7 @@ i830_crt_get_modes (xf86OutputPtr output)
 {
     DisplayModePtr	    modes;
     xf86MonPtr		    edid_mon = NULL;
+    I830OutputPrivatePtr    intel_output = output->driver_private;
 
     /* Try to probe normal CRT port, and also digital port for output
        in DVI-I mode. */
@@ -458,6 +466,11 @@ i830_crt_get_modes (xf86OutputPtr output)
     if ((edid_mon = i830_get_edid(output, GPIOE, "CRTDDC_E")))
 	goto found;
 found:
+    /* Destroy DDC bus after probe, so every other new probe will
+       scan all ports again */
+    if (intel_output->pDDCBus)
+	xf86DestroyI2CBusRec(intel_output->pDDCBus, TRUE, TRUE);
+
     xf86OutputSetEDID (output, edid_mon);
 
     modes = xf86OutputGetEDIDModes (output);
@@ -509,7 +522,4 @@ i830_crt_init(ScrnInfoPtr pScrn)
     output->driver_private = i830_output;
     output->interlaceAllowed = FALSE;
     output->doubleScanAllowed = FALSE;
-
-    /* Set up the DDC bus. */
-    I830I2CInit(pScrn, &i830_output->pDDCBus, GPIOA, "CRTDDC_A");
 }
commit 140451abb41fbd68d5aac4736c1cf1ec2805dd9e
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Oct 9 18:18:34 2008 -0700

    For non-DRM, add NOOPs after BATCH_BUFFER_START to verify completion
    
    In non-DRM mode, the driver waits for the hardware by checking the ring
    pointers; when the ring is empty, it assumes the hardware is idle. However,
    the hardware updates the ring pointers before executing a command, so if the
    MI_BATCH_BUFFER_START is the last command in the ring, the driver will think
    the hardware is idle while it may still be processing the contents of the
    batch buffer. Placing NOOPs after the BATCH_BUFFER_START allows the driver
    to know that the hardware has completed the batch buffer.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index b7b8f18..cd8f687 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -45,9 +45,11 @@ intel_nondrm_exec(dri_bo *bo, unsigned int used, void *priv)
     ScrnInfoPtr pScrn = priv;
     I830Ptr pI830 = I830PTR(pScrn);
 
-    BEGIN_LP_RING(2);
+    BEGIN_LP_RING(4);
     OUT_RING(MI_BATCH_BUFFER_START | (2 << 6));
     OUT_RING(bo->offset);
+    OUT_RING(MI_NOOP);
+    OUT_RING(MI_NOOP);
     ADVANCE_LP_RING();
 
     return 0;
commit d09d938bf26ea0c44352ff6e7a57ba43f4047fdb
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Oct 9 18:17:13 2008 -0700

    i830 nondrm batch buffer insertion was missing ADVANCE_LP_RING() call
    
    The ring commands to insert a batch buffer to the ring in i830 form were not
    terminated by a call to ADVANCE_LP_RING(). This surely would have caused
    chaos.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c
index 3727f0e..b7b8f18 100644
--- a/src/i830_batchbuffer.c
+++ b/src/i830_batchbuffer.c
@@ -64,6 +64,7 @@ intel_nondrm_exec_i830(dri_bo *bo, unsigned int used, void *priv)
     OUT_RING(bo->offset);
     OUT_RING(bo->offset + pI830->batch_used - 4);
     OUT_RING(MI_NOOP);
+    ADVANCE_LP_RING();
 
     return 0;
 }
commit d24010b7b3f2419beb40dc5ae1e8aeb3e04b5a93
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Oct 9 14:29:04 2008 -0700

    Disable frame buffer compression by default for GM965.
    
    We haven't found a way to make FBC work reliably with GM965 yet,
    (it often fails to notice CPU writes). This appears to be a
    specific problem with this device, (as we haven't gotten similar
    bug reports for subsequent devices such as GM45). So FBC is
    now disabled by default for GM965 but can still be enabled with
    the FrameBufferCompression option for experimenting/debugging.
    
    This resolves bug #16257:
    
    	[GM965 EXA] Frame-buffer compression broken for CPU writes (XPutImage)
    	https://bugs.freedesktop.org/show_bug.cgi?id=16257

diff --git a/src/i830.h b/src/i830.h
index 5b78236..89f19d2 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -950,6 +950,13 @@ static inline int i830_fb_compression_supported(I830Ptr pI830)
      */
     if (!pI830->tiling || (IS_I965G(pI830) && pI830->accel <= ACCEL_XAA))
 	return FALSE;
+    /* We have not gotten FBC to work consistently on 965GM. Our best
+     * working theory right now is that FBC simply isn't reliable on
+     * that device. See this bug report for more details:
+     * https://bugs.freedesktop.org/show_bug.cgi?id=16257
+     */
+    if (IS_I965GM(pI830))
+	return FALSE;
     return TRUE;
 }
 
commit 4128b01ec84ffa0f03c335c36738f383376d9381
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Thu Oct 9 09:19:41 2008 +0800

    Remove Lenovo T61 TV quirk
    
    BIOS already says no integrated TV, and this quirk blocks TV
    on R61i which has the same subdevice id as T61.

diff --git a/src/i830_quirks.c b/src/i830_quirks.c
index 528b564..12cab86 100644
--- a/src/i830_quirks.c
+++ b/src/i830_quirks.c
@@ -258,8 +258,6 @@ static i830_quirk i830_quirk_list[] = {
 
     /* Lenovo Napa TV (use dmi)*/
     { PCI_CHIP_I945_GM, 0x17aa, SUBSYS_ANY, quirk_lenovo_tv_dmi },
-    /* Lenovo T61 has no TV output */
-    { PCI_CHIP_I965_GM, 0x17aa, 0x20b5, quirk_ignore_tv },
     /* Lenovo 3000 v200 */
     { PCI_CHIP_I965_GM, 0x17aa, 0x3c18, quirk_ignore_tv },
 
commit 74571363539426abeb0a1af11f3bb545d91ed6c2
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date:   Wed Oct 8 15:36:10 2008 +0800

    Put forware VBIOS data parsing
    
    i830_bios_init() is called too late after output init, which
    makes bios data mostly useless, and caused all TV init fail as
    tv_present flag is not set.

diff --git a/src/i830_driver.c b/src/i830_driver.c
index 933c8b8..c1d61f4 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -1895,6 +1895,10 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
    if (!i830_detect_chipset(pScrn))
        return FALSE;
 
+   if (i830_bios_init(pScrn))
+       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		  "VBIOS initialization failed.\n");
+
    I830PreInitCrtcConfig(pScrn);
 
    if (pI830->use_drm_mode) {
@@ -1914,10 +1918,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
        return FALSE;
    }
 
-   if (i830_bios_init(pScrn))
-       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		  "VBIOS initialization failed.\n");
-
    /*
     * XXX If we knew the pre-initialised GTT format for certain, we could
     * probably figure out the physical address even in the StolenOnly case.
commit 111dd151dedf535464d638461f9485ec2939780e
Author: Lukas Hejtmanek <xhejtman at ics.muni.cz>
Date:   Tue Oct 7 15:07:08 2008 +0200

    Fix driver build against server master.
    
    Broken by 3a4151b69daa478ac6edf042d604ee41e8429c0d

diff --git a/src/i830_exa.c b/src/i830_exa.c
index e03f2de..8623159 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -726,6 +726,10 @@ I830EXAInit(ScreenPtr pScreen)
     return TRUE;
 }
 
+#ifdef I830_USE_UXA
+static int uxa_pixmap_index;
+#endif
+
 dri_bo *
 i830_get_pixmap_bo(PixmapPtr pixmap)
 {
@@ -750,7 +754,6 @@ i830_get_pixmap_bo(PixmapPtr pixmap)
 }
 
 #if defined(I830_USE_UXA)
-static int uxa_pixmap_index;
 
 static void
 i830_uxa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo)
commit 3a4151b69daa478ac6edf042d604ee41e8429c0d
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Oct 6 17:00:08 2008 -0700

    Fix driver build against server 1.4.2.
    
    This disables UXA and DRM modesetting pre-1.5, due to privates handling
    issues.

diff --git a/Makefile.am b/Makefile.am
index 5db07de..896427f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,12 @@
 #  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 AUTOMAKE_OPTIONS = foreign
-SUBDIRS = uxa src man
+
+if BUILD_UXA
+UXA_DIR = uxa
+endif
+
+SUBDIRS = $(UXA_DIR) src man
 
 EXTRA_DIST = README
 DISTCLEANFILES = doltcompile
diff --git a/configure.ac b/configure.ac
index 86bb80f..d5db3a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,6 +84,8 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto)
 
 # Checks for pkg-config packages
 PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES])
+PKG_CHECK_MODULES(UXA, [xorg-server >= 1.5], [BUILD_UXA=yes], [BUILD_UXA=no])
+
 sdkdir=$(pkg-config --variable=sdkdir xorg-server)
 drm_cflags=$(pkg-config --cflags libdrm)
 
@@ -108,6 +110,8 @@ if test x$DRI != xno; then
 	AC_CHECK_HEADER(xf86drmMode.h,
 			[DRM_MODE=yes],[DRM_MODE=no]
 			[#include "stdint.h"])
+	dnl exaGetPixmapDriverPrivate required for DRM_MODE.
+	PKG_CHECK_MODULES(DRM_MODE, [xorg-server >= 1.5], [], [DRM_MODE=no])
 	if test "x$DRM_MODE" = xyes; then
 	   	AC_DEFINE(XF86DRM_MODE,1,[DRM kernel modesetting])
 	fi
@@ -124,6 +128,11 @@ if test x$DRI = xauto; then
 fi
 AC_MSG_RESULT([$DRI])
 
+AM_CONDITIONAL(BUILD_UXA, test $BUILD_UXA = yes)
+if test "$BUILD_UXA" = yes; then
+	AC_DEFINE(I830_USE_UXA, 1, [UMA Acceleration Architecture support])
+fi
+
 AC_CHECK_HEADER(xf86Modes.h,[XMODES=yes],[XMODES=no],[#include "xorg-server.h"])
 AC_CHECK_DECL(XSERVER_LIBPCIACCESS,
 	      [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no],
diff --git a/src/Makefile.am b/src/Makefile.am
index 8966bd6..9b32215 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,14 +32,17 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER)
 
 AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \
 	@PCIACCESS_CFLAGS@ @UXA_CFLAGS@ \
-	@XMODES_CFLAGS@ -DI830_XV -DI830_USE_XAA -DI830_USE_EXA	-DI830_USE_UXA
+	@XMODES_CFLAGS@ -DI830_XV -DI830_USE_XAA -DI830_USE_EXA
 
 intel_drv_la_LTLIBRARIES = intel_drv.la
 intel_drv_la_LDFLAGS = -module -avoid-version
 intel_drv_ladir = @moduledir@/drivers
-intel_drv_la_LIBADD = -lm ../uxa/libuxa.la
+intel_drv_la_LIBADD = -lm -ldrm_intel
+if BUILD_UXA
+intel_drv_la_LIBADD += ../uxa/libuxa.la
+endif
 if XSERVER_LIBPCIACCESS
-intel_drv_la_LIBADD += @PCIACCESS_LIBS@ @DRM_LIBS@ -ldrm_intel
+intel_drv_la_LIBADD += @PCIACCESS_LIBS@ @DRM_LIBS@
 endif
 
 XMODE_SRCS=\
diff --git a/src/i830_accel.c b/src/i830_accel.c
index 386e653..a9b3005 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -331,9 +331,13 @@ I830AccelInit(ScreenPtr pScreen)
 	pI830->accel_max_y = 2048;
     }
     switch (pI830->accel) {
-#ifdef I830_USE_UXA
     case ACCEL_UXA:
+#ifdef I830_USE_UXA
 	return i830_uxa_init(pScreen);
+#else
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		   "UXA not built in, falling back to EXA.\n");
+	return I830EXAInit(pScreen);
 #endif
 #ifdef I830_USE_EXA
     case ACCEL_EXA:
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 3a2a9a4..933c8b8 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -2693,8 +2693,10 @@ I830BlockHandler(int i,
        pI830->need_mi_flush = FALSE;
     }
 
+#ifdef I830_USE_UXA
     if (pI830->accel == ACCEL_UXA)
 	i830_uxa_block_handler (pScreen);
+#endif
     /*
      * Check for FIFO underruns at block time (which amounts to just
      * periodically).  If this happens, it means our DSPARB or some other
diff --git a/src/i830_exa.c b/src/i830_exa.c
index fd29df1..e03f2de 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -726,14 +726,6 @@ I830EXAInit(ScreenPtr pScreen)
     return TRUE;
 }
 
-static int uxa_pixmap_index;
-
-static void
-i830_uxa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo)
-{
-    dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
-}
-
 dri_bo *
 i830_get_pixmap_bo(PixmapPtr pixmap)
 {
@@ -741,17 +733,31 @@ i830_get_pixmap_bo(PixmapPtr pixmap)
     ScrnInfoPtr scrn = xf86Screens[screen->myNum];
     I830Ptr i830 = I830PTR(scrn);
 
+#ifdef I830_USE_UXA
     if (i830->accel == ACCEL_UXA) {
 	return dixLookupPrivate(&pixmap->devPrivates, &uxa_pixmap_index);
-    } else if (i830->accel == ACCEL_EXA) {
+    }
+#endif
+#ifdef XF86DRM_MODE
+    if (i830->accel == ACCEL_EXA) {
 	struct i830_exa_pixmap_priv *driver_priv =
 	    exaGetPixmapDriverPrivate(pixmap);
 	return driver_priv ? driver_priv->bo : NULL;
     }
+#endif
 
     return NULL;
 }
 
+#if defined(I830_USE_UXA)
+static int uxa_pixmap_index;
+
+static void
+i830_uxa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo)
+{
+    dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo);
+}
+
 static Bool
 i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access)
 {
@@ -937,6 +943,7 @@ i830_uxa_init (ScreenPtr pScreen)
 
     return TRUE;
 }
+#endif /* I830_USE_UXA */
 
 #ifdef XF86DRI
 
commit 3621183cf4acef23414e8d69c34b1e587f52ec67
Author: Eric Anholt <eric at anholt.net>
Date:   Mon Oct 6 16:59:16 2008 -0700

    Fix bios_reader build against old servers.
    
    The server's pci_device structure ends up conflicting with libpciaccess's.
    Just don't include the server structure for this non-server tool.

diff --git a/src/bios_reader/Makefile.am b/src/bios_reader/Makefile.am
index c85081e..9f1c45a 100644
--- a/src/bios_reader/Makefile.am
+++ b/src/bios_reader/Makefile.am
@@ -1,4 +1,5 @@
-AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @XMODES_CFLAGS@ @PCIACCESS_CFLAGS@
+AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @XMODES_CFLAGS@ @PCIACCESS_CFLAGS@ \
+	-DREG_DUMPER
 
 noinst_PROGRAMS = bios_reader  $(BIOS_DUMPER) $(SWF_DUMPER)
 
diff --git a/src/bios_reader/bios_reader.c b/src/bios_reader/bios_reader.c
index 61b492d..2a6906d 100644
--- a/src/bios_reader/bios_reader.c
+++ b/src/bios_reader/bios_reader.c
@@ -38,6 +38,9 @@
 
 #include "../i830_bios.h"
 
+typedef uint8_t CARD8;
+typedef uint16_t CARD16;
+typedef uint32_t CARD32;
 #define _PARSE_EDID_
 #include "edid.h"
 
diff --git a/src/i830_bios.h b/src/i830_bios.h
index 0a1f4ba..39706ac 100644
--- a/src/i830_bios.h
+++ b/src/i830_bios.h
@@ -29,7 +29,9 @@
 #define _I830_BIOS_H_
 
 #include <stdint.h>
+#ifndef REG_DUMPER
 #include <xf86str.h>
+#endif
 
 struct vbt_header {
     char signature[20];			/**< Always starts with 'VBT$' */
@@ -393,7 +395,9 @@ struct vch_bdb_22 {
     struct vch_panel_data   panels[16];
 } __attribute__((packed));
 
+#ifndef REG_DUMPER
 int i830_bios_init(ScrnInfoPtr pScrn);
+#endif
 
 /*
  * Driver<->VBIOS interaction occurs through scratch bits in
commit 080d36648f92d3b9a559e5458687fa82afab411f
Author: Eric Anholt <eric at anholt.net>
Date:   Wed Oct 1 16:13:09 2008 -0700

    Add support for RepeatPad and RepeatReflect to 915 and 830-class Render accel.

diff --git a/src/i830_render.c b/src/i830_render.c
index c1ce856..7b05daa 100644
--- a/src/i830_render.c
+++ b/src/i830_render.c
@@ -244,8 +244,8 @@ static Bool i830_check_composite_texture(PicturePtr pPict, int unit)
         I830FALLBACK("Unsupported picture format 0x%x\n",
 		     (int)pPict->format);
 
-    if (pPict->repeat && pPict->repeatType != RepeatNormal)
-	I830FALLBACK("unsupport repeat type\n");
+    if (pPict->repeatType > RepeatReflect)
+        I830FALLBACK("Unsupported picture repeat %d\n", pPict->repeatType);
 
     if (pPict->filter != PictFilterNearest &&
         pPict->filter != PictFilterBilinear)
@@ -276,7 +276,7 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
     ScrnInfoPtr pScrn = xf86Screens[pPict->pDrawable->pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
     uint32_t format, pitch, filter;
-    uint32_t wrap_mode = TEXCOORDMODE_CLAMP_BORDER;
+    uint32_t wrap_mode;
 
     pitch = intel_get_pixmap_pitch(pPix);
     pI830->scale_units[unit][0] = pPix->drawable.width;
@@ -285,8 +285,22 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
 
     format = i8xx_get_card_format(pPict);
 
-    if (pPict->repeat)
+    switch (pPict->repeatType) {
+    case RepeatNone:
+	wrap_mode = TEXCOORDMODE_CLAMP_BORDER;
+	break;
+    case RepeatNormal:
 	wrap_mode = TEXCOORDMODE_WRAP;
+	break;
+    case RepeatPad:
+	wrap_mode = TEXCOORDMODE_CLAMP;
+	break;
+    case RepeatReflect:
+	wrap_mode = TEXCOORDMODE_MIRROR;
+	break;
+    default:
+	FatalError("Unkown repeat type %d\n", pPict->repeatType);
+    }
 
     switch (pPict->filter) {
     case PictFilterNearest:
diff --git a/src/i915_render.c b/src/i915_render.c
index 970c42a..039db3b 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -201,9 +201,8 @@ static Bool i915_check_composite_texture(PicturePtr pPict, int unit)
         I830FALLBACK("Unsupported picture format 0x%x\n",
 		     (int)pPict->format);
 
-    if (pPict->repeat && pPict->repeatType != RepeatNormal)
-	I830FALLBACK("extended repeat (%d) not supported\n",
-		     pPict->repeatType);
+    if (pPict->repeatType > RepeatReflect)
+        I830FALLBACK("Unsupported picture repeat %d\n", pPict->repeatType);
 
     if (pPict->filter != PictFilterNearest &&
         pPict->filter != PictFilterBilinear)
@@ -252,7 +251,7 @@ i915_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
     I830Ptr pI830 = I830PTR(pScrn);
     uint32_t format, pitch, filter;
     int w, h, i;
-    uint32_t wrap_mode = TEXCOORDMODE_CLAMP_BORDER;
+    uint32_t wrap_mode;
 
     pitch = intel_get_pixmap_pitch(pPix);
     w = pPict->pDrawable->width;
@@ -270,8 +269,22 @@ i915_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit)
 	I830FALLBACK("unknown texture format\n");
     format = i915_tex_formats[i].card_fmt;
 
-    if (pPict->repeat)
+    switch (pPict->repeatType) {
+    case RepeatNone:
+	wrap_mode = TEXCOORDMODE_CLAMP_BORDER;
+	break;
+    case RepeatNormal:
 	wrap_mode = TEXCOORDMODE_WRAP;
+	break;
+    case RepeatPad:
+	wrap_mode = TEXCOORDMODE_CLAMP_EDGE;
+	break;
+    case RepeatReflect:
+	wrap_mode = TEXCOORDMODE_MIRROR;
+	break;
+    default:
+	FatalError("Unkown repeat type %d\n", pPict->repeatType);
+    }
 
     switch (pPict->filter) {
     case PictFilterNearest:
commit 5e04b5ad1b618655e201cbf1f5b2585aa6be0c17
Merge: 979bb10... 260cbcf...
Author: Jesse Barnes <jbarnes at virtuousgeek.org>
Date:   Mon Oct 6 16:08:12 2008 -0700

    Merge branch 'master' of ssh://git.freedesktop.org/git/xorg/driver/xf86-video-intel

commit 260cbcfe61868175ba3e649ce07d43f57601f9be
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Oct 6 13:17:59 2008 -0700

    Document and use 'legacy' border color mode
    
    It's very convenient that the hardware supports this non-default
    mode since it's exactly what is specified by the Render extension.
    This provides a more efficient means of fixing bug #16820:
    
            [EXA] Composition result in black for areas outside of source-surface bo
            https://bugs.freedesktop.org/show_bug.cgi?id=16820
    
    without the software fallback we had in the earlier fix,
    (commit 76c9ece36e6400fd10f364ee330faea470e2da64 ).

diff --git a/src/brw_defines.h b/src/brw_defines.h
index 13cb439..0df2491 100644
--- a/src/brw_defines.h
+++ b/src/brw_defines.h
@@ -466,6 +466,9 @@
 #define BRW_SURFACE_BUFFER  4
 #define BRW_SURFACE_NULL    7
 
+#define BRW_BORDER_COLOR_MODE_DEFAULT	0
+#define BRW_BORDER_COLOR_MODE_LEGACY	1
+
 #define BRW_TEXCOORDMODE_WRAP            0
 #define BRW_TEXCOORDMODE_MIRROR          1
 #define BRW_TEXCOORDMODE_CLAMP           2
diff --git a/src/brw_structs.h b/src/brw_structs.h
index 553aeeb..022915d 100644
--- a/src/brw_structs.h
+++ b/src/brw_structs.h
@@ -840,10 +840,26 @@ struct brw_wm_unit_state
    float global_depth_offset_scale;   
 };
 
-struct brw_sampler_border_color {
+/* The hardware supports two different modes for border color. The
+ * default (OpenGL) mode uses floating-point color channels, while the
+ * legacy mode uses 4 bytes.
+ *
+ * More significantly, the legacy mode respects the components of the
+ * border color for channels not present in the source, (whereas the
+ * default mode will ignore the border color's alpha channel and use
+ * alpha==1 for an RGB source, for example).
+ *
+ * The legacy mode matches the semantics specified by the Render
+ * extension.
+ */
+struct brw_sampler_default_border_color {
    float color[4];
 };
 
+struct brw_sampler_legacy_border_color {
+   uint8_t color[4];
+};
+
 struct brw_sampler_state
 {
    
diff --git a/src/i965_render.c b/src/i965_render.c
index 4bffe0d..9ee273c 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -496,8 +496,8 @@ typedef struct _gen4_state {
 					  [SAMPLER_STATE_FILTER_COUNT]
 					  [SAMPLER_STATE_EXTEND_COUNT][2];
 
-    struct brw_sampler_border_color sampler_border_color;
-    PAD64 (brw_sampler_border_color, 0);
+    struct brw_sampler_legacy_border_color sampler_border_color;
+    PAD64 (brw_sampler_legacy_border_color, 0);
 
     /* Index by [src_blend][dst_blend] */
     brw_cc_unit_state_padded cc_state[BRW_BLENDFACTOR_COUNT]
@@ -572,7 +572,10 @@ sampler_state_init (struct brw_sampler_state *sampler_state,
     memset(sampler_state, 0, sizeof(*sampler_state));
 
     sampler_state->ss0.lod_preclamp = 1; /* GL mode */
-    sampler_state->ss0.border_color_mode = 0; /* GL mode */
+
+    /* We use the legacy mode to get the semantics specified by
+     * the Render extension. */
+    sampler_state->ss0.border_color_mode = BRW_BORDER_COLOR_MODE_LEGACY;
 
     switch(filter) {
     default:
@@ -734,13 +737,13 @@ gen4_state_init (struct gen4_render_state *render_state)
     card_state->vs_state.vs6.vs_enable = 0;
     card_state->vs_state.vs6.vert_cache_disable = 1;
 
-    /* Set up the sampler default color (always transparent black) */
+    /* Set up the sampler border color (always transparent black) */
     memset(&card_state->sampler_border_color, 0,
 	   sizeof(card_state->sampler_border_color));
-    card_state->sampler_border_color.color[0] = 0.0; /* R */
-    card_state->sampler_border_color.color[1] = 0.0; /* G */
-    card_state->sampler_border_color.color[2] = 0.0; /* B */
-    card_state->sampler_border_color.color[3] = 0.0; /* A */
+    card_state->sampler_border_color.color[0] = 0; /* R */
+    card_state->sampler_border_color.color[1] = 0; /* G */
+    card_state->sampler_border_color.color[2] = 0; /* B */
+    card_state->sampler_border_color.color[3] = 0; /* A */
 
     card_state->cc_viewport.min_depth = -1.e35;
     card_state->cc_viewport.max_depth = 1.e35;
commit 98ca9e2af1b0a67ed91e10cf661af70dfba44d43
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Oct 6 13:16:37 2008 -0700

    Rename default_color to border_color
    
    This is consistent with the documentation, (and just plain makes
    more sense).

diff --git a/src/brw_structs.h b/src/brw_structs.h
index ef7906b..553aeeb 100644
--- a/src/brw_structs.h
+++ b/src/brw_structs.h
@@ -840,7 +840,7 @@ struct brw_wm_unit_state
    float global_depth_offset_scale;   
 };
 
-struct brw_sampler_default_color {
+struct brw_sampler_border_color {
    float color[4];
 };
 
@@ -857,7 +857,7 @@ struct brw_sampler_state
       unsigned int base_level:5; 
       unsigned int pad:1;
       unsigned int lod_preclamp:1; 
-      unsigned int default_color_mode:1; 
+      unsigned int border_color_mode:1; 
       unsigned int pad0:1;
       unsigned int disable:1; 
    } ss0;
@@ -876,7 +876,7 @@ struct brw_sampler_state
    struct
    {
       unsigned int pad:5;
-      unsigned int default_color_pointer:27; 
+      unsigned int border_color_pointer:27; 
    } ss2;
    
    struct
diff --git a/src/i965_render.c b/src/i965_render.c
index 2b59e91..4bffe0d 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -496,8 +496,8 @@ typedef struct _gen4_state {
 					  [SAMPLER_STATE_FILTER_COUNT]
 					  [SAMPLER_STATE_EXTEND_COUNT][2];
 
-    struct brw_sampler_default_color sampler_default_color;
-    PAD64 (brw_sampler_default_color, 0);
+    struct brw_sampler_border_color sampler_border_color;
+    PAD64 (brw_sampler_border_color, 0);
 
     /* Index by [src_blend][dst_blend] */
     brw_cc_unit_state_padded cc_state[BRW_BLENDFACTOR_COUNT]
@@ -566,13 +566,13 @@ static void
 sampler_state_init (struct brw_sampler_state *sampler_state,
 		    sampler_state_filter_t filter,
 		    sampler_state_extend_t extend,
-		    int default_color_offset)
+		    int border_color_offset)
 {
     /* PS kernel use this sampler */
     memset(sampler_state, 0, sizeof(*sampler_state));
 
     sampler_state->ss0.lod_preclamp = 1; /* GL mode */
-    sampler_state->ss0.default_color_mode = 0; /* GL mode */
+    sampler_state->ss0.border_color_mode = 0; /* GL mode */
 
     switch(filter) {
     default:
@@ -610,8 +610,8 @@ sampler_state_init (struct brw_sampler_state *sampler_state,
 	break;
     }
 
-    assert((default_color_offset & 31) == 0);
-    sampler_state->ss2.default_color_pointer = default_color_offset >> 5;
+    assert((border_color_offset & 31) == 0);
+    sampler_state->ss2.border_color_pointer = border_color_offset >> 5;
 
     sampler_state->ss3.chroma_key_enable = 0; /* disable chromakey */
 }
@@ -735,12 +735,12 @@ gen4_state_init (struct gen4_render_state *render_state)
     card_state->vs_state.vs6.vert_cache_disable = 1;
 
     /* Set up the sampler default color (always transparent black) */
-    memset(&card_state->sampler_default_color, 0,
-	   sizeof(card_state->sampler_default_color));
-    card_state->sampler_default_color.color[0] = 0.0; /* R */
-    card_state->sampler_default_color.color[1] = 0.0; /* G */
-    card_state->sampler_default_color.color[2] = 0.0; /* B */
-    card_state->sampler_default_color.color[3] = 0.0; /* A */
+    memset(&card_state->sampler_border_color, 0,
+	   sizeof(card_state->sampler_border_color));
+    card_state->sampler_border_color.color[0] = 0.0; /* R */
+    card_state->sampler_border_color.color[1] = 0.0; /* G */
+    card_state->sampler_border_color.color[2] = 0.0; /* B */
+    card_state->sampler_border_color.color[3] = 0.0; /* A */
 
     card_state->cc_viewport.min_depth = -1.e35;
     card_state->cc_viewport.max_depth = 1.e35;
@@ -760,12 +760,12 @@ gen4_state_init (struct gen4_render_state *render_state)
 					i, j,
 					state_base_offset +
 					offsetof (gen4_state_t,
-						  sampler_default_color));
+						  sampler_border_color));
 		    sampler_state_init (&card_state->sampler_state[i][j][k][l][1],
 					k, l,
 					state_base_offset +
 					offsetof (gen4_state_t,
-						  sampler_default_color));
+						  sampler_border_color));
 		}
 	    }
 	}
commit 175b30e3828266a89021c2439119545099d72715
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Oct 6 12:48:07 2008 -0700

    Revert "Fallback to software for RepeatNone with transformed RGB-only pictures."
    
    This reverts commit 76c9ece36e6400fd10f364ee330faea470e2da64.
    
    We've learned a new technique that should let us avoid this fallback
    to software. See following commit.

diff --git a/src/i965_render.c b/src/i965_render.c
index 709f3fd..2b59e91 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -254,42 +254,6 @@ i965_check_composite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
     if (!i965_get_dest_format(pDstPicture, &tmp1))
 	I830FALLBACK("Get Color buffer format\n");
 
-    /* There's an infelicity of the 965 with respect to implementing
-     * RepeatNone for a source picture without alpha. The hardware's
-     * CLAMP_BORDER mode in this case doesn't match what Render, (and
-     * everyone, really), wants. Render expects that samples outside
-     * the bounds of the source picture will be transparent, but the
-     * hardware is documented as follows:
-     *
-     *     For surface formats with one or more channels missing, the
-     *     value from the border color is not used for the missing
-     *     channels, resulting in these channels resulting in the
-     *     overall default value (0 for colors and 1 for alpha)
-     *     regardless of whether border color is chosen.
-     *
-     *     [Intel 965 PRM; Volume 4; Section 4.7.4 SAMPLER_BORDER_COLOR_STATE]
-     *
-     * It's that hard-coding of "1 for alpha" that kills us.  Until we
-     * figure out a way to get the hardware to do what we want, we'll
-     * fall back to software. We fall back only if the operator uses
-     * the source alpha, the source format has no alpha, and there's
-     * a transform.
-     *
-     * For more complicated scenarios where there's a transform, but
-     * it won't actually result in any sampling outside the source
-     * picture, we'll have to rely on a higher layer,
-     * (ReduceCompositeOp in render/picture.c), that actually has
-     * access to the coordinates, to simplify the operator from Over
-     * to Source, for example.
-     */
-    if (i965_blend_op[op].src_alpha &&
-	(PICT_FORMAT_A(pSrcPicture->format) == 0) &&
-	pSrcPicture->transform)
-    {
-	I830FALLBACK("No support for alpha (RepeatNone) for an RGB-only picture\n");
-    }
-
-
     return TRUE;
 
 }
commit 21cce1998a10db520c390eb5061814867564c583
Author: Shuang He <shuang.he at intel.com>
Date:   Mon Oct 6 09:48:21 2008 +0800

    Fix a typo in G965 texture video code

diff --git a/src/i965_video.c b/src/i965_video.c
index 4c79259..78f69ee 100644
--- a/src/i965_video.c
+++ b/src/i965_video.c
@@ -254,7 +254,7 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id,
 	ps_kernel_static = &ps_kernel_planar_static[0][0];
 	ps_kernel_static_size = sizeof (ps_kernel_planar_static);
 	src_width[1] = src_width[0] = width;
-	src_width[1] = src_height[0] = height;
+	src_height[1] = src_height[0] = height;
 	src_pitch[1] = src_pitch[0] = video_pitch * 2;
 	src_width[4] = src_width[5] = src_width[2] = src_width[3] = width / 2;
 	src_height[4] = src_height[5] = src_height[2] = src_height[3] = height / 2;
commit 76c9ece36e6400fd10f364ee330faea470e2da64
Author: Carl Worth <cworth at cworth.org>
Date:   Thu Oct 2 20:40:14 2008 -0700

    Fallback to software for RepeatNone with transformed RGB-only pictures.
    
    We wish it wouldn't, but the hardware ignores the alpha in the
    BorderColor we set when the source picture format has no alpha
    in it, (and it uses alpha of 1.0 where we want 0.0). For now,
    fallback for these cases. This gives a correct result, but
    obviously is not as fast as we would like.
    
    This fixes bug #16820:
    
    	[EXA] Composition result in black for areas outside of source-surface bounds
    	https://bugs.freedesktop.org/show_bug.cgi?id=16820

diff --git a/src/i965_render.c b/src/i965_render.c
index 2b59e91..709f3fd 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -254,6 +254,42 @@ i965_check_composite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
     if (!i965_get_dest_format(pDstPicture, &tmp1))
 	I830FALLBACK("Get Color buffer format\n");
 
+    /* There's an infelicity of the 965 with respect to implementing
+     * RepeatNone for a source picture without alpha. The hardware's
+     * CLAMP_BORDER mode in this case doesn't match what Render, (and
+     * everyone, really), wants. Render expects that samples outside
+     * the bounds of the source picture will be transparent, but the
+     * hardware is documented as follows:
+     *
+     *     For surface formats with one or more channels missing, the
+     *     value from the border color is not used for the missing
+     *     channels, resulting in these channels resulting in the
+     *     overall default value (0 for colors and 1 for alpha)
+     *     regardless of whether border color is chosen.
+     *
+     *     [Intel 965 PRM; Volume 4; Section 4.7.4 SAMPLER_BORDER_COLOR_STATE]
+     *
+     * It's that hard-coding of "1 for alpha" that kills us.  Until we
+     * figure out a way to get the hardware to do what we want, we'll
+     * fall back to software. We fall back only if the operator uses
+     * the source alpha, the source format has no alpha, and there's
+     * a transform.
+     *
+     * For more complicated scenarios where there's a transform, but
+     * it won't actually result in any sampling outside the source
+     * picture, we'll have to rely on a higher layer,
+     * (ReduceCompositeOp in render/picture.c), that actually has
+     * access to the coordinates, to simplify the operator from Over
+     * to Source, for example.
+     */
+    if (i965_blend_op[op].src_alpha &&
+	(PICT_FORMAT_A(pSrcPicture->format) == 0) &&
+	pSrcPicture->transform)
+    {
+	I830FALLBACK("No support for alpha (RepeatNone) for an RGB-only picture\n");
+    }
+
+
     return TRUE;
 
 }
commit f1dbc266ccfe26c6b9a272e40a5bbe9afaa4f2e0
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Oct 2 14:45:12 2008 -0700

    Work around libpciaccess reporting a 0 rom size by guessing.
    
    I required the following patch on top of this to work around libpciaccess
    brokenness.  libpciaccess reports 0 rom size if there's no rom resource,
    even if the rom file exists in sysfs.

diff --git a/src/i830_bios.c b/src/i830_bios.c
index 726fe30..007530d 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -159,6 +159,8 @@ parse_general_features(I830Ptr pI830, struct bdb_header *bdb)
     }
 }
 
+#define INTEL_VBIOS_SIZE (64 * 1024)	/* XXX */
+
 /**
  * i830_bios_init - map VBIOS, find VBT
  *
@@ -182,25 +184,35 @@ i830_bios_init(ScrnInfoPtr pScrn)
 
 #if XSERVER_LIBPCIACCESS
     size = pI830->PciInfo->rom_size;
+    if (size == 0) {
+	size = INTEL_VBIOS_SIZE;
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		   "libpciaccess reported 0 rom size, guessing %dkB\n",
+		   size / 1024);
+    }
 #else
-#define INTEL_VBIOS_SIZE (64 * 1024)	/* XXX */
     size = INTEL_VBIOS_SIZE;
 #endif
-    if (size == 0)
-	return -1;
     bios = xalloc(size);
     if (bios == NULL)
 	return -1;
 
 #if XSERVER_LIBPCIACCESS
     ret = pci_device_read_rom (pI830->PciInfo, bios);
-    if (ret != 0)
+    if (ret != 0) {
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+                  "libpciaccess failed to read %dkB video BIOS: %s\n",
+                  size / 1024, strerror(-ret));
+	xfree (bios);
 	return -1;
+    }
 #else
     /* xf86ReadPciBIOS returns the length read */
     ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size);
-    if (ret <= 0)
+    if (ret <= 0) {
+	xfree (bios);
 	return -1;
+    }
 #endif
 
     vbt_off = INTEL_BIOS_16(0x1a);
commit 8304b405e0dc2f31fd2d2fd82e150ba502ab74e2
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 29 17:37:28 2008 -0700

    Eliminate INT10 call to get BIOS contents
    
    libpciaccess (and the old X server PCI code as well) provides a function to
    get the ROM contents. Code to use that was already present in the driver and
    used if the INT10 function failed. Skip the INT10 and just use libpciaccess
    as that eliminates several module loads and scary use of vm86.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/common.h b/src/common.h
index 840d30a..acd5f4a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -81,8 +81,6 @@ extern void I830InitpScrn(ScrnInfoPtr pScrn);
 extern int I830EntityIndex;
 extern const char *I810vgahwSymbols[];
 extern const char *I810ramdacSymbols[];
-extern const char *I810int10Symbols[];
-extern const char *I810vbeSymbols[];
 extern const char *I810ddcSymbols[];
 extern const char *I810fbSymbols[];
 extern const char *I810xaaSymbols[];
@@ -106,21 +104,6 @@ extern void I830DPRINTF_stub(const char *filename, int line,
 #define RecPtr pI810
 #endif
 
-/* BIOS debug macro */
-#define xf86ExecX86int10_wrapper(pInt, pScrn) do {			\
-   ErrorF("Executing (ax == 0x%x) BIOS call at %s:%d\n", pInt->ax, __FILE__, __LINE__);	\
-   if (I810_DEBUG & DEBUG_VERBOSE_BIOS) {				\
-      ErrorF("Checking Error state before execution\n");		\
-      PrintErrorState(pScrn);						\
-   }									\
-   xf86ExecX86int10(pInt);						\
-   if(I810_DEBUG & DEBUG_VERBOSE_BIOS) {				\
-      ErrorF("Checking Error state after execution\n");			\
-      usleep(50000);							\
-      PrintErrorState(pScrn);						\
-   }									\
-} while (0)
-
 static inline void memset_volatile(volatile void *b, int c, size_t len)
 {
     int i;
diff --git a/src/i810.h b/src/i810.h
index e7331f6..7ea2043 100644
--- a/src/i810.h
+++ b/src/i810.h
@@ -47,7 +47,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xaa.h"
 #include "xf86Cursor.h"
 #include "xf86xv.h"
-#include "xf86int10.h"
 #include "vbe.h"
 #include "vgaHW.h"
 
@@ -276,6 +275,8 @@ typedef struct _I810Rec {
    int  drmMinor;
 } I810Rec;
 
+extern const char *I810vbeSymbols[];
+
 #define I810PTR(p) ((I810Ptr)((p)->driverPrivate))
 
 #define I810_SELECT_FRONT	0
diff --git a/src/i810_driver.c b/src/i810_driver.c
index a7f408c..cc28ad8 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -342,14 +342,6 @@ const char *I810ddcSymbols[] = {
    NULL
 };
 
-const char *I810int10Symbols[] = {
-   "xf86ExecX86int10",
-   "xf86InitInt10",
-   "xf86Int10AllocPages",
-   "xf86int10Addr",
-   NULL
-};
-
 const char *I810xaaSymbols[] = {
    "XAACreateInfoRec",
    "XAADestroyInfoRec",
@@ -518,7 +510,7 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin)
 #endif
 			I810shadowFBSymbols,
 			I810vbeSymbols, vbeOptionalSymbols,
-			I810ddcSymbols, I810int10Symbols, NULL);
+			I810ddcSymbols, NULL);
 
       /*
        * The return value must be non-NULL on success even though there
diff --git a/src/i830.h b/src/i830.h
index 491dfd0..5b78236 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -56,8 +56,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xaa.h"
 #include "xf86Cursor.h"
 #include "xf86xv.h"
-#include "xf86int10.h"
-#include "vbe.h"
 #include "vgaHW.h"
 #include "xf86Crtc.h"
 #include "xf86RandR12.h"
diff --git a/src/i830_bios.c b/src/i830_bios.c
index 2cb0b07..726fe30 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -47,9 +47,6 @@
 				 (bios[_addr + 2] << 16)	\
 				 (bios[_addr + 3] << 24))
 
-/* XXX */
-#define INTEL_VBIOS_SIZE (64 * 1024)
-
 static void *
 find_section(struct bdb_header *bdb, int section_id)
 {
@@ -180,34 +177,34 @@ i830_bios_init(ScrnInfoPtr pScrn)
     struct bdb_header *bdb;
     int vbt_off, bdb_off;
     unsigned char *bios;
-    vbeInfoPtr	pVbe;
-    pointer pVBEModule = NULL;
+    int ret;
+    int size;
 
-    bios = xalloc(INTEL_VBIOS_SIZE);
+#if XSERVER_LIBPCIACCESS
+    size = pI830->PciInfo->rom_size;
+#else
+#define INTEL_VBIOS_SIZE (64 * 1024)	/* XXX */
+    size = INTEL_VBIOS_SIZE;
+#endif
+    if (size == 0)
+	return -1;
+    bios = xalloc(size);
     if (bios == NULL)
 	return -1;
 
-    /* Load vbe module */
-    if (!(pVBEModule = xf86LoadSubModule(pScrn, "vbe")))
-	return FALSE;
-    xf86LoaderReqSymLists(I810vbeSymbols, NULL);
-
-    pVbe = VBEInit(NULL, pI830->pEnt->index);
-    if (pVbe != NULL) {
-	memcpy(bios, xf86int10Addr(pVbe->pInt10,
-				   pVbe->pInt10->BIOSseg << 4),
-	       INTEL_VBIOS_SIZE);
-	vbeFree (pVbe);
-    } else {
 #if XSERVER_LIBPCIACCESS
-	pci_device_read_rom (pI830->PciInfo, bios);
+    ret = pci_device_read_rom (pI830->PciInfo, bios);
+    if (ret != 0)
+	return -1;
 #else
-	xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, INTEL_VBIOS_SIZE);
+    /* xf86ReadPciBIOS returns the length read */
+    ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size);
+    if (ret <= 0)
+	return -1;
 #endif
-    }
 
     vbt_off = INTEL_BIOS_16(0x1a);
-    if (vbt_off >= INTEL_VBIOS_SIZE) {
+    if (vbt_off >= size) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Bad VBT offset: 0x%x\n",
 		   vbt_off);
 	xfree(bios);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 53219c3..3a2a9a4 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -191,7 +191,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dixstruct.h"
 #include "xf86xv.h"
 #include <X11/extensions/Xv.h>
-#include "vbe.h"
 #include "shadow.h"
 #include "i830.h"
 #include "i830_display.h"
@@ -441,9 +440,6 @@ I830DetectMemory(ScrnInfoPtr pScrn)
    uint16_t gmch_ctrl;
    int memsize = 0, gtt_size;
    int range;
-#if 0
-   VbeInfoBlock *vbeInfo;
-#endif
 
 #if XSERVER_LIBPCIACCESS
    struct pci_device *bridge = intel_host_bridge ();
@@ -1420,11 +1416,6 @@ I830LoadSyms(ScrnInfoPtr pScrn)
     if (pI830->use_drm_mode)
 	return TRUE;
 
-    /* Load int10 module */
-    if (!xf86LoadSubModule(pScrn, "int10"))
-	return FALSE;
-    xf86LoaderReqSymLists(I810int10Symbols, NULL);
-
     /* The vgahw module should be loaded here when needed */
     if (!xf86LoadSubModule(pScrn, "vgahw"))
 	return FALSE;
diff --git a/src/i830_modes.c b/src/i830_modes.c
index 06921a5..4aa493e 100644
--- a/src/i830_modes.c
+++ b/src/i830_modes.c
@@ -31,7 +31,6 @@
  * Authors: David Dawes <dawes at xfree86.org>
  *	    Eric Anholt <eric.anholt at intel.com>
  *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbeModes.c,v 1.6 2002/11/02 01:38:25 dawes Exp $
  */
 /*
  * Modified by Alan Hourihane <alanh at tungstengraphics.com>
commit ab2b70f831314f81a581bfb1e48d059a3a2b0b06
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Oct 1 16:05:16 2008 -0700

    Prefer repeatType field over using both repeat and repeatType.
    
    Eric informed me that the repeat field exists only for backwards
    compatibility with old drivers that weren't prepared for values
    other than 0 or 1 here. Since we are, we can just ignore that
    field and examine only repeatType. So the code's a (tiny) bit
    simpler this way.

diff --git a/src/i965_render.c b/src/i965_render.c
index 498fa1f..2b59e91 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -209,7 +209,7 @@ static Bool i965_check_composite_texture(PicturePtr pPict, int unit)
         I830FALLBACK("Unsupported picture format 0x%x\n",
 		     (int)pPict->format);
 
-    if (pPict->repeat && pPict->repeatType > RepeatReflect)
+    if (pPict->repeatType > RepeatReflect)
 	I830FALLBACK("extended repeat (%d) not supported\n",
 		     pPict->repeatType);
 
@@ -840,11 +840,8 @@ sampler_state_filter_from_picture (int filter)
 }
 
 static sampler_state_extend_t
-sampler_state_extend_from_picture (int repeat, int repeat_type)
+sampler_state_extend_from_picture (int repeat_type)
 {
-    if (repeat == 0)
-	return SAMPLER_STATE_EXTEND_NONE;
-
     switch (repeat_type) {
     case RepeatNone:
 	return SAMPLER_STATE_EXTEND_NONE;
@@ -1029,8 +1026,7 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
     src_filter = sampler_state_filter_from_picture (pSrcPicture->filter);
     if (src_filter < 0)
 	I830FALLBACK ("Bad src filter 0x%x\n", pSrcPicture->filter);
-    src_extend = sampler_state_extend_from_picture (pSrcPicture->repeat,
-						    pSrcPicture->repeatType);
+    src_extend = sampler_state_extend_from_picture (pSrcPicture->repeatType);
     if (src_extend < 0)
 	I830FALLBACK ("Bad src repeat 0x%x\n", pSrcPicture->repeatType);
 
@@ -1038,8 +1034,7 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
 	mask_filter = sampler_state_filter_from_picture (pMaskPicture->filter);
 	if (mask_filter < 0)
 	    I830FALLBACK ("Bad mask filter 0x%x\n", pMaskPicture->filter);
-	mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeat,
-							 pMaskPicture->repeatType);
+	mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeatType);
 	if (mask_extend < 0)
 	    I830FALLBACK ("Bad mask repeat 0x%x\n", pMaskPicture->repeatType);
     } else {
commit 128223ee9b7880e640056475462eca9a88415492
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Oct 1 15:29:04 2008 -0700

    Add support for RepeatPad and RepeatReflect.
    
    It's quite simple to support these modes---we simply need to
    turn on the support for them in the hardware.
    
    These changes have been verified with the extend-pad and
    extend-reflect tests in cairo's test suite. However, this
    currently required using a custom-modified version of cairo.
    The issue is that released versions of cairo, (and even
    cairo master so far), don't pass RepeatPad and RepeatReflect
    to Render, (due to various bugs and workarounds in cairo
    and pixman). I do plan to fix those issues in cairo, so that
    in a future release of cairo, (1.8.2 perhaps?), the cairo
    test suite will usefully test these new repeat modes in our
    driver.

diff --git a/src/i965_render.c b/src/i965_render.c
index b4a2a73..498fa1f 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -209,7 +209,7 @@ static Bool i965_check_composite_texture(PicturePtr pPict, int unit)
         I830FALLBACK("Unsupported picture format 0x%x\n",
 		     (int)pPict->format);
 
-    if (pPict->repeat && pPict->repeatType != RepeatNormal)
+    if (pPict->repeat && pPict->repeatType > RepeatReflect)
 	I830FALLBACK("extended repeat (%d) not supported\n",
 		     pPict->repeatType);
 
@@ -427,6 +427,8 @@ typedef enum {
 typedef enum {
     SAMPLER_STATE_EXTEND_NONE,
     SAMPLER_STATE_EXTEND_REPEAT,
+    SAMPLER_STATE_EXTEND_PAD,
+    SAMPLER_STATE_EXTEND_REFLECT,
     SAMPLER_STATE_EXTEND_COUNT
 } sampler_state_extend_t;
 
@@ -596,6 +598,16 @@ sampler_state_init (struct brw_sampler_state *sampler_state,
 	sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_WRAP;
 	sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_WRAP;
 	break;
+    case SAMPLER_STATE_EXTEND_PAD:
+	sampler_state->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
+	sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
+	sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CLAMP;
+	break;
+    case SAMPLER_STATE_EXTEND_REFLECT:
+	sampler_state->ss1.r_wrap_mode = BRW_TEXCOORDMODE_MIRROR;
+	sampler_state->ss1.s_wrap_mode = BRW_TEXCOORDMODE_MIRROR;
+	sampler_state->ss1.t_wrap_mode = BRW_TEXCOORDMODE_MIRROR;
+	break;
     }
 
     assert((default_color_offset & 31) == 0);
@@ -838,6 +850,10 @@ sampler_state_extend_from_picture (int repeat, int repeat_type)
 	return SAMPLER_STATE_EXTEND_NONE;
     case RepeatNormal:
 	return SAMPLER_STATE_EXTEND_REPEAT;
+    case RepeatPad:
+	return SAMPLER_STATE_EXTEND_PAD;
+    case RepeatReflect:
+	return SAMPLER_STATE_EXTEND_REFLECT;
     default:
 	return -1;
     }
commit b7279f1be1b913c1c6ee8ebfb95c97800217a821
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Oct 1 15:26:39 2008 -0700

    Examine picture repeatType as well as repeat field.
    
    The existing switch statement was switching on the Boolean
    repeat field rather than the correct repeatType field. This
    had not caused any problem before as only two possible repeat
    values were supported (RepeatNone = 0 and RepeatNormal = 1)
    so they were always the same as the repeat field.
    
    Soon, however, we'll be supporting more repeat types, so we'll
    need to switch on the correct value.

diff --git a/src/i965_render.c b/src/i965_render.c
index 7dee5f3..b4a2a73 100644
--- a/src/i965_render.c
+++ b/src/i965_render.c
@@ -828,9 +828,12 @@ sampler_state_filter_from_picture (int filter)
 }
 
 static sampler_state_extend_t
-sampler_state_extend_from_picture (int repeat)
+sampler_state_extend_from_picture (int repeat, int repeat_type)
 {
-    switch (repeat) {
+    if (repeat == 0)
+	return SAMPLER_STATE_EXTEND_NONE;
+
+    switch (repeat_type) {
     case RepeatNone:
 	return SAMPLER_STATE_EXTEND_NONE;
     case RepeatNormal:
@@ -1010,17 +1013,19 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture,
     src_filter = sampler_state_filter_from_picture (pSrcPicture->filter);
     if (src_filter < 0)
 	I830FALLBACK ("Bad src filter 0x%x\n", pSrcPicture->filter);
-    src_extend = sampler_state_extend_from_picture (pSrcPicture->repeat);
+    src_extend = sampler_state_extend_from_picture (pSrcPicture->repeat,
+						    pSrcPicture->repeatType);
     if (src_extend < 0)
-	I830FALLBACK ("Bad src repeat 0x%x\n", pSrcPicture->repeat);
+	I830FALLBACK ("Bad src repeat 0x%x\n", pSrcPicture->repeatType);
 
     if (pMaskPicture) {
 	mask_filter = sampler_state_filter_from_picture (pMaskPicture->filter);
 	if (mask_filter < 0)
 	    I830FALLBACK ("Bad mask filter 0x%x\n", pMaskPicture->filter);
-	mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeat);
+	mask_extend = sampler_state_extend_from_picture (pMaskPicture->repeat,
+							 pMaskPicture->repeatType);
 	if (mask_extend < 0)
-	    I830FALLBACK ("Bad mask repeat 0x%x\n", pMaskPicture->repeat);
+	    I830FALLBACK ("Bad mask repeat 0x%x\n", pMaskPicture->repeatType);
     } else {
 	mask_filter = SAMPLER_STATE_FILTER_NEAREST;
 	mask_extend = SAMPLER_STATE_EXTEND_NONE;


More information about the xorg-commit mailing list