diff options
author | kem <kem> | 2001-03-07 19:14:37 +0000 |
---|---|---|
committer | kem <kem> | 2001-03-07 19:14:37 +0000 |
commit | 38baaad074b69a17801ab41e8edb1c033f270650 (patch) | |
tree | 119719ee414d36fd8928d0c6fd6bf1686cfd1a69 | |
parent | c59258dedf31c8ae0eca10c9cb9d739d7e43561f (diff) |
- Prepare for merge with trunksarea-1-0-0-20010307-freeze
- Change variable names to be more consistent
- Fix bug in per-context creation routine
- Fix root-only permissions for get/setsareactx IOCTLs
- Back out incomplete gamma changes
- Fix some compilation warning messages
- Various code cleanups
- Disable per-context SAREA example code for Radeon
This can be re-enabled when it is actually used by the driver. Look for
'#ifdef PER_CONTEXT_SAREA' in the client-side and ddx Radeon driver.
29 files changed, 255 insertions, 304 deletions
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c index c7e326643..9b2c5b2f1 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.c @@ -61,6 +61,7 @@ int RADEON_DEBUG = (0 ); #endif +#ifdef PER_CONTEXT_SAREA char *radeonGetPerContextSAREA(int fd, drmContext hHWContext, drmSize size) @@ -77,6 +78,7 @@ char *radeonGetPerContextSAREA(int fd, return address; } +#endif /* Create the device specific context. */ @@ -108,6 +110,7 @@ GLboolean radeonCreateContext( Display *dpy, GLvisual *glVisual, rmesa->sarea = (RADEONSAREAPrivPtr)((char *)sPriv->pSAREA + radeonScreen->sarea_priv_offset); +#ifdef PER_CONTEXT_SAREA rmesa->private_sarea = radeonGetPerContextSAREA(rmesa->driFd, rmesa->hHWContext, radeonScreen->private_sarea_size); @@ -116,6 +119,7 @@ GLboolean radeonCreateContext( Display *dpy, GLvisual *glVisual, FREE( rmesa ); return GL_FALSE; } +#endif rmesa->tmp_matrix = (GLfloat *) ALIGN_MALLOC( 16 * sizeof(GLfloat), 16 ); if ( !rmesa->tmp_matrix ) { @@ -214,12 +218,15 @@ void radeonDestroyContext( radeonContextPtr rmesa ) radeonTexObjPtr t, next_t; int i; - if( rmesa->private_sarea ) { +#ifdef PER_CONTEXT_SAREA + if ( rmesa->private_sarea ) { drmUnmap( (drmAddress)rmesa->private_sarea, radeonScreen->private_sarea_size ); rmesa->private_sarea = NULL; } - for ( i = 0 ; i < rmesa->radeonScreen->numTexHeaps ; i++ ) { +#endif + + for ( i = 0 ; i < radeonScreen->numTexHeaps ; i++ ) { foreach_s ( t, next_t, &rmesa->TexObjList[i] ) { radeonDestroyTexObj( rmesa, t ); } diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h index a417a0e50..668b451a9 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_context.h @@ -220,7 +220,10 @@ struct radeon_context { radeonScreenPtr radeonScreen; /* Screen private DRI data */ RADEONSAREAPrivPtr sarea; /* Private SAREA data */ - char *private_sarea; + +#ifdef PER_CONTEXT_SAREA + char *private_sarea; /* Per-context private SAREA */ +#endif /* Performance counters */ diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c index 72fa28a98..b3da87bd3 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.c @@ -190,9 +190,12 @@ radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv ) } radeonScreen->driScreen = sPriv; - radeonScreen->private_sarea_size = radeonDRIPriv->private_sarea_size; radeonScreen->sarea_priv_offset = radeonDRIPriv->sarea_priv_offset; +#ifdef PER_CONTEXT_SAREA + radeonScreen->perctx_sarea_size = radeonDRIPriv->perctx_sarea_size; +#endif + radeonDDSetupInit(); radeonDDTriangleFuncsInit(); radeonDDFastPathInit(); diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h index 11cce76b6..81265eaaf 100644 --- a/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h +++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_screen.h @@ -68,7 +68,9 @@ typedef struct { int texSize[RADEON_NR_TEX_HEAPS]; int logTexGranularity[RADEON_NR_TEX_HEAPS]; +#ifdef PER_CONTEXT_SAREA drmSize private_sarea_size; +#endif radeonRegionRec mmio; radeonRegionRec status; diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index ee6ff1552..7ad699bc7 100644 --- a/xc/programs/Xserver/GL/dri/dri.c +++ b/xc/programs/Xserver/GL/dri/dri.c @@ -81,8 +81,7 @@ static RESTYPE DRIFullScreenResType; static RESTYPE DRIDrawablePrivResType; static RESTYPE DRIContextPrivResType; -static void DRIDestroyDummyContext(ScreenPtr pScreen, - Bool need_destroy_context); +static void DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv); /* Wrapper just like xf86DrvMsg, but without the verbosity level checking. @@ -147,8 +146,8 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIPriv->nrWindows = 0; pDRIPriv->fullscreen = NULL; - pDRIPriv->needDummyCtx = pDRIInfo->needDummyCtx; - pDRIPriv->dummyCtxNeedsDrvCtx = pDRIInfo->dummyCtxNeedsDrvCtx; + pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx; + pDRIPriv->createDummyCtxPriv = pDRIInfo->createDummyCtxPriv; if (drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString) < 0) { pDRIPriv->directRenderingSupport = FALSE; @@ -410,9 +409,8 @@ DRICloseScreen(ScreenPtr pScreen) } } - if(pDRIPriv->dummy_pDRIContextPriv && - pDRIPriv->needDummyCtx) { - DRIDestroyDummyContext(pScreen, pDRIPriv->dummyCtxNeedsDrvCtx); + if (pDRIPriv->dummyCtxPriv && pDRIPriv->createDummyCtx) { + DRIDestroyDummyContext(pScreen, pDRIPriv->createDummyCtxPriv); } if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) { @@ -658,8 +656,7 @@ DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv) } static Bool -DRICreateDummyContext(ScreenPtr pScreen, Bool need_create_context -) +DRICreateDummyContext(ScreenPtr pScreen, Bool needCtxPriv) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; @@ -672,59 +669,58 @@ DRICreateDummyContext(ScreenPtr pScreen, Bool need_create_context visual = pScreen->visuals; + /* Find the X visual that corresponds the the first GLX visual */ for (visNum = 0; visNum < pScreen->numVisuals; visNum++, visual++) { - if (pGLXVis->vid == visual->vid) - break; + if (pGLXVis->vid == visual->vid) + break; } + if (visNum == pScreen->numVisuals) return FALSE; - if(visNum == pScreen->numVisuals) return FALSE; - - visual = NULL; - - if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, - &pDRIPriv->pSAREA->dummy_context, 0))) { + if (!(pDRIContextPriv = + DRICreateContextPriv(pScreen, + &pDRIPriv->pSAREA->dummy_context, 0))) { return FALSE; } - contextStore=DRIGetContextStore(pDRIContextPriv); - if (pDRIPriv->pDriverInfo->CreateContext && need_create_context) { - if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual, - pDRIPriv->pSAREA->dummy_context, *pVisualConfigPriv, - (DRIContextType)(long)contextStore))) { + contextStore = DRIGetContextStore(pDRIContextPriv); + if (pDRIPriv->pDriverInfo->CreateContext && needCtxPriv) { + if (!pDRIPriv->pDriverInfo->CreateContext(pScreen, visual, + pDRIPriv->pSAREA->dummy_context, + *pVisualConfigPriv, + (DRIContextType)(long)contextStore)) { DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } } - pDRIPriv->dummy_pDRIContextPriv = pDRIContextPriv; + pDRIPriv->dummyCtxPriv = pDRIContextPriv; return TRUE; } static void -DRIDestroyDummyContext(ScreenPtr pScreen, Bool need_destroy_context -) +DRIDestroyDummyContext(ScreenPtr pScreen, Bool hasCtxPriv) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIContextPrivPtr pDRIContextPriv = pDRIPriv->dummy_pDRIContextPriv; + DRIContextPrivPtr pDRIContextPriv = pDRIPriv->dummyCtxPriv; void *contextStore; - if(!pDRIContextPriv) return; - if (pDRIPriv->pDriverInfo->DestroyContext && need_destroy_context) { - contextStore=DRIGetContextStore(pDRIContextPriv); - (pDRIPriv->pDriverInfo->DestroyContext)(pDRIContextPriv->pScreen, - pDRIContextPriv->hwContext, (DRIContextType)(long)contextStore); + if (!pDRIContextPriv) return; + if (pDRIPriv->pDriverInfo->DestroyContext && hasCtxPriv) { + contextStore = DRIGetContextStore(pDRIContextPriv); + pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen, + pDRIContextPriv->hwContext, + (DRIContextType)(long)contextStore); } - DRIDestroyContextPriv(pDRIPriv->dummy_pDRIContextPriv); - pDRIPriv->dummy_pDRIContextPriv = NULL; + DRIDestroyContextPriv(pDRIPriv->dummyCtxPriv); + pDRIPriv->dummyCtxPriv = NULL; } Bool DRICreateContext(ScreenPtr pScreen, VisualPtr visual, - XID context, drmContextPtr pHWContext -) + XID context, drmContextPtr pHWContext) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); __GLXscreenInfo *pGLXScreen = &__glXActiveScreens[pScreen->myNum]; @@ -734,13 +730,14 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual, void *contextStore; int visNum; - if(pDRIPriv->needDummyCtx && !pDRIPriv->dummy_pDRIContextPriv) { - if(!DRICreateDummyContext(pScreen, pDRIPriv->dummyCtxNeedsDrvCtx)) { + if (pDRIPriv->createDummyCtx && !pDRIPriv->dummyCtxPriv) { + if (!DRICreateDummyContext(pScreen, pDRIPriv->createDummyCtxPriv)) { DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] Could not create dummy context\n"); return FALSE; } } + /* Find the GLX visual associated with the one requested */ for (visNum = 0; visNum < pGLXScreen->numVisuals; @@ -756,7 +753,7 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual, return FALSE; } - contextStore=DRIGetContextStore(pDRIContextPriv); + contextStore = DRIGetContextStore(pDRIContextPriv); if (pDRIPriv->pDriverInfo->CreateContext) { if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual, *pHWContext, *pVisualConfigPriv, @@ -790,9 +787,10 @@ DRIContextPrivDelete(pointer pResource, XID id) pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen); if (pDRIPriv->pDriverInfo->DestroyContext) { - contextStore=DRIGetContextStore(pDRIContextPriv); - (pDRIPriv->pDriverInfo->DestroyContext)(pDRIContextPriv->pScreen, - pDRIContextPriv->hwContext, (DRIContextType)(long)contextStore); + contextStore = DRIGetContextStore(pDRIContextPriv); + pDRIPriv->pDriverInfo->DestroyContext(pDRIContextPriv->pScreen, + pDRIContextPriv->hwContext, + (DRIContextType)(long)contextStore); } return DRIDestroyContextPriv(pDRIContextPriv); } @@ -819,41 +817,35 @@ DRIClipNotifyAllDrawables(ScreenPtr pScreen) static void DRITransitionToSharedBuffers(ScreenPtr pScreen) { -/* ErrorF("DRITransitionToSharedBuffers\n"); */ - DRIClipNotifyAllDrawables( pScreen ); + DRIClipNotifyAllDrawables( pScreen ); } static void DRITransitionToPrivateBuffers(ScreenPtr pScreen) { -/* ErrorF("DRITransitionToPrivateBuffers\n"); */ - DRIClipNotifyAllDrawables( pScreen ); + DRIClipNotifyAllDrawables( pScreen ); } static void DRITransitionTo3d(ScreenPtr pScreen) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - -/* ErrorF("DRITransitionTo3d\n"); */ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - if (pDRIInfo->TransitionTo3d) - pDRIInfo->TransitionTo3d( pScreen ); + if (pDRIInfo->TransitionTo3d) + pDRIInfo->TransitionTo3d( pScreen ); } static void DRITransitionTo2d(ScreenPtr pScreen) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - -/* ErrorF("DRITransitionTo2d\n"); */ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; - if (pDRIInfo->TransitionTo2d) - pDRIInfo->TransitionTo2d( pScreen ); + if (pDRIInfo->TransitionTo2d) + pDRIInfo->TransitionTo2d( pScreen ); } diff --git a/xc/programs/Xserver/GL/dri/dri.h b/xc/programs/Xserver/GL/dri/dri.h index 92017d13a..bb0f811aa 100644 --- a/xc/programs/Xserver/GL/dri/dri.h +++ b/xc/programs/Xserver/GL/dri/dri.h @@ -147,8 +147,8 @@ typedef struct { DRIWindowRequests bufferRequests; int devPrivateSize; void* devPrivate; - Bool needDummyCtx; - Bool dummyCtxNeedsDrvCtx; + Bool createDummyCtx; + Bool createDummyCtxPriv; } DRIInfoRec, *DRIInfoPtr; diff --git a/xc/programs/Xserver/GL/dri/dristruct.h b/xc/programs/Xserver/GL/dri/dristruct.h index b2edee8ee..0cc083583 100644 --- a/xc/programs/Xserver/GL/dri/dristruct.h +++ b/xc/programs/Xserver/GL/dri/dristruct.h @@ -93,9 +93,9 @@ typedef struct _DRIScreenPrivRec XF86DRIClipRectRec fullscreen_rect; /* fake rect for fullscreen mode */ DRIWrappedFuncsRec wrap; DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; - DRIContextPrivPtr dummy_pDRIContextPriv;/* Pointer to dummy ctx */ - Bool needDummyCtx; - Bool dummyCtxNeedsDrvCtx; + DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */ + Bool createDummyCtx; + Bool createDummyCtxPriv; } DRIScreenPrivRec, *DRIScreenPrivPtr; #endif /* DRI_STRUCT_H */ diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c index 1bce2a94d..5d55ad114 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c @@ -819,8 +819,8 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = R128DRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - pDRIInfo->needDummyCtx = TRUE; - pDRIInfo->dummyCtxNeedsDrvCtx = FALSE; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) { xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed!\n"); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h index 0f8f0486c..911122b21 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h @@ -366,7 +366,10 @@ typedef struct { CARD32 re_width_height; CARD32 aux_sc_cntl; - int private_sarea_size; + +#ifdef PER_CONTEXT_SAREA + int perctx_sarea_size; +#endif #endif XF86VideoAdaptorPtr adaptor; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c index ee3f0b369..704041d91 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c @@ -244,26 +244,27 @@ static Bool RADEONCreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore) { +#ifdef PER_CONTEXT_SAREA ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); RADEONDRIContextPtr ctx_info; ctx_info = (RADEONDRIContextPtr)contextStore; - if(!ctx_info) return FALSE; + if (!ctx_info) return FALSE; - if(drmAddMap(info->drmFD, 0, - info->private_sarea_size, - DRM_SHM, - DRM_REMOVABLE, - &ctx_info->sarea_handle) < 0) { + if (drmAddMap(info->drmFD, 0, + info->perctx_sarea_size, + DRM_SHM, + DRM_REMOVABLE, + &ctx_info->sarea_handle) < 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[DRI] could not create private sarea for ctx id (%d)\n", (int)hwContext); return FALSE; } - if(drmAddContextPrivateMapping(info->drmFD, hwContext, - ctx_info->sarea_handle) < 0) { + if (drmAddContextPrivateMapping(info->drmFD, hwContext, + ctx_info->sarea_handle) < 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[DRI] could not associate private sarea to ctx id (%d)\n", (int)hwContext); @@ -272,6 +273,7 @@ static Bool RADEONCreateContext(ScreenPtr pScreen, VisualPtr visual, } ctx_info->ctx_id = hwContext; +#endif return TRUE; } @@ -279,18 +281,20 @@ static Bool RADEONCreateContext(ScreenPtr pScreen, VisualPtr visual, static void RADEONDestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore) { +#ifdef PER_CONTEXT_SAREA ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RADEONInfoPtr info = RADEONPTR(pScrn); RADEONDRIContextPtr ctx_info; ctx_info = (RADEONDRIContextPtr) contextStore; - if(!ctx_info) return; + if (!ctx_info) return; - if(drmRmMap(info->drmFD, ctx_info->sarea_handle) < 0) { + if (drmRmMap(info->drmFD, ctx_info->sarea_handle) < 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[DRI] could not remove private sarea for ctx id (%d)\n", (int)hwContext); } +#endif } /* Called when the X server is woken up to allow the last client's @@ -1230,7 +1234,12 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) < RADEON_MAX_DRAWABLES ? SAREA_MAX_DRAWABLES : RADEON_MAX_DRAWABLES); - info->private_sarea_size = 64 * 1024; +#ifdef PER_CONTEXT_SAREA + /* This is only here for testing per-context SAREAs. When used, the + magic number below would be properly defined in a header file. */ + info->perctx_sarea_size = 64 * 1024; +#endif + #ifdef NOT_DONE /* FIXME: Need to extend DRI protocol to pass this size back to * client for SAREA mapping that includes a device private record @@ -1265,8 +1274,8 @@ Bool RADEONDRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = RADEONDRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - pDRIInfo->needDummyCtx = TRUE; - pDRIInfo->dummyCtxNeedsDrvCtx = FALSE; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) { xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed!\n"); @@ -1410,10 +1419,12 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen) pRADEONDRI->log2AGPTexGran = info->log2AGPTexGran; pRADEONDRI->agpTexOffset = info->agpTexStart; - /* Set Per Context Private Sarea Size */ - pRADEONDRI->private_sarea_size = info->private_sarea_size; + pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); - pRADEONDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); +#ifdef PER_CONTEXT_SAREA + /* Set per-context SAREA size */ + pRADEONDRI->perctx_sarea_size = info->perctx_sarea_size; +#endif return TRUE; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h index 8050b1169..11e8a3e09 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h @@ -96,8 +96,11 @@ typedef struct { drmSize agpTexMapSize; int log2AGPTexGran; int agpTexOffset; - drmSize private_sarea_size; unsigned int sarea_priv_offset; + +#ifdef PER_CONTEXT_SAREA + drmSize perctx_sarea_size; +#endif } RADEONDRIRec, *RADEONDRIPtr; #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c index f719e02df..6cf4650f2 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c @@ -50,7 +50,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glint.h" #include "glint_dri.h" - static char GLINTKernelDriverName[] = "gamma"; static char GLINTClientDriverName[] = "gamma"; @@ -66,54 +65,6 @@ GLINTDRIControlInit(int drmSubFD, int irq) return 0; } -Bool -GLINTDRIKernelInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - GLINTPtr pGlint = GLINTPTR(pScrn); - DRIInfoPtr pDRIInfo = pGlint->pDRIInfo; - GLINTDRIPtr pGlintDRI = pDRIInfo->devPrivate; - drmGLINTInit init; - int ret; - - init.hControlRegs0 = pGlintDRI->hControlRegs0; - init.hControlRegs1 = pGlintDRI->hControlRegs1; - init.hControlRegs2 = pGlintDRI->hControlRegs2; - init.hControlRegs3 = pGlintDRI->hControlRegs3; - - ret = drmGLINTInitDMA( pGlint->drmSubFD, &init ); - if ( ret < 0 ) { - xf86DrvMsg( pScrn->scrnIndex, X_ERROR, - "[drm] Failed to initialize DMA! (%d)\n", ret ); - return FALSE; - } - - /* tell the generic kernel driver how to handle Gamma DMA */ - if (pGlint->irq <= 0) { - pGlint->irq = drmGetInterruptFromBusID(pGlint->drmSubFD, - ((pciConfigPtr)pGlint->PciInfo - ->thisCard)->busnum, - ((pciConfigPtr)pGlint->PciInfo - ->thisCard)->devnum, - ((pciConfigPtr)pGlint->PciInfo - ->thisCard)->funcnum); - } - - if ( (pGlint->irq <= 0) || - GLINTDRIControlInit(pGlint->drmSubFD, pGlint->irq) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] cannot initialize dma with IRQ %d\n", - pGlint->irq); - return FALSE; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] dma control initialized, using IRQ %d\n", - pGlint->irq); - - return TRUE; -} - static Bool GLINTInitVisualConfigs(ScreenPtr pScreen) { @@ -474,8 +425,8 @@ GLINTDRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = GLINTDRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - pDRIInfo->needDummyCtx = TRUE; - pDRIInfo->dummyCtxNeedsDrvCtx = FALSE; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; if (!DRIScreenInit(pScreen, pDRIInfo, &(pGlint->drmSubFD))) { DRIDestroyInfoRec(pGlint->pDRIInfo); @@ -637,13 +588,31 @@ GLINTDRIScreenInit(ScreenPtr pScreen) pGlint->drmBufs->count); xf86EnableBusMaster(pGlint->PciTag); - if(!GLINTDRIKernelInit(pScreen)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] cannot initialize kernel drm driver\n"); + + /* tell the generic kernel driver how to handle Gamma DMA */ + if (pGlint->irq <= 0) { + pGlint->irq = drmGetInterruptFromBusID(pGlint->drmSubFD, + ((pciConfigPtr)pGlint->PciInfo + ->thisCard)->busnum, + ((pciConfigPtr)pGlint->PciInfo + ->thisCard)->devnum, + ((pciConfigPtr)pGlint->PciInfo + ->thisCard)->funcnum); + } + + if ( (pGlint->irq <= 0) || + GLINTDRIControlInit(pGlint->drmSubFD, pGlint->irq) ) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] cannot initialize dma with IRQ %d\n", + pGlint->irq); DRICloseScreen(pScreen); return FALSE; } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] dma control initialized, using IRQ %d\n", + pGlint->irq); + /* setup visual configurations */ if (!(GLINTInitVisualConfigs(pScreen))) { DRICloseScreen(pScreen); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h index b97566c68..9fe9f02de 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h @@ -32,8 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Jens Owen <jens@precisioninsight.com> * */ -#include <xf86drm.h> -#include <xf86drmGlint.h> + /* * Glint specific record passed back to client driver * via DRIGetDeviceInfo request diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c index 4bbfebabb..03ec81480 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c @@ -310,8 +310,8 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = I810DRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - pDRIInfo->needDummyCtx = TRUE; - pDRIInfo->dummyCtxNeedsDrvCtx = FALSE; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; /* This adds the framebuffer as a drm map *before* we have asked agp * to allocate it. Scary stuff, hold on... 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 8a0156ea0..cb17e0533 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c @@ -956,8 +956,8 @@ Bool MGADRIScreenInit( ScreenPtr pScreen ) pDRIInfo->wrap.ValidateTree = NULL; pDRIInfo->wrap.PostValidateTree = NULL; - pDRIInfo->needDummyCtx = TRUE; - pDRIInfo->dummyCtxNeedsDrvCtx = FALSE; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; if ( SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES ) { pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c index b433f593a..9dc2feb48 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c @@ -262,8 +262,8 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) pDRIInfo->MoveBuffers = SISDRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - pDRIInfo->needDummyCtx = TRUE; - pDRIInfo->dummyCtxNeedsDrvCtx = FALSE; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; if (!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) { xfree(pDRIInfo->devPrivate); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c index 9880726c8..af7d6a1cb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c @@ -260,8 +260,8 @@ FFBDRIScreenInit(ScreenPtr pScreen) /* Our InitBuffers depends heavily on this setting. */ pDRIInfo->bufferRequests = DRI_3D_WINDOWS_ONLY; - pDRIInfo->needDummyCtx = TRUE; - pDRIInfo->dummyCtxNeedsDrvCtx = FALSE; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; if (!DRIScreenInit(pScreen, pDRIInfo, &(pFfb->drmSubFD))) { DRIDestroyInfoRec(pFfb->pDRIInfo); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index b05829d68..c70cb35e5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -381,8 +381,8 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) pDRIInfo->TransitionTo3d = TDFXDRITransitionTo3d; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - pDRIInfo->needDummyCtx = FALSE; - pDRIInfo->dummyCtxNeedsDrvCtx = FALSE; + pDRIInfo->createDummyCtx = FALSE; + pDRIInfo->createDummyCtxPriv = FALSE; if (!DRIScreenInit(pScreen, pDRIInfo, &pTDFX->drmSubFD)) { xfree(pDRIInfo->devPrivate); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile index fedd5f2ff..34244e6e5 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile @@ -22,7 +22,6 @@ MTRR_DEFINES = -DHAS_MTRR_SUPPORT xf86drmR128.c \ xf86drmRadeon.c \ xf86drmSiS.c \ - xf86drmGlint.c \ $(MSRC) OBJS = xf86drm.o \ xf86drmHash.o \ @@ -33,7 +32,6 @@ MTRR_DEFINES = -DHAS_MTRR_SUPPORT xf86drmR128.o \ xf86drmRadeon.o \ xf86drmSiS.o \ - xf86drmGlint.o \ $(MOBJ) INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux index 1780e697d..26eed9a5f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux @@ -261,7 +261,7 @@ ChangeLog: $(CC) $(MODCFLAGS) -I$(TREE) -c $< -o $@ $(DRMOBJS): $(DRMHEADERS) -$(GAMMAOBJS): $(GAMMAHEADERS) +#$(GAMMAOBJS): $(GAMMAHEADERS) $(TDFXOBJS): $(TDFXHEADERS) ifeq ($(AGP),1) $(MGAOBJS): $(MGAHEADERS) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h index 6d366e7a0..7c65f5fc3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h @@ -88,7 +88,6 @@ typedef struct drm_tex_region { #include "i810_drm.h" #include "r128_drm.h" #include "radeon_drm.h" -#include "gamma_drm.h" #ifdef CONFIG_DRM_SIS #include "sis_drm.h" #endif @@ -377,8 +376,8 @@ typedef struct drm_agp_info { #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t) -#define DRM_IOCTL_CTX_SAREA DRM_IOW( 0x1c, drm_ctx_priv_map_t) -#define DRM_IOCTL_GET_CTX_SAREA DRM_IOWR(0x1d, drm_ctx_priv_map_t) +#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t) +#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t) #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t) @@ -403,9 +402,6 @@ typedef struct drm_agp_info { #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) -/* Gamma specific ioctls */ -#define DRM_IOCTL_GAMMA_INIT DRM_IOW( 0x40, drm_gamma_init_t) - /* MGA specific ioctls */ #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) #define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h index 6f21c0ed0..804df4095 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h @@ -835,9 +835,9 @@ extern int DRM(notifier)(void *priv); /* Context Bitmap support (ctxbitmap.c) */ extern int DRM(ctxbitmap_init)( drm_device_t *dev ); extern void DRM(ctxbitmap_cleanup)( drm_device_t *dev ); -extern int DRM(add_ctx_map)( struct inode *inode, struct file *filp, +extern int DRM(setsareactx)( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int DRM(get_ctx_map)( struct inode *inode, struct file *filp, +extern int DRM(getsareactx)( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); /* Buffer management support (bufs.c) */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h index 6f673ac00..8f891fd2a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h @@ -129,7 +129,7 @@ void DRM(ctxbitmap_cleanup)( drm_device_t *dev ) * Per Context SAREA Support */ -int DRM(get_ctx_map)(struct inode *inode, struct file *filp, +int DRM(getsareactx)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; @@ -137,13 +137,13 @@ int DRM(get_ctx_map)(struct inode *inode, struct file *filp, drm_ctx_priv_map_t request; drm_map_t *map; - if(copy_from_user(&request, - (drm_ctx_priv_map_t *)arg, - sizeof(request))) + if (copy_from_user(&request, + (drm_ctx_priv_map_t *)arg, + sizeof(request))) return -EFAULT; down(&dev->struct_sem); - if((int)request.ctx_id >= dev->max_context) { + if ((int)request.ctx_id >= dev->max_context) { up(&dev->struct_sem); return -EINVAL; } @@ -157,7 +157,7 @@ int DRM(get_ctx_map)(struct inode *inode, struct file *filp, return 0; } -int DRM(add_ctx_map)(struct inode *inode, struct file *filp, +int DRM(setsareactx)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; @@ -167,9 +167,9 @@ int DRM(add_ctx_map)(struct inode *inode, struct file *filp, drm_map_list_t *r_list; struct list_head *list; - if(copy_from_user(&request, - (drm_ctx_priv_map_t *)arg, - sizeof(request))) + if (copy_from_user(&request, + (drm_ctx_priv_map_t *)arg, + sizeof(request))) return -EFAULT; down(&dev->struct_sem); @@ -178,17 +178,17 @@ int DRM(add_ctx_map)(struct inode *inode, struct file *filp, if(r_list->map && r_list->map->handle == request.handle) break; } - if(list == &(dev->maplist->head)) { + if (list == &(dev->maplist->head)) { up(&dev->struct_sem); return -EINVAL; } map = r_list->map; up(&dev->struct_sem); - if(!map) return -EINVAL; + if (!map) return -EINVAL; down(&dev->struct_sem); - if((int)request.ctx_id >= dev->max_context) { + if ((int)request.ctx_id >= dev->max_context) { up(&dev->struct_sem); return -EINVAL; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h index 776b07312..05923b50b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h @@ -118,64 +118,64 @@ static struct file_operations DRM(fops) = { }; -static drm_ioctl_desc_t DRM(ioctls)[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(version), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { DRM(getunique), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { DRM(getmagic), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { DRM(irq_busid), 0, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = { DRM(getmap), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = { DRM(getclient), 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = { DRM(getstats), 0, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { DRM(setunique), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { DRM(block), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { DRM(unblock), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { DRM(authmagic), 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { DRM(addmap), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { DRM(rmmap), 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_CTX_SAREA)] = { DRM(add_ctx_map), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX_SAREA)] = { DRM(get_ctx_map), 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { DRM(addctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { DRM(rmctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { DRM(modctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { DRM(getctx), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { DRM(switchctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { DRM(newctx), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { DRM(resctx), 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { DRM(adddraw), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { DRM(rmdraw), 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { DRM(lock), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { DRM(unlock), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { DRM(finish), 1, 0 }, +static drm_ioctl_desc_t DRM(ioctls)[] = { + [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(version), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { DRM(getunique), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { DRM(getmagic), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { DRM(irq_busid), 0, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = { DRM(getmap), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = { DRM(getclient), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = { DRM(getstats), 0, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { DRM(setunique), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { DRM(block), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { DRM(unblock), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { DRM(authmagic), 1, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { DRM(addmap), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { DRM(rmmap), 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { DRM(setsareactx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { DRM(getsareactx), 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { DRM(addctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { DRM(rmctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { DRM(modctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { DRM(getctx), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { DRM(switchctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { DRM(newctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { DRM(resctx), 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { DRM(adddraw), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { DRM(rmdraw), 1, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { DRM(lock), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { DRM(unlock), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { DRM(finish), 1, 0 }, #if __HAVE_DMA - [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { DRM(addbufs), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { DRM(markbufs), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { DRM(infobufs), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { DRM(mapbufs), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { DRM(freebufs), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { DRM(addbufs), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { DRM(markbufs), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { DRM(infobufs), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { DRM(mapbufs), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { DRM(freebufs), 1, 0 }, /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */ #if __HAVE_DMA_IRQ - [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, #endif #endif #if __REALLY_HAVE_AGP - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { DRM(agp_release), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { DRM(agp_info), 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { DRM(agp_alloc), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { DRM(agp_free), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { DRM(agp_bind), 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { DRM(agp_release), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { DRM(agp_info), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { DRM(agp_alloc), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { DRM(agp_free), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { DRM(agp_bind), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 }, #endif DRIVER_IOCTLS diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c index 1b784f80e..e2ac60616 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c @@ -37,6 +37,40 @@ #include <linux/interrupt.h> /* For task queue support */ #include <linux/delay.h> +#if 0 +#define DO_IOREMAP( _map ) \ +do { \ + (_map)->handle = DRM(ioremap)( (_map)->offset, (_map)->size ); \ +} while (0) + +#define DO_IOREMAPFREE( _map ) \ +do { \ + if ( (_map)->handle && (_map)->size ) \ + DRM(ioremapfree)( (_map)->handle, (_map)->size ); \ +} while (0) + +#define DO_FIND_MAP( _map, _offset ) \ +do { \ + int _i; \ + for ( _i = 0 ; _i < dev->map_count ; _i++ ) { \ + if ( dev->maplist[_i]->offset == _offset ) { \ + _map = dev->maplist[_i]; \ + break; \ + } \ + } \ +} while (0) +#endif + +/* WARNING!!! MAGIC NUMBER!!! The number of regions already added to the + kernel must be specified here. Currently, the number is 2. This must + match the order the X server uses for instantiating register regions , + or must be passed in a new ioctl. */ +#define GAMMA_REG(reg) \ + (2 \ + + ((reg < 0x1000) \ + ? 0 \ + : ((reg < 0x10000) ? 1 : ((reg < 0x11000) ? 2 : 3)))) + #define GAMMA_OFF(reg) \ ((reg < 0x1000) \ ? reg \ @@ -46,12 +80,7 @@ ? (reg - 0x10000) \ : (reg - 0x11000)))) -#define GAMMA_BASE(reg) ((unsigned long) \ - ((reg < 0x1000) ? dev_priv->mmio0->handle : \ - ((reg < 0x10000) ? dev_priv->mmio1->handle : \ - ((reg < 0x11000) ? dev_priv->mmio2->handle : \ - dev_priv->mmio3->handle)))) - +#define GAMMA_BASE(reg) ((unsigned long)dev->maplist[GAMMA_REG(reg)]->handle) #define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg)) #define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg) #define GAMMA_READ(reg) GAMMA_DEREF(reg) @@ -78,8 +107,6 @@ static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address, unsigned long length) { - drm_gamma_private_t *dev_priv = (drm_gamma_private_t *) - dev->dev_private; GAMMA_WRITE(GAMMA_DMAADDRESS, virt_to_phys((void *)address)); while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4) ; @@ -88,8 +115,6 @@ static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address, void gamma_dma_quiescent_single(drm_device_t *dev) { - drm_gamma_private_t *dev_priv = (drm_gamma_private_t *) - dev->dev_private; while (GAMMA_READ(GAMMA_DMACOUNT)) ; while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) @@ -106,8 +131,6 @@ void gamma_dma_quiescent_single(drm_device_t *dev) void gamma_dma_quiescent_dual(drm_device_t *dev) { - drm_gamma_private_t *dev_priv = (drm_gamma_private_t *) - dev->dev_private; while (GAMMA_READ(GAMMA_DMACOUNT)) ; while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) @@ -133,24 +156,18 @@ void gamma_dma_quiescent_dual(drm_device_t *dev) void gamma_dma_ready(drm_device_t *dev) { - drm_gamma_private_t *dev_priv = (drm_gamma_private_t *) - dev->dev_private; while (GAMMA_READ(GAMMA_DMACOUNT)) ; } static inline int gamma_dma_is_ready(drm_device_t *dev) { - drm_gamma_private_t *dev_priv = (drm_gamma_private_t *) - dev->dev_private; return !GAMMA_READ(GAMMA_DMACOUNT); } static void gamma_dma_service(int irq, void *device, struct pt_regs *regs) { drm_device_t *dev = (drm_device_t *)device; - drm_gamma_private_t *dev_priv = (drm_gamma_private_t *) - dev->dev_private; drm_device_dma_t *dma = dev->dma; atomic_inc(&dev->counts[6]); /* _DRM_STAT_IRQ */ @@ -621,8 +638,6 @@ int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd, int gamma_irq_install(drm_device_t *dev, int irq) { - drm_gamma_private_t *dev_priv = (drm_gamma_private_t *) - dev->dev_private; int retcode; if (!irq) return -EINVAL; @@ -677,8 +692,6 @@ int gamma_irq_install(drm_device_t *dev, int irq) int gamma_irq_uninstall(drm_device_t *dev) { - drm_gamma_private_t *dev_priv = (drm_gamma_private_t *) - dev->dev_private; int irq; down(&dev->struct_sem); @@ -698,6 +711,7 @@ int gamma_irq_uninstall(drm_device_t *dev) return 0; } + int gamma_control(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { @@ -723,41 +737,3 @@ int gamma_control(struct inode *inode, struct file *filp, unsigned int cmd, } return 0; } - -void gamma_dma_cleanup(drm_device_t *dev) -{ - drm_gamma_private_t *dev_priv; - - if(dev->dev_private) { - dev_priv = (drm_gamma_private_t *)dev->dev_private; - DRM(free)(dev_priv, - sizeof(drm_gamma_private_t), - DRM_MEM_DRIVER); - dev->dev_private = NULL; - } -} - -int gamma_dma_init(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_gamma_init_t init; - drm_gamma_private_t *dev_priv; - - if (copy_from_user(&init, (drm_gamma_init_t *)arg, sizeof(init))) - return -EFAULT; - - dev_priv = DRM(alloc)(sizeof(drm_gamma_private_t), - DRM_MEM_DRIVER); - if(!dev_priv) return -ENOMEM; - - memset(dev_priv, 0, sizeof(drm_gamma_private_t)); - - DRM_FIND_MAP(dev_priv->mmio0, init.hControlRegs0); - DRM_FIND_MAP(dev_priv->mmio1, init.hControlRegs1); - DRM_FIND_MAP(dev_priv->mmio2, init.hControlRegs2); - DRM_FIND_MAP(dev_priv->mmio3, init.hControlRegs3); - - return 0; -} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c index ae73aca48..c24d5a33c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c @@ -46,8 +46,7 @@ #define DRIVER_IOCTLS \ - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 }, \ - [DRM_IOCTL_NR(DRM_IOCTL_GAMMA_INIT)] = { gamma_dma_init, 1, 0 } + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 } #define __HAVE_MTRR 1 #define __HAVE_CTX_BITMAP 0 @@ -90,13 +89,14 @@ do { \ gamma_reclaim_buffers( dev, priv->pid ); \ if ( dev->dev_private ) { \ drm_gamma_private_t *dev_priv = dev->dev_private; \ + dev_priv->dispatch_status &= MGA_IN_DISPATCH; \ } \ } while (0) #endif #if 0 #define DRIVER_PRETAKEDOWN() do { \ - if ( dev->dev_private ) gamma_dma_cleanup( dev ); \ + if ( dev->dev_private ) gamma_do_cleanup_dma( dev ); \ } while (0) #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h index ae2ec59b4..1bfa26509 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h @@ -35,10 +35,6 @@ typedef struct drm_gamma_private { drm_map_t *buffers; - drm_map_t *mmio0; - drm_map_t *mmio1; - drm_map_t *mmio2; - drm_map_t *mmio3; } drm_gamma_private_t; #define LOCK_TEST_WITH_RETURN( dev ) \ @@ -76,8 +72,5 @@ extern int gamma_control(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int gamma_find_devices(void); extern int gamma_found(void); -extern void gamma_dma_cleanup(drm_device_t *dev); -extern int gamma_dma_init(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); #endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c index 9a063b219..f51840201 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c @@ -519,7 +519,7 @@ int drmRmMap(int fd, drmHandle handle) { drm_map_t map; - map.handle = handle; + map.handle = (void *)handle; if(ioctl(fd, DRM_IOCTL_RM_MAP, &map)) return -errno; return 0; @@ -1105,9 +1105,9 @@ int drmAddContextPrivateMapping(int fd, drmContext ctx_id, drmHandle handle) drm_ctx_priv_map_t map; map.ctx_id = ctx_id; - map.handle = handle; + map.handle = (void *)handle; - if(ioctl(fd, DRM_IOCTL_CTX_SAREA, &map)) return -errno; + if (ioctl(fd, DRM_IOCTL_SET_SAREA_CTX, &map)) return -errno; return 0; } @@ -1117,8 +1117,8 @@ int drmGetContextPrivateMapping(int fd, drmContext ctx_id, drmHandlePtr handle) map.ctx_id = ctx_id; - if(ioctl(fd, DRM_IOCTL_GET_CTX_SAREA, &map)) return -errno; - if(handle) *handle = map.handle; + if (ioctl(fd, DRM_IOCTL_GET_SAREA_CTX, &map)) return -errno; + if (handle) *handle = (drmHandle)map.handle; return 0; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h index 6d366e7a0..7c65f5fc3 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h @@ -88,7 +88,6 @@ typedef struct drm_tex_region { #include "i810_drm.h" #include "r128_drm.h" #include "radeon_drm.h" -#include "gamma_drm.h" #ifdef CONFIG_DRM_SIS #include "sis_drm.h" #endif @@ -377,8 +376,8 @@ typedef struct drm_agp_info { #define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t) -#define DRM_IOCTL_CTX_SAREA DRM_IOW( 0x1c, drm_ctx_priv_map_t) -#define DRM_IOCTL_GET_CTX_SAREA DRM_IOWR(0x1d, drm_ctx_priv_map_t) +#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t) +#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t) #define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t) #define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t) @@ -403,9 +402,6 @@ typedef struct drm_agp_info { #define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) #define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) -/* Gamma specific ioctls */ -#define DRM_IOCTL_GAMMA_INIT DRM_IOW( 0x40, drm_gamma_init_t) - /* MGA specific ioctls */ #define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) #define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x41, drm_lock_t) |