diff options
-rw-r--r-- | man/intel.man | 10 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/i830.h | 32 | ||||
-rw-r--r-- | src/i830_accel.c | 10 | ||||
-rw-r--r-- | src/i830_driver.c | 123 | ||||
-rw-r--r-- | src/i830_memory.c | 99 | ||||
-rw-r--r-- | src/i830_video.c | 12 | ||||
-rw-r--r-- | src/i830_xaa.c | 809 |
8 files changed, 13 insertions, 1085 deletions
diff --git a/man/intel.man b/man/intel.man index 4f8db817..3e74bc2d 100644 --- a/man/intel.man +++ b/man/intel.man @@ -147,12 +147,10 @@ have options for selecting adaptors. 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. +Choose acceleration architecture, either "UXA" or "EXA". +EXA is a simple acceleration architecture designed for systems without +kernel memory management, while UXA is designed to take advantage of the +capabilities of kernel memory management. .IP Default: "UXA" if kernel-modesetting is available, "EXA" otherwise. .TP diff --git a/src/Makefile.am b/src/Makefile.am index 6ab43fc3..64012691 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,7 +32,7 @@ SUBDIRS = xvmc bios_reader ch7017 ch7xxx ivch sil164 tfp410 $(REGDUMPER) AM_CFLAGS = @WARN_CFLAGS@ @XORG_CFLAGS@ @DRM_CFLAGS@ @DRI_CFLAGS@ \ @PCIACCESS_CFLAGS@ -I$(top_srcdir)/uxa \ - -DI830_XV -DI830_USE_XAA -DI830_USE_EXA -DI830_USE_UXA + -DI830_XV -DI830_USE_EXA -DI830_USE_UXA intel_drv_la_LTLIBRARIES = intel_drv.la intel_drv_la_LDFLAGS = -module -avoid-version @@ -112,7 +112,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 \ @@ -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" @@ -93,10 +92,6 @@ 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; #include "common.h" @@ -338,7 +333,6 @@ enum backlight_control { typedef enum accel_method { ACCEL_UNINIT = 0, ACCEL_NONE, - ACCEL_XAA, ACCEL_EXA, ACCEL_UXA } accel_method_t; @@ -356,8 +350,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; @@ -381,7 +373,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 @@ -455,28 +446,9 @@ typedef struct _I830Rec { 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); @@ -899,9 +871,9 @@ static inline int i830_fb_compression_supported(I830Ptr pI830) 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 diff --git a/src/i830_accel.c b/src/i830_accel.c index 12bb5a20..a3772c50 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" @@ -137,9 +136,6 @@ I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) else i830_dump_error_state(pScrn); ErrorF("space: %d wanted %d\n", ring->space, n); -#ifdef I830_USE_XAA - pI830->AccelInfoRec = NULL; /* Stops recursive behavior */ -#endif #ifdef I830_USE_EXA pI830->EXADriverPtr = NULL; #endif @@ -207,8 +203,6 @@ I830Sync(ScrnInfoPtr pScrn) } else if (!pI830->use_drm_mode) { i830_wait_ring_idle(pScrn); } - - pI830->nextColorExpandBuf = 0; } void @@ -315,10 +309,6 @@ I830AccelInit(ScreenPtr pScreen) 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_driver.c b/src/i830_driver.c index f8373a8c..93bb0eae 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -299,7 +299,6 @@ static PciChipsets I830PciChipsets[] = { typedef enum { OPTION_ACCELMETHOD, OPTION_NOACCEL, - OPTION_CACHE_LINES, OPTION_DRI, OPTION_VIDEO_KEY, OPTION_COLOR_KEY, @@ -319,7 +318,6 @@ typedef enum { 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}, @@ -1473,7 +1471,6 @@ static const char *accel_name[] = { "unspecified", "no", - "XAA", "EXA", "UXA", }; @@ -1574,20 +1571,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn) 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; @@ -1595,7 +1578,7 @@ I830AccelMethodInit(ScrnInfoPtr pScrn) #ifdef I830_USE_EXA pI830->accel = ACCEL_EXA; #endif -#if I830_USE_XAA + I830_USE_EXA + I830_USE_UXA >= 2 +#if I830_USE_EXA + I830_USE_UXA >= 2 from = X_DEFAULT; if ((s = (char *)xf86GetOptValString(pI830->Options, OPTION_ACCELMETHOD))) { @@ -1603,10 +1586,6 @@ I830AccelMethodInit(ScrnInfoPtr pScrn) 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; @@ -1916,16 +1895,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; @@ -2499,46 +2468,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. * @@ -2713,14 +2642,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)) @@ -3067,13 +2988,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; @@ -3105,9 +3019,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, @@ -3327,9 +3238,6 @@ I830LeaveVT(int scrnIndex, int flags) if ((pI830->accel == ACCEL_EXA || pI830->accel == ACCEL_UXA) && IS_I965G(pI830)) gen4_render_state_cleanup(pScrn); - if (pI830->AccelInfoRec) - pI830->AccelInfoRec->NeedToSync = FALSE; - ret = drmDropMaster(pI830->drmSubFD); if (ret) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -3483,9 +3391,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; @@ -3503,18 +3408,6 @@ 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); @@ -3667,14 +3560,6 @@ 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) { @@ -3702,12 +3587,6 @@ 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) { diff --git a/src/i830_memory.c b/src/i830_memory.c index 14b52ed9..c46541cf 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -64,11 +64,8 @@ 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 @@ -369,7 +366,6 @@ 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; @@ -1015,8 +1011,7 @@ i830_allocate_ringbuffer(ScrnInfoPtr pScrn) #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) @@ -1088,13 +1083,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. * @@ -1107,7 +1095,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; @@ -1128,67 +1115,17 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn) 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 = pitch * (fb_height + cacheLines); - size = ROUND_TO_PAGE(size); + size = ROUND_TO_PAGE(pitch * fb_height); - /* 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; @@ -1394,9 +1331,6 @@ 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 @@ -1435,29 +1369,6 @@ i830_allocate_2d_memory(ScrnInfoPtr pScrn) } #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; } diff --git a/src/i830_video.c b/src/i830_video.c index f73c1f7f..210f8db5 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" @@ -2488,16 +2486,6 @@ I830PutImage(ScrnInfoPtr pScrn, } #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, diff --git a/src/i830_xaa.c b/src/i830_xaa.c deleted file mode 100644 index a1180550..00000000 --- a/src/i830_xaa.c +++ /dev/null @@ -1,809 +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 - -static 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); - - return pI830->front_buffer->tiling != TILE_NONE; -} - -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->front_buffer->offset + (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->front_buffer->offset); - OUT_BATCH((src_y1 << 16) | (src_x1 & 0xffff)); - OUT_BATCH(pI830->BR[13] & 0xFFFF); - OUT_BATCH(pI830->front_buffer->offset); - - 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->front_buffer->offset); - 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->front_buffer->offset + - (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->front_buffer->offset + - (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 - */ -static 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; -} |