diff options
author | alanh <alanh> | 2000-07-10 20:43:21 +0000 |
---|---|---|
committer | alanh <alanh> | 2000-07-10 20:43:21 +0000 |
commit | 55378d1c9953642fb1b327237d51287d4d8beefb (patch) | |
tree | 9fa410ce1172ee263503c9bc22b33eac2db1833e /xc/programs | |
parent | 4a947efe3394fe82c2a6c97a033e5065567c55ea (diff) |
Import of XFree86 4.0.1
Diffstat (limited to 'xc/programs')
26 files changed, 1336 insertions, 1030 deletions
diff --git a/xc/programs/Imakefile b/xc/programs/Imakefile index 324ba930d..33a60c4f5 100644 --- a/xc/programs/Imakefile +++ b/xc/programs/Imakefile @@ -2,7 +2,7 @@ XCOMM $TOG: Imakefile /main/85 1998/02/26 17:14:44 kaleb $ XCOMM XCOMM XCOMM -XCOMM $XFree86: xc/programs/Imakefile,v 3.28 2000/02/26 05:35:07 dawes Exp $ +XCOMM $XFree86: xc/programs/Imakefile,v 3.29 2000/06/15 20:49:59 dawes Exp $ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" @@ -43,7 +43,9 @@ SCREENSAVESRCDIR = beforelight XDMSRCDIR = xdm XFINDPROXYSRCDIR = xfindproxy XFWPSRCDIR = xfwp +#if BuildXF86VidModeExt XGAMMASRCDIR = xgamma +#endif XHOSTSRCDIR = xhost #if BuildPlugin XRXSRCDIR = xrx diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index 68e638f27..2d1ee7bc9 100644 --- a/xc/programs/Xserver/GL/dri/dri.c +++ b/xc/programs/Xserver/GL/dri/dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.13 2000/03/04 01:53:01 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.19 2000/06/25 16:03:43 tsi Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -32,7 +32,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#if XFree86LOADER +#ifdef XFree86LOADER #include "xf86.h" #include "xf86_ansic.h" #else @@ -93,15 +93,12 @@ DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...) } Bool -DRIScreenInit( - ScreenPtr pScreen, - DRIInfoPtr pDRIInfo, - int* pDRMFD) +DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) { DRIScreenPrivPtr pDRIPriv; drmContextPtr reserved; int reserved_count; - int i; + int i, fd, drmWasAvailable; if (DRIGeneration != serverGeneration) { if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) @@ -109,28 +106,38 @@ DRIScreenInit( DRIGeneration = serverGeneration; } - if (!drmAvailable()) { - return FALSE; + drmWasAvailable = drmAvailable(); + + /* Note that drmOpen will try to load the kernel module, if needed. */ + fd = drmOpen(pDRIInfo->drmDriverName, NULL); + if (fd < 0) { + /* failed to open DRM */ + pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + return FALSE; } - if (!(pDRIPriv = (DRIScreenPrivPtr)xalloc(sizeof(DRIScreenPrivRec)))) { - return FALSE; + if (!drmWasAvailable) { + /* drmOpen loaded the kernel module, print a message to say so */ + DRIDrvMsg(pScreen->myNum, X_INFO, + "[drm] loaded kernel module \"%s\"\n", + pDRIInfo->drmDriverName); } - pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer)pDRIPriv; + pDRIPriv = (DRIScreenPrivPtr) xalloc(sizeof(DRIScreenPrivRec)); + if (!pDRIPriv) { + pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + return FALSE; + } + + pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv; + pDRIPriv->drmFD = fd; pDRIPriv->directRenderingSupport = TRUE; pDRIPriv->pDriverInfo = pDRIInfo; - - /* setup device independent direct rendering memory maps */ - - if ((pDRIPriv->drmFD = drmOpen(pDRIPriv->pDriverInfo->drmDriverName, - NULL)) < 0) { - pDRIPriv->directRenderingSupport = FALSE; - return FALSE; - } + pDRIPriv->nrWindows = 0; if (drmSetBusid(pDRIPriv->drmFD, pDRIPriv->pDriverInfo->busIdString) < 0) { pDRIPriv->directRenderingSupport = FALSE; + pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; drmClose(pDRIPriv->drmFD); return FALSE; } @@ -149,6 +156,7 @@ DRIScreenInit( &pDRIPriv->hSAREA) < 0) { pDRIPriv->directRenderingSupport = FALSE; + pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; drmClose(pDRIPriv->drmFD); return FALSE; } @@ -162,6 +170,7 @@ DRIScreenInit( (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0) { pDRIPriv->directRenderingSupport = FALSE; + pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; drmClose(pDRIPriv->drmFD); return FALSE; } @@ -176,6 +185,7 @@ DRIScreenInit( &pDRIPriv->hFrameBuffer) < 0) { pDRIPriv->directRenderingSupport = FALSE; + pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize); drmClose(pDRIPriv->drmFD); return FALSE; @@ -334,8 +344,9 @@ DRIFinishScreenInit(ScreenPtr pScreen) pDRIPriv->wrap.CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = pDRIInfo->wrap.CopyWindow; } - miClipNotify(DRIClipNotify); - + if (pDRIInfo->wrap.ClipNotify) + miClipNotify(pDRIInfo->wrap.ClipNotify); + DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] installation complete\n"); return TRUE; @@ -432,8 +443,7 @@ DRIExtensionInit(void) } void -DRIReset( -) +DRIReset(void) { /* * This stub routine is called when the X Server recycles, resources @@ -445,10 +455,7 @@ DRIReset( } Bool -DRIQueryDirectRenderingCapable( - ScreenPtr pScreen, - Bool* isCapable -) +DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -461,11 +468,7 @@ DRIQueryDirectRenderingCapable( } Bool -DRIOpenConnection( - ScreenPtr pScreen, - drmHandlePtr hSAREA, - char **busIdString -) +DRIOpenConnection(ScreenPtr pScreen, drmHandlePtr hSAREA, char **busIdString) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -476,10 +479,7 @@ DRIOpenConnection( } Bool -DRIAuthConnection( - ScreenPtr pScreen, - drmMagic magic -) +DRIAuthConnection(ScreenPtr pScreen, drmMagic magic) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -488,23 +488,17 @@ DRIAuthConnection( } Bool -DRICloseConnection( - ScreenPtr pScreen -) +DRICloseConnection(ScreenPtr pScreen) { - DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - return TRUE; } Bool -DRIGetClientDriverName( - ScreenPtr pScreen, - int* ddxDriverMajorVersion, - int* ddxDriverMinorVersion, - int* ddxDriverPatchVersion, - char** clientDriverName -) +DRIGetClientDriverName(ScreenPtr pScreen, + int *ddxDriverMajorVersion, + int *ddxDriverMinorVersion, + int *ddxDriverPatchVersion, + char **clientDriverName) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -616,11 +610,8 @@ DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv) } Bool -DRICreateContext( - ScreenPtr pScreen, - VisualPtr visual, - XID context, - drmContextPtr pHWContext +DRICreateContext(ScreenPtr pScreen, VisualPtr visual, + XID context, drmContextPtr pHWContext ) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -652,7 +643,7 @@ DRICreateContext( visual, *pHWContext, *pVisualConfigPriv, - contextStore))) { + (int)contextStore))) { DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } @@ -665,10 +656,7 @@ DRICreateContext( } Bool -DRIDestroyContext( - ScreenPtr pScreen, - XID context -) +DRIDestroyContext(ScreenPtr pScreen, XID context) { FreeResourceByType(context, DRIContextPrivResType, FALSE); @@ -677,9 +665,7 @@ DRIDestroyContext( /* DRIContextPrivDelete is called by the resource manager. */ Bool -DRIContextPrivDelete( - pointer pResource, - XID id) +DRIContextPrivDelete(pointer pResource, XID id) { DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr)pResource; DRIScreenPrivPtr pDRIPriv; @@ -689,19 +675,75 @@ DRIContextPrivDelete( if (pDRIPriv->pDriverInfo->DestroyContext) { contextStore=DRIGetContextStore(pDRIContextPriv); (pDRIPriv->pDriverInfo->DestroyContext)(pDRIContextPriv->pScreen, - pDRIContextPriv->hwContext, - contextStore); + pDRIContextPriv->hwContext, + (int)contextStore); } return DRIDestroyContextPriv(pDRIContextPriv); } + +/* This walks the drawable timestamp array and invalidates all of them + * in the case of transition from private to shared backbuffers. It's + * not necessary for correctness, because DRIClipNotify gets called in + * time to prevent any conflict, but the transition from + * shared->private is sometimes missed if we don't do this. + */ +static void +DRIClipNotifyAllDrawables(ScreenPtr pScreen) +{ + int i; + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + + for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { + pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; + } +} + + +static void +DRITransitionToSharedBuffers(ScreenPtr pScreen) +{ +/* ErrorF("DRITransitionToSharedBuffers\n"); */ + DRIClipNotifyAllDrawables( pScreen ); +} + + +static void +DRITransitionToPrivateBuffers(ScreenPtr pScreen) +{ +/* ErrorF("DRITransitionToPrivateBuffers\n"); */ + DRIClipNotifyAllDrawables( pScreen ); +} + + +static void +DRITransitionTo3d(ScreenPtr pScreen) +{ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; + +/* ErrorF("DRITransitionTo3d\n"); */ + + if (pDRIInfo->TransitionTo3d) + pDRIInfo->TransitionTo3d( pScreen ); +} + +static void +DRITransitionTo2d(ScreenPtr pScreen) +{ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; + +/* ErrorF("DRITransitionTo2d\n"); */ + + if (pDRIInfo->TransitionTo2d) + pDRIInfo->TransitionTo2d( pScreen ); +} + + Bool -DRICreateDrawable( - ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable, - drmDrawablePtr hHWDrawable -) +DRICreateDrawable(ScreenPtr pScreen, Drawable id, + DrawablePtr pDrawable, drmDrawablePtr hHWDrawable) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv; @@ -734,6 +776,17 @@ DRICreateDrawable( pWin->devPrivates[DRIWindowPrivIndex].ptr = (pointer)pDRIDrawablePriv; + switch (++pDRIPriv->nrWindows) { + case 1: + DRITransitionTo3d( pScreen ); + break; + case 2: + DRITransitionToSharedBuffers( pScreen ); + break; + default: + break; + } + /* track this in case this window is destroyed */ AddResource(id, DRIDrawablePrivResType, (pointer)pWin); } @@ -747,22 +800,19 @@ DRICreateDrawable( } Bool -DRIDestroyDrawable( - ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable -) +DRIDestroyDrawable(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable) { DRIDrawablePrivPtr pDRIDrawablePriv; WindowPtr pWin; + if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr)pDrawable; pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); pDRIDrawablePriv->refCount--; if (pDRIDrawablePriv->refCount <= 0) { /* This calls back DRIDrawablePrivDelete which frees private area */ - FreeResourceByType(id, DRIDrawablePrivResType, FALSE); + FreeResourceByType(id, DRIDrawablePrivResType, FALSE); } } else { /* pixmap (or for GLX 1.3, a PBuffer) */ @@ -774,9 +824,7 @@ DRIDestroyDrawable( } Bool -DRIDrawablePrivDelete( - pointer pResource, - XID id) +DRIDrawablePrivDelete(pointer pResource, XID id) { DrawablePtr pDrawable = (DrawablePtr)pResource; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen); @@ -798,6 +846,17 @@ DRIDrawablePrivDelete( } xfree(pDRIDrawablePriv); pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL; + + switch (--pDRIPriv->nrWindows) { + case 0: + DRITransitionTo2d( pDrawable->pScreen ); + break; + case 1: + DRITransitionToPrivateBuffers( pDrawable->pScreen ); + break; + default: + break; + } } else { /* pixmap (or for GLX 1.3, a PBuffer) */ /* NOT_DONE */ @@ -808,24 +867,27 @@ DRIDrawablePrivDelete( } Bool -DRIGetDrawableInfo( - ScreenPtr pScreen, - DrawablePtr pDrawable, - unsigned int* index, - unsigned int* stamp, - int* X, - int* Y, - int* W, - int* H, - int* numClipRects, - XF86DRIClipRectPtr* pClipRects -) +DRIGetDrawableInfo(ScreenPtr pScreen, + DrawablePtr pDrawable, + unsigned int* index, + unsigned int* stamp, + int* X, + int* Y, + int* W, + int* H, + int* numClipRects, + XF86DRIClipRectPtr* pClipRects, + int* backX, + int* backY, + int* numBackClipRects, + XF86DRIClipRectPtr* pBackClipRects) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv; WindowPtr pWin, pOldWin; - int i, oldestIndex = 0; - unsigned int oldestStamp; + int i; + + printf("maxDrawableTableEntry = %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry); if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr)pDrawable; @@ -849,7 +911,8 @@ DRIGetDrawableInfo( /* Search table for oldest entry */ if (i == pDRIPriv->pDriverInfo->maxDrawableTableEntry) { - oldestStamp = ~0; + unsigned int oldestStamp = ~0; + int oldestIndex = 0; i = pDRIPriv->pDriverInfo->maxDrawableTableEntry; while (i--) { if (pDRIPriv->pSAREA->drawableTable[i].stamp < @@ -867,10 +930,10 @@ DRIGetDrawableInfo( pOldDrawPriv->drawableIndex = -1; /* claim drawable table entry */ - pDRIPriv->DRIDrawables[i] = pDrawable; + pDRIPriv->DRIDrawables[oldestIndex] = pDrawable; /* validate SAREA entry */ - pDRIPriv->pSAREA->drawableTable[i].stamp = + pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = DRIDrawableValidationStamp++; /* check for stamp wrap around */ @@ -886,6 +949,13 @@ DRIGetDrawableInfo( } } + /* If the driver wants to be notified when the index is + * set for a drawable, let it know now. + */ + if (pDRIPriv->pDriverInfo->SetDrawableIndex) + pDRIPriv->pDriverInfo->SetDrawableIndex(pWin, + pDRIDrawablePriv->drawableIndex); + /* reinit drawable ID if window is visible */ if ((pWin->viewable) && (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS)) @@ -907,6 +977,35 @@ DRIGetDrawableInfo( *H = (int)(pWin->drawable.height); *numClipRects = REGION_NUM_RECTS(&pWin->clipList); *pClipRects = (XF86DRIClipRectPtr)REGION_RECTS(&pWin->clipList); + + *backX = *X; + *backY = *Y; + + if (pDRIPriv->nrWindows == 1 && *numClipRects) { + /* Use a single cliprect. */ + + int x0 = *X; + int y0 = *Y; + int x1 = x0 + *W; + int y1 = y0 + *H; + + if (x0 < 0) x0 = 0; + if (y0 < 0) y0 = 0; + if (x1 > pScreen->width-1) x1 = pScreen->width-1; + if (y1 > pScreen->height-1) y1 = pScreen->height-1; + + pDRIPriv->private_buffer_rect.x1 = x0; + pDRIPriv->private_buffer_rect.y1 = y0; + pDRIPriv->private_buffer_rect.x2 = x1; + pDRIPriv->private_buffer_rect.y2 = y1; + + *numBackClipRects = 1; + *pBackClipRects = &(pDRIPriv->private_buffer_rect); + } else { + /* Use the frontbuffer cliprects for back buffers. */ + *numBackClipRects = 0; + *pBackClipRects = 0; + } } else { /* Not a DRIDrawable */ @@ -922,15 +1021,13 @@ DRIGetDrawableInfo( } Bool -DRIGetDeviceInfo( - ScreenPtr pScreen, - drmHandlePtr hFrameBuffer, - int* fbOrigin, - int* fbSize, - int* fbStride, - int* devPrivateSize, - void** pDevPrivate -) +DRIGetDeviceInfo(ScreenPtr pScreen, + drmHandlePtr hFrameBuffer, + int* fbOrigin, + int* fbSize, + int* fbStride, + int* devPrivateSize, + void** pDevPrivate) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -961,6 +1058,11 @@ DRICreateInfoRec(void) inforec->wrap.CopyWindow = DRICopyWindow; inforec->wrap.ValidateTree = DRIValidateTree; inforec->wrap.PostValidateTree = DRIPostValidateTree; + inforec->wrap.ClipNotify = DRIClipNotify; + + inforec->TransitionTo2d = 0; + inforec->TransitionTo3d = 0; + inforec->SetDrawableIndex = 0; return inforec; } @@ -972,11 +1074,9 @@ DRIDestroyInfoRec(DRIInfoPtr DRIInfo) xfree((char*)DRIInfo); } + void -DRIWakeupHandler( - pointer wakeupData, - int result, - pointer pReadmask) +DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask) { int i; @@ -992,10 +1092,7 @@ DRIWakeupHandler( } void -DRIBlockHandler( - pointer blockData, - OSTimePtr pTimeout, - pointer pReadmask) +DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) { int i; @@ -1011,11 +1108,8 @@ DRIBlockHandler( } void -DRIDoWakeupHandler( - int screenNum, - pointer wakeupData, - unsigned long result, - pointer pReadmask) +DRIDoWakeupHandler(int screenNum, pointer wakeupData, + unsigned long result, pointer pReadmask) { ScreenPtr pScreen = screenInfo.screens[screenNum]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1033,11 +1127,8 @@ DRIDoWakeupHandler( } void -DRIDoBlockHandler( - int screenNum, - pointer blockData, - pointer pTimeout, - pointer pReadmask) +DRIDoBlockHandler(int screenNum, pointer blockData, + pointer pTimeout, pointer pReadmask) { ScreenPtr pScreen = screenInfo.screens[screenNum]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1055,11 +1146,7 @@ DRIDoBlockHandler( } void -DRISwapContext( - int drmFD, - void *oldctx, - void *newctx -) +DRISwapContext(int drmFD, void *oldctx, void *newctx) { DRIContextPrivPtr oldContext = (DRIContextPrivPtr)oldctx; DRIContextPrivPtr newContext = (DRIContextPrivPtr)newctx; @@ -1214,10 +1301,7 @@ DRIGetContextStore(DRIContextPrivPtr context) } void -DRIPaintWindow( - WindowPtr pWin, - RegionPtr prgn, - int what) +DRIPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1279,10 +1363,7 @@ DRIPaintWindow( } void -DRICopyWindow( - WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc) +DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1320,10 +1401,10 @@ DRICopyWindow( } static void -DRIGetSecs(unsigned long *secs, unsigned long *usecs) +DRIGetSecs(long *secs, long *usecs) { -#if XFree86LOADER - xf86getsecs(secs,usecs); +#ifdef XFree86LOADER + getsecs(secs,usecs); #else struct timeval tv; @@ -1348,12 +1429,12 @@ DRIComputeMilliSeconds(unsigned long s_secs, unsigned long s_usecs, static void DRISpinLockTimeout(drmLock *lock, int val, unsigned long timeout /* in mS */) { - int count = 10000; - char ret; - unsigned long s_secs, s_usecs; - unsigned long f_secs, f_usecs; - unsigned long msecs; - unsigned long prev = 0; + int count = 10000; + char ret; + long s_secs, s_usecs; + long f_secs, f_usecs; + long msecs; + long prev = 0; DRIGetSecs(&s_secs, &s_usecs); @@ -1376,10 +1457,7 @@ DRISpinLockTimeout(drmLock *lock, int val, unsigned long timeout /* in mS */) } int -DRIValidateTree( - WindowPtr pParent, - WindowPtr pChild, - VTKind kind) +DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) { ScreenPtr pScreen = pParent->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1434,10 +1512,7 @@ DRIValidateTree( } void -DRIPostValidateTree( - WindowPtr pParent, - WindowPtr pChild, - VTKind kind) +DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) { ScreenPtr pScreen; DRIScreenPrivPtr pDRIPriv; @@ -1468,10 +1543,7 @@ DRIPostValidateTree( } void -DRIClipNotify( - WindowPtr pWin, - int dx, - int dy) +DRIClipNotify(WindowPtr pWin, int dx, int dy) { DRIScreenPrivPtr pDRIPriv; DRIDrawablePrivPtr pDRIDrawablePriv; @@ -1484,8 +1556,7 @@ DRIClipNotify( } CARD32 -DRIGetDrawableIndex( - WindowPtr pWin) +DRIGetDrawableIndex(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1502,10 +1573,26 @@ DRIGetDrawableIndex( return index; } +unsigned int +DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index) +{ + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + return pDRIPriv->pSAREA->drawableTable[drawable_index].stamp; +} + + void -DRILock(ScreenPtr pScreen, int flags) { +DRIPrintDrawableLock(ScreenPtr pScreen, char *msg) +{ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + + ErrorF("%s: %d\n", msg, pDRIPriv->pSAREA->drawable_lock.lock); +} +void +DRILock(ScreenPtr pScreen, int flags) { + DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); + if (!lockRefCount) DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags); lockRefCount++; @@ -1528,17 +1615,38 @@ DRIUnlock(ScreenPtr pScreen) { DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext); } -void *DRIGetSAREAPrivate(ScreenPtr pScreen) +void * +DRIGetSAREAPrivate(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv) return 0; - return ((void*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec); + return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec)); } -drmContext DRIGetContext(ScreenPtr pScreen) +drmContext +DRIGetContext(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv) return 0; return pDRIPriv->myContext; } +/* This lets get at the unwrapped functions so that they can correctly + * call the lowerlevel functions, and choose whether they will be + * called at every level of recursion (eg in validatetree). + */ +DRIWrappedFuncsRec * +DRIGetWrappedFuncs(ScreenPtr pScreen) +{ + return &(DRI_SCREEN_PRIV(pScreen)->wrap); +} + +void +DRIQueryVersion(int *majorVersion, + int *minorVersion, + int *patchVersion) +{ + *majorVersion = XF86DRI_MAJOR_VERSION; + *minorVersion = XF86DRI_MINOR_VERSION; + *patchVersion = XF86DRI_PATCH_VERSION; +} diff --git a/xc/programs/Xserver/GL/dri/dri.h b/xc/programs/Xserver/GL/dri/dri.h index d82ec5359..e50b6119f 100644 --- a/xc/programs/Xserver/GL/dri/dri.h +++ b/xc/programs/Xserver/GL/dri/dri.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.9 2000/03/04 01:53:02 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dri.h,v 1.12 2000/06/23 19:29:41 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -69,6 +69,10 @@ typedef int DRIWindowRequests; #define DRI_3D_WINDOWS_ONLY 1 #define DRI_ALL_WINDOWS 2 + +typedef void (*ClipNotifyPtr)( WindowPtr, int, int ); + + /* * These functions can be wrapped by the DRI. Each of these have * generic default funcs (initialized in DRICreateInfoRec) and can be @@ -82,8 +86,12 @@ typedef struct { CopyWindowProcPtr CopyWindow; ValidateTreeProcPtr ValidateTree; PostValidateTreeProcPtr PostValidateTree; + ClipNotifyPtr ClipNotify; } DRIWrappedFuncsRec, *DRIWrappedFuncsPtr; + + + typedef struct { /* driver call back functions */ Bool (*CreateContext)(ScreenPtr pScreen, @@ -107,6 +115,9 @@ typedef struct { DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); + void (*TransitionTo3d)(ScreenPtr pScreen); + void (*TransitionTo2d)(ScreenPtr pScreen); + void (*SetDrawableIndex)(WindowPtr pWin, CARD32 index); /* wrapped functions */ DRIWrappedFuncsRec wrap; @@ -131,131 +142,158 @@ typedef struct { void* devPrivate; } DRIInfoRec, *DRIInfoPtr; -extern Bool DRIScreenInit( - ScreenPtr pScreen, - DRIInfoPtr pDRIInfo, - int* pDRMFD); -void DRICloseScreen(ScreenPtr pScreen); -Bool DRIExtensionInit(void); -void DRIReset(void); -Bool DRIQueryDirectRenderingCapable( ScreenPtr pScreen, Bool* isCapable); -Bool DRIOpenConnection( - ScreenPtr pScreen, - drmHandlePtr hSAREA, - char **busIdString -); -Bool DRIAuthConnection(ScreenPtr pScreen, drmMagic magic); -Bool DRICloseConnection( ScreenPtr pScreen); -Bool DRIGetClientDriverName( - ScreenPtr pScreen, - int* ddxDriverMajorVersion, - int* ddxDriverMinorVersion, - int* ddxDriverPatchVersion, - char** clientDriverName -); -Bool DRICreateContext( - ScreenPtr pScreen, - VisualPtr visual, - XID context, - drmContextPtr pHWContext -); -Bool DRIDestroyContext( ScreenPtr pScreen, XID context); -Bool DRIContextPrivDelete( - pointer pResource, - XID id); -Bool DRICreateDrawable( - ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable, - drmDrawablePtr hHWDrawable -); -Bool DRIDestroyDrawable( ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable); -Bool DRIDrawablePrivDelete( - pointer pResource, - XID id); -Bool DRIGetDrawableInfo( - ScreenPtr pScreen, - DrawablePtr pDrawable, - unsigned int* index, - unsigned int* stamp, - int* X, - int* Y, - int* W, - int* H, - int* numClipRects, - XF86DRIClipRectPtr* pClipRects -); -Bool DRIGetDeviceInfo( - ScreenPtr pScreen, - drmHandlePtr hFrameBuffer, - int* fbOrigin, - int* fbSize, - int* fbStride, - int* devPrivateSize, - void** pDevPrivate -); -DRIInfoPtr DRICreateInfoRec(void); -void DRIDestroyInfoRec(DRIInfoPtr DRIInfo); -Bool DRIFinishScreenInit(ScreenPtr pScreen); -void DRIWakeupHandler( - pointer wakeupData, - int result, - pointer pReadmask); -void DRIBlockHandler( - pointer blockData, - OSTimePtr pTimeout, - pointer pReadmask); -void DRIDoWakeupHandler( - int screenNum, - pointer wakeupData, - unsigned long result, - pointer pReadmask); -void DRIDoBlockHandler( - int screenNum, - pointer blockData, - pointer pTimeout, - pointer pReadmask); -void DRISwapContext( - int drmFD, - void *oldctx, - void *newctx); -void* DRIGetContextStore(DRIContextPrivPtr context); -void DRIPaintWindow( - WindowPtr pWin, - RegionPtr prgn, - int what); -void DRICopyWindow( - WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc); -int DRIValidateTree( - WindowPtr pParent, - WindowPtr pChild, - VTKind kind); -void DRIPostValidateTree( - WindowPtr pParent, - WindowPtr pChild, - VTKind kind); -void DRIClipNotify( - WindowPtr pWin, - int dx, - int dy); -CARD32 DRIGetDrawableIndex( - WindowPtr pWin); -void DRILock(ScreenPtr pScreen, int flags); -void DRIUnlock(ScreenPtr pScreen); -void *DRIGetSAREAPrivate(ScreenPtr pScreen); -DRIContextPrivPtr -DRICreateContextPriv(ScreenPtr pScreen, - drmContextPtr pHWContext, - DRIContextFlags flags); -DRIContextPrivPtr -DRICreateContextPrivFromHandle(ScreenPtr pScreen, - drmContext hHWContext, - DRIContextFlags flags); -Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv); + +extern Bool DRIScreenInit(ScreenPtr pScreen, + DRIInfoPtr pDRIInfo, + int *pDRMFD); + +extern void DRICloseScreen(ScreenPtr pScreen); + +extern Bool DRIExtensionInit(void); + +extern void DRIReset(void); + +extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen, + Bool *isCapable); + +extern Bool DRIOpenConnection(ScreenPtr pScreen, + drmHandlePtr hSAREA, + char **busIdString); + +extern Bool DRIAuthConnection(ScreenPtr pScreen, drmMagic magic); + +extern Bool DRICloseConnection(ScreenPtr pScreen); + +extern Bool DRIGetClientDriverName(ScreenPtr pScreen, + int* ddxDriverMajorVersion, + int* ddxDriverMinorVersion, + int* ddxDriverPatchVersion, + char** clientDriverName); + +extern Bool DRICreateContext(ScreenPtr pScreen, + VisualPtr visual, + XID context, + drmContextPtr pHWContext); + +extern Bool DRIDestroyContext(ScreenPtr pScreen, XID context); + +extern Bool DRIContextPrivDelete(pointer pResource, XID id); + +extern Bool DRICreateDrawable(ScreenPtr pScreen, + Drawable id, + DrawablePtr pDrawable, + drmDrawablePtr hHWDrawable); + +extern Bool DRIDestroyDrawable(ScreenPtr pScreen, + Drawable id, + DrawablePtr pDrawable); + +extern Bool DRIDrawablePrivDelete(pointer pResource, + XID id); + +extern Bool DRIGetDrawableInfo(ScreenPtr pScreen, + DrawablePtr pDrawable, + unsigned int* index, + unsigned int* stamp, + int* X, + int* Y, + int* W, + int* H, + int* numClipRects, + XF86DRIClipRectPtr* pClipRects, + int* backX, + int* backY, + int* numBackClipRects, + XF86DRIClipRectPtr* pBackClipRects); + +extern Bool DRIGetDeviceInfo(ScreenPtr pScreen, + drmHandlePtr hFrameBuffer, + int* fbOrigin, + int* fbSize, + int* fbStride, + int* devPrivateSize, + void** pDevPrivate); + +extern DRIInfoPtr DRICreateInfoRec(void); + +extern void DRIDestroyInfoRec(DRIInfoPtr DRIInfo); + +extern Bool DRIFinishScreenInit(ScreenPtr pScreen); + +extern void DRIWakeupHandler(pointer wakeupData, + int result, + pointer pReadmask); + +extern void DRIBlockHandler(pointer blockData, + OSTimePtr pTimeout, + pointer pReadmask); + +extern void DRIDoWakeupHandler(int screenNum, + pointer wakeupData, + unsigned long result, + pointer pReadmask); + +extern void DRIDoBlockHandler(int screenNum, + pointer blockData, + pointer pTimeout, + pointer pReadmask); + +extern void DRISwapContext(int drmFD, + void *oldctx, + void *newctx); + +extern void *DRIGetContextStore(DRIContextPrivPtr context); + +extern void DRIPaintWindow(WindowPtr pWin, + RegionPtr prgn, + int what); + +extern void DRICopyWindow(WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +extern int DRIValidateTree(WindowPtr pParent, + WindowPtr pChild, + VTKind kind); + +extern void DRIPostValidateTree(WindowPtr pParent, + WindowPtr pChild, + VTKind kind); + +extern void DRIClipNotify(WindowPtr pWin, + int dx, + int dy); + +extern CARD32 DRIGetDrawableIndex(WindowPtr pWin); + +extern void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg); + +extern void DRILock(ScreenPtr pScreen, int flags); + +extern void DRIUnlock(ScreenPtr pScreen); + +extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen); + +extern void *DRIGetSAREAPrivate(ScreenPtr pScreen); + +extern unsigned int DRIGetDrawableStamp(ScreenPtr pScreen, + CARD32 drawable_index); + +extern DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen, + drmContextPtr pHWContext, + DRIContextFlags flags); + +extern DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen, + drmContext hHWContext, + DRIContextFlags flags); + +extern Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv); + +extern drmContext DRIGetContext(ScreenPtr pScreen); + +extern void DRIQueryVersion(int *majorVersion, + int *minorVersion, + int *patchVersion); #define _DRI_H_ diff --git a/xc/programs/Xserver/GL/dri/dristruct.h b/xc/programs/Xserver/GL/dri/dristruct.h index 392be3d97..02d62ae49 100644 --- a/xc/programs/Xserver/GL/dri/dristruct.h +++ b/xc/programs/Xserver/GL/dri/dristruct.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.7 2000/03/02 16:07:38 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/dristruct.h,v 1.8 2000/06/17 00:03:12 martin Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -87,6 +87,8 @@ typedef struct _DRIScreenPrivRec void** hiddenContextStore; /* hidden X context */ void** partial3DContextStore; /* parital 3D context */ DRIInfoPtr pDriverInfo; + int nrWindows; + XF86DRIClipRectRec private_buffer_rect; /* management of private buffers */ DRIWrappedFuncsRec wrap; DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES]; } DRIScreenPrivRec, *DRIScreenPrivPtr; diff --git a/xc/programs/Xserver/GL/dri/xf86dri.c b/xc/programs/Xserver/GL/dri/xf86dri.c index b39b57450..4fd33c2ec 100644 --- a/xc/programs/Xserver/GL/dri/xf86dri.c +++ b/xc/programs/Xserver/GL/dri/xf86dri.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/dri/xf86dri.c,v 1.6 2000/02/23 04:46:52 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/dri/xf86dri.c,v 1.8 2000/06/25 16:03:43 tsi Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -33,7 +33,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -#if XFree86LOADER +#ifdef XFree86LOADER #include "xf86.h" #include "xf86_ansic.h" #endif @@ -161,6 +161,9 @@ ProcXF86DRIQueryDirectRenderingCapable( } rep.isCapable = isCapable; + if (!LocalClient(client)) + rep.isCapable = 0; + WriteToClient(client, sizeof(xXF86DRIQueryDirectRenderingCapableReply), (char *)&rep); return (client->noClientException); @@ -210,12 +213,21 @@ ProcXF86DRIAuthConnection( register ClientPtr client ) { + xXF86DRIAuthConnectionReply rep; + REQUEST(xXF86DRIAuthConnectionReq); REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq); - if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) - ErrorF("Failed to authenticate %u\n", stuff->magic); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.authenticated = 1; + if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) { + ErrorF("Failed to authenticate %u\n", stuff->magic); + rep.authenticated = 0; + } + WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *)&rep); return (client->noClientException); } @@ -388,6 +400,8 @@ ProcXF86DRIGetDrawableInfo( DrawablePtr pDrawable; int X, Y, W, H; XF86DRIClipRectPtr pClipRects; + XF86DRIClipRectPtr pBackClipRects; + int backX, backY; REQUEST(xXF86DRIGetDrawableInfoReq); REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq); @@ -411,7 +425,11 @@ ProcXF86DRIGetDrawableInfo( (int*)&W, (int*)&H, (int*)&rep.numClipRects, - &pClipRects)) { + &pClipRects, + &backX, + &backY, + (int*)&rep.numBackClipRects, + &pBackClipRects)) { return BadValue; } @@ -419,18 +437,32 @@ ProcXF86DRIGetDrawableInfo( rep.drawableY = Y; rep.drawableWidth = W; rep.drawableHeight = H; + rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - + SIZEOF(xGenericReply)); + + rep.backX = backX; + rep.backY = backY; + + if (rep.numBackClipRects) + rep.length += sizeof(XF86DRIClipRectRec) * rep.numBackClipRects; + + if (rep.numClipRects) + rep.length += sizeof(XF86DRIClipRectRec) * rep.numClipRects; + + WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep); - rep.length = 0; if (rep.numClipRects) { - rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - - SIZEOF(xGenericReply) + - sizeof(XF86DRIClipRectRec) * rep.numClipRects); + WriteToClient(client, + sizeof(XF86DRIClipRectRec) * rep.numClipRects, + (char *)pClipRects); } - WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep); - if (rep.length) { - WriteToClient(client, rep.length, (char *)pClipRects); + if (rep.numBackClipRects) { + WriteToClient(client, + sizeof(XF86DRIClipRectRec) * rep.numBackClipRects, + (char *)pBackClipRects); } + return (client->noClientException); } @@ -487,15 +519,19 @@ ProcXF86DRIDispatch ( { REQUEST(xReq); - if (!LocalClient(client)) - return DRIErrorBase + XF86DRIClientNotLocal; - switch (stuff->data) { case X_XF86DRIQueryVersion: return ProcXF86DRIQueryVersion(client); case X_XF86DRIQueryDirectRenderingCapable: return ProcXF86DRIQueryDirectRenderingCapable(client); + } + + if (!LocalClient(client)) + return DRIErrorBase + XF86DRIClientNotLocal; + + switch (stuff->data) + { case X_XF86DRIOpenConnection: return ProcXF86DRIOpenConnection(client); case X_XF86DRICloseConnection: diff --git a/xc/programs/Xserver/GL/glx/glxcmds.c b/xc/programs/Xserver/GL/glx/glxcmds.c index 2504ffa29..64b28a206 100644 --- a/xc/programs/Xserver/GL/glx/glxcmds.c +++ b/xc/programs/Xserver/GL/glx/glxcmds.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.4 1999/07/18 08:34:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxcmds.c,v 1.5 2000/06/17 00:03:12 martin Exp $ */ /* ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the @@ -139,8 +139,13 @@ int __glXCreateContext(__GLXclientState *cl, GLbyte *pc) ** NOTE: no support for sharing display lists between direct ** contexts, even if they are in the same address space. */ +#if 0 + /* Disabling this code seems to allow shared display lists + * and texture objects to work. We'll leave it disabled for now. + */ client->errorValue = shareList; return BadMatch; +#endif } else { /* ** Create an indirect context regardless of what the client asked diff --git a/xc/programs/Xserver/GL/glx/glxscreens.c b/xc/programs/Xserver/GL/glx/glxscreens.c index d10696847..d68bca06e 100644 --- a/xc/programs/Xserver/GL/glx/glxscreens.c +++ b/xc/programs/Xserver/GL/glx/glxscreens.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.2 1999/06/14 07:31:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/glx/glxscreens.c,v 1.4 2000/06/17 00:03:12 martin Exp $ */ /* ** The contents of this file are subject to the GLX Public License Version 1.0 ** (the "License"). You may not use this file except in compliance with the @@ -20,8 +20,13 @@ ** $SGI$ */ +#ifdef IN_MODULE +#include <xf86_ansic.h> +#else #include <string.h> #include <signal.h> +#endif + #include <windowstr.h> #include "glxserver.h" @@ -246,9 +251,14 @@ void __glXScreenInit(GLint numscreens) if ((*__glXScreens[j]->screenProbe)(i)) { __glXActiveScreens[i] = *__glXScreens[j]; +#if 0 + /* we don't use this since matchVisuals doesn't allow alpha */ __glXActiveScreens[i].numUsableVisuals = matchVisuals(__glXActiveScreens[i].pGlxVisual, __glXActiveScreens[i].numVisuals, i); +#else + __glXActiveScreens[i].numUsableVisuals = __glXActiveScreens[i].numVisuals; +#endif __glXActiveScreens[i].GLXvendor = __glXStrdup(GLXServerVendorName); __glXActiveScreens[i].GLXversion = __glXStrdup(GLXServerVersion); __glXActiveScreens[i].GLXextensions = __glXStrdup(GLXServerExtensions); diff --git a/xc/programs/Xserver/GL/mesa/include/GL/Imakefile b/xc/programs/Xserver/GL/mesa/include/GL/Imakefile index 3bef7e2db..69ea6c654 100644 --- a/xc/programs/Xserver/GL/mesa/include/GL/Imakefile +++ b/xc/programs/Xserver/GL/mesa/include/GL/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.4 2000/02/23 04:46:55 martin Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.5 2000/06/30 18:27:01 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -6,7 +6,8 @@ XCOMM $XFree86: xc/programs/Xserver/GL/mesa/include/GL/Imakefile,v 1.4 2000/02/2 DEFINES = $(GLX_DEFINES) LinkSourceFile(gl.h, ../../../../../../extras/Mesa/include/GL) -LinkSourceFile(glx.h, ../../../../../../extras/Mesa/include/GL) +LinkSourceFile(glx.h, ../../../../../../../xc/include/GL) +LinkSourceFile(glxtokens.h, ../../../../../../../xc/include/GL) LinkSourceFile(xmesa.h, ../../../../../../extras/Mesa/include/GL) LinkSourceFile(xmesa_x.h, ../../../../../../extras/Mesa/include/GL) LinkSourceFile(xmesa_xf86.h, ../../../../../../extras/Mesa/include/GL) diff --git a/xc/programs/Xserver/GL/mesa/src/Imakefile b/xc/programs/Xserver/GL/mesa/src/Imakefile index 29ae102d4..42eb72f67 100644 --- a/xc/programs/Xserver/GL/mesa/src/Imakefile +++ b/xc/programs/Xserver/GL/mesa/src/Imakefile @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.13 2000/03/02 16:07:38 martin Exp $ +XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.14 2000/06/17 00:03:13 martin Exp $ #define IHaveModules #include <Server.tmpl> @@ -7,6 +7,9 @@ XCOMM $XFree86: xc/programs/Xserver/GL/mesa/src/Imakefile,v 1.13 2000/03/02 16:0 SUBDIRS = X +LinkSourceFile(aatriangle.c,../../../../../extras/Mesa/src) +LinkSourceFile(aatriangle.h,../../../../../extras/Mesa/src) +LinkSourceFile(aatritemp.h,../../../../../extras/Mesa/src) LinkSourceFile(accum.c,../../../../../extras/Mesa/src) LinkSourceFile(accum.h,../../../../../extras/Mesa/src) LinkSourceFile(all.h,../../../../../extras/Mesa/src) @@ -115,6 +118,8 @@ LinkSourceFile(pipeline.c,../../../../../extras/Mesa/src) LinkSourceFile(pipeline.h,../../../../../extras/Mesa/src) LinkSourceFile(pixel.c,../../../../../extras/Mesa/src) LinkSourceFile(pixel.h,../../../../../extras/Mesa/src) +LinkSourceFile(pixeltex.c,../../../../../extras/Mesa/src) +LinkSourceFile(pixeltex.h,../../../../../extras/Mesa/src) LinkSourceFile(points.c,../../../../../extras/Mesa/src) LinkSourceFile(points.h,../../../../../extras/Mesa/src) LinkSourceFile(polygon.c,../../../../../extras/Mesa/src) @@ -184,7 +189,8 @@ LinkSourceFile(xform_tmp.h,../../../../../extras/Mesa/src) LinkSourceFile(zoom.c,../../../../../extras/Mesa/src) LinkSourceFile(zoom.h,../../../../../extras/Mesa/src) - CORE_SRCS = accum.c \ + CORE_SRCS = aatriangle.c \ + accum.c \ alpha.c \ alphabuf.c \ attrib.c \ @@ -226,6 +232,7 @@ LinkSourceFile(zoom.h,../../../../../extras/Mesa/src) pb.c \ pipeline.c \ pixel.c \ + pixeltex.c \ points.c \ polygon.c \ quads.c \ @@ -257,7 +264,8 @@ LinkSourceFile(zoom.h,../../../../../extras/Mesa/src) xform.c \ zoom.c - CORE_OBJS = accum.o \ + CORE_OBJS = aatriangle.o \ + accum.o \ alpha.o \ alphabuf.o \ attrib.o \ @@ -300,6 +308,7 @@ LinkSourceFile(zoom.h,../../../../../extras/Mesa/src) pb.o \ pipeline.o \ pixel.o \ + pixeltex.o \ points.o \ polygon.o \ quads.o \ diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c index f305e3488..00e151147 100644 --- a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c +++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.7 2000/02/23 04:46:56 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/GL/mesa/src/X/xf86glx.c,v 1.9 2000/06/17 00:03:13 martin Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -29,6 +29,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* * Authors: * Kevin E. Martin <kevin@precisioninsight.com> + * Brian E. Paul <brian@precisioninsight.com> * */ @@ -93,12 +94,13 @@ __GLXextensionInfo __glDDXExtensionInfo = { __MESA_setVisualConfigs }; -__MESA_screen MESAScreens[MAXSCREENS]; -__GLcontext *MESA_CC = NULL; +static __MESA_screen MESAScreens[MAXSCREENS]; +static __GLcontext *MESA_CC = NULL; + +static int numConfigs = 0; +static __GLXvisualConfig *visualConfigs = NULL; +static void **visualPrivates = NULL; -int numConfigs = 0; -__GLXvisualConfig *visualConfigs = NULL; -void **visualPrivates = NULL; static int count_bits(unsigned int n) { @@ -111,6 +113,7 @@ static int count_bits(unsigned int n) return bits; } + static XMesaVisual find_mesa_visual(int screen, VisualID vid) { XMesaVisual xm_vis = NULL; @@ -129,251 +132,148 @@ static XMesaVisual find_mesa_visual(int screen, VisualID vid) return xm_vis; } -#define VISUAL_CONFIG(rgba,accum,back,depth,stencil,rating) \ -{ \ - -1, /* vid */ \ - -1, /* class */ \ - rgba, /* rgba */ \ - -1, -1, -1, 0, /* rgba sizes, alpha not supported, yet */ \ - -1, -1, -1, 0, /* rgba masks, alpha not supported, yet */ \ - accum, accum, accum, accum, /* rgba accum sizes */ \ - back, /* doubleBuffer */ \ - GL_FALSE, /* stereo */ \ - -1, /* bufferSize */ \ - depth, /* depthSize */ \ - stencil, /* stencilSize */ \ - 0, /* auxBuffers */ \ - 0, /* level */ \ - rating, /* visualRating */ \ - 0, /* transparentPixel */ \ - 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ \ - 0 /* transparentIndex */ \ -} -#define IS_RGBA GL_TRUE -#define IS_CI GL_FALSE -#define HAS_ACCUM ACCUM_BITS -#define NO_ACCUM 0 -#define HAS_BACK GL_TRUE -#define NO_BACK GL_FALSE -#define HAS_DEPTH DEPTH_BITS -#define NO_DEPTH 0 -#define HAS_STENCIL STENCIL_BITS -#define NO_STENCIL 0 - -static __GLXvisualConfig __MESAvisualConfigs[] = { - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, NO_BACK, HAS_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, HAS_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, HAS_BACK, HAS_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, NO_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0), - VISUAL_CONFIG(IS_RGBA, HAS_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, NO_BACK, HAS_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, HAS_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, NO_BACK, NO_DEPTH, NO_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0), - VISUAL_CONFIG( IS_CI, NO_ACCUM, HAS_BACK, HAS_DEPTH, HAS_STENCIL, 0), +/* + * In the case the driver has no GLX visuals we'll use these. + * [0] = RGB, double buffered + * [1] = RGB, double buffered, stencil, accum + * [2] = CI, double buffered + */ +#define NUM_FALLBACK_CONFIGS 3 +static __GLXvisualConfig FallbackConfigs[NUM_FALLBACK_CONFIGS] = { + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE_EXT, /* visualRating */ + 0, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + { + -1, /* vid */ + -1, /* class */ + True, /* rgba */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 16, 16, 16, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 8, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE_EXT, /* visualRating */ + 0, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, + { + -1, /* vid */ + -1, /* class */ + False, /* color index */ + -1, -1, -1, 0, /* rgba sizes */ + -1, -1, -1, 0, /* rgba masks */ + 0, 0, 0, 0, /* rgba accum sizes */ + True, /* doubleBuffer */ + False, /* stereo */ + -1, /* bufferSize */ + 16, /* depthSize */ + 0, /* stencilSize */ + 0, /* auxBuffers */ + 0, /* level */ + GLX_NONE_EXT, /* visualRating */ + 0, /* transparentPixel */ + 0, 0, 0, 0, /* transparent rgba color (floats scaled to ints) */ + 0 /* transparentIndex */ + }, }; -static int __numMESAvisualConfigs = - sizeof(__MESAvisualConfigs)/sizeof(__GLXvisualConfig); -static int __numRGBconfigs = -1; -static int __numCIconfigs = -1; static Bool init_visuals(int *nvisualp, VisualPtr *visualp, VisualID *defaultVisp, int ndepth, DepthPtr pdepth, int rootDepth) { + int numRGBconfigs; + int numCIconfigs; int numVisuals = *nvisualp; - int numMesaVisuals = 0; - int numMergedVisualConfigs = 0; + int numNewVisuals; + int numNewConfigs; VisualPtr pVisual = *visualp; VisualPtr pVisualNew = NULL; VisualID *orig_vid = NULL; __GLXvisualConfig *glXVisualPtr = NULL; - __GLXvisualConfig *pMergedVisualConfigs = NULL; + __GLXvisualConfig *pNewVisualConfigs = NULL; void **glXVisualPriv; - void **pMergedVisualPriv; - int *mesaConfigUsed; - int *driverConfigUsed; - int found_default = FALSE; + void **pNewVisualPriv; + int found_default; int i, j, k; - int is_rgb; - Bool match; - - /* Alloc space for the list of merged GLX visuals */ - pMergedVisualConfigs = - (__GLXvisualConfig *)__glXMalloc((numConfigs + - __numMESAvisualConfigs) * - sizeof(__GLXvisualConfig)); - if (!pMergedVisualConfigs) { - return FALSE; - } - - /* Alloc space for the list of merged GLX visual privates */ - pMergedVisualPriv = - (void **)__glXMalloc((numConfigs + __numMESAvisualConfigs) * - sizeof(void *)); - if (!pMergedVisualPriv) { - __glXFree(pMergedVisualConfigs); - return FALSE; - } - /* Compute the intersection of the driver's visual configs */ - mesaConfigUsed = __glXCalloc(__numMESAvisualConfigs, sizeof(int)); - driverConfigUsed = __glXCalloc(numConfigs, sizeof(int)); - - for (i = j = 0; i < numConfigs; i++) { - k = 0; - while ((k < __numMESAvisualConfigs) && (!driverConfigUsed[i])) { - if (!mesaConfigUsed[k]) { - -#ifdef DEBUG_VISUAL_CONFIG -#define TEST_AND_COPY(fld) do { \ - if (match) { \ - if ((__MESAvisualConfigs[k].fld == visualConfigs[i].fld) || \ - (__MESAvisualConfigs[k].fld == -1)) { \ - pMergedVisualConfigs[j].fld = visualConfigs[i].fld; \ - } \ - else if (visualConfigs[i].fld == -1) { \ - pMergedVisualConfigs[j].fld = __MESAvisualConfigs[k].fld; \ - } \ - else { \ - match = FALSE; \ - xf86DrvMsg (0, 0, "[GLXVisualInit] mismatch: " \ - "(%s) DriverVisualConfig[%d] MesaVisualConfig[%d]\n", \ - #fld, i, k); \ - } \ - } \ - } while (0) -#else -#define TEST_AND_COPY(fld) do { \ - if (match) { \ - if ((__MESAvisualConfigs[k].fld == visualConfigs[i].fld) || \ - (__MESAvisualConfigs[k].fld == -1)) { \ - pMergedVisualConfigs[j].fld = visualConfigs[i].fld; \ - } \ - else if (visualConfigs[i].fld == -1) { \ - pMergedVisualConfigs[j].fld = __MESAvisualConfigs[k].fld; \ - } \ - else { \ - match = FALSE; \ - } \ - } \ - } while (0) -#endif + if (numConfigs > 0) + numNewConfigs = numConfigs; + else + numNewConfigs = NUM_FALLBACK_CONFIGS; - match = TRUE; - TEST_AND_COPY(class); - TEST_AND_COPY(rgba); - TEST_AND_COPY(redSize); - TEST_AND_COPY(greenSize); - TEST_AND_COPY(blueSize); - TEST_AND_COPY(alphaSize); - TEST_AND_COPY(redMask); - TEST_AND_COPY(greenMask); - TEST_AND_COPY(blueMask); - TEST_AND_COPY(alphaMask); - TEST_AND_COPY(accumRedSize); - TEST_AND_COPY(accumGreenSize); - TEST_AND_COPY(accumBlueSize); - TEST_AND_COPY(accumAlphaSize); - TEST_AND_COPY(doubleBuffer); - TEST_AND_COPY(stereo); - TEST_AND_COPY(bufferSize); - TEST_AND_COPY(depthSize); - TEST_AND_COPY(stencilSize); - TEST_AND_COPY(auxBuffers); - TEST_AND_COPY(level); - TEST_AND_COPY(visualRating); - TEST_AND_COPY(transparentPixel); - TEST_AND_COPY(transparentRed); - TEST_AND_COPY(transparentGreen); - TEST_AND_COPY(transparentBlue); - TEST_AND_COPY(transparentAlpha); - TEST_AND_COPY(transparentIndex); - if (match) { - driverConfigUsed[i] = TRUE; - mesaConfigUsed[k] = TRUE; - pMergedVisualPriv[j] = visualPrivates[i]; - j++; -#ifdef DEBUG_VISUAL_CONFIG - xf86DrvMsg (0, 0, "[GLXVisualInit] MATCH: " - "DriverVisualConfig[%d] MesaVisualConfig[%d]\n", i, k); -#endif - } - } - k++; - } + /* Alloc space for the list of new GLX visuals */ + pNewVisualConfigs = (__GLXvisualConfig *) + __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); + if (!pNewVisualConfigs) { + return FALSE; } - /* - ** If SetVisualConfigs was not called, then just make all of Mesa's - ** visual configs available. - */ - if (!numConfigs) { - memcpy(pMergedVisualConfigs, __MESAvisualConfigs, - sizeof(__GLXvisualConfig) * __numMESAvisualConfigs); - memset(pMergedVisualPriv, 0, sizeof(void *) * __numMESAvisualConfigs); - memset(mesaConfigUsed, TRUE, sizeof(int) * __numMESAvisualConfigs); - j = __numMESAvisualConfigs; + /* Alloc space for the list of new GLX visual privates */ + pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); + if (!pNewVisualPriv) { + __glXFree(pNewVisualConfigs); + return FALSE; } /* - ** This code is not currently used. When the visual caveat - ** extension is supported by the DRI and Mesa, we can take advantage - ** of this code. + ** If SetVisualConfigs was not called, then use default GLX + ** visual configs. */ -#if 0 - /* Add any unclaimed MESA configs w/ slow caveat */ - for (i = 0; i < __numMESAvisualConfigs; i++) { - if (!mesaConfigUsed[i]) { - memcpy(&pMergedVisualConfigs[j], &__MESAvisualConfigs[i], - sizeof(__GLXvisualConfig)); - pMergedVisualConfigs[j].visualRating = GLX_SLOW_VISUAL_EXT; - j++; -#ifdef DEBUG_VISUAL_CONFIG - xf86DrvMsg (0, 0, "[GLXVisualInit] slow config: " - "MesaVisualConfig[%d]\n", i); -#endif - } + if (numConfigs == 0) { + memcpy(pNewVisualConfigs, FallbackConfigs, + NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); + memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); } - - /* Add any unclaimed driver configs w/ nonconformant caveat */ - for (i = 0; i < numConfigs; i++) { - if (!driverConfigUsed[i]) { - memcpy(&pMergedVisualConfigs[j], &visualConfigs[i], - sizeof(__GLXvisualConfig)); - pMergedVisualConfigs[j].visualRating = GLX_NON_CONFORMANT_VISUAL_EXT; - j++; -#ifdef DEBUG_VISUAL_CONFIG - xf86DrvMsg (0, 0, "[GLXVisualInit] non-conformant config: " - "DriverVisualConfig[%d]\n", i); -#endif - } + else { + /* copy driver's visual config info */ + for (i = 0; i < numConfigs; i++) { + pNewVisualConfigs[i] = visualConfigs[i]; + pNewVisualPriv[i] = visualPrivates[i]; + } } -#endif - numMergedVisualConfigs = j; /* Count the number of RGB and CI visual configs */ - __numRGBconfigs = __numCIconfigs = 0; - for (i = 0; i < numMergedVisualConfigs; i++) { - if (pMergedVisualConfigs[i].rgba) - __numRGBconfigs++; + numRGBconfigs = 0; + numCIconfigs = 0; + for (i = 0; i < numNewConfigs; i++) { + if (pNewVisualConfigs[i].rgba) + numRGBconfigs++; else - __numCIconfigs++; + numCIconfigs++; } /* Count the total number of visuals to compute */ + numNewVisuals = 0; for (i = 0; i < numVisuals; i++) { - numMesaVisuals += + numNewVisuals += (pVisual[i].class == TrueColor || pVisual[i].class == DirectColor) - ? __numRGBconfigs : __numCIconfigs; + ? numRGBconfigs : numCIconfigs; } /* Reset variables for use with the next screen/driver's visual configs */ @@ -381,51 +281,52 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, numConfigs = 0; /* Alloc temp space for the list of orig VisualIDs for each new visual */ - orig_vid = (VisualID *)__glXMalloc(numMesaVisuals * sizeof(VisualID)); + orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); if (!orig_vid) { - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); return FALSE; } /* Alloc space for the list of glXVisuals */ - glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numMesaVisuals * + glXVisualPtr = (__GLXvisualConfig *)__glXMalloc(numNewVisuals * sizeof(__GLXvisualConfig)); if (!glXVisualPtr) { __glXFree(orig_vid); - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); return FALSE; } /* Alloc space for the list of glXVisualPrivates */ - glXVisualPriv = (void **)__glXMalloc(numMesaVisuals * sizeof(void *)); + glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); if (!glXVisualPriv) { __glXFree(glXVisualPtr); __glXFree(orig_vid); - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); return FALSE; } /* Alloc space for the new list of the X server's visuals */ - pVisualNew = (VisualPtr)__glXMalloc(numMesaVisuals * sizeof(VisualRec)); + pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); if (!pVisualNew) { __glXFree(glXVisualPriv); __glXFree(glXVisualPtr); __glXFree(orig_vid); - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); return FALSE; } /* Initialize the new visuals */ + found_default = FALSE; for (i = j = 0; i < numVisuals; i++) { - is_rgb = (pVisual[i].class == TrueColor || - pVisual[i].class == DirectColor); + int is_rgb = (pVisual[i].class == TrueColor || + pVisual[i].class == DirectColor); - for (k = 0; k < numMergedVisualConfigs; k++) { - if (pMergedVisualConfigs[k].rgba != is_rgb) + for (k = 0; k < numNewConfigs; k++) { + if (pNewVisualConfigs[k].rgba != is_rgb) continue; /* Initialize the new visual */ @@ -442,7 +343,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, orig_vid[j] = pVisual[i].vid; /* Initialize the glXVisual */ - glXVisualPtr[j] = pMergedVisualConfigs[k]; + glXVisualPtr[j] = pNewVisualConfigs[k]; glXVisualPtr[j].vid = pVisualNew[j].vid; /* @@ -456,23 +357,25 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, glXVisualPtr[j].redSize = count_bits(pVisual[i].redMask); glXVisualPtr[j].greenSize = count_bits(pVisual[i].greenMask); glXVisualPtr[j].blueSize = count_bits(pVisual[i].blueMask); - glXVisualPtr[j].alphaSize = 0; /* Not supported in Mesa */ + glXVisualPtr[j].alphaSize = glXVisualPtr[j].alphaSize; glXVisualPtr[j].redMask = pVisual[i].redMask; glXVisualPtr[j].greenMask = pVisual[i].greenMask; glXVisualPtr[j].blueMask = pVisual[i].blueMask; - glXVisualPtr[j].alphaMask = 0; /* Not supported in Mesa */ + glXVisualPtr[j].alphaMask = glXVisualPtr[j].alphaMask; glXVisualPtr[j].bufferSize = rootDepth; } /* Save the device-dependent private for this visual */ - glXVisualPriv[j] = pMergedVisualPriv[k]; + glXVisualPriv[j] = pNewVisualPriv[k]; j++; } } + assert(j <= numNewVisuals); + /* Save the GLX visuals in the screen structure */ - MESAScreens[screenInfo.numScreens-1].num_vis = numMesaVisuals; + MESAScreens[screenInfo.numScreens-1].num_vis = numNewVisuals; MESAScreens[screenInfo.numScreens-1].glx_vis = glXVisualPtr; MESAScreens[screenInfo.numScreens-1].private = glXVisualPriv; @@ -484,7 +387,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, /* Count the new number of VisualIDs at this depth */ for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numMesaVisuals; k++) + for (k = 0; k < numNewVisuals; k++) if (pdepth[i].vids[j] == orig_vid[k]) numVids++; @@ -493,7 +396,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, /* Initialize the new list of VisualIDs for this depth */ for (j = 0; j < pdepth[i].numVids; j++) - for (k = 0; k < numMesaVisuals; k++) + for (k = 0; k < numNewVisuals; k++) if (pdepth[i].vids[j] == orig_vid[k]) pVids[n++] = pVisualNew[k].vid; @@ -504,7 +407,7 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, } /* Update the X server's visuals */ - *nvisualp = numMesaVisuals; + *nvisualp = numNewVisuals; *visualp = pVisualNew; /* Free the old list of the X server's visuals */ @@ -512,11 +415,12 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp, /* Clean up temporary allocations */ __glXFree(orig_vid); - __glXFree(pMergedVisualPriv); - __glXFree(pMergedVisualConfigs); + __glXFree(pNewVisualPriv); + __glXFree(pNewVisualConfigs); /* Free the private list created by DDX HW driver */ - if (visualPrivates) xfree(visualPrivates); + if (visualPrivates) + xfree(visualPrivates); visualPrivates = NULL; return TRUE; @@ -584,6 +488,8 @@ static void init_screen_visuals(int screen) /* Alloc space for the list of XMesa visuals */ pXMesaVisual = (XMesaVisual *)__glXMalloc(MESAScreens[screen].num_vis * sizeof(XMesaVisual)); + __glXMemset(pXMesaVisual, 0, + MESAScreens[screen].num_vis * sizeof(XMesaVisual)); used = (int *)__glXMalloc(pScreen->numVisuals * sizeof(int)); __glXMemset(used, 0, pScreen->numVisuals * sizeof(int)); @@ -603,18 +509,22 @@ static void init_screen_visuals(int screen) /* Create the XMesa visual */ pXMesaVisual[i] = - XMesaCreateVisual(pScreen, - pVis, - pGLXVis->rgba, - (pGLXVis->alphaSize > 0), - pGLXVis->doubleBuffer, - pGLXVis->stereo, - GL_TRUE, /* ximage_flag */ - pGLXVis->depthSize, - pGLXVis->stencilSize, - pGLXVis->accumRedSize, - pGLXVis->level); - + XMesaCreateVisual(pScreen, + pVis, + pGLXVis->rgba, + (pGLXVis->alphaSize > 0), + pGLXVis->doubleBuffer, + pGLXVis->stereo, + GL_TRUE, /* ximage_flag */ + pGLXVis->depthSize, + pGLXVis->stencilSize, + pGLXVis->accumRedSize, + pGLXVis->accumGreenSize, + pGLXVis->accumBlueSize, + pGLXVis->accumAlphaSize, + 0, /* numSamples */ + pGLXVis->level, + pGLXVis->visualRating ); /* Set the VisualID */ pGLXVis->vid = pVis->vid; @@ -670,7 +580,8 @@ extern void __MESA_resetExtension(void) for (i = 0; i < screenInfo.numScreens; i++) { for (j = 0; j < MESAScreens[i].num_vis; j++) { - XMesaDestroyVisual(MESAScreens[i].xm_vis[j]); + if (MESAScreens[i].xm_vis[j]) + XMesaDestroyVisual(MESAScreens[i].xm_vis[j]); } __glXFree(MESAScreens[i].glx_vis); MESAScreens[i].glx_vis = NULL; diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile index 45300d897..9e28fb7c6 100644 --- a/xc/programs/Xserver/Imakefile +++ b/xc/programs/Xserver/Imakefile @@ -2,7 +2,7 @@ XCOMM $TOG: Imakefile /main/249 1997/12/11 11:18:14 kaleb $ /* * Server Master Makefile */ -XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.182 2000/02/29 15:24:15 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/Imakefile,v 3.184 2000/06/17 00:03:10 martin Exp $ #ifndef InstallXserverSetUID #define InstallXserverSetUID NO @@ -619,7 +619,7 @@ XF86IDRVOBJS = $(XF86SRC)/input/drvConf.o XF86IDRVLIBS = $(XF86IDRIVERLIB) XF86SCANLIB = $(XF86SRC)/scanpci/LibraryTargetName(scanpci) XF86LIBS = $(XF86INIT) $(XF86COMLIB) $(XF86RACLIB) $(XF86PARSLIB) \ - $(XF86OSLIB) $(XF86INT10LIB) + $(XF86OSLIB) $(XF86INT10LIB) $(XF86DDCLIB) #else XF86LIBS = $(XF86INIT) $(XF86COMLIB) $(XF86PARSLIB) $(XF86OSLIB) #endif @@ -634,7 +634,8 @@ XF86SERVERSYSLIBS = $(FONTLIBS) $(SYSLIBS) $(LIBDL) $(LIBREGEX) #endif XF86SERVEROBJS = $(XF86DRVOBJS) $(XF86IDRVOBJS) XF86SERVERLIBS = $(XF86DRVLIBS) $(XF86IDRVLIBS) $(XF86LIBS) $(XF86LOADERLIB) \ - $(XF86COMLIB) $(XF86MAINLIBS) $(XF86SCANLIB) $(XF86OSLIB) + $(XF86COMLIB) $(XF86MAINLIBS) $(XF86SCANLIB) $(XF86OSLIB) \ + $(XF86DDCLIB) #if HasParallelMake MakeMutex($(XF86SERVERSUBDIRS) $(XF86SERVERLIBS) $(XF86SERVERSYSLIBS)) #endif @@ -728,6 +729,31 @@ $(SAVAGEOBJS) $(XSAVAGE) $(SAVAGELIBS) $(SAVAGESYSLIBS):: $(SAVAGEDIRS) ServerTarget(Xsavage,$(SAVAGEDIRS),$(SAVAGEOBJS),$(SAVAGELIBS),$(SAVAGESYSLIBS)) #endif /* XSAVAGEServer */ +#if XIgsServer +XCOMM +XCOMM server with Keith's S3 Igs driver +XCOMM + + IGSDIR = $(KDRIVE)/igs + IGS = $(IGSDIR)/LibraryTargetName(igs) + + KDDIRS = StdKdDirs + + IGSDIRS = $(STDDIRS) $(KDDIRS) $(IGSDIR) + + IGSLIBS = PreFbLibs $(IGS) KdLibs FbPostFbLibs + IGSSYSLIBS = StdKdSysLibs + +#if HasParallelMake +MakeMutex($(IGSDIRS) $(IGSOBJS) $(IGSLIBS) $(IGSSYSLIBS)) +#endif +#if ForceServerRemake +$(IGSOBJS) $(XIGS) $(IGSLIBS) $(IGSSYSLIBS):: $(IGSDIRS) + @if [ -f $@ ]; then touch $@; fi +#endif +ServerTarget(Xigs,$(IGSDIRS),$(IGSOBJS),$(IGSLIBS),$(IGSSYSLIBS)) +#endif /* XIGSServer */ + #if XTridentServer XCOMM XCOMM server with Keith's TRIDENT Cyber9525 driver @@ -861,7 +887,7 @@ ServerTarget(Xitsy,$(ITSYDIRS),$(ITSYOBJS),$(ITSYLIBS),$(ITSYSYSLIBS)) #endif /* XItsyServer */ KDRIVEDIRS=$(KDDIRS) $(FBDEVDIR) $(SAVAGEDIR) $(TRIDENTDIR) $(SIS530DIR) \ - $(TRIODIR) $(TS300DIR) $(ITSYDIR) + $(TRIODIR) $(TS300DIR) $(ITSYDIR) $(IGSDIR) #if XprtServer && !MakeDllModules XCOMM diff --git a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c index 06da5fb96..eaa65e949 100644 --- a/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c +++ b/xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c @@ -42,11 +42,10 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c,v 3.6 1998/10/04 09:34:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/PEX5/ddpex/mi/level2/miNSurf.c,v 3.7 2000/04/05 18:13:28 dawes Exp $ */ #define TRIMING 1 -#include <math.h> #include "mipex.h" #include "misc.h" #include "miscstruct.h" @@ -58,6 +57,11 @@ SOFTWARE. #include "miNurbs.h" #include "pexos.h" +#if !defined(IN_MODULE) /* hv: not a module header file */ +#include <math.h> +#else +#include <xf86_ansic.h> +#endif static ddpex3rtn build_surf_reps(); static int add_grid(); diff --git a/xc/programs/Xserver/Xext/Imakefile b/xc/programs/Xserver/Xext/Imakefile index 5f6c0ef08..b53229a18 100644 --- a/xc/programs/Xserver/Xext/Imakefile +++ b/xc/programs/Xserver/Xext/Imakefile @@ -1,5 +1,5 @@ XCOMM $TOG: Imakefile /main/63 1997/11/24 16:48:40 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.32 2000/02/13 06:15:30 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/Xext/Imakefile,v 3.33 2000/06/15 20:49:59 dawes Exp $ #include <Server.tmpl> @@ -117,7 +117,10 @@ XF86BIGFOBJS = xf86bigfont.o xtest.o xtest1di.o xtest1dd.o sleepuntil.o $(PNRXOBJS) \ $(XF86BIGFOBJS) +#ifdef XFree86Version +/* XXX Check if this can be eliminated */ XF86INCLUDES = -I$(XF86COMSRC) +#endif INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ $(PNRXINCLUDES) $(XF86INCLUDES) -I$(FONTINCSRC) \ $(FONTCACHEINCLUDES) diff --git a/xc/programs/Xserver/Xext/dgaproc.h b/xc/programs/Xserver/Xext/dgaproc.h index dfd56461c..2b0118f15 100644 --- a/xc/programs/Xserver/Xext/dgaproc.h +++ b/xc/programs/Xserver/Xext/dgaproc.h @@ -1,8 +1,10 @@ -/* $XFree86: xc/programs/Xserver/Xext/dgaproc.h,v 1.19 1999/10/13 22:32:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/dgaproc.h,v 1.21 2000/06/30 19:06:54 keithp Exp $ */ #ifndef __DGAPROC_H #define __DGAPROC_H +#include "Xproto.h" +#include "pixmap.h" #define DGA_CONCURRENT_ACCESS 0x00000001 #define DGA_FILL_RECT 0x00000002 @@ -58,36 +60,43 @@ void XFree86DGAExtensionInit(void); int DGASetMode( - int index, + int Index, int num, XDGAModePtr mode, PixmapPtr *pPix ); +void +DGASetInputMode( + int Index, + Bool keyboard, + Bool mouse +); + void DGASelectInput( - int index, + int Index, ClientPtr client, long mask ); -Bool DGAAvailable(int index); -Bool DGAActive(int index); +Bool DGAAvailable(int Index); +Bool DGAActive(int Index); void DGAShutdown(void); void DGAInstallCmap(ColormapPtr cmap); -int DGAGetViewportStatus(int index); -int DGASync(int index); +int DGAGetViewportStatus(int Index); +int DGASync(int Index); int DGAFillRect( - int index, + int Index, int x, int y, int w, int h, unsigned long color ); int DGABlitRect( - int index, + int Index, int srcx, int srcy, int w, int h, int dstx, int dsty @@ -95,7 +104,7 @@ DGABlitRect( int DGABlitTransRect( - int index, + int Index, int srcx, int srcy, int w, int h, int dstx, int dsty, @@ -104,28 +113,28 @@ DGABlitTransRect( int DGASetViewport( - int index, + int Index, int x, int y, int mode ); -int DGAGetModes(int index); -int DGAGetOldDGAMode(int index); +int DGAGetModes(int Index); +int DGAGetOldDGAMode(int Index); -int DGAGetModeInfo(int index, XDGAModePtr mode, int num); +int DGAGetModeInfo(int Index, XDGAModePtr mode, int num); Bool DGAVTSwitch(void); -Bool DGAStealMouseEvent(int index, xEvent *e, int dx, int dy); -Bool DGAStealKeyEvent(int index, xEvent *e); +Bool DGAStealMouseEvent(int Index, xEvent *e, int dx, int dy); +Bool DGAStealKeyEvent(int Index, xEvent *e); Bool DGAIsDgaEvent (xEvent *e); Bool DGADeliverEvent (ScreenPtr pScreen, xEvent *e); -Bool DGAOpenFramebuffer(int index, char **name, unsigned char **mem, +Bool DGAOpenFramebuffer(int Index, char **name, unsigned char **mem, int *size, int *offset, int *flags); -void DGACloseFramebuffer(int index); -Bool DGAChangePixmapMode(int index, int *x, int *y, int mode); -int DGACreateColormap(int index, ClientPtr client, int id, int mode, +void DGACloseFramebuffer(int Index); +Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode); +int DGACreateColormap(int Index, ClientPtr client, int id, int mode, int alloc); extern unsigned char DGAReqCode; diff --git a/xc/programs/Xserver/Xext/panoramiX.c b/xc/programs/Xserver/Xext/panoramiX.c index 35456cd4b..c4c2e447f 100644 --- a/xc/programs/Xserver/Xext/panoramiX.c +++ b/xc/programs/Xserver/Xext/panoramiX.c @@ -19,12 +19,13 @@ * or in FAR 52.227-19, as applicable. * * * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/Xext/panoramiX.c,v 3.17 2000/03/03 22:17:37 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/panoramiX.c,v 3.22 2000/05/25 21:12:30 mvojkovi Exp $ */ #define NEED_REPLIES #include <stdio.h> #include "X.h" #include "Xproto.h" +#include "Xarch.h" #include "misc.h" #include "cursor.h" #include "cursorstr.h" @@ -102,7 +103,7 @@ int PanoramiXChangeSaveSet(), PanoramiXReparentWindow(); int PanoramiXMapWindow(), PanoramiXMapSubwindows(); int PanoramiXUnmapWindow(), PanoramiXUnmapSubwindows(); int PanoramiXConfigureWindow(), PanoramiXCirculateWindow(); -int PanoramiXGetGeometry(); +int PanoramiXGetGeometry(), PanoramiXTranslateCoords(); int PanoramiXCreatePixmap(), PanoramiXFreePixmap(); int PanoramiXCreateGC(), PanoramiXChangeGC(); int PanoramiXCopyGC(), PanoramiXCopyColormapAndFree(); @@ -331,7 +332,7 @@ XineramaDestroyClip(GCPtr pGC) -static int +int XineramaDeleteResource(pointer data, XID id) { xfree(data); @@ -571,6 +572,7 @@ void PanoramiXExtensionInit(int argc, char *argv[]) ProcVector[X_ConfigureWindow] = PanoramiXConfigureWindow; ProcVector[X_CirculateWindow] = PanoramiXCirculateWindow; ProcVector[X_GetGeometry] = PanoramiXGetGeometry; + ProcVector[X_TranslateCoords] = PanoramiXTranslateCoords; ProcVector[X_CreatePixmap] = PanoramiXCreatePixmap; ProcVector[X_FreePixmap] = PanoramiXFreePixmap; ProcVector[X_CreateGC] = PanoramiXCreateGC; @@ -840,6 +842,7 @@ void PanoramiXConsolidate(void) for (i = 0; i < PanoramiXNumScreens; i++) { root->info[i].id = WindowTable[i]->drawable.id; + root->u.win.class = InputOutput; defmap->info[i].id = (screenInfo.screens[i])->defColormap; } @@ -1058,10 +1061,13 @@ ProcPanoramiXDispatch (ClientPtr client) } - +#if X_BYTE_ORDER == X_LITTLE_ENDIAN #define SHIFT_L(v,s) (v) << (s) #define SHIFT_R(v,s) (v) >> (s) - +#else +#define SHIFT_L(v,s) (v) >> (s) +#define SHIFT_R(v,s) (v) << (s) +#endif static void CopyBits(char *dst, int shiftL, char *src, int bytes) @@ -1202,7 +1208,7 @@ XineramaGetImageData( } } } else { - j = pDraw->bitsPerPixel >> 3; + j = BitsPerPixel(depth) >> 3; x = (pbox->x1 - SrcBox.x1) * j; y = pbox->y1 - SrcBox.y1; w *= j; diff --git a/xc/programs/Xserver/Xext/panoramiXprocs.c b/xc/programs/Xserver/Xext/panoramiXprocs.c index 48e962d89..414d895c8 100644 --- a/xc/programs/Xserver/Xext/panoramiXprocs.c +++ b/xc/programs/Xserver/Xext/panoramiXprocs.c @@ -22,7 +22,7 @@ /* Massively rewritten by Mark Vojkovich <markv@valinux.com> */ -/* $XFree86: xc/programs/Xserver/Xext/panoramiXprocs.c,v 3.22 2000/02/27 23:15:30 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/panoramiXprocs.c,v 3.27 2000/04/08 19:18:54 mvojkovi Exp $ */ #include <stdio.h> #include "X.h" @@ -494,7 +494,9 @@ int PanoramiXConfigureWindow(ClientPtr client) } } - FOR_NSCREENS_BACKWARD(j) { + /* have to go forward or you get expose events before + ConfigureNotify events */ + FOR_NSCREENS_FORWARD(j) { stuff->window = win->info[j].id; if(sib) *((CARD32 *) &stuff[1] + sib_offset) = sib->info[j].id; @@ -543,33 +545,104 @@ int PanoramiXGetGeometry(ClientPtr client) rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; - rep.root = WindowTable[pDraw->pScreen->myNum]->drawable.id; + rep.root = WindowTable[0]->drawable.id; rep.depth = pDraw->depth; + rep.width = pDraw->width; + rep.height = pDraw->height; + rep.x = rep.y = rep.borderWidth = 0; - if (stuff->id == WindowTable[0]->drawable.id) { + if (stuff->id == rep.root) { xWindowRoot *root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart); rep.width = root->pixWidth; rep.height = root->pixHeight; - } else { - rep.width = pDraw->width; - rep.height = pDraw->height; - } - - if ((pDraw->type == UNDRAWABLE_WINDOW) || - ((pDraw->type == DRAWABLE_WINDOW) && (stuff->id == pDraw->id))) { + } else + if ((pDraw->type == UNDRAWABLE_WINDOW) || (pDraw->type == DRAWABLE_WINDOW)) + { WindowPtr pWin = (WindowPtr)pDraw; rep.x = pWin->origin.x - wBorderWidth (pWin); rep.y = pWin->origin.y - wBorderWidth (pWin); + if(pWin->parent == WindowTable[0]) { + rep.x += panoramiXdataPtr[0].x; + rep.y += panoramiXdataPtr[0].y; + } rep.borderWidth = pWin->borderWidth; - } else { /* DRAWABLE_PIXMAP or DRAWABLE_BUFFER */ - rep.x = rep.y = rep.borderWidth = 0; } + WriteReplyToClient(client, sizeof(xGetGeometryReply), &rep); return (client->noClientException); } +int PanoramiXTranslateCoords(ClientPtr client) +{ + INT16 x, y; + REQUEST(xTranslateCoordsReq); + + register WindowPtr pWin, pDst; + xTranslateCoordsReply rep; + + REQUEST_SIZE_MATCH(xTranslateCoordsReq); + pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, + SecurityReadAccess); + if (!pWin) + return(BadWindow); + pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, + SecurityReadAccess); + if (!pDst) + return(BadWindow); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.sameScreen = xTrue; + rep.child = None; + + if(pWin == WindowTable[0]) { + x = stuff->srcX - panoramiXdataPtr[0].x; + y = stuff->srcY - panoramiXdataPtr[0].y; + } else { + x = pWin->drawable.x + stuff->srcX; + y = pWin->drawable.y + stuff->srcY; + } + pWin = pDst->firstChild; + while (pWin) { +#ifdef SHAPE + BoxRec box; +#endif + if ((pWin->mapped) && + (x >= pWin->drawable.x - wBorderWidth (pWin)) && + (x < pWin->drawable.x + (int)pWin->drawable.width + + wBorderWidth (pWin)) && + (y >= pWin->drawable.y - wBorderWidth (pWin)) && + (y < pWin->drawable.y + (int)pWin->drawable.height + + wBorderWidth (pWin)) +#ifdef SHAPE + /* When a window is shaped, a further check + * is made to see if the point is inside + * borderSize + */ + && (!wBoundingShape(pWin) || + POINT_IN_REGION(pWin->drawable.pScreen, + &pWin->borderSize, x, y, &box)) +#endif + ) + { + rep.child = pWin->drawable.id; + pWin = (WindowPtr) NULL; + } + else + pWin = pWin->nextSib; + } + rep.dstX = x - pDst->drawable.x; + rep.dstY = y - pDst->drawable.y; + if(pDst == WindowTable[0]) { + rep.dstX += panoramiXdataPtr[0].x; + rep.dstY += panoramiXdataPtr[0].y; + } + + WriteReplyToClient(client, sizeof(xTranslateCoordsReply), &rep); + return(client->noClientException); +} int PanoramiXCreatePixmap(ClientPtr client) { @@ -961,8 +1034,8 @@ int PanoramiXCopyArea(ClientPtr client) FOR_NSCREENS(j) VERIFY_DRAWABLE(drawables[j], src->info[j].id, client); - pitch = PixmapBytePad(stuff->width, drawables[0]->depth); - if(!(data = xcalloc(stuff->height, pitch))) + pitch = PixmapBytePad(stuff->width, drawables[0]->depth); + if(!(data = xcalloc(1, stuff->height * pitch))) return BadAlloc; XineramaGetImageData(drawables, srcx, srcy, @@ -972,15 +1045,17 @@ int PanoramiXCopyArea(ClientPtr client) FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, pGC, client); - + + if(drawables[0]->depth != pDst->depth) { + client->errorValue = stuff->dstDrawable; + xfree(data); + return (BadMatch); + } + (*pGC->ops->PutImage) (pDst, pGC, pDst->depth, dstx, dsty, stuff->width, stuff->height, 0, ZPixmap, data); - if(pGC->graphicsExposures) { - /* Ugh */ - } - if(dstShared) break; } @@ -1695,9 +1770,6 @@ int PanoramiXGetImage(ClientPtr client) Mask plane, planemask; int linesDone, nlines, linesPerBuf; long widthBytesLine, length; -#ifdef INTERNAL_VS_EXTERNAL_PADDING - long widthBytesLineProto, lengthProto; -#endif REQUEST(xGetImageReq); @@ -1761,10 +1833,7 @@ int PanoramiXGetImage(ClientPtr client) widthBytesLine = PixmapBytePad(w, pDraw->depth); length = widthBytesLine * h; -#ifdef INTERNAL_VS_EXTERNAL_PADDING - widthBytesLineProto = PixmapBytePadProto(w, pDraw->depth); - lengthProto = widthBytesLineProto * h; -#endif + } else { widthBytesLine = BitmapBytePad(w); plane = ((Mask)1) << (pDraw->depth - 1); @@ -1772,18 +1841,9 @@ int PanoramiXGetImage(ClientPtr client) length = widthBytesLine * h * Ones(planemask & (plane | (plane - 1))); -#ifdef INTERNAL_VS_EXTERNAL_PADDING - widthBytesLineProto = BitmapBytePadProto(w); - lengthProto = (length / widthBytesLine) * widthBytesLineProto; -#endif } -#ifdef INTERNAL_VS_EXTERNAL_PADDING - xgi.length = (lengthProto + 3) >> 2; -#else xgi.length = (length + 3) >> 2; -#endif - if (widthBytesLine == 0 || h == 0) linesPerBuf = 0; @@ -1814,14 +1874,6 @@ int PanoramiXGetImage(ClientPtr client) XineramaGetImageData(drawables, x, y + linesDone, w, nlines, format, planemask, pBuf, widthBytesLine, isRoot); -#ifdef INTERNAL_VS_EXTERNAL_PADDING - if ( widthBytesLine != widthBytesLineProto ) { - char *linePtr = pBuf; - for(i = 0; i < nlines; i++, linePtr += widthBytesLine) { - (void)WriteToClient(client, widthBytesLineProto, linePtr); - } - } else -#endif (void)WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); @@ -1840,15 +1892,7 @@ int PanoramiXGetImage(ClientPtr client) nlines, format, plane, pBuf, widthBytesLine, isRoot); -#ifdef INTERNAL_VS_EXTERNAL_PADDING - if ( widthBytesLine != widthBytesLineProto ) { - char *linePtr = pBuf; - for(i = 0; i < nlines; i++, linePtr += widthBytesLine) { - (void)WriteToClient(client, widthBytesLineProto, linePtr); - } - } else -#endif - (void)WriteToClient(client, + (void)WriteToClient(client, (int)(nlines * widthBytesLine), pBuf); diff --git a/xc/programs/Xserver/Xext/panoramiXsrv.h b/xc/programs/Xserver/Xext/panoramiXsrv.h index c12986093..afdc4055f 100644 --- a/xc/programs/Xserver/Xext/panoramiXsrv.h +++ b/xc/programs/Xserver/Xext/panoramiXsrv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.5 2000/03/03 22:17:37 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/panoramiXsrv.h,v 1.6 2000/03/30 18:20:35 mvojkovi Exp $ */ #ifndef _PANORAMIXSRV_H_ #define _PANORAMIXSRV_H_ @@ -16,6 +16,7 @@ extern PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE, XID, int); extern PanoramiXRes * PanoramiXFindIDOnAnyScreen(RESTYPE, XID); extern WindowPtr PanoramiXChangeWindow(int, WindowPtr); extern Bool XineramaRegisterConnectionBlockCallback(void (*func)(void)); +extern int XineramaDeleteResource(pointer, XID); extern RegionRec XineramaScreenRegions[MAXSCREENS]; diff --git a/xc/programs/Xserver/Xext/saver.c b/xc/programs/Xserver/Xext/saver.c index 0539cd700..6b862cd66 100644 --- a/xc/programs/Xserver/Xext/saver.c +++ b/xc/programs/Xserver/Xext/saver.c @@ -1,6 +1,6 @@ /* * $XConsortium: saver.c,v 1.12 94/04/17 20:59:36 dpw Exp $ - * $XFree86: xc/programs/Xserver/Xext/saver.c,v 3.2 1996/06/10 09:11:17 dawes Exp $ + * $XFree86: xc/programs/Xserver/Xext/saver.c,v 3.3 2000/04/05 18:13:29 dawes Exp $ * Copyright (c) 1992 X Consortium @@ -30,7 +30,6 @@ in this Software without prior written authorization from the X Consortium. #define NEED_REPLIES #define NEED_EVENTS -#include <stdio.h> #include "X.h" #include "Xproto.h" #include "misc.h" @@ -47,6 +46,12 @@ in this Software without prior written authorization from the X Consortium. #include "cursorstr.h" #include "colormapst.h" +#ifdef IN_MODULE +#include <xf86_ansic.h> +#else +#include <stdio.h> +#endif + static unsigned char ScreenSaverReqCode = 0; static int ScreenSaverEventBase = 0; diff --git a/xc/programs/Xserver/Xext/shm.c b/xc/programs/Xserver/Xext/shm.c index 8352f2ccb..b8ec5e074 100644 --- a/xc/programs/Xserver/Xext/shm.c +++ b/xc/programs/Xserver/Xext/shm.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.21 2000/03/05 16:59:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/shm.c,v 3.26 2000/04/27 16:26:44 eich Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -92,6 +92,8 @@ static void SShmCompletionEvent( #endif ); +static Bool ShmDestroyPixmap (PixmapPtr pPixmap); + static DISPATCH_PROC(ProcShmAttach); static DISPATCH_PROC(ProcShmCreatePixmap); static DISPATCH_PROC(ProcShmDetach); @@ -112,12 +114,16 @@ static DISPATCH_PROC(SProcShmQueryVersion); static unsigned char ShmReqCode; int ShmCompletionCode; int BadShmSegCode; -RESTYPE ShmSegType, ShmPixType; +RESTYPE ShmSegType; static ShmDescPtr Shmsegs; static Bool sharedPixmaps; static int pixmapFormat; static int shmPixFormat[MAXSCREENS]; static ShmFuncsPtr shmFuncs[MAXSCREENS]; +static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS]; +#ifdef PIXPRIV +static int shmPixmapPrivate; +#endif static ShmFuncs miFuncs = {NULL, miShmPutImage}; static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage}; @@ -200,7 +206,6 @@ ShmExtensionInit() sharedPixmaps = xFalse; pixmapFormat = 0; -#ifndef INTERNAL_VS_EXTERNAL_PADDING { sharedPixmaps = xTrue; pixmapFormat = shmPixFormat[0]; @@ -218,11 +223,26 @@ ShmExtensionInit() } if (!pixmapFormat) pixmapFormat = ZPixmap; - } + if (sharedPixmaps) + { + for (i = 0; i < screenInfo.numScreens; i++) + { + destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap; + screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap; + } +#ifdef PIXPRIV + shmPixmapPrivate = AllocatePixmapPrivateIndex(); + for (i = 0; i < screenInfo.numScreens; i++) + { + if (!AllocatePixmapPrivate(screenInfo.screens[i], + shmPixmapPrivate, 0)) + return; + } #endif + } + } ShmSegType = CreateNewResourceType(ShmDetachSegment); - ShmPixType = CreateNewResourceType(ShmDetachSegment); - if (ShmSegType && ShmPixType && + if (ShmSegType && (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, ProcShmDispatch, SProcShmDispatch, ShmResetProc, StandardMinorOpcode))) @@ -264,6 +284,41 @@ ShmSetPixmapFormat(pScreen, format) shmPixFormat[pScreen->myNum] = format; } +static Bool +ShmDestroyPixmap (PixmapPtr pPixmap) +{ + ScreenPtr pScreen = pPixmap->drawable.pScreen; + Bool ret; + if (pPixmap->refcnt == 1) + { + ShmDescPtr shmdesc; +#ifdef PIXPRIV + shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr; +#else + char *base = (char *) pPixmap->devPrivate.ptr; + + if (base != (pointer) (pPixmap + 1)) + { + for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next) + { + if (shmdesc->addr <= base && base <= shmdesc->addr + shmdesc->size) + break; + } + } + else + shmdesc = 0; +#endif + if (shmdesc) + ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id); + } + + pScreen->DestroyPixmap = destroyPixmap[pScreen->myNum]; + ret = (*pScreen->DestroyPixmap) (pPixmap); + destroyPixmap[pScreen->myNum] = pScreen->DestroyPixmap; + pScreen->DestroyPixmap = ShmDestroyPixmap; + return ret; +} + void ShmRegisterFbFuncs(pScreen) ScreenPtr pScreen; @@ -497,13 +552,6 @@ ProcPanoramiXShmGetImage(ClientPtr client) Mask plane, planemask; long lenPer, length, widthBytesLine; Bool isRoot; -#ifdef INTERNAL_VS_EXTERNAL_PADDING - long widthBytesLineProto; - long lenPerProto,lengthProto; - char *tmpImage; - int tmpAlloced = 0; -#endif - REQUEST(xShmGetImageReq); @@ -567,106 +615,30 @@ ProcPanoramiXShmGetImage(ClientPtr client) if(format == ZPixmap) { widthBytesLine = PixmapBytePad(w, pDraw->depth); length = widthBytesLine * h; -#ifdef INTERNAL_VS_EXTERNAL_PADDING - widthBytesLineProto = PixmapBytePadProto(w, pDraw->depth); - lengthProto = widthBytesLineProto * h; -#endif } else { widthBytesLine = PixmapBytePad(w, 1); lenPer = widthBytesLine * h; plane = ((Mask)1) << (pDraw->depth - 1); length = lenPer * Ones(planemask & (plane | (plane - 1))); -#ifdef INTERNAL_VS_EXTERNAL_PADDING - widthBytesLineProto = PixmapBytePadProto(w, 1); - lenPerProto = widthBytesLineProto * h; - lengthProto = (length / lenPer) * lenPerProto; -#endif } -#ifdef INTERNAL_VS_EXTERNAL_PADDING - VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto, client); - xgi.size = lengthProto; -#else VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); xgi.size = length; -#endif if (length == 0) {/* nothing to do */ } else if (format == ZPixmap) { -#ifdef INTERNAL_VS_EXTERNAL_PADDING - /* check for protocol/server padding differences. - */ - if ((widthBytesLine != widthBytesLineProto) || - ((unsigned long)shmdesc->addr + stuff->offset & (sizeof(long)-1))) - { - /* temp stuff for 64 bit alignment stuff */ - char * bufPtr, * protoPtr; - int i; - - if(!(tmpImage = (char *) xalloc(length))) - return (BadAlloc); - tmpAlloced = 1; - - XineramaGetImageData(drawables, x, y, w, h, format, planemask, - tmpImage, widthBytesLine, isRoot); - - - /* for 64-bit server, convert image to pad to 32 bits */ - bzero(shmdesc->addr + stuff->offset,lengthProto); - - for (i=0,bufPtr=tmpImage,protoPtr=shmdesc->addr + stuff->offset; - i < h; - bufPtr += widthBytesLine,protoPtr += widthBytesLineProto, - i++) - memmove(protoPtr,bufPtr,widthBytesLineProto); - } else -#endif XineramaGetImageData(drawables, x, y, w, h, format, planemask, shmdesc->addr + stuff->offset, widthBytesLine, isRoot); } else { -#ifdef INTERNAL_VS_EXTERNAL_PADDING - /* check for protocol/server padding differences. - */ - if ((widthBytesLine != widthBytesLineProto) || - ((unsigned long)shmdesc->addr + stuff->offset & - (sizeof(long)-1))) - { - if(!(tmpImage = (char *) xalloc(length))) - return (BadAlloc); - tmpAlloced = 1; - } -#endif length = stuff->offset; for (; plane; plane >>= 1) { if (planemask & plane) { -#ifdef INTERNAL_VS_EXTERNAL_PADDING - if ((widthBytesLine != widthBytesLineProto) || - ((unsigned long)shmdesc->addr + stuff->offset & - (sizeof(long)-1))) - { - /* get image for each plane. */ - - XineramaGetImageData(drawables, x, y, w, h, - format, plane, tmpImage, - widthBytesLine, isRoot); - - - /* for 64-bit server, convert image to pad to 32 bits */ - bzero(shmdesc->addr+length, widthBytesLine); - memmove(shmdesc->addr+length, tmpImage, - widthBytesLineProto); - /* increment length */ - length += lenPerProto; - } else /* no diff between protocol and server */ -#endif - { - XineramaGetImageData(drawables, x, y, w, h, - format, plane, shmdesc->addr + length, - widthBytesLine, isRoot); - length += lenPer; - } + XineramaGetImageData(drawables, x, y, w, h, + format, plane, shmdesc->addr + length, + widthBytesLine, isRoot); + length += lenPer; } } } @@ -680,11 +652,6 @@ ProcPanoramiXShmGetImage(ClientPtr client) } WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi); -#ifdef INTERNAL_VS_EXTERNAL_PADDING - if (tmpAlloced) - xfree(tmpImage); -#endif - return(client->noClientException); } @@ -746,6 +713,10 @@ CreatePmap: shmdesc->addr + stuff->offset); if (pMap) { +#ifdef PIXPRIV + pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc; +#endif + shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = newPix->info[j].id; if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) { @@ -765,11 +736,8 @@ CreatePmap: FreeResource(newPix->info[j].id, RT_NONE); } xfree(newPix); - } else { - shmdesc->refcnt++; - AddResource(stuff->pid, ShmPixType, shmdesc); + } else AddResource(stuff->pid, XRT_PIXMAP, newPix); - } return result; } @@ -783,11 +751,6 @@ ProcShmPutImage(client) register GCPtr pGC; register DrawablePtr pDraw; long length; -#ifdef INTERNAL_VS_EXTERNAL_PADDING - long lengthProto; - char *tmpImage; - int tmpAlloced = 0; -#endif ShmDescPtr shmdesc; REQUEST(xShmPutImageReq); @@ -801,9 +764,6 @@ ProcShmPutImage(client) if (stuff->depth != 1) return BadMatch; length = PixmapBytePad(stuff->totalWidth, 1); -#ifdef INTERNAL_VS_EXTERNAL_PADDING - lengthProto = PixmapBytePadProto(stuff->totalWidth, 1); -#endif } else if (stuff->format == XYPixmap) { @@ -811,19 +771,12 @@ ProcShmPutImage(client) return BadMatch; length = PixmapBytePad(stuff->totalWidth, 1); length *= stuff->depth; -#ifdef INTERNAL_VS_EXTERNAL_PADDING - lengthProto = PixmapBytePadProto(stuff->totalWidth, 1); - lengthProto *= stuff->depth; -#endif } else if (stuff->format == ZPixmap) { if (pDraw->depth != stuff->depth) return BadMatch; length = PixmapBytePad(stuff->totalWidth, stuff->depth); -#ifdef INTERNAL_VS_EXTERNAL_PADDING - lengthProto = PixmapBytePadProto(stuff->totalWidth, stuff->depth); -#endif } else { @@ -831,13 +784,8 @@ ProcShmPutImage(client) return BadValue; } -#ifdef INTERNAL_VS_EXTERNAL_PADDING - VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto * stuff->totalHeight, - client); -#else VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight, client); -#endif if (stuff->srcX > stuff->totalWidth) { client->errorValue = stuff->srcX; @@ -859,62 +807,6 @@ ProcShmPutImage(client) return BadValue; } -#ifdef INTERNAL_VS_EXTERNAL_PADDING - /* handle 64 bit case where protocol may pad to 32 and we want 64 - * In this case, length is what the server wants and lengthProto is - * what the protocol thinks it is. If the the two are different, - * copy the protocol version (i.e. the memory shared between the - * server and the client) to a version with a scanline pad of 64. - */ - if (length != lengthProto) - { - register int i; - char * stuffptr, /* pointer into protocol data */ - * tmpptr; /* new location to copy to */ - - if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight))) - return (BadAlloc); - tmpAlloced = 1; - - bzero(tmpImage,length*stuff->totalHeight); - - if (stuff->format == XYPixmap) - { - int lineBytes = PixmapBytePad(stuff->totalWidth, 1); - int lineBytesProto = PixmapBytePadProto(stuff->totalWidth, 1); - int depth = stuff->depth; - - stuffptr = shmdesc->addr + stuff->offset ; - tmpptr = tmpImage; - for (i = 0; i < stuff->totalHeight*stuff->depth; - stuffptr += lineBytesProto,tmpptr += lineBytes, i++) - memmove(tmpptr,stuffptr,lineBytesProto); - } - else - { - for (i = 0, - stuffptr = shmdesc->addr + stuff->offset, - tmpptr=tmpImage; - i < stuff->totalHeight; - stuffptr += lengthProto,tmpptr += length, i++) - memmove(tmpptr,stuffptr,lengthProto); - } - } - /* handle 64-bit case where stuff is not 64-bit aligned - */ - else if ((unsigned long)(shmdesc->addr+stuff->offset) & - (sizeof(long)-1)) - { - if(!(tmpImage = (char *) ALLOCATE_LOCAL(length*stuff->totalHeight))) - return (BadAlloc); - tmpAlloced = 1; - memmove(tmpImage,(char *)(shmdesc->addr+stuff->offset), - length*stuff->totalHeight); - } - else - tmpImage = (char *)(shmdesc->addr+stuff->offset); -#endif - if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) || ((stuff->format != ZPixmap) && (stuff->srcX < screenInfo.bitmapScanlinePad) && @@ -926,11 +818,7 @@ ProcShmPutImage(client) stuff->dstX, stuff->dstY, stuff->totalWidth, stuff->srcHeight, stuff->srcX, stuff->format, -#ifdef INTERNAL_VS_EXTERNAL_PADDING - tmpImage + -#else shmdesc->addr + stuff->offset + -#endif (stuff->srcY * length)); else (*shmFuncs[pDraw->pScreen->myNum]->PutImage)( @@ -939,12 +827,7 @@ ProcShmPutImage(client) stuff->srcX, stuff->srcY, stuff->srcWidth, stuff->srcHeight, stuff->dstX, stuff->dstY, -#ifdef INTERNAL_VS_EXTERNAL_PADDING - tmpImage); - -#else shmdesc->addr + stuff->offset); -#endif if (stuff->sendEvent) { @@ -960,12 +843,7 @@ ProcShmPutImage(client) WriteEventsToClient(client, 1, (xEvent *) &ev); } -#ifdef INTERNAL_VS_EXTERNAL_PADDING - if (tmpAlloced) - DEALLOCATE_LOCAL(tmpImage); -#endif - - return (client->noClientException); + return (client->noClientException); } @@ -980,12 +858,6 @@ ProcShmGetImage(client) xShmGetImageReply xgi; ShmDescPtr shmdesc; int n; -#ifdef INTERNAL_VS_EXTERNAL_PADDING - long widthBytesLine,widthBytesLineProto; - long lenPerProto,lengthProto; - char *tmpImage; - int tmpAlloced = 0; -#endif REQUEST(xShmGetImageReq); @@ -1033,43 +905,18 @@ ProcShmGetImage(client) xgi.depth = pDraw->depth; if(stuff->format == ZPixmap) { -#ifdef INTERNAL_VS_EXTERNAL_PADDING - widthBytesLine = PixmapBytePad(stuff->width, pDraw->depth); - length = widthBytesLine * stuff->height; - widthBytesLineProto = PixmapBytePadProto(stuff->width, pDraw->depth); - lengthProto = widthBytesLineProto * stuff->height; -#else length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; -#endif } else { -#ifdef INTERNAL_VS_EXTERNAL_PADDING - widthBytesLine = PixmapBytePad(stuff->width, 1); - lenPer = widthBytesLine * stuff->height; - plane = ((Mask)1) << (pDraw->depth - 1); - /* only planes asked for */ - length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); - - widthBytesLineProto = PixmapBytePadProto(stuff->width, 1); - lenPerProto = widthBytesLineProto * stuff->height; - lengthProto = lenPerProto * Ones(stuff->planeMask & - (plane | (plane - 1))); -#else lenPer = PixmapBytePad(stuff->width, 1) * stuff->height; plane = ((Mask)1) << (pDraw->depth - 1); /* only planes asked for */ length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); -#endif } -#ifdef INTERNAL_VS_EXTERNAL_PADDING - VERIFY_SHMSIZE(shmdesc, stuff->offset, lengthProto, client); - xgi.size = lengthProto; -#else VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); xgi.size = length; -#endif if (length == 0) { @@ -1077,105 +924,25 @@ ProcShmGetImage(client) } else if (stuff->format == ZPixmap) { -#ifdef INTERNAL_VS_EXTERNAL_PADDING - /* check for protocol/server padding differences. - */ - if ((widthBytesLine != widthBytesLineProto) || - ((unsigned long)shmdesc->addr + stuff->offset & (sizeof(long)-1))) - { - /* temp stuff for 64 bit alignment stuff */ - register char * bufPtr, * protoPtr; - register int i; - - if(!(tmpImage = (char *) ALLOCATE_LOCAL(length))) - return (BadAlloc); - tmpAlloced = 1; - - (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, - stuff->width, stuff->height, - stuff->format, stuff->planeMask, - tmpImage); - - /* for 64-bit server, convert image to pad to 32 bits - */ - bzero(shmdesc->addr + stuff->offset,lengthProto); - - for (i=0,bufPtr=tmpImage,protoPtr=shmdesc->addr + stuff->offset; - i < stuff->height; - bufPtr += widthBytesLine,protoPtr += widthBytesLineProto, - i++) - memmove(protoPtr,bufPtr,widthBytesLineProto); - } - else - { - (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, - stuff->width, stuff->height, - stuff->format, stuff->planeMask, - shmdesc->addr + stuff->offset); - } -#else (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, stuff->planeMask, shmdesc->addr + stuff->offset); -#endif } else { -#ifdef INTERNAL_VS_EXTERNAL_PADDING - /* check for protocol/server padding differences. - */ - if ((widthBytesLine != widthBytesLineProto) || - ((unsigned long)shmdesc->addr + stuff->offset & - (sizeof(long)-1))) - { - if(!(tmpImage = (char *) ALLOCATE_LOCAL(length))) - return (BadAlloc); - tmpAlloced = 1; - } -#endif length = stuff->offset; for (; plane; plane >>= 1) { if (stuff->planeMask & plane) { -#ifdef INTERNAL_VS_EXTERNAL_PADDING - if ((widthBytesLine != widthBytesLineProto) || - ((unsigned long)shmdesc->addr + stuff->offset & - (sizeof(long)-1))) - { - /* get image for each plane. - */ - (*pDraw->pScreen->GetImage)(pDraw, - stuff->x, stuff->y, - stuff->width, stuff->height, - stuff->format, plane, - tmpImage); - - /* for 64-bit server, convert image to pad to 32 bits */ - bzero(shmdesc->addr+length, widthBytesLine); - memmove(shmdesc->addr+length, tmpImage, widthBytesLineProto); - /* increment length */ - length += lenPerProto; - } - else /* no diff between protocol and server */ - { - (*pDraw->pScreen->GetImage)(pDraw, - stuff->x, stuff->y, - stuff->width, stuff->height, - stuff->format, plane, - shmdesc->addr + length); - length += lenPer; - } -#else (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, stuff->width, stuff->height, stuff->format, plane, shmdesc->addr + length); length += lenPer; -#endif } } } @@ -1188,11 +955,6 @@ ProcShmGetImage(client) } WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi); -#ifdef INTERNAL_VS_EXTERNAL_PADDING - if (tmpAlloced) - DEALLOCATE_LOCAL(tmpImage); -#endif - return(client->noClientException); } @@ -1260,14 +1022,15 @@ CreatePmap: shmdesc->addr + stuff->offset); if (pMap) { +#ifdef PIXPRIV + pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc; +#endif + shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap)) { - shmdesc->refcnt++; - if (AddResource(stuff->pid, ShmPixType, (pointer)shmdesc)) - return(client->noClientException); - FreeResource(stuff->pid, RT_NONE); + return(client->noClientException); } } return (BadAlloc); diff --git a/xc/programs/Xserver/Xext/xf86bigfont.c b/xc/programs/Xserver/Xext/xf86bigfont.c index 4669824c9..443fc8d24 100644 --- a/xc/programs/Xserver/Xext/xf86bigfont.c +++ b/xc/programs/Xserver/Xext/xf86bigfont.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86bigfont.c,v 1.5 2000/02/29 03:09:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86bigfont.c,v 1.9 2000/06/22 16:59:25 tsi Exp $ */ /* * BIGFONT extension for sharing font metrics between clients (if possible) * and for transmitting font metrics to clients in a compressed form. @@ -37,9 +37,6 @@ #include <sys/types.h> #ifdef HAS_SHM -#ifdef CSRG_BASED -#include <sys/param.h> -#endif #if defined(linux) && !defined(__GNU_LIBRARY__) /* Linux libc4 and libc5 only (because glibc doesn't include kernel headers): Linux 2.0.x and 2.2.x define SHMLBA as PAGE_SIZE, but forget to define @@ -57,6 +54,7 @@ #include <sys/shm.h> #include <sys/stat.h> #include <stdlib.h> +#include <unistd.h> #include <time.h> #include <errno.h> #endif @@ -165,7 +163,15 @@ XFree86BigfontExtensionInit() FontShmdescIndex = AllocateFontPrivateIndex(); +#if !defined(CSRG_BASED) pagesize = SHMLBA; +#else +# ifdef _SC_PAGESIZE + pagesize = sysconf(_SC_PAGESIZE); +# else + pagesize = getpagesize(); +# endif +#endif #endif } } @@ -204,6 +210,15 @@ shmalloc( return (ShmDescPtr) NULL; #endif + /* On some older Linux systems, the number of shared memory segments + system-wide is 127. In Linux 2.4, it is 4095. + Therefore there is a tradeoff to be made between allocating a + shared memory segment on one hand, and allocating memory and piping + the glyph metrics on the other hand. If the glyph metrics size is + small, we prefer the traditional way. */ + if (size < 3500) + return (ShmDescPtr) NULL; + pDesc = (ShmDescRec *) xalloc(sizeof(ShmDescRec)); if (!pDesc) return (ShmDescPtr) NULL; @@ -318,7 +333,11 @@ ProcXF86BigfontQueryVersion( reply.minorVersion = XF86BIGFONT_MINOR_VERSION; reply.uid = geteuid(); reply.gid = getegid(); +#ifdef HAS_SHM reply.signature = signature; +#else + reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */ +#endif reply.capabilities = #ifdef HAS_SHM (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0) diff --git a/xc/programs/Xserver/Xext/xf86dga.c b/xc/programs/Xserver/Xext/xf86dga.c index aa61e850a..9593c4a40 100644 --- a/xc/programs/Xserver/Xext/xf86dga.c +++ b/xc/programs/Xserver/Xext/xf86dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86dga.c,v 3.19 1999/08/01 07:56:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86dga.c,v 3.21 2000/06/30 19:06:54 keithp Exp $ */ /* @@ -100,6 +100,10 @@ ProcXF86DGADirectVideo(ClientPtr client) if(Success != DGASetMode(stuff->screen, num, &mode, &pix)) return (DGAErrorBase + XF86DGAScreenNotActive); + DGASetInputMode (stuff->screen, + (stuff->enable & XF86DGADirectKeyb) != 0, + (stuff->enable & XF86DGADirectMouse) != 0); + return (client->noClientException); } @@ -145,7 +149,16 @@ ProcXF86DGASetViewPort(ClientPtr client) REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq); if (!DGAActive(stuff->screen)) - return (DGAErrorBase + XF86DGADirectNotActivated); + { + int num; + PixmapPtr pix; + XDGAModeRec mode; + + if(!(num = DGAGetOldDGAMode(stuff->screen))) + return (DGAErrorBase + XF86DGANoDirectVideoMode); + if(Success != DGASetMode(stuff->screen, num, &mode, &pix)) + return (DGAErrorBase + XF86DGAScreenNotActive); + } if (DGASetViewport(stuff->screen, stuff->x, stuff->y, DGA_FLIP_RETRACE) != Success) diff --git a/xc/programs/Xserver/Xext/xf86dga2.c b/xc/programs/Xserver/Xext/xf86dga2.c index 2daa4166b..9ae96a63e 100644 --- a/xc/programs/Xserver/Xext/xf86dga2.c +++ b/xc/programs/Xserver/Xext/xf86dga2.c @@ -3,7 +3,7 @@ Written by Mark Vojkovich */ -/* $XFree86: xc/programs/Xserver/Xext/xf86dga2.c,v 1.14 1999/10/13 22:32:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86dga2.c,v 1.16 2000/06/30 19:06:54 keithp Exp $ */ #define NEED_REPLIES @@ -218,8 +218,12 @@ ProcXDGAQueryModes(ClientPtr client) rep.number = 0; rep.sequenceNumber = client->sequence; - if (!DGAAvailable(stuff->screen)) - return DGAErrorBase + XF86DGANoDirectVideoMode; + if (!DGAAvailable(stuff->screen)) { + rep.number = 0; + rep.length = 0; + WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep); + return (client->noClientException); + } if(!(num = DGAGetModes(stuff->screen))) { WriteToClient(client, sz_xXDGAQueryModesReply, (char*)&rep); @@ -665,6 +669,42 @@ SProcXDGADispatch (ClientPtr client) return DGAErrorBase + XF86DGAClientNotLocal; } +#if 0 +#define DGA_REQ_DEBUG +#endif + +#ifdef DGA_REQ_DEBUG +static char *dgaMinor[] = { + "QueryVersion", + "GetVideoLL", + "DirectVideo", + "GetViewPortSize", + "SetViewPort", + "GetVidPage", + "SetVidPage", + "InstallColormap", + "QueryDirectVideo", + "ViewPortChanged", + "10", + "11", + "QueryModes", + "SetMode", + "SetViewport", + "InstallColormap", + "SelectInput", + "FillRectangle", + "CopyArea", + "CopyTransparentArea", + "GetViewportStatus", + "Sync", + "OpenFramebuffer", + "CloseFramebuffer", + "SetClientVersion", + "ChangePixmapMode", + "CreateColormap", +}; +#endif + static int ProcXDGADispatch (ClientPtr client) { @@ -673,6 +713,11 @@ ProcXDGADispatch (ClientPtr client) if (!LocalClient(client)) return DGAErrorBase + XF86DGAClientNotLocal; +#ifdef DGA_REQ_DEBUG + if (stuff->data <= X_XDGACreateColormap) + fprintf (stderr, " DGA %s\n", dgaMinor[stuff->data]); +#endif + /* divert old protocol */ #if 1 if( (stuff->data <= X_XF86DGAViewPortChanged) && diff --git a/xc/programs/Xserver/Xext/xf86misc.c b/xc/programs/Xserver/Xext/xf86misc.c index c4ae12103..7bc360f0e 100644 --- a/xc/programs/Xserver/Xext/xf86misc.c +++ b/xc/programs/Xserver/Xext/xf86misc.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.31 1999/07/10 12:17:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86misc.c,v 3.33 2000/05/03 00:43:42 tsi Exp $ */ /* * Copyright (c) 1995, 1996 The XFree86 Project, Inc @@ -24,6 +24,7 @@ #include "Xfuncproto.h" #include "xf86miscproc.h" +#if 0 #include <X11/Xtrans.h> #include "../os/osdep.h" #include <X11/Xauth.h> @@ -38,6 +39,7 @@ #include <lan/socket.h> #endif #endif /* USL */ +#endif #ifdef EXTMODULE #include "xf86_ansic.h" @@ -74,7 +76,6 @@ static DISPATCH_PROC(SProcXF86MiscSetSaver); static unsigned char XF86MiscReqCode = 0; -#define DEBUG #ifdef DEBUG # define DEBUG_P(x) ErrorF(x"\n"); #else @@ -249,6 +250,8 @@ ProcXF86MiscGetMouseSettings(client) swapl(&rep.flags, n); } WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep); + MiscExtDestroyStruct(mouse, MISC_POINTER); + if (rep.devnamelen) WriteToClient(client, rep.devnamelen, devname); return (client->noClientException); @@ -321,13 +324,14 @@ ProcXF86MiscSetMouseSettings(client) MiscExtSetMouseValue(mouse, MISC_MSE_FLAGS, stuff->flags); switch ((ret = MiscExtApply(mouse, MISC_POINTER))) { - case MISC_RET_SUCCESS: break; + case MISC_RET_SUCCESS: break; case MISC_RET_BADVAL: return BadValue; case MISC_RET_BADMSEPROTO: return MISCERR(XF86MiscBadMouseProtocol); case MISC_RET_BADBAUDRATE: return MISCERR(XF86MiscBadMouseBaudRate); case MISC_RET_BADFLAGS: return MISCERR(XF86MiscBadMouseFlags); - case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo); - default: + case MISC_RET_BADCOMBO: return MISCERR(XF86MiscBadMouseCombo); + case MISC_RET_NOMODULE: return MISCERR(XF86MiscNoModule); + default: ErrorF("Unexpected return from MiscExtApply(POINTER) = %d\n", ret); return BadImplementation; } diff --git a/xc/programs/Xserver/Xext/xf86miscproc.h b/xc/programs/Xserver/Xext/xf86miscproc.h index 7e7f5af0e..28ea5ecd1 100644 --- a/xc/programs/Xserver/Xext/xf86miscproc.h +++ b/xc/programs/Xserver/Xext/xf86miscproc.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/Xext/xf86miscproc.h,v 1.1 1999/07/10 12:17:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xf86miscproc.h,v 1.2 2000/04/17 16:29:48 eich Exp $ */ /* Prototypes for Pointer/Keyboard functions that the DDX must provide */ @@ -31,7 +31,8 @@ typedef enum { MISC_RET_BADBAUDRATE, MISC_RET_BADFLAGS, MISC_RET_BADCOMBO, - MISC_RET_BADKBDTYPE + MISC_RET_BADKBDTYPE, + MISC_RET_NOMODULE } MiscExtReturn; typedef enum { diff --git a/xc/programs/Xserver/Xext/xvdisp.c b/xc/programs/Xserver/Xext/xvdisp.c index 282b690f3..5f85d5f9b 100644 --- a/xc/programs/Xserver/Xext/xvdisp.c +++ b/xc/programs/Xserver/Xext/xvdisp.c @@ -21,7 +21,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/Xext/xvdisp.c,v 1.10 2000/01/19 01:12:18 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvdisp.c,v 1.15 2000/06/10 22:00:26 mvojkovi Exp $ */ /* ** File: @@ -68,6 +68,17 @@ SOFTWARE. #include "xf86_ansic.h" #endif +#ifdef PANORAMIX +#include "panoramiX.h" +#include "panoramiXsrv.h" + +XvAdaptorPtr XineramaAdaptors[MAXSCREENS]; +static int XineramaXvShmPutImage(ClientPtr); +static int XineramaXvPutImage(ClientPtr); +static int XineramaXvSetPortAttribute(ClientPtr); +static int XineramaXvStopVideo(ClientPtr); +#endif + /* INTERNAL */ static int ProcXvQueryExtension(ClientPtr); @@ -215,13 +226,37 @@ ProcXvDispatch(ClientPtr client) case xv_UngrabPort: return(ProcXvUngrabPort(client)); case xv_SelectVideoNotify: return(ProcXvSelectVideoNotify(client)); case xv_SelectPortNotify: return(ProcXvSelectPortNotify(client)); - case xv_StopVideo: return(ProcXvStopVideo(client)); - case xv_SetPortAttribute: return(ProcXvSetPortAttribute(client)); + case xv_StopVideo: +#ifdef PANORAMIX + if(!noPanoramiXExtension) + return(XineramaXvStopVideo(client)); + else +#endif + return(ProcXvStopVideo(client)); + case xv_SetPortAttribute: +#ifdef PANORAMIX + if(!noPanoramiXExtension) + return(XineramaXvSetPortAttribute(client)); + else +#endif + return(ProcXvSetPortAttribute(client)); case xv_GetPortAttribute: return(ProcXvGetPortAttribute(client)); case xv_QueryBestSize: return(ProcXvQueryBestSize(client)); case xv_QueryPortAttributes: return(ProcXvQueryPortAttributes(client)); - case xv_PutImage: return(ProcXvPutImage(client)); - case xv_ShmPutImage: return(ProcXvShmPutImage(client)); + case xv_PutImage: +#ifdef PANORAMIX + if(!noPanoramiXExtension) + return(XineramaXvPutImage(client)); + else +#endif + return(ProcXvPutImage(client)); + case xv_ShmPutImage: +#ifdef PANORAMIX + if(!noPanoramiXExtension) + return(XineramaXvShmPutImage(client)); + else +#endif + return(ProcXvShmPutImage(client)); case xv_QueryImageAttributes: return(ProcXvQueryImageAttributes(client)); case xv_ListImageFormats: return(ProcXvListImageFormats(client)); default: @@ -292,6 +327,7 @@ ProcXvQueryExtension(ClientPtr client) rep.type = X_Reply; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.version = XvVersion; rep.revision = XvRevision; @@ -819,7 +855,6 @@ ProcXvSetPortAttribute(ClientPtr client) client->errorValue = stuff->value; return status; - } static int @@ -1136,6 +1171,7 @@ ProcXvShmPutImage(ClientPtr client) return status; } + static int ProcXvQueryImageAttributes(ClientPtr client) { @@ -1777,3 +1813,228 @@ SWriteListImageFormatsReply( return Success; } + + +#ifdef PANORAMIX + + +static int +XineramaXvStopVideo(ClientPtr client) +{ + int result, i, portoffset; + PanoramiXRes *draw; + XvPortPtr pPort; + REQUEST(xvStopVideoReq); + REQUEST_SIZE_MATCH(xvStopVideoReq); + + if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( + client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + return BadDrawable; + + portoffset = stuff->port - XineramaAdaptors[0]->base_id; + + FOR_NSCREENS_BACKWARD(i) { + if(XineramaAdaptors[i]) { + stuff->drawable = draw->info[i].id; + stuff->port = XineramaAdaptors[i]->base_id + portoffset; + result = ProcXvStopVideo(client); + } + } + + return result; +} + +static int +XineramaXvSetPortAttribute(ClientPtr client) +{ + REQUEST(xvSetPortAttributeReq); + int result, i, portoffset; + + REQUEST_SIZE_MATCH(xvSetPortAttributeReq); + + portoffset = stuff->port - XineramaAdaptors[0]->base_id; + + FOR_NSCREENS_BACKWARD(i) { + if(XineramaAdaptors[i]) { + stuff->port = XineramaAdaptors[i]->base_id + portoffset; + result = ProcXvSetPortAttribute(client); + } + } + return result; +} + + +static int +XineramaXvShmPutImage(ClientPtr client) +{ + REQUEST(xvShmPutImageReq); + PanoramiXRes *draw, *gc; + Bool send_event = stuff->send_event; + Bool isRoot; + int result, i, x, y, portoffset; + + REQUEST_SIZE_MATCH(xvShmPutImageReq); + + if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( + client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + return BadDrawable; + + if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->gc, XRT_GC, SecurityReadAccess))) + return BadGC; + + isRoot = (draw->type == XRT_WINDOW) && + (stuff->drawable == WindowTable[0]->drawable.id); + + x = stuff->drw_x; + y = stuff->drw_y; + + portoffset = stuff->port - XineramaAdaptors[0]->base_id; + + FOR_NSCREENS_BACKWARD(i) { + if(XineramaAdaptors[i]) { + stuff->drawable = draw->info[i].id; + stuff->port = XineramaAdaptors[i]->base_id + portoffset; + stuff->gc = gc->info[i].id; + stuff->drw_x = x; + stuff->drw_y = y; + if(isRoot) { + stuff->drw_x -= panoramiXdataPtr[i].x; + stuff->drw_y -= panoramiXdataPtr[i].y; + } + stuff->send_event = (send_event && !i) ? 1 : 0; + + result = ProcXvShmPutImage(client); + if(result != Success) break; + } + } + return result; +} + +static int +XineramaXvPutImage(ClientPtr client) +{ + REQUEST(xvPutImageReq); + PanoramiXRes *draw, *gc; + Bool isRoot; + int result, i, x, y, portoffset; + + REQUEST_AT_LEAST_SIZE(xvPutImageReq); + + if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( + client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + return BadDrawable; + + if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( + client, stuff->gc, XRT_GC, SecurityReadAccess))) + return BadGC; + + isRoot = (draw->type == XRT_WINDOW) && + (stuff->drawable == WindowTable[0]->drawable.id); + + x = stuff->drw_x; + y = stuff->drw_y; + + portoffset = stuff->port - XineramaAdaptors[0]->base_id; + + FOR_NSCREENS_BACKWARD(i) { + if(XineramaAdaptors[i]) { + stuff->drawable = draw->info[i].id; + stuff->port = XineramaAdaptors[i]->base_id + portoffset; + stuff->gc = gc->info[i].id; + stuff->drw_x = x; + stuff->drw_y = y; + if(isRoot) { + stuff->drw_x -= panoramiXdataPtr[i].x; + stuff->drw_y -= panoramiXdataPtr[i].y; + } + + result = ProcXvPutImage(client); + if(result != Success) break; + } + } + return result; +} + + +void XineramifyXv(void) +{ + ScreenPtr pScreen; + XvScreenPtr pxvs; + XvAdaptorPtr pAdapt, refAdapt; + XvImagePtr refImage; + int imageHeads = 0; + Bool match, blast; + int max_w = 0, max_h = 0; + int i, j, k, n; + + /* find which heads can do images */ + for(i = 0; i < PanoramiXNumScreens; i++) { + pScreen = screenInfo.screens[i]; + XineramaAdaptors[i] = NULL; + pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr; + if(pxvs) { + for(j = 0; j < pxvs->nAdaptors; j++) { + pAdapt = pxvs->pAdaptors + j; + if((pAdapt->type & XvImageMask) && (pAdapt->nImages > 0)) { + imageHeads++; + XineramaAdaptors[i] = pAdapt; + break; /* assuming only one XvImage capable adaptor per head */ + } + } + } + } + + if(!imageHeads || !XineramaAdaptors[0]) return; + + /* filter out image types not common on all */ + refAdapt = XineramaAdaptors[0]; + + for(i = 0; i < refAdapt->nEncodings; i++) { + if(!strcmp(refAdapt->pEncodings[i].name, "XV_IMAGE")) { + max_w = refAdapt->pEncodings[i].width; + max_h = refAdapt->pEncodings[i].height; + break; + } + } + + for(i = 0; i < refAdapt->nImages; i++) { + refImage = refAdapt->pImages + i; + + blast = FALSE; + for(j = 0; j < PanoramiXNumScreens; j++) { + match = FALSE; + if((pAdapt = XineramaAdaptors[j])) { + for(k = 0; k < pAdapt->nImages; k++) { + if(pAdapt->pImages[k].id == refImage->id) { + match = TRUE; + for(n = 0; n < pAdapt->nEncodings; n++) { + if(!strcmp(pAdapt->pEncodings[n].name, "XV_IMAGE")) { + if(max_w > pAdapt->pEncodings[n].width) + max_w = pAdapt->pEncodings[n].width; + if(max_h > pAdapt->pEncodings[n].height) + max_h = pAdapt->pEncodings[n].height; + break; + } + } + break; + } + } + } + if(!match) { + blast = TRUE; + break; + } + } + if(blast) { + if(i < (refAdapt->nImages - 1)) + memcpy(refAdapt->pImages + i, refAdapt->pImages + i + 1, + (refAdapt->nImages - 1 - i) * sizeof(XvImageRec)); + refAdapt->nImages--; + } + } + + if(!refAdapt->nImages) /* no image formats in common between heads */ + refAdapt->type &= ~XvImageMask; +} +#endif diff --git a/xc/programs/Xserver/Xext/xvmain.c b/xc/programs/Xserver/Xext/xvmain.c index 99f2287c5..2403ad7a0 100644 --- a/xc/programs/Xserver/Xext/xvmain.c +++ b/xc/programs/Xserver/Xext/xvmain.c @@ -21,7 +21,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/Xext/xvmain.c,v 1.8 2000/01/18 16:35:40 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/Xext/xvmain.c,v 1.9 2000/03/30 18:20:36 mvojkovi Exp $ */ /* ** File: @@ -98,10 +98,16 @@ SOFTWARE. #include "xf86_ansic.h" #endif +#ifdef PANORAMIX +#include "panoramiX.h" +#include "panoramiXsrv.h" +extern void XineramifyXv(void); +#endif + int XvScreenIndex = -1; -unsigned long XvExtensionGeneration; -unsigned long XvScreenGeneration; -unsigned long XvResourceGeneration; +unsigned long XvExtensionGeneration = 0; +unsigned long XvScreenGeneration = 0; +unsigned long XvResourceGeneration = 0; int XvReqCode; int XvEventBase; @@ -125,8 +131,6 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *); static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *); static Bool CreateResourceTypes(void); -static int lastScreenWithAdaptors = 0; - static Bool XvCloseScreen(int, ScreenPtr); static Bool XvDestroyPixmap(PixmapPtr); static Bool XvDestroyWindow(WindowPtr); @@ -151,12 +155,10 @@ static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int); void XvExtensionInit() { - int ii; - register ExtensionEntry *extEntry; + ExtensionEntry *extEntry; /* LOOK TO SEE IF ANY SCREENS WERE INITIALIZED; IF NOT THEN INIT GLOBAL VARIABLES SO THE EXTENSION CAN FUNCTION */ - if (XvScreenGeneration != serverGeneration) { if (!CreateResourceTypes()) @@ -170,22 +172,12 @@ XvExtensionInit() ErrorF("XvExtensionInit: Unable to allocate screen private index\n"); return; } - +#ifdef PANORAMIX + XineramaRegisterConnectionBlockCallback(XineramifyXv); +#endif XvScreenGeneration = serverGeneration; } - /* ITS A LITTLE HARD TO UNDERSTAND WHAT THIS DOES, BUT ESSENTIALLY I WANT - ALL SCREEN THAT HAVE ADAPTORS TO HAVE A VALID DEVPRIVATE POINTER AND ANY - THAT DON'T TO HAVE NULL DEVPRIVATE POINTERS; THIS WAY I DON'T HAVE TO - CALL A SPECIAL XV SCREEN INITIALIZE FOR SCREENS WITHOUT ADAPTORS; THERE - SHOULD BE AN EASIER WAY TO DO THIS, BUT main.c DOESN'T INITIALIZE THE - DEVPRIVATE POINTERS FOR A NEWLY CREATED SCREEN, NOR ARE THEY INITIALIZED - WHEN A NEW SCREEN PRIVATE INDEX IS ALLOCATED */ - - for (ii=lastScreenWithAdaptors; ii<screenInfo.numScreens; ii++) - screenInfo.screens[ii]->devPrivates[XvScreenIndex].ptr = (pointer)NULL; - lastScreenWithAdaptors = screenInfo.numScreens; - if (XvExtensionGeneration != serverGeneration) { XvExtensionGeneration = serverGeneration; @@ -264,8 +256,6 @@ CreateResourceTypes() int XvScreenInit(ScreenPtr pScreen) { - - int ii; XvScreenPtr pxvs; if (XvScreenGeneration != serverGeneration) @@ -281,21 +271,12 @@ XvScreenInit(ScreenPtr pScreen) ErrorF("XvScreenInit: Unable to allocate screen private index\n"); return BadAlloc; } +#ifdef PANORAMIX + XineramaRegisterConnectionBlockCallback(XineramifyXv); +#endif XvScreenGeneration = serverGeneration; } - /* ITS A LITTLE HARD TO UNDERSTAND WHAT THIS DOES, BUT ESSENTIALLY I WANT - ALL SCREEN THAT HAVE ADAPTORS TO HAVE A VALID DEVPRIVATE POINTER AND ANY - THAT DON'T TO HAVE NULL DEVPRIVATE POINTERS; THIS WAY I DON'T HAVE TO - CALL A SPECIAL XV SCREEN INITIALIZE FOR SCREENS WITHOUT ADAPTORS; THERE - SHOULD BE AN EASIER WAY TO DO THIS, BUT main.c DOESN'T INITIALIZE THE - DEVPRIVATE POINTERS FOR A NEWLY CREATED SCREEN, NOR ARE THEY INITIALIZED - WHEN A NEW SCREEN PRIVATE INDEX IS ALLOCATED */ - - for (ii=lastScreenWithAdaptors; ii<screenInfo.numScreens; ii++) - screenInfo.screens[ii]->devPrivates[XvScreenIndex].ptr = (pointer)NULL; - lastScreenWithAdaptors = screenInfo.numScreens; - if (pScreen->devPrivates[XvScreenIndex].ptr) { ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n"); @@ -351,7 +332,6 @@ XvCloseScreen( static void XvResetProc(ExtensionEntry* extEntry) { - lastScreenWithAdaptors = 0; } int |