diff options
author | Keith Packard <keithp@keithp.com> | 2009-04-30 12:48:32 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-04-30 12:48:32 -0700 |
commit | b18ac0f86bae0c5bc5c3b8052b2fc5362e3f5d10 (patch) | |
tree | a5ee3703c7e2a5154ca0e443daa489b50c845a29 | |
parent | cc50de1a9eada785323f2dcc3a59e8e94284e17e (diff) | |
parent | c231b41f3f3eb3ba9c8436d5fd93a30704ed437c (diff) |
Merge commit 'origin/master' into display-port
53 files changed, 435 insertions, 4949 deletions
@@ -25,10 +25,6 @@ The process for releasing a new tarball is as follows: $ make distcheck - Note that unlike a regular "make", this will not work unless - you pass a valid --with-xserver-source=/path/to/xserver option - to configure. - 5. Tag the release $ git tag -m "Intel <ver> release" <ver> diff --git a/configure.ac b/configure.ac index ad1cfcfd..12fec794 100644 --- a/configure.ac +++ b/configure.ac @@ -70,15 +70,10 @@ AC_ARG_ENABLE(video-debug, AC_HELP_STRING([--enable-video-debug], [VIDEO_DEBUG="$enableval"], [VIDEO_DEBUG=no]) -AC_ARG_WITH(xserver-source,AC_HELP_STRING([--with-xserver-source=XSERVER_SOURCE], - [Path to X server source tree]), - [ XSERVER_SOURCE="$withval" ], - [ XSERVER_SOURCE="" ]) - -AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc], - [Disable XvMC support [[default=auto]]]), - [XVMC="$enableval"], - [XVMC=auto]) +dnl AC_ARG_ENABLE(xvmc, AC_HELP_STRING([--disable-xvmc], +dnl [Disable XvMC support [[default=auto]]]), +dnl [XVMC="$enableval"], +dnl [XVMC=auto]) # Checks for extensions XORG_DRIVER_CHECK_EXT(XINERAMA, xineramaproto) @@ -88,14 +83,7 @@ XORG_DRIVER_CHECK_EXT(XF86DRI, xextproto x11) XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) # Checks for pkg-config packages -PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES]) - -PKG_CHECK_MODULES(SERVER_1_5, [xorg-server >= 1.5], - [SERVER_1_5=yes], [SERVER_1_5=no]) - -if test "$SERVER_1_5" = yes; then - AC_DEFINE(SERVER_1_5, 1, [Building against server 1.5]) -fi +PKG_CHECK_MODULES(XORG, [xorg-server >= 1.6 xproto fontsproto $REQUIRED_MODULES]) sdkdir=$(pkg-config --variable=sdkdir xorg-server) drm_cflags=$(pkg-config --cflags libdrm) @@ -129,77 +117,7 @@ if test x$DRI = xauto; then fi AC_MSG_RESULT([$DRI]) -AC_CHECK_HEADER(xf86Modes.h,[XMODES=yes],[XMODES=no],[#include "xorg-server.h"]) -AC_CHECK_DECL(XSERVER_LIBPCIACCESS, - [XSERVER_LIBPCIACCESS=yes],[XSERVER_LIBPCIACCESS=no], - [#include "xorg-server.h"]) -CFLAGS="$save_CFLAGS" - -if test x$XSERVER_LIBPCIACCESS = xyes; then - PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10]) -else - PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10], - have_libpciaccess=yes, - have_libpciaccess=no) -fi -AM_CONDITIONAL(XSERVER_LIBPCIACCESS, test "x$XSERVER_LIBPCIACCESS" = xyes) -AM_CONDITIONAL(LIBPCIACCESS, - test "x$XSERVER_LIBPCIACCESS" = xyes -o "x$have_libpciaccess" = xyes) -AM_CONDITIONAL(XMODES, test "x$XMODES" = xno) - -if test "x$XSERVER_SOURCE" = x; then - if test -d ../../xserver; then - XSERVER_SOURCE="`cd ../../xserver && pwd`" - fi -fi - -if test -d "$XSERVER_SOURCE"; then - case "$XSERVER_SOURCE" in - /*) - ;; - *) - XSERVER_SOURCE="`cd $XSERVER_SOURCE && pwd`" - ;; - esac - if test -f $srcdir/src/modes/xf86Modes.h; then - : - else - ln -sf $XSERVER_SOURCE/hw/xfree86/modes $srcdir/src/modes - fi - - if test -f $srcdir/src/parser/xf86Parser.h; then - : - else - ln -sf $XSERVER_SOURCE/hw/xfree86/parser $srcdir/src/parser - fi -fi - -if test "x$XMODES" = xyes; then - AC_MSG_NOTICE([X server has new mode code]) - AC_DEFINE(XMODES, 1,[X server has built-in mode code]) - XMODES_CFLAGS= -else - if test -f $srcdir/src/modes/xf86Modes.h -a -f $srcdir/src/parser/xf86Parser.h; then - AC_MSG_NOTICE([X server is missing new mode code, using local copy]) - else - AC_MSG_ERROR([Must have X server >= 1.3 source tree for mode setting code. Please specify --with-xserver-source]) - fi - XMODES_CFLAGS='-DXF86_MODES_RENAME -I$(top_srcdir)/src -I$(top_srcdir)/src/modes -I$(top_srcdir)/src/parser' -fi - -AC_SUBST([XMODES_CFLAGS]) - -SAVE_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$CPPFLAGS $XORG_CFLAGS" - -AC_CHECK_DECL(xf86RotateFreeShadow, - [AC_DEFINE(HAVE_FREE_SHADOW, 1, [have new FreeShadow API])], - [], - [#include <xorg-server.h> - #include <windowstr.h> - #include <xf86Crtc.h>]) - -CPPFLAGS="$SAVE_CPPFLAGS" +PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10]) dnl Use lots of warning flags with GCC @@ -219,13 +137,6 @@ if test "$DRI" = yes; then AC_DEFINE(XF86DRI_DEVEL,1,[Enable developmental DRI driver support]) fi -dnl Server 1.5's set_mode_major required for DRM_MODE. -PKG_CHECK_MODULES(DRM_MODE, [xorg-server >= 1.5], - [DRM_MODE=yes], [DRM_MODE=no]) -if test "x$DRM_MODE" = xyes; then - AC_DEFINE(XF86DRM_MODE,1,[DRM kernel modesetting]) -fi - AM_CONDITIONAL(VIDEO_DEBUG, test x$VIDEO_DEBUG = xyes) if test "$VIDEO_DEBUG" = yes; then AC_DEFINE(VIDEO_DEBUG,1,[Enable debug support]) diff --git a/man/intel.man b/man/intel.man index 4f8db817..05aa6789 100644 --- a/man/intel.man +++ b/man/intel.man @@ -146,16 +146,6 @@ have options for selecting adaptors. .IP Default: Textured video adaptor is preferred. .TP -.BI "Option \*qAccelMethod\*q \*q" string \*q -Choose acceleration architecture, either "XAA", "EXA", or "UXA". XAA is the old -XFree86 based acceleration architecture. EXA is a simpler -acceleration architecture designed to better accelerate the X Render extension. -UXA is a newer acceleration architecture built from the EXA acceleration -code but taking advantage of kernel memory management to provide simpler, -faster code. -.IP -Default: "UXA" if kernel-modesetting is available, "EXA" otherwise. -.TP .BI "Option \*qModeDebug\*q \*q" boolean \*q Enable printing of additional debugging information about modesetting to the server log. diff --git a/src/Makefile.am b/src/Makefile.am index 044f2354..6fb84ffc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,11 +18,7 @@ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -if LIBPCIACCESS -REGDUMPER = reg_dumper -endif - -SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER) +SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 reg_dumper # this is obnoxious: # -module lets us name the module exactly how we want @@ -31,33 +27,13 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER) # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \ - @PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa \ - @XMODES_CFLAGS@ -DI830_XV -DI830_USE_XAA -DI830_USE_EXA -DI830_USE_UXA + @PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa intel_drv_la_LTLIBRARIES = intel_drv.la intel_drv_la_LDFLAGS = -module -avoid-version intel_drv_ladir = @moduledir@/drivers intel_drv_la_LIBADD = -lm @DRM_LIBS@ -ldrm_intel ../uxa/libuxa.la -if XSERVER_LIBPCIACCESS intel_drv_la_LIBADD += @PCIACCESS_LIBS@ -endif - -XMODE_SRCS=\ - local_xf86Rename.h \ - parser/xf86Parser.h \ - parser/xf86Optrec.h \ - modes/xf86Modes.h \ - modes/xf86Modes.c \ - modes/xf86cvt.c \ - modes/xf86Crtc.h \ - modes/xf86Crtc.c \ - modes/xf86Cursors.c \ - modes/xf86EdidModes.c \ - modes/xf86RandR12.c \ - modes/xf86RandR12.h \ - modes/xf86Rename.h \ - modes/xf86Rotate.c \ - modes/xf86DiDGA.c INTEL_DRI_SRCS = \ i810_dri.c \ @@ -130,7 +106,6 @@ intel_drv_la_SOURCES = \ i915_video.c \ i965_video.c \ i830_exa.c \ - i830_xaa.c \ i830_render.c \ i915_render.c \ i965_render.c \ @@ -205,11 +180,6 @@ clean-local: -rm -f $(INTEL_G4B) endif -if XMODES -intel_drv_la_SOURCES += \ - $(XMODE_SRCS) -endif - if DRI intel_drv_la_SOURCES += \ $(INTEL_DRI_SRCS) diff --git a/src/bios_reader/Makefile.am b/src/bios_reader/Makefile.am index 9f1c45a5..cff9e1a6 100644 --- a/src/bios_reader/Makefile.am +++ b/src/bios_reader/Makefile.am @@ -1,9 +1,8 @@ -AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @XMODES_CFLAGS@ @PCIACCESS_CFLAGS@ \ +AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @PCIACCESS_CFLAGS@ \ -DREG_DUMPER noinst_PROGRAMS = bios_reader $(BIOS_DUMPER) $(SWF_DUMPER) -if LIBPCIACCESS BIOS_DUMPER = bios_dumper bios_dumper_SOURCES = bios_dumper.c @@ -15,5 +14,3 @@ SWF_DUMPER = swf_dumper swf_dumper_SOURCES = swf_dumper.c swf_dumper_LDADD = $(PCIACCESS_LIBS) - -endif diff --git a/src/ch7017/Makefile.am b/src/ch7017/Makefile.am index fef4d373..48aef60d 100644 --- a/src/ch7017/Makefile.am +++ b/src/ch7017/Makefile.am @@ -3,7 +3,7 @@ # -avoid-version prevents gratuitous .0.0.0 version numbers on the end # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. -AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ +AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ @PCIACCESS_CFLAGS@ ch7017_la_LTLIBRARIES = ch7017.la diff --git a/src/ch7xxx/Makefile.am b/src/ch7xxx/Makefile.am index 9f936116..476f84b2 100644 --- a/src/ch7xxx/Makefile.am +++ b/src/ch7xxx/Makefile.am @@ -3,7 +3,7 @@ # -avoid-version prevents gratuitous .0.0.0 version numbers on the end # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. -AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ +AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ @PCIACCESS_CFLAGS@ ch7xxx_la_LTLIBRARIES = ch7xxx.la diff --git a/src/common.h b/src/common.h index 8b32a66e..1576d3a1 100644 --- a/src/common.h +++ b/src/common.h @@ -40,7 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define _INTEL_COMMON_H_ /* Provide substitutes for gcc's __FUNCTION__ on other compilers */ -#ifndef __GNUC__ +#if !defined(__GNUC__) && !defined(__FUNCTION__) # if defined(__STDC__) && (__STDC_VERSION__>=199901L) /* C99 */ # define __FUNCTION__ __func__ # else @@ -55,11 +55,15 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef I830DEBUG #define MARKER() ErrorF("\n### %s:%d: >>> %s <<< ###\n\n", \ __FILE__, __LINE__,__FUNCTION__) -#define DPRINTF I830DPRINTF_stub +#define DPRINTF I830DPRINTF #else /* #ifdef I830DEBUG */ #define MARKER() -/* this is a real ugly hack to get the compiler to optimize the debugging statements into oblivion */ -#define DPRINTF if(0) I830DPRINTF_stub +#define DPRINTF I830DPRINTF_stub +static inline void +I830DPRINTF_stub(const char *filename, int line, const char *function, + const char *fmt, ...) +{ +} #endif /* #ifdef I830DEBUG */ #define KB(x) ((x) * 1024) @@ -318,21 +322,12 @@ extern int I810_DEBUG; #define PCI_CHIP_G41_G_BRIDGE 0x2E30 #endif -#if XSERVER_LIBPCIACCESS #define I810_MEMBASE(p,n) (p)->regions[(n)].base_addr #define VENDOR_ID(p) (p)->vendor_id #define DEVICE_ID(p) (p)->device_id #define SUBVENDOR_ID(p) (p)->subvendor_id #define SUBSYS_ID(p) (p)->subdevice_id #define CHIP_REVISION(p) (p)->revision -#else -#define I810_MEMBASE(p,n) (p)->memBase[n] -#define VENDOR_ID(p) (p)->vendor -#define DEVICE_ID(p) (p)->chipType -#define SUBVENDOR_ID(p) (p)->subsysVendor -#define SUBSYS_ID(p) (p)->subsysCard -#define CHIP_REVISION(p) (p)->chipRev -#endif #define IS_I810(pI810) (DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810 || \ DEVICE_ID(pI810->PciInfo) == PCI_CHIP_I810_DC100 || \ @@ -399,9 +394,7 @@ extern int I810_DEBUG; #define PIPE_NAME(n) ('A' + (n)) -#if XSERVER_LIBPCIACCESS struct pci_device * intel_host_bridge (void); -#endif - + #endif /* _INTEL_COMMON_H_ */ diff --git a/src/drmmode_display.c b/src/drmmode_display.c index 7b97a646..15ffc29c 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -31,7 +31,6 @@ #include "xorgVersion.h" -#ifdef XF86DRM_MODE #include "i830.h" #include "intel_bufmgr.h" #include "xf86drmMode.h" @@ -738,19 +737,19 @@ static int subpixel_conv_table[7] = { 0, SubPixelUnknown, SubPixelVerticalBGR, SubPixelNone }; -const char *output_names[] = { "None", - "VGA", - "DVI", - "DVI", - "DVI", - "Composite", - "TV", - "LVDS", - "CTV", - "DIN", - "DP", - "HDMI", - "HDMI", +static const char *output_names[] = { "None", + "VGA", + "DVI", + "DVI", + "DVI", + "Composite", + "TV", + "LVDS", + "CTV", + "DIN", + "DP", + "HDMI", + "HDMI", }; @@ -824,9 +823,6 @@ drmmode_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) if (scrn->virtualX == width && scrn->virtualY == height) return TRUE; - if (!pI830->can_resize) - return FALSE; - pitch = i830_pad_drawable_width(width, pI830->cpp); tiled = i830_tiled_width(pI830, &pitch, pI830->cpp); xf86DrvMsg(scrn->scrnIndex, X_INFO, @@ -896,7 +892,6 @@ static const xf86CrtcConfigFuncsRec drmmode_xf86crtc_config_funcs = { Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp) { - I830Ptr pI830 = I830PTR(pScrn); xf86CrtcConfigPtr xf86_config; drmmode_ptr drmmode; int i; @@ -921,33 +916,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp) for (i = 0; i < drmmode->mode_res->count_connectors; i++) drmmode_output_init(pScrn, drmmode, i); - xf86InitialConfiguration(pScrn, pI830->can_resize); + xf86InitialConfiguration(pScrn, TRUE); return TRUE; } - -Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData, dri_bo **bo) -{ - return FALSE; - -#if 0 - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (pScrn); - int i; - - for (i = 0; i < config->num_crtc; i++) { - xf86CrtcPtr crtc = config->crtc[i]; - drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; - - if (!drmmode_crtc->rotate_bo) - continue; - - if (drmmode_crtc->rotate_bo->virtual == pPixData) { - *bo = drmmode_crtc->rotate_bo; - return TRUE; - } - } - return FALSE; -#endif -} - -#endif diff --git a/src/i2c_vid.h b/src/i2c_vid.h index 6c4e95df..e5d5ec12 100644 --- a/src/i2c_vid.h +++ b/src/i2c_vid.h @@ -129,8 +129,4 @@ typedef struct _I830I2CVidOutputRec { void (*dump_regs)(I2CDevPtr d); } I830I2CVidOutputRec, *I830I2CVidOutputPtr; -/* XXX change this name to avoid driver-specific prefix */ -DisplayModePtr -i830_dvo_get_current_mode (xf86OutputPtr output); - #endif @@ -51,9 +51,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "vgaHW.h" #include "xorg-server.h" -#ifdef XSERVER_LIBPCIACCESS #include <pciaccess.h> -#endif #ifdef XF86DRI #include "xf86drm.h" @@ -190,12 +188,7 @@ typedef struct _I810Rec { unsigned long MMIOAddr; IOADDRESS ioBase; EntityInfoPtr pEnt; -#if XSERVER_LIBPCIACCESS struct pci_device *PciInfo; -#else - pciVideoPtr PciInfo; - PCITAG PciTag; -#endif I810RingBuffer *LpRing; unsigned int BR[20]; diff --git a/src/i810_dri.c b/src/i810_dri.c index 136a7056..00691af7 100644 --- a/src/i810_dri.c +++ b/src/i810_dri.c @@ -354,14 +354,8 @@ I810DRIScreenInit(ScreenPtr pScreen) } else { pDRIInfo->busIdString = xalloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", -#if XSERVER_LIBPCIACCESS ((pI810->PciInfo->domain << 8) | pI810->PciInfo->bus), pI810->PciInfo->dev, pI810->PciInfo->func -#else - ((pciConfigPtr) pI810->PciInfo->thisCard)->busnum, - ((pciConfigPtr) pI810->PciInfo->thisCard)->devnum, - ((pciConfigPtr) pI810->PciInfo->thisCard)->funcnum -#endif ); } pDRIInfo->ddxDriverMajorVersion = I810_MAJOR_VERSION; @@ -978,19 +972,10 @@ I810DRIScreenInit(ScreenPtr pScreen) if (!pI810DRI->irq) { pI810DRI->irq = drmGetInterruptFromBusID(pI810->drmSubFD, -#if XSERVER_LIBPCIACCESS ((pI810->PciInfo->domain << 8) | pI810->PciInfo->bus), pI810->PciInfo->dev, pI810->PciInfo->func -#else - ((pciConfigPtr) pI810-> - PciInfo->thisCard)->busnum, - ((pciConfigPtr) pI810-> - PciInfo->thisCard)->devnum, - ((pciConfigPtr) pI810-> - PciInfo->thisCard)->funcnum -#endif ); if ((drmCtlInstHandler(pI810->drmSubFD, pI810DRI->irq)) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, diff --git a/src/i810_driver.c b/src/i810_driver.c index fe4bd626..263e8d92 100644 --- a/src/i810_driver.c +++ b/src/i810_driver.c @@ -95,14 +95,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static void I810Identify(int flags); -#if XSERVER_LIBPCIACCESS static Bool intel_pci_probe (DriverPtr drv, int entity_num, struct pci_device *dev, intptr_t match_data); -#else -static Bool I810Probe(DriverPtr drv, int flags); -#endif #ifndef I830_ONLY static Bool I810PreInit(ScrnInfoPtr pScrn, int flags); @@ -120,9 +116,6 @@ static ModeStatus I810ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); #endif /* I830_ONLY */ - -#if XSERVER_LIBPCIACCESS - #define INTEL_DEVICE_MATCH(d,i) \ { 0x8086, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) } @@ -162,25 +155,17 @@ static const struct pci_id_match intel_device_match[] = { { 0, 0, 0 }, }; -#endif /* XSERVER_LIBPCIACCESS */ - _X_EXPORT DriverRec I810 = { I810_VERSION, I810_DRIVER_NAME, I810Identify, -#if XSERVER_LIBPCIACCESS NULL, -#else - I810Probe, -#endif I810AvailableOptions, NULL, 0, NULL, -#if XSERVER_LIBPCIACCESS intel_device_match, intel_pci_probe -#endif }; /* *INDENT-OFF* */ @@ -482,11 +467,7 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin) if (!setupDone) { setupDone = 1; xf86AddDriver(&I810, module, -#if XSERVER_LIBPCIACCESS HaveDriverFuncs -#else - 0 -#endif ); /* @@ -575,7 +556,6 @@ I810AvailableOptions(int chipid, int busid) #endif } -#if XSERVER_LIBPCIACCESS struct pci_device * intel_host_bridge (void) { @@ -641,147 +621,6 @@ static Bool intel_pci_probe (DriverPtr driver, } return scrn != NULL; } -#else /* XSERVER_LIBPCIACCESS */ - -/* - * I810Probe -- - * - * Look through the PCI bus to find cards that are I810 boards. - * Setup the dispatch table for the rest of the driver functions. - * - */ -static Bool -I810Probe(DriverPtr drv, int flags) -{ - int i, numUsed, numDevSections, *usedChips; - DevUnion *pPriv; - GDevPtr *devSections; - Bool foundScreen = FALSE; - pciVideoPtr *VideoInfo; - pciVideoPtr *ppPci; - PciChipsets *id; - - /* - * Find the config file Device sections that match this - * driver, and return if there are none. - */ - if ((numDevSections = - xf86MatchDevice(I810_DRIVER_NAME, &devSections)) <= 0 ) { - return FALSE; - } - - /* - * This probing is just checking the PCI data the server already - * collected. - */ - if (!(VideoInfo = xf86GetPciVideoInfo())) - return FALSE; - - /* - * Mobile platforms may have both function 0 and 1 active, but they - * are handled as a single entity. To make sure that the function 1 - * entity isn't assigned to a screen, check for and claim it here - * first. - * - * XXX If function 1's resources are ever needed, they'll need to be - * added to the screen and marked active. - */ - for (ppPci = VideoInfo; ppPci != NULL && *ppPci != NULL; ppPci++) { - if ((*ppPci)->vendor == PCI_VENDOR_INTEL && - (*ppPci)->func == 1) { - for (id = I810PciChipsets; id->PCIid != -1; id++) { - if (id->PCIid == (*ppPci)->chipType) { - /* Claim slot */ - if (xf86CheckPciSlot((*ppPci)->bus, (*ppPci)->device, - (*ppPci)->func)) { - xf86ClaimPciSlot((*ppPci)->bus, (*ppPci)->device, - (*ppPci)->func, drv, id->PCIid, - NULL, FALSE); - } - break; - } - } - } - } - - /* Look for Intel i8xx devices. */ - numUsed = xf86MatchPciInstances(I810_NAME, PCI_VENDOR_INTEL, - I810Chipsets, I810PciChipsets, - devSections, numDevSections, - drv, &usedChips); - - if (flags & PROBE_DETECT) { - if (numUsed > 0) - foundScreen = TRUE; - } else { - for (i = 0; i < numUsed; i++) { - ScrnInfoPtr pScrn = NULL; - - /* Allocate new ScrnInfoRec and claim the slot */ - if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], - I810PciChipsets, NULL, NULL, NULL, - NULL, NULL))) { - EntityInfoPtr pEnt; - - pEnt = xf86GetEntityInfo(usedChips[i]); - - pScrn->driverVersion = I810_VERSION; - pScrn->driverName = I810_DRIVER_NAME; - pScrn->name = I810_NAME; - pScrn->Probe = I810Probe; - foundScreen = TRUE; - switch (pEnt->chipset) { - case PCI_CHIP_845_G: - case PCI_CHIP_I865_G: - case PCI_CHIP_I830_M: - case PCI_CHIP_I855_GM: - case PCI_CHIP_I915_G: - case PCI_CHIP_E7221_G: - case PCI_CHIP_I915_GM: - case PCI_CHIP_I945_G: - case PCI_CHIP_I945_GM: - case PCI_CHIP_I945_GME: - case PCI_CHIP_IGD_GM: - case PCI_CHIP_IGD_G: - case PCI_CHIP_I965_G: - case PCI_CHIP_G35_G: - case PCI_CHIP_I965_Q: - case PCI_CHIP_I946_GZ: - case PCI_CHIP_I965_GM: - case PCI_CHIP_I965_GME: - case PCI_CHIP_G33_G: - case PCI_CHIP_Q35_G: - case PCI_CHIP_Q33_G: - case PCI_CHIP_GM45_GM: - case PCI_CHIP_IGD_E_G: - case PCI_CHIP_G45_G: - case PCI_CHIP_Q45_G: - case PCI_CHIP_G41_G: - I830InitpScrn(pScrn); - break; -#ifndef I830_ONLY - default: - pScrn->PreInit = I810PreInit; - pScrn->ScreenInit = I810ScreenInit; - pScrn->SwitchMode = I810SwitchMode; - pScrn->AdjustFrame = I810AdjustFrame; - pScrn->EnterVT = I810EnterVT; - pScrn->LeaveVT = I810LeaveVT; - pScrn->FreeScreen = I810FreeScreen; - pScrn->ValidMode = I810ValidMode; - break; -#endif - } - } - } - } - - xfree(usedChips); - xfree(devSections); - - return foundScreen; -} -#endif /* else XSERVER_LIBPCIACCESS */ #ifndef I830_ONLY static void @@ -873,10 +712,6 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) pI810->ioBase = hwp->PIOOffset; pI810->PciInfo = xf86GetPciInfoForEntity(pI810->pEnt->index); -#if !XSERVER_LIBPCIACCESS - pI810->PciTag = pciTag(pI810->PciInfo->bus, pI810->PciInfo->device, - pI810->PciInfo->func); -#endif if (xf86RegisterResources(pI810->pEnt->index, NULL, ResNone)) return FALSE; @@ -1015,45 +850,11 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", (pScrn->chipset != NULL) ? pScrn->chipset : "Unknown i810"); -#if XSERVER_LIBPCIACCESS pI810->LinearAddr = pI810->PciInfo->regions[0].base_addr; -#else - if (pI810->pEnt->device->MemBase != 0) { - pI810->LinearAddr = pI810->pEnt->device->MemBase; - from = X_CONFIG; - } else { - if (pI810->PciInfo->memBase[1] != 0) { - pI810->LinearAddr = pI810->PciInfo->memBase[0] & 0xFF000000; - from = X_PROBED; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No valid FB address in PCI config space\n"); - I810FreeRec(pScrn); - return FALSE; - } - } -#endif xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", (unsigned long)pI810->LinearAddr); -#if XSERVER_LIBPCIACCESS pI810->MMIOAddr = pI810->PciInfo->regions[1].base_addr; -#else - if (pI810->pEnt->device->IOBase != 0) { - pI810->MMIOAddr = pI810->pEnt->device->IOBase; - from = X_CONFIG; - } else { - if (pI810->PciInfo->memBase[1]) { - pI810->MMIOAddr = pI810->PciInfo->memBase[1] & 0xFFF80000; - from = X_PROBED; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "No valid MMIO address in PCI config space\n"); - I810FreeRec(pScrn); - return FALSE; - } - } -#endif xf86DrvMsg(pScrn->scrnIndex, from, "IO registers at addr 0x%lX\n", (unsigned long)pI810->MMIOAddr); @@ -1072,11 +873,7 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) { uint32_t whtcfg_pamr_drp; -#if XSERVER_LIBPCIACCESS pci_device_cfg_read_u32(pI810->PciInfo, & whtcfg_pamr_drp, WHTCFG_PAMR_DRP); -#else - whtcfg_pamr_drp = pciReadLong(pI810->PciTag, WHTCFG_PAMR_DRP); -#endif /* Need this for choosing watermarks. */ @@ -1129,18 +926,10 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) /* Calculate Fixed Offsets depending on graphics aperture size */ { -#if XSERVER_LIBPCIACCESS struct pci_device *bridge = intel_host_bridge (); uint32_t smram_miscc; pci_device_cfg_read_u32 (bridge, & smram_miscc, SMRAM_MISCC); -#else - PCITAG bridge; - long smram_miscc; - - bridge = pciTag(0, 0, 0); /* This is always the host bridge */ - smram_miscc = pciReadLong(bridge, SMRAM_MISCC); -#endif if ((smram_miscc & GFX_MEM_WIN_SIZE) == GFX_MEM_WIN_32M) { pI810->FbMapSize = 0x1000000; @@ -1331,10 +1120,8 @@ I810MapMMIO(ScrnInfoPtr pScrn) { int mmioFlags; I810Ptr pI810 = I810PTR(pScrn); -#if XSERVER_LIBPCIACCESS struct pci_device *const device = pI810->PciInfo; int err; -#endif #if !defined(__alpha__) mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; @@ -1342,7 +1129,6 @@ I810MapMMIO(ScrnInfoPtr pScrn) mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE; #endif -#if XSERVER_LIBPCIACCESS err = pci_device_map_range (device, pI810->MMIOAddr, I810_REG_SIZE, @@ -1355,13 +1141,6 @@ I810MapMMIO(ScrnInfoPtr pScrn) strerror (err), err); return FALSE; } -#else - pI810->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, - pI810->PciTag, - pI810->MMIOAddr, I810_REG_SIZE); - if (!pI810->MMIOBase) - return FALSE; -#endif return TRUE; } @@ -1369,17 +1148,12 @@ static Bool I810MapMem(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); -#if XSERVER_LIBPCIACCESS struct pci_device *const device = pI810->PciInfo; int err; -#else - long i; -#endif if (!I810MapMMIO(pScrn)) return FALSE; -#if XSERVER_LIBPCIACCESS err = pci_device_map_range (device, pI810->LinearAddr, pI810->FbMapSize, @@ -1392,15 +1166,6 @@ I810MapMem(ScrnInfoPtr pScrn) strerror (err), err); return FALSE; } -#else - for (i = 2; i < pI810->FbMapSize; i <<= 1) ; - - pI810->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, - pI810->PciTag, - pI810->LinearAddr, i); - if (!pI810->FbBase) - return FALSE; -#endif pI810->LpRing->virtual_start = pI810->FbBase + pI810->LpRing->mem.Start; @@ -1412,12 +1177,7 @@ I810UnmapMMIO(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); -#if XSERVER_LIBPCIACCESS pci_device_unmap_range (pI810->PciInfo, pI810->MMIOBase, I810_REG_SIZE); -#else - xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->MMIOBase, - I810_REG_SIZE); -#endif pI810->MMIOBase = NULL; } @@ -1426,12 +1186,7 @@ I810UnmapMem(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); -#if XSERVER_LIBPCIACCESS pci_device_unmap_range (pI810->PciInfo, pI810->FbBase, pI810->FbMapSize); -#else - xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI810->FbBase, - pI810->FbMapSize); -#endif pI810->FbBase = NULL; I810UnmapMMIO(pScrn); return TRUE; @@ -53,7 +53,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86PciInfo.h" #include "xf86Pci.h" #include "i810_reg.h" -#include "xaa.h" #include "xf86Cursor.h" #include "xf86xv.h" #include "vgaHW.h" @@ -61,44 +60,26 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "xf86RandR12.h" #include "xorg-server.h" -#ifdef XSERVER_LIBPCIACCESS #include <pciaccess.h> -#endif -#ifdef XF86DRI #include "xf86drm.h" #include "sarea.h" #define _XF86DRI_SERVER_ #include "dri.h" #include "GL/glxint.h" #include "i830_dri.h" -#endif #include "intel_bufmgr.h" #include "i915_drm.h" -#ifdef I830_USE_EXA -#include "exa.h" -Bool I830EXAInit(ScreenPtr pScreen); -unsigned long long I830TexOffsetStart(PixmapPtr pPix); -#endif - -#ifdef I830_USE_UXA #include "uxa.h" Bool i830_uxa_init(ScreenPtr pScreen); void i830_uxa_create_screen_resources(ScreenPtr pScreen); void i830_uxa_block_handler (ScreenPtr pScreen); Bool i830_get_aperture_space(ScrnInfoPtr pScrn, drm_intel_bo **bo_table, int num_bos); -#endif -#if defined(I830_USE_UXA) || defined(I830_USE_EXA) dri_bo *i830_get_pixmap_bo (PixmapPtr pixmap); void i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo); -#endif - -#ifdef I830_USE_XAA -Bool I830XAAInit(ScreenPtr pScreen); -#endif typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr; @@ -106,24 +87,15 @@ typedef struct _I830OutputRec I830OutputRec, *I830OutputPtr; #include "i830_sdvo.h" #include "i2c_vid.h" -/* - * The mode handling is based upon the VESA driver written by - * Paulo César Pereira de Andrade <pcpa@conectiva.com.br>. - */ - -#ifdef XF86DRI -#define I830_MM_MINPAGES 512 -#define I830_MM_MAXSIZE (32*1024) -#define I830_KERNEL_MM (1 << 0) /* Initialize the kernel memory manager*/ -#define I830_KERNEL_TEX (1 << 1) /* Allocate texture memory pool */ -#endif - #ifdef XvMCExtension #ifdef ENABLE_XVMC #define INTEL_XVMC 1 #endif #endif +#define ALWAYS_SYNC 0 +#define ALWAYS_FLUSH 0 + typedef struct _I830Rec *I830Ptr; typedef void (*I830WriteIndexedByteFunc)(I830Ptr pI830, IOADDRESS addr, @@ -246,8 +218,6 @@ struct _I830DVODriver { pointer modhandle; }; -extern const char *i830_output_type_names[]; - typedef struct _I830CrtcPrivateRec { int pipe; int plane; @@ -353,15 +323,12 @@ enum backlight_control { typedef enum accel_method { ACCEL_UNINIT = 0, ACCEL_NONE, - ACCEL_XAA, - ACCEL_EXA, ACCEL_UXA } accel_method_t; enum dri_type { DRI_DISABLED, DRI_NONE, - DRI_XF86DRI, DRI_DRI2 }; @@ -372,8 +339,6 @@ typedef struct _I830Rec { int cpp; unsigned int bufferOffset; /* for I830SelectBuffer */ - BoxRec FbMemBox; - int CacheLines; /* These are set in PreInit and never changed. */ long FbMapSize; @@ -397,10 +362,6 @@ typedef struct _I830Rec { /* separate small buffers for kernels that support this */ i830_memory *cursor_mem_classic[2]; i830_memory *cursor_mem_argb[2]; - i830_memory *xaa_scratch; -#ifdef I830_USE_EXA - i830_memory *exa_offscreen; -#endif i830_memory *fake_bufmgr_mem; /* Regions allocated either from the above pools, or from agpgart. */ @@ -423,15 +384,15 @@ typedef struct _I830Rec { /** Number of bytes to be emitted in the current BEGIN_BATCH. */ uint32_t batch_emitting; dri_bo *batch_bo; + dri_bo *last_batch_bo; /** Whether we're in a section of code that can't tolerate flushing */ Bool in_batch_atomic; /** Ending batch_used that was verified by i830_start_batch_atomic() */ int batch_atomic_limit; -#ifdef I830_XV /* For Xvideo */ i830_memory *overlay_regs; -#endif + void *offscreenImages; /**< remembered memory block for release */ #ifdef INTEL_XVMC /* For XvMC */ Bool XvMCEnabled; @@ -444,89 +405,35 @@ typedef struct _I830Rec { i830_memory *power_context; -#ifdef XF86DRI - i830_memory *back_buffer; - i830_memory *depth_buffer; - i830_memory *textures; /**< Compatibility texture memory */ i830_memory *memory_manager; /**< DRI memory manager aperture */ - i830_memory *hw_status; /* for G33 hw status page alloc */ - - int TexGranularity; - int drmMinor; - Bool allocate_classic_textures; - - Bool can_resize; - - Bool want_vblank_interrupts; -#endif Bool need_mi_flush; - Bool NeedRingBufferLow; Bool tiling; Bool fb_compression; - int backPitch; - Bool CursorNeedsPhysical; - - DGAModePtr DGAModes; - int numDGAModes; - Bool DGAactive; - int DGAViewportStatus; int Chipset; unsigned long LinearAddr; unsigned long MMIOAddr; IOADDRESS ioBase; EntityInfoPtr pEnt; -#if XSERVER_LIBPCIACCESS struct pci_device *PciInfo; -#else - pciVideoPtr PciInfo; - PCITAG PciTag; -#endif uint8_t variant; unsigned int BR[20]; - unsigned char **ScanlineColorExpandBuffers; - int NumScanlineColorExpandBuffers; - int nextColorExpandBuf; - Bool fence_used[FENCE_NEW_NR]; accel_method_t accel; -#ifdef I830_USE_XAA - XAAInfoRecPtr AccelInfoRec; - - /* additional XAA accelerated Composite support */ - CompositeProcPtr saved_composite; - Bool (*xaa_check_composite)(int op, PicturePtr pSrc, PicturePtr pMask, - PicturePtr pDst); - Bool (*xaa_prepare_composite)(int op, PicturePtr pSrc, PicturePtr pMask, - PicturePtr pDst, PixmapPtr pSrcPixmap, - PixmapPtr pMaskPixmap, PixmapPtr pDstPixmap); - void (*xaa_composite)(PixmapPtr pDst, int xSrc, int ySrc, - int xMask, int yMask, int xDst, int yDst, - int w, int h); - void (*xaa_done_composite)(PixmapPtr pDst); -#endif CloseScreenProcPtr CloseScreen; void (*batch_flush_notify)(ScrnInfoPtr pScrn); -#ifdef I830_USE_EXA - ExaDriverPtr EXADriverPtr; -#endif -#ifdef I830_USE_UXA uxa_driver_t *uxa_driver; Bool need_flush; -#endif - Bool need_sync; -#if defined(I830_USE_EXA) || defined(I830_USE_UXA) PixmapPtr pSrcPixmap; -#endif int accel_pixmap_pitch_alignment; int accel_pixmap_offset_alignment; int accel_max_x; @@ -541,7 +448,6 @@ typedef struct _I830Rec { Bool XvEnabled; /* Xv enabled for this generation. */ Bool XvPreferOverlay; -#ifdef I830_XV int colorKey; XF86VideoAdaptorPtr adaptor; ScreenBlockHandlerProcPtr BlockHandler; @@ -557,14 +463,13 @@ typedef struct _I830Rec { drm_intel_bo *gen4_sampler_bo; drm_intel_bo *gen4_sip_kernel_bo; } video; -#endif - /* EXA render state */ + /* Render accel state */ float scale_units[2][2]; /** Transform pointers for src/mask, or NULL if identity */ PictTransform *transform[2]; float coord_adjust; - /* i915 EXA render state */ + /* i915 render accel state */ uint32_t mapstate[6]; uint32_t samplerstate[6]; @@ -582,18 +487,9 @@ typedef struct _I830Rec { enum dri_type directRenderingType; /* DRI enabled this generation. */ -#ifdef XF86DRI Bool directRenderingOpen; - int LockHeld; - DRIInfoPtr pDRIInfo; int drmSubFD; - int numVisualConfigs; - __GLXvisualConfig *pVisualConfigs; - I830ConfigPrivPtr pVisualConfigsPriv; - drm_handle_t buffer_map; - drm_handle_t ring_map; char deviceName[64]; -#endif /* Broken-out options. */ OptionInfoPtr Options; @@ -615,10 +511,6 @@ typedef struct _I830Rec { Bool suspended; Bool leaving; - /* fbOffset converted to (x, y). */ - int xoffset; - int yoffset; - unsigned int SaveGeneration; OsTimerPtr devicesTimer; @@ -737,10 +629,6 @@ typedef struct _I830Rec { unsigned long intel_get_pixmap_offset(PixmapPtr pPix); unsigned long intel_get_pixmap_pitch(PixmapPtr pPix); -struct i830_exa_pixmap_priv { - dri_bo *bo; -}; - /* Batchbuffer support macros and functions */ #include "i830_batchbuffer.h" @@ -782,10 +670,8 @@ i830_crtc_set_cursor_colors (xf86CrtcPtr crtc, int bg, int fg); extern void i830_refresh_ring(ScrnInfoPtr pScrn); extern void I830EmitFlush(ScrnInfoPtr pScrn); -#ifdef I830_XV extern void I830InitVideo(ScreenPtr pScreen); extern void i830_crtc_dpms_video(xf86CrtcPtr crtc, Bool on); -#endif int i830_crtc_pipe (xf86CrtcPtr crtc); @@ -798,33 +684,10 @@ i830_pipe_a_require_activate (ScrnInfoPtr scrn); void i830_pipe_a_require_deactivate (ScrnInfoPtr scrn); -#ifdef XF86DRI -extern Bool I830Allocate3DMemory(ScrnInfoPtr pScrn, const int flags); -extern void I830SetupMemoryTiling(ScrnInfoPtr pScrn); -extern Bool I830DRIScreenInit(ScreenPtr pScreen); -extern Bool I830CheckDRIAvailable(ScrnInfoPtr pScrn); -extern Bool I830DRIDoMappings(ScreenPtr pScreen); -extern Bool I830DRIResume(ScreenPtr pScreen); -extern void I830DRICloseScreen(ScreenPtr pScreen); -extern Bool I830DRIFinishScreenInit(ScreenPtr pScreen); -extern void I830DRIUnlock(ScrnInfoPtr pScrn); -extern Bool I830DRILock(ScrnInfoPtr pScrn); -extern Bool I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on); -extern Bool i830_update_dri_buffers(ScrnInfoPtr pScrn); -extern Bool I830DRISetHWS(ScrnInfoPtr pScrn); -extern Bool I830DRIInstIrqHandler(ScrnInfoPtr pScrn); -#endif - -#ifdef DRI2 Bool I830DRI2ScreenInit(ScreenPtr pScreen); void I830DRI2CloseScreen(ScreenPtr pScreen); -#endif -#ifdef XF86DRM_MODE extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp); -extern Bool drmmode_is_rotate_pixmap(ScrnInfoPtr pScrn, pointer pPixData, - dri_bo **bo); -#endif extern Bool I830AccelInit(ScreenPtr pScreen); extern void I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, @@ -853,7 +716,6 @@ void i830_free_3d_memory(ScrnInfoPtr pScrn); void i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem); extern long I830CheckAvailableMemory(ScrnInfoPtr pScrn); Bool i830_allocate_2d_memory(ScrnInfoPtr pScrn); -Bool i830_allocate_texture_memory(ScrnInfoPtr pScrn); Bool i830_allocate_pwrctx(ScrnInfoPtr pScrn); Bool i830_allocate_3d_memory(ScrnInfoPtr pScrn); void i830_init_bufmgr(ScrnInfoPtr pScrn); @@ -861,7 +723,6 @@ void i830_init_bufmgr(ScrnInfoPtr pScrn); Bool i830_allocate_xvmc_buffer(ScrnInfoPtr pScrn, const char *name, i830_memory **buffer, unsigned long size, int flags); #endif -extern void i830_update_front_offset(ScrnInfoPtr pScrn); extern uint32_t i830_create_new_fb(ScrnInfoPtr pScrn, int width, int height, int *pitch); @@ -875,9 +736,6 @@ i830_pad_drawable_width(int width, int cpp); extern Bool I830I2CInit(ScrnInfoPtr pScrn, I2CBusPtr *bus_ptr, int i2c_reg, char *name); -/* return a mask of output indices matching outputs against type_mask */ -int i830_output_clones (ScrnInfoPtr pScrn, int type_mask); - /* i830_display.c */ Bool i830PipeHasType (xf86CrtcPtr crtc, int type); @@ -899,15 +757,11 @@ void i830_hdmi_init(ScrnInfoPtr pScrn, int output_reg); /* i830_lvds.c */ void i830_lvds_init(ScrnInfoPtr pScrn); -extern void i830MarkSync(ScrnInfoPtr pScrn); -extern void i830WaitSync(ScrnInfoPtr pScrn); - /* i830_memory.c */ Bool i830_bind_all_memory(ScrnInfoPtr pScrn); Bool i830_unbind_all_memory(ScrnInfoPtr pScrn); unsigned long i830_get_fence_size(I830Ptr pI830, unsigned long size); unsigned long i830_get_fence_pitch(I830Ptr pI830, unsigned long pitch, int format); -unsigned long i830_get_fence_alignment(I830Ptr pI830, unsigned long size); Bool I830BindAGPMemory(ScrnInfoPtr pScrn); Bool I830UnbindAGPMemory(ScrnInfoPtr pScrn); @@ -967,10 +821,6 @@ i830_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform, void i830_enter_render(ScrnInfoPtr); -#ifndef SERVER_1_5 -Bool xf86MonitorIsHDMI(xf86MonPtr mon); -#endif - static inline void i830_wait_ring_idle(ScrnInfoPtr pScrn) { @@ -986,10 +836,12 @@ static inline int i830_fb_compression_supported(I830Ptr pI830) return FALSE; if (IS_I810(pI830) || IS_I815(pI830) || IS_I830(pI830)) return FALSE; + if (IS_IGD(pI830)) + return FALSE; /* fbc depends on tiled surface. And we don't support tiled - * front buffer with XAA now. + * front buffer with unaccelerated. */ - if (!pI830->tiling || (IS_I965G(pI830) && pI830->accel <= ACCEL_XAA)) + if (!pI830->tiling || (IS_I965G(pI830) && pI830->accel == ACCEL_NONE)) 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 @@ -1005,7 +857,7 @@ static inline int i830_fb_compression_supported(I830Ptr pI830) do { \ if (I830PTR(pScrn)->fallback_debug) { \ xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ - "EXA fallback: " s "\n", ##arg); \ + "fallback: " s "\n", ##arg); \ } \ return FALSE; \ } while(0) @@ -1093,4 +945,14 @@ enum { INTEL_CREATE_PIXMAP_TILING_Y, }; +#if (ALWAYS_FLUSH | ALWAYS_SYNC) +void +i830_debug_sync(ScrnInfoPtr scrn); +#else +static inline void +i830_debug_sync(ScrnInfoPtr scrn) +{ +} +#endif + #endif /* _I830_H_ */ diff --git a/src/i830_accel.c b/src/i830_accel.c index 9f5bcb55..589f86de 100644 --- a/src/i830_accel.c +++ b/src/i830_accel.c @@ -57,7 +57,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <errno.h> #include "xf86.h" -#include "xaarop.h" #include "i830.h" #include "i810_reg.h" #include "i830_debug.h" @@ -67,28 +66,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. unsigned long intel_get_pixmap_offset(PixmapPtr pPix) { -#if defined(I830_USE_EXA) || defined(I830_USE_UXA) ScreenPtr pScreen = pPix->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - if (pI830->accel == ACCEL_EXA) - return exaGetPixmapOffset(pPix); -#endif return (unsigned long)pPix->devPrivate.ptr - (unsigned long)pI830->FbBase; } unsigned long intel_get_pixmap_pitch(PixmapPtr pPix) { -#ifdef I830_USE_EXA - ScreenPtr pScreen = pPix->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - - if (pI830->accel == ACCEL_EXA) - return exaGetPixmapPitch(pPix); -#endif return (unsigned long)pPix->devKind; } @@ -137,21 +124,7 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) else i830_dump_error_state(pScrn); ErrorF("space: %d wanted %d\n", ring->space, n); -#ifdef XF86DRI - if (pI830->directRenderingType == DRI_XF86DRI) { - DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); - DRICloseScreen(screenInfo.screens[pScrn->scrnIndex]); - } -#endif -#ifdef I830_USE_XAA - pI830->AccelInfoRec = NULL; /* Stops recursive behavior */ -#endif -#ifdef I830_USE_EXA - pI830->EXADriverPtr = NULL; -#endif -#ifdef I830_USE_UXA - pI830->uxa_driver = NULL; -#endif + pI830->uxa_driver = NULL; FatalError("lockup\n"); } @@ -177,52 +150,13 @@ I830Sync(ScrnInfoPtr pScrn) if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC)) ErrorF("I830Sync\n"); - if (pI830->accel == ACCEL_NONE) + if (pI830->accel == ACCEL_NONE || !pScrn->vtSema || !pI830->batch_bo) return; -#ifdef XF86DRI - /* VT switching tries to do this. - */ - if (!pI830->LockHeld && pI830->directRenderingType == DRI_XF86DRI) { - return; - } -#endif - I830EmitFlush(pScrn); intel_batch_flush(pScrn, TRUE); - - if (pI830->directRenderingType > DRI_NONE) { - struct drm_i915_irq_emit emit; - struct drm_i915_irq_wait wait; - int ret; - - /* Most of the uses of I830Sync while using GEM should actually be - * using set_domain on a specific buffer. We're not there yet, so fake - * it up using irq_emit/wait. It's still better than spinning on - * register reads for idle. - */ - emit.irq_seq = &wait.irq_seq; - ret = drmCommandWriteRead(pI830->drmSubFD, DRM_I830_IRQ_EMIT, &emit, - sizeof(emit)); - if (ret != 0) - FatalError("Failure to emit IRQ: %s\n", strerror(-ret)); - - do { - ret = drmCommandWrite(pI830->drmSubFD, DRM_I830_IRQ_WAIT, &wait, - sizeof(wait)); - } while (ret == -EINTR); - - if (ret != 0) - FatalError("Failure to wait for IRQ: %s\n", strerror(-ret)); - - if (!pI830->memory_manager) - i830_refresh_ring(pScrn); - } else if (!pI830->use_drm_mode) { - i830_wait_ring_idle(pScrn); - } - - pI830->nextColorExpandBuf = 0; + intel_batch_wait_last(pScrn); } void @@ -241,35 +175,17 @@ I830EmitFlush(ScrnInfoPtr pScrn) } } -Bool -I830SelectBuffer(ScrnInfoPtr pScrn, int buffer) -{ - I830Ptr pI830 = I830PTR(pScrn); - - switch (buffer) { -#ifdef XF86DRI - case I830_SELECT_BACK: - pI830->bufferOffset = pI830->back_buffer->offset; - if (pI830->back_buffer->tiling == TILE_YMAJOR) - return FALSE; - break; - case I830_SELECT_DEPTH: - pI830->bufferOffset = pI830->depth_buffer->offset; - if (pI830->depth_buffer->tiling == TILE_YMAJOR) - return FALSE; - break; -#endif - default: - case I830_SELECT_FRONT: - pI830->bufferOffset = pScrn->fbOffset; - break; - } - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SelectBuffer %d --> offset %x\n", - buffer, pI830->bufferOffset); - return TRUE; +#if (ALWAYS_SYNC || ALWAYS_FLUSH) +void +i830_debug_sync(ScrnInfoPtr scrn) +{ + if (ALWAYS_SYNC) + I830Sync(scrn); + else + intel_batch_flush(scrn, FALSE); } +#endif /* The following function sets up the supported acceleration. Call it * from the FbInit() function in the SVGA driver, or before ScreenInit @@ -317,7 +233,7 @@ I830AccelInit(ScreenPtr pScreen) * * For the tiled issues, the only tiled buffer we draw to should be * the front, which will have an appropriate pitch/offset already set up, - * so EXA doesn't need to worry. + * so UXA doesn't need to worry. */ if (IS_I965G(pI830)) { pI830->accel_pixmap_offset_alignment = 4 * 2; @@ -336,21 +252,7 @@ I830AccelInit(ScreenPtr pScreen) switch (pI830->accel) { 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: - return I830EXAInit(pScreen); -#endif -#ifdef I830_USE_XAA - case ACCEL_XAA: - return I830XAAInit(pScreen); -#endif case ACCEL_UNINIT: case ACCEL_NONE: break; diff --git a/src/i830_batchbuffer.c b/src/i830_batchbuffer.c index ff5f0c21..5a9f9c5c 100644 --- a/src/i830_batchbuffer.c +++ b/src/i830_batchbuffer.c @@ -159,8 +159,13 @@ intel_batch_teardown(ScrnInfoPtr pScrn) if (pI830->batch_ptr != NULL) { dri_bo_unmap(pI830->batch_bo); - dri_bo_unreference(pI830->batch_bo); pI830->batch_ptr = NULL; + + dri_bo_unreference(pI830->batch_bo); + pI830->batch_bo = NULL; + + dri_bo_unreference(pI830->last_batch_bo); + pI830->last_batch_bo = NULL; } } @@ -201,7 +206,13 @@ intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed) if (ret != 0) FatalError("Failed to submit batchbuffer: %s\n", strerror(-ret)); - dri_bo_unreference(pI830->batch_bo); + /* Save a ref to the last batch emitted, which we use for syncing + * in debug code. + */ + dri_bo_unreference(pI830->last_batch_bo); + pI830->last_batch_bo = pI830->batch_bo; + pI830->batch_bo = NULL; + intel_next_batch(pScrn); /* Mark that we need to flush whatever potential rendering we've done in the @@ -214,3 +225,17 @@ intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed) if (pI830->batch_flush_notify) pI830->batch_flush_notify (pScrn); } + +/** Waits on the last emitted batchbuffer to be completed. */ +void +intel_batch_wait_last(ScrnInfoPtr scrn) +{ + I830Ptr pI830 = I830PTR(scrn); + + /* Map it CPU write, which guarantees it's done. This is a completely + * non performance path, so we don't need anything better. + */ + drm_intel_bo_map(pI830->last_batch_bo, TRUE); + drm_intel_bo_unmap(pI830->last_batch_bo); +} + diff --git a/src/i830_batchbuffer.h b/src/i830_batchbuffer.h index a72786e5..6e0aaa79 100644 --- a/src/i830_batchbuffer.h +++ b/src/i830_batchbuffer.h @@ -35,6 +35,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void intel_batch_init(ScrnInfoPtr pScrn); void intel_batch_teardown(ScrnInfoPtr pScrn); void intel_batch_flush(ScrnInfoPtr pScrn, Bool flushed); +void intel_batch_wait_last(ScrnInfoPtr pScrn); static inline int intel_batch_space(I830Ptr pI830) @@ -100,21 +101,10 @@ intel_batch_emit_reloc_pixmap(I830Ptr pI830, PixmapPtr pPixmap, uint32_t read_domains, uint32_t write_domain, uint32_t delta) { -#if I830_USE_UXA || I830_USE_EXA dri_bo *bo = i830_get_pixmap_bo(pPixmap); -#endif - uint32_t offset; assert(pI830->batch_ptr != NULL); assert(intel_batch_space(pI830) >= 4); -#if I830_USE_UXA || I830_USE_EXA - if (bo) { - intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta); - return; - } -#endif - offset = intel_get_pixmap_offset(pPixmap); - *(uint32_t *)(pI830->batch_ptr + pI830->batch_used) = offset + delta; - pI830->batch_used += 4; + intel_batch_emit_reloc(pI830, bo, read_domains, write_domain, delta); } #define OUT_BATCH(dword) intel_batch_emit_dword(pI830, dword) diff --git a/src/i830_bios.c b/src/i830_bios.c index 4f2355de..7c51f384 100644 --- a/src/i830_bios.c +++ b/src/i830_bios.c @@ -218,7 +218,6 @@ i830_bios_init(ScrnInfoPtr pScrn) int ret; int size; -#if XSERVER_LIBPCIACCESS size = pI830->PciInfo->rom_size; if (size == 0) { size = INTEL_VBIOS_SIZE; @@ -226,14 +225,10 @@ i830_bios_init(ScrnInfoPtr pScrn) "libpciaccess reported 0 rom size, guessing %dkB\n", size / 1024); } -#else - size = INTEL_VBIOS_SIZE; -#endif bios = xalloc(size); if (bios == NULL) return -1; -#if XSERVER_LIBPCIACCESS ret = pci_device_read_rom (pI830->PciInfo, bios); if (ret != 0) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -242,14 +237,6 @@ i830_bios_init(ScrnInfoPtr pScrn) xfree (bios); return -1; } -#else - /* xf86ReadPciBIOS returns the length read */ - ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size); - if (ret <= 0) { - xfree (bios); - return -1; - } -#endif vbt_off = INTEL_BIOS_16(0x1a); if (vbt_off >= size) { diff --git a/src/i830_cursor.c b/src/i830_cursor.c index 43a65cb9..e1cf0bf6 100644 --- a/src/i830_cursor.c +++ b/src/i830_cursor.c @@ -136,19 +136,6 @@ I830CursorInit(ScreenPtr pScreen) HARDWARE_CURSOR_ARGB)); } -void -i830_crtc_load_cursor_image (xf86CrtcPtr crtc, unsigned char *src) -{ - I830Ptr pI830 = I830PTR(crtc->scrn); - I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - uint8_t *pcurs; - - pcurs = pI830->FbBase + intel_crtc->cursor_offset; - - intel_crtc->cursor_is_argb = FALSE; - memcpy (pcurs, src, I810_CURSOR_X * I810_CURSOR_Y / 4); -} - #ifdef ARGB_CURSOR void i830_crtc_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image) diff --git a/src/i830_display.c b/src/i830_display.c index fe689a43..33e293b9 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -265,6 +265,8 @@ intel_find_pll_i8xx_and_i9xx(const intel_limit_t *, xf86CrtcPtr, static Bool intel_find_pll_g4x(const intel_limit_t *, xf86CrtcPtr, int, int, intel_clock_t *); +static void +i830_crtc_load_lut(xf86CrtcPtr crtc); static Bool intel_find_pll_g4x_dp(const intel_limit_t *, xf86CrtcPtr, @@ -773,7 +775,6 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y) ScrnInfoPtr pScrn = crtc->scrn; I830Ptr pI830 = I830PTR(pScrn); I830CrtcPrivatePtr intel_crtc = crtc->driver_private; - int pipe = intel_crtc->pipe; int plane = intel_crtc->plane; unsigned long Start, Offset, Stride; int dspbase = (plane == 0 ? DSPABASE : DSPBBASE); @@ -812,30 +813,6 @@ i830PipeSetBase(xf86CrtcPtr crtc, int x, int y) OUTREG(dspbase, Start + Offset); POSTING_READ(dspbase); } - -#ifdef XF86DRI - if (pI830->directRenderingType == DRI_XF86DRI) { - drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen); - - if (!sPriv) - return; - - switch (pipe) { - case 0: - sPriv->pipeA_x = x; - sPriv->pipeA_y = y; - break; - case 1: - sPriv->pipeB_x = x; - sPriv->pipeB_y = y; - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Can't update pipe %d in SAREA\n", pipe); - break; - } - } -#endif } /* @@ -1137,7 +1114,7 @@ i830_use_fb_compression(xf86CrtcPtr crtc) return TRUE; } -#if defined(DRM_IOCTL_MODESET_CTL) && (defined(XF86DRI) || defined(DRI2)) +#if defined(DRM_IOCTL_MODESET_CTL) static void i830_modeset_ctl(xf86CrtcPtr crtc, int pre) { ScrnInfoPtr pScrn = crtc->scrn; @@ -1169,7 +1146,7 @@ static void i830_modeset_ctl(xf86CrtcPtr crtc, int dpms_state) { return; } -#endif /* DRM_IOCTL_MODESET_CTL && (XF86DRI || DRI2) */ +#endif /* DRM_IOCTL_MODESET_CTL */ static void i830_disable_vga_plane (xf86CrtcPtr crtc) @@ -1201,7 +1178,7 @@ i830_disable_vga_plane (xf86CrtcPtr crtc) } -void +static void i830_crtc_enable(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; @@ -1361,54 +1338,22 @@ i830_crtc_dpms(xf86CrtcPtr crtc, int mode) } intel_crtc->dpms_mode = mode; - -#ifdef XF86DRI - if (pI830->directRenderingType == DRI_XF86DRI) { - drmI830Sarea *sPriv = (drmI830Sarea *) DRIGetSAREAPrivate(pScrn->pScreen); - Bool enabled = crtc->enabled && mode != DPMSModeOff; - - I830DRISetVBlankInterrupt (pScrn, TRUE); - - if (!sPriv) - return; - - switch (pipe) { - case 0: - sPriv->pipeA_w = enabled ? crtc->mode.HDisplay : 0; - sPriv->pipeA_h = enabled ? crtc->mode.VDisplay : 0; - break; - case 1: - sPriv->pipeB_w = enabled ? crtc->mode.HDisplay : 0; - sPriv->pipeB_h = enabled ? crtc->mode.VDisplay : 0; - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Can't update pipe %d in SAREA\n", pipe); - break; - } - } -#endif } static Bool i830_crtc_lock (xf86CrtcPtr crtc) { - /* Sync the engine before mode switch */ - i830WaitSync(crtc->scrn); + /* Sync the engine before mode switch, to finish any outstanding + * WAIT_FOR_EVENTS that may rely on CRTC state. + */ + I830Sync(crtc->scrn); -#ifdef XF86DRI - return I830DRILock(crtc->scrn); -#else return FALSE; -#endif } static void i830_crtc_unlock (xf86CrtcPtr crtc) { -#ifdef XF86DRI - I830DRIUnlock (crtc->scrn); -#endif } static void @@ -1443,11 +1388,6 @@ i830_crtc_commit (xf86CrtcPtr crtc) /* Reenable FB compression if possible */ if (i830_use_fb_compression(crtc)) i830_enable_fb_compression(crtc); - -#ifdef XF86DRI - /* Tell DRI1 the news about new output config */ - i830_update_dri_buffers(crtc->scrn); -#endif } void @@ -1487,11 +1427,7 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn) else if (IS_I915GM(pI830)) { uint16_t gcfgc; -#if XSERVER_LIBPCIACCESS pci_device_cfg_read_u16 (pI830->PciInfo, &gcfgc, I915_GCFGC); -#else - gcfgc = pciReadWord(pI830->PciTag, I915_GCFGC); -#endif if (gcfgc & I915_LOW_FREQUENCY_ENABLE) return 133000; else { @@ -1506,14 +1442,9 @@ i830_get_core_clock_speed(ScrnInfoPtr pScrn) } else if (IS_I865G(pI830)) return 266000; else if (IS_I855(pI830)) { -#if XSERVER_LIBPCIACCESS struct pci_device *bridge = intel_host_bridge (); uint16_t hpllcc; pci_device_cfg_read_u16 (bridge, &hpllcc, I855_HPLLCC); -#else - PCITAG bridge = pciTag(0, 0, 0); /* This is always the host bridge */ - uint16_t hpllcc = pciReadWord(bridge, I855_HPLLCC); -#endif /* Assume that the hardware is in the high speed state. This * should be the default. @@ -2006,16 +1937,13 @@ i830_crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, OUTREG(dspcntr_reg, dspcntr); /* Flush the plane changes */ i830PipeSetBase(crtc, x, y); -#ifdef XF86DRI - I830DRISetVBlankInterrupt (pScrn, TRUE); -#endif - + i830WaitForVblank(pScrn); } /** Loads the palette/gamma unit for the CRTC with the prepared values */ -void +static void i830_crtc_load_lut(xf86CrtcPtr crtc) { ScrnInfoPtr pScrn = crtc->scrn; @@ -2489,7 +2417,6 @@ static const xf86CrtcFuncsRec i830_crtc_funcs = { .set_cursor_position = i830_crtc_set_cursor_position, .show_cursor = i830_crtc_show_cursor, .hide_cursor = i830_crtc_hide_cursor, -/* .load_cursor_image = i830_crtc_load_cursor_image, */ .load_cursor_argb = i830_crtc_load_cursor_argb, .destroy = NULL, /* XXX */ #if RANDR_13_INTERFACE diff --git a/src/i830_display.h b/src/i830_display.h index 0ba196d3..24a2717a 100644 --- a/src/i830_display.h +++ b/src/i830_display.h @@ -33,12 +33,10 @@ void i830WaitForVblank(ScrnInfoPtr pScrn); void i830DescribeOutputConfiguration(ScrnInfoPtr pScrn); void i830_set_new_crtc_bo(ScrnInfoPtr pScrn); void i830_crtc_disable(xf86CrtcPtr crtc, Bool disable_pipe); -void i830_crtc_enable(xf86CrtcPtr crtc); xf86CrtcPtr i830GetLoadDetectPipe(xf86OutputPtr output, DisplayModePtr mode, int *dpms_mode); void i830ReleaseLoadDetectPipe(xf86OutputPtr output, int dpms_mode); void i830_crtc_init(ScrnInfoPtr pScrn, int pipe); -void i830_crtc_load_lut(xf86CrtcPtr crtc); DisplayModePtr i830_crtc_mode_get(ScrnInfoPtr pScrn, xf86CrtcPtr crtc); void i830_output_prepare (xf86OutputPtr output); void i830_output_commit (xf86OutputPtr output); diff --git a/src/i830_dri.c b/src/i830_dri.c index 6a324929..743521cd 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -89,1448 +89,22 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i915_drm.h" -#include "dristruct.h" - -#ifdef DRI2 #include "dri2.h" -#endif - -static Bool I830InitVisualConfigs(ScreenPtr pScreen); -static Bool I830CreateContext(ScreenPtr pScreen, VisualPtr visual, - drm_context_t hwContext, void *pVisualConfigPriv, - DRIContextType contextStore); -static void I830DestroyContext(ScreenPtr pScreen, drm_context_t hwContext, - DRIContextType contextStore); -static void I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, - void *readContextStore, - DRIContextType writeContextType, - void *writeContextStore); -static void I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -static void I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); - -static void I830DRITransitionTo2d(ScreenPtr pScreen); -static void I830DRITransitionTo3d(ScreenPtr pScreen); - -#if (DRIINFO_MAJOR_VERSION > 5 || \ - (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 4)) -#define DRI_DRIVER_FRAMEBUFFER_MAP 1 -#else -#define DRI_DRIVER_FRAMEBUFFER_MAP 0 -#endif - -extern void GlxSetVisualConfigs(int nconfigs, - __GLXvisualConfig * configs, - void **configprivs); - -static Bool -I830CleanupDma(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - drmI830Init info; - - memset(&info, 0, sizeof(drmI830Init)); - info.func = I830_CLEANUP_DMA; - - if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT, - &info, sizeof(drmI830Init))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Dma Cleanup Failed\n"); - return FALSE; - } - - return TRUE; -} - -static Bool -I830InitDma(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - I830RingBuffer *ring = &pI830->ring; - I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate; - drmI830Init info; - - memset(&info, 0, sizeof(drmI830Init)); - info.func = I830_INIT_DMA; - - /* Initialize fields that are used in the absence of GEM */ - if (!pI830->memory_manager && !pI830->use_drm_mode) { - info.ring_start = ring->mem->offset + pI830->LinearAddr; - info.ring_end = ring->mem->end + pI830->LinearAddr; - info.ring_size = ring->mem->size; - - /* Not used as of the middle of GEM development. */ - info.mmio_offset = (unsigned int)pI830DRI->regs; - - /* Not used as of before GEM development */ - info.front_offset = pI830->front_buffer->offset; - info.back_offset = pI830->back_buffer->offset; - info.depth_offset = pI830->depth_buffer->offset; - info.pitch = pScrn->displayWidth; - info.back_pitch = pScrn->displayWidth; - info.depth_pitch = pScrn->displayWidth; - info.w = pScrn->virtualX; - info.h = pScrn->virtualY; - } - - - info.sarea_priv_offset = sizeof(XF86DRISAREARec); - - /* This should probably have been moved alongside offset/pitch in the sarea. - */ - info.cpp = pI830->cpp; - - if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT, - &info, sizeof(drmI830Init))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "I830 Dma Initialization Failed\n"); - return FALSE; - } - - return TRUE; -} - -static Bool -I830ResumeDma(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - drmI830Init info; - - memset(&info, 0, sizeof(drmI830Init)); - info.func = I830_RESUME_DMA; - - if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT, - &info, sizeof(drmI830Init))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 Dma Resume Failed\n"); - return FALSE; - } - - return TRUE; -} - -static Bool -I830SetParam(ScrnInfoPtr pScrn, int param, int value) -{ - I830Ptr pI830 = I830PTR(pScrn); - drmI830SetParam sp; - - memset(&sp, 0, sizeof(sp)); - sp.param = param; - sp.value = value; - - if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SETPARAM, &sp, sizeof(sp))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830 SetParam Failed\n"); - return FALSE; - } - - return TRUE; -} - -Bool -I830DRISetHWS(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - drmI830HWS hws; - - hws.addr = pI830->hw_status->offset; - - if (drmCommandWrite(pI830->drmSubFD, DRM_I830_HWS_PAGE_ADDR, - &hws, sizeof(drmI830HWS))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "hw status page initialization Failed\n"); - return FALSE; - } - return TRUE; -} - -static Bool -I830InitVisualConfigs(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - int numConfigs = 0; - __GLXvisualConfig *pConfigs = NULL; - I830ConfigPrivPtr pI830Configs = NULL; - I830ConfigPrivPtr *pI830ConfigPtrs = NULL; - int accum, stencil, db, depth; - int i; - - switch (pScrn->bitsPerPixel) { - case 8: - case 24: - break; - - case 16: - numConfigs = 8; - - pConfigs = - (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), - numConfigs); - if (!pConfigs) - return FALSE; - - pI830Configs = - (I830ConfigPrivPtr) xcalloc(sizeof(I830ConfigPrivRec), - numConfigs); - if (!pI830Configs) { - xfree(pConfigs); - return FALSE; - } - - pI830ConfigPtrs = - (I830ConfigPrivPtr *) xcalloc(sizeof(I830ConfigPrivPtr), - numConfigs); - if (!pI830ConfigPtrs) { - xfree(pConfigs); - xfree(pI830Configs); - return FALSE; - } - - for (i = 0; i < numConfigs; i++) - pI830ConfigPtrs[i] = &pI830Configs[i]; - - i = 0; - depth = 1; - for (accum = 0; accum <= 1; accum++) { - for (stencil = 0; stencil <= 1; stencil++) { - for (db = 1; db >= 0; db--) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 5; - pConfigs[i].greenSize = 6; - pConfigs[i].blueSize = 5; - pConfigs[i].alphaSize = 0; - pConfigs[i].redMask = 0x0000F800; - pConfigs[i].greenMask = 0x000007E0; - pConfigs[i].blueMask = 0x0000001F; - pConfigs[i].alphaMask = 0; - if (accum) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 0; - } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; - } - pConfigs[i].doubleBuffer = db ? TRUE : FALSE; - pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 16; - if (depth) - pConfigs[i].depthSize = 16; - else - pConfigs[i].depthSize = 0; - if (stencil) - pConfigs[i].stencilSize = 8; - else - pConfigs[i].stencilSize = 0; - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if (stencil || accum) - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - else - pConfigs[i].visualRating = GLX_NONE_EXT; - pConfigs[i].transparentPixel = GLX_NONE_EXT; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; - i++; - } - } - } - assert(i == numConfigs); - break; - - case 32: - numConfigs = 8; - - pConfigs = (__GLXvisualConfig *) xcalloc(sizeof(__GLXvisualConfig), - numConfigs); - if (!pConfigs) { - return FALSE; - } - - pI830Configs = (I830ConfigPrivPtr) xcalloc(sizeof(I830ConfigPrivRec), - numConfigs); - if (!pI830Configs) { - xfree(pConfigs); - return FALSE; - } - - pI830ConfigPtrs = (I830ConfigPrivPtr *) - xcalloc(sizeof(I830ConfigPrivPtr), numConfigs); - if (!pI830ConfigPtrs) { - xfree(pConfigs); - xfree(pI830Configs); - return FALSE; - } - - for (i = 0; i < numConfigs; i++) { - pI830ConfigPtrs[i] = &pI830Configs[i]; - } - - i = 0; - for (accum = 0; accum <= 1; accum++) { - for (depth = 1; depth >= 0; depth--) { /* and stencil */ - for (db = 1; db >= 0; db--) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 8; - pConfigs[i].greenSize = 8; - pConfigs[i].blueSize = 8; - pConfigs[i].alphaSize = 8; - pConfigs[i].redMask = 0x00FF0000; - pConfigs[i].greenMask = 0x0000FF00; - pConfigs[i].blueMask = 0x000000FF; - pConfigs[i].alphaMask = 0xFF000000; - if (accum) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 16; - } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; - } - if (db) { - pConfigs[i].doubleBuffer = TRUE; - } else { - pConfigs[i].doubleBuffer = FALSE; - } - pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 32; - if (depth) { - pConfigs[i].depthSize = 24; - pConfigs[i].stencilSize = 8; - } else { - pConfigs[i].depthSize = 0; - pConfigs[i].stencilSize = 0; - } - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if (accum) { - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - } else { - pConfigs[i].visualRating = GLX_NONE_EXT; - } - pConfigs[i].transparentPixel = GLX_NONE_EXT; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; - i++; - } - } - } - if (i != numConfigs) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Incorrect initialization of visuals\n"); - return FALSE; - } - break; - - } - pI830->numVisualConfigs = numConfigs; - pI830->pVisualConfigs = pConfigs; - pI830->pVisualConfigsPriv = pI830Configs; - GlxSetVisualConfigs(numConfigs, pConfigs, (void **)pI830ConfigPtrs); - return TRUE; -} - -Bool -I830CheckDRIAvailable(ScrnInfoPtr pScrn) -{ - /* Hardware 3D rendering only implemented for 16bpp and 32 bpp */ - if (((pScrn->bitsPerPixel / 8) != 2 && pScrn->depth != 16) && - (pScrn->bitsPerPixel / 8) != 4) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Direct rendering only supported in 16 and 32 bpp modes\n"); - return FALSE; - } - - /* Check that the GLX, DRI, and DRM modules have been loaded by testing - * for known symbols in each module. */ - if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[dri] %s failed: glx not loaded\n", __FUNCTION__); - return FALSE; - } - if (!xf86LoaderCheckSymbol("DRIScreenInit")) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[dri] %s failed: dri not loaded\n", __FUNCTION__); - return FALSE; - } - if (!xf86LoaderCheckSymbol("drmAvailable")) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[dri] %s failed: libdrm not loaded\n", __FUNCTION__); - return FALSE; - } - if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[dri] %s failed (libdri.a too old)\n", __FUNCTION__); - return FALSE; - } - - /* Check the DRI version */ - { - int major, minor, patch; - - DRIQueryVersion(&major, &minor, &patch); - if (major != DRIINFO_MAJOR_VERSION || minor < DRIINFO_MINOR_VERSION || - major < 5) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[dri] %s failed because of a version mismatch.\n" - "[dri] libDRI version is %d.%d.%d but version %d.%d.x is needed.\n" - "[dri] Disabling DRI.\n", - "I830CheckDRIAvailable", major, minor, patch, - DRIINFO_MAJOR_VERSION, DRIINFO_MINOR_VERSION); - return FALSE; - } - } - - return TRUE; -} - -Bool -I830DRIScreenInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - DRIInfoPtr pDRIInfo; - I830DRIPtr pI830DRI; - - DPRINTF(PFX, "I830DRIScreenInit\n"); - - if (!I830CheckDRIAvailable(pScrn)) - return FALSE; - - pDRIInfo = DRICreateInfoRec(); - if (!pDRIInfo) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] DRICreateInfoRec failed. Disabling DRI.\n"); - return FALSE; - } - - pI830->pDRIInfo = pDRIInfo; - pI830->LockHeld = 0; - - pDRIInfo->drmDriverName = "i915"; - if (IS_I965G(pI830)) - pDRIInfo->clientDriverName = "i965"; - else - pDRIInfo->clientDriverName = "i915"; - - if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) { - pDRIInfo->busIdString = DRICreatePCIBusID(pI830->PciInfo); - } else { - pDRIInfo->busIdString = xalloc(64); - sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", -#if XSERVER_LIBPCIACCESS - ((pI830->PciInfo->domain << 8) | pI830->PciInfo->bus), - pI830->PciInfo->dev, pI830->PciInfo->func -#else - ((pciConfigPtr) pI830->PciInfo->thisCard)->busnum, - ((pciConfigPtr) pI830->PciInfo->thisCard)->devnum, - ((pciConfigPtr) pI830->PciInfo->thisCard)->funcnum -#endif - ); - } - pDRIInfo->ddxDriverMajorVersion = I830_MAJOR_VERSION; - pDRIInfo->ddxDriverMinorVersion = I830_MINOR_VERSION; - pDRIInfo->ddxDriverPatchVersion = I830_PATCHLEVEL; - pDRIInfo->ddxDrawableTableEntry = I830_MAX_DRAWABLES; - - if (SAREA_MAX_DRAWABLES < I830_MAX_DRAWABLES) - pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; - else - pDRIInfo->maxDrawableTableEntry = I830_MAX_DRAWABLES; - - if (sizeof(XF86DRISAREARec) + sizeof(drmI830Sarea) > SAREA_MAX) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] Data does not fit in SAREA\n"); - return FALSE; - } - /* This is a hack for now. We have to have more than a 4k page here - * because of the size of the state. However, the state should be - * in a per-context mapping. This will be added in the Mesa 3.5 port - * of the I830 driver. - */ - pDRIInfo->SAREASize = SAREA_MAX; - - if (!(pI830DRI = (I830DRIPtr) xcalloc(sizeof(I830DRIRec), 1))) { - DRIDestroyInfoRec(pI830->pDRIInfo); - pI830->pDRIInfo = NULL; - return FALSE; - } - pDRIInfo->devPrivate = pI830DRI; - pDRIInfo->devPrivateSize = sizeof(I830DRIRec); - pDRIInfo->contextSize = sizeof(I830DRIContextRec); - - pDRIInfo->CreateContext = I830CreateContext; - pDRIInfo->DestroyContext = I830DestroyContext; - pDRIInfo->SwapContext = I830DRISwapContext; - pDRIInfo->InitBuffers = I830DRIInitBuffers; - pDRIInfo->MoveBuffers = I830DRIMoveBuffers; - pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - -#if DRIINFO_MAJOR_VERSION > 5 || \ - (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 3) - if (pI830->accel == ACCEL_EXA) - pDRIInfo->texOffsetStart = I830TexOffsetStart; -#endif - -#if DRI_DRIVER_FRAMEBUFFER_MAP - /* DRI version is high enough that we can get the DRI code to not - * try to manage the framebuffer. - */ - pDRIInfo->frameBufferPhysicalAddress = 0; - pDRIInfo->frameBufferSize = 0; - pDRIInfo->frameBufferStride = 0; - pDRIInfo->dontMapFrameBuffer = TRUE; -#else - /* Supply a dummy mapping info required by DRI setup. - */ - pDRIInfo->frameBufferPhysicalAddress = (char *) pI830->LinearAddr; - pDRIInfo->frameBufferSize = GTT_PAGE_SIZE; - pDRIInfo->frameBufferStride = 1; -#endif - - pDRIInfo->TransitionTo2d = I830DRITransitionTo2d; - pDRIInfo->TransitionTo3d = I830DRITransitionTo3d; - - /* do driver-independent DRI screen initialization here */ - if (!DRIScreenInit(pScreen, pDRIInfo, &pI830->drmSubFD)) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] DRIScreenInit failed. Disabling DRI.\n"); - xfree(pDRIInfo->devPrivate); - pDRIInfo->devPrivate = NULL; - DRIDestroyInfoRec(pI830->pDRIInfo); - pI830->pDRIInfo = NULL; - return FALSE; - } - - /* Now, nuke dri.c's dummy frontbuffer map setup if we did that. */ - if (pDRIInfo->frameBufferSize != 0) { - int tmp; - drm_handle_t fb_handle; - void *ptmp; - - /* With the compat method, it will continue to report - * the wrong map out of GetDeviceInfo, which will break AIGLX. - */ - DRIGetDeviceInfo(pScreen, &fb_handle, &tmp, &tmp, &tmp, &tmp, &ptmp); - drmRmMap(pI830->drmSubFD, fb_handle); - - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Removed DRI frontbuffer mapping in compatibility mode.\n"); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "DRIGetDeviceInfo will report incorrect frontbuffer " - "handle.\n"); - } - - /* Check the i915 DRM versioning */ - { - drmVersionPtr version; - - /* Check the DRM lib version. - * drmGetLibVersion was not supported in version 1.0, so check for - * symbol first to avoid possible crash or hang. - */ - if (xf86LoaderCheckSymbol("drmGetLibVersion")) { - version = drmGetLibVersion(pI830->drmSubFD); - } else - { - /* drmlib version 1.0.0 didn't have the drmGetLibVersion - * entry point. Fake it by allocating a version record - * via drmGetVersion and changing it to version 1.0.0 - */ - version = drmGetVersion(pI830->drmSubFD); - version->version_major = 1; - version->version_minor = 0; - version->version_patchlevel = 0; - } - -#define REQ_MAJ 1 -#define REQ_MIN 1 - if (version) { - if (version->version_major != REQ_MAJ || - version->version_minor < REQ_MIN) { - /* incompatible drm library version */ - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] I830DRIScreenInit failed because of a version mismatch.\n" - "[dri] libdrm.a module version is %d.%d.%d but version %d.%d.x is needed.\n" - "[dri] Disabling DRI.\n", - version->version_major, - version->version_minor, version->version_patchlevel, - REQ_MAJ, REQ_MIN); - drmFreeVersion(version); - I830DRICloseScreen(pScreen); - return FALSE; - } - drmFreeVersion(version); - } - - /* Check the i915 DRM version */ - version = drmGetVersion(pI830->drmSubFD); - if (version) { - if (version->version_major != 1 || version->version_minor < 3) { - /* incompatible drm version */ - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] %s failed because of a version mismatch.\n" - "[dri] i915 kernel module version is %d.%d.%d but version 1.3 or greater is needed.\n" - "[dri] Disabling DRI.\n", - "I830DRIScreenInit", - version->version_major, - version->version_minor, version->version_patchlevel); - I830DRICloseScreen(pScreen); - drmFreeVersion(version); - return FALSE; - } - /* Check whether the kernel module attached to the device isn't the - * one we expected (meaning it's the old i830 module). - */ - if (strncmp(version->name, pDRIInfo->drmDriverName, - strlen(pDRIInfo->drmDriverName))) - { - xf86DrvMsg(pScreen->myNum, X_WARNING, - "Detected i830 kernel module. The i915 kernel module " - "is required for DRI. Aborting.\n"); - I830DRICloseScreen(pScreen); - drmFreeVersion(version); - return FALSE; - } - pI830->drmMinor = version->version_minor; - drmFreeVersion(version); - } - } - - return TRUE; -} - -static void -I830InitTextureHeap(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - drmI830MemInitHeap drmHeap; - - if (pI830->textures == NULL) - return; - - /* Start up the simple memory manager for agp space */ - drmHeap.region = I830_MEM_REGION_AGP; - drmHeap.start = 0; - drmHeap.size = pI830->textures->size; - - if (drmCommandWrite(pI830->drmSubFD, DRM_I830_INIT_HEAP, - &drmHeap, sizeof(drmHeap))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Failed to initialized agp heap manager\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] Initialized kernel agp heap manager, %ld\n", - pI830->textures->size); - - I830SetParam(pScrn, I830_SETPARAM_TEX_LRU_LOG_GRANULARITY, - pI830->TexGranularity); - } -} - -/* - * Map registers & ring buffer - */ -static Bool -I830DRIMapHW(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - DRIInfoPtr pDRIInfo = pI830->pDRIInfo; - I830DRIPtr pI830DRI = pDRIInfo->devPrivate; - - /* Kernel deals with direct hw access in this case */ - if (pI830->use_drm_mode) - return TRUE; - - DPRINTF(PFX, "I830DRIMapHW\n"); - pI830DRI->regsSize = I830_REG_SIZE; - if (drmAddMap(pI830->drmSubFD, (drm_handle_t)pI830->MMIOAddr, - pI830DRI->regsSize, DRM_REGISTERS, 0, - (drmAddress) &pI830DRI->regs) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n"); - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08x\n", - (int)pI830DRI->regs); - - if (!pI830->memory_manager) { - if (drmAddMap(pI830->drmSubFD, - (drm_handle_t)pI830->ring.mem->offset + - pI830->LinearAddr, - pI830->ring.mem->size, DRM_AGP, 0, - (drmAddress) &pI830->ring_map) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap(ring_map) failed. Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] ring buffer = 0x%08x\n", - (int)pI830->ring_map); - } - - return TRUE; -} - -/** - * Sets up mappings for static, lifetime-fixed allocations, and inital SAREA - * setup. - */ -Bool -I830DRIDoMappings(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - DRIInfoPtr pDRIInfo = pI830->pDRIInfo; - I830DRIPtr pI830DRI = pDRIInfo->devPrivate; - drmI830Sarea *sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen); - - if (!I830DRIMapHW(pScreen)) { - DRICloseScreen(pScreen); - return FALSE; - } - - if (!I830InitDma(pScrn)) { - DRICloseScreen(pScreen); - return FALSE; - } - - if (pI830->memory_manager == NULL) - intel_bufmgr_fake_set_last_dispatch(pI830->bufmgr, - (volatile unsigned int *) - &sarea->last_dispatch); - - /* init to zero to be safe */ - sarea->front_handle = 0; - sarea->back_handle = 0; - sarea->depth_handle = 0; - sarea->tex_handle = 0; - - /* Assign pScreen */ - pScrn->pScreen = pScreen; - - /* Need to initialize pScreen now to let RandR know. */ - pScrn->pScreen->width = pScrn->virtualX; - pScrn->pScreen->height = pScrn->virtualY; - - /* If we are using the kernel memory manager, we have to delay SAREA and - * mapping setup until our buffers are pinned at EnterVT, losing the - * opportunity to fail cleanly early on. - */ - if (pI830->memory_manager == NULL) { - if (!i830_update_dri_buffers(pScrn)) { - /* screen mappings probably failed */ - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap(screen mappings) failed. " - "Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - } - - if (pI830->allocate_classic_textures) - I830InitTextureHeap(pScrn); - - if (DEVICE_ID(pI830->PciInfo) != PCI_CHIP_845_G && - DEVICE_ID(pI830->PciInfo) != PCI_CHIP_I830_M) { - I830SetParam(pScrn, I830_SETPARAM_USE_MI_BATCHBUFFER_START, 1 ); - } - - pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate; - pI830DRI->deviceID = DEVICE_ID(pI830->PciInfo); - pI830DRI->width = pScrn->virtualX; - pI830DRI->height = pScrn->virtualY; - pI830DRI->mem = pScrn->videoRam * 1024; - pI830DRI->cpp = pI830->cpp; - - pI830DRI->bitsPerPixel = pScrn->bitsPerPixel; - - pI830DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); - - if (!(I830InitVisualConfigs(pScreen))) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[dri] I830InitVisualConfigs failed. Disabling DRI\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n"); - pI830->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; - - return TRUE; -} -Bool -I830DRIInstIrqHandler(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate; - - pI830DRI->irq = drmGetInterruptFromBusID(pI830->drmSubFD, -#if XSERVER_LIBPCIACCESS - ((pI830->PciInfo->domain << 8) | - pI830->PciInfo->bus), - pI830->PciInfo->dev, - pI830->PciInfo->func -#else - ((pciConfigPtr) pI830-> - PciInfo->thisCard)->busnum, - ((pciConfigPtr) pI830-> - PciInfo->thisCard)->devnum, - ((pciConfigPtr) pI830-> - PciInfo->thisCard)->funcnum +#ifdef DRI2 +#if DRI2INFOREC_VERSION >= 1 +#define USE_DRI2_1_1_0 #endif - ); - - if (drmCtlInstHandler(pI830->drmSubFD, pI830DRI->irq)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] failure adding irq handler\n"); - pI830DRI->irq = 0; - return FALSE; - } else - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] dma control initialized, using IRQ %d\n", - pI830DRI->irq); - - return TRUE; -} - -Bool -I830DRIResume(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - - DPRINTF(PFX, "I830DRIResume\n"); - - I830ResumeDma(pScrn); - - if (!pI830->memory_manager) - I830DRIInstIrqHandler(pScrn); - - return TRUE; -} - -void -I830DRICloseScreen(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - I830DRIPtr pI830DRI = (I830DRIPtr) pI830->pDRIInfo->devPrivate; - - DPRINTF(PFX, "I830DRICloseScreen\n"); - - if (!pI830->memory_manager && pI830DRI->irq) { - drmCtlUninstHandler(pI830->drmSubFD); - pI830DRI->irq = 0; - } - - I830CleanupDma(pScrn); - - DRICloseScreen(pScreen); - - if (pI830->pDRIInfo) { - if (pI830->pDRIInfo->devPrivate) { - xfree(pI830->pDRIInfo->devPrivate); - pI830->pDRIInfo->devPrivate = NULL; - } - DRIDestroyInfoRec(pI830->pDRIInfo); - pI830->pDRIInfo = NULL; - } - if (pI830->pVisualConfigs) - xfree(pI830->pVisualConfigs); - if (pI830->pVisualConfigsPriv) - xfree(pI830->pVisualConfigsPriv); - pI830->directRenderingType = DRI_NONE; -} - -static Bool -I830CreateContext(ScreenPtr pScreen, VisualPtr visual, - drm_context_t hwContext, void *pVisualConfigPriv, - DRIContextType contextStore) -{ - return TRUE; -} - -static void -I830DestroyContext(ScreenPtr pScreen, drm_context_t hwContext, - DRIContextType contextStore) -{ -} - -Bool -I830DRIFinishScreenInit(ScreenPtr pScreen) -{ - DPRINTF(PFX, "I830DRIFinishScreenInit\n"); - - if (!DRIFinishScreenInit(pScreen)) - return FALSE; - - /* move irq initialize later in EnterVT, as then we - * would finish binding possible hw status page, which - * requires irq ctrl ioctl not be called that early. - */ - return TRUE; -} - -static void -I830DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType oldContextType, void *oldContext, - DRIContextType newContextType, void *newContext) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - - if (syncType == DRI_3D_SYNC && - oldContextType == DRI_2D_CONTEXT && newContextType == DRI_2D_CONTEXT) { - - if (I810_DEBUG & DEBUG_VERBOSE_DRI) - ErrorF("i830DRISwapContext (in)\n"); - - pI830->last_3d = LAST_3D_OTHER; - - if (!pScrn->vtSema) - return; - pI830->LockHeld = 1; - if (!pI830->memory_manager) - i830_refresh_ring(pScrn); - - } else if (syncType == DRI_2D_SYNC && - oldContextType == DRI_NO_CONTEXT && - newContextType == DRI_2D_CONTEXT) { - if (I810_DEBUG & DEBUG_VERBOSE_DRI) - ErrorF("i830DRISwapContext (out)\n"); - - if (!pScrn->vtSema) - return; - pI830->LockHeld = 0; - } else if (I810_DEBUG & DEBUG_VERBOSE_DRI) - ErrorF("i830DRISwapContext (other)\n"); -} - -static void -I830DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - BoxPtr pbox; - int nbox; - int buffer, first_buffer, last_buffer; - - if (I810_DEBUG & DEBUG_VERBOSE_DRI) - ErrorF("I830DRIInitBuffers\n"); - first_buffer = I830_SELECT_BACK; - last_buffer = I830_SELECT_DEPTH; - - for (buffer = first_buffer; buffer <= last_buffer; buffer++) { - pbox = REGION_RECTS(prgn); - nbox = REGION_NUM_RECTS(prgn); - - if (!I830SelectBuffer(pScrn, buffer)) - continue; - - if (buffer == I830_SELECT_DEPTH) { - switch (pScrn->bitsPerPixel) { - case 16: - I830SetupForSolidFill(pScrn, 0xffff, GXcopy, -1); - break; - case 32: - I830SetupForSolidFill(pScrn, 0xffffff, GXcopy, -1); - break; - } - } else - I830SetupForSolidFill(pScrn, 0, GXcopy, -1); - while (nbox--) { - I830SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); - pbox++; - } - } - - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - i830MarkSync(pScrn); -} - -/* This routine is a modified form of XAADoBitBlt with the calls to - * ScreenToScreenBitBlt built in. My routine has the prgnSrc as source - * instead of destination. My origin is upside down so the ydir cases - * are reversed. - */ -static void -I830DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index) -{ - ScreenPtr pScreen = pParent->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - BoxPtr pboxTmp, pboxNext, pboxBase; - DDXPointPtr pptTmp, pptNew2 = NULL; - int xdir, ydir; - -#if 0 - int screenwidth = pScrn->virtualX; - int screenheight = pScrn->virtualY; -#else - int screenwidth = pScreen->width; - int screenheight = pScreen->height; +extern XF86ModuleData dri2ModuleData; #endif - BoxPtr pbox = REGION_RECTS(prgnSrc); - int nbox = REGION_NUM_RECTS(prgnSrc); - - BoxPtr pboxNew1 = NULL; - BoxPtr pboxNew2 = NULL; - DDXPointPtr pptNew1 = NULL; - DDXPointPtr pptSrc = &ptOldOrg; - - int dx = pParent->drawable.x - ptOldOrg.x; - int dy = pParent->drawable.y - ptOldOrg.y; - int buffer, first_buffer, last_buffer; - - /* If the copy will overlap in Y, reverse the order */ - if (dy > 0) { - ydir = -1; - - if (nbox > 1) { - /* Keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr) xalloc(sizeof(BoxRec) * nbox); - if (!pboxNew1) - return; - pptNew1 = (DDXPointPtr) xalloc(sizeof(DDXPointRec) * nbox); - if (!pptNew1) { - xfree(pboxNew1); - return; - } - pboxBase = pboxNext = pbox + nbox - 1; - while (pboxBase >= pbox) { - while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) - pboxNext--; - pboxTmp = pboxNext + 1; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp <= pboxBase) { - *pboxNew1++ = *pboxTmp++; - *pptNew1++ = *pptTmp++; - } - pboxBase = pboxNext; - } - pboxNew1 -= nbox; - pbox = pboxNew1; - pptNew1 -= nbox; - pptSrc = pptNew1; - } - } else { - /* No changes required */ - ydir = 1; - } - - /* If the regions will overlap in X, reverse the order */ - if (dx > 0) { - xdir = -1; - - if (nbox > 1) { - /*reverse orderof rects in each band */ - pboxNew2 = (BoxPtr) xalloc(sizeof(BoxRec) * nbox); - pptNew2 = (DDXPointPtr) xalloc(sizeof(DDXPointRec) * nbox); - if (!pboxNew2 || !pptNew2) { - if (pptNew2) - xfree(pptNew2); - if (pboxNew2) - xfree(pboxNew2); - if (pboxNew1) { - xfree(pptNew1); - xfree(pboxNew1); - } - return; - } - pboxBase = pboxNext = pbox; - while (pboxBase < pbox + nbox) { - while ((pboxNext < pbox + nbox) && (pboxNext->y1 == pboxBase->y1)) - pboxNext++; - pboxTmp = pboxNext; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp != pboxBase) { - *pboxNew2++ = *--pboxTmp; - *pptNew2++ = *--pptTmp; - } - pboxBase = pboxNext; - } - pboxNew2 -= nbox; - pbox = pboxNew2; - pptNew2 -= nbox; - pptSrc = pptNew2; - } - } else { - /* No changes are needed */ - xdir = 1; - } - - /* SelectBuffer isn't really a good concept for the i810. - */ - I830EmitFlush(pScrn); - first_buffer = I830_SELECT_BACK; - last_buffer = I830_SELECT_DEPTH; - - for (buffer = first_buffer; buffer <= last_buffer; buffer++) { - if (!I830SelectBuffer(pScrn, buffer)) - continue; - I830SetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, -1, -1); - pbox = REGION_RECTS(prgnSrc); - nbox = REGION_NUM_RECTS(prgnSrc); - for (; nbox--; pbox++) { - - int x1 = pbox->x1; - int y1 = pbox->y1; - int destx = x1 + dx; - int desty = y1 + dy; - int w = pbox->x2 - x1 + 1; - int h = pbox->y2 - y1 + 1; - - if (destx < 0) - x1 -= destx, w += destx, destx = 0; - if (desty < 0) - y1 -= desty, h += desty, desty = 0; - if (destx + w > screenwidth) - w = screenwidth - destx; - if (desty + h > screenheight) - h = screenheight - desty; - if (w <= 0) - continue; - if (h <= 0) - continue; - - if (I810_DEBUG & DEBUG_VERBOSE_DRI) - ErrorF("MoveBuffers %d,%d %dx%d dx: %d dy: %d\n", - x1, y1, w, h, dx, dy); - - I830SubsequentScreenToScreenCopy(pScrn, x1, y1, destx, desty, w, h); - } - } - - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - I830EmitFlush(pScrn); - - if (pboxNew2) { - xfree(pptNew2); - xfree(pboxNew2); - } - if (pboxNew1) { - xfree(pptNew1); - xfree(pboxNew1); - } - i830MarkSync(pScrn); -} - -static void -I830DRITransitionTo3d(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - - pI830->want_vblank_interrupts = TRUE; - I830DRISetVBlankInterrupt(pScrn, TRUE); -} - -static void -I830DRITransitionTo2d(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - - pI830->want_vblank_interrupts = FALSE; - I830DRISetVBlankInterrupt(pScrn, FALSE); -} - -static int -i830_name_buffer (ScrnInfoPtr pScrn, i830_memory *mem) -{ - if (mem && mem->bo) - { - if (!mem->gem_name) - { - int ret; - ret = dri_bo_flink(mem->bo, &mem->gem_name); - if (ret != 0) - { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] failed to name buffer %d\n", -errno); - return -1; - } - } - return mem->gem_name; - } - return -1; -} - -/** - * Update the SAREA fields with current buffer information. - * - * Most of the SAREA fields are already updated by i830_do_addmap(). - * - * This does include other SAREA initialization which will actually be constant - * over the lifetime of the server. - */ -static void -i830_update_sarea(ScrnInfoPtr pScrn, drmI830Sarea *sarea) -{ - ScreenPtr pScreen = pScrn->pScreen; - I830Ptr pI830 = I830PTR(pScrn); - - if (pI830->directRenderingType == DRI_DRI2) - return; - - sarea->width = pScreen->width; - sarea->height = pScreen->height; - sarea->pitch = pScrn->displayWidth; - sarea->virtualX = pScrn->virtualX; - sarea->virtualY = pScrn->virtualY; - - sarea->front_tiled = (pI830->front_buffer->tiling != TILE_NONE); - sarea->back_tiled = (pI830->back_buffer->tiling != TILE_NONE); - sarea->depth_tiled = (pI830->depth_buffer->tiling != TILE_NONE); - sarea->rotated_tiled = FALSE; - - sarea->log_tex_granularity = pI830->TexGranularity; - - sarea->front_bo_handle = i830_name_buffer (pScrn, pI830->front_buffer); - sarea->back_bo_handle = i830_name_buffer (pScrn, pI830->back_buffer); - sarea->depth_bo_handle = i830_name_buffer (pScrn, pI830->depth_buffer); - - /* The rotation is now handled entirely by the X Server, so just leave the - * DRI unaware. - */ - sarea->rotation = 0; - sarea->rotated_offset = -1; - sarea->rotated_size = 0; - sarea->rotated_pitch = pScrn->displayWidth; -} - -/** - * Updates the DRI mapping for the given i830_memory struct, with the given - * flags. - */ -static int -i830_do_addmap(ScrnInfoPtr pScrn, i830_memory *mem, - drm_handle_t *sarea_handle, int *sarea_size, int *sarea_offset) -{ - I830Ptr pI830 = I830PTR(pScrn); - int size = mem->size; - - if (mem == pI830->front_buffer) { - /* Workaround for XAA pixmap cache: Don't use front_buffer->size - * and instead, calculate the visible frontbuffer size and round to - * avoid irritating the assertions of older DRI drivers. - */ - size = ROUND_TO_PAGE(pScrn->displayWidth * pScrn->virtualY * - pI830->cpp); - } - - if (*sarea_handle != 0 && - (*sarea_size != size || *sarea_offset != mem->offset)) - { - drmRmMap(pI830->drmSubFD, *sarea_handle); - *sarea_handle = 0; - *sarea_size = 0; - *sarea_offset = 0; - } - - if (*sarea_handle == 0) { - int ret; - - ret = drmAddMap(pI830->drmSubFD, - (drm_handle_t)(mem->offset + pI830->LinearAddr), - size, DRM_AGP, 0, - (drmAddress) sarea_handle); - if (ret == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] mapped %s at 0x%08lx, handle = 0x%08x\n", - mem->name, mem->offset + pI830->LinearAddr, - (int)*sarea_handle); - *sarea_size = size; - *sarea_offset = mem->offset; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] failed to map %s at 0x%08lx\n", - mem->name, mem->offset + pI830->LinearAddr); - return FALSE; - } - } - - return TRUE; -} - -/** - * Updates the DRM mappings with the current buffer information. - * - * Some old DRI drivers may be unprepared for buffers actually moving at - * runtime, which would likely result in bus errors on software fallbacks or - * hangs or misrendering on hardware rendering. - */ -static Bool -i830_update_dri_mappings(ScrnInfoPtr pScrn, drmI830Sarea *sarea) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (!i830_do_addmap(pScrn, pI830->front_buffer, &sarea->front_handle, - &sarea->front_size, &sarea->front_offset)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); - return FALSE; - } - - if (!i830_do_addmap(pScrn, pI830->back_buffer, &sarea->back_handle, - &sarea->back_size, &sarea->back_offset)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); - return FALSE; - } - - sarea->third_handle = 0; - sarea->third_offset = 0; - sarea->third_size = 0; - - if (!i830_do_addmap(pScrn, pI830->depth_buffer, &sarea->depth_handle, - &sarea->depth_size, &sarea->depth_offset)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); - return FALSE; - } - - if (pI830->allocate_classic_textures) { - if (!i830_do_addmap(pScrn, pI830->textures, &sarea->tex_handle, - &sarea->tex_size, &sarea->tex_offset)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Disabling DRI.\n"); - return FALSE; - } - } - - return TRUE; -} - -static void -i830_update_screen_private(ScrnInfoPtr pScrn, drmI830Sarea *sarea) -{ - I830Ptr pI830 = I830PTR(pScrn); - - pI830->pDRIInfo->frameBufferPhysicalAddress = (char *) pI830->LinearAddr; - pI830->pDRIInfo->frameBufferStride = pScrn->displayWidth * pI830->cpp; - pI830->pDRIInfo->frameBufferSize = sarea->front_size; -#if DRI_DRIVER_FRAMEBUFFER_MAP - pI830->pDRIInfo->hFrameBuffer = sarea->front_handle; -#endif -} - -/** - * Update the SAREA fields, DRI mappings, and screen info passed through the - * protocol. - * - * This gets called both at startup and after any of the buffers might have - * been relocated. - */ -Bool -i830_update_dri_buffers(ScrnInfoPtr pScrn) -{ - ScreenPtr pScreen = pScrn->pScreen; - I830Ptr pI830 = I830PTR(pScrn); - drmI830Sarea *sarea; - Bool success; - - if (pI830->directRenderingType != DRI_XF86DRI) - return TRUE; - - sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen); - - success = i830_update_dri_mappings(pScrn, sarea); - if (!success) - return FALSE; - i830_update_sarea(pScrn, sarea); - i830_update_screen_private(pScrn, sarea); - - return TRUE; -} - -Bool -I830DRISetVBlankInterrupt (ScrnInfoPtr pScrn, Bool on) -{ - I830Ptr pI830 = I830PTR(pScrn); - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - drmI830VBlankPipe pipe; - - /* If we have no 3d running, then don't bother enabling the vblank - * interrupt. - */ - if (!pI830->want_vblank_interrupts) - on = FALSE; - - if (pI830->directRenderingType == DRI_XF86DRI && pI830->drmMinor >= 5) { - if (on) { - if (xf86_config->num_crtc > 1 && xf86_config->crtc[1]->enabled) - if (pI830->drmMinor >= 6) - pipe.pipe = DRM_I830_VBLANK_PIPE_A | DRM_I830_VBLANK_PIPE_B; - else - pipe.pipe = DRM_I830_VBLANK_PIPE_B; - else - pipe.pipe = DRM_I830_VBLANK_PIPE_A; - } else { - pipe.pipe = 0; - } - if (drmCommandWrite(pI830->drmSubFD, DRM_I830_SET_VBLANK_PIPE, - &pipe, sizeof (pipe))) { - return FALSE; - } - } - - return TRUE; -} - -Bool -I830DRILock(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (pI830->directRenderingType == DRI_XF86DRI && !pI830->LockHeld) { - DRILock(screenInfo.screens[pScrn->scrnIndex], 0); - pI830->LockHeld = 1; - if (!pI830->memory_manager) - i830_refresh_ring(pScrn); - return TRUE; - } - else - return FALSE; -} - - - -void -I830DRIUnlock(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (pI830->directRenderingType == DRI_XF86DRI && pI830->LockHeld) { - DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); - pI830->LockHeld = 0; - } -} - -#ifdef DRI2 - typedef struct { PixmapPtr pPixmap; + unsigned int attachment; } I830DRI2BufferPrivateRec, *I830DRI2BufferPrivatePtr; +#ifndef USE_DRI2_1_1_0 static DRI2BufferPtr I830DRI2CreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) { @@ -1602,6 +176,7 @@ I830DRI2CreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) buffers[i].driverPrivate = &privates[i]; buffers[i].flags = 0; /* not tiled */ privates[i].pPixmap = pPixmap; + privates[i].attachment = attachments[i]; bo = i830_get_pixmap_bo (pPixmap); if (dri_bo_flink(bo, &buffers[i].name) != 0) { @@ -1613,6 +188,88 @@ I830DRI2CreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) return buffers; } +#else + +static DRI2BufferPtr +I830DRI2CreateBuffer(DrawablePtr pDraw, unsigned int attachment, + unsigned int format) +{ + ScreenPtr pScreen = pDraw->pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + DRI2BufferPtr buffers; + dri_bo *bo; + I830DRI2BufferPrivatePtr privates; + PixmapPtr pPixmap; + + buffers = xcalloc(1, sizeof *buffers); + if (buffers == NULL) + return NULL; + privates = xcalloc(1, sizeof *privates); + if (privates == NULL) { + xfree(buffers); + return NULL; + } + + if (attachment == DRI2BufferFrontLeft) { + if (pDraw->type == DRAWABLE_PIXMAP) + pPixmap = (PixmapPtr) pDraw; + else + pPixmap = (*pScreen->GetWindowPixmap)((WindowPtr) pDraw); + pPixmap->refcnt++; + } else { + unsigned int hint = 0; + + switch (attachment) { + case DRI2BufferDepth: + case DRI2BufferDepthStencil: + if (SUPPORTS_YTILING(pI830)) + hint = INTEL_CREATE_PIXMAP_TILING_Y; + else + hint = INTEL_CREATE_PIXMAP_TILING_X; + break; + case DRI2BufferFakeFrontLeft: + case DRI2BufferFakeFrontRight: + case DRI2BufferBackLeft: + case DRI2BufferBackRight: + hint = INTEL_CREATE_PIXMAP_TILING_X; + break; + } + + if (!pI830->tiling || + (!IS_I965G(pI830) && !pI830->kernel_exec_fencing)) + hint = 0; + + pPixmap = (*pScreen->CreatePixmap)(pScreen, + pDraw->width, + pDraw->height, + (format != 0)?format:pDraw->depth, + hint); + + } + + + buffers->attachment = attachment; + buffers->pitch = pPixmap->devKind; + buffers->cpp = pPixmap->drawable.bitsPerPixel / 8; + buffers->driverPrivate = privates; + buffers->format = format; + buffers->flags = 0; /* not tiled */ + privates->pPixmap = pPixmap; + privates->attachment = attachment; + + bo = i830_get_pixmap_bo (pPixmap); + if (dri_bo_flink(bo, &buffers->name) != 0) { + /* failed to name buffer */ + } + + return buffers; +} + +#endif + +#ifndef USE_DRI2_1_1_0 + static void I830DRI2DestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count) { @@ -1633,15 +290,37 @@ I830DRI2DestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count) } } +#else + +static void +I830DRI2DestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer) +{ + if (buffer) { + I830DRI2BufferPrivatePtr private = buffer->driverPrivate; + ScreenPtr pScreen = pDraw->pScreen; + + (*pScreen->DestroyPixmap)(private->pPixmap); + + xfree(private); + xfree(buffer); + } +} + +#endif + static void I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, - DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer) + DRI2BufferPtr pDstBuffer, DRI2BufferPtr pSrcBuffer) { - I830DRI2BufferPrivatePtr private = pSrcBuffer->driverPrivate; + I830DRI2BufferPrivatePtr srcPrivate = pSrcBuffer->driverPrivate; + I830DRI2BufferPrivatePtr dstPrivate = pDstBuffer->driverPrivate; ScreenPtr pScreen = pDraw->pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - PixmapPtr pPixmap = private->pPixmap; + PixmapPtr pSrcPixmap = (srcPrivate->attachment == DRI2BufferFrontLeft) + ? (PixmapPtr) pDraw : srcPrivate->pPixmap; + PixmapPtr pDstPixmap = (dstPrivate->attachment == DRI2BufferFrontLeft) + ? (PixmapPtr) pDraw : dstPrivate->pPixmap; RegionPtr pCopyClip; GCPtr pGC; @@ -1649,9 +328,9 @@ I830DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion, pCopyClip = REGION_CREATE(pScreen, NULL, 0); REGION_COPY(pScreen, pCopyClip, pRegion); (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pCopyClip, 0); - ValidateGC(pDraw, pGC); - (*pGC->ops->CopyArea)(&pPixmap->drawable, - pDraw, pGC, 0, 0, pDraw->width, pDraw->height, 0, 0); + ValidateGC(&pDstPixmap->drawable, pGC); + (*pGC->ops->CopyArea)(&pSrcPixmap->drawable, &pDstPixmap->drawable, + pGC, 0, 0, pDraw->width, pDraw->height, 0, 0); FreeScratchGC(pGC); /* Emit a flush of the rendering cache, or on the 965 and beyond @@ -1680,28 +359,53 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen) int i; struct stat sbuf; dev_t d; +#ifdef USE_DRI2_1_1_0 + int dri2_major = 1; + int dri2_minor = 0; +#endif if (pI830->accel != ACCEL_UXA) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "DRI2 requires UXA\n"); return FALSE; } +#ifdef USE_DRI2_1_1_0 + if (xf86LoaderCheckSymbol("DRI2Version")) { + DRI2Version(& dri2_major, & dri2_minor); + } + + if (dri2_minor < 1) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "DRI2 requires DRI2 module version 1.1.0 or later\n"); + return FALSE; + } +#endif + sprintf(buf, "pci:%04x:%02x:%02x.%d", pI830->PciInfo->domain, pI830->PciInfo->bus, pI830->PciInfo->dev, pI830->PciInfo->func); - info.fd = -1; - -#ifdef XF86DRM_MODE /* Use the already opened (master) fd from modesetting */ - if (pI830->use_drm_mode) + if (pI830->use_drm_mode) { info.fd = pI830->drmSubFD; -#endif - - if (info.fd < 0) + } else { info.fd = drmOpen("i915", buf); + drmSetVersion sv; + int err; + + /* Check that what we opened was a master or a master-capable FD, + * by setting the version of the interface we'll use to talk to it. + * (see DRIOpenDRMMaster() in DRI1) + */ + sv.drm_di_major = 1; + sv.drm_di_minor = 1; + sv.drm_dd_major = -1; + err = drmSetInterfaceVersion(info.fd, &sv); + if (err != 0) + return FALSE; + } if (info.fd < 0) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Failed to open DRM device\n"); @@ -1730,10 +434,19 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen) info.driverName = IS_I965G(pI830) ? "i965" : "i915"; info.deviceName = p; - info.version = 1; +#ifdef USE_DRI2_1_1_0 + info.version = 2; + info.CreateBuffers = NULL; + info.DestroyBuffers = NULL; + info.CreateBuffer = I830DRI2CreateBuffer; + info.DestroyBuffer = I830DRI2DestroyBuffer; +#else + info.version = 1; info.CreateBuffers = I830DRI2CreateBuffers; info.DestroyBuffers = I830DRI2DestroyBuffers; +#endif + info.CopyRegion = I830DRI2CopyRegion; pI830->drmSubFD = info.fd; @@ -1749,5 +462,3 @@ void I830DRI2CloseScreen(ScreenPtr pScreen) DRI2CloseScreen(pScreen); pI830->directRenderingType = DRI_NONE; } - -#endif diff --git a/src/i830_driver.c b/src/i830_driver.c index 4672a383..4278609e 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -206,27 +206,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i830_hwmc.h" #endif -#ifdef XF86DRI -#include "dri.h" #include <sys/ioctl.h> #include "i915_drm.h" -#endif - -#ifdef XF86DRM_MODE #include <xf86drmMode.h> -#endif - -#ifdef I830_USE_EXA -const char *I830exaSymbols[] = { - "exaGetVersion", - "exaDriverInit", - "exaDriverFini", - "exaOffscreenAlloc", - "exaOffscreenFree", - "exaWaitSync", - NULL -}; -#endif #define BIT(x) (1 << (x)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) @@ -300,9 +282,7 @@ static PciChipsets I830PciChipsets[] = { */ typedef enum { - OPTION_ACCELMETHOD, OPTION_NOACCEL, - OPTION_CACHE_LINES, OPTION_DRI, OPTION_VIDEO_KEY, OPTION_COLOR_KEY, @@ -320,9 +300,7 @@ typedef enum { } I830Opts; static OptionInfoRec I830Options[] = { - {OPTION_ACCELMETHOD, "AccelMethod", OPTV_ANYSTR, {0}, FALSE}, {OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE}, - {OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, {OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, TRUE}, {OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE}, {OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, @@ -341,15 +319,6 @@ static OptionInfoRec I830Options[] = { }; /* *INDENT-ON* */ -const char *i830_output_type_names[] = { - "Unused", - "Analog", - "DVO", - "SDVO", - "LVDS", - "TVOUT", -}; - static void i830AdjustFrame(int scrnIndex, int x, int y, int flags); static Bool I830CloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool I830EnterVT(int scrnIndex, int flags); @@ -361,8 +330,8 @@ extern void xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y); #ifdef I830DEBUG void -I830DPRINTF_stub(const char *filename, int line, const char *function, - const char *fmt, ...) +I830DPRINTF(const char *filename, int line, const char *function, + const char *fmt, ...) { va_list ap; @@ -374,13 +343,6 @@ I830DPRINTF_stub(const char *filename, int line, const char *function, va_end(ap); ErrorF("##############################################\n\n"); } -#else /* #ifdef I830DEBUG */ -void -I830DPRINTF_stub(const char *filename, int line, const char *function, - const char *fmt, ...) -{ - /* do nothing */ -} #endif /* #ifdef I830DEBUG */ /* Export I830 options to i830 driver where necessary */ @@ -427,20 +389,11 @@ static int I830DetectMemory(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); -#if !XSERVER_LIBPCIACCESS - PCITAG bridge; -#endif uint16_t gmch_ctrl; int memsize = 0, gtt_size; int range; - -#if XSERVER_LIBPCIACCESS struct pci_device *bridge = intel_host_bridge (); pci_device_cfg_read_u16(bridge, & gmch_ctrl, I830_GMCH_CTRL); -#else - bridge = pciTag(0, 0, 0); /* This is always the host bridge */ - gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL); -#endif if (IS_I965G(pI830)) { /* The 965 may have a GTT that is actually larger than is necessary @@ -585,15 +538,10 @@ I830DetectMemory(ScrnInfoPtr pScrn) static Bool I830MapMMIO(ScrnInfoPtr pScrn) { -#if XSERVER_LIBPCIACCESS int err; struct pci_device *device; -#else - int mmioFlags; -#endif I830Ptr pI830 = I830PTR(pScrn); -#if XSERVER_LIBPCIACCESS device = pI830->PciInfo; err = pci_device_map_range (device, pI830->MMIOAddr, @@ -607,20 +555,6 @@ I830MapMMIO(ScrnInfoPtr pScrn) strerror (err), err); return FALSE; } -#else - -#if !defined(__alpha__) - mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; -#else - mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE; -#endif - - pI830->MMIOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, - pI830->PciTag, - pI830->MMIOAddr, I810_REG_SIZE); - if (!pI830->MMIOBase) - return FALSE; -#endif /* Set up the GTT mapping for the various places it has been moved over * time. @@ -643,7 +577,6 @@ I830MapMMIO(ScrnInfoPtr pScrn) gttaddr = I810_MEMBASE(pI830->PciInfo, 3) & 0xFFFFFF00; pI830->GTTMapSize = pI830->FbMapSize / 1024; } -#if XSERVER_LIBPCIACCESS err = pci_device_map_range (device, gttaddr, pI830->GTTMapSize, PCI_DEV_MAP_FLAG_WRITABLE, @@ -655,13 +588,6 @@ I830MapMMIO(ScrnInfoPtr pScrn) strerror (err), err); return FALSE; } -#else - pI830->GTTBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, - pI830->PciTag, - gttaddr, pI830->GTTMapSize); - if (pI830->GTTBase == NULL) - return FALSE; -#endif } else { /* The GTT aperture on i830 is write-only. We could probably map the * actual physical pages that back it, but leave it alone for now. @@ -678,30 +604,17 @@ I830MapMem(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); long i; -#if XSERVER_LIBPCIACCESS struct pci_device *const device = pI830->PciInfo; int err; -#endif for (i = 2; i < pI830->FbMapSize; i <<= 1) ; pI830->FbMapSize = i; - if (!I830MapMMIO(pScrn)) - return FALSE; - -#if XSERVER_LIBPCIACCESS err = pci_device_map_range (device, pI830->LinearAddr, pI830->FbMapSize, PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE, (void **) &pI830->FbBase); if (err) return FALSE; -#else - pI830->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, - pI830->PciTag, - pI830->LinearAddr, pI830->FbMapSize); - if (!pI830->FbBase) - return FALSE; -#endif if (pI830->ring.mem != NULL) { pI830->ring.virtual_start = pI830->FbBase + pI830->ring.mem->offset; @@ -715,20 +628,11 @@ I830UnmapMMIO(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); -#if XSERVER_LIBPCIACCESS pci_device_unmap_range (pI830->PciInfo, pI830->MMIOBase, I810_REG_SIZE); -#else - xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->MMIOBase, - I810_REG_SIZE); -#endif pI830->MMIOBase = NULL; if (IS_I9XX(pI830)) { -#if XSERVER_LIBPCIACCESS pci_device_unmap_range (pI830->PciInfo, pI830->GTTBase, pI830->GTTMapSize); -#else - xf86UnMapVidMem(pScrn->scrnIndex, pI830->GTTBase, pI830->GTTMapSize); -#endif pI830->GTTBase = NULL; } } @@ -738,12 +642,7 @@ I830UnmapMem(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); -#if XSERVER_LIBPCIACCESS pci_device_unmap_range (pI830->PciInfo, pI830->FbBase, pI830->FbMapSize); -#else - xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pI830->FbBase, - pI830->FbMapSize); -#endif pI830->FbBase = NULL; I830UnmapMMIO(pScrn); return TRUE; @@ -817,7 +716,7 @@ I830LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, } } -void +static void i830_update_front_offset(ScrnInfoPtr pScrn) { ScreenPtr pScreen = pScrn->pScreen; @@ -878,14 +777,13 @@ i830CreateScreenResources(ScreenPtr pScreen) i830_update_front_offset(pScrn); -#ifdef I830_USE_UXA if (pI830->accel == ACCEL_UXA) i830_uxa_create_screen_resources(pScreen); -#endif + return TRUE; } -int +static int i830_output_clones (ScrnInfoPtr pScrn, int type_mask) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR (pScrn); @@ -1171,7 +1069,7 @@ i830_xf86crtc_resize (ScrnInfoPtr scrn, int width, int height) scrn->virtualX = width; scrn->virtualY = height; #ifdef DRI2 - if (i830->can_resize && i830->front_buffer) + if (i830->front_buffer) { i830_memory *new_front, *old_front; Bool tiled; @@ -1242,18 +1140,13 @@ i830SetHotkeyControl(ScrnInfoPtr pScrn, int mode) pI830->writeControl(pI830, GRX, 0x18, gr18); } -#ifdef XF86DRM_MODE /* * DRM mode setting Linux only at this point... later on we could * add a wrapper here. */ static Bool i830_kernel_mode_enabled(ScrnInfoPtr pScrn) { -#if XSERVER_LIBPCIACCESS struct pci_device *PciInfo; -#else - pciVideoPtr PciInfo; -#endif EntityInfoPtr pEnt; char *busIdString; int ret; @@ -1273,9 +1166,6 @@ static Bool i830_kernel_mode_enabled(ScrnInfoPtr pScrn) return TRUE; } -#else -#define i830_kernel_mode_enabled(x) FALSE -#endif static Bool i830_detect_chipset(ScrnInfoPtr pScrn) @@ -1300,11 +1190,7 @@ i830_detect_chipset(ScrnInfoPtr pScrn) break; case PCI_CHIP_I855_GM: /* Check capid register to find the chipset variant */ -#if XSERVER_LIBPCIACCESS pci_device_cfg_read_u32 (pI830->PciInfo, &capid, I85X_CAPID); -#else - capid = pciReadLong (pI830->PciTag, I85X_CAPID); -#endif pI830->variant = (capid >> I85X_VARIANT_SHIFT) & I85X_VARIANT_MASK; switch (pI830->variant) { case I855_GM: @@ -1483,19 +1369,11 @@ i830_detect_chipset(ScrnInfoPtr pScrn) /* Now figure out mapsize on 8xx chips */ if (IS_I830(pI830) || IS_845G(pI830)) { -#if XSERVER_LIBPCIACCESS uint16_t gmch_ctrl; struct pci_device *bridge; bridge = intel_host_bridge (); pci_device_cfg_read_u16 (bridge, &gmch_ctrl, I830_GMCH_CTRL); -#else - PCITAG bridge; - uint16_t gmch_ctrl; - - bridge = pciTag(0, 0, 0); /* This is always the host bridge */ - gmch_ctrl = pciReadWord(bridge, I830_GMCH_CTRL); -#endif if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) { pI830->FbMapSize = 0x8000000; } else { @@ -1503,12 +1381,7 @@ i830_detect_chipset(ScrnInfoPtr pScrn) } } else { if (IS_I9XX(pI830)) { -#if XSERVER_LIBPCIACCESS pI830->FbMapSize = pI830->PciInfo->regions[fb_bar].size; -#else - pI830->FbMapSize = 1UL << pciGetBaseSize(pI830->PciTag, 2, TRUE, - NULL); -#endif } else { /* 128MB aperture for later i8xx series. */ pI830->FbMapSize = 0x8000000; @@ -1522,8 +1395,6 @@ static const char *accel_name[] = { "unspecified", "no", - "XAA", - "EXA", "UXA", }; @@ -1616,52 +1487,12 @@ I830AccelMethodInit(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); MessageType from = X_PROBED; - char *s; int i, num_pipe; if (xf86ReturnOptValBool(pI830->Options, OPTION_NOACCEL, FALSE)) { pI830->accel = ACCEL_NONE; - } - - /* - * The ugliness below: - * If either XAA or EXA (exclusive) is compiled in, default to it. - * - * If both are compiled in, and the user didn't specify noAccel, use the - * config option AccelMethod to determine which to use, defaulting to EXA - * if none is specified, or if the string was unrecognized. - * - * Then, just to make things more confusing, the default EXA will - * be overridden to UXA if KMS is available. See I830DrmModeInit. - * - * All this *will* go away when we remove XAA and EXA support from - * this driver. (And there will be much rejoicing.) - */ - if (!(pI830->accel == ACCEL_NONE)) { -#ifdef I830_USE_UXA - pI830->accel = ACCEL_UXA; -#endif -#ifdef I830_USE_EXA - pI830->accel = ACCEL_EXA; -#endif -#if I830_USE_XAA + I830_USE_EXA + I830_USE_UXA >= 2 - from = X_DEFAULT; - if ((s = (char *)xf86GetOptValString(pI830->Options, - OPTION_ACCELMETHOD))) { - if (!xf86NameCmp(s, "EXA")) { - from = X_CONFIG; - pI830->accel = ACCEL_EXA; - } - else if (!xf86NameCmp(s, "XAA")) { - from = X_CONFIG; - pI830->accel = ACCEL_XAA; - } - else if (!xf86NameCmp(s, "UXA")) { - from = X_CONFIG; - pI830->accel = ACCEL_UXA; - } - } -#endif + } else { + pI830->accel = ACCEL_UXA; xf86DrvMsg(pScrn->scrnIndex, from, "Using %s for acceleration\n", accel_name[pI830->accel]); } @@ -1670,7 +1501,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn) if (!xf86ReturnOptValBool(pI830->Options, OPTION_DRI, TRUE)) pI830->directRenderingType = DRI_DISABLED; -#ifdef XF86DRI if (pI830->accel == ACCEL_NONE) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it " "needs 2D acceleration.\n"); @@ -1680,7 +1510,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn) "runs only at depths 16 and 24.\n"); pI830->directRenderingType = DRI_DISABLED; } -#endif /* XF86DRI */ I830MapMMIO(pScrn); @@ -1709,20 +1538,8 @@ I830AccelMethodInit(ScrnInfoPtr pScrn) I830SetupOutputs(pScrn); SaveHWState(pScrn); - pI830->can_resize = FALSE; - if (pI830->accel == ACCEL_UXA && pI830->directRenderingType != DRI_XF86DRI) - pI830->can_resize = TRUE; -#if !defined(DRI2) && defined(XF86DRI) - /* Disable resizing so that DRI1 can initialize and give us GEM support. */ - pI830->can_resize = FALSE; -#endif - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Resizable framebuffer: %s (%d %d)\n", - pI830->can_resize ? "available" : "not available", - pI830->directRenderingType, pI830->accel); - if (!xf86InitialConfiguration (pScrn, pI830->can_resize)) + if (!xf86InitialConfiguration (pScrn, TRUE)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); RestoreHWState(pScrn); @@ -1742,29 +1559,12 @@ I830AccelMethodInit(ScrnInfoPtr pScrn) static Bool I830DrmModeInit(ScrnInfoPtr pScrn) { -#ifdef XF86DRM_MODE I830Ptr pI830 = I830PTR(pScrn); char *bus_id; - char *s; int ret; - /* Default to UXA but allow override */ pI830->accel = ACCEL_UXA; - if ((s = (char *)xf86GetOptValString(pI830->Options, OPTION_ACCELMETHOD))) { - if (xf86NameCmp(s, "UXA")) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "kernel mode setting active,overridding accelmethod and using UXA\n"); - } - - pI830->can_resize = FALSE; - if (pI830->accel == ACCEL_UXA && pI830->directRenderingType != DRI_XF86DRI) - pI830->can_resize = TRUE; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Resizable framebuffer: %s (%d %d)\n", - pI830->can_resize ? "available" : "not available", - pI830->directRenderingType, pI830->accel); - bus_id = DRICreatePCIBusID(pI830->PciInfo); /* Create a bus Id */ @@ -1787,10 +1587,8 @@ I830DrmModeInit(ScrnInfoPtr pScrn) } pI830->directRenderingType = DRI_NONE; - pI830->allocate_classic_textures = FALSE; i830_init_bufmgr(pScrn); -#endif return TRUE; } @@ -1803,7 +1601,6 @@ I830XvInit(ScrnInfoPtr pScrn) pI830->XvPreferOverlay = xf86ReturnOptValBool(pI830->Options, OPTION_PREFER_OVERLAY, FALSE); -#ifdef I830_XV if (xf86GetOptValInteger(pI830->Options, OPTION_VIDEO_KEY, &(pI830->colorKey))) { from = X_CONFIG; @@ -1819,7 +1616,6 @@ I830XvInit(ScrnInfoPtr pScrn) } xf86DrvMsg(pScrn->scrnIndex, from, "video overlay key set to 0x%x\n", pI830->colorKey); -#endif } /** @@ -1876,10 +1672,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) return FALSE; pI830->PciInfo = xf86GetPciInfoForEntity(pI830->pEnt->index); -#if !XSERVER_LIBPCIACCESS - pI830->PciTag = pciTag(pI830->PciInfo->bus, pI830->PciInfo->device, - pI830->PciInfo->func); -#endif if (xf86RegisterResources(pI830->pEnt->index, NULL, ResNone)) { PreInitCleanup(pScrn); @@ -1971,43 +1763,6 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(I810fbSymbols, NULL); - switch (pI830->accel) { -#ifdef I830_USE_XAA - case ACCEL_XAA: - if (!xf86LoadSubModule(pScrn, "xaa")) { - PreInitCleanup(pScrn); - return FALSE; - } - xf86LoaderReqSymLists(I810xaaSymbols, NULL); - break; -#endif - -#ifdef I830_USE_EXA - case ACCEL_EXA: { - XF86ModReqInfo req; - int errmaj, errmin; - - memset(&req, 0, sizeof(req)); - req.majorversion = 2; -#if EXA_VERSION_MINOR >= 2 - req.minorversion = 2; -#else - req.minorversion = 1; -#endif - if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &req, - &errmaj, &errmin)) { - LoaderErrorMsg(NULL, "exa", errmaj, errmin); - PreInitCleanup(pScrn); - return FALSE; - } - xf86LoaderReqSymLists(I830exaSymbols, NULL); - break; - } -#endif - default: - break; - } - if (!pI830->use_drm_mode) { i830CompareRegsToSnapshot(pScrn, "After PreInit"); @@ -2019,23 +1774,11 @@ I830PreInit(ScrnInfoPtr pScrn, int flags) xf86SetOperatingState(resVgaMem, pI830->pEnt->index, ResDisableOpr); } -#if defined(XF86DRI) - /* Load the dri module if requested. */ - if (xf86ReturnOptValBool(pI830->Options, OPTION_DRI, FALSE) && - pI830->directRenderingType != DRI_DISABLED) { - if (xf86LoadSubModule(pScrn, "dri")) { - xf86LoaderReqSymLists(I810driSymbols, I810drmSymbols, NULL); - } - } -#endif - -#if defined(DRI2) /* Load the dri2 module if requested. */ if (xf86ReturnOptValBool(pI830->Options, OPTION_DRI, FALSE) && pI830->directRenderingType != DRI_DISABLED) { xf86LoadSubModule(pScrn, "dri2"); } -#endif pI830->preinit = FALSE; @@ -2123,7 +1866,6 @@ i830_refresh_ring(ScrnInfoPtr pScrn) pI830->ring.space = pI830->ring.head - (pI830->ring.tail + 8); if (pI830->ring.space < 0) pI830->ring.space += pI830->ring.mem->size; - i830MarkSync(pScrn); } enum pipe { @@ -2323,9 +2065,6 @@ RestoreHWState(ScrnInfoPtr pScrn) DPRINTF(PFX, "RestoreHWState\n"); -#ifdef XF86DRI - I830DRISetVBlankInterrupt (pScrn, FALSE); -#endif /* Disable outputs */ for (i = 0; i < xf86_config->num_output; i++) { xf86OutputPtr output = xf86_config->output[i]; @@ -2594,46 +2333,6 @@ I830PointerMoved(int index, int x, int y) (*pI830->PointerMoved)(index, newX, newY); } -static Bool -I830InitFBManager( - ScreenPtr pScreen, - BoxPtr FullBox -){ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - RegionRec ScreenRegion; - RegionRec FullRegion; - BoxRec ScreenBox; - Bool ret; - - ScreenBox.x1 = 0; - ScreenBox.y1 = 0; - ScreenBox.x2 = pScrn->displayWidth; - if (pScrn->virtualX > pScrn->virtualY) - ScreenBox.y2 = pScrn->virtualX; - else - ScreenBox.y2 = pScrn->virtualY; - - if((FullBox->x1 > ScreenBox.x1) || (FullBox->y1 > ScreenBox.y1) || - (FullBox->x2 < ScreenBox.x2) || (FullBox->y2 < ScreenBox.y2)) { - return FALSE; - } - - if (FullBox->y2 < FullBox->y1) return FALSE; - if (FullBox->x2 < FullBox->x2) return FALSE; - - REGION_INIT(pScreen, &ScreenRegion, &ScreenBox, 1); - REGION_INIT(pScreen, &FullRegion, FullBox, 1); - - REGION_SUBTRACT(pScreen, &FullRegion, &FullRegion, &ScreenRegion); - - ret = xf86InitFBManagerRegion(pScreen, &FullRegion); - - REGION_UNINIT(pScreen, &ScreenRegion); - REGION_UNINIT(pScreen, &FullRegion); - - return ret; -} - /** * Intialiazes the hardware for the 3D pipeline use in the 2D driver. * @@ -2649,16 +2348,6 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn) if (pI830->accel == ACCEL_NONE) return; -#ifdef XF86DRI - if (pI830->directRenderingType == DRI_XF86DRI) { - drmI830Sarea *sarea = DRIGetSAREAPrivate(pScrn->pScreen); - - /* Mark that the X Server was the last holder of the context */ - if (sarea) - sarea->ctxOwner = DRIGetContext(pScrn->pScreen); - } -#endif - /* If we've emitted our state since the last clobber by another client, * skip it. */ @@ -2705,18 +2394,14 @@ I830BlockHandler(int i, * fashion. */ intel_batch_flush(pScrn, flushed); -#ifdef XF86DRI if (pI830->memory_manager) drmCommandNone(pI830->drmSubFD, DRM_I915_GEM_THROTTLE); -#endif pI830->need_mi_flush = FALSE; } -#ifdef I830_USE_UXA if (pI830->accel == ACCEL_UXA) i830_uxa_block_handler (pScreen); -#endif I830VideoBlockHandler(i, blockData, pTimeout, pReadmask); } @@ -2770,7 +2455,6 @@ i830_try_memory_allocation(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); Bool tiled = pI830->tiling; - Bool xf86dri = pI830->directRenderingType == DRI_XF86DRI; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Attempting memory allocation with %stiled buffers.\n", @@ -2783,9 +2467,6 @@ i830_try_memory_allocation(ScrnInfoPtr pScrn) if (!i830_allocate_pwrctx(pScrn)) goto failed; - if (xf86dri && !i830_allocate_3d_memory(pScrn)) - goto failed; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%siled allocation successful.\n", tiled ? "T" : "Unt"); return TRUE; @@ -2824,14 +2505,6 @@ i830_memory_init(ScrnInfoPtr pScrn) pI830->pEnt->device->videoRam ? X_CONFIG : X_DEFAULT, "VideoRam: %d KB\n", pScrn->videoRam); - if (xf86GetOptValInteger(pI830->Options, OPTION_CACHE_LINES, - &(pI830->CacheLines))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Requested %d cache lines\n", - pI830->CacheLines); - } else { - pI830->CacheLines = -1; - } - /* Tiled first if we got a good displayWidth */ if (tiled) { if (i830_try_memory_allocation(pScrn)) @@ -2850,18 +2523,6 @@ i830_memory_init(ScrnInfoPtr pScrn) "disabled\n"); pI830->fb_compression = FALSE; - /* Try again, but leave DRI enabled */ - if (pI830->directRenderingType == DRI_XF86DRI) { - if (i830_try_memory_allocation(pScrn)) - return TRUE; - else { - i830_reset_allocations(pScrn); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Couldn't allocate 3D memory, " - "disabling DRI.\n"); - pI830->directRenderingType = DRI_NONE; - } - } - if (i830_try_memory_allocation(pScrn)) return TRUE; @@ -2971,9 +2632,7 @@ I830SwapPipes(ScrnInfoPtr pScrn) * alone in that case. * Also make sure the DRM can handle the swap. */ - if (I830LVDSPresent(pScrn) && !IS_I965GM(pI830) && !IS_GM45(pI830) && - (pI830->directRenderingType != DRI_XF86DRI || - (pI830->directRenderingType == DRI_XF86DRI && pI830->drmMinor >= 10))) { + if (I830LVDSPresent(pScrn) && !IS_I965GM(pI830) && !IS_GM45(pI830)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "adjusting plane->pipe mappings " "to allow for framebuffer compression\n"); for (c = 0; c < config->num_crtc; c++) { @@ -3065,10 +2724,8 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } if (pI830->use_drm_mode) { -#ifdef XF86DRM_MODE pI830->stolen_size = 0; pScrn->videoRam = ~0UL / KB(1); -#endif } else { I830AdjustMemory(pScreen); } @@ -3078,14 +2735,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI830->directRenderingType = DRI_DRI2; #endif -#ifdef XF86DRI - /* If DRI hasn't been explicitly disabled, try to initialize it. - * It will be used by the memory allocator. - */ - if (!pI830->can_resize && pI830->directRenderingType == DRI_NONE && I830DRIScreenInit(pScreen)) - pI830->directRenderingType = DRI_XF86DRI; -#endif - /* Enable tiling by default */ pI830->tiling = TRUE; @@ -3125,27 +2774,31 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI830->last_3d = LAST_3D_OTHER; pI830->overlayOn = FALSE; -#ifdef I830_XV /* * Set this so that the overlay allocation is factored in when * appropriate. */ pI830->XvEnabled = TRUE; -#endif - /* Need MMIO mapped to do GTT lookups during memory allocation. */ if (!pI830->use_drm_mode) I830MapMMIO(pScrn); + /* Need FB mapped to set up the fake bufmgr if we end up doing that + * in i830_memory_init() -> i830_allocator_init(). + */ + if (!pI830->use_drm_mode) { + if (!I830MapMem(pScrn)) + return FALSE; + pScrn->memPhysBase = (unsigned long)pI830->FbBase; + } + if (!i830_memory_init(pScrn)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Couldn't allocate video memory\n"); return FALSE; } - I830UnmapMMIO(pScrn); - i830_fixup_mtrrs(pScrn); pI830->starting = TRUE; @@ -3158,15 +2811,11 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (!miSetPixmapDepths()) return FALSE; -#ifdef I830_XV if (pI830->accel == ACCEL_NONE) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Xv is disabled because it " "needs 2D acceleration.\n"); pI830->XvEnabled = FALSE; } -#else - pI830->XvEnabled = FALSE; -#endif if (pI830->accel != ACCEL_NONE && !pI830->use_drm_mode) { if (pI830->memory_manager == NULL && pI830->ring.mem->size == 0) { @@ -3176,47 +2825,13 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI830->accel = ACCEL_NONE; } } - - if (!pI830->use_drm_mode) { - DPRINTF(PFX, "assert( if(!I830MapMem(pScrn)) )\n"); - if (!I830MapMem(pScrn)) - return FALSE; - pScrn->memPhysBase = (unsigned long)pI830->FbBase; - } i830_init_bufmgr(pScrn); -#ifdef XF86DRI - /* - * Setup DRI after visuals have been established, but before fbScreenInit - * is called. fbScreenInit will eventually call into the drivers - * InitGLXVisuals call back. - */ - if (pI830->directRenderingType == DRI_XF86DRI) { - if (pI830->accel == ACCEL_NONE) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DRI is disabled because it " - "needs 2D acceleration.\n"); - pI830->directRenderingType = DRI_NONE; - } - } - - if (pI830->directRenderingType == DRI_XF86DRI && - !I830DRIDoMappings(pScreen)) - pI830->directRenderingType = DRI_NONE; - - /* If we failed for any reason, free DRI memory. */ - if (pI830->directRenderingType != DRI_XF86DRI && - pI830->back_buffer != NULL) - i830_free_3d_memory(pScrn); - if (!pI830->use_drm_mode) I830SwapPipes(pScrn); -#endif pScrn->fbOffset = pI830->front_buffer->offset; - pI830->xoffset = (pScrn->fbOffset / pI830->cpp) % pScrn->displayWidth; - pI830->yoffset = (pScrn->fbOffset / pI830->cpp) / pScrn->displayWidth; - if (!pI830->use_drm_mode) { vgaHWSetMmioFuncs(hwp, pI830->MMIOBase, 0); vgaHWGetIOBase(hwp); @@ -3227,13 +2842,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) DPRINTF(PFX, "assert( if(!I830EnterVT(scrnIndex, 0)) )\n"); - if (pI830->accel <= ACCEL_XAA) { - if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to init memory manager\n"); - } - } - if (pScrn->virtualX > pScrn->displayWidth) pScrn->displayWidth = pScrn->virtualX; @@ -3265,9 +2873,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86DiDGAInit (pScreen, pI830->LinearAddr + pScrn->fbOffset); - DPRINTF(PFX, - "assert( if(!I830InitFBManager(pScreen, &(pI830->FbMemBox))) )\n"); - if (pI830->accel != ACCEL_NONE) { if (!I830AccelInit(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -3292,15 +2897,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor initialization failed\n"); -#ifdef XF86DRI - /* Must be called before EnterVT, so we can acquire the DRI lock when - * binding our memory. - */ - if (pI830->directRenderingType == DRI_XF86DRI && - !I830DRIFinishScreenInit(pScreen)) - pI830->directRenderingType = DRI_NONE; -#endif - /* Must force it before EnterVT, so we are in control of VT and * later memory should be bound when allocating, e.g rotate_mem */ pScrn->vtSema = TRUE; @@ -3333,30 +2929,22 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86DPMSInit(pScreen, xf86DPMSSet, 0); -#ifdef I830_XV #ifdef INTEL_XVMC pI830->XvMCEnabled = FALSE; - from = (pI830->directRenderingType == DRI_XF86DRI && - xf86GetOptValBool(pI830->Options, OPTION_XVMC, - &pI830->XvMCEnabled)) ? X_CONFIG : X_DEFAULT; + from = xf86GetOptValBool(pI830->Options, OPTION_XVMC, + &pI830->XvMCEnabled) ? X_CONFIG : X_DEFAULT; xf86DrvMsg(pScrn->scrnIndex, from, "Intel XvMC decoder %sabled\n", pI830->XvMCEnabled ? "en" : "dis"); #endif /* Init video */ if (pI830->XvEnabled) I830InitVideo(pScreen); -#endif /* Setup 3D engine, needed for rotation too */ IntelEmitInvarientState(pScrn); -#if defined(XF86DRI) || defined(DRI2) +#if defined(DRI2) switch (pI830->directRenderingType) { - case DRI_XF86DRI: - pI830->directRenderingOpen = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "direct rendering: XF86DRI Enabled\n"); - break; case DRI_DRI2: pI830->directRenderingOpen = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering: DRI2 Enabled\n"); @@ -3397,7 +2985,7 @@ i830AdjustFrame(int scrnIndex, int x, int y, int flags) xf86CrtcPtr crtc = output->crtc; DPRINTF(PFX, "i830AdjustFrame: y = %d (+ %d), x = %d (+ %d)\n", - x, pI830->xoffset, y, pI830->yoffset); + x, crtc->desiredX, y, crtc->desiredY); if (pI830->use_drm_mode) return; @@ -3405,7 +2993,7 @@ i830AdjustFrame(int scrnIndex, int x, int y, int flags) if (crtc && crtc->enabled) { /* Sync the engine before adjust frame */ - i830WaitSync(pScrn); + I830Sync(pScrn); i830PipeSetBase(crtc, crtc->desiredX + x, crtc->desiredY + y); crtc->x = output->initial_x + x; crtc->y = output->initial_y + y; @@ -3432,10 +3020,6 @@ I830LeaveVT(int scrnIndex, int flags) ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); int ret; -#ifndef HAVE_FREE_SHADOW - xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); - int o; -#endif DPRINTF(PFX, "Leave VT\n"); @@ -3447,32 +3031,7 @@ I830LeaveVT(int scrnIndex, int flags) i830SetHotkeyControl(pScrn, HOTKEY_BIOS_SWITCH); -#ifdef XF86DRI - if (pI830->directRenderingOpen && - pI830->directRenderingType == DRI_XF86DRI) { - DRILock(screenInfo.screens[pScrn->scrnIndex], 0); - - if (!pI830->memory_manager) { - I830DRISetVBlankInterrupt (pScrn, FALSE); - drmCtlUninstHandler(pI830->drmSubFD); - } - } -#endif - -#ifndef HAVE_FREE_SHADOW - for (o = 0; o < config->num_crtc; o++) { - xf86CrtcPtr crtc = config->crtc[o]; - - if (crtc->rotatedPixmap || crtc->rotatedData) { - crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap, - crtc->rotatedData); - crtc->rotatedPixmap = NULL; - crtc->rotatedData = NULL; - } - } -#else xf86RotateFreeShadow(pScrn); -#endif xf86_hide_cursors (pScrn); @@ -3499,7 +3058,6 @@ I830LeaveVT(int scrnIndex, int flags) i830_unbind_all_memory(pScrn); -#ifdef XF86DRI if (pI830->memory_manager && !pI830->use_drm_mode) { int ret; @@ -3510,20 +3068,14 @@ I830LeaveVT(int scrnIndex, int flags) if (ret != 0) FatalError("DRM_I915_LEAVEVT failed: %s\n", strerror(ret)); } -#endif /* XF86DRI */ - if ((pI830->accel == ACCEL_EXA || pI830->accel == ACCEL_UXA) && IS_I965G(pI830)) + if (pI830->accel == ACCEL_UXA && IS_I965G(pI830)) gen4_render_state_cleanup(pScrn); - if (pI830->AccelInfoRec) - pI830->AccelInfoRec->NeedToSync = FALSE; - -#ifdef XF86DRI ret = drmDropMaster(pI830->drmSubFD); if (ret) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "drmDropMaster failed: %s\n", strerror(ret)); -#endif + "drmDropMaster failed: %s\n", strerror(errno)); } /* @@ -3539,12 +3091,17 @@ I830EnterVT(int scrnIndex, int flags) DPRINTF(PFX, "Enter VT\n"); -#ifdef XF86DRI ret = drmSetMaster(pI830->drmSubFD); - if (ret) - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "drmDropMaster failed: %s\n", strerror(ret)); -#endif + if (ret) { + if (errno == EINVAL) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "drmSetMaster failed: 2.6.29 or newer kernel required for " + "multi-server DRI\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "drmSetMaster failed: %s\n", strerror(errno)); + } + } /* * Only save state once per server generation since that's what most @@ -3578,7 +3135,6 @@ I830EnterVT(int scrnIndex, int flags) if (!pI830->use_drm_mode) i830_disable_render_standby(pScrn); -#ifdef XF86DRI if (pI830->memory_manager && !pI830->use_drm_mode) { int ret; @@ -3589,7 +3145,6 @@ I830EnterVT(int scrnIndex, int flags) if (ret != 0) FatalError("DRM_I915_ENTERVT failed: %s\n", strerror(ret)); } -#endif /* XF86DRI */ if (!i830_bind_all_memory(pScrn)) return FALSE; @@ -3601,8 +3156,7 @@ I830EnterVT(int scrnIndex, int flags) intel_batch_init(pScrn); - if ((pI830->accel == ACCEL_EXA || pI830->accel == ACCEL_UXA) && - IS_I965G(pI830)) + if (pI830->accel == ACCEL_UXA && IS_I965G(pI830)) gen4_render_state_init(pScrn); if (!pI830->use_drm_mode) { @@ -3641,54 +3195,6 @@ I830EnterVT(int scrnIndex, int flags) i830DescribeOutputConfiguration(pScrn); } -#ifdef XF86DRI - if (pI830->directRenderingType == DRI_XF86DRI) { - /* HW status is fixed, we need to set it up before any drm - * operation which accessing that page, like irq install, etc. - */ - if (pI830->starting && !pI830->memory_manager) { - if (pI830->hw_status != NULL && !I830DRISetHWS(pScrn)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Fail to setup hardware status page.\n"); - I830DRICloseScreen(pScrn->pScreen); - return FALSE; - } - if (!pI830->memory_manager && !I830DRIInstIrqHandler(pScrn)) { - I830DRICloseScreen(pScrn->pScreen); - return FALSE; - } - } - - /* Update buffer offsets in sarea and mappings, since buffer offsets - * may have changed. - */ - if (!i830_update_dri_buffers(pScrn)) - FatalError("i830_update_dri_buffers() failed\n"); - - I830DRISetVBlankInterrupt (pScrn, TRUE); - - if (!pI830->starting) { - ScreenPtr pScreen = pScrn->pScreen; - drmI830Sarea *sarea = (drmI830Sarea *) DRIGetSAREAPrivate(pScreen); - int i; - - I830DRIResume(screenInfo.screens[scrnIndex]); - - if (!pI830->memory_manager) - i830_refresh_ring(pScrn); - I830Sync(pScrn); - - sarea->texAge++; - for(i = 0; i < I830_NR_TEX_REGIONS+1 ; i++) - sarea->texList[i].age = sarea->texAge; - - DPRINTF(PFX, "calling dri unlock\n"); - DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); - } - pI830->LockHeld = 0; - } -#endif - /* Set the hotkey to just notify us. We could check its results * periodically and attempt to do something, but it seems like we basically * never get results when we should, and this should all be better handled @@ -3718,9 +3224,6 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; I830Ptr pI830 = I830PTR(pScrn); -#ifdef I830_USE_XAA - XAAInfoRecPtr infoPtr = pI830->AccelInfoRec; -#endif pI830->closing = TRUE; @@ -3738,57 +3241,32 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen) vgaHWUnmapMem(pScrn); } - if (pI830->ScanlineColorExpandBuffers) { - xfree(pI830->ScanlineColorExpandBuffers); - pI830->ScanlineColorExpandBuffers = NULL; - } -#ifdef I830_USE_XAA - if (infoPtr) { - if (infoPtr->ScanlineColorExpandBuffers) - xfree(infoPtr->ScanlineColorExpandBuffers); - XAADestroyInfoRec(infoPtr); - pI830->AccelInfoRec = NULL; - } -#endif -#ifdef I830_USE_EXA - if (pI830->EXADriverPtr) { - exaDriverFini(pScreen); - xfree(pI830->EXADriverPtr); - pI830->EXADriverPtr = NULL; - } -#endif -#ifdef I830_USE_UXA if (pI830->uxa_driver) { uxa_driver_fini (pScreen); xfree (pI830->uxa_driver); pI830->uxa_driver = NULL; } -#endif + if (pI830->front_buffer) { + i830_set_pixmap_bo(pScreen->GetScreenPixmap(pScreen), NULL); + i830_free_memory(pScrn, pI830->front_buffer); + pI830->front_buffer = NULL; + } + xf86_cursors_fini (pScreen); i830_allocator_fini(pScrn); -#ifdef I830_XV i965_free_video(pScrn); -#endif + free(pI830->offscreenImages); + pI830->offscreenImages = NULL; dri_bufmgr_destroy(pI830->bufmgr); pI830->bufmgr = NULL; -#ifdef XF86DRI - if (pI830->directRenderingOpen && - pI830->directRenderingType == DRI_XF86DRI) { - pI830->directRenderingOpen = FALSE; - I830DRICloseScreen(pScreen); - } -#endif - -#ifdef DRI2 if (pI830->directRenderingOpen && pI830->directRenderingType == DRI_DRI2) { pI830->directRenderingOpen = FALSE; I830DRI2CloseScreen(pScreen); } -#endif xf86GARTCloseScreen(scrnIndex); @@ -3898,108 +3376,6 @@ i830_pipe_to_crtc(ScrnInfoPtr pScrn, int pipe) return NULL; } -#if 0 -/** - * This function is used for testing of the screen detect functions from the - * periodic timer. - */ -static void -i830MonitorDetectDebugger(ScrnInfoPtr pScrn) -{ - Bool found_crt; - I830Ptr pI830 = I830PTR(pScrn); - int start, finish, i; - - if (!pScrn->vtSema) - return 1000; - - for (i = 0; i < xf86_config->num_output; i++) { - enum output_status ret; - char *result; - - start = GetTimeInMillis(); - ret = pI830->output[i].detect(pScrn, &pI830->output[i]); - finish = GetTimeInMillis(); - - if (ret == OUTPUT_STATUS_CONNECTED) - result = "connected"; - else if (ret == OUTPUT_STATUS_DISCONNECTED) - result = "disconnected"; - else - result = "unknown"; - - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Detected SDVO as %s in %dms\n", - result, finish - start); - } -} -#endif - -void -i830WaitSync(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - switch (pI830->accel) { -#ifdef I830_USE_XAA - case ACCEL_XAA: - if (pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) { - (*pI830->AccelInfoRec->Sync)(pScrn); - pI830->AccelInfoRec->NeedToSync = FALSE; - } - break; -#endif -#ifdef I830_USE_EXA - case ACCEL_EXA: - if (pI830->EXADriverPtr) { - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; - exaWaitSync(pScreen); - } - break; -#endif -#ifdef I830_USE_UXA - case ACCEL_UXA: - if (pI830->uxa_driver && pI830->need_sync) { - pI830->need_sync = FALSE; - I830Sync(pScrn); - } - break; -#endif - default: - break; - } -} - -void -i830MarkSync(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - switch (pI830->accel) { -#ifdef I830_USE_XAA - case ACCEL_XAA: - if (pI830->AccelInfoRec) - pI830->AccelInfoRec->NeedToSync = TRUE; - break; -#endif -#ifdef I830_USE_EXA - case ACCEL_EXA: - if (pI830->EXADriverPtr) { - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; - exaMarkSync(pScreen); - } - break; -#endif -#ifdef I830_USE_UXA - case ACCEL_UXA: - if (pI830->uxa_driver) - pI830->need_sync = TRUE; - break; -#endif - default: - break; - } -} - void I830InitpScrn(ScrnInfoPtr pScrn) { diff --git a/src/i830_dvo.c b/src/i830_dvo.c index 832c7625..a0e80743 100644 --- a/src/i830_dvo.c +++ b/src/i830_dvo.c @@ -61,7 +61,7 @@ static const char *ch7017_symbols[] = { }; /* driver list */ -struct _I830DVODriver i830_dvo_drivers[] = +static struct _I830DVODriver i830_dvo_drivers[] = { { .type = I830_OUTPUT_DVO_TMDS, @@ -370,7 +370,7 @@ static const xf86OutputFuncsRec i830_dvo_output_funcs = { * Other chips with DVO LVDS will need to extend this to deal with the LVDS * chip being on DVOB/C and having multiple pipes. */ -DisplayModePtr +static DisplayModePtr i830_dvo_get_current_mode (xf86OutputPtr output) { ScrnInfoPtr pScrn = output->scrn; diff --git a/src/i830_exa.c b/src/i830_exa.c index 39011bc6..0a15de83 100644 --- a/src/i830_exa.c +++ b/src/i830_exa.c @@ -39,9 +39,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include <string.h> #include <sys/mman.h> -#define ALWAYS_SYNC 0 -#define ALWAYS_FLUSH 0 - const int I830CopyROP[16] = { ROP_0, /* GXclear */ @@ -82,21 +79,7 @@ const int I830PatternROP[16] = ROP_1 }; -#ifdef I830_USE_UXA static int uxa_pixmap_index; -#endif - -#ifndef SERVER_1_5 -static inline void *dixLookupPrivate(DevUnion **privates, int *key) -{ - return (*privates)[*key].ptr; -} - -static inline void dixSetPrivate(DevUnion **privates, int *key, void *val) -{ - (*privates)[*key].ptr = val; -} -#endif /** * Returns whether a given pixmap is tiled or not. @@ -168,44 +151,11 @@ i830_pixmap_pitch_is_aligned(PixmapPtr pixmap) return i830_pixmap_pitch(pixmap) % pI830->accel_pixmap_pitch_alignment == 0; } -static Bool -i830_exa_pixmap_is_offscreen(PixmapPtr pPixmap) -{ - ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - - if ((void *)pPixmap->devPrivate.ptr >= (void *)pI830->FbBase && - (void *)pPixmap->devPrivate.ptr < - (void *)(pI830->FbBase + pI830->FbMapSize)) - { - return TRUE; - } else { - return FALSE; - } -} - -/** - * I830EXASync - wait for a command to finish - * @pScreen: current screen - * @marker: marker command to wait for - * - * Wait for the command specified by @marker to finish, then return. We don't - * actually do marker waits, though we might in the future. For now, just - * wait for a full idle. - */ -static void -I830EXASync(ScreenPtr pScreen, int marker) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - - I830Sync(pScrn); -} - /** - * I830EXAPrepareSolid - prepare for a Solid operation, if possible + * Sets up hardware state for a series of solid fills. */ static Bool -I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) +i830_uxa_prepare_solid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) { ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); @@ -215,7 +165,7 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) i830_get_pixmap_bo(pPixmap), }; - if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planemask)) + if (!UXA_PM_IS_SOLID(&pPixmap->drawable, planemask)) I830FALLBACK("planemask is not solid"); if (pPixmap->drawable.bitsPerPixel == 24) @@ -252,7 +202,7 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) } static void -I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2) +i830_uxa_solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2) { ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); @@ -287,18 +237,11 @@ I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2) } static void -I830EXADoneSolid(PixmapPtr pPixmap) +i830_uxa_done_solid(PixmapPtr pPixmap) { -#if ALWAYS_SYNC || ALWAYS_FLUSH ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; -#if ALWAYS_FLUSH - intel_batch_flush(pScrn, FALSE); -#endif -#if ALWAYS_SYNC - I830Sync(pScrn); -#endif -#endif + i830_debug_sync(pScrn); } /** @@ -306,8 +249,8 @@ I830EXADoneSolid(PixmapPtr pPixmap) * - support planemask using FULL_BLT_CMD? */ static Bool -I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, - int ydir, int alu, Pixel planemask) +i830_uxa_prepare_copy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, + int ydir, int alu, Pixel planemask) { ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); @@ -317,7 +260,7 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, i830_get_pixmap_bo(pDstPixmap), }; - if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask)) + if (!UXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask)) I830FALLBACK("planemask is not solid"); if (pDstPixmap->drawable.bitsPerPixel < 8) @@ -347,8 +290,8 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, } static void -I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1, - int dst_y1, int w, int h) +i830_uxa_copy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1, + int dst_y1, int w, int h) { ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); @@ -399,18 +342,11 @@ I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1, } static void -I830EXADoneCopy(PixmapPtr pDstPixmap) +i830_uxa_done_copy(PixmapPtr pDstPixmap) { -#if ALWAYS_SYNC || ALWAYS_FLUSH ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum]; -#if ALWAYS_FLUSH - intel_batch_flush(pScrn, FALSE); -#endif -#if ALWAYS_SYNC - I830Sync(pScrn); -#endif -#endif + i830_debug_sync(pScrn); } @@ -422,16 +358,9 @@ I830EXADoneCopy(PixmapPtr pDstPixmap) void i830_done_composite(PixmapPtr pDst) { -#if ALWAYS_SYNC || ALWAYS_FLUSH ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; -#if ALWAYS_FLUSH - intel_batch_flush(pScrn, FALSE); -#endif -#if ALWAYS_SYNC - I830Sync(pScrn); -#endif -#endif + i830_debug_sync(pScrn); } #define xFixedToFloat(val) \ @@ -517,267 +446,6 @@ i830_transform_is_affine (PictTransformPtr t) return t->matrix[2][0] == 0 && t->matrix[2][1] == 0; } -#ifdef XF86DRM_MODE - -static void * -I830EXACreatePixmap(ScreenPtr screen, int size, int align) -{ - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; - I830Ptr i830 = I830PTR(scrn); - struct i830_exa_pixmap_priv *new_priv; - - new_priv = xcalloc(1, sizeof(struct i830_exa_pixmap_priv)); - if (!new_priv) - return NULL; - - if (size == 0) - return new_priv; - - new_priv->bo = dri_bo_alloc(i830->bufmgr, "pixmap", size, - i830->accel_pixmap_offset_alignment); - if (!new_priv->bo) { - xfree(new_priv); - return NULL; - } - - return new_priv; -} - -static void -I830EXADestroyPixmap(ScreenPtr pScreen, void *driverPriv) -{ - struct i830_exa_pixmap_priv *priv = driverPriv; - - if (priv->bo) - dri_bo_unreference(priv->bo); - xfree(priv); -} - -static Bool I830EXAPixmapIsOffscreen(PixmapPtr pPix) -{ - struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix); - - if (driver_priv && driver_priv->bo) - return TRUE; - - return FALSE; -} - -static Bool I830EXAPrepareAccess(PixmapPtr pPix, int index) -{ - ScreenPtr screen = pPix->drawable.pScreen; - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; - I830Ptr i830 = I830PTR(scrn); - struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix); - - if (!driver_priv) { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no driver private?\n", - __FUNCTION__); - return FALSE; - } - - if (!driver_priv->bo) { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no buffer object?\n", - __FUNCTION__); - return TRUE; - } - - intel_batch_flush(scrn, FALSE); - if (i830->need_sync) { - I830Sync(scrn); - i830->need_sync = FALSE; - } - if (drm_intel_gem_bo_map_gtt(driver_priv->bo)) { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: bo map failed\n", - __FUNCTION__); - return FALSE; - } - pPix->devPrivate.ptr = driver_priv->bo->virtual; - - return TRUE; -} - -static void I830EXAFinishAccess(PixmapPtr pPix, int index) -{ - ScreenPtr screen = pPix->drawable.pScreen; - ScrnInfoPtr scrn = xf86Screens[screen->myNum]; - I830Ptr i830 = I830PTR(scrn); - struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix); - - if (!driver_priv) { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no driver private?\n", - __FUNCTION__); - return; - } - - if (!driver_priv->bo) { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: no buffer object?\n", - __FUNCTION__); - return; - } - - dri_bo_unmap(driver_priv->bo); - pPix->devPrivate.ptr = NULL; - if (driver_priv->bo == i830->front_buffer->bo) - i830->need_flush = TRUE; -} - -static Bool I830EXAModifyPixmapHeader(PixmapPtr pPix, int width, int height, - int depth, int bitsPerPixel, int devKind, - pointer pPixData) -{ - ScreenPtr pScreen = pPix->drawable.pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - struct i830_exa_pixmap_priv *driver_priv = exaGetPixmapDriverPrivate(pPix); - - if (!driver_priv) - return FALSE; - - if (pI830->use_drm_mode && - drmmode_is_rotate_pixmap(pScrn, pPixData, &driver_priv->bo)) { - /* this is a rotate pixmap */ - dri_bo_unmap(driver_priv->bo); - dri_bo_reference(driver_priv->bo); - miModifyPixmapHeader(pPix, width, height, depth, - bitsPerPixel, devKind, NULL); - } - - if (pPixData == pI830->FbBase + pScrn->fbOffset) { - if (driver_priv->bo) - dri_bo_unreference(driver_priv->bo); - driver_priv->bo = - intel_bo_gem_create_from_name(pI830->bufmgr, "front", - pI830->front_buffer->gem_name); - if (!driver_priv->bo) - return FALSE; - - miModifyPixmapHeader(pPix, width, height, depth, - bitsPerPixel, devKind, NULL); - - return TRUE; - } - return FALSE; -} - -#endif /* XF86DRM_MODE */ - -Bool -I830EXAInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - - pI830->EXADriverPtr = exaDriverAlloc(); - if (pI830->EXADriverPtr == NULL) { - pI830->accel = ACCEL_NONE; - return FALSE; - } - memset(pI830->EXADriverPtr, 0, sizeof(*pI830->EXADriverPtr)); - - pI830->bufferOffset = 0; - pI830->EXADriverPtr->exa_major = 2; - /* If compiled against EXA 2.2, require 2.2 so we can use the - * PixmapIsOffscreen hook. - */ -#if EXA_VERSION_MINOR >= 2 - pI830->EXADriverPtr->exa_minor = 2; -#else - pI830->EXADriverPtr->exa_minor = 1; - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "EXA compatibility mode. Output rotation rendering " - "performance may suffer\n"); -#endif - if (!pI830->use_drm_mode) { - pI830->EXADriverPtr->memoryBase = pI830->FbBase; - if (pI830->exa_offscreen) { - pI830->EXADriverPtr->offScreenBase = pI830->exa_offscreen->offset; - pI830->EXADriverPtr->memorySize = pI830->exa_offscreen->offset + - pI830->exa_offscreen->size; - } else { - pI830->EXADriverPtr->offScreenBase = pI830->FbMapSize; - pI830->EXADriverPtr->memorySize = pI830->FbMapSize; - } - pI830->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS; - } else { -#ifdef XF86DRM_MODE - pI830->EXADriverPtr->flags = EXA_OFFSCREEN_PIXMAPS | EXA_HANDLES_PIXMAPS; - pI830->EXADriverPtr->PrepareAccess = I830EXAPrepareAccess; - pI830->EXADriverPtr->FinishAccess = I830EXAFinishAccess; -#if EXA_VERSION_MINOR >= 4 - pI830->EXADriverPtr->CreatePixmap = I830EXACreatePixmap; - pI830->EXADriverPtr->DestroyPixmap = I830EXADestroyPixmap; - pI830->EXADriverPtr->PixmapIsOffscreen = I830EXAPixmapIsOffscreen; - pI830->EXADriverPtr->ModifyPixmapHeader = I830EXAModifyPixmapHeader; -#endif -#endif /* XF86DRM_MODE */ - } - - DPRINTF(PFX, "EXA Mem: memoryBase 0x%x, end 0x%x, offscreen base 0x%x, " - "memorySize 0x%x\n", - pI830->EXADriverPtr->memoryBase, - pI830->EXADriverPtr->memoryBase + pI830->EXADriverPtr->memorySize, - pI830->EXADriverPtr->offScreenBase, - pI830->EXADriverPtr->memorySize); - - pI830->EXADriverPtr->pixmapOffsetAlign = pI830->accel_pixmap_offset_alignment; - pI830->EXADriverPtr->pixmapPitchAlign = pI830->accel_pixmap_pitch_alignment; - pI830->EXADriverPtr->maxX = pI830->accel_max_x; - pI830->EXADriverPtr->maxY = pI830->accel_max_y; - - /* Sync */ - pI830->EXADriverPtr->WaitMarker = I830EXASync; - - /* Solid fill */ - pI830->EXADriverPtr->PrepareSolid = I830EXAPrepareSolid; - pI830->EXADriverPtr->Solid = I830EXASolid; - pI830->EXADriverPtr->DoneSolid = I830EXADoneSolid; - - /* Copy */ - pI830->EXADriverPtr->PrepareCopy = I830EXAPrepareCopy; - pI830->EXADriverPtr->Copy = I830EXACopy; - pI830->EXADriverPtr->DoneCopy = I830EXADoneCopy; - - /* Composite */ - if (!IS_I9XX(pI830)) { - pI830->EXADriverPtr->CheckComposite = i830_check_composite; - pI830->EXADriverPtr->PrepareComposite = i830_prepare_composite; - pI830->EXADriverPtr->Composite = i830_composite; - pI830->EXADriverPtr->DoneComposite = i830_done_composite; - } else if (IS_I915G(pI830) || IS_I915GM(pI830) || - IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830)) - { - pI830->EXADriverPtr->CheckComposite = i915_check_composite; - pI830->EXADriverPtr->PrepareComposite = i915_prepare_composite; - pI830->EXADriverPtr->Composite = i915_composite; - pI830->EXADriverPtr->DoneComposite = i830_done_composite; - } else { - pI830->EXADriverPtr->CheckComposite = i965_check_composite; - pI830->EXADriverPtr->PrepareComposite = i965_prepare_composite; - pI830->EXADriverPtr->Composite = i965_composite; - pI830->EXADriverPtr->DoneComposite = i830_done_composite; - } -#if EXA_VERSION_MINOR >= 2 - if (!pI830->use_drm_mode) - pI830->EXADriverPtr->PixmapIsOffscreen = i830_exa_pixmap_is_offscreen; -#endif - - if(!exaDriverInit(pScreen, pI830->EXADriverPtr)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "EXA initialization failed; trying older version\n"); - pI830->EXADriverPtr->exa_minor = 0; - if(!exaDriverInit(pScreen, pI830->EXADriverPtr)) { - xfree(pI830->EXADriverPtr); - pI830->accel = ACCEL_NONE; - return FALSE; - } - } - - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - - return TRUE; -} - dri_bo * i830_get_pixmap_bo(PixmapPtr pixmap) { @@ -785,20 +453,10 @@ i830_get_pixmap_bo(PixmapPtr pixmap) ScrnInfoPtr scrn = xf86Screens[screen->myNum]; I830Ptr i830 = I830PTR(scrn); -#ifdef I830_USE_UXA - if (i830->accel == ACCEL_UXA) { + if (i830->accel == ACCEL_UXA) return dixLookupPrivate(&pixmap->devPrivates, &uxa_pixmap_index); - } -#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; + else + return NULL; } void @@ -810,24 +468,12 @@ i830_set_pixmap_bo(PixmapPtr pixmap, dri_bo *bo) if (old_bo) dri_bo_unreference (old_bo); -#if I830_USE_UXA if (i830->accel == ACCEL_UXA) { - dri_bo_reference(bo); - dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo); - } -#endif -#ifdef XF86DRM_MODE - if (i830->accel == ACCEL_EXA) { - struct i830_exa_pixmap_priv *driver_priv = - exaGetPixmapDriverPrivate(pixmap); - if (driver_priv) { + if (bo != NULL) dri_bo_reference(bo); - driver_priv->bo = bo; - } + dixSetPrivate(&pixmap->devPrivates, &uxa_pixmap_index, bo); } -#endif } -#if defined(I830_USE_UXA) static void i830_uxa_set_pixmap_bo (PixmapPtr pixmap, dri_bo *bo) @@ -846,11 +492,6 @@ i830_uxa_prepare_access (PixmapPtr pixmap, uxa_access_t access) I830Ptr i830 = I830PTR(scrn); intel_batch_flush(scrn, FALSE); - /* XXX: dri_bo_map should handle syncing for us, what's the deal? */ - if (i830->need_sync) { - I830Sync(scrn); - i830->need_sync = FALSE; - } /* No VT sema or GEM? No GTT mapping. */ if (!scrn->vtSema || !i830->memory_manager) { @@ -941,11 +582,7 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag if (w > 32767 || h > 32767) return NullPixmap; -#ifdef SERVER_1_5 pixmap = fbCreatePixmap (screen, 0, 0, depth, usage); -#else - pixmap = fbCreatePixmap (screen, 0, 0, depth); -#endif if (w && h) { @@ -990,18 +627,6 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag return pixmap; } - -#ifndef SERVER_1_5 -static PixmapPtr -i830_uxa_server_14_create_pixmap (ScreenPtr screen, int w, int h, int depth) -{ - /* For server pre-1.6, we're never allocating DRI2 buffers, so no need for - * a hint. - */ - return i830_uxa_create_pixmap(screen, w, h, depth, 0); -} -#endif - static Bool i830_uxa_destroy_pixmap (PixmapPtr pixmap) { @@ -1034,13 +659,8 @@ i830_uxa_init (ScreenPtr pScreen) ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; I830Ptr i830 = I830PTR(scrn); -#ifdef SERVER_1_5 if (!dixRequestPrivate(&uxa_pixmap_index, 0)) return FALSE; -#else - if (!AllocatePixmapPrivate(pScreen, uxa_pixmap_index, 0)) - return FALSE; -#endif i830->uxa_driver = uxa_driver_alloc(); if (i830->uxa_driver == NULL) { @@ -1054,14 +674,14 @@ i830_uxa_init (ScreenPtr pScreen) i830->uxa_driver->uxa_minor = 0; /* Solid fill */ - i830->uxa_driver->prepare_solid = I830EXAPrepareSolid; - i830->uxa_driver->solid = I830EXASolid; - i830->uxa_driver->done_solid = I830EXADoneSolid; + i830->uxa_driver->prepare_solid = i830_uxa_prepare_solid; + i830->uxa_driver->solid = i830_uxa_solid; + i830->uxa_driver->done_solid = i830_uxa_done_solid; /* Copy */ - i830->uxa_driver->prepare_copy = I830EXAPrepareCopy; - i830->uxa_driver->copy = I830EXACopy; - i830->uxa_driver->done_copy = I830EXADoneCopy; + i830->uxa_driver->prepare_copy = i830_uxa_prepare_copy; + i830->uxa_driver->copy = i830_uxa_copy; + i830->uxa_driver->done_copy = i830_uxa_done_copy; /* Composite */ if (!IS_I9XX(i830)) { @@ -1095,33 +715,10 @@ i830_uxa_init (ScreenPtr pScreen) return FALSE; } -#ifdef SERVER_1_5 pScreen->CreatePixmap = i830_uxa_create_pixmap; -#else - pScreen->CreatePixmap = i830_uxa_server_14_create_pixmap; -#endif pScreen->DestroyPixmap = i830_uxa_destroy_pixmap; - I830SelectBuffer(scrn, I830_SELECT_FRONT); - uxa_set_fallback_debug(pScreen, i830->fallback_debug); return TRUE; } -#endif /* I830_USE_UXA */ - -#ifdef XF86DRI - -#ifndef ExaOffscreenMarkUsed -extern void ExaOffscreenMarkUsed(PixmapPtr); -#endif - -unsigned long long -I830TexOffsetStart(PixmapPtr pPix) -{ - exaMoveInPixmap(pPix); - ExaOffscreenMarkUsed(pPix); - - return exaGetPixmapOffset(pPix); -} -#endif diff --git a/src/i830_hwmc.c b/src/i830_hwmc.c index e33a15de..ecefb5b5 100644 --- a/src/i830_hwmc.c +++ b/src/i830_hwmc.c @@ -35,7 +35,7 @@ struct intel_xvmc_driver *xvmc_driver; /* set global current driver for xvmc */ -Bool intel_xvmc_set_driver(struct intel_xvmc_driver *d) +static Bool intel_xvmc_set_driver(struct intel_xvmc_driver *d) { if (xvmc_driver) { ErrorF("XvMC driver already set!\n"); diff --git a/src/i830_hwmc.h b/src/i830_hwmc.h index 72208d53..41f64413 100644 --- a/src/i830_hwmc.h +++ b/src/i830_hwmc.h @@ -101,7 +101,6 @@ extern struct intel_xvmc_driver *xvmc_driver; extern struct intel_xvmc_driver i915_xvmc_driver; extern struct intel_xvmc_driver i965_xvmc_driver; -extern Bool intel_xvmc_set_driver(struct intel_xvmc_driver *); extern Bool intel_xvmc_probe(ScrnInfoPtr); extern Bool intel_xvmc_driver_init(ScreenPtr, XF86VideoAdaptorPtr); extern Bool intel_xvmc_screen_init(ScreenPtr); diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 7fc0bcec..064810f6 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -207,12 +207,8 @@ i830_lvds_set_backlight_legacy(xf86OutputPtr output, int level) ScrnInfoPtr pScrn = output->scrn; I830Ptr pI830 = I830PTR(pScrn); -#if XSERVER_LIBPCIACCESS pci_device_cfg_write_u8(pI830->PciInfo, level, LEGACY_BACKLIGHT_BRIGHTNESS); -#else - pciWriteByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS, level); -#endif } static int @@ -222,11 +218,7 @@ i830_lvds_get_backlight_legacy(xf86OutputPtr output) I830Ptr pI830 = I830PTR(pScrn); uint8_t lbb; -#if XSERVER_LIBPCIACCESS pci_device_cfg_read_u8(pI830->PciInfo, &lbb, LEGACY_BACKLIGHT_BRIGHTNESS); -#else - lbb = pciReadByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS); -#endif return lbb; } @@ -242,22 +234,14 @@ i830_lvds_set_backlight_combo(xf86OutputPtr output, int level) uint32_t blc_pwm_ctl; uint8_t lbb; -#if XSERVER_LIBPCIACCESS pci_device_cfg_read_u8(pI830->PciInfo, &lbb, LEGACY_BACKLIGHT_BRIGHTNESS); -#else - lbb = pciReadByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS); -#endif /* * If LBB is zero and we're shooting for a non-zero brightness level, * we have to increase LBB by at least 1. */ if (!lbb && level) { -#if XSERVER_LIBPCIACCESS pci_device_cfg_write_u8(pI830->PciInfo, 1, LEGACY_BACKLIGHT_BRIGHTNESS); -#else - pciWriteByte(pI830->PciTag, LEGACY_BACKLIGHT_BRIGHTNESS, 1); -#endif } /* diff --git a/src/i830_memory.c b/src/i830_memory.c index d3138d94..52ec872b 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -64,19 +64,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - Ring buffer * - HW cursor block (either one block or four) * - Overlay registers - * - XAA linear allocator (optional) - * - XAA scratch (screen 1) - * - XAA scratch (screen 2, only in zaphod mode) - * - Front buffer (screen 1, more is better for XAA) - * - Front buffer (screen 2, only in zaphod mode, more is better for XAA) + * - Front buffer (screen 1) + * - Front buffer (screen 2, only in zaphod mode) * - Back/depth buffer (3D only) * - Compatibility texture pool (optional, more is always better) * - New texture pool (optional, more is always better. aperture allocation * only) - * - EXA offscreen pool (more is always better) - * - * We also want to be able to resize the front/back/depth buffers, and then - * resize the EXA and texture memory pools appropriately. * * The user may request a specific amount of memory to be used * (pI830->pEnt->videoRam != 0), in which case allocations have to fit within @@ -107,9 +100,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "i830.h" #include "i810_reg.h" -#ifdef XF86DRI #include "i915_drm.h" -#endif #define ALIGN(i,m) (((i) + (m) - 1) & ~((m) - 1)) @@ -185,7 +176,7 @@ i830_get_fence_pitch(I830Ptr pI830, unsigned long pitch, int format) * On some chips, pitch width has to be a power of two tile width, so * calculate that here. */ -unsigned long +static unsigned long i830_get_fence_alignment(I830Ptr pI830, unsigned long size) { if (IS_I965G(pI830)) @@ -225,7 +216,6 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem) if (mem == NULL || mem->bound) return TRUE; -#ifdef XF86DRI if (mem->bo != NULL) { if (dri_bo_pin(mem->bo, mem->alignment) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -238,7 +228,6 @@ i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem) mem->offset = mem->bo->offset; mem->end = mem->offset + mem->size; } -#endif if (!mem->bound) { if (!pI830->gtt_acquired) @@ -274,7 +263,6 @@ i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem) !pI830->kernel_exec_fencing) i830_clear_tiling(pScrn, mem->fence_nr); -#ifdef XF86DRI if (mem->bo != NULL) { if (dri_bo_unpin(mem->bo) == 0) { mem->bound = FALSE; @@ -286,7 +274,6 @@ i830_unbind_memory(ScrnInfoPtr pScrn, i830_memory *mem) return FALSE; } } -#endif if (mem->key == -1 || xf86UnbindGARTMemory(pScrn->scrnIndex, mem->key)) { mem->bound = FALSE; @@ -305,7 +292,6 @@ i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem) /* Free any AGP memory. */ i830_unbind_memory(pScrn, mem); -#ifdef XF86DRI if (mem->bo != NULL) { I830Ptr pI830 = I830PTR(pScrn); dri_bo_unreference (mem->bo); @@ -323,7 +309,6 @@ i830_free_memory(ScrnInfoPtr pScrn, i830_memory *mem) xfree(mem); return; } -#endif /* Disconnect from the list of allocations */ if (mem->prev != NULL) mem->prev->next = mem->next; @@ -352,14 +337,12 @@ i830_reset_allocations(ScrnInfoPtr pScrn) while (pI830->memory_list->next->next != NULL) { i830_memory *mem = pI830->memory_list->next; -#ifdef XF86DRI /* Don't reset BO allocator, which we set up at init. */ if (pI830->memory_manager == mem) { mem = mem->next; if (mem->next == NULL) break; } -#endif i830_free_memory(pScrn, mem); } @@ -379,34 +362,12 @@ i830_reset_allocations(ScrnInfoPtr pScrn) pI830->cursor_mem_argb[p] = NULL; } pI830->front_buffer = NULL; - pI830->xaa_scratch = NULL; - pI830->exa_offscreen = NULL; pI830->overlay_regs = NULL; pI830->power_context = NULL; -#ifdef XF86DRI - pI830->back_buffer = NULL; - pI830->depth_buffer = NULL; - pI830->textures = NULL; -#endif pI830->ring.mem = NULL; pI830->fake_bufmgr_mem = NULL; } -void -i830_free_3d_memory(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - -#ifdef XF86DRI - i830_free_memory(pScrn, pI830->back_buffer); - pI830->back_buffer = NULL; - i830_free_memory(pScrn, pI830->depth_buffer); - pI830->depth_buffer = NULL; - i830_free_memory(pScrn, pI830->textures); - pI830->textures = NULL; -#endif -} - /** * Initialize's the driver's video memory allocator to allocate in the * given range. @@ -421,13 +382,9 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size) { I830Ptr pI830 = I830PTR(pScrn); i830_memory *start, *end; -#ifdef XF86DRI - int dri_major, dri_minor, dri_patch; struct drm_i915_getparam gp; struct drm_i915_setparam sp; int has_gem; - int has_dri; -#endif start = xcalloc(1, sizeof(*start)); if (start == NULL) @@ -464,18 +421,9 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size) pI830->memory_list = start; -#ifdef XF86DRI has_gem = FALSE; - has_dri = FALSE; - - if (pI830->directRenderingType == DRI_XF86DRI && - xf86LoaderCheckSymbol ("DRIQueryVersion")) - { - DRIQueryVersion(&dri_major, &dri_minor, &dri_patch); - has_dri = TRUE; - } - if (pI830->directRenderingType >= DRI_XF86DRI) + if (pI830->directRenderingType >= DRI_DRI2) { has_gem = FALSE; gp.param = I915_PARAM_HAS_GEM; @@ -490,10 +438,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size) * 5.4 or newer so we can rely on the lock being held after DRIScreenInit, * rather than after DRIFinishScreenInit. */ - if ((pI830->directRenderingType == DRI_XF86DRI && has_gem && has_dri && - (dri_major > 5 || (dri_major == 5 && dri_minor >= 4))) || - (pI830->directRenderingType == DRI_DRI2 && has_gem)) - { + if (pI830->directRenderingType == DRI_DRI2 && has_gem) { int mmsize; /* Take over all of the graphics aperture minus enough to for @@ -501,11 +446,6 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size) */ mmsize = size; - /* EXA area is fixed. */ - if (pI830->accel == ACCEL_EXA) { - mmsize -= ROUND_TO_PAGE(3 * pScrn->displayWidth * pI830->cpp * - pScrn->virtualY); - } /* Overlay and cursors, if physical, need to be allocated outside * of the kernel memory manager. */ @@ -562,10 +502,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size) i830_free_memory(pScrn, pI830->memory_manager); pI830->memory_manager = NULL; } - } else { - pI830->allocate_classic_textures = TRUE; } -#endif /* XF86DRI */ return TRUE; } @@ -580,7 +517,6 @@ i830_allocator_fini(ScrnInfoPtr pScrn) /* The memory manager is more special */ if (pI830->memory_manager) { - /* XXX drmMMTakedown(pI830->drmSubFD, DRM_BO_MEM_TT);*/ i830_free_memory(pScrn, pI830->memory_manager); pI830->memory_manager = NULL; } @@ -798,7 +734,6 @@ i830_allocate_agp_memory(ScrnInfoPtr pScrn, i830_memory *mem, int flags) return TRUE; } -#ifdef XF86DRI static i830_memory * i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name, unsigned long size, unsigned long pitch, @@ -886,7 +821,6 @@ i830_allocate_memory_bo(ScrnInfoPtr pScrn, const char *name, return mem; } -#endif /* XF86DRI */ /* Allocates video memory at the given size, pitch, alignment and tile format. * @@ -913,9 +847,7 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name, enum tile_format tile_format) { i830_memory *mem; -#ifdef XF86DRI I830Ptr pI830 = I830PTR(pScrn); -#endif /* Manage tile alignment and size constraints */ if (tile_format != TILE_NONE) { @@ -935,14 +867,12 @@ i830_allocate_memory(ScrnInfoPtr pScrn, const char *name, size = i830_get_fence_size(pI830, size); alignment = i830_get_fence_alignment(pI830, size); } -#ifdef XF86DRI if (pI830->use_drm_mode || (pI830->memory_manager && !(flags & NEED_PHYSICAL_ADDR) && !(flags & NEED_LIFETIME_FIXED))) { return i830_allocate_memory_bo(pScrn, name, size, pitch, alignment, flags, tile_format); } else -#endif /* XF86DRI */ { mem = i830_allocate_aperture(pScrn, name, size, pitch, alignment, flags, tile_format); if (mem == NULL) @@ -1065,13 +995,12 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn) } pI830->ring.tail_mask = pI830->ring.mem->size - 1; + pI830->ring.virtual_start = pI830->FbBase + pI830->ring.mem->offset; return TRUE; } -#ifdef I830_XV /** - * Allocate space for overlay registers and XAA linear allocator (if - * requested) + * Allocate space for overlay registers. */ static Bool i830_allocate_overlay(ScrnInfoPtr pScrn) @@ -1107,7 +1036,6 @@ i830_allocate_overlay(ScrnInfoPtr pScrn) return TRUE; } -#endif static Bool IsTileable(ScrnInfoPtr pScrn, int pitch) @@ -1143,13 +1071,6 @@ IsTileable(ScrnInfoPtr pScrn, int pitch) } } -/* This is the 2D rendering vertical coordinate limit. We can ignore - * the 3D rendering limits in our 2d pixmap cache allocation, because XAA - * doesn't do any 3D rendering to/from the cache lines when using an offset - * at the start of framebuffer. - */ -#define MAX_2D_HEIGHT 65536 - /** * Allocates a framebuffer for a screen. * @@ -1162,7 +1083,6 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn) I830Ptr pI830 = I830PTR(pScrn); unsigned int pitch = pScrn->displayWidth * pI830->cpp; unsigned long minspace, avail; - int cacheLines, maxCacheLines; int align; long size, fb_height; int flags; @@ -1175,75 +1095,18 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn) * rotation. */ fb_height = pScrn->virtualY; - if (!pI830->can_resize) - { - if (!pI830->use_drm_mode && pScrn->virtualX > pScrn->virtualY) - fb_height = pScrn->virtualX; - else - fb_height = pScrn->virtualY; - } - - pI830->FbMemBox.x1 = 0; - pI830->FbMemBox.x2 = pScrn->displayWidth; - pI830->FbMemBox.y1 = 0; - pI830->FbMemBox.y2 = fb_height; /* Calculate how much framebuffer memory to allocate. For the * initial allocation, calculate a reasonable minimum. This is - * enough for the virtual screen size, plus some pixmap cache - * space if we're using XAA. + * enough for the virtual screen size. */ minspace = pitch * pScrn->virtualY; avail = pScrn->videoRam * 1024; - if (pI830->accel == ACCEL_XAA) { - maxCacheLines = (avail - minspace) / pitch; - /* This shouldn't happen. */ - if (maxCacheLines < 0) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Internal Error: " - "maxCacheLines < 0 in i830_allocate_2d_memory()\n"); - maxCacheLines = 0; - } - if (maxCacheLines > (MAX_2D_HEIGHT - pScrn->virtualY)) - maxCacheLines = MAX_2D_HEIGHT - pScrn->virtualY; - - if (pI830->CacheLines >= 0) { - cacheLines = pI830->CacheLines; - } else { - int size; - - size = 3 * pitch * pScrn->virtualY; - size = ROUND_TO_PAGE(size); - - cacheLines = (size + pitch - 1) / pitch; - } - if (cacheLines > maxCacheLines) - cacheLines = maxCacheLines; - - pI830->FbMemBox.y2 += cacheLines; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Allocating %d scanlines for pixmap cache\n", - cacheLines); - } else { - /* For non-XAA, we have a separate allocation for the linear allocator - * which also does the pixmap cache. - */ - cacheLines = 0; - } + size = ROUND_TO_PAGE(pitch * fb_height); - size = pitch * (fb_height + cacheLines); - size = ROUND_TO_PAGE(size); - - /* Front buffer tiling has to be disabled with G965 XAA because some of the - * acceleration operations (non-XY COLOR_BLT) can't be done to tiled - * buffers. - */ if (pI830->tiling) tile_format = TILE_XMAJOR; - if (pI830->accel == ACCEL_XAA && IS_I965G(pI830)) - tile_format = TILE_NONE; if (!IsTileable(pScrn, pitch)) tile_format = TILE_NONE; @@ -1273,7 +1136,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn) return NULL; } - if (!pI830->use_drm_mode && pI830->FbBase) + if (!pI830->use_drm_mode && pI830->FbBase && front_buffer->bound) memset (pI830->FbBase + front_buffer->offset, 0, size); return front_buffer; @@ -1410,8 +1273,6 @@ Bool i830_allocate_2d_memory(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - unsigned int pitch = pScrn->displayWidth * pI830->cpp; - long size; if (!pI830->use_drm_mode) { if (!xf86AgpGARTSupported() || !xf86AcquireGART(pScrn->scrnIndex)) { @@ -1448,232 +1309,13 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn) } } -#ifdef I830_XV - /* Allocate overlay register space and optional XAA linear allocator - * space. The second head in zaphod mode will share the space. - */ if (!pI830->use_drm_mode) i830_allocate_overlay(pScrn); -#endif pI830->front_buffer = i830_allocate_framebuffer(pScrn); if (pI830->front_buffer == NULL) return FALSE; -#ifdef I830_USE_EXA - if (pI830->accel == ACCEL_EXA && !pI830->use_drm_mode) { - if (pI830->exa_offscreen == NULL) { - /* Default EXA to having 3 screens worth of offscreen memory space - * (for pixmaps). - * - * XXX: It would be nice to auto-size it larger if the user - * specified a larger size, or to fit along with texture and FB - * memory if a low videoRam is specified. - */ - size = 3 * pitch * pScrn->virtualY; - size = ROUND_TO_PAGE(size); - - /* EXA has no way to tell it that the offscreen memory manager has - * moved its base and all the contents with it, so we have to have - * it locked in place for the whole driver instance. - */ - pI830->exa_offscreen = - i830_allocate_memory(pScrn, "exa offscreen", - size, PITCH_NONE, 1, NEED_LIFETIME_FIXED, - TILE_NONE); - if (pI830->exa_offscreen == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to allocate EXA offscreen memory.\n"); - return FALSE; - } - } - } -#endif /* I830_USE_EXA */ - - if (pI830->accel == ACCEL_XAA) { - /* The lifetime fixed offset of xaa scratch is probably not required, - * but we do some setup using it at XAAInit() time. And XAA may not - * end up being supported with GEM anyway. - */ - pI830->xaa_scratch = - i830_allocate_memory(pScrn, "xaa scratch", MAX_SCRATCH_BUFFER_SIZE, - PITCH_NONE, GTT_PAGE_SIZE, NEED_LIFETIME_FIXED, - TILE_NONE); - if (pI830->xaa_scratch == NULL) { - pI830->xaa_scratch = - i830_allocate_memory(pScrn, "xaa scratch", - MIN_SCRATCH_BUFFER_SIZE, PITCH_NONE, - GTT_PAGE_SIZE, NEED_LIFETIME_FIXED, - TILE_NONE); - if (pI830->xaa_scratch == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to allocate scratch buffer space\n"); - return FALSE; - } - } - } - - return TRUE; -} - -#ifdef XF86DRI -static unsigned int -myLog2(unsigned int n) -{ - unsigned int log2 = 1; - - while (n > 1) { - n >>= 1; - log2++; - } - return log2; -} - -static Bool -i830_allocate_backbuffer(ScrnInfoPtr pScrn, i830_memory **buffer, - const char *name) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned int pitch = pScrn->displayWidth * pI830->cpp; - unsigned long size; - int height; - enum tile_format tile_format = TILE_NONE;; - - if (pI830->rotation & (RR_Rotate_0 | RR_Rotate_180)) - height = pScrn->virtualY; - else - height = pScrn->virtualX; - - /* Try to allocate on the best tile-friendly boundaries. */ - if (pI830->tiling && IsTileable(pScrn, pitch)) - { - size = ROUND_TO_PAGE(pitch * ALIGN(height, 16)); - tile_format = TILE_XMAJOR; - } - else - { - size = ROUND_TO_PAGE(pitch * height); - tile_format = TILE_NONE; - } - *buffer = i830_allocate_memory(pScrn, name, size, pitch, - GTT_PAGE_SIZE, - ALIGN_BOTH_ENDS | - ALLOW_SHARING, - tile_format); - - if (*buffer == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to allocate %s space.\n", name); - return FALSE; - } - - return TRUE; -} - -static Bool -i830_allocate_depthbuffer(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size; - unsigned int pitch = pScrn->displayWidth * pI830->cpp; - int height; - int flags; - enum tile_format tile_format = TILE_NONE; - - height = pScrn->virtualY; - - /* First try allocating it tiled */ - flags = ALLOW_SHARING; - if (pI830->tiling && IsTileable(pScrn, pitch)) - { - /* The 965 requires that the depth buffer be in Y Major format, while - * the rest appear to fail when handed that format. - */ - tile_format = IS_I965G(pI830) ? TILE_YMAJOR: TILE_XMAJOR; - height = ALIGN(height, 16); - flags |= ALIGN_BOTH_ENDS; - } - size = ROUND_TO_PAGE(pitch * height); - - pI830->depth_buffer = - i830_allocate_memory(pScrn, "depth buffer", size, pitch, - GTT_PAGE_SIZE, flags, tile_format); - - if (pI830->depth_buffer == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to allocate depth buffer space.\n"); - return FALSE; - } - - return TRUE; -} - -Bool -i830_allocate_texture_memory(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned long size; - int i; - - if (pI830->allocate_classic_textures) { - /* XXX: auto-sizing */ - size = MB(32); - i = myLog2(size / I830_NR_TEX_REGIONS); - if (i < I830_LOG_MIN_TEX_REGION_SIZE) - i = I830_LOG_MIN_TEX_REGION_SIZE; - pI830->TexGranularity = i; - /* Truncate size */ - size >>= i; - size <<= i; - if (size < KB(512)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Less than 512 kBytes for texture space (real %ld" - "kBytes).\n", - size / 1024); - return FALSE; - } - /* Now that the DRM uses the sarea to get the offsets of the buffers, - * and we update the classic DRM mappings and the sarea contents on - * changes, the NEED_LIFETIME_FIXED is no longer true and should be - * made conditional on DRM version. - */ - pI830->textures = i830_allocate_memory(pScrn, "classic textures", size, - PITCH_NONE, - GTT_PAGE_SIZE, - ALLOW_SHARING | - NEED_LIFETIME_FIXED, - TILE_NONE); - if (pI830->textures == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to allocate texture space.\n"); - return FALSE; - } - } - - return TRUE; -} - -static Bool -i830_allocate_hwstatus(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - int flags; - - /* The current DRM will leak the HWS mapping if we update the address - * after init (at best), so allocate it fixed for its lifetime - * (i.e. not through buffer objects). - */ - flags = NEED_LIFETIME_FIXED; - if (HWS_NEED_NONSTOLEN(pI830)) - flags |= NEED_NON_STOLEN; - pI830->hw_status = i830_allocate_memory(pScrn, "HW status", - HWSTATUS_PAGE_SIZE, PITCH_NONE, GTT_PAGE_SIZE, flags, - TILE_NONE); - if (pI830->hw_status == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Failed to allocate hw status page.\n"); - return FALSE; - } return TRUE; } @@ -1698,31 +1340,6 @@ i830_allocate_pwrctx(ScrnInfoPtr pScrn) return TRUE; } -Bool -i830_allocate_3d_memory(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - DPRINTF(PFX, "i830_allocate_3d_memory\n"); - - if (!pI830->memory_manager && HWS_NEED_GFX(pI830)) { - if (!i830_allocate_hwstatus(pScrn)) - return FALSE; - } - - if (!i830_allocate_backbuffer(pScrn, &pI830->back_buffer, "back buffer")) - return FALSE; - - if (!i830_allocate_depthbuffer(pScrn)) - return FALSE; - - if (!i830_allocate_texture_memory(pScrn)) - return FALSE; - - return TRUE; -} -#endif - /** * Sets up tiled surface registers ("fences") for the hardware. * @@ -1747,10 +1364,7 @@ i830_set_tiling(ScrnInfoPtr pScrn, unsigned int offset, assert(tile_format != TILE_NONE); - if (pI830->need_sync) { - I830Sync(pScrn); - pI830->need_sync = FALSE; - } + I830Sync(pScrn); if (IS_I965G(pI830)) max_fence = FENCE_NEW_NR; diff --git a/src/i830_render.c b/src/i830_render.c index 5696fa3d..4ca4e338 100644 --- a/src/i830_render.c +++ b/src/i830_render.c @@ -345,10 +345,7 @@ i830_texture_setup(PicturePtr pPict, PixmapPtr pPix, int unit) ADVANCE_BATCH(); } -#ifdef I830DEBUG - ErrorF("try to sync to show any errors..."); - I830Sync(pScrn); -#endif + i830_debug_sync(pScrn); return TRUE; } @@ -569,10 +566,7 @@ i830_prepare_composite(int op, PicturePtr pSrcPicture, ADVANCE_BATCH(); } -#ifdef I830DEBUG - Error("try to sync to show any errors..."); - I830Sync(pScrn); -#endif + i830_debug_sync(pScrn); return TRUE; } diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index 29ccd4e5..a4c9120e 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -114,6 +114,9 @@ struct i830_sdvo_priv { /* Default 0 for full RGB range 0-255, 1 is for RGB range 16-235 */ uint32_t broadcast_rgb; + /** This flag means if we should switch ddc bus before next i2c Start */ + Bool ddc_bus_switch; + /** State for save/restore */ /** @{ */ int save_sdvo_mult; @@ -126,6 +129,9 @@ struct i830_sdvo_priv { static Atom broadcast_atom; +static void +i830_sdvo_dump(ScrnInfoPtr pScrn); + /** * Writes the SDVOB or SDVOC with the given value, but always writes both * SDVOB and SDVOC to work around apparent hardware issues (according to @@ -380,7 +386,7 @@ i830_sdvo_read_response(xf86OutputPtr output, void *response, int response_len) return status; } -int +static int i830_sdvo_get_pixel_multiplier(DisplayModePtr pMode) { if (pMode->Clock >= 100000) @@ -1178,6 +1184,9 @@ i830_sdvo_mode_set(xf86OutputPtr output, DisplayModePtr mode, } i830_sdvo_write_sdvox(output, sdvox); + + if (0) + i830_sdvo_dump(pScrn); } static void @@ -1397,7 +1406,10 @@ i830_sdvo_ddc_i2c_start(I2CBusPtr b, int timeout) I2CBusPtr i2cbus = intel_output->pI2CBus; struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; - i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus); + if (dev_priv->ddc_bus_switch) { + i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus); + dev_priv->ddc_bus_switch = FALSE; + } return i2cbus->I2CStart(i2cbus, timeout); } @@ -1408,11 +1420,13 @@ i830_sdvo_ddc_i2c_stop(I2CDevPtr d) xf86OutputPtr output = d->pI2CBus->DriverPrivate.ptr; I830OutputPrivatePtr intel_output = output->driver_private; I2CBusPtr i2cbus = intel_output->pI2CBus, savebus; + struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; savebus = d->pI2CBus; d->pI2CBus = i2cbus; i2cbus->I2CStop(d); d->pI2CBus = savebus; + dev_priv->ddc_bus_switch = TRUE; } /** @@ -1492,7 +1506,7 @@ i830_sdvo_dump_device(xf86OutputPtr output) i830_sdvo_dump_hdmi_buf(output); } -void +static void i830_sdvo_dump(ScrnInfoPtr pScrn) { xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); @@ -1715,7 +1729,6 @@ i830_sdvo_detect(xf86OutputPtr output) { xf86MonPtr edid_mon; /* Check EDID in DVI-I case */ - i830_sdvo_set_control_bus_switch(output, dev_priv->ddc_bus); edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus); if (edid_mon && !DIGITAL(edid_mon->features.input_type)) { xfree(edid_mon); @@ -1906,6 +1919,7 @@ i830_sdvo_destroy (xf86OutputPtr output) xf86DestroyI2CBusRec (intel_output->pDDCBus, FALSE, FALSE); xf86DestroyI2CDevRec (&dev_priv->d, FALSE); xf86DestroyI2CBusRec (dev_priv->d.pI2CBus, TRUE, TRUE); + free(dev_priv->name); if (output->randr_output) { RROutputPtr randr_output = output->randr_output; @@ -2192,6 +2206,7 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) ddcbus->I2CStop = i830_sdvo_ddc_i2c_stop; ddcbus->I2CAddress = i830_sdvo_ddc_i2c_address; ddcbus->DriverPrivate.ptr = output; + dev_priv->ddc_bus_switch = TRUE; if (!xf86I2CBusInit(ddcbus)) { diff --git a/src/i830_sdvo.h b/src/i830_sdvo.h index 798a88df..607dc5c1 100644 --- a/src/i830_sdvo.h +++ b/src/i830_sdvo.h @@ -27,9 +27,3 @@ Bool i830_sdvo_init(ScrnInfoPtr pScrn, int output_device); - -int -i830_sdvo_get_pixel_multiplier(DisplayModePtr pMode); - -void -i830_sdvo_dump(ScrnInfoPtr pScrn); diff --git a/src/i830_video.c b/src/i830_video.c index 4ed30478..8d33d692 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -70,8 +70,6 @@ #include "i830_video.h" #include "xf86xv.h" #include <X11/extensions/Xv.h> -#include "xaa.h" -#include "xaalocal.h" #include "dixstruct.h" #include "fourcc.h" @@ -140,11 +138,6 @@ static Atom xvSyncToVblank; #define OVERLAY_DEBUG if (0) ErrorF #endif -/* Oops, I never exported this function in EXA. I meant to. */ -#ifndef exaMoveInPixmap -void exaMoveInPixmap (PixmapPtr pPixmap); -#endif - /* * OCMD - Overlay Command Register */ @@ -468,7 +461,7 @@ i830_overlay_on(ScrnInfoPtr pScrn) OUT_BATCH(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); OUT_BATCH(MI_NOOP); ADVANCE_BATCH(); - i830WaitSync(pScrn); + I830Sync(pScrn); /* * If we turned pipe A on up above, turn it @@ -521,7 +514,7 @@ i830_overlay_off(ScrnInfoPtr pScrn) /* * Wait for overlay to go idle. This has to be - * separated from the turning off state by a WaitSync + * separated from the turning off state by a Sync * to ensure the overlay will not read OCMD early and * disable the overlay before the commands here are * executed @@ -531,7 +524,7 @@ i830_overlay_off(ScrnInfoPtr pScrn) OUT_BATCH(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); OUT_BATCH(MI_NOOP); ADVANCE_BATCH(); - i830WaitSync(pScrn); + I830Sync(pScrn); } /* @@ -552,7 +545,7 @@ i830_overlay_off(ScrnInfoPtr pScrn) OUT_BATCH(MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); OUT_BATCH(MI_NOOP); ADVANCE_BATCH(); - i830WaitSync(pScrn); + I830Sync(pScrn); } pI830->overlayOn = FALSE; OVERLAY_DEBUG("overlay_off\n"); @@ -2392,6 +2385,7 @@ I830PutImage(ScrnInfoPtr pScrn, return BadAlloc; if (!pPriv->textured && drm_intel_bo_pin(pPriv->buf, 4096) != 0) { drm_intel_bo_unreference(pPriv->buf); + pPriv->buf = NULL; xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to pin xv buffer\n"); return BadAlloc; @@ -2480,23 +2474,6 @@ I830PutImage(ScrnInfoPtr pScrn, pPixmap = (PixmapPtr)pDraw; } -#ifdef I830_USE_EXA - if (pPriv->textured && pI830->accel == ACCEL_EXA) { - /* Force the pixmap into framebuffer so we can draw to it. */ - exaMoveInPixmap(pPixmap); - } -#endif - - if (pPriv->textured && pI830->accel <= ACCEL_XAA && - (((char *)pPixmap->devPrivate.ptr < (char *)pI830->FbBase) || - ((char *)pPixmap->devPrivate.ptr >= (char *)pI830->FbBase + - pI830->FbMapSize))) { - /* If the pixmap wasn't in framebuffer, then we have no way in XAA to - * force it there. So, we simply refuse to draw and fail. - */ - return BadAlloc; - } - if (!pPriv->textured) { i830_display_video(pScrn, crtc, destId, width, height, dstPitch, x1, y1, x2, y2, &dstBox, src_w, src_h, @@ -2885,11 +2862,12 @@ I830InitOffscreenImages(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); - /* need to free this someplace */ if (!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) { return; } + pI830->offscreenImages = offscreenImages; + offscreenImages[0].image = &Images[0]; offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES /*| VIDEO_CLIP_TO_VIEWPORT*/; offscreenImages[0].alloc_surface = I830AllocateSurface; diff --git a/src/i830_xaa.c b/src/i830_xaa.c deleted file mode 100644 index 1f82840d..00000000 --- a/src/i830_xaa.c +++ /dev/null @@ -1,829 +0,0 @@ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Reformatted with GNU indent (2.2.8), using the following options: - * - * -bad -bap -c41 -cd0 -ncdb -ci6 -cli0 -cp0 -ncs -d0 -di3 -i3 -ip3 -l78 - * -lp -npcs -psl -sob -ss -br -ce -sc -hnl - * - * This provides a good match with the original i810 code and preferred - * XFree86 formatting conventions. - * - * When editing this driver, please follow the existing formatting, and edit - * with <TAB> characters expanded at 8-column intervals. - */ - -/* - * Authors: - * Keith Whitwell <keith@tungstengraphics.com> - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <assert.h> -#include "xf86.h" -#include "xaarop.h" -#include "i830.h" -#include "i810_reg.h" -#include "mipict.h" - -#ifndef DO_SCANLINE_IMAGE_WRITE -#define DO_SCANLINE_IMAGE_WRITE 0 -#endif - -/* I830 Accel Functions */ -static void I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, - int pattx, int patty, - int fg, int bg, int rop, - unsigned int planemask); -static void I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, - int pattx, int patty, - int x, int y, int w, int h); - -static void I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int mask); - -static void I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr - pScrn, int x, - int y, int w, - int h, - int skipleft); - -static void I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); - -#if DO_SCANLINE_IMAGE_WRITE -static void I830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, - int trans_color, int bpp, - int depth); -static void I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft); -static void I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno); -#endif - -void -i830_xaa_composite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); - -Bool -I830XAAInit(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); - I830Ptr pI830 = I830PTR(pScrn); - int i; - int width = 0; - int nr_buffers = 0; - unsigned char *ptr = NULL; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830XAAInit\n"); - - pI830->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) - return FALSE; - - infoPtr->Flags = LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS | PIXMAP_CACHE; - - /* Use the same sync function as the I830. - */ - infoPtr->Sync = I830Sync; - - /* Everything else is different enough to justify different functions */ - { - infoPtr->SolidFillFlags = NO_PLANEMASK; - infoPtr->SetupForSolidFill = I830SetupForSolidFill; - infoPtr->SubsequentSolidFillRect = I830SubsequentSolidFillRect; - } - - { - infoPtr->ScreenToScreenCopyFlags = (NO_PLANEMASK | NO_TRANSPARENCY); - - infoPtr->SetupForScreenToScreenCopy = I830SetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = - I830SubsequentScreenToScreenCopy; - } - - { - infoPtr->SetupForMono8x8PatternFill = I830SetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - I830SubsequentMono8x8PatternFillRect; - - infoPtr->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_ORIGIN| - BIT_ORDER_IN_BYTE_MSBFIRST | - NO_PLANEMASK); - - } - - if (pI830->xaa_scratch->size != 0) { - width = ((pScrn->displayWidth + 31) & ~31) / 8; - nr_buffers = pI830->xaa_scratch->size / width; - ptr = pI830->FbBase + pI830->xaa_scratch->offset; - } - - if (nr_buffers) { - pI830->NumScanlineColorExpandBuffers = nr_buffers; - pI830->ScanlineColorExpandBuffers = (unsigned char **) - xnfcalloc(nr_buffers, sizeof(unsigned char *)); - - for (i = 0; i < nr_buffers; i++, ptr += width) - pI830->ScanlineColorExpandBuffers[i] = ptr; - - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - (NO_PLANEMASK | ROP_NEEDS_SOURCE | BIT_ORDER_IN_BYTE_MSBFIRST); - - infoPtr->ScanlineColorExpandBuffers = (unsigned char **) - xnfcalloc(1, sizeof(unsigned char *)); - infoPtr->NumScanlineColorExpandBuffers = 1; - - infoPtr->ScanlineColorExpandBuffers[0] = - pI830->ScanlineColorExpandBuffers[0]; - pI830->nextColorExpandBuf = 0; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - I830SetupForScanlineCPUToScreenColorExpandFill; - - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - I830SubsequentScanlineCPUToScreenColorExpandFill; - - infoPtr->SubsequentColorExpandScanline = - I830SubsequentColorExpandScanline; - -#if DO_SCANLINE_IMAGE_WRITE - infoPtr->NumScanlineImageWriteBuffers = 1; - infoPtr->ScanlineImageWriteBuffers = - infoPtr->ScanlineColorExpandBuffers; - infoPtr->SetupForScanlineImageWrite = I830SetupForScanlineImageWrite; - infoPtr->SubsequentScanlineImageWriteRect = - I830SubsequentScanlineImageWriteRect; - infoPtr->SubsequentImageWriteScanline = - I830SubsequentImageWriteScanline; - infoPtr->ScanlineImageWriteFlags = NO_GXCOPY | - NO_PLANEMASK | - ROP_NEEDS_SOURCE | - SCANLINE_PAD_DWORD; -#endif - } - - /* Set up pI830->bufferOffset */ - I830SelectBuffer(pScrn, I830_SELECT_FRONT); - - if (!XAAInit(pScreen, infoPtr)) - return FALSE; - - if (ps != NULL) { - if (IS_I865G(pI830) || IS_I855(pI830) || - IS_845G(pI830) || IS_I830(pI830)) - { - pI830->xaa_check_composite = i830_check_composite; - pI830->xaa_prepare_composite = i830_prepare_composite; - pI830->xaa_composite = i830_composite; - pI830->xaa_done_composite = i830_done_composite; - } else if (IS_I915G(pI830) || IS_I915GM(pI830) || - IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830)) - { - pI830->xaa_check_composite = i915_check_composite; - pI830->xaa_prepare_composite = i915_prepare_composite; - pI830->xaa_composite = i830_composite; - pI830->xaa_done_composite = i830_done_composite; - } else { - pI830->xaa_check_composite = i965_check_composite; - pI830->xaa_prepare_composite = i965_prepare_composite; - pI830->xaa_composite = i965_composite; - pI830->xaa_done_composite = i830_done_composite; - } - - pI830->saved_composite = ps->Composite; - ps->Composite = i830_xaa_composite; - } - - return TRUE; -} - -static unsigned int -I830CheckTiling(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (pI830->bufferOffset == pI830->front_buffer->offset && - pI830->front_buffer->tiling != TILE_NONE) - { - return TRUE; - } -#ifdef XF86DRI - if (pI830->back_buffer != NULL && - pI830->bufferOffset == pI830->back_buffer->offset && - pI830->back_buffer->tiling != TILE_NONE) - { - return TRUE; - } - if (pI830->depth_buffer != NULL && - pI830->bufferOffset == pI830->depth_buffer->offset && - pI830->depth_buffer->tiling != TILE_NONE) - { - return TRUE; - } -#endif - - return FALSE; -} - -void -I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForFillRectSolid color: %x rop: %x mask: %x\n", - color, rop, planemask); - - if (IS_I965G(pI830) && I830CheckTiling(pScrn)) { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2; - } else { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - } - -#ifdef I830_USE_EXA - /* This function gets used by I830DRIInitBuffers(), and we might not have - * XAAGetPatternROP() available. So just use the ROPs from our EXA code - * if available. - */ - pI830->BR[13] |= (I830PatternROP[rop] << 16); -#else - pI830->BR[13] |= (XAAGetPatternROP(rop) << 16); -#endif - - pI830->BR[16] = color; - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } -} - -void -I830SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentFillRectSolid %d,%d %dx%d\n", x, y, w, h); - - { - BEGIN_BATCH(6); - - if (pScrn->bitsPerPixel == 32) { - OUT_BATCH(COLOR_BLT_CMD | COLOR_BLT_WRITE_ALPHA | - COLOR_BLT_WRITE_RGB); - } else { - OUT_BATCH(COLOR_BLT_CMD); - } - OUT_BATCH(pI830->BR[13]); - OUT_BATCH((h << 16) | (w * pI830->cpp)); - OUT_BATCH(pI830->bufferOffset + (y * pScrn->displayWidth + x) * - pI830->cpp); - OUT_BATCH(pI830->BR[16]); - OUT_BATCH(0); - - ADVANCE_BATCH(); - } - - if (IS_I965G(pI830)) - I830EmitFlush(pScrn); -} - -void -I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, - unsigned int planemask, int transparency_color) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForScreenToScreenCopy %d %d %x %x %d\n", - xdir, ydir, rop, planemask, transparency_color); - - if (IS_I965G(pI830) && I830CheckTiling(pScrn)) { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2; - } else { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - } - -#ifdef I830_USE_EXA - /* This function gets used by I830DRIInitBuffers(), and we might not have - * XAAGetCopyROP() available. So just use the ROPs from our EXA code - * if available. - */ - pI830->BR[13] |= I830CopyROP[rop] << 16; -#else - pI830->BR[13] |= XAAGetCopyROP(rop) << 16; -#endif - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } - -} - -void -I830SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int src_x1, int src_y1, - int dst_x1, int dst_y1, int w, int h) -{ - I830Ptr pI830 = I830PTR(pScrn); - int dst_x2, dst_y2; - unsigned int tiled = I830CheckTiling(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentScreenToScreenCopy %d,%d - %d,%d %dx%d\n", - src_x1, src_y1, dst_x1, dst_y1, w, h); - - dst_x2 = dst_x1 + w; - dst_y2 = dst_y1 + h; - - { - BEGIN_BATCH(8); - - if (pScrn->bitsPerPixel == 32) { - OUT_BATCH(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB | tiled << 15 | tiled << 11); - } else { - OUT_BATCH(XY_SRC_COPY_BLT_CMD | tiled << 15 | tiled << 11); - } - OUT_BATCH(pI830->BR[13]); - OUT_BATCH((dst_y1 << 16) | (dst_x1 & 0xffff)); - OUT_BATCH((dst_y2 << 16) | (dst_x2 & 0xffff)); - OUT_BATCH(pI830->bufferOffset); - OUT_BATCH((src_y1 << 16) | (src_x1 & 0xffff)); - OUT_BATCH(pI830->BR[13] & 0xFFFF); - OUT_BATCH(pI830->bufferOffset); - - ADVANCE_BATCH(); - } - - if (IS_I965G(pI830)) - I830EmitFlush(pScrn); -} - -static void -I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty, - int fg, int bg, int rop, - unsigned int planemask) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForMono8x8PatternFill\n"); - - pI830->BR[16] = pattx; - pI830->BR[17] = patty; - pI830->BR[18] = bg; - pI830->BR[19] = fg; - - if (IS_I965G(pI830) && I830CheckTiling(pScrn)) { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2; - } else { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - } - pI830->BR[13] |= XAAGetPatternROP(rop) << 16; - if (bg == -1) - pI830->BR[13] |= (1 << 28); - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } - -} - -static void -I830SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int pattx, int patty, - int x, int y, int w, int h) -{ - I830Ptr pI830 = I830PTR(pScrn); - int x1, x2, y1, y2; - unsigned int tiled = I830CheckTiling(pScrn); - - x1 = x; - x2 = x + w; - y1 = y; - y2 = y + h; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentMono8x8PatternFillRect\n"); - - { - BEGIN_BATCH(10); - - if (pScrn->bitsPerPixel == 32) { - OUT_BATCH(XY_MONO_PAT_BLT_CMD | XY_MONO_PAT_BLT_WRITE_ALPHA | - XY_MONO_PAT_BLT_WRITE_RGB | tiled << 11 | - ((patty << 8) & XY_MONO_PAT_VERT_SEED) | - ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); - } else { - OUT_BATCH(XY_MONO_PAT_BLT_CMD | tiled << 11 | - ((patty << 8) & XY_MONO_PAT_VERT_SEED) | - ((pattx << 12) & XY_MONO_PAT_HORT_SEED)); - } - OUT_BATCH(pI830->BR[13]); - OUT_BATCH((y1 << 16) | x1); - OUT_BATCH((y2 << 16) | x2); - OUT_BATCH(pI830->bufferOffset); - OUT_BATCH(pI830->BR[18]); /* bg */ - OUT_BATCH(pI830->BR[19]); /* fg */ - OUT_BATCH(pI830->BR[16]); /* pattern data */ - OUT_BATCH(pI830->BR[17]); - OUT_BATCH(0); - ADVANCE_BATCH(); - } - - if (IS_I965G(pI830)) - I830EmitFlush(pScrn); -} - -static void -I830GetNextScanlineColorExpandBuffer(ScrnInfoPtr pScrn) -{ - I830Ptr pI830 = I830PTR(pScrn); - XAAInfoRecPtr infoPtr = pI830->AccelInfoRec; - - if (pI830->nextColorExpandBuf == pI830->NumScanlineColorExpandBuffers) - I830Sync(pScrn); - - infoPtr->ScanlineColorExpandBuffers[0] = - pI830->ScanlineColorExpandBuffers[pI830->nextColorExpandBuf]; - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("using color expand buffer %d\n", pI830->nextColorExpandBuf); - - pI830->nextColorExpandBuf++; -} - -static void -I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop, - unsigned int planemask) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForScanlineScreenToScreenColorExpand %d %d %x %x\n", - fg, bg, rop, planemask); - - /* Fill out register values */ - if (IS_I965G(pI830) && I830CheckTiling(pScrn)) { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2; - } else { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - } - pI830->BR[13] |= XAAGetCopyROP(rop) << 16; - if (bg == -1) - pI830->BR[13] |= (1 << 29); - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } - - pI830->BR[18] = bg; - pI830->BR[19] = fg; - - I830GetNextScanlineColorExpandBuffer(pScrn); -} - -static void -I830SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, - int w, int h, int skipleft) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentScanlineCPUToScreenColorExpandFill " - "%d,%d %dx%x %d\n", x, y, w, h, skipleft); - - /* Fill out register values */ - pI830->BR[9] = (pI830->bufferOffset + - (y * pScrn->displayWidth + x) * pI830->cpp); - pI830->BR[11] = ((1 << 16) | w); -} - -static void -I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned int tiled = I830CheckTiling(pScrn); - - pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - - pI830->FbBase); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentColorExpandScanline %d (addr %x)\n", - bufno, pI830->BR[12]); - - { - BEGIN_BATCH(8); - - if (pScrn->bitsPerPixel == 32) { - OUT_BATCH(XY_MONO_SRC_BLT_CMD | XY_MONO_SRC_BLT_WRITE_ALPHA | - tiled << 11 | XY_MONO_SRC_BLT_WRITE_RGB); - } else { - OUT_BATCH(XY_MONO_SRC_BLT_CMD | tiled << 11); - } - OUT_BATCH(pI830->BR[13]); - OUT_BATCH(0); /* x1 = 0, y1 = 0 */ - OUT_BATCH(pI830->BR[11]); /* x2 = w, y2 = 1 */ - OUT_BATCH(pI830->BR[9]); /* dst addr */ - OUT_BATCH(pI830->BR[12]); /* src addr */ - OUT_BATCH(pI830->BR[18]); /* bg */ - OUT_BATCH(pI830->BR[19]); /* fg */ - - ADVANCE_BATCH(); - } - - /* Advance to next scanline. - */ - pI830->BR[9] += pScrn->displayWidth * pI830->cpp; - I830GetNextScanlineColorExpandBuffer(pScrn); - - if (IS_I965G(pI830)) - I830EmitFlush(pScrn); -} - -#if DO_SCANLINE_IMAGE_WRITE -static void -I830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, - unsigned int planemask, int trans_color, - int bpp, int depth) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SetupForScanlineImageWrite %x %x\n", rop, planemask); - - /* Fill out register values */ - if (IS_I965G(pI830) && I830CheckTiling(pScrn)) { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp) >> 2; - } else { - pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - } - pI830->BR[13] |= XAAGetCopyROP(rop) << 16; - - switch (pScrn->bitsPerPixel) { - case 8: - break; - case 16: - pI830->BR[13] |= (1 << 24); - break; - case 32: - pI830->BR[13] |= ((1 << 25) | (1 << 24)); - break; - } - - I830GetNextScanlineColorExpandBuffer(pScrn); -} - -static void -I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y, - int w, int h, int skipleft) -{ - I830Ptr pI830 = I830PTR(pScrn); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentScanlineImageWriteRect " - "%d,%d %dx%x %d\n", x, y, w, h, skipleft); - - /* Fill out register values */ - pI830->BR[9] = (pI830->bufferOffset + - (y * pScrn->displayWidth + x) * pI830->cpp); - pI830->BR[11] = ((1 << 16) | w); -} - -static void -I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) -{ - I830Ptr pI830 = I830PTR(pScrn); - unsigned int tiled = I830CheckTiling(pScrn); - - pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - - pI830->FbBase); - - if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) - ErrorF("I830SubsequentImageWriteScanline %d (addr %x)\n", - bufno, pI830->BR[12]); - - { - BEGIN_BATCH(8); - - if (pScrn->bitsPerPixel == 32) { - OUT_BATCH(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - tiled << 11 | XY_SRC_COPY_BLT_WRITE_RGB); - } else { - OUT_BATCH(XY_SRC_COPY_BLT_CMD | tiled << 11); - } - OUT_BATCH(pI830->BR[13]); - OUT_BATCH(0); /* x1 = 0, y1 = 0 */ - OUT_BATCH(pI830->BR[11]); /* x2 = w, y2 = 1 */ - OUT_BATCH(pI830->BR[9]); /* dst addr */ - OUT_BATCH(0); /* source origin (0,0) */ - OUT_BATCH(pI830->BR[11] & 0xffff); /* source pitch */ - OUT_BATCH(pI830->BR[12]); /* src addr */ - - ADVANCE_BATCH(); - } - - /* Advance to next scanline. - */ - pI830->BR[9] += pScrn->displayWidth * pI830->cpp; - I830GetNextScanlineColorExpandBuffer(pScrn); -} -#endif /* DO_SCANLINE_IMAGE_WRITE */ -/* Support for multiscreen */ - -/** - * Special case acceleration for Render acceleration of rotation operations - * by xf86Rotate.c - */ -void -i830_xaa_composite(CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - I830Ptr pI830 = I830PTR(pScrn); - xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); - PictureScreenPtr ps; - PixmapPtr pSrcPixmap, pDstPixmap; - RegionRec region; - BoxPtr pbox; - int nbox; - int i; - - /* Throw out cases that aren't going to be our rotation first */ - if (pMask != NULL || op != PictOpSrc || pSrc->pDrawable == NULL) - goto fallback; - - if (pSrc->pDrawable->type != DRAWABLE_WINDOW || - pDst->pDrawable->type != DRAWABLE_PIXMAP) - { - goto fallback; - } - pSrcPixmap = (*pScreen->GetWindowPixmap) ((WindowPtr) pSrc->pDrawable); - pDstPixmap = (PixmapPtr)pDst->pDrawable; - - /* Check if the dest is one of our shadow pixmaps */ - for (i = 0; i < xf86_config->num_crtc; i++) { - xf86CrtcPtr crtc = xf86_config->crtc[i]; - - if (crtc->rotatedPixmap == pDstPixmap) - break; - } - if (i == xf86_config->num_crtc) - goto fallback; - - if (pSrcPixmap != pScreen->GetScreenPixmap(pScreen)) - goto fallback; - - /* OK, so we've got a Render operation on one of our shadow pixmaps, with - * the source being the real framebuffer. We know that both of these are - * in framebuffer, with no x/y offsets, i.e. normal pixmaps like our EXA- - * based Render acceleration code expects. - */ - assert(pSrcPixmap->drawable.x == 0); - assert(pSrcPixmap->drawable.y == 0); - assert(pDstPixmap->drawable.x == 0); - assert(pDstPixmap->drawable.y == 0); - - if (!miComputeCompositeRegion (®ion, pSrc, NULL, pDst, - xSrc, ySrc, 0, 0, xDst, yDst, - width, height)) - return; - - if (!pI830->xaa_check_composite(op, pSrc, NULL, pDst)) { - REGION_UNINIT(pScreen, ®ion); - goto fallback; - } - - if (!pI830->xaa_prepare_composite(op, pSrc, NULL, pDst, - pSrcPixmap, NULL, pDstPixmap)) - { - REGION_UNINIT(pScreen, ®ion); - goto fallback; - } - - nbox = REGION_NUM_RECTS(®ion); - pbox = REGION_RECTS(®ion); - - xSrc -= xDst; - ySrc -= yDst; - - while (nbox--) - { - pI830->xaa_composite(pDstPixmap, - pbox->x1 + xSrc, - pbox->y1 + ySrc, - 0, 0, - pbox->x1, - pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - pbox++; - } - - REGION_UNINIT(pDst->pDrawable->pScreen, ®ion); - - pI830->xaa_done_composite(pDstPixmap); - i830MarkSync(pScrn); - - return; - -fallback: - /* Fallback path: Call down to the next level (XAA) */ - ps = GetPictureScreenIfSet(pScreen); - - ps->Composite = pI830->saved_composite; - - ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, - width, height); - - pI830->saved_composite = ps->Composite; - ps->Composite = i830_xaa_composite; -} diff --git a/src/i915_video.c b/src/i915_video.c index 93e0c86a..1d1fa018 100644 --- a/src/i915_video.c +++ b/src/i915_video.c @@ -415,7 +415,5 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, } intel_batch_end_atomic(pScrn); - - i830MarkSync(pScrn); } diff --git a/src/i965_render.c b/src/i965_render.c index c123a369..7583af17 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -431,7 +431,7 @@ typedef enum { #define KERNEL(kernel_enum, kernel, masked) \ [kernel_enum] = {&kernel, sizeof(kernel), masked} -struct wm_kernel_info { +static struct wm_kernel_info { void *data; unsigned int size; Bool has_mask; @@ -923,6 +923,7 @@ i965_set_picture_surface_state(dri_bo *ss_bo, int ss_index, struct brw_surface_state_padded *ss; struct brw_surface_state local_ss; dri_bo *pixmap_bo = i830_get_pixmap_bo(pPixmap); + uint32_t write_domain, read_domains; ss = (struct brw_surface_state_padded *)ss_bo->virtual + ss_index; @@ -952,10 +953,7 @@ i965_set_picture_surface_state(dri_bo *ss_bo, int ss_index, local_ss.ss0.vert_line_stride_ofs = 0; local_ss.ss0.mipmap_layout_mode = 0; local_ss.ss0.render_cache_read_mode = 0; - if (pixmap_bo != NULL) - local_ss.ss1.base_addr = pixmap_bo->offset; - else - local_ss.ss1.base_addr = intel_get_pixmap_offset(pPixmap); + local_ss.ss1.base_addr = pixmap_bo->offset; local_ss.ss2.mip_count = 0; local_ss.ss2.render_target_rotation = 0; @@ -967,22 +965,20 @@ i965_set_picture_surface_state(dri_bo *ss_bo, int ss_index, memcpy(ss, &local_ss, sizeof(local_ss)); - if (pixmap_bo != NULL) { - uint32_t write_domain, read_domains; - if (is_dst) { - write_domain = I915_GEM_DOMAIN_RENDER; - read_domains = I915_GEM_DOMAIN_RENDER; - } else { - write_domain = 0; - read_domains = I915_GEM_DOMAIN_SAMPLER; - } - dri_bo_emit_reloc(ss_bo, read_domains, write_domain, - 0, - ss_index * sizeof(*ss) + - offsetof(struct brw_surface_state, ss1), - pixmap_bo); + if (is_dst) { + write_domain = I915_GEM_DOMAIN_RENDER; + read_domains = I915_GEM_DOMAIN_RENDER; + } else { + write_domain = 0; + read_domains = I915_GEM_DOMAIN_SAMPLER; } + drm_intel_bo_emit_reloc(ss_bo, + ss_index * sizeof(*ss) + + offsetof(struct brw_surface_state, ss1), + pixmap_bo, + 0, + read_domains, write_domain); } static void @@ -1216,11 +1212,6 @@ i965_emit_composite_state(ScrnInfoPtr pScrn) ADVANCE_BATCH(); } - -#ifdef I830DEBUG - ErrorF("try to sync to show any errors...\n"); - I830Sync(pScrn); -#endif } /** @@ -1290,8 +1281,10 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture, surface_state_bo = dri_bo_alloc(pI830->bufmgr, "surface_state", 3 * sizeof (brw_surface_state_padded), 4096); - if (dri_bo_map(surface_state_bo, 1) != 0) + if (dri_bo_map(surface_state_bo, 1) != 0) { + dri_bo_unreference(surface_state_bo); return FALSE; + } /* Set up the state buffer for the destination surface */ i965_set_picture_surface_state(surface_state_bo, 0, pDstPicture, pDst, TRUE); @@ -1310,6 +1303,7 @@ i965_prepare_composite(int op, PicturePtr pSrcPicture, binding_table_bo = dri_bo_alloc(pI830->bufmgr, "binding_table", 3 * sizeof(uint32_t), 4096); if (dri_bo_map (binding_table_bo, 1) != 0) { + dri_bo_unreference(binding_table_bo); dri_bo_unreference(surface_state_bo); return FALSE; } @@ -1605,10 +1599,7 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, intel_batch_end_atomic(pScrn); -#ifdef I830DEBUG - ErrorF("sync after 3dprimitive\n"); - I830Sync(pScrn); -#endif + i830_debug_sync(pScrn); } void @@ -1716,35 +1707,28 @@ gen4_render_state_cleanup(ScrnInfoPtr pScrn) I830Ptr pI830 = I830PTR(pScrn); struct gen4_render_state *render_state= pI830->gen4_render_state; int i, j, k, l, m; + gen4_composite_op *composite_op = &render_state->composite_op; - if (render_state->vertex_buffer_bo) { - dri_bo_unreference (render_state->vertex_buffer_bo); - render_state->vertex_buffer_bo = NULL; - } + drm_intel_bo_unreference(composite_op->binding_table_bo); + drm_intel_bo_unreference(render_state->vertex_buffer_bo); drm_intel_bo_unreference(render_state->vs_state_bo); - render_state->vs_state_bo = NULL; drm_intel_bo_unreference(render_state->sf_state_bo); - render_state->sf_state_bo = NULL; drm_intel_bo_unreference(render_state->sf_mask_state_bo); - render_state->sf_mask_state_bo = NULL; - for (i = 0; i < WM_KERNEL_COUNT; i++) { + for (i = 0; i < WM_KERNEL_COUNT; i++) drm_intel_bo_unreference(render_state->wm_kernel_bo[i]); - render_state->wm_kernel_bo[i] = NULL; - } for (i = 0; i < SAMPLER_STATE_FILTER_COUNT; i++) for (j = 0; j < SAMPLER_STATE_EXTEND_COUNT; j++) for (k = 0; k < SAMPLER_STATE_FILTER_COUNT; k++) for (l = 0; l < SAMPLER_STATE_EXTEND_COUNT; l++) - for (m = 0; m < WM_KERNEL_COUNT; m++) { + for (m = 0; m < WM_KERNEL_COUNT; m++) drm_intel_bo_unreference(render_state->wm_state_bo[m][i][j][k][l]); - render_state->wm_state_bo[m][i][j][k][l] = NULL; - } drm_intel_bo_unreference(render_state->cc_state_bo); - render_state->cc_state_bo = NULL; drm_intel_bo_unreference(render_state->sip_kernel_bo); - render_state->sip_kernel_bo = NULL; + + free(pI830->gen4_render_state); + pI830->gen4_render_state = NULL; } diff --git a/src/i965_video.c b/src/i965_video.c index f6020d4e..1d0ed74c 100644 --- a/src/i965_video.c +++ b/src/i965_video.c @@ -375,13 +375,10 @@ i965_create_dst_surface_state(ScrnInfoPtr scrn, dest_surf_state->ss0.mipmap_layout_mode = 0; dest_surf_state->ss0.render_cache_read_mode = 0; - if (pixmap_bo != NULL) - dest_surf_state->ss1.base_addr = - intel_emit_reloc(surf_bo, offsetof(struct brw_surface_state, ss1), - pixmap_bo, 0, - I915_GEM_DOMAIN_SAMPLER, 0); - else - dest_surf_state->ss1.base_addr = intel_get_pixmap_offset(pixmap); + dest_surf_state->ss1.base_addr = + intel_emit_reloc(surf_bo, offsetof(struct brw_surface_state, ss1), + pixmap_bo, 0, + I915_GEM_DOMAIN_SAMPLER, 0); dest_surf_state->ss2.height = scrn->virtualY - 1; dest_surf_state->ss2.width = scrn->virtualX - 1; @@ -1160,7 +1157,6 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, i965_post_draw_debug(pScrn); } - i830MarkSync(pScrn); #if WATCH_STATS i830_dump_error_state(pScrn); #endif diff --git a/src/ivch/Makefile.am b/src/ivch/Makefile.am index 8b12b093..f9cc116b 100644 --- a/src/ivch/Makefile.am +++ b/src/ivch/Makefile.am @@ -3,7 +3,7 @@ # -avoid-version prevents gratuitous .0.0.0 version numbers on the end # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. -AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ +AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ @PCIACCESS_CFLAGS@ ivch_la_LTLIBRARIES = ivch.la diff --git a/src/local_xf86Rename.h b/src/local_xf86Rename.h deleted file mode 100644 index e1e788f3..00000000 --- a/src/local_xf86Rename.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright © 2006 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#define XF86NAME(x) intel_##x diff --git a/src/reg_dumper/gtt.c b/src/reg_dumper/gtt.c index ead5935b..4a46f118 100644 --- a/src/reg_dumper/gtt.c +++ b/src/reg_dumper/gtt.c @@ -59,9 +59,9 @@ int main(int argc, char **argv) else { /* 915/945 chips has GTT range in bar 3*/ int err = 0; - err = pci_device_map_range (pI830->pci_dev, - pI830->pci_dev->regions[3].base_addr, - pI830->pci_dev->regions[3].size, + err = pci_device_map_range (pI830->PciInfo, + pI830->PciInfo->regions[3].base_addr, + pI830->PciInfo->regions[3].size, PCI_DEV_MAP_FLAG_WRITABLE, (void **)>t); if (err != 0) { @@ -70,7 +70,7 @@ int main(int argc, char **argv) } } - aper_size = pI830->pci_dev->regions[2].size; + aper_size = pI830->PciInfo->regions[2].size; for (start = 0; start < aper_size; start += KB(4)) { uint32_t start_pte = INGTT(start); diff --git a/src/reg_dumper/hotplug.c b/src/reg_dumper/hotplug.c index 68fe5842..de463844 100644 --- a/src/reg_dumper/hotplug.c +++ b/src/reg_dumper/hotplug.c @@ -72,10 +72,7 @@ int main(int argc, char **argv) if (dev->vendor_id != 0x8086) errx(1, "Graphics card is non-intel"); - i830.PciInfo = &i830.pci_info_rec; - i830.PciInfo->chipType = dev->device_id; - - i830.pci_dev = dev; + i830.PciInfo = dev; mmio_bar = IS_I9XX((&i830)) ? 0 : 1; diff --git a/src/reg_dumper/idle.c b/src/reg_dumper/idle.c index 8d60c0ca..cbd68aa3 100644 --- a/src/reg_dumper/idle.c +++ b/src/reg_dumper/idle.c @@ -142,10 +142,7 @@ int main(int argc, char **argv) if (dev->vendor_id != 0x8086) errx(1, "Graphics card is non-intel"); - i830.PciInfo = &i830.pci_info_rec; - i830.PciInfo->chipType = dev->device_id; - - i830.pci_dev = dev; + i830.PciInfo = dev; mmio_bar = IS_I9XX((&i830)) ? 0 : 1; diff --git a/src/reg_dumper/main.c b/src/reg_dumper/main.c index 5c8ef9ed..ce883ef8 100644 --- a/src/reg_dumper/main.c +++ b/src/reg_dumper/main.c @@ -29,7 +29,6 @@ #include <stdlib.h> #include <string.h> #include <stdarg.h> -#include <pciaccess.h> #include <err.h> #include "reg_dumper.h" @@ -62,10 +61,7 @@ int main(int argc, char **argv) if (dev->vendor_id != 0x8086) errx(1, "Graphics card is non-intel"); - i830.PciInfo = &i830.pci_info_rec; - i830.PciInfo->chipType = dev->device_id; - - i830.pci_dev = dev; + i830.PciInfo = dev; mmio_bar = IS_I9XX((&i830)) ? 0 : 1; diff --git a/src/reg_dumper/reg_dumper.h b/src/reg_dumper/reg_dumper.h index 9f24d5cc..8c2eb0bb 100644 --- a/src/reg_dumper/reg_dumper.h +++ b/src/reg_dumper/reg_dumper.h @@ -29,6 +29,7 @@ #include <string.h> #include <stdlib.h> #include <stdio.h> +#include <pciaccess.h> #include "common.h" /** @file @@ -45,18 +46,12 @@ typedef char Bool; #define X_WARNING 1 #define X_ERROR 2 -struct pci_info_rec { - uint16_t chipType; -}; - typedef struct _i830 { /* Fields in common with the real pI830 */ - struct pci_info_rec *PciInfo; + struct pci_device *PciInfo; Bool use_drm_mode; /* Fields used for setting up reg_dumper */ - struct pci_device *pci_dev; - struct pci_info_rec pci_info_rec; volatile unsigned char *mmio; } I830Rec, *I830Ptr; diff --git a/src/reg_dumper/util.c b/src/reg_dumper/util.c index 6dd1e487..4d6380e9 100644 --- a/src/reg_dumper/util.c +++ b/src/reg_dumper/util.c @@ -65,10 +65,7 @@ void intel_i830rec_init(I830Ptr pI830) if (dev->vendor_id != 0x8086) errx(1, "Graphics card is non-intel"); - pI830->PciInfo = &pI830->pci_info_rec; - pI830->PciInfo->chipType = dev->device_id; - - pI830->pci_dev = dev; + pI830->PciInfo = dev; mmio_bar = IS_I9XX(pI830) ? 0 : 1; diff --git a/src/sil164/Makefile.am b/src/sil164/Makefile.am index 7b179ab9..6d1cf378 100644 --- a/src/sil164/Makefile.am +++ b/src/sil164/Makefile.am @@ -3,7 +3,7 @@ # -avoid-version prevents gratuitous .0.0.0 version numbers on the end # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. -AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ +AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ @PCIACCESS_CFLAGS@ sil164_la_LTLIBRARIES = sil164.la diff --git a/src/tfp410/Makefile.am b/src/tfp410/Makefile.am index 0dbc0212..23d9c87a 100644 --- a/src/tfp410/Makefile.am +++ b/src/tfp410/Makefile.am @@ -3,7 +3,7 @@ # -avoid-version prevents gratuitous .0.0.0 version numbers on the end # _ladir passes a dummy rpath to libtool so the thing will actually link # TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc. -AM_CFLAGS = @WARN_CFLAGS@ @XMODES_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ +AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRI_CFLAGS@ \ @PCIACCESS_CFLAGS@ tfp410_la_LTLIBRARIES = tfp410.la diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c index e3220543..a225a4dc 100644 --- a/uxa/uxa-accel.c +++ b/uxa/uxa-accel.c @@ -977,69 +977,6 @@ out: return ret; } -#ifndef SERVER_1_5 -void -uxa_paint_window(WindowPtr pWin, RegionPtr pRegion, int what) -{ - ScreenPtr screen = pWin->drawable.pScreen; - uxa_screen_t *uxa_screen = uxa_get_screen(screen); - DDXPointRec zeros = { 0, 0 }; - - if (REGION_NIL(pRegion)) - return; - - if (uxa_screen->swappedOut) { - uxa_check_paint_window(pWin, pRegion, what); - return; - } - - switch (what) { - case PW_BACKGROUND: - switch (pWin->backgroundState) { - case None: - return; - case ParentRelative: - do { - pWin = pWin->parent; - } while (pWin->backgroundState == ParentRelative); - (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, - what); - return; - case BackgroundPixel: - if (uxa_fill_region_solid(&pWin->drawable, pRegion, - pWin->background.pixel, - FB_ALLONES, GXcopy)) - return; - break; - case BackgroundPixmap: - if (uxa_fill_region_tiled(&pWin->drawable, pRegion, - pWin->background.pixmap, - &zeros, FB_ALLONES, GXcopy)) - return; - break; - } - break; - case PW_BORDER: - if (pWin->borderIsPixel) { - if (uxa_fill_region_solid(&pWin->drawable, pRegion, - pWin->border.pixel, - FB_ALLONES, GXcopy)) - return; - break; - } else { - if (uxa_fill_region_tiled(&pWin->drawable, pRegion, - pWin->border.pixmap, - &zeros, FB_ALLONES, GXcopy)) - return; - break; - } - break; - } - - uxa_check_paint_window(pWin, pRegion, what); -} -#endif /* !SERVER_1_5 */ - /** * Accelerates GetImage for solid ZPixmap downloads from framebuffer memory. * diff --git a/uxa/uxa-glyphs.c b/uxa/uxa-glyphs.c index 3cb03f59..af5f5879 100644 --- a/uxa/uxa-glyphs.c +++ b/uxa/uxa-glyphs.c @@ -50,8 +50,6 @@ #include "mipict.h" -#ifdef SERVER_1_5 - #if DEBUG_GLYPH_CACHE #define DBG_GLYPH_CACHE(a) ErrorF a #else @@ -873,5 +871,3 @@ uxa_glyphs (CARD8 op, (*pScreen->DestroyPixmap) (pMaskPixmap); } } - -#endif /* SERVER_1_5 */ diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h index d1cd341e..3d2b7764 100644 --- a/uxa/uxa-priv.h +++ b/uxa/uxa-priv.h @@ -64,6 +64,16 @@ #endif #include "damage.h" +/* Provide substitutes for gcc's __FUNCTION__ on other compilers */ +#if !defined(__GNUC__) && !defined(__FUNCTION__) +# if defined(__STDC__) && (__STDC_VERSION__>=199901L) /* C99 */ +# define __FUNCTION__ __func__ +# else +# define __FUNCTION__ "" +# endif +#endif + + /* 1.6 and earlier server compat */ #ifndef miGetCompositeClip #define miCopyRegion fbCopyRegion @@ -129,10 +139,6 @@ typedef struct { CloseScreenProcPtr SavedCloseScreen; GetImageProcPtr SavedGetImage; GetSpansProcPtr SavedGetSpans; -#ifndef SERVER_1_5 - PaintWindowBackgroundProcPtr SavedPaintWindowBackground; - PaintWindowBorderProcPtr SavedPaintWindowBorder; -#endif CreatePixmapProcPtr SavedCreatePixmap; DestroyPixmapProcPtr SavedDestroyPixmap; CopyWindowProcPtr SavedCopyWindow; @@ -171,12 +177,8 @@ extern int uxa_screen_index; static inline uxa_screen_t * uxa_get_screen(ScreenPtr screen) { -#ifdef SERVER_1_5 return (uxa_screen_t *)dixLookupPrivate(&screen->devPrivates, &uxa_screen_index); -#else - return screen->devPrivates[uxa_screen_index].ptr; -#endif } /** Align an offset to an arbitrary alignment */ diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c index edbf0d8c..b377bf53 100644 --- a/uxa/uxa-render.c +++ b/uxa/uxa-render.c @@ -818,13 +818,8 @@ uxa_create_alpha_picture (ScreenPtr pScreen, return 0; } -#ifdef SERVER_1_5 pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, pPictFormat->depth, 0); -#else - pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, - pPictFormat->depth); -#endif if (!pPixmap) return 0; pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); diff --git a/uxa/uxa-unaccel.c b/uxa/uxa-unaccel.c index f63c03b7..8f864688 100644 --- a/uxa/uxa-unaccel.c +++ b/uxa/uxa-unaccel.c @@ -336,24 +336,6 @@ uxa_check_get_spans (DrawablePtr pDrawable, } } -#ifndef SERVER_1_5 -void -uxa_check_paint_window (WindowPtr pWin, RegionPtr pRegion, int what) -{ - ScreenPtr screen = pWin->drawable.pScreen; - - UXA_FALLBACK(("from %p (%c)\n", pWin, - uxa_drawable_location (&pWin->drawable))); - if (uxa_prepare_access (&pWin->drawable, UXA_ACCESS_RW)) { - if (uxa_prepare_access_window (pWin)) { - fbPaintWindow (pWin, pRegion, what); - uxa_finish_access_window (pWin); - } - uxa_finish_access(&pWin->drawable); - } -} -#endif - void uxa_check_composite (CARD8 op, PicturePtr pSrc, @@ -40,9 +40,6 @@ #include "uxa.h" int uxa_screen_index; -#ifndef SERVER_1_5 -static int uxa_generation; -#endif /** * uxa_get_drawable_pixmap() returns a backing pixmap for a given drawable. @@ -370,18 +367,12 @@ uxa_close_screen(int i, ScreenPtr pScreen) PictureScreenPtr ps = GetPictureScreenIfSet(pScreen); #endif -#ifdef SERVER_1_5 uxa_glyphs_fini(pScreen); -#endif pScreen->CreateGC = uxa_screen->SavedCreateGC; pScreen->CloseScreen = uxa_screen->SavedCloseScreen; pScreen->GetImage = uxa_screen->SavedGetImage; pScreen->GetSpans = uxa_screen->SavedGetSpans; -#ifndef SERVER_1_5 - pScreen->PaintWindowBackground = uxa_screen->SavedPaintWindowBackground; - pScreen->PaintWindowBorder = uxa_screen->SavedPaintWindowBorder; -#endif pScreen->CreatePixmap = uxa_screen->SavedCreatePixmap; pScreen->DestroyPixmap = uxa_screen->SavedDestroyPixmap; pScreen->CopyWindow = uxa_screen->SavedCopyWindow; @@ -478,15 +469,7 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver) uxa_screen->info = uxa_driver; -#ifdef SERVER_1_5 dixSetPrivate(&screen->devPrivates, &uxa_screen_index, uxa_screen); -#else - if (uxa_generation != serverGeneration) { - uxa_screen_index = AllocateScreenPrivateIndex(); - uxa_generation = serverGeneration; - } - screen->devPrivates[uxa_screen_index].ptr = uxa_screen; -#endif // exaDDXDriverInit(screen); @@ -505,14 +488,6 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver) uxa_screen->SavedGetSpans = screen->GetSpans; screen->GetSpans = uxa_check_get_spans; -#ifndef SERVER_1_5 - uxa_screen->SavedPaintWindowBackground = screen->PaintWindowBackground; - screen->PaintWindowBackground = uxa_paint_window; - - uxa_screen->SavedPaintWindowBorder = screen->PaintWindowBorder; - screen->PaintWindowBorder = uxa_paint_window; -#endif /* !SERVER_1_5 */ - uxa_screen->SavedCopyWindow = screen->CopyWindow; screen->CopyWindow = uxa_copy_window; @@ -530,10 +505,8 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver) uxa_screen->SavedComposite = ps->Composite; ps->Composite = uxa_composite; -#ifdef SERVER_1_5 uxa_screen->SavedGlyphs = ps->Glyphs; ps->Glyphs = uxa_glyphs; -#endif uxa_screen->SavedTriangles = ps->Triangles; ps->Triangles = uxa_triangles; @@ -554,9 +527,7 @@ uxa_driver_init(ScreenPtr screen, uxa_driver_t *uxa_driver) ShmRegisterFuncs(screen, &uxa_shm_funcs); #endif -#ifdef SERVER_1_5 uxa_glyphs_init(screen); -#endif LogMessage(X_INFO, "UXA(%d): Driver registered support for the following" " operations:\n", screen->myNum); |