Index: configure.ac =================================================================== RCS file: /cvs/xorg/driver/xf86-video-trident/configure.ac,v retrieving revision 1.14 diff -u -r1.14 configure.ac --- configure.ac 21 Feb 2006 04:27:00 -0000 1.14 +++ configure.ac 9 Jul 2006 20:04:08 -0000 @@ -57,12 +57,14 @@ # Checks for pkg-config packages PKG_CHECK_MODULES(XORG, [xorg-server xproto fontsproto $REQUIRED_MODULES]) sdkdir=$(pkg-config --variable=sdkdir xorg-server) +PKG_CHECK_MODULES(DRI, [libdrm >= 2.0 xf86driproto]) # Checks for libraries. # Checks for header files. AC_HEADER_STDC +AC_SUBST([DRI_CFLAGS]) AC_SUBST([XORG_CFLAGS]) AC_SUBST([moduledir]) Index: src/Makefile.am =================================================================== RCS file: /cvs/xorg/driver/xf86-video-trident/src/Makefile.am,v retrieving revision 1.2 diff -u -r1.2 Makefile.am --- src/Makefile.am 21 Feb 2006 04:27:00 -0000 1.2 +++ src/Makefile.am 9 Jul 2006 20:04:08 -0000 @@ -23,7 +23,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 = @XORG_CFLAGS@ +AM_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ trident_drv_la_LTLIBRARIES = trident_drv.la trident_drv_la_LDFLAGS = -module -avoid-version trident_drv_ladir = @moduledir@/drivers Index: src/blade_accel_exa.c =================================================================== RCS file: /cvs/xorg/driver/xf86-video-trident/src/blade_accel_exa.c,v retrieving revision 1.6 diff -u -r1.6 blade_accel_exa.c --- src/blade_accel_exa.c 7 Apr 2006 21:42:44 -0000 1.6 +++ src/blade_accel_exa.c 9 Jul 2006 20:04:09 -0000 @@ -26,34 +26,37 @@ * Trident Blade3D EXA support. * TODO: * Composite hooks (some ops/arg. combos may not be supported) - * Upload/Download from screen (is this even possible with this chip?) - * Fast mixed directoion Blts + * Upload/Download from screen (requires DRM driver) + * DMA command submission */ +#include +#include + #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "xf86.h" +#include "xf86drm.h" #include "xf86_OSproc.h" - -#include "xf86PciInfo.h" #include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xaarop.h" #include "exa.h" #include "trident.h" #include "trident_regs.h" -#include "xaarop.h" +#include "blade_drm.h" #undef REPLICATE #define REPLICATE(r, bpp) \ { \ if (bpp == 16) { \ r = ((r & 0xFFFF) << 16) | (r & 0xFFFF); \ - } else \ - if (bpp == 8) { \ + } else if (bpp == 8) { \ r &= 0xFF; \ r |= (r<<8); \ r |= (r<<16); \ @@ -141,8 +144,39 @@ static void DoneSolid(PixmapPtr pPixmap) { +#if 0 /* Test geometry stuff */ + TRIDENTPtr pTrident = + TRIDENTPTR(xf86Screens[pPixmap->drawable.pScreen->myNum]); + int dst_stride = (pPixmap->drawable.width + 7) / 8; + int dst_off = exaGetPixmapOffset(pPixmap) / 8; + unsigned int x = 0, y = 0, x2 = 50, y2 = 50; + + BLADE_OUT(GER_FGCOLOR, 0xff00ff); + BLADE_OUT(GER_ROP, GetCopyROP(15)); + BLADE_OUT(GER_DSTBASE0, GetDepth(pPixmap->drawable.bitsPerPixel) | + dst_stride << 20 | dst_off); + + BLADE_OUT(GER_DRAW_CMD, GER_OP_LINE | + GER_DRAW_SRC_COLOR | GER_ROP_ENABLE | GER_SRC_CONST); + + BLADE_OUT(GER_DST1, y << 16 | x); + BLADE_OUT(GER_DST2, ((y2 - 1) & 0xfff) << 16 | ((x2 - 1) & 0xfff)); + + x2 <<= 4; y2 <<= 4; + + BLADE_OUT(RE_PRIM_ATTR, 0); + BLADE_OUT(RE_PRIM_TYPE, RE_MAJOR_EDGE | RE_SCAN_POS | x2 & 0xffff); + BLADE_OUT(RE_ARG_BASE + 0, y << 16 | x); + BLADE_OUT(RE_ARG_BASE + 4, 1 << 31 | 1 << 30 | 1); +#endif } +/* + * Copy routines. In the unlikely event that the planemask is not all + * ones, we program the bitmask register (Base + 0x84) with the value + * and remember to set the bitmask bit in the drawing register by + * overloading pTrident->BltScanDirection. + */ static Bool PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir, int alu, Pixel planemask) { @@ -155,10 +189,6 @@ pTrident->BltScanDirection = 0; - /* Blade only supports +xdir,+ydir && -xdir,-ydir */ - if ((xdir * ydir) < 0) - return FALSE; - REPLICATE(planemask, pSrcPixmap->drawable.bitsPerPixel); if (planemask != (unsigned int)-1) { BLADE_OUT(GER_BITMASK, ~planemask); @@ -206,26 +236,320 @@ { } -/* Composite comes later (if at all) */ -static Bool CheckComposite(int op, PicturePtr pSrcPicture, - PicturePtr pMaskPicture, PicturePtr pDstPicture) +/* + * Upload/Download routines. Here we need to ask the DRM driver to do + * the setup and copy for us. It'll take care of pinning the pages and + * starting the DMA. For large copies we may end up sleeping here (depends + * on the DRM driver implementation). + */ +static Bool UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, + char *src, int src_pitch) { - return 0; + ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + TRIDENTRegPtr pReg = &pTrident->ModeReg; + CARD32 fb_pitch = pDst->drawable.pScreen->width * + (pDst->drawable.bitsPerPixel / 8); + CARD32 fb_off = exaGetPixmapOffset(pDst) / 8; + drm_blade_dma_req_t req; + + ErrorF("UTS(%d, %d, %d, %d, 0x%p, %d)\n", x, y, w, h, src, src_pitch); + ErrorF(" fb_pitch: %d, fb_off: 0x%lx\n", fb_pitch, fb_off); + + req.sys_start = src; + req.sys_pitch = src_pitch; + req.fb_start = fb_off; + req.fb_pitch = fb_pitch; + req.height = h; + req.width = w * (pDst->drawable.bitsPerPixel / 8); + req.direction = BLADE_DMA_SYS_TO_FB; + + if (ioctl(pTrident->drm_fd, DRM_IOCTL_BLADE_DMA, &req)) { + ErrorF(" failed: %s\n", strerror(errno)); + return FALSE; + } + + exaMarkSync(pDst->drawable.pScreen); + return TRUE; +} + +static Bool DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, + char *dst, int dst_pitch) +{ + TRIDENTPtr pTrident = + TRIDENTPTR(xf86Screens[pSrc->drawable.pScreen->myNum]); + + return FALSE; +} + +/* + * Compositing operations. The CyberBlade isn't a very featureful chip, but + * we can support a few operations. Have to check the Render documentation + * to see what we can do reasonably. + */ +struct comp_op_str { + int op; + char *name; +}; + +static struct comp_op_str comp_op_strs[] = { + { PictOpMinimum, "PictOpMinimum" }, + { PictOpClear, "PictOpClear" }, + { PictOpSrc, "PictOpSrc" }, + { PictOpDst, "PictOpDst" }, + { PictOpOver, "PictOpOver" }, + { PictOpOverReverse, "PictOpOverReverse" }, + { PictOpIn, "PictOpIn" }, + { PictOpInReverse, "PictOpInReverse" }, + { PictOpOut, "PictOpOut" }, + { PictOpOutReverse, "PictOpOutReverse" }, + { PictOpAtop, "PictOpAtop" }, + { PictOpAtopReverse, "PictOpAtopReverse" }, + { PictOpXor, "PictOpXor" }, + { PictOpAdd, "PictOpAdd" }, + { PictOpSaturate, "PictOpSaturate" }, + { PictOpMaximum, "PictOpMaximum" }, +}; + +static char *strcompop(int op) +{ + int i; + + for (i = 0; i < sizeof(comp_op_strs); i++) + if (comp_op_strs[i].op == op) + return comp_op_strs[i].name; + return "(unknown)"; +} + +static Bool CheckComposite(int op, PicturePtr pSrc, PicturePtr pMask, + PicturePtr pDst) +{ + static int count; + + /* + * See which render ops are the most common... + */ + if (count++ % 100 == 0) { + ErrorF("CheckComposite(%s, %p, %p, %p)\n", strcompop(op), pSrc, pMask, + pDst); + if (pSrc && pSrc->transform) + ErrorF(" source transform\n"); + if (pDst && pDst->transform) + ErrorF(" dst. transform\n"); + } + + return FALSE; + + /* Don't support transforms yet... */ + if (pSrc->transform || pDst->transform) + return FALSE; + + /* Support simple mask and image overlays */ + if (pMask && !pMask->repeat && + pMask->format == PICT_a8 && + op == PictOpOver && + pSrc->repeat && + pSrc->pDrawable->width == 1 && + pSrc->pDrawable->height == 1 && + PICT_FORMAT_BPP(pSrc->format) == 32 && + (PICT_FORMAT_A(pSrc->format) == 0 || + pSrc->componentAlpha) && + pDst->pDrawable->bitsPerPixel == 32 && + pDst->pDrawable->type == DRAWABLE_WINDOW) + return TRUE; + + if (!pMask && + op == PictOpOver && + !pSrc->repeat && + PICT_FORMAT_A(pSrc->format) == 8 && + PICT_FORMAT_BPP(pSrc->format) == 32 && + pDst->pDrawable->bitsPerPixel == 32 && + pDst->pDrawable->type == DRAWABLE_WINDOW) + return TRUE; + + return FALSE; } static Bool PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst) { + TRIDENTPtr pTrident = + TRIDENTPTR(xf86Screens[pDstPicture->pDrawable->pScreen->myNum]); + pTrident->pMask = pMask; + pTrident->pSrc = pSrcPicture; return 0; } - -static void Composite(PixmapPtr pDst, int srcX, int srcY, int maskX, +#if 0 +static void Composite(PixmapPtr pDstPixmap, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int width, int height) { -} + TRIDENTPtr pTrident = + TRIDENTPTR(xf86Screens[pDstPixmap->drawable.pScreen->myNum]); + PixmapPtr pMask = pTrident->pMask; + PicturePtr pSrc = pTrident->pSrc; + RegionRec region; + int n; + BoxPtr pbox; + CARD32 rgb; + CARD8 *msk, *mskLine; + int mskBpp; + int mskXoff, mskYoff; + CARD32 *src, *srcLine; + CARD32 *off, *offLine; + int srcXoff, srcYoff; + int srcBpp; + int x_msk, y_msk, x_src, y_src, x_dst, y_dst; + int x2; + int w, h, w_this, h_this, w_remain; + CARD32 *off_screen; + int off_size = tridents->off_screen_size >> 2; + int off_width, off_height; + int stride = pScreenPriv->screen->fb[0].pixelStride; + int mskExtra; + CARD32 off_screen_offset = tridents->off_screen - tridents->screen; + int mode; + + /* Support simple mask and image overlays */ +#define MODE_NONE 0 +#define MODE_IMAGE 1 +#define MODE_MASK 2 + + rgb = *((CARD32 *) ((PixmapPtr) (pSrc->pDrawable))->devPrivate.ptr); + if (pMask && !pMask->repeat && + pMask->format == PICT_a8 && + op == PictOpOver && + pSrc->repeat && + pSrc->pDrawable->width == 1 && + pSrc->pDrawable->height == 1 && + PICT_FORMAT_BPP(pSrc->format) == 32 && + (PICT_FORMAT_A(pSrc->format) == 0 || + (rgb & 0xff000000) == 0xff000000) && + pDst->pDrawable->bitsPerPixel == 32 && + pDst->pDrawable->type == DRAWABLE_WINDOW) + mode = MODE_MASK; + else if (!pMask && + op == PictOpOver && + !pSrc->repeat && + PICT_FORMAT_A(pSrc->format) == 8 && + PICT_FORMAT_BPP(pSrc->format) == 32 && + pDst->pDrawable->bitsPerPixel == 32 && + pDst->pDrawable->type == DRAWABLE_WINDOW) + mode = MODE_IMAGE; + + xDst += pDst->pDrawable->x; + yDst += pDst->pDrawable->y; + xSrc += pSrc->pDrawable->x; + ySrc += pSrc->pDrawable->y; + + if (pMask) { + xMask += pMask->pDrawable->x; + yMask += pMask->pDrawable->y; + mskStride = mskStride * sizeof (FbBits) / sizeof (CARD8); + } + if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height)) + return; + + cop->multi = COP_MULTI_PATTERN; + cop->src_offset = off_screen_offset; + + if (mode == MODE_IMAGE) { + cop->multi = (COP_MULTI_ALPHA | + COP_ALPHA_BLEND_ENABLE | + COP_ALPHA_WRITE_ENABLE | + 0x7 << 16 | + COP_ALPHA_DST_BLEND_1_SRC_A | + COP_ALPHA_SRC_BLEND_1); + } else { + rgb &= 0xffffff; + cop->multi = (COP_MULTI_ALPHA | + COP_ALPHA_BLEND_ENABLE | + COP_ALPHA_WRITE_ENABLE | + 0x7 << 16 | + COP_ALPHA_DST_BLEND_1_SRC_A | + COP_ALPHA_SRC_BLEND_SRC_A); + } + + n = REGION_NUM_RECTS (®ion); + pbox = REGION_RECTS (®ion); + + while (n--) { + h = pbox->y2 - pbox->y1; + w = pbox->x2 - pbox->x1; + + offStride = (w + 7) & ~7; + off_height = off_size / offStride; + if (off_height > h) + off_height = h; + + cop->multi = COP_MULTI_STRIDE | (stride << 16) | offStride; + + y_dst = pbox->y1; + y_src = y_dst - yDst + ySrc; + y_msk = y_dst - yDst + yMask; + + x_dst = pbox->x1; + x_src = x_dst - xDst + xSrc; + x_msk = x_dst - xDst + xMask; + + if (mode == MODE_IMAGE) + srcLine = (CARD32 *) srcBits + (y_src - srcYoff) * srcStride + + (x_src - srcXoff); + else + mskLine = (CARD8 *) mskBits + (y_msk - mskYoff) * mskStride + + (x_msk - mskXoff); + + while (h) { + h_this = h; + if (h_this > off_height) + h_this = off_height; + h -= h_this; + + offLine = (CARD32 *) tridents->off_screen; + + _tridentWaitDone(cop); + + cop->dst_start_xy = TRI_XY(x_dst, y_dst); + cop->dst_end_xy = TRI_XY(x_dst + w - 1, y_dst + h_this - 1); + cop->src_start_xy = TRI_XY(0,0); + cop->src_end_xy = TRI_XY(w - 1, h_this - 1); + + if (mode == MODE_IMAGE) { + while (h_this--) { + w_remain = w; + src = srcLine; + srcLine += srcStride; + off = offLine; + offLine += offStride; + while (w_remain--) + *off++ = *src++; + } + } else { + while (h_this--) { + w_remain = w; + msk = mskLine; + mskLine += mskStride; + off = offLine; + offLine += offStride; + while (w_remain--) + *off++ = rgb | (*msk++ << 24); + } + } + + cop->command = (COP_OP_BLT | + COP_SCL_OPAQUE | + COP_OP_FB); + } + pbox++; + } + cop->src_offset = 0; + + exaMarkSync(pDst->pDrawable->pScreen); +} +#endif static void DoneComposite(PixmapPtr pDst) { } @@ -244,6 +568,7 @@ BLADE_OUT(GER_PATSTYLE, 0); /* Clear pattern & style first? */ BLADEBUSY(busy); + while (busy != 0) { if (--cnt < 0) { ErrorF("GE timeout\n"); @@ -255,8 +580,12 @@ } } +/* + * Nothing special to do for accessing a particular pixmap on the device. + */ static Bool PrepareAccess(PixmapPtr pPix, int index) { + return TRUE; } static void FinishAccess(PixmapPtr pPix, int index) @@ -278,6 +607,105 @@ BLADE_OUT(GER_PATSTYLE, 0); } +/* + * We need DRM for the DMA operations. There's no DRI support yet (no + * 3D driver) so we call the DRM stuff directly. + */ +Bool BladeInitDRM(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + drmVersionPtr drm_version; + + pTrident->drm_fd = drmOpen("blade", NULL); /* FIXME: multihead */ + + if (pTrident->drm_fd < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Could not open DRM (%s), disabling DMA transfers\n", + strerror(errno)); + return FALSE; + } + + drm_version = drmGetVersion(pTrident->drm_fd); + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "DRM version: %d.%d.%d (name: %s)\n", + drm_version->version_major, + drm_version->version_minor, + drm_version->version_patchlevel, + drm_version->name); + + return TRUE; +} + +/* + * AGP is nice to have. + */ +Bool BladeInitAGP(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + int agp_mode; + + if (drmAgpAcquire(pTrident->drm_fd)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Could not access AGP, disabling DMA transfers\n"); + return FALSE; + } + + pTrident->agpSize = drmAgpSize(pTrident->drm_fd); +// pTrident->agpSize = pTrident->agpSize < 2<<21 ? pTrident->agpSize : 1<<21; + pTrident->agpPhysical = drmAgpBase(pTrident->drm_fd); + + agp_mode = drmAgpGetMode(pTrident->drm_fd); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "AGP: version %d.%d\n" + " mode %x\n" + " base=%08lx size=%08lx\n" + , drmAgpVersionMajor(pTrident->drm_fd), + drmAgpVersionMinor(pTrident->drm_fd), agp_mode, + pTrident->agpPhysical, pTrident->agpSize); + + if (drmAgpEnable(pTrident->drm_fd, agp_mode) < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "could not enable AGP\n"); + return FALSE; + } + + if (drmAgpAlloc(pTrident->drm_fd, pTrident->agpSize, 0, 0, + &pTrident->drm_agp_handle)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "could not allocate AGP memory\n"); + return FALSE; + } + + if (drmAgpBind(pTrident->drm_fd, pTrident->drm_agp_handle, 0)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "could not bind AGP memory\n"); + return FALSE; + } + + if (drmAddMap(pTrident->drm_fd, 0, pTrident->agpSize, DRM_AGP, 0, + &pTrident->drm_agp_map_handle)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "could not add AGP map, %s\n", + strerror(errno)); + return FALSE; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "agp map handle=%08lx\n", + (unsigned long)pTrident->drm_agp_map_handle); + + if (drmMap(pTrident->drm_fd, pTrident->agpPhysical, pTrident->agpSize, + (drmAddressPtr)&pTrident->agpMemory)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "could not map AGP memory: %s\n", + strerror(errno)); + return FALSE; + } + + return TRUE; +} + +/* Debug routines */ +static int BladeTestDMA(ScrnInfoPtr pScrn); +static void BladeTestAGP(ScrnInfoPtr pScrn); + Bool BladeExaInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -295,11 +723,24 @@ ExaDriver->exa_major = 2; ExaDriver->exa_minor = 0; + /* We need DRM for UTS/DTS */ + if (BladeInitDRM(pScrn) && !BladeTestDMA(pScrn)) { + ExaDriver->UploadToScreen = UploadToScreen; + ExaDriver->DownloadFromScreen = DownloadFromScreen; + } + + /* AGP isn't strictly necessary though it's awfully nice */ + if (!BladeInitAGP(pScrn)) + ErrorF("Blade AGP initialization failed.\n"); + pTrident->EXADriverPtr = ExaDriver; pTrident->InitializeAccelerator = BladeInitializeAccelerator; BladeInitializeAccelerator(pScrn); + /* This keeps us from getting either -xdir,+ydir or +xdir,-ydir blts */ + ExaDriver->flags = EXA_TWO_BITBLT_DIRECTIONS; + ExaDriver->memoryBase = pTrident->FbBase; ExaDriver->memorySize = pScrn->videoRam * 1024; @@ -334,3 +775,74 @@ return exaDriverInit(pScreen, ExaDriver); } + +/* + * Debug routines + */ + +#define WIDTH 800 +#define HEIGHT 600 + +/* + * Test the DRM DMA implementation + */ +static int BladeTestDMA(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + drm_blade_dma_req_t req; + unsigned long *block = NULL; + int i, ret; + + block = malloc(sizeof(unsigned long) * WIDTH * HEIGHT); + if (!block) { + ErrorF("out of memory\n"); + return; + } + + for (i = 0; i < WIDTH * HEIGHT; i++) + block[i] = 0x0000ff00; + + /* Try to put it onto the framebuffer somewhere */ + req.sys_start = (unsigned char *)block; + req.sys_pitch = sizeof(unsigned long) * WIDTH; + req.fb_start = pTrident->FbBase; + req.fb_pitch = sizeof(unsigned long) * 800; + req.height = HEIGHT; + req.width = sizeof(unsigned long) * WIDTH; + req.direction = BLADE_DMA_SYS_TO_FB; + + ret = ioctl(pTrident->drm_fd, DRM_IOCTL_BLADE_DMA, &req); + + free(block); + ErrorF("DMA test result: %d\n", ret); + return ret; +} + +/* + * Test AGP transfer speeds. + */ +static void BladeTestAGP(ScrnInfoPtr pScrn) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + char *tmp; + struct timespec time1, time2; + double mb = pTrident->agpSize / (1024.0*1024.0); + double sec; + + if (!(tmp = malloc(pTrident->agpSize))) + return; + + clock_gettime(CLOCK_MONOTONIC, &time1); + memcpy(tmp, (char *)pTrident->agpMemory, pTrident->agpSize); + clock_gettime(CLOCK_MONOTONIC, &time2); + sec = time2.tv_sec - time1.tv_sec; + if (!sec) + sec = (time2.tv_nsec - time1.tv_nsec) / 1000000000.0; + else { + sec = time2.tv_nsec / 1000000000.0; + sec += (1000000000.0 - time1.tv_nsec) / 1000000000.0; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "AGP memory read test: %f MB/s\n", + mb / sec); + free(tmp); +} Index: src/trident.h =================================================================== RCS file: /cvs/xorg/driver/xf86-video-trident/src/trident.h,v retrieving revision 1.7 diff -u -r1.7 trident.h --- src/trident.h 7 Apr 2006 21:42:44 -0000 1.7 +++ src/trident.h 9 Jul 2006 20:04:09 -0000 @@ -27,6 +27,10 @@ #ifndef _TRIDENT_H_ #define _TRIDENT_H_ +#ifdef XF86DRI +#include "xf86drm.h" +#endif + #include #include #include @@ -66,6 +70,14 @@ EntityInfoPtr pEnt; ExaDriverPtr EXADriverPtr; int useEXA; + int drm_fd; + drm_handle_t drm_agp_handle; + drm_handle_t drm_agp_map_handle; + unsigned long agpSize; + unsigned long agpMemory; + unsigned long agpPhysical; + PixmapPtr pMask; + PicturePtr pSrc; int Chipset; int DACtype; int RamDac; Index: src/trident_dac.c =================================================================== RCS file: /cvs/xorg/driver/xf86-video-trident/src/trident_dac.c,v retrieving revision 1.7 diff -u -r1.7 trident_dac.c --- src/trident_dac.c 7 Apr 2006 21:42:44 -0000 1.7 +++ src/trident_dac.c 9 Jul 2006 20:04:10 -0000 @@ -685,10 +685,10 @@ pReg->tridentRegs3x4[AddColReg] &= 0xDF; pReg->tridentRegs3x4[AddColReg] |= (offset & 0x200) >> 4; } - + if (IsPciCard && UseMMIO) { if (!pTrident->NoAccel) - pReg->tridentRegs3x4[GraphEngReg] |= 0x80; + pReg->tridentRegs3x4[GraphEngReg] |= 0x80; } else { if (!pTrident->NoAccel) pReg->tridentRegs3x4[GraphEngReg] |= 0x82; Index: src/trident_driver.c =================================================================== RCS file: /cvs/xorg/driver/xf86-video-trident/src/trident_driver.c,v retrieving revision 1.19 diff -u -r1.19 trident_driver.c --- src/trident_driver.c 8 Apr 2006 01:51:12 -0000 1.19 +++ src/trident_driver.c 9 Jul 2006 20:04:12 -0000 @@ -568,6 +568,35 @@ NULL }; +#ifdef XF86DRI +static const char *drmSymbols[] = { + "drmOpen", + "drmAddBufs", + "drmAddMap", + "drmAgpAcquire", + "drmAgpVersionMajor", + "drmAgpVersionMinor", + "drmAgpAlloc", + "drmAgpBind", + "drmAgpEnable", + "drmAgpFree", + "drmAgpRelease", + "drmAgpUnbind", + "drmAuthMagic", + "drmCommandNone", + "drmCommandWrite", + "drmCreateContext", + "drmCtlInstHandler", + "drmCtlUninstHandler", + "drmDestroyContext", + "drmFreeVersion", + "drmGetInterruptFromBusID", + "drmGetLibVersion", + "drmGetVersion", + NULL +}; +#endif + #ifdef XFree86LOADER static MODULESETUPPROTO(tridentSetup); @@ -602,6 +631,9 @@ xf86AddDriver(&TRIDENT, module, 0); LoaderRefSymLists(vgahwSymbols, fbSymbols, i2cSymbols, vbeSymbols, ramdacSymbols, int10Symbols, +#ifdef XF86DRI + drmSymbols, +#endif xaaSymbols, exaSymbols, shadowSymbols, NULL); return (pointer)TRUE; } @@ -2466,7 +2498,7 @@ req.majorversion = 2; if (!LoadSubModule(pScrn->module, "exa", NULL, NULL, NULL, &req, - &errmaj, &errmin)) + &errmaj, &errmin) || !xf86LoadSubModule(pScrn, "drm")) { LoaderErrorMsg(NULL, "exa", errmaj, errmin); if (IsPciCard && UseMMIO) { @@ -2477,6 +2509,7 @@ return FALSE; } xf86LoaderReqSymLists(exaSymbols, NULL); + xf86LoaderReqSymLists(drmSymbols, NULL); } switch (pScrn->displayWidth * pScrn->bitsPerPixel / 8) { @@ -2959,7 +2992,7 @@ pTrident->BlockHandler = pScreen->BlockHandler; pScreen->BlockHandler = TRIDENTBlockHandler; - if (!pTrident->ShadowFB) + if (!pTrident->ShadowFB && !pTrident->useEXA) TRIDENTDGAInit(pScreen); if (!pTrident->Linear) { Index: src/trident_regs.h =================================================================== RCS file: /cvs/xorg/driver/xf86-video-trident/src/trident_regs.h,v retrieving revision 1.3 diff -u -r1.3 trident_regs.h --- src/trident_regs.h 21 Feb 2006 04:27:00 -0000 1.3 +++ src/trident_regs.h 9 Jul 2006 20:04:13 -0000 @@ -251,6 +251,37 @@ #define GER_SRCBASE2 0x21D0 #define GER_SRCBASE3 0x21C4 +/* Raster engine */ + +#define RE_PRIM_ATTR 0x2130 +#define RE_ATTR_Z (1 << 31) +#define RE_ATTR_TEX (1 << 30) +#define RE_ATTR_PERS (1 << 29) +#define RE_ATTR_COLOR (1 << 28) +#define RE_ATTR_SPEC (1 << 27) +#define RE_ATTR_FOG (1 << 26) +#define RE_ATTR_STEP (1 << 25) +#define RE_ATTR_ZNORM (1 << 6) +#define RE_ATTR_FLAT (1 << 5) +#define RE_ATTR_FULL_VERTEX (1 << 4) +#define RE_ATTR_SUBPIX (1 << 3) +#define RE_ATTR_AA (1 << 2) +#define RE_ATTR_AUTO_LINE (1 << 1) +#define RE_ATTR_BRES (1 << 0) +#define RE_PRIM_TYPE 0x213C +#define RE_TARG_SE (1 << 30) +#define RE_PRIM_NULL (1 << 29) +#define RE_PRIM_LAST (1 << 28) +#define RE_OP_LINE (0 << 26) +#define RE_OP_POLY (1 << 26) +#define RE_MAJOR_EDGE (1 << 25) +#define RE_MAJOR_AA (1 << 24) +#define RE_MINOR_EDGE (1 << 23) +#define RE_MINOR_AA (1 << 22) +#define RE_SCAN_POS (0 << 21) +#define RE_SCAN_NEG (1 << 21) +#define RE_ARG_BASE 0x2140 + /* Wait for VSync */ #define WAITFORVSYNC \ { \