summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-07-29 22:57:09 -0700
committerKeith Packard <keithp@keithp.com>2008-08-05 15:29:50 -0700
commit59774e9aca2d743e82d616bb644d20ff6d60d492 (patch)
tree209dfbdbfa8eb9dbd9cfc7a41be3fa3a7ead19ac /src
parentc2f0df4dc97c87539b66525a277c7d1e2c421f61 (diff)
Add UXA - the unified memory acceleration architecture.
This eliminates the cost of EXA migration management while providing full pixmap allocation control to the driver. The goal is to make something useful for UMA drivers.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am6
-rw-r--r--src/i830.h16
-rw-r--r--src/i830_accel.c31
-rw-r--r--src/i830_debug.c2
-rw-r--r--src/i830_dri.c2
-rw-r--r--src/i830_driver.c153
-rw-r--r--src/i830_exa.c131
-rw-r--r--src/i830_memory.c16
-rw-r--r--src/i830_video.c4
9 files changed, 284 insertions, 77 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 2932233d..dd92c8d9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,13 +31,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@ \
- @XMODES_CFLAGS@ -DI830_XV -DI830_USE_XAA -DI830_USE_EXA
+ @PCIACCESS_CFLAGS@ -I../uxa \
+ @XMODES_CFLAGS@ -DI830_XV -DI830_USE_XAA -DI830_USE_EXA -DI830_USE_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
+intel_drv_la_LIBADD = -lm ../uxa/libuxa.la
if XSERVER_LIBPCIACCESS
intel_drv_la_LIBADD += @PCIACCESS_LIBS@
endif
diff --git a/src/i830.h b/src/i830.h
index a8ab8c6c..2fb8efaa 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -83,7 +83,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifdef I830_USE_EXA
#include "exa.h"
+#include "uxa.h"
Bool I830EXAInit(ScreenPtr pScreen);
+Bool i830_uxa_init(ScreenPtr pScreen);
unsigned long long I830TexOffsetStart(PixmapPtr pPix);
#endif
@@ -355,6 +357,14 @@ enum backlight_control {
BCM_KERNEL,
};
+typedef enum accel_method {
+ ACCEL_UNINIT = 0,
+ ACCEL_NONE,
+ ACCEL_XAA,
+ ACCEL_EXA,
+ ACCEL_UXA
+} accel_method_t;
+
typedef struct _I830Rec {
unsigned char *MMIOBase;
unsigned char *GTTBase;
@@ -496,8 +506,7 @@ typedef struct _I830Rec {
Bool fence_used[FENCE_NEW_NR];
- Bool useEXA;
- Bool noAccel;
+ accel_method_t accel;
Bool SWCursor;
#ifdef I830_USE_XAA
XAAInfoRecPtr AccelInfoRec;
@@ -518,6 +527,7 @@ typedef struct _I830Rec {
#ifdef I830_USE_EXA
ExaDriverPtr EXADriverPtr;
+ uxa_driver_t *uxa_driver;
PixmapPtr pSrcPixmap;
#endif
@@ -902,7 +912,7 @@ static inline int i830_fb_compression_supported(I830Ptr pI830)
/* fbc depends on tiled surface. And we don't support tiled
* front buffer with XAA now.
*/
- if (!pI830->tiling || (IS_I965G(pI830) && !pI830->useEXA))
+ if (!pI830->tiling || (IS_I965G(pI830) && pI830->accel <= ACCEL_XAA))
return FALSE;
return TRUE;
}
diff --git a/src/i830_accel.c b/src/i830_accel.c
index c3cd08e0..579de31c 100644
--- a/src/i830_accel.c
+++ b/src/i830_accel.c
@@ -67,12 +67,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
unsigned long
intel_get_pixmap_offset(PixmapPtr pPix)
{
+#ifdef I830_USE_EXA
ScreenPtr pScreen = pPix->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
-#ifdef I830_USE_EXA
- if (pI830->useEXA)
+ if (pI830->accel == ACCEL_EXA)
return exaGetPixmapOffset(pPix);
#endif
return (unsigned long)pPix->devPrivate.ptr - (unsigned long)pI830->FbBase;
@@ -81,17 +81,15 @@ intel_get_pixmap_offset(PixmapPtr pPix)
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);
-#ifdef I830_USE_EXA
- if (pI830->useEXA)
+ if (pI830->accel == ACCEL_EXA)
return exaGetPixmapPitch(pPix);
#endif
-#ifdef I830_USE_XAA
return (unsigned long)pPix->devKind;
-#endif
}
int
@@ -151,6 +149,9 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis)
#ifdef I830_USE_EXA
pI830->EXADriverPtr = NULL;
#endif
+#ifdef I830_USE_UXA
+ pI830->uxa_driver = NULL;
+#endif
FatalError("lockup\n");
}
@@ -176,7 +177,7 @@ I830Sync(ScrnInfoPtr pScrn)
if (I810_DEBUG & (DEBUG_VERBOSE_ACCEL | DEBUG_VERBOSE_SYNC))
ErrorF("I830Sync\n");
- if (pI830->noAccel)
+ if (pI830->accel == ACCEL_NONE)
return;
#ifdef XF86DRI
@@ -278,15 +279,25 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer)
Bool
I830AccelInit(ScreenPtr pScreen)
{
-#ifdef I830_USE_EXA
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
- if (pI830->useEXA)
+ switch (pI830->accel) {
+#ifdef I830_USE_UXA
+ case ACCEL_UXA:
+ return i830_uxa_init(pScreen);
+#endif
+#ifdef I830_USE_EXA
+ case ACCEL_EXA:
return I830EXAInit(pScreen);
#endif
#ifdef I830_USE_XAA
- return I830XAAInit(pScreen);
+ case ACCEL_XAA:
+ return I830XAAInit(pScreen);
#endif
+ case ACCEL_UNINIT:
+ case ACCEL_NONE:
+ break;
+ }
return FALSE;
}
diff --git a/src/i830_debug.c b/src/i830_debug.c
index 1671e255..f1205cc6 100644
--- a/src/i830_debug.c
+++ b/src/i830_debug.c
@@ -1314,6 +1314,8 @@ i830_valid_command (uint32_t cmd)
if (!mi_cmds[opcode])
return -1;
break;
+ case 1:
+ return -1;
case 2: /* 2D */
count = (cmd & 0x1f) + 2;
opcode = (cmd >> 22) & 0x7f;
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 46783721..0e5d81dd 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -589,7 +589,7 @@ I830DRIScreenInit(ScreenPtr pScreen)
#if DRIINFO_MAJOR_VERSION > 5 || \
(DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 3)
- if (pI830->useEXA)
+ if (pI830->accel == ACCEL_EXA)
pDRIInfo->texOffsetStart = I830TexOffsetStart;
#endif
diff --git a/src/i830_driver.c b/src/i830_driver.c
index b6fac9f8..ed974ce2 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -290,9 +290,7 @@ static PciChipsets I830PciChipsets[] = {
*/
typedef enum {
-#if defined(I830_USE_XAA) && defined(I830_USE_EXA)
OPTION_ACCELMETHOD,
-#endif
OPTION_NOACCEL,
OPTION_SW_CURSOR,
OPTION_CACHE_LINES,
@@ -318,9 +316,7 @@ typedef enum {
} I830Opts;
static OptionInfoRec I830Options[] = {
-#if defined(I830_USE_XAA) && defined(I830_USE_EXA)
{OPTION_ACCELMETHOD, "AccelMethod", OPTV_ANYSTR, {0}, FALSE},
-#endif
{OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE},
@@ -1338,6 +1334,15 @@ i830_detect_chipset(ScrnInfoPtr pScrn)
return TRUE;
}
+static const char *accel_name[] =
+{
+ "unspecified",
+ "no",
+ "XAA",
+ "EXA",
+ "UXA",
+};
+
/**
* This is called per zaphod head (so usually just once) to do initialization
* before the Screen is created.
@@ -1554,7 +1559,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
num_pipe, num_pipe > 1 ? "s" : "");
if (xf86ReturnOptValBool(pI830->Options, OPTION_NOACCEL, FALSE)) {
- pI830->noAccel = TRUE;
+ pI830->accel = ACCEL_NONE;
}
/*
@@ -1568,29 +1573,38 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
* All this *could* go away if we removed XAA support from this driver,
* for example. :)
*/
- if (!pI830->noAccel) {
+ if (pI830->accel == ACCEL_UNINIT) {
+ pI830->accel = ACCEL_NONE;
+#ifdef I830_USE_XAA
+ pI830->accel = ACCEL_XAA;
+#endif
#ifdef I830_USE_EXA
- pI830->useEXA = TRUE;
-#else
- pI830->useEXA = FALSE;
+ pI830->accel = ACCEL_EXA;
+#endif
+#ifdef I830_USE_UXA
+ pI830->accel = ACCEL_UXA;
#endif
-#if defined(I830_USE_XAA) && defined(I830_USE_EXA)
+#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->useEXA = TRUE;
+ pI830->accel = ACCEL_EXA;
}
else if (!xf86NameCmp(s, "XAA")) {
from = X_CONFIG;
- pI830->useEXA = FALSE;
+ pI830->accel = ACCEL_XAA;
+ }
+ else if (!xf86NameCmp(s, "UXA")) {
+ from = X_CONFIG;
+ pI830->accel = ACCEL_UXA;
}
}
#endif
- xf86DrvMsg(pScrn->scrnIndex, from, "Using %s for acceleration\n",
- pI830->useEXA ? "EXA" : "XAA");
}
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s acceleration\n",
+ accel_name[pI830->accel]);
if (xf86ReturnOptValBool(pI830->Options, OPTION_SW_CURSOR, FALSE)) {
pI830->SWCursor = TRUE;
@@ -1601,7 +1615,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
#ifdef XF86DRI
if (!pI830->directRenderingDisabled) {
- if (pI830->noAccel || pI830->SWCursor) {
+ if (pI830->accel == ACCEL_NONE || pI830->SWCursor) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "DRI is disabled because it "
"needs HW cursor and 2D acceleration.\n");
pI830->directRenderingDisabled = TRUE;
@@ -1774,7 +1788,7 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
if (!IS_I965G(pI830) && pScrn->virtualY > 2048) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot support > 2048 vertical lines. disabling acceleration.\n");
- pI830->noAccel = TRUE;
+ pI830->accel = ACCEL_NONE;
}
/* Set display resolution */
@@ -1788,18 +1802,19 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
xf86LoaderReqSymLists(I810fbSymbols, NULL);
+ switch (pI830->accel) {
#ifdef I830_USE_XAA
- if (!pI830->noAccel && !pI830->useEXA) {
+ case ACCEL_XAA:
if (!xf86LoadSubModule(pScrn, "xaa")) {
PreInitCleanup(pScrn);
return FALSE;
}
xf86LoaderReqSymLists(I810xaaSymbols, NULL);
- }
+ break;
#endif
#ifdef I830_USE_EXA
- if (!pI830->noAccel && pI830->useEXA) {
+ case ACCEL_EXA: {
XF86ModReqInfo req;
int errmaj, errmin;
@@ -1817,8 +1832,12 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
xf86LoaderReqSymLists(I830exaSymbols, NULL);
+ break;
}
#endif
+ default:
+ break;
+ }
if (!pI830->SWCursor) {
if (!xf86LoadSubModule(pScrn, "ramdac")) {
PreInitCleanup(pScrn);
@@ -1878,7 +1897,7 @@ i830_stop_ring(ScrnInfoPtr pScrn, Bool flush)
pI830->entityPrivate->RingRunning = 0;
/* Flush the ring buffer (if enabled), then disable it. */
- if (!pI830->noAccel) {
+ if (pI830->accel != ACCEL_NONE) {
temp = INREG(LP_RING + RING_LEN);
if (temp & RING_VALID) {
i830_refresh_ring(pScrn);
@@ -1900,7 +1919,7 @@ i830_start_ring(ScrnInfoPtr pScrn)
DPRINTF(PFX, "SetRingRegs\n");
- if (pI830->noAccel)
+ if (pI830->accel == ACCEL_NONE)
return;
if (!I830IsPrimary(pScrn)) return;
@@ -2441,7 +2460,7 @@ IntelEmitInvarientState(ScrnInfoPtr pScrn)
I830Ptr pI830 = I830PTR(pScrn);
uint32_t ctx_addr;
- if (pI830->noAccel)
+ if (pI830->accel == ACCEL_NONE)
return;
#ifdef XF86DRI
@@ -2496,12 +2515,12 @@ I830BlockHandler(int i,
pI830->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = I830BlockHandler;
- if (pScrn->vtSema && !pI830->noAccel) {
+ if (pScrn->vtSema && pI830->accel != ACCEL_NONE) {
/* Emit a flush of the rendering cache, or on the 965 and beyond
* rendering results may not hit the framebuffer until significantly
* later.
*/
- if (!pI830->noAccel && (pI830->need_mi_flush || pI830->batch_used))
+ if (pI830->accel != ACCEL_NONE && (pI830->need_mi_flush || pI830->batch_used))
I830EmitFlush(pScrn);
/* Flush the batch, so that any rendering is executed in a timely
@@ -3001,12 +3020,12 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->XvEnabled = !pI830->XvDisabled;
if (pI830->XvEnabled) {
if (!I830IsPrimary(pScrn)) {
- if (!pI8301->XvEnabled || pI830->noAccel) {
+ if (!pI8301->XvEnabled || pI830->accel == ACCEL_NONE) {
pI830->XvEnabled = FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Xv is disabled.\n");
}
} else
- if (pI830->noAccel || pI830->StolenOnly) {
+ if (pI830->accel == ACCEL_NONE || pI830->StolenOnly) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Xv is disabled because it "
"needs 2D accel and AGPGART.\n");
pI830->XvEnabled = FALSE;
@@ -3016,18 +3035,18 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pI830->XvEnabled = FALSE;
#endif
- if (!pI830->noAccel) {
+ if (pI830->accel != ACCEL_NONE) {
if (pI830->memory_manager == NULL && pI830->LpRing->mem->size == 0) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Disabling acceleration because the ring buffer "
"allocation failed.\n");
- pI830->noAccel = TRUE;
+ pI830->accel = ACCEL_NONE;
}
}
#ifdef I830_XV
if (pI830->XvEnabled) {
- if (pI830->noAccel) {
+ if (pI830->accel == ACCEL_NONE) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Disabling Xv because it "
"needs 2D acceleration.\n");
pI830->XvEnabled = FALSE;
@@ -3049,7 +3068,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
*/
if (pI830->directRenderingEnabled) {
- if (pI830->noAccel || pI830->SWCursor || (pI830->StolenOnly && I830IsPrimary(pScrn))) {
+ if (pI830->accel == ACCEL_NONE || pI830->SWCursor || (pI830->StolenOnly && I830IsPrimary(pScrn))) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DRI is disabled because it "
"needs HW cursor, 2D accel and AGPGART.\n");
pI830->directRenderingEnabled = FALSE;
@@ -3123,7 +3142,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
DPRINTF(PFX, "assert( if(!I830EnterVT(scrnIndex, 0)) )\n");
- if (!pI830->useEXA) {
+ if (pI830->accel <= ACCEL_XAA) {
if (I830IsPrimary(pScrn)) {
if (!I830InitFBManager(pScreen, &(pI830->FbMemBox))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -3171,7 +3190,7 @@ I830ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
DPRINTF(PFX,
"assert( if(!I830InitFBManager(pScreen, &(pI830->FbMemBox))) )\n");
- if (!pI830->noAccel) {
+ if (pI830->accel != ACCEL_NONE) {
if (!I830AccelInit(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Hardware acceleration initialization failed\n");
@@ -3596,12 +3615,19 @@ I830CloseScreen(int scrnIndex, ScreenPtr pScreen)
}
#endif
#ifdef I830_USE_EXA
- if (pI830->useEXA && pI830->EXADriverPtr) {
+ 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
xf86_cursors_fini (pScreen);
i830_allocator_fini(pScrn);
@@ -3830,19 +3856,34 @@ i830WaitSync(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
+ switch (pI830->accel) {
#ifdef I830_USE_XAA
- if (!pI830->noAccel && !pI830->useEXA && pI830->AccelInfoRec
- && pI830->AccelInfoRec->NeedToSync) {
- (*pI830->AccelInfoRec->Sync)(pScrn);
- pI830->AccelInfoRec->NeedToSync = FALSE;
- }
+ case ACCEL_XAA:
+ if (pI830->AccelInfoRec && pI830->AccelInfoRec->NeedToSync) {
+ (*pI830->AccelInfoRec->Sync)(pScrn);
+ pI830->AccelInfoRec->NeedToSync = FALSE;
+ }
+ break;
#endif
#ifdef I830_USE_EXA
- if (!pI830->noAccel && pI830->useEXA && pI830->EXADriverPtr) {
- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
- exaWaitSync(pScreen);
- }
+ 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) {
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+ uxa_wait_sync(pScreen);
+ }
+ break;
+#endif
+ default:
+ break;
+ }
}
void
@@ -3850,16 +3891,32 @@ i830MarkSync(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
+ switch (pI830->accel) {
#ifdef I830_USE_XAA
- if (!pI830->useEXA && pI830->AccelInfoRec)
- pI830->AccelInfoRec->NeedToSync = TRUE;
+ case ACCEL_XAA:
+ if (pI830->AccelInfoRec)
+ pI830->AccelInfoRec->NeedToSync = TRUE;
+ break;
#endif
#ifdef I830_USE_EXA
- if (pI830->useEXA && pI830->EXADriverPtr) {
- ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
- exaMarkSync(pScreen);
- }
+ 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) {
+ ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
+ exaMarkSync(pScreen);
+ }
+ break;
#endif
+ default:
+ break;
+ }
}
void
diff --git a/src/i830_exa.c b/src/i830_exa.c
index 75ccd742..a6705f48 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -430,7 +430,7 @@ I830EXAInit(ScreenPtr pScreen)
pI830->EXADriverPtr = exaDriverAlloc();
if (pI830->EXADriverPtr == NULL) {
- pI830->noAccel = TRUE;
+ pI830->accel = ACCEL_NONE;
return FALSE;
}
memset(pI830->EXADriverPtr, 0, sizeof(*pI830->EXADriverPtr));
@@ -558,7 +558,7 @@ I830EXAInit(ScreenPtr pScreen)
pI830->EXADriverPtr->exa_minor = 0;
if(!exaDriverInit(pScreen, pI830->EXADriverPtr)) {
xfree(pI830->EXADriverPtr);
- pI830->noAccel = TRUE;
+ pI830->accel = ACCEL_NONE;
return FALSE;
}
}
@@ -568,6 +568,133 @@ I830EXAInit(ScreenPtr pScreen)
return TRUE;
}
+static Bool
+i830_uxa_pixmap_is_offscreen(PixmapPtr pPixmap)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
+ I830Ptr pI830 = I830PTR(pScrn);
+
+ /* XXX for now, eventually we'll support 'real' off-screen pixmaps */
+ if ((void *)pPixmap->devPrivate.ptr >= (void *)pI830->FbBase &&
+ (void *)pPixmap->devPrivate.ptr <
+ (void *)(pI830->FbBase + pI830->FbMapSize))
+ {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
+
+Bool
+i830_uxa_init (ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ I830Ptr pI830 = I830PTR(pScrn);
+
+ pI830->uxa_driver = uxa_driver_alloc();
+ if (pI830->uxa_driver == NULL) {
+ pI830->accel = ACCEL_NONE;
+ return FALSE;
+ }
+ memset(pI830->uxa_driver, 0, sizeof(*pI830->uxa_driver));
+
+ pI830->bufferOffset = 0;
+ pI830->uxa_driver->uxa_major = 1;
+ pI830->uxa_driver->uxa_minor = 0;
+
+ /* Limits are described in the BLT engine chapter under Graphics Data Size
+ * Limitations, and the descriptions of SURFACE_STATE, 3DSTATE_BUFFER_INFO,
+ * 3DSTATE_DRAWING_RECTANGLE, 3DSTATE_MAP_INFO, and 3DSTATE_MAP_INFO.
+ *
+ * i845 through i965 limits 2D rendering to 65536 lines and pitch of 32768.
+ *
+ * i965 limits 3D surface to (2*element size)-aligned offset if un-tiled.
+ * i965 limits 3D surface to 4kB-aligned offset if tiled.
+ * i965 limits 3D surfaces to w,h of ?,8192.
+ * i965 limits 3D surface to pitch of 1B - 128kB.
+ * i965 limits 3D surface pitch alignment to 1 or 2 times the element size.
+ * i965 limits 3D surface pitch alignment to 512B if tiled.
+ * i965 limits 3D destination drawing rect to w,h of 8192,8192.
+ *
+ * i915 limits 3D textures to 4B-aligned offset if un-tiled.
+ * i915 limits 3D textures to ~4kB-aligned offset if tiled.
+ * i915 limits 3D textures to width,height of 2048,2048.
+ * i915 limits 3D textures to pitch of 16B - 8kB, in dwords.
+ * i915 limits 3D destination to ~4kB-aligned offset if tiled.
+ * i915 limits 3D destination to pitch of 16B - 8kB, in dwords, if un-tiled.
+ * i915 limits 3D destination to pitch of 512B - 8kB, in tiles, if tiled.
+ * i915 limits 3D destination to POT aligned pitch if tiled.
+ * i915 limits 3D destination drawing rect to w,h of 2048,2048.
+ *
+ * i845 limits 3D textures to 4B-aligned offset if un-tiled.
+ * i845 limits 3D textures to ~4kB-aligned offset if tiled.
+ * i845 limits 3D textures to width,height of 2048,2048.
+ * i845 limits 3D textures to pitch of 4B - 8kB, in dwords.
+ * i845 limits 3D destination to 4B-aligned offset if un-tiled.
+ * i845 limits 3D destination to ~4kB-aligned offset if tiled.
+ * i845 limits 3D destination to pitch of 8B - 8kB, in dwords.
+ * i845 limits 3D destination drawing rect to w,h of 2048,2048.
+ *
+ * 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.
+ */
+ if (IS_I965G(pI830)) {
+ pI830->uxa_driver->maxX = 8192;
+ pI830->uxa_driver->maxY = 8192;
+ } else {
+ pI830->uxa_driver->maxX = 2048;
+ pI830->uxa_driver->maxY = 2048;
+ }
+
+ /* Sync */
+ pI830->uxa_driver->WaitMarker = I830EXASync;
+
+ /* Solid fill */
+ pI830->uxa_driver->PrepareSolid = I830EXAPrepareSolid;
+ pI830->uxa_driver->Solid = I830EXASolid;
+ pI830->uxa_driver->DoneSolid = I830EXADoneSolid;
+
+ /* Copy */
+ pI830->uxa_driver->PrepareCopy = I830EXAPrepareCopy;
+ pI830->uxa_driver->Copy = I830EXACopy;
+ pI830->uxa_driver->DoneCopy = I830EXADoneCopy;
+
+ /* Composite */
+ if (!IS_I9XX(pI830)) {
+ pI830->uxa_driver->CheckComposite = i830_check_composite;
+ pI830->uxa_driver->PrepareComposite = i830_prepare_composite;
+ pI830->uxa_driver->Composite = i830_composite;
+ pI830->uxa_driver->DoneComposite = i830_done_composite;
+ } else if (IS_I915G(pI830) || IS_I915GM(pI830) ||
+ IS_I945G(pI830) || IS_I945GM(pI830) || IS_G33CLASS(pI830))
+ {
+ pI830->uxa_driver->CheckComposite = i915_check_composite;
+ pI830->uxa_driver->PrepareComposite = i915_prepare_composite;
+ pI830->uxa_driver->Composite = i830_composite;
+ pI830->uxa_driver->DoneComposite = i830_done_composite;
+ } else {
+ pI830->uxa_driver->CheckComposite = i965_check_composite;
+ pI830->uxa_driver->PrepareComposite = i965_prepare_composite;
+ pI830->uxa_driver->Composite = i965_composite;
+ pI830->uxa_driver->DoneComposite = i830_done_composite;
+ }
+ pI830->uxa_driver->PixmapIsOffscreen = i830_uxa_pixmap_is_offscreen;
+
+ if(!uxa_driver_init(pScreen, pI830->uxa_driver)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "UXA initialization failed\n");
+ xfree(pI830->uxa_driver);
+ pI830->accel = ACCEL_NONE;
+ return FALSE;
+ }
+
+ I830SelectBuffer(pScrn, I830_SELECT_FRONT);
+
+ return TRUE;
+}
+
#ifdef XF86DRI
#ifndef ExaOffscreenMarkUsed
diff --git a/src/i830_memory.c b/src/i830_memory.c
index b62bda05..c1748b3e 100644
--- a/src/i830_memory.c
+++ b/src/i830_memory.c
@@ -449,7 +449,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long offset, unsigned long size)
mmsize = size;
/* EXA area is fixed. */
- if (pI830->useEXA) {
+ if (pI830->accel == ACCEL_EXA) {
mmsize -= ROUND_TO_PAGE(3 * pScrn->displayWidth * pI830->cpp *
pScrn->virtualY);
}
@@ -1022,7 +1022,7 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn)
{
I830Ptr pI830 = I830PTR(pScrn);
- if (pI830->noAccel || pI830->memory_manager || pI830->LpRing->mem != NULL)
+ if (pI830->accel == ACCEL_NONE || pI830->memory_manager || pI830->LpRing->mem != NULL)
return TRUE;
/* We don't have any mechanism in the DRM yet to alert it that we've moved
@@ -1167,7 +1167,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
minspace = pitch * pScrn->virtualY;
avail = pScrn->videoRam * 1024;
- if (!pI830->useEXA) {
+ if (pI830->accel == ACCEL_XAA) {
maxCacheLines = (avail - minspace) / pitch;
/* This shouldn't happen. */
if (maxCacheLines < 0) {
@@ -1198,7 +1198,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
"Allocating %d scanlines for pixmap cache\n",
cacheLines);
} else {
- /* For EXA, we have a separate allocation for the linear allocator
+ /* For non-XAA, we have a separate allocation for the linear allocator
* which also does the pixmap cache.
*/
cacheLines = 0;
@@ -1213,7 +1213,7 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox,
* acceleration operations (non-XY COLOR_BLT) can't be done to tiled
* buffers.
*/
- if (!pI830->useEXA && IS_I965G(pI830))
+ if (pI830->accel <= ACCEL_XAA && IS_I965G(pI830))
tiling = FALSE;
else
tiling = pI830->tiling;
@@ -1412,7 +1412,7 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
}
/* even in XAA, 965G needs state mem buffer for rendering */
- if (IS_I965G(pI830) && !pI830->noAccel &&
+ if (IS_I965G(pI830) && pI830->accel != ACCEL_NONE &&
pI830->gen4_render_state_mem == NULL)
{
pI830->gen4_render_state_mem =
@@ -1450,7 +1450,7 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
return FALSE;
#ifdef I830_USE_EXA
- if (pI830->useEXA) {
+ if (pI830->accel == ACCEL_EXA) {
if (pI830->exa_offscreen == NULL) {
/* Default EXA to having 3 screens worth of offscreen memory space
* (for pixmaps).
@@ -1478,7 +1478,7 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn)
}
#endif /* I830_USE_EXA */
- if (!pI830->noAccel && !pI830->useEXA) {
+ 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.
diff --git a/src/i830_video.c b/src/i830_video.c
index 486f6708..1719835c 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -2460,13 +2460,13 @@ I830PutImage(ScrnInfoPtr pScrn,
}
#ifdef I830_USE_EXA
- if (pPriv->textured && pI830->useEXA) {
+ 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->useEXA &&
+ if (pPriv->textured && pI830->accel <= ACCEL_XAA &&
(((char *)pPixmap->devPrivate.ptr < (char *)pI830->FbBase) ||
((char *)pPixmap->devPrivate.ptr >= (char *)pI830->FbBase +
pI830->FbMapSize))) {