diff options
author | kem <kem> | 2001-03-13 18:25:35 +0000 |
---|---|---|
committer | kem <kem> | 2001-03-13 18:25:35 +0000 |
commit | 96c4eb2cbbc450c4e7af8b4a1b19a3f3c5133a70 (patch) | |
tree | 8ffa06314fce648f971a42890cb54ec5c364c5b3 | |
parent | c227deecf6caf422e12a10c5c7f0cc1d1811d07f (diff) |
- Merge from trunk into branch IIsarea-1-0-0-20010314sarea-1-0-0-branch
28 files changed, 191 insertions, 238 deletions
diff --git a/xc/lib/GL/mesa/src/OSmesa/Imakefile b/xc/lib/GL/mesa/src/OSmesa/Imakefile index ee1b684ff..3eac5a7b0 100644 --- a/xc/lib/GL/mesa/src/OSmesa/Imakefile +++ b/xc/lib/GL/mesa/src/OSmesa/Imakefile @@ -75,6 +75,7 @@ MESA_INCLUDES = -I. -I.. -I../../include -I../../../../../include ../stages.c \ ../state.c \ ../stencil.c \ + ../texformat.c \ ../teximage.c \ ../texobj.c \ ../texstate.c \ @@ -149,6 +150,7 @@ MESA_INCLUDES = -I. -I.. -I../../include -I../../../../../include ../stages.o \ ../state.o \ ../stencil.o \ + ../texformat.o \ ../teximage.o \ ../texobj.o \ ../texstate.o \ diff --git a/xc/lib/GL/mesa/src/drv/ffb/Imakefile b/xc/lib/GL/mesa/src/drv/ffb/Imakefile index d66bc2bfb..b3ae59e4f 100644 --- a/xc/lib/GL/mesa/src/drv/ffb/Imakefile +++ b/xc/lib/GL/mesa/src/drv/ffb/Imakefile @@ -100,6 +100,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ ../../stages.c \ ../../state.c \ ../../stencil.c \ + ../../texformat.c \ ../../teximage.c \ ../../texobj.c \ ../../texstate.c \ @@ -173,6 +174,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ ../../stages.o \ ../../state.o \ ../../stencil.o \ + ../../texformat.o \ ../../teximage.o \ ../../texobj.o \ ../../texstate.o \ diff --git a/xc/lib/GL/mesa/src/drv/gamma/Imakefile b/xc/lib/GL/mesa/src/drv/gamma/Imakefile index 95a1b6450..48387680e 100644 --- a/xc/lib/GL/mesa/src/drv/gamma/Imakefile +++ b/xc/lib/GL/mesa/src/drv/gamma/Imakefile @@ -40,7 +40,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) + INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) DRISRCS = ../../../dri/dri_mesa.c \ ../../../../dri/dri_tmm.c @@ -129,6 +129,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ ../../stages.c \ ../../state.c \ ../../stencil.c \ + ../../texformat.c \ ../../teximage.c \ ../../texobj.c \ ../../texstate.c \ @@ -202,6 +203,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ ../../stages.o \ ../../state.o \ ../../stencil.o \ + ../../texformat.o \ ../../teximage.o \ ../../texobj.o \ ../../texstate.o \ diff --git a/xc/lib/GL/mesa/src/drv/i810/Imakefile b/xc/lib/GL/mesa/src/drv/i810/Imakefile index 570c1bad9..1353d4273 100644 --- a/xc/lib/GL/mesa/src/drv/i810/Imakefile +++ b/xc/lib/GL/mesa/src/drv/i810/Imakefile @@ -39,7 +39,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ -I../../../../dri/drm DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) $(ASM_DEFINES) - INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) + INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) DRISRCS = ../../../dri/dri_mesa.c \ ../../../../dri/dri_tmm.c @@ -134,6 +134,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ ../../stages.c \ ../../state.c \ ../../stencil.c \ + ../../texformat.c \ ../../teximage.c \ ../../texobj.c \ ../../texstate.c \ @@ -207,6 +208,7 @@ MESA_INCLUDES = -I. -I.. -I../../include \ ../../stages.o \ ../../state.o \ ../../stencil.o \ + ../../texformat.o \ ../../teximage.o \ ../../texobj.o \ ../../texstate.o \ diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c index 8e7bb0f24..d10969df4 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c @@ -169,16 +169,30 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->depthOffset = serverInfo->depthOffset; mgaScreen->depthPitch = serverInfo->depthPitch; + mgaScreen->mmio.handle = serverInfo->registers.handle; + mgaScreen->mmio.size = serverInfo->registers.size; + if ( drmMap( sPriv->fd, + mgaScreen->mmio.handle, mgaScreen->mmio.size, + &mgaScreen->mmio.map ) < 0 ) { + FREE( mgaScreen ); + sPriv->private = NULL; + __driMesaMessage( "Couldn't map MMIO registers" ); + return GL_FALSE; + } + +#if 0 mgaScreen->status.handle = serverInfo->status.handle; mgaScreen->status.size = serverInfo->status.size; - if ( drmMap( sPriv->fd, mgaScreen->status.handle, mgaScreen->status.size, &mgaScreen->status.map ) < 0 ) { + drmUnmap( mgaScreen->mmio.map, mgaScreen->mmio.size ); FREE( mgaScreen ); sPriv->private = NULL; + __driMesaMessage( "Couldn't map status page" ); return GL_FALSE; } +#endif mgaScreen->primary.handle = serverInfo->primary.handle; mgaScreen->primary.size = serverInfo->primary.size; @@ -386,8 +400,10 @@ GLboolean XMesaCreateContext( Display *dpy, GLvisual *mesaVis, mmesa->texAge[0] = 0; mmesa->texAge[1] = 0; +#if 0 mmesa->status = (GLuint *)mmesa->mgaScreen->status.map; - mmesa->status_offset = mmesa->mgaScreen->primary.handle; +#endif + mmesa->primary_offset = mmesa->mgaScreen->primary.handle; ctx->DriverCtx = (void *) mmesa; mmesa->glCtx = ctx; diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h index 8a5726f22..5dcede8ec 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.h @@ -76,6 +76,7 @@ typedef struct mga_screen_private_s { __DRIscreenPrivate *sPriv; drmBufMapPtr bufs; + drmRegion mmio; drmRegion status; drmRegion primary; drmRegion buffers; @@ -110,7 +111,7 @@ extern void mgaEmitScissorValues( mgaContextPtr mmesa, int box_nr, int emit ); */ #define LOCK_HARDWARE_QUIESCENT( mmesa ) do { \ LOCK_HARDWARE( mmesa ); \ - mgaUpdateLock( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); \ + UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); \ } while (0) @@ -134,5 +135,17 @@ do { \ #define GET_DRAWABLE_LOCK( mmesa ) while(0) #define RELEASE_DRAWABLE_LOCK( mmesa ) while(0) + +/* The 2D driver macros are busted -- we can't use them here as they + * rely on the 2D driver data structures rather than taking an explicit + * base address. + */ +#define MGA_BASE( reg ) ((CARD32)(mmesa->mgaScreen->mmio.map)) +#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg) + +#define MGA_DEREF( reg ) *(volatile CARD32 *)MGA_ADDR( reg ) +#define MGA_READ( reg ) MGA_DEREF( reg ) +#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0) + #endif #endif diff --git a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h index e1aacb193..c82b70cc8 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgacontext.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgacontext.h @@ -223,8 +223,8 @@ struct mga_context_t { */ unsigned int texAge[MGA_NR_TEX_HEAPS];/* texture LRU age */ unsigned int dirtyAge; /* buffer age for synchronization */ - GLuint *status; - GLuint status_offset; + + GLuint primary_offset; /* Mirrors of some DRI state. */ diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c index c31d23eca..4624cee1e 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.c @@ -43,50 +43,6 @@ static void mga_iload_dma_ioctl(mgaContextPtr mmesa, } -int mgaUpdateLock( mgaContextPtr mmesa, drmLockFlags flags ) -{ -#if 0 - drm_lock_t lock; - int retcode; - - lock.flags = 0; - - if (mmesa->sarea->last_quiescent != mmesa->sarea->last_enqueue && - flags & DRM_LOCK_QUIESCENT) { - if (MGA_DEBUG&DEBUG_VERBOSE_IOCTL) - fprintf(stderr, "mgaLockQuiescent\n"); - lock.flags |= _DRM_LOCK_QUIESCENT; - } - - if (flags & DRM_LOCK_FLUSH) lock.flags |= _DRM_LOCK_FLUSH; - if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL; - - if (!lock.flags) - return 0; - - retcode = ioctl(mmesa->driFd, DRM_IOCTL_MGA_FLUSH, &lock); - if(retcode != 0) { - fprintf(stderr, "Lockupdate failed\n"); - if(retcode == EACCES) exit(1); - else return -1; - } - - if(flags & DRM_LOCK_QUIESCENT) - mmesa->sarea->last_quiescent = mmesa->sarea->last_enqueue; -#else - int ret; - - ret = drmMGAFlushDMA( mmesa->driFd, flags ); - if ( ret ) { - fprintf(stderr, "Lockupdate failed\n"); - if (ret == EACCES) exit(1); - else return -1; - } -#endif - - return 0; -} - drmBufPtr mga_get_buffer_ioctl( mgaContextPtr mmesa ) { int idx = 0; @@ -288,9 +244,9 @@ void mgaSwapBuffers( mgaContextPtr mmesa ) { __DRIdrawablePrivate *dPriv = mmesa->driDrawable; XF86DRIClipRectPtr pbox; - int nbox; - int ret; - int i; + GLint nbox; + GLint ret, wait = 0; + GLint i; GLuint last_frame, last_wrap; FLUSH_BATCH( mmesa ); @@ -305,10 +261,25 @@ void mgaSwapBuffers( mgaContextPtr mmesa ) while ( 1 ) { if ( last_wrap < mmesa->sarea->last_wrap || ( last_wrap == mmesa->sarea->last_wrap && - last_frame <= *mmesa->status - mmesa->status_offset ) ) { + last_frame <= (MGA_READ( MGAREG_PRIMADDRESS ) - + mmesa->primary_offset) ) ) { break; } + if ( 0 ) { + wait++; + fprintf( stderr, " last: head=0x%06x wrap=%d\n", + last_frame, last_wrap ); + fprintf( stderr, " head: head=0x%06x wrap=%d\n", + MGA_READ( MGAREG_PRIMADDRESS ) - mmesa->primary_offset, + mmesa->sarea->last_wrap ); + } + + for ( i = 0 ; i < 1024 ; i++ ) { + /* Don't just hammer the register... */ + } } + if ( wait ) + fprintf( stderr, "\n" ); /* Use the frontbuffer cliprects */ @@ -566,9 +537,6 @@ void mgaFireILoadLocked( mgaContextPtr mmesa, fprintf(stderr, "mgaFireILoad idx %d ofs 0x%x length %d\n", mmesa->iload_buffer->idx, (int)offset, (int)length ); - /* HACK - */ - UPDATE_LOCK( mmesa, DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); mga_iload_dma_ioctl( mmesa, offset, length ); } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h index 7fd1dbce9..b8207e540 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgaioctl.h @@ -26,7 +26,6 @@ void mgaFireILoadLocked( mgaContextPtr mmesa, void mgaWaitAgeLocked( mgaContextPtr mmesa, int age ); void mgaWaitAge( mgaContextPtr mmesa, int age ); -int mgaUpdateLock( mgaContextPtr mmesa, drmLockFlags flags ); void mgaFlushVertices( mgaContextPtr mmesa ); void mgaFlushVerticesLocked( mgaContextPtr mmesa ); @@ -94,10 +93,11 @@ GLuint *mgaAllocVertexDwordsInline( mgaContextPtr mmesa, int dwords ) #define UPDATE_LOCK( mmesa, flags ) \ do { \ GLint ret = drmMGAFlushDMA( mmesa->driFd, flags ); \ - if ( ret ) { \ + if ( ret < 0 ) { \ drmMGAEngineReset( mmesa->driFd ); \ UNLOCK_HARDWARE( mmesa ); \ - fprintf( stderr, "drmMGAFlushDMA: return = %d\n", ret ); \ + fprintf( stderr, __FUNCTION__ ": flush ret=%d\n", ret ); \ + /*fprintf( stderr, "drmMGAFlushDMA: return = %d\n", ret );*/ \ exit( 1 ); \ } \ } while (0) diff --git a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c b/xc/lib/GL/mesa/src/drv/mga/mgapixel.c index 72903c209..94d98295e 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgapixel.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgapixel.c @@ -285,7 +285,7 @@ mgaDDReadPixels( GLcontext *ctx, __DRIdrawablePrivate *dPriv = mmesa->driDrawable; int nbox, retcode, i; - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); if (mmesa->dirty_cliprects & MGA_FRONT) mgaUpdateRects( mmesa, MGA_FRONT ); @@ -349,7 +349,7 @@ mgaDDReadPixels( GLcontext *ctx, } } - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); } UNLOCK_HARDWARE( mmesa ); @@ -511,8 +511,7 @@ mgaDDDrawPixels( GLcontext *ctx, return GL_FALSE; } - LOCK_HARDWARE( mmesa ); - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + LOCK_HARDWARE_QUIESCENT( mmesa ); if (mmesa->dirty_cliprects & MGA_FRONT) mgaUpdateRects( mmesa, MGA_FRONT ); @@ -522,7 +521,7 @@ mgaDDDrawPixels( GLcontext *ctx, { do_draw_pix( ctx, x, y, width, height, pitch, pixels, dest, planemask ); - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); } else { @@ -578,7 +577,7 @@ mgaDDDrawPixels( GLcontext *ctx, /* Fix me -- use multiple buffers to avoid flush. */ - mgaUpdateLock( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); + UPDATE_LOCK( mmesa, DRM_LOCK_FLUSH | DRM_LOCK_QUIESCENT ); pixels = (void *)((char *) pixels + rows * pitch); height -= rows; diff --git a/xc/lib/GL/mesa/src/drv/sis/Imakefile b/xc/lib/GL/mesa/src/drv/sis/Imakefile index 505d18831..dea96d209 100644 --- a/xc/lib/GL/mesa/src/drv/sis/Imakefile +++ b/xc/lib/GL/mesa/src/drv/sis/Imakefile @@ -168,6 +168,7 @@ LinkSourceFile(xdriP.h, ../../X) ../../stages.c \ ../../state.c \ ../../stencil.c \ + ../../texformat.c \ ../../teximage.c \ ../../texobj.c \ ../../texstate.c \ @@ -241,6 +242,7 @@ LinkSourceFile(xdriP.h, ../../X) ../../stages.o \ ../../state.o \ ../../stencil.o \ + ../../texformat.o \ ../../teximage.o \ ../../texobj.o \ ../../texstate.o \ @@ -383,7 +385,7 @@ NormalLintTarget($(SRCS)) #if !GlxUseBuiltInDRIDriver LIBNAME = sis_dri.so -ALL_OBJS = $(OBJS) +ALL_OBJS = $(OBJS) ALL_DEPS = DONE SharedDepModuleTarget($(LIBNAME),$(ALL_DEPS),$(ALL_OBJS)) InstallDynamicModule($(LIBNAME),$(MODULEDIR),dri) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c index 3b34acf08..73fbb11bd 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c @@ -366,6 +366,7 @@ void MGAGetQuiescence( ScrnInfoPtr pScrn ) { MGAPtr pMga = MGAPTR(pScrn); + DRILock( screenInfo.screens[pScrn->scrnIndex], 0 ); pMga->haveQuiescense = 1; if ( pMga->directRenderingEnabled ) { @@ -403,12 +404,14 @@ void MGAGetQuiescenceShared( ScrnInfoPtr pScrn ) MGAEntPtr pMGAEnt = pMga->entityPrivate; MGAPtr pMGA2 = MGAPTR(pMGAEnt->pScrn_2); + DRILock( screenInfo.screens[pMGAEnt->pScrn_1->scrnIndex], 0 ); + pMga = MGAPTR(pMGAEnt->pScrn_1); pMga->haveQuiescense = 1; pMGA2->haveQuiescense = 1; if ( pMGAEnt->directRenderingEnabled ) { - MGAWaitForIdleDMA( pScrn ); + MGAWaitForIdleDMA( pMGAEnt->pScrn_1 ); pMga->RestoreAccelState( pScrn ); xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex ); } @@ -510,13 +513,24 @@ static void MGABlockHandler( int screenNum, pointer blockData, ScreenPtr pScreen = screenInfo.screens[screenNum]; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); + MGAEntPtr pMGAEnt; if ( pMga->haveQuiescense ) { - pMga->haveQuiescense = 0; - - if ( pMga->directRenderingEnabled ) { - DRIUnlock( pScreen ); + if ( xf86IsEntityShared( pScrn->entityList[0] ) ) { + /* Restore to first screen */ + pMga->RestoreAccelState( pScrn ); + xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex ); + pMGAEnt = pMga->entityPrivate; + + if ( pMGAEnt->directRenderingEnabled ) { + DRIUnlock( screenInfo.screens[pMGAEnt->pScrn_1->scrnIndex] ); + } + } else { + if ( pMga->directRenderingEnabled ) { + DRIUnlock( pScreen ); + } } + pMga->haveQuiescense = 0; } } @@ -561,7 +575,7 @@ static Bool MGADRIAgpInit(ScreenPtr pScreen) /* FIXME: Make these configurable... */ - pMGADRIServer->agp.size = 8 * 1024 * 1024; + pMGADRIServer->agp.size = 12 * 1024 * 1024; pMGADRIServer->warp.offset = 0; pMGADRIServer->warp.size = MGA_WARP_UCODE_SIZE; @@ -749,8 +763,10 @@ static Bool MGADRIMapInit( ScreenPtr pScreen ) pMGADRIServer->registers.size = MGAIOMAPSIZE; - if ( drmAddMap( pMga->drmFD, (drmHandle)pMga->IOAddress, - pMGADRIServer->registers.size, DRM_REGISTERS, 0, + if ( drmAddMap( pMga->drmFD, + (drmHandle)pMga->IOAddress, + pMGADRIServer->registers.size, + DRM_REGISTERS, DRM_READ_ONLY, &pMGADRIServer->registers.handle ) < 0 ) { xf86DrvMsg( pScreen->myNum, X_ERROR, "[drm] Could not add MMIO registers mapping\n" ); @@ -1171,6 +1187,8 @@ Bool MGADRIFinishScreenInit( ScreenPtr pScreen ) pMGADRI->logTextureGranularity = i; pMGADRI->textureSize = (pMGADRI->textureSize >> i) << i; /* truncate */ + pMGADRI->registers.handle = pMGADRIServer->registers.handle; + pMGADRI->registers.size = pMGADRIServer->registers.size; pMGADRI->status.handle = pMGADRIServer->status.handle; pMGADRI->status.size = pMGADRIServer->status.size; pMGADRI->primary.handle = pMGADRIServer->primary.handle; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h index 56069492f..7e6794348 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h @@ -77,22 +77,6 @@ typedef struct { drmBufMapPtr drmBuffers; - - - - Bool agpAcquired; - drmHandle agp_private; - drmSize agpSizep; - drmAddress agpBase; - int irq; - drmHandle regs; - drmSize regsSize; - drmAddress regsMap; - -#if 0 - drmMGAWarpIndex WarpIndex[MGA_MAX_WARP_PIPES]; -#endif - CARD8 *agp_map; } MGADRIServerPrivateRec, *MGADRIServerPrivatePtr; typedef struct { @@ -127,6 +111,7 @@ typedef struct { unsigned int mAccess; + drmRegion registers; drmRegion status; drmRegion primary; drmRegion buffers; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h index 8be2a6204..db0180527 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h @@ -84,7 +84,6 @@ while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \ #ifdef XF86DRI #define CHECK_DMA_QUIESCENT(pMGA, pScrn) { \ if (!pMGA->haveQuiescense) { \ - DRILock( screenInfo.screens[pScrn->scrnIndex], 0 ); \ pMGA->GetQuiescence( pScrn ); \ } \ } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h index d26ef774a..cb1c3e962 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h @@ -91,7 +91,7 @@ /* 32 buffers of 64k each, total 1 meg. */ #define MGA_BUFFER_SIZE (1 << 16) -#define MGA_NUM_BUFFERS 64 +#define MGA_NUM_BUFFERS 128 /* Keep these small for testing. */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c index 21e14f376..ec80fb417 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c @@ -178,7 +178,7 @@ void mga_do_dma_flush( drm_mga_private_t *dev_priv ) primary->last_flush = primary->tail; - head = *primary->head; + head = MGA_READ( MGA_PRIMADDRESS ); if ( head <= tail ) { primary->space = primary->size - primary->tail; @@ -218,7 +218,7 @@ void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) primary->last_flush = 0; primary->last_wrap++; - head = *primary->head; + head = MGA_READ( MGA_PRIMADDRESS ); if ( head == dev_priv->primary->offset ) { primary->space = primary->size; @@ -240,7 +240,6 @@ void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) { - drm_mga_primary_buffer_t *primary = &dev_priv->prim; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; u32 head = dev_priv->primary->offset; DRM_DEBUG( "%s:\n", __FUNCTION__ ); @@ -248,8 +247,6 @@ void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) sarea_priv->last_wrap++; DRM_DEBUG( " wrap = %d\n", sarea_priv->last_wrap ); - *primary->head = head; - mga_flush_write_combine(); MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL ); @@ -272,7 +269,7 @@ static void mga_freelist_print( drm_device_t *dev ) DRM_INFO( "\n" ); DRM_INFO( "current dispatch: last=0x%x done=0x%x\n", dev_priv->sarea_priv->last_dispatch, - (unsigned int)(*dev_priv->prim.head - + (unsigned int)(MGA_READ( MGA_PRIMADDRESS ) - dev_priv->primary->offset) ); DRM_INFO( "current freelist:\n" ); @@ -375,7 +372,7 @@ static drm_buf_t *mga_freelist_get( drm_device_t *dev ) u32 head, wrap; DRM_DEBUG( "%s:\n", __FUNCTION__ ); - head = *dev_priv->prim.head; + head = MGA_READ( MGA_PRIMADDRESS ); wrap = dev_priv->sarea_priv->last_wrap; DRM_DEBUG( " tail=0x%06lx %d\n", @@ -403,7 +400,7 @@ int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_freelist_t *head, *next, *prev; + drm_mga_freelist_t *head, *entry, *prev; DRM_DEBUG( "%s: age=0x%06lx wrap=%d\n", __FUNCTION__, @@ -411,22 +408,23 @@ int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ) dev_priv->primary->offset, buf_priv->list_entry->age.wrap ); - /* Put buffer on the head + 1, as the head is a sentinal. - */ - - next = buf_priv->list_entry; + entry = buf_priv->list_entry; head = dev_priv->head; - prev = head->next; if ( buf_priv->list_entry->age.head == MGA_BUFFER_USED ) { - SET_AGE( &next->age, MGA_BUFFER_FREE, 0 ); + SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); + prev = dev_priv->tail; + prev->next = entry; + entry->prev = prev; + entry->next = NULL; + } else { + prev = head->next; + head->next = entry; + prev->prev = entry; + entry->prev = head; + entry->next = prev; } - head->next = next; - prev->prev = next; - next->prev = head; - next->next = prev; - return 0; } @@ -529,7 +527,6 @@ static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) + dev_priv->primary->size); dev_priv->prim.size = dev_priv->primary->size; - dev_priv->prim.head = &dev_priv->prim.status[0]; dev_priv->prim.tail = 0; dev_priv->prim.space = dev_priv->prim.size; @@ -625,10 +622,11 @@ int mga_dma_flush( struct inode *inode, struct file *filp, WRAP_TEST_WITH_RETURN( dev_priv ); +#if 0 if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) { mga_do_dma_flush( dev_priv ); } - +#endif if ( lock.flags & _DRM_LOCK_QUIESCENT ) { return mga_do_wait_for_idle( dev_priv ); } else { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h index c2fe4a188..5cf863185 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h @@ -97,7 +97,7 @@ /* 32 buffers of 64k each, total 2 meg. */ #define MGA_BUFFER_SIZE (1 << 16) -#define MGA_NUM_BUFFERS 32 +#define MGA_NUM_BUFFERS 128 /* Keep these small for testing. */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h index f56186e1e..bd33d9d1e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h @@ -36,7 +36,6 @@ typedef struct drm_mga_primary_buffer { u8 *end; int size; - volatile u32 *head; u32 tail; int space; @@ -246,6 +245,13 @@ do { \ #define FLUSH_DMA() \ do { \ + if ( 0 ) { \ + DRM_INFO( __FUNCTION__ ":\n" ); \ + DRM_INFO( " tail=0x%06x head=0x%06lx\n", \ + dev_priv->prim.tail, \ + MGA_READ( MGA_PRIMADDRESS ) - \ + dev_priv->primary->offset ); \ + } \ if ( dev_priv->prim.space < dev_priv->prim.high_mark ) { \ mga_do_dma_wrap_start( dev_priv ); \ } else { \ @@ -278,7 +284,7 @@ do { \ } while (0) -/* Buffer ageing via primary DMA stream head pointer. +/* Buffer aging via primary DMA stream head pointer. */ #define SET_AGE( age, h, w ) \ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c index dc2c8c301..1e1c2827a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c @@ -591,20 +591,9 @@ static void mga_dma_dispatch_swap( drm_device_t *dev ) int i; DMA_LOCALS; DRM_DEBUG( __FUNCTION__ ":\n" ); - DRM_DEBUG( " head = 0x%06x\n", *dev_priv->prim.head ); + DRM_DEBUG( " head = 0x%06x\n", MGA_READ( MGA_PRIMADDRESS ) ); - sarea_priv->last_frame.head = dev_priv->prim.tail; - sarea_priv->last_frame.wrap = dev_priv->prim.last_wrap; - - DRM_DEBUG( " tail = 0x%06x\n", dev_priv->prim.tail ); - DRM_DEBUG( " wrap = 0x%06x\n", dev_priv->prim.last_wrap ); - - BEGIN_DMA( 4 + nbox ); - - DMA_BLOCK( MGA_DMAPAD, 0x00000000, - MGA_DMAPAD, 0x00000000, - MGA_DWGSYNC, 0x00007100, - MGA_DWGSYNC, 0x00007000 ); + BEGIN_DMA( 3 + nbox ); DMA_BLOCK( MGA_DSTORG, dev_priv->front_offset, MGA_MACCESS, dev_priv->maccess, @@ -635,6 +624,12 @@ static void mga_dma_dispatch_swap( drm_device_t *dev ) ADVANCE_DMA(); + DRM_DEBUG( " tail = 0x%06x\n", dev_priv->prim.tail ); + DRM_DEBUG( " wrap = 0x%06x\n", dev_priv->prim.last_wrap ); + + sarea_priv->last_frame.head = dev_priv->prim.tail; + sarea_priv->last_frame.wrap = dev_priv->prim.last_wrap; + FLUSH_DMA(); DRM_DEBUG( "%s... done.\n", __FUNCTION__ ); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c index f4b4f0c4a..c0e20c213 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c @@ -839,13 +839,9 @@ int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) int i; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - ring->space = *ring->head - ring->tail; - if ( ring->space <= 0 ) - ring->space += ring->size; - + r128_update_ring_snapshot( ring ); if ( ring->space >= n ) return 0; - udelay( 1 ); } @@ -854,19 +850,6 @@ int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) return -EBUSY; } -void r128_update_ring_snapshot( drm_r128_private_t *dev_priv ) -{ - drm_r128_ring_buffer_t *ring = &dev_priv->ring; - - ring->space = *ring->head - ring->tail; -#if R128_PERFORMANCE_BOXES - if ( ring->space == 0 ) - atomic_inc( &dev_priv->idle_count ); -#endif - if ( ring->space <= 0 ) - ring->space += ring->size; -} - static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d ) { int i; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c index e42868ed6..daae0f875 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c @@ -38,11 +38,11 @@ #define DRIVER_NAME "r128" #define DRIVER_DESC "ATI Rage 128" -#define DRIVER_DATE "20010216" +#define DRIVER_DATE "20010308" #define DRIVER_MAJOR 2 #define DRIVER_MINOR 1 -#define DRIVER_PATCHLEVEL 4 +#define DRIVER_PATCHLEVEL 5 #define DRIVER_IOCTLS \ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h index 9f53746f8..6216b9a1b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h @@ -130,7 +130,14 @@ extern void r128_freelist_reset( drm_device_t *dev ); extern drm_buf_t *r128_freelist_get( drm_device_t *dev ); extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); -extern void r128_update_ring_snapshot( drm_r128_private_t *dev_priv ); + +static inline void +r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring ) +{ + ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32); + if ( ring->space <= 0 ) + ring->space += ring->size; +} extern int r128_do_cce_idle( drm_r128_private_t *dev_priv ); extern int r128_do_cleanup_cce( drm_device_t *dev ); @@ -415,9 +422,7 @@ do { \ drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i; \ if ( ring->space < ring->high_mark ) { \ for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ - ring->space = *ring->head - ring->tail; \ - if ( ring->space <= 0 ) \ - ring->space += ring->size; \ + r128_update_ring_snapshot( ring ); \ if ( ring->space >= ring->high_mark ) \ goto __ring_space_done; \ udelay( 1 ); \ @@ -462,7 +467,7 @@ do { \ DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ (n), __FUNCTION__ ); \ } \ - if ( dev_priv->ring.space < (n) * sizeof(u32) ) { \ + if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ r128_wait_ring( dev_priv, (n) * sizeof(u32) ); \ } \ dev_priv->ring.space -= (n) * sizeof(u32); \ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c index fa16f3ced..9fc6b485c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c @@ -372,8 +372,6 @@ static void r128_cce_dispatch_clear( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { unsigned int tmp = flags; @@ -477,8 +475,6 @@ static void r128_cce_dispatch_swap( drm_device_t *dev ) RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - #if R128_PERFORMANCE_BOXES /* Do some trivial performance monitoring... */ @@ -535,8 +531,6 @@ static void r128_cce_dispatch_flip( drm_device_t *dev ) RING_LOCALS; DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); - r128_update_ring_snapshot( dev_priv ); - #if R128_PERFORMANCE_BOXES /* Do some trivial performance monitoring... */ @@ -587,8 +581,6 @@ static void r128_cce_dispatch_vertex( drm_device_t *dev, DRM_DEBUG( "%s: buf=%d nbox=%d\n", __FUNCTION__, buf->idx, sarea_priv->nbox ); - r128_update_ring_snapshot( dev_priv ); - if ( 0 ) r128_print_dirty( "dispatch_vertex", sarea_priv->dirty ); @@ -656,8 +648,6 @@ static void r128_cce_dispatch_indirect( drm_device_t *dev, DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end ); - r128_update_ring_snapshot( dev_priv ); - if ( start != end ) { int offset = buf->bus_address + start; int dwords = (end - start + 3) / sizeof(u32); @@ -722,8 +712,6 @@ static void r128_cce_dispatch_indices( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); - r128_update_ring_snapshot( dev_priv ); - if ( 0 ) r128_print_dirty( "dispatch_indices", sarea_priv->dirty ); @@ -799,8 +787,6 @@ static int r128_cce_dispatch_blit( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - /* The compiler won't optimize away a division by a variable, * even if the only legal values are powers of two. Thus, we'll * use a shift instead. @@ -911,8 +897,6 @@ static int r128_cce_dispatch_write_span( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - count = depth->n; if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { return -EFAULT; @@ -1006,8 +990,6 @@ static int r128_cce_dispatch_write_pixels( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - count = depth->n; x = kmalloc( count * sizeof(*x), 0 ); @@ -1123,8 +1105,6 @@ static int r128_cce_dispatch_read_span( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - count = depth->n; if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { return -EFAULT; @@ -1167,8 +1147,6 @@ static int r128_cce_dispatch_read_pixels( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - count = depth->n; if ( count > dev_priv->depth_pitch ) { count = dev_priv->depth_pitch; @@ -1236,8 +1214,6 @@ static void r128_cce_dispatch_stipple( drm_device_t *dev, u32 *stipple ) RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - BEGIN_RING( 33 ); OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) ); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c index c80665caf..ed8b1bbca 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c @@ -1166,13 +1166,9 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ) int i; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - ring->space = *ring->head - ring->tail; - if ( ring->space <= 0 ) - ring->space += ring->size; - - if ( ring->space >= n ) + radeon_update_ring_snapshot( ring ); + if ( ring->space > n ) return 0; - udelay( 1 ); } @@ -1181,17 +1177,6 @@ int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ) return -EBUSY; } -void radeon_update_ring_snapshot( drm_radeon_private_t *dev_priv ) -{ - drm_radeon_ring_buffer_t *ring = &dev_priv->ring; - - ring->space = *ring->head - ring->tail; - if ( ring->space == 0 ) - atomic_inc( &dev_priv->idle_count ); - if ( ring->space <= 0 ) - ring->space += ring->size; -} - static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d ) { int i; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c index 1aa889aee..dba2037f9 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c @@ -36,11 +36,11 @@ #define DRIVER_NAME "radeon" #define DRIVER_DESC "ATI Radeon" -#define DRIVER_DATE "20010305" +#define DRIVER_DATE "20010308" #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 -#define DRIVER_PATCHLEVEL 0 +#define DRIVER_PATCHLEVEL 1 #define DRIVER_IOCTLS \ [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h index d279b0467..f176bb560 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h @@ -146,7 +146,14 @@ extern void radeon_freelist_reset( drm_device_t *dev ); extern drm_buf_t *radeon_freelist_get( drm_device_t *dev ); extern int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ); -extern void radeon_update_ring_snapshot( drm_radeon_private_t *dev_priv ); + +static inline void +radeon_update_ring_snapshot( drm_radeon_ring_buffer_t *ring ) +{ + ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32); + if ( ring->space <= 0 ) + ring->space += ring->size; +} extern int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ); extern int radeon_do_cleanup_cp( drm_device_t *dev ); @@ -601,9 +608,7 @@ do { \ drm_radeon_ring_buffer_t *ring = &dev_priv->ring; int i; \ if ( ring->space < ring->high_mark ) { \ for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ - ring->space = *ring->head - ring->tail; \ - if ( ring->space <= 0 ) \ - ring->space += ring->size; \ + radeon_update_ring_snapshot( ring ); \ if ( ring->space >= ring->high_mark ) \ goto __ring_space_done; \ udelay( 1 ); \ @@ -657,7 +662,7 @@ do { \ DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ n, __FUNCTION__ ); \ } \ - if ( dev_priv->ring.space < (n) * sizeof(u32) ) { \ + if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ radeon_wait_ring( dev_priv, (n) * sizeof(u32) ); \ } \ dev_priv->ring.space -= (n) * sizeof(u32); \ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c index ff1b3512f..9360c43b0 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c @@ -498,8 +498,6 @@ static void radeon_cp_dispatch_clear( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - radeon_update_ring_snapshot( dev_priv ); - if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { unsigned int tmp = flags; @@ -656,8 +654,6 @@ static void radeon_cp_dispatch_swap( drm_device_t *dev ) RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - radeon_update_ring_snapshot( dev_priv ); - #if RADEON_PERFORMANCE_BOXES /* Do some trivial performance monitoring... */ @@ -725,8 +721,6 @@ static void radeon_cp_dispatch_flip( drm_device_t *dev ) RING_LOCALS; DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); - radeon_update_ring_snapshot( dev_priv ); - #if RADEON_PERFORMANCE_BOXES /* Do some trivial performance monitoring... */ @@ -777,8 +771,6 @@ static void radeon_cp_dispatch_vertex( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "%s: nbox=%d\n", __FUNCTION__, sarea_priv->nbox ); - radeon_update_ring_snapshot( dev_priv ); - if ( 0 ) radeon_print_dirty( "dispatch_vertex", sarea_priv->dirty ); @@ -845,8 +837,6 @@ static void radeon_cp_dispatch_indirect( drm_device_t *dev, DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end ); - radeon_update_ring_snapshot( dev_priv ); - if ( start != end ) { int offset = (dev_priv->agp_buffers_offset + buf->offset + start); @@ -909,8 +899,6 @@ static void radeon_cp_dispatch_indices( drm_device_t *dev, RING_LOCALS; DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); - radeon_update_ring_snapshot( dev_priv ); - if ( 0 ) radeon_print_dirty( "dispatch_indices", sarea_priv->dirty ); @@ -1066,8 +1054,10 @@ static int radeon_cp_dispatch_texture( drm_device_t *dev, image->height -= height; image->data = (char *)image->data + size; - if ( copy_to_user( tex->image, image, sizeof(*image) ) ) + if ( copy_to_user( tex->image, image, sizeof(*image) ) ) { + DRM_ERROR( "EFAULT on tex->image\n" ); return -EFAULT; + } } else if ( size < 4 ) { size = 4; } @@ -1101,16 +1091,21 @@ static int radeon_cp_dispatch_texture( drm_device_t *dev, /* Texture image width is larger than the minimum, so we * can upload it directly. */ - if ( copy_from_user( buffer, data, dwords * sizeof(u32) ) ) + if ( copy_from_user( buffer, data, dwords * sizeof(u32) ) ) { + DRM_ERROR( "EFAULT on data, %d dwords\n", dwords ); return -EFAULT; + } } else { /* Texture image width is less than the minimum, so we * need to pad out each image scanline to the minimum * width. */ for ( i = 0 ; i < tex->height ; i++ ) { - if ( copy_from_user( buffer, data, tex_width ) ) + if ( copy_from_user( buffer, data, tex_width ) ) { + DRM_ERROR( "EFAULT on pad, %d bytes\n", + tex_width ); return -EFAULT; + } buffer += 8; data += tex_width; } @@ -1143,8 +1138,6 @@ static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple ) RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - radeon_update_ring_snapshot( dev_priv ); - BEGIN_RING( 35 ); OUT_RING( CP_PACKET0( RADEON_RE_STIPPLE_ADDR, 0 ) ); @@ -1180,7 +1173,6 @@ int radeon_cp_clear( struct inode *inode, struct file *filp, sizeof(clear) ) ) return -EFAULT; - RING_SPACE_TEST_WITH_RETURN( dev_priv ); if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c index 24b698cce..70240b950 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c @@ -10,11 +10,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * 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 NONINFRINGEMENT. IN NO EVENT SHALL @@ -22,7 +22,7 @@ * 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. - * + * * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.3 2000/06/17 00:03:34 martin Exp $ @@ -187,7 +187,7 @@ int N(HashDestroy)(void *t) int i; if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + for (i = 0; i < HASH_SIZE; i++) { for (bucket = table->buckets[i]; bucket;) { next = bucket->next; @@ -235,8 +235,8 @@ int N(HashLookup)(void *t, unsigned long key, void **value) HashTablePtr table = (HashTablePtr)t; HashBucketPtr bucket; - if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + if (!table || table->magic != HASH_MAGIC) return -1; /* Bad magic */ + bucket = HashFind(table, key, NULL); if (!bucket) return 1; /* Not found */ *value = bucket->value; @@ -250,7 +250,7 @@ int N(HashInsert)(void *t, unsigned long key, void *value) unsigned long hash; if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + if (HashFind(table, key, &hash)) return 1; /* Already in table */ bucket = HASH_ALLOC(sizeof(*bucket)); @@ -272,7 +272,7 @@ int N(HashDelete)(void *t, unsigned long key) HashBucketPtr bucket; if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + bucket = HashFind(table, key, &hash); if (!bucket) return 1; /* Not found */ @@ -285,7 +285,7 @@ int N(HashDelete)(void *t, unsigned long key) int N(HashNext)(void *t, unsigned long *key, void **value) { HashTablePtr table = (HashTablePtr)t; - + for (; table->p0 < HASH_SIZE; ++table->p0, table->p1 = table->buckets[table->p0]) { if (table->p1) { @@ -301,7 +301,7 @@ int N(HashNext)(void *t, unsigned long *key, void **value) int N(HashFirst)(void *t, unsigned long *key, void **value) { HashTablePtr table = (HashTablePtr)t; - + if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ table->p0 = 0; @@ -337,7 +337,7 @@ static void compute_dist(HashTablePtr table) { int i; HashBucketPtr bucket; - + printf("Entries = %ld, hits = %ld, partials = %ld, misses = %ld\n", table->entries, table->hits, table->partials, table->misses); clear_dist(); @@ -356,7 +356,7 @@ static void check_table(HashTablePtr table, { unsigned long retval = 0; int retcode = N(HashLookup)(table, key, &retval); - + switch (retcode) { case -1: printf("Bad magic = 0x%08lx:" @@ -391,7 +391,7 @@ int main(void) for (i = 256; i >= 0; i--) check_table(table, i, i); compute_dist(table); N(HashDestroy)(table); - + printf("\n***** 1024 consecutive integers ****\n"); table = N(HashCreate)(); for (i = 0; i < 1024; i++) N(HashInsert)(table, i, i); @@ -399,7 +399,7 @@ int main(void) for (i = 1024; i >= 0; i--) check_table(table, i, i); compute_dist(table); N(HashDestroy)(table); - + printf("\n***** 1024 consecutive page addresses (4k pages) ****\n"); table = N(HashCreate)(); for (i = 0; i < 1024; i++) N(HashInsert)(table, i*4096, i); @@ -407,7 +407,7 @@ int main(void) for (i = 1024; i >= 0; i--) check_table(table, i*4096, i); compute_dist(table); N(HashDestroy)(table); - + printf("\n***** 1024 random integers ****\n"); table = N(HashCreate)(); srandom(0xbeefbeef); @@ -429,7 +429,7 @@ int main(void) for (i = 0; i < 5000; i++) check_table(table, random(), i); compute_dist(table); N(HashDestroy)(table); - + return 0; } #endif |