diff options
author | marha <marha@users.sourceforge.net> | 2013-10-07 16:40:05 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-10-07 16:40:05 +0200 |
commit | 8f0ed7f7a754df710b13b9dabbaa32b5d4211182 (patch) | |
tree | 03bf52a933c29962894c2cec5f33028439cf4f5a /xorg-server | |
parent | 7d29f4054380e7f42722c280b9caedce9fa4ace9 (diff) | |
parent | 81fd17c8678e89cea6610b8b2996b028b21eb5dc (diff) | |
download | vcxsrv-8f0ed7f7a754df710b13b9dabbaa32b5d4211182.tar.gz vcxsrv-8f0ed7f7a754df710b13b9dabbaa32b5d4211182.tar.bz2 vcxsrv-8f0ed7f7a754df710b13b9dabbaa32b5d4211182.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
xserver fontconfig libXdmcp mesa pixmand xkeyboard-config git update 7 oct 2013
Conflicts:
xorg-server/dix/dispatch.c
xorg-server/dix/privates.c
xorg-server/glx/glxcmds.c
xorg-server/hw/kdrive/ephyr/ephyr.h
xorg-server/hw/kdrive/ephyr/ephyrinit.c
xorg-server/hw/kdrive/ephyr/hostx.c
Diffstat (limited to 'xorg-server')
105 files changed, 2116 insertions, 5310 deletions
diff --git a/xorg-server/Xext/panoramiX.c b/xorg-server/Xext/panoramiX.c index c0aed27d7..be7e03100 100644 --- a/xorg-server/Xext/panoramiX.c +++ b/xorg-server/Xext/panoramiX.c @@ -53,9 +53,7 @@ Equipment Corporation. #include "servermd.h" #include "resource.h" #include "picturestr.h" -#ifdef XFIXES #include "xfixesint.h" -#endif #ifdef COMPOSITE #include "compint.h" #endif @@ -583,9 +581,7 @@ PanoramiXExtensionInit(void) ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor; PanoramiXRenderInit(); -#ifdef XFIXES PanoramiXFixesInit(); -#endif #ifdef COMPOSITE PanoramiXCompositeInit(); #endif @@ -890,9 +886,7 @@ PanoramiXResetProc(ExtensionEntry * extEntry) int i; PanoramiXRenderReset(); -#ifdef XFIXES PanoramiXFixesReset(); -#endif #ifdef COMPOSITE PanoramiXCompositeReset (); #endif diff --git a/xorg-server/Xext/security.c b/xorg-server/Xext/security.c index 8a82806e9..dce3c9fba 100644 --- a/xorg-server/Xext/security.c +++ b/xorg-server/Xext/security.c @@ -59,8 +59,9 @@ static DevPrivateKeyRec stateKeyRec; /* This is what we store as client security state */ typedef struct { - int haveState; - unsigned int trustLevel; + unsigned int haveState :1; + unsigned int live :1; + unsigned int trustLevel :2; XID authId; } SecurityStateRec; @@ -143,6 +144,7 @@ SecurityLabelInitial(void) state = dixLookupPrivate(&serverClient->devPrivates, stateKey); state->trustLevel = XSecurityClientTrusted; state->haveState = TRUE; + state->live = FALSE; } /* @@ -952,6 +954,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) state->trustLevel = XSecurityClientTrusted; state->authId = None; state->haveState = TRUE; + state->live = FALSE; break; case ClientStateRunning: @@ -962,6 +965,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) if (rc == Success) { /* it is a generated authorization */ pAuth->refcnt++; + state->live = TRUE; if (pAuth->refcnt == 1 && pAuth->timer) TimerCancel(pAuth->timer); @@ -974,9 +978,10 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) rc = dixLookupResourceByType((pointer *) &pAuth, state->authId, SecurityAuthorizationResType, serverClient, DixGetAttrAccess); - if (rc == Success) { + if (rc == Success && state->live) { /* it is a generated authorization */ pAuth->refcnt--; + state->live = FALSE; if (pAuth->refcnt == 0) SecurityStartAuthorizationTimer(pAuth); } diff --git a/xorg-server/composite/compalloc.c b/xorg-server/composite/compalloc.c index e684c4360..baf59c5d9 100644 --- a/xorg-server/composite/compalloc.c +++ b/xorg-server/composite/compalloc.c @@ -205,7 +205,7 @@ compRedirectWindow(ClientPtr pClient, WindowPtr pWin, int update) anyMarked = compMarkWindows(pWin, &pLayerWin); if (cw->damageRegistered) { - DamageUnregister(&pWin->drawable, cw->damage); + DamageUnregister(cw->damage); cw->damageRegistered = FALSE; } cw->update = CompositeRedirectManual; @@ -638,7 +638,7 @@ compSetParentPixmap(WindowPtr pWin) CompWindowPtr cw = GetCompWindow(pWin); if (cw->damageRegistered) { - DamageUnregister(&pWin->drawable, cw->damage); + DamageUnregister(cw->damage); cw->damageRegistered = FALSE; DamageEmpty(cw->damage); } diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c index de8924143..b55b78ec5 100644 --- a/xorg-server/config/udev.c +++ b/xorg-server/config/udev.c @@ -226,6 +226,10 @@ device_added(struct udev_device *udev_device) input_options = input_option_new(input_options, "config_info", config_info); + /* Default setting needed for non-seat0 seats */ + if (ServerIsNotSeat0()) + input_options = input_option_new(input_options, "GrabDevice", "on"); + LogMessage(X_INFO, "config/udev: Adding input device %s (%s)\n", name, path); rc = NewInputDeviceRequest(input_options, &attrs, &dev); diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index f26bff4c5..3df579a00 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -26,9 +26,9 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.60) -AC_INIT([xorg-server], 1.14.99.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) -RELEASE_DATE="2013-04-24" -RELEASE_NAME="Sweet Tea" +AC_INIT([xorg-server], 1.14.99.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +RELEASE_DATE="2013-10-04" +RELEASE_NAME="Chicory Coffee" AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) @@ -2116,12 +2116,12 @@ if test "$KDRIVE" = yes; then AC_DEFINE(KDRIVE_MOUSE, 1, [Enable KDrive mouse driver]) fi - XEPHYR_REQUIRED_LIBS="x11 >= 1.6 $LIBXEXT xau xdmcp" + XEPHYR_REQUIRED_LIBS="xau xdmcp xcb xcb-shape xcb-aux xcb-image xcb-icccm xcb-shm xcb-keysyms" if test "x$XV" = xyes; then - XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xv" + XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS xcb-xv" fi if test "x$DRI" = xyes && test "x$GLX" = xyes; then - XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS $LIBGL libdrm" + XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS libdrm xcb-glx xcb-xf86dri > 1.6" fi if test "x$XEPHYR" = xauto; then diff --git a/xorg-server/damageext/damageext.c b/xorg-server/damageext/damageext.c index c852005ef..481f778bb 100644 --- a/xorg-server/damageext/damageext.c +++ b/xorg-server/damageext/damageext.c @@ -31,7 +31,6 @@ static unsigned char DamageReqCode; static int DamageEventBase; static RESTYPE DamageExtType; -static RESTYPE DamageExtWinType; static DevPrivateKeyRec DamageClientPrivateKeyRec; @@ -305,11 +304,14 @@ static const int version_requests[] = { #define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0])) static int (*ProcDamageVector[XDamageNumberRequests]) (ClientPtr) = { -/*************** Version 1 ******************/ + /*************** Version 1 ******************/ ProcDamageQueryVersion, - ProcDamageCreate, ProcDamageDestroy, ProcDamageSubtract, -/*************** Version 1.1 ****************/ -ProcDamageAdd,}; + ProcDamageCreate, + ProcDamageDestroy, + ProcDamageSubtract, + /*************** Version 1.1 ****************/ + ProcDamageAdd, +}; static int ProcDamageDispatch(ClientPtr client) @@ -385,11 +387,14 @@ SProcDamageAdd(ClientPtr client) } static int (*SProcDamageVector[XDamageNumberRequests]) (ClientPtr) = { -/*************** Version 1 ******************/ + /*************** Version 1 ******************/ SProcDamageQueryVersion, - SProcDamageCreate, SProcDamageDestroy, SProcDamageSubtract, -/*************** Version 1.1 ****************/ -SProcDamageAdd,}; + SProcDamageCreate, + SProcDamageDestroy, + SProcDamageSubtract, + /*************** Version 1.1 ****************/ + SProcDamageAdd, +}; static int SProcDamageDispatch(ClientPtr client) @@ -427,26 +432,13 @@ FreeDamageExt(pointer value, XID did) * Get rid of the resource table entry hanging from the window id */ pDamageExt->id = 0; - if (WindowDrawable(pDamageExt->pDrawable->type)) - FreeResourceByType(pDamageExt->pDrawable->id, DamageExtWinType, TRUE); if (pDamageExt->pDamage) { - DamageUnregister(pDamageExt->pDrawable, pDamageExt->pDamage); DamageDestroy(pDamageExt->pDamage); } free(pDamageExt); return Success; } -static int -FreeDamageExtWin(pointer value, XID wid) -{ - DamageExtPtr pDamageExt = (DamageExtPtr) value; - - if (pDamageExt->id) - FreeResource(pDamageExt->id, RT_NONE); - return Success; -} - static void SDamageNotifyEvent(xDamageNotifyEvent * from, xDamageNotifyEvent * to) { @@ -477,10 +469,6 @@ DamageExtensionInit(void) if (!DamageExtType) return; - DamageExtWinType = CreateNewResourceType(FreeDamageExtWin, "DamageExtWin"); - if (!DamageExtWinType) - return; - if (!dixRegisterPrivateKey (&DamageClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(DamageClientRec))) return; diff --git a/xorg-server/dbe/Makefile.am b/xorg-server/dbe/Makefile.am index 043555b8c..7d034c7f7 100644 --- a/xorg-server/dbe/Makefile.am +++ b/xorg-server/dbe/Makefile.am @@ -9,5 +9,4 @@ endif libdbe_la_SOURCES = \ dbe.c \ midbe.c \ - midbe.h \ - midbestr.h + midbe.h diff --git a/xorg-server/dbe/dbe.c b/xorg-server/dbe/dbe.c index 38fd22b77..e8fccdc69 100644 --- a/xorg-server/dbe/dbe.c +++ b/xorg-server/dbe/dbe.c @@ -90,10 +90,7 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens) pDbeScreenPriv->GetVisualInfo = NULL; pDbeScreenPriv->AllocBackBufferName = NULL; pDbeScreenPriv->SwapBuffers = NULL; - pDbeScreenPriv->BeginIdiom = NULL; - pDbeScreenPriv->EndIdiom = NULL; pDbeScreenPriv->WinPrivDelete = NULL; - pDbeScreenPriv->ResetProc = NULL; (*nStubbedScreens)++; @@ -232,8 +229,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client) * Allocate a window priv. */ - pDbeWindowPriv = - dixAllocateObjectWithPrivates(DbeWindowPrivRec, PRIVATE_DBE_WINDOW); + pDbeWindowPriv = calloc(1, sizeof(DbeWindowPrivRec)); if (!pDbeWindowPriv) return BadAlloc; @@ -545,44 +541,6 @@ ProcDbeSwapBuffers(ClientPtr client) /****************************************************************************** * - * DBE DIX Procedure: ProcDbeBeginIdiom - * - * Description: - * - * This function is for processing a DbeBeginIdiom request. - * This request informs the server that a complex swap will immediately - * follow this request. - * - * Return Values: - * - * Success - * - *****************************************************************************/ - -static int -ProcDbeBeginIdiom(ClientPtr client) -{ - /* REQUEST(xDbeBeginIdiomReq); */ - DbeScreenPrivPtr pDbeScreenPriv; - register int i; - - REQUEST_SIZE_MATCH(xDbeBeginIdiomReq); - - for (i = 0; i < screenInfo.numScreens; i++) { - pDbeScreenPriv = DBE_SCREEN_PRIV(screenInfo.screens[i]); - - /* Call the DDX begin idiom procedure if there is one. */ - if (pDbeScreenPriv->BeginIdiom) { - (*pDbeScreenPriv->BeginIdiom) (client); - } - } - - return Success; - -} /* ProcDbeBeginIdiom() */ - -/****************************************************************************** - * * DBE DIX Procedure: ProcDbeGetVisualInfo * * Description: @@ -816,7 +774,7 @@ ProcDbeDispatch(ClientPtr client) return (ProcDbeSwapBuffers(client)); case X_DbeBeginIdiom: - return (ProcDbeBeginIdiom(client)); + return Success; case X_DbeEndIdiom: return Success; @@ -980,32 +938,6 @@ SProcDbeSwapBuffers(ClientPtr client) /****************************************************************************** * - * DBE DIX Procedure: SProcDbeBeginIdiom - * - * Description: - * - * This function is for processing a DbeBeginIdiom request on a swapped - * server. This request informs the server that a complex swap will - * immediately follow this request. - * - * Return Values: - * - * Success - * - *****************************************************************************/ - -static int -SProcDbeBeginIdiom(ClientPtr client) -{ - REQUEST(xDbeBeginIdiomReq); - - swaps(&stuff->length); - return (ProcDbeBeginIdiom(client)); - -} /* SProcDbeBeginIdiom() */ - -/****************************************************************************** - * * DBE DIX Procedure: SProcDbeGetVisualInfo * * Description: @@ -1095,7 +1027,7 @@ SProcDbeDispatch(ClientPtr client) return (SProcDbeSwapBuffers(client)); case X_DbeBeginIdiom: - return (SProcDbeBeginIdiom(client)); + return Success; case X_DbeEndIdiom: return Success; @@ -1287,7 +1219,7 @@ DbeWindowPrivDelete(pointer pDbeWinPriv, XID id) NULL); /* We are done with the window priv. */ - dixFreeObjectWithPrivates(pDbeWindowPriv, PRIVATE_DBE_WINDOW); + free(pDbeWindowPriv); } return Success; @@ -1319,10 +1251,7 @@ DbeResetProc(ExtensionEntry * extEntry) if (pDbeScreenPriv) { /* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */ pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow; - - if (pDbeScreenPriv->ResetProc) - (*pDbeScreenPriv->ResetProc) (pScreen); - + pScreen->PositionWindow = pDbeScreenPriv->PositionWindow; free(pDbeScreenPriv); } } diff --git a/xorg-server/dbe/dbestruct.h b/xorg-server/dbe/dbestruct.h index f9d938af1..200206652 100644 --- a/xorg-server/dbe/dbestruct.h +++ b/xorg-server/dbe/dbestruct.h @@ -143,6 +143,20 @@ typedef struct _DbeWindowPrivRec { */ XID initIDs[DBE_INIT_MAX_IDS]; + /* Pointer to a drawable that contains the contents of the back buffer. + */ + PixmapPtr pBackBuffer; + + /* Pointer to a drawable that contains the contents of the front buffer. + * This pointer is only used for the XdbeUntouched swap action. For that + * swap action, we need to copy the front buffer (window) contents into + * this drawable, copy the contents of current back buffer drawable (the + * back buffer) into the window, swap the front and back drawable pointers, + * and then swap the drawable/resource associations in the resource + * database. + */ + PixmapPtr pFrontBuffer; + /* Device-specific private information. */ PrivateRec *devPrivates; @@ -180,16 +194,9 @@ typedef struct _DbeScreenPrivRec { int * /*pNumWindows */ , DbeSwapInfoPtr /*swapInfo */ ); - void (*BeginIdiom) (ClientPtr /*client */ - ); - void (*EndIdiom) (ClientPtr /*client */ - ); void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ , XID /*bufId */ ); - void (*ResetProc) (ScreenPtr /*pScreen */ - ); - } DbeScreenPrivRec, *DbeScreenPrivPtr; #endif /* DBE_STRUCT_H */ diff --git a/xorg-server/dbe/midbe.c b/xorg-server/dbe/midbe.c index d810d992e..3663fddcc 100644 --- a/xorg-server/dbe/midbe.c +++ b/xorg-server/dbe/midbe.c @@ -48,7 +48,6 @@ #include "resource.h" #include "opaque.h" #include "dbestruct.h" -#include "midbestr.h" #include "regionstr.h" #include "gcstruct.h" #include "inputstr.h" @@ -57,9 +56,6 @@ #include <stdio.h> -static DevPrivateKeyRec miDbeWindowPrivPrivKeyRec; - -#define miDbeWindowPrivPrivKey (&miDbeWindowPrivPrivKeyRec) /****************************************************************************** * @@ -138,7 +134,6 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) { ScreenPtr pScreen; DbeWindowPrivPtr pDbeWindowPriv; - MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv; DbeScreenPrivPtr pDbeScreenPriv; GCPtr pGC; xRectangle clearRect; @@ -156,12 +151,8 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - /* Setup the window priv priv. */ - pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); - pDbeWindowPrivPriv->pDbeWindowPriv = pDbeWindowPriv; - /* Get a front pixmap. */ - if (!(pDbeWindowPrivPriv->pFrontBuffer = + if (!(pDbeWindowPriv->pFrontBuffer = (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width, pDbeWindowPriv->height, pWin->drawable.depth, 0))) { @@ -169,22 +160,22 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) } /* Get a back pixmap. */ - if (!(pDbeWindowPrivPriv->pBackBuffer = + if (!(pDbeWindowPriv->pBackBuffer = (*pScreen->CreatePixmap) (pScreen, pDbeWindowPriv->width, pDbeWindowPriv->height, pWin->drawable.depth, 0))) { - (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer); + (*pScreen->DestroyPixmap) (pDbeWindowPriv->pFrontBuffer); return BadAlloc; } /* Security creation/labeling check. */ rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId, - dbeDrawableResType, pDbeWindowPrivPriv->pBackBuffer, + dbeDrawableResType, pDbeWindowPriv->pBackBuffer, RT_WINDOW, pWin, DixCreateAccess); /* Make the back pixmap a DBE drawable resource. */ if (rc != Success || !AddResource(bufId, dbeDrawableResType, - pDbeWindowPrivPriv->pBackBuffer)) { + pDbeWindowPriv->pBackBuffer)) { /* free the buffer and the drawable resource */ FreeResource(bufId, RT_NONE); return (rc == Success) ? BadAlloc : rc; @@ -193,11 +184,11 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) /* Clear the back buffer. */ pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) { - ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC); + ValidateGC((DrawablePtr) pDbeWindowPriv->pBackBuffer, pGC); clearRect.x = clearRect.y = 0; - clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width; - clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height; - (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv-> + clearRect.width = pDbeWindowPriv->pBackBuffer->drawable.width; + clearRect.height = pDbeWindowPriv->pBackBuffer->drawable.height; + (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPriv-> pBackBuffer, pGC, 1, &clearRect); } FreeScratchGC(pGC); @@ -210,9 +201,8 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction) */ /* Associate the new ID with an existing pixmap. */ - pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); if (!AddResource(bufId, dbeDrawableResType, - (pointer) pDbeWindowPrivPriv->pBackBuffer)) { + (pointer) pDbeWindowPriv->pBackBuffer)) { return BadAlloc; } @@ -237,12 +227,10 @@ static void miDbeAliasBuffers(DbeWindowPrivPtr pDbeWindowPriv) { int i; - MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv = - MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) { ChangeResourceValue(pDbeWindowPriv->IDs[i], dbeDrawableResType, - (pointer) pDbeWindowPrivPriv->pBackBuffer); + (pointer) pDbeWindowPriv->pBackBuffer); } } /* miDbeAliasBuffers() */ @@ -261,15 +249,15 @@ static int miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo) { DbeScreenPrivPtr pDbeScreenPriv; + DbeWindowPrivPtr pDbeWindowPriv; GCPtr pGC; WindowPtr pWin; - MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv; PixmapPtr pTmpBuffer; xRectangle clearRect; pWin = swapInfo[0].pWindow; pDbeScreenPriv = DBE_SCREEN_PRIV_FROM_WINDOW(pWin); - pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin); + pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); pGC = GetScratchGC(pWin->drawable.depth, pWin->drawable.pScreen); /* @@ -286,9 +274,9 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo) break; case XdbeUntouched: - ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pFrontBuffer, pGC); + ValidateGC((DrawablePtr) pDbeWindowPriv->pFrontBuffer, pGC); (*pGC->ops->CopyArea) ((DrawablePtr) pWin, - (DrawablePtr) pDbeWindowPrivPriv->pFrontBuffer, + (DrawablePtr) pDbeWindowPriv->pFrontBuffer, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); break; @@ -305,7 +293,7 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo) */ ValidateGC((DrawablePtr) pWin, pGC); - (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, + (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPriv->pBackBuffer, (DrawablePtr) pWin, pGC, 0, 0, pWin->drawable.width, pWin->drawable.height, 0, 0); @@ -321,23 +309,23 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo) case XdbeBackground: if ((*pDbeScreenPriv->SetupBackgroundPainter) (pWin, pGC)) { - ValidateGC((DrawablePtr) pDbeWindowPrivPriv->pBackBuffer, pGC); + ValidateGC((DrawablePtr) pDbeWindowPriv->pBackBuffer, pGC); clearRect.x = 0; clearRect.y = 0; - clearRect.width = pDbeWindowPrivPriv->pBackBuffer->drawable.width; - clearRect.height = pDbeWindowPrivPriv->pBackBuffer->drawable.height; - (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPrivPriv-> + clearRect.width = pDbeWindowPriv->pBackBuffer->drawable.width; + clearRect.height = pDbeWindowPriv->pBackBuffer->drawable.height; + (*pGC->ops->PolyFillRect) ((DrawablePtr) pDbeWindowPriv-> pBackBuffer, pGC, 1, &clearRect); } break; case XdbeUntouched: /* Swap pixmap pointers. */ - pTmpBuffer = pDbeWindowPrivPriv->pBackBuffer; - pDbeWindowPrivPriv->pBackBuffer = pDbeWindowPrivPriv->pFrontBuffer; - pDbeWindowPrivPriv->pFrontBuffer = pTmpBuffer; + pTmpBuffer = pDbeWindowPriv->pBackBuffer; + pDbeWindowPriv->pBackBuffer = pDbeWindowPriv->pFrontBuffer; + pDbeWindowPriv->pFrontBuffer = pTmpBuffer; - miDbeAliasBuffers(pDbeWindowPrivPriv->pDbeWindowPriv); + miDbeAliasBuffers(pDbeWindowPriv); break; @@ -427,8 +415,6 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo) static void miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId) { - MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv; - if (pDbeWindowPriv->nBufferIDs != 0) { /* We still have at least one more buffer ID associated with this * window. @@ -440,18 +426,15 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId) * free some stuff. */ - pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); - /* Destroy the front and back pixmaps. */ - if (pDbeWindowPrivPriv->pFrontBuffer) { + if (pDbeWindowPriv->pFrontBuffer) { (*pDbeWindowPriv->pWindow->drawable.pScreen-> - DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer); + DestroyPixmap) (pDbeWindowPriv->pFrontBuffer); } - if (pDbeWindowPrivPriv->pBackBuffer) { + if (pDbeWindowPriv->pBackBuffer) { (*pDbeWindowPriv->pWindow->drawable.pScreen-> - DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer); + DestroyPixmap) (pDbeWindowPriv->pBackBuffer); } - } /* miDbeWinPrivDelete() */ /****************************************************************************** @@ -627,10 +610,6 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) else { /* Clear out the new DBE buffer pixmaps. */ - MiDbeWindowPrivPrivPtr pDbeWindowPrivPriv; - - pDbeWindowPrivPriv = MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv); - /* I suppose this could avoid quite a bit of work if * it computed the minimal area required. */ @@ -641,9 +620,9 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) } /* Copy the contents of the old front pixmap to the new one. */ if (pWin->bitGravity != ForgetGravity) { - (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv-> - pFrontBuffer, (DrawablePtr) pFrontBuffer, - pGC, sourcex, sourcey, savewidth, saveheight, + (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPriv->pFrontBuffer, + (DrawablePtr) pFrontBuffer, pGC, + sourcex, sourcey, savewidth, saveheight, destx, desty); } @@ -654,8 +633,8 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) } /* Copy the contents of the old back pixmap to the new one. */ if (pWin->bitGravity != ForgetGravity) { - (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPrivPriv-> - pBackBuffer, (DrawablePtr) pBackBuffer, pGC, + (*pGC->ops->CopyArea) ((DrawablePtr) pDbeWindowPriv->pBackBuffer, + (DrawablePtr) pBackBuffer, pGC, sourcex, sourcey, savewidth, saveheight, destx, desty); } @@ -664,11 +643,11 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) * pixmaps. */ - (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pFrontBuffer); - (*pScreen->DestroyPixmap) (pDbeWindowPrivPriv->pBackBuffer); + (*pScreen->DestroyPixmap) (pDbeWindowPriv->pFrontBuffer); + (*pScreen->DestroyPixmap) (pDbeWindowPriv->pBackBuffer); - pDbeWindowPrivPriv->pFrontBuffer = pFrontBuffer; - pDbeWindowPrivPriv->pBackBuffer = pBackBuffer; + pDbeWindowPriv->pFrontBuffer = pFrontBuffer; + pDbeWindowPriv->pBackBuffer = pBackBuffer; /* Make sure all XID are associated with the new back pixmap. */ miDbeAliasBuffers(pDbeWindowPriv); @@ -682,30 +661,6 @@ miDbePositionWindow(WindowPtr pWin, int x, int y) /****************************************************************************** * - * DBE MI Procedure: miDbeResetProc - * - * Description: - * - * This function is called from DbeResetProc(), which is called at the end - * of every server generation. This function peforms any MI-specific - * shutdown tasks. - * - *****************************************************************************/ - -static void -miDbeResetProc(ScreenPtr pScreen) -{ - DbeScreenPrivPtr pDbeScreenPriv; - - pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); - - /* Unwrap wrappers */ - pScreen->PositionWindow = pDbeScreenPriv->PositionWindow; - -} /* miDbeResetProc() */ - -/****************************************************************************** - * * DBE MI Procedure: miDbeInit * * Description: @@ -717,10 +672,6 @@ miDbeResetProc(ScreenPtr pScreen) Bool miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) { - if (!dixRegisterPrivateKey(&miDbeWindowPrivPrivKeyRec, PRIVATE_DBE_WINDOW, - sizeof(MiDbeWindowPrivPrivRec))) - return FALSE; - /* Wrap functions. */ pDbeScreenPriv->PositionWindow = pScreen->PositionWindow; pScreen->PositionWindow = miDbePositionWindow; @@ -729,9 +680,6 @@ miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo; pDbeScreenPriv->AllocBackBufferName = miDbeAllocBackBufferName; pDbeScreenPriv->SwapBuffers = miDbeSwapBuffers; - pDbeScreenPriv->BeginIdiom = 0; - pDbeScreenPriv->EndIdiom = 0; - pDbeScreenPriv->ResetProc = miDbeResetProc; pDbeScreenPriv->WinPrivDelete = miDbeWinPrivDelete; return TRUE; diff --git a/xorg-server/dbe/midbestr.h b/xorg-server/dbe/midbestr.h deleted file mode 100644 index 70017b045..000000000 --- a/xorg-server/dbe/midbestr.h +++ /dev/null @@ -1,75 +0,0 @@ -/****************************************************************************** - * - * Copyright (c) 1994, 1995 Hewlett-Packard Company - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR - * THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the Hewlett-Packard - * Company shall not be used in advertising or otherwise to promote the - * sale, use or other dealings in this Software without prior written - * authorization from the Hewlett-Packard Company. - * - * Header file for users of machine-independent DBE code - * - *****************************************************************************/ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef MIDBE_STRUCT_H -#define MIDBE_STRUCT_H - -/* DEFINES */ - -#define MI_DBE_WINDOW_PRIV_PRIV(pDbeWindowPriv) \ - (!(pDbeWindowPriv) ? NULL : (MiDbeWindowPrivPrivPtr) \ - dixLookupPrivate(&(pDbeWindowPriv)->devPrivates, miDbeWindowPrivPrivKey)) - -#define MI_DBE_WINDOW_PRIV_PRIV_FROM_WINDOW(pWin)\ - MI_DBE_WINDOW_PRIV_PRIV(DBE_WINDOW_PRIV(pWin)) - -/* TYPEDEFS */ - -typedef struct _MiDbeWindowPrivPrivRec { - /* Place machine-specific fields in here. - * Since this is mi code, we do not really have machine-specific fields. - */ - - /* Pointer to a drawable that contains the contents of the back buffer. - */ - PixmapPtr pBackBuffer; - - /* Pointer to a drawable that contains the contents of the front buffer. - * This pointer is only used for the XdbeUntouched swap action. For that - * swap action, we need to copy the front buffer (window) contents into - * this drawable, copy the contents of current back buffer drawable (the - * back buffer) into the window, swap the front and back drawable pointers, - * and then swap the drawable/resource associations in the resource - * database. - */ - PixmapPtr pFrontBuffer; - - /* Pointer back to our window private with which we are associated. */ - DbeWindowPrivPtr pDbeWindowPriv; - -} MiDbeWindowPrivPrivRec, *MiDbeWindowPrivPrivPtr; - -#endif /* MIDBE_STRUCT_H */ diff --git a/xorg-server/dix/cursor.c b/xorg-server/dix/cursor.c index cd8305c6c..8cc54bd1f 100644 --- a/xorg-server/dix/cursor.c +++ b/xorg-server/dix/cursor.c @@ -71,9 +71,7 @@ static GlyphSharePtr sharedGlyphs = (GlyphSharePtr) NULL; DevScreenPrivateKeyRec cursorScreenDevPriv; -#ifdef XFIXES static CARD32 cursorSerial; -#endif static void FreeCursorBits(CursorBitsPtr bits) @@ -272,10 +270,8 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits, bits->refcnt = -1; CheckForEmptyMask(bits); pCurs->bits = bits; -#ifdef XFIXES pCurs->serialNumber = ++cursorSerial; pCurs->name = None; -#endif pCurs->foreRed = foreRed; pCurs->foreGreen = foreGreen; @@ -433,10 +429,8 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, CheckForEmptyMask(bits); pCurs->bits = bits; pCurs->refcnt = 1; -#ifdef XFIXES pCurs->serialNumber = ++cursorSerial; pCurs->name = None; -#endif pCurs->foreRed = foreRed; pCurs->foreGreen = foreGreen; diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c index f37b5d71f..b2ca29f10 100644..100755 --- a/xorg-server/dix/dispatch.c +++ b/xorg-server/dix/dispatch.c @@ -2020,7 +2020,7 @@ ProcPutImage(ClientPtr client) static int
DoGetImage(ClientPtr client, int format, Drawable drawable,
int x, int y, int width, int height,
- Mask planemask, xGetImageReply ** im_return)
+ Mask planemask)
{
DrawablePtr pDraw, pBoundingDraw;
int nlines, linesPerBuf, rc;
@@ -2120,46 +2120,32 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, xgi.length = length;
- if (im_return) {
- pBuf = calloc(1, sz_xGetImageReply + length);
- if (!pBuf)
- return BadAlloc;
- if (widthBytesLine == 0)
- linesPerBuf = 0;
- else
+ xgi.length = bytes_to_int32(xgi.length);
+ if (widthBytesLine == 0 || height == 0)
+ linesPerBuf = 0;
+ else if (widthBytesLine >= IMAGE_BUFSIZE)
+ linesPerBuf = 1;
+ else {
+ linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
+ if (linesPerBuf > height)
linesPerBuf = height;
- *im_return = (xGetImageReply *) pBuf;
- *(xGetImageReply *) pBuf = xgi;
- pBuf += sz_xGetImageReply;
}
- else {
- xgi.length = bytes_to_int32(xgi.length);
- if (widthBytesLine == 0 || height == 0)
- linesPerBuf = 0;
- else if (widthBytesLine >= IMAGE_BUFSIZE)
- linesPerBuf = 1;
- else {
- linesPerBuf = IMAGE_BUFSIZE / widthBytesLine;
- if (linesPerBuf > height)
- linesPerBuf = height;
+ length = linesPerBuf * widthBytesLine;
+ if (linesPerBuf < height) {
+ /* we have to make sure intermediate buffers don't need padding */
+ while ((linesPerBuf > 1) &&
+ (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
+ linesPerBuf--;
+ length -= widthBytesLine;
}
- length = linesPerBuf * widthBytesLine;
- if (linesPerBuf < height) {
- /* we have to make sure intermediate buffers don't need padding */
- while ((linesPerBuf > 1) &&
- (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1))) {
- linesPerBuf--;
- length -= widthBytesLine;
- }
- while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
- linesPerBuf++;
- length += widthBytesLine;
- }
+ while (length & ((1L << LOG2_BYTES_PER_SCANLINE_PAD) - 1)) {
+ linesPerBuf++;
+ length += widthBytesLine;
}
- if (!(pBuf = calloc(1, length)))
- return BadAlloc;
- WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
}
+ if (!(pBuf = calloc(1, length)))
+ return BadAlloc;
+ WriteReplyToClient(client, sizeof(xGetImageReply), &xgi);
if (pDraw->type == DRAWABLE_WINDOW) {
pVisibleRegion = NotClippedByChildren((WindowPtr) pDraw);
@@ -2188,13 +2174,10 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, /* Note that this is NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
- if (!im_return) {
- ReformatImage(pBuf, (int) (nlines * widthBytesLine),
- BitsPerPixel(pDraw->depth), ClientOrder(client));
+ ReformatImage(pBuf, (int) (nlines * widthBytesLine),
+ BitsPerPixel(pDraw->depth), ClientOrder(client));
-/* Don't split me, gcc pukes when you do */
- WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
- }
+ WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
linesDone += nlines;
}
}
@@ -2219,18 +2202,10 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, /* Note: NOT a call to WriteSwappedDataToClient,
as we do NOT byte swap */
- if (im_return) {
- pBuf += nlines * widthBytesLine;
- }
- else {
- ReformatImage(pBuf,
- (int) (nlines * widthBytesLine),
- 1, ClientOrder(client));
-
-/* Don't split me, gcc pukes when you do */
- WriteToClient(client, (int) (nlines * widthBytesLine),
- pBuf);
- }
+ ReformatImage(pBuf, (int) (nlines * widthBytesLine),
+ 1, ClientOrder(client));
+
+ WriteToClient(client, (int)(nlines * widthBytesLine), pBuf);
linesDone += nlines;
}
}
@@ -2238,8 +2213,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable, }
if (pVisibleRegion)
RegionDestroy(pVisibleRegion);
- if (!im_return)
- free(pBuf);
+ free(pBuf);
return Success;
}
@@ -2253,7 +2227,7 @@ ProcGetImage(ClientPtr client) return DoGetImage(client, stuff->format, stuff->drawable,
stuff->x, stuff->y,
(int) stuff->width, (int) stuff->height,
- stuff->planeMask, (xGetImageReply **) NULL);
+ stuff->planeMask);
}
int
diff --git a/xorg-server/dix/pixmap.c b/xorg-server/dix/pixmap.c index fe9214739..d5dc3831b 100644 --- a/xorg-server/dix/pixmap.c +++ b/xorg-server/dix/pixmap.c @@ -202,7 +202,6 @@ PixmapStopDirtyTracking(PixmapPtr src, PixmapPtr slave_dst) xorg_list_for_each_entry_safe(ent, safe, &screen->pixmap_dirty_list, ent) { if (ent->src == src && ent->slave_dst == slave_dst) { - DamageUnregister(&src->drawable, ent->damage); DamageDestroy(ent->damage); xorg_list_del(&ent->ent); free(ent); diff --git a/xorg-server/dix/privates.c b/xorg-server/dix/privates.c index 6f03bbcdb..f9b45d816 100644..100755 --- a/xorg-server/dix/privates.c +++ b/xorg-server/dix/privates.c @@ -80,7 +80,6 @@ static const Bool xselinux_private[PRIVATE_LAST] = { /* [PRIVATE_GC] =*/ TRUE, /* [PRIVATE_CURSOR] =*/ TRUE, /* PRIVATE_CURSOR_BITS,*/ FALSE, - /* PRIVATE_DBE_WINDOW,*/ FALSE, /* PRIVATE_DAMAGE,*/ FALSE, /* PRIVATE_GLYPH,*/ FALSE, /* [PRIVATE_GLYPHSET] =*/ TRUE, @@ -110,7 +109,6 @@ static const char *key_names[PRIVATE_LAST] = { /*[PRIVATE_CURSOR_BITS] =*/ "CURSOR_BITS", /* extension privates */ - /*[PRIVATE_DBE_WINDOW] =*/ "DBE_WINDOW", /*[PRIVATE_DAMAGE] =*/ "DAMAGE", /*[PRIVATE_GLYPH] =*/ "GLYPH", /*[PRIVATE_GLYPHSET] =*/ "GLYPHSET", @@ -132,7 +130,6 @@ static const Bool screen_specific_private[PRIVATE_LAST] = { /*[PRIVATE_GC] =*/ TRUE, /*[PRIVATE_CURSOR] =*/ FALSE, /*[PRIVATE_CURSOR_BITS] =*/ FALSE, - /*[PRIVATE_DBE_WINDOW] =*/ FALSE, /*[PRIVATE_DAMAGE] =*/ FALSE, /*[PRIVATE_GLYPH] =*/ FALSE, /*[PRIVATE_GLYPHSET] =*/ FALSE, @@ -313,7 +310,6 @@ static Bool (*const allocated_early[PRIVATE_LAST]) (FixupFunc, unsigned) = { /*PRIVATE_GC,*/ NULL, /*PRIVATE_CURSOR,*/ NULL, /*PRIVATE_CURSOR_BITS,*/ NULL, - /*PRIVATE_DBE_WINDOW,*/ NULL, /*PRIVATE_DAMAGE,*/ NULL, /*PRIVATE_GLYPH,*/ NULL, /*PRIVATE_GLYPHSET,*/ NULL, diff --git a/xorg-server/dix/window.c b/xorg-server/dix/window.c index c97d04293..804b54c32 100644 --- a/xorg-server/dix/window.c +++ b/xorg-server/dix/window.c @@ -2850,11 +2850,9 @@ HandleSaveSet(ClientPtr client) for (j = 0; j < client->numSaved; j++) { pWin = SaveSetWindow(client->saveSet[j]); -#ifdef XFIXES if (SaveSetToRoot(client->saveSet[j])) pParent = pWin->drawable.pScreen->root; else -#endif { pParent = pWin->parent; while (pParent && (wClient(pParent) == client)) @@ -2862,11 +2860,9 @@ HandleSaveSet(ClientPtr client) } if (pParent) { if (pParent != pWin->parent) { -#ifdef XFIXES /* unmap first so that ReparentWindow doesn't remap */ if (!SaveSetShouldMap(client->saveSet[j])) UnmapWindow(pWin, FALSE); -#endif ReparentWindow(pWin, pParent, pWin->drawable.x - wBorderWidth(pWin) - pParent->drawable.x, @@ -2875,9 +2871,7 @@ HandleSaveSet(ClientPtr client) if (!pWin->realized && pWin->mapped) pWin->mapped = FALSE; } -#ifdef XFIXES if (SaveSetShouldMap(client->saveSet[j])) -#endif MapWindow(pWin, client); } } diff --git a/xorg-server/exa/exa_classic.c b/xorg-server/exa/exa_classic.c index 1fa534bc6..0fa422fcd 100644 --- a/xorg-server/exa/exa_classic.c +++ b/xorg-server/exa/exa_classic.c @@ -192,7 +192,6 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height, * gpu memory, so there's no need to track damage. */ if (pExaPixmap->pDamage) { - DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); DamageDestroy(pExaPixmap->pDamage); pExaPixmap->pDamage = NULL; } diff --git a/xorg-server/exa/exa_migration_mixed.c b/xorg-server/exa/exa_migration_mixed.c index 445c4fcbf..5e0bf152a 100644 --- a/xorg-server/exa/exa_migration_mixed.c +++ b/xorg-server/exa/exa_migration_mixed.c @@ -190,7 +190,6 @@ exaPrepareAccessReg_mixed(PixmapPtr pPixmap, int index, RegionPtr pReg) * copy anymore. Drivers that prefer DFS, should fail prepare * access. */ - DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); DamageDestroy(pExaPixmap->pDamage); pExaPixmap->pDamage = NULL; diff --git a/xorg-server/exa/exa_mixed.c b/xorg-server/exa/exa_mixed.c index 0fb409102..3e2dcf263 100644 --- a/xorg-server/exa/exa_mixed.c +++ b/xorg-server/exa/exa_mixed.c @@ -139,7 +139,6 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, if (pPixData) { if (pExaPixmap->driverPriv) { if (pExaPixmap->pDamage) { - DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); DamageDestroy(pExaPixmap->pDamage); pExaPixmap->pDamage = NULL; } @@ -189,7 +188,6 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth, if (pExaPixmap->sys_ptr) { free(pExaPixmap->sys_ptr); pExaPixmap->sys_ptr = NULL; - DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage); DamageDestroy(pExaPixmap->pDamage); pExaPixmap->pDamage = NULL; RegionEmpty(&pExaPixmap->validSys); diff --git a/xorg-server/fb/fb.h b/xorg-server/fb/fb.h index 248e9d86e..26957df4c 100644 --- a/xorg-server/fb/fb.h +++ b/xorg-server/fb/fb.h @@ -1111,17 +1111,6 @@ fbInitVisuals(VisualPtr * visualp, * fbcopy.c */ -/* Compatibility definition, to be removed at next ABI change. */ -typedef void (*fbCopyProc) (DrawablePtr pSrcDrawable, - DrawablePtr pDstDrawable, - GCPtr pGC, - BoxPtr pDstBox, - int nbox, - int dx, - int dy, - Bool reverse, - Bool upsidedown, Pixel bitplane, void *closure); - extern _X_EXPORT void fbCopyNtoN(DrawablePtr pSrcDrawable, diff --git a/xorg-server/glx/glxcmds.c b/xorg-server/glx/glxcmds.c index d5d14b7a6..f2e3fede0 100644..100755 --- a/xorg-server/glx/glxcmds.c +++ b/xorg-server/glx/glxcmds.c @@ -51,6 +51,8 @@ #include "indirect_table.h" #include "indirect_util.h" +static char GLXServerVendorName[] = "SGI"; + _X_HIDDEN int validGlxScreen(ClientPtr client, int screen, __GLXscreen ** pGlxScreen, int *err) @@ -1039,7 +1041,7 @@ __glXDisp_GetVisualConfigs(__GLXclientState * cl, GLbyte * pc) return Success; } -#define __GLX_TOTAL_FBCONFIG_ATTRIBS (37) +#define __GLX_TOTAL_FBCONFIG_ATTRIBS (44) #define __GLX_FBCONFIG_ATTRIBS_LENGTH (__GLX_TOTAL_FBCONFIG_ATTRIBS * 2) /** * Send the set of GLXFBConfigs to the client. There is not currently @@ -1124,13 +1126,23 @@ DoGetFBConfigs(__GLXclientState * cl, unsigned screen) WRITE_PAIR(GLX_SWAP_METHOD_OML, modes->swapMethod); WRITE_PAIR(GLX_SAMPLES_SGIS, modes->samples); WRITE_PAIR(GLX_SAMPLE_BUFFERS_SGIS, modes->sampleBuffers); - /* GLX_VISUAL_SELECT_GROUP_SGIX ? */ + WRITE_PAIR(GLX_VISUAL_SELECT_GROUP_SGIX, modes->visualSelectGroup); WRITE_PAIR(GLX_DRAWABLE_TYPE, modes->drawableType); WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGB_EXT, modes->bindToTextureRgb); WRITE_PAIR(GLX_BIND_TO_TEXTURE_RGBA_EXT, modes->bindToTextureRgba); WRITE_PAIR(GLX_BIND_TO_MIPMAP_TEXTURE_EXT, modes->bindToMipmapTexture); WRITE_PAIR(GLX_BIND_TO_TEXTURE_TARGETS_EXT, modes->bindToTextureTargets); + WRITE_PAIR(GLX_Y_INVERTED_EXT, modes->yInverted); + if (modes->drawableType & GLX_PBUFFER_BIT) { + WRITE_PAIR(GLX_MAX_PBUFFER_WIDTH, modes->maxPbufferWidth); + WRITE_PAIR(GLX_MAX_PBUFFER_HEIGHT, modes->maxPbufferHeight); + WRITE_PAIR(GLX_MAX_PBUFFER_PIXELS, modes->maxPbufferPixels); + WRITE_PAIR(GLX_OPTIMAL_PBUFFER_WIDTH_SGIX, + modes->optimalPbufferWidth); + WRITE_PAIR(GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX, + modes->optimalPbufferHeight); + } /* Add attribute only if its value is not default. */ if (modes->sRGBCapable != GL_FALSE) { WRITE_PAIR(GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, modes->sRGBCapable); @@ -1427,6 +1439,8 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, width, height, config->rgbBits, 0); __glXleaveServer(GL_FALSE); + if (!pPixmap) + return BadAlloc; /* Assign the pixmap the same id as the pbuffer and add it as a * resource so it and the DRI2 drawable will be reclaimed when the @@ -1468,7 +1482,6 @@ __glXDisp_CreatePbuffer(__GLXclientState * cl, GLbyte * pc) height = attrs[i * 2 + 1]; break; case GLX_LARGEST_PBUFFER: - case GLX_PRESERVED_CONTENTS: /* FIXME: huh... */ break; } @@ -1486,6 +1499,10 @@ __glXDisp_CreateGLXPbufferSGIX(__GLXclientState * cl, GLbyte * pc) REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq); + /* + * We should really handle attributes correctly, but this extension + * is so rare I have difficulty caring. + */ return DoCreatePbuffer(cl->client, req->screen, req->fbconfig, req->width, req->height, req->pbuffer); } @@ -1693,15 +1710,14 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId) ClientPtr client = cl->client; __GLXcontext *ctx; xGLXQueryContextInfoEXTReply reply; - int nProps; - int *sendBuf, *pSendBuf; + #define nProps 3 + int sendBuf[nProps * 2]; int nReplyBytes; int err; if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err)) return err; - nProps = 3; reply.type = X_Reply; reply.sequenceNumber = client->sequence; @@ -1710,17 +1726,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId) nReplyBytes = reply.length << 2; - sendBuf = (int *) malloc((size_t) nReplyBytes); - if (sendBuf == NULL) { - return __glXError(GLXBadContext); /* XXX: Is this correct? */ - } - pSendBuf = sendBuf; - *pSendBuf++ = GLX_SHARE_CONTEXT_EXT; - *pSendBuf++ = (int) (ctx->share_id); - *pSendBuf++ = GLX_VISUAL_ID_EXT; - *pSendBuf++ = (int) (ctx->config->visualID); - *pSendBuf++ = GLX_SCREEN_EXT; - *pSendBuf++ = (int) (ctx->pGlxScreen->pScreen->myNum); + sendBuf[0] = GLX_SHARE_CONTEXT_EXT; + sendBuf[1] = (int) (ctx->share_id); + sendBuf[2] = GLX_VISUAL_ID_EXT; + sendBuf[3] = (int) (ctx->config->visualID); + sendBuf[4] = GLX_SCREEN_EXT; + sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum); if (client->swapped) { __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf); @@ -1729,7 +1740,6 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId) WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply); WriteToClient(client, nReplyBytes, sendBuf); } - free((char *) sendBuf); return Success; } @@ -1903,28 +1913,44 @@ DoGetDrawableAttributes(__GLXclientState * cl, XID drawId) ClientPtr client = cl->client; xGLXGetDrawableAttributesReply reply; __GLXdrawable *pGlxDraw; - CARD32 attributes[6]; - int numAttribs, error; + CARD32 attributes[14]; + int numAttribs = 0, error; if (!validGlxDrawable(client, drawId, GLX_DRAWABLE_ANY, DixGetAttrAccess, &pGlxDraw, &error)) return error; - numAttribs = 3; - - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - reply.length = numAttribs << 1; - reply.numAttribs = numAttribs; - - attributes[0] = GLX_TEXTURE_TARGET_EXT; attributes[1] = pGlxDraw->target == GL_TEXTURE_2D ? GLX_TEXTURE_2D_EXT : GLX_TEXTURE_RECTANGLE_EXT; + numAttribs++; attributes[2] = GLX_Y_INVERTED_EXT; attributes[3] = GL_FALSE; + numAttribs++; attributes[4] = GLX_EVENT_MASK; attributes[5] = pGlxDraw->eventMask; + numAttribs++; + attributes[6] = GLX_WIDTH; + attributes[7] = pGlxDraw->pDraw->width; + numAttribs++; + attributes[8] = GLX_HEIGHT; + attributes[9] = pGlxDraw->pDraw->height; + numAttribs++; + attributes[10] = GLX_FBCONFIG_ID; + attributes[11] = pGlxDraw->config->fbconfigID; + numAttribs++; + if (pGlxDraw->type == GLX_DRAWABLE_PBUFFER) { + attributes[12] = GLX_PRESERVED_CONTENTS; + attributes[13] = GL_TRUE; + numAttribs++; + } + + + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = numAttribs << 1; + reply.numAttribs = numAttribs; + if (client->swapped) { __glXSwapGetDrawableAttributesReply(client, &reply, attributes); @@ -2173,15 +2199,12 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc) ** Make enough space in the buffer, then copy the entire request. */ if (cl->largeCmdBufSize < cmdlen) { - if (!cl->largeCmdBuf) { - cl->largeCmdBuf = (GLbyte *) malloc(cmdlen); - } - else { - cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen); - } - if (!cl->largeCmdBuf) { - return BadAlloc; - } + GLbyte *newbuf = cl->largeCmdBuf; + + if (!(newbuf = realloc(newbuf, cmdlen))) + return BadAlloc; + + cl->largeCmdBuf = newbuf; cl->largeCmdBufSize = cmdlen; } memcpy(cl->largeCmdBuf, pc, dataBytes); @@ -2397,7 +2420,7 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc) switch (req->name) { case GLX_VENDOR: - ptr = pGlxScreen->GLXvendor; + ptr = GLXServerVendorName; break; case GLX_VERSION: /* Return to the server version rather than the screen version diff --git a/xorg-server/glx/glxcontext.h b/xorg-server/glx/glxcontext.h index 4764e56f5..3d08c9929 100644 --- a/xorg-server/glx/glxcontext.h +++ b/xorg-server/glx/glxcontext.h @@ -55,7 +55,6 @@ struct __GLXcontext { /* ** list of context structs */ - __GLXcontext *last; __GLXcontext *next; /* diff --git a/xorg-server/glx/glxdri2.c b/xorg-server/glx/glxdri2.c index 8a1fa4159..f662b2188 100644 --- a/xorg-server/glx/glxdri2.c +++ b/xorg-server/glx/glxdri2.c @@ -941,8 +941,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) if (screen == NULL) return NULL; - if (!xf86LoaderCheckSymbol("DRI2Connect") || - !DRI2Connect(serverClient, pScreen, DRI2DriverDRI, + if (!DRI2Connect(serverClient, pScreen, DRI2DriverDRI, &screen->fd, &driverName, &deviceName)) { LogMessage(X_INFO, "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum); diff --git a/xorg-server/glx/glxext.c b/xorg-server/glx/glxext.c index 01597849e..e690044a4 100644 --- a/xorg-server/glx/glxext.c +++ b/xorg-server/glx/glxext.c @@ -295,10 +295,6 @@ glxClientCallback(CallbackListPtr *list, pointer closure, pointer data) switch (pClient->clientState) { case ClientStateRunning: - /* - ** By default, assume that the client supports - ** GLX major version 1 minor version 0 protocol. - */ cl->client = pClient; break; diff --git a/xorg-server/glx/glxscreens.c b/xorg-server/glx/glxscreens.c index 2d9178121..4ab84ef09 100644 --- a/xorg-server/glx/glxscreens.c +++ b/xorg-server/glx/glxscreens.c @@ -132,7 +132,6 @@ static const char GLServerExtensions[] = "GL_NV_blend_square " "GL_NV_depth_clamp " "GL_NV_fog_distance " - "GL_NV_fragment_program " "GL_NV_fragment_program_option " "GL_NV_fragment_program2 " "GL_NV_light_max_exponent " @@ -143,9 +142,6 @@ static const char GLServerExtensions[] = "GL_NV_texture_env_combine4 " "GL_NV_texture_expand_normal " "GL_NV_texture_rectangle " - "GL_NV_vertex_program " - "GL_NV_vertex_program1_1 " - "GL_NV_vertex_program2 " "GL_NV_vertex_program2_option " "GL_NV_vertex_program3 " "GL_OES_compressed_paletted_texture " @@ -158,13 +154,14 @@ static const char GLServerExtensions[] = "GL_SGIS_texture_edge_clamp " "GL_SGIS_texture_lod " "GL_SGIX_depth_texture " - "GL_SGIX_shadow " "GL_SGIX_shadow_ambient " "GL_SUN_slice_accum "; + "GL_SGIX_shadow " + "GL_SGIX_shadow_ambient " + "GL_SUN_slice_accum "; /* ** We have made the simplifying assuption that the same extensions are ** supported across all screens in a multi-screen system. */ -static char GLXServerVendorName[] = "SGI"; unsigned glxMajorVersion = SERVER_GLX_MAJOR_VERSION; unsigned glxMinorVersion = SERVER_GLX_MINOR_VERSION; static char GLXServerExtensions[] = @@ -173,12 +170,14 @@ static char GLXServerExtensions[] = "GLX_EXT_visual_rating " "GLX_EXT_import_context " "GLX_EXT_texture_from_pixmap " - "GLX_OML_swap_method " "GLX_SGI_make_current_read " + "GLX_OML_swap_method " + "GLX_SGI_make_current_read " #ifndef __APPLE__ "GLX_SGIS_multisample " #endif "GLX_SGIX_fbconfig " - "GLX_SGIX_pbuffer " "GLX_MESA_copy_sub_buffer "; + "GLX_SGIX_pbuffer " + "GLX_MESA_copy_sub_buffer "; static Bool glxCloseScreen(ScreenPtr pScreen) @@ -334,7 +333,6 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen) pGlxScreen->pScreen = pScreen; pGlxScreen->GLextensions = strdup(GLServerExtensions); - pGlxScreen->GLXvendor = strdup(GLXServerVendorName); pGlxScreen->GLXextensions = strdup(GLXServerExtensions); /* All GLX providers must support all of the functionality required for at @@ -424,7 +422,6 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen) void __glXScreenDestroy(__GLXscreen * screen) { - free(screen->GLXvendor); free(screen->GLXextensions); free(screen->GLextensions); free(screen->visuals); diff --git a/xorg-server/glx/glxscreens.h b/xorg-server/glx/glxscreens.h index 0a7b6043e..c8119fd21 100644 --- a/xorg-server/glx/glxscreens.h +++ b/xorg-server/glx/glxscreens.h @@ -54,8 +54,6 @@ struct __GLXconfig { GLint level; - GLint pixmapMode; - /* GLX */ GLint visualID; GLint visualType; /**< One of the GLX X visual types. (i.e., @@ -94,8 +92,6 @@ struct __GLXconfig { /* OML_swap_method */ GLint swapMethod; - GLint screen; - /* EXT_texture_from_pixmap */ GLint bindToTextureRgb; GLint bindToTextureRgba; @@ -145,7 +141,6 @@ struct __GLXscreen { char *GLextensions; - char *GLXvendor; char *GLXextensions; /** diff --git a/xorg-server/hw/dmx/Makefile.am b/xorg-server/hw/dmx/Makefile.am index fb727e656..a05af139e 100644 --- a/xorg-server/hw/dmx/Makefile.am +++ b/xorg-server/hw/dmx/Makefile.am @@ -56,8 +56,6 @@ Xdmx_SOURCES = dmx.c \ dmxprop.h \ dmxscrinit.c \ dmxscrinit.h \ - dmxshadow.c \ - dmxshadow.h \ dmxstat.c \ dmxstat.h \ dmxsync.c \ diff --git a/xorg-server/hw/dmx/dmx.h b/xorg-server/hw/dmx/dmx.h index f0cb04459..7242e4380 100644 --- a/xorg-server/hw/dmx/dmx.h +++ b/xorg-server/hw/dmx/dmx.h @@ -254,10 +254,6 @@ typedef struct _DMXScreenInfo { /* Global variables available to all Xserver/hw/dmx routines. */ extern int dmxNumScreens; /**< Number of dmxScreens */ extern DMXScreenInfo *dmxScreens; /**< List of outputs */ -extern int dmxShadowFB; /**< Non-zero if using - - * shadow frame-buffer - * (deprecated) */ extern XErrorEvent dmxLastErrorEvent; /**< Last error that * occurred */ diff --git a/xorg-server/hw/dmx/dmxcursor.c b/xorg-server/hw/dmx/dmxcursor.c index 35aca81b4..70f2bc4b4 100644 --- a/xorg-server/hw/dmx/dmxcursor.c +++ b/xorg-server/hw/dmx/dmxcursor.c @@ -197,8 +197,6 @@ miPointerScreenFuncRec dmxPointerCursorFuncs = { dmxCursorOffScreen, dmxCrossScreen, dmxWarpCursor, - NULL, - NULL, }; /** Create a list of screens that we'll manipulate. */ diff --git a/xorg-server/hw/dmx/dmxinit.c b/xorg-server/hw/dmx/dmxinit.c index ec8a59e0d..0cc56ebe2 100644 --- a/xorg-server/hw/dmx/dmxinit.c +++ b/xorg-server/hw/dmx/dmxinit.c @@ -82,8 +82,6 @@ DMXScreenInfo *dmxScreens; int dmxNumInputs; DMXInputInfo *dmxInputs; -int dmxShadowFB = FALSE; - XErrorEvent dmxLastErrorEvent; Bool dmxErrorOccurred = FALSE; @@ -854,9 +852,6 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[]) /* Initialized things that need timer hooks */ dmxStatInit(); dmxSyncInit(); /* Calls RegisterBlockAndWakeupHandlers */ - - dmxLog(dmxInfo, "Shadow framebuffer support %s\n", - dmxShadowFB ? "enabled" : "disabled"); } /* RATS: Assuming the fp string (which comes from the command-line argv @@ -952,10 +947,6 @@ ddxProcessArgument(int argc, char *argv[], int i) retval = 2; } else if (!strcmp(argv[i], "-noshadowfb")) { - dmxLog(dmxWarning, - "-noshadowfb has been deprecated " - "since it is now the default\n"); - dmxShadowFB = FALSE; retval = 1; } else if (!strcmp(argv[i], "-nomulticursor")) { @@ -963,7 +954,6 @@ ddxProcessArgument(int argc, char *argv[], int i) retval = 1; } else if (!strcmp(argv[i], "-shadowfb")) { - dmxShadowFB = TRUE; retval = 1; } else if (!strcmp(argv[i], "-configfile")) { diff --git a/xorg-server/hw/dmx/dmxpict.c b/xorg-server/hw/dmx/dmxpict.c index b1177cf41..c9762c2f1 100644 --- a/xorg-server/hw/dmx/dmxpict.c +++ b/xorg-server/hw/dmx/dmxpict.c @@ -141,10 +141,6 @@ dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; PictureScreenPtr ps; - /* The shadow framebuffer only relies on FB to be initialized */ - if (dmxShadowFB) - return fbPictureInit(pScreen, formats, nformats); - if (!miPictureInit(pScreen, formats, nformats)) return FALSE; diff --git a/xorg-server/hw/dmx/dmxscrinit.c b/xorg-server/hw/dmx/dmxscrinit.c index 849ef16a1..963d3a9de 100644 --- a/xorg-server/hw/dmx/dmxscrinit.c +++ b/xorg-server/hw/dmx/dmxscrinit.c @@ -41,7 +41,6 @@ #include "dmx.h" #include "dmxsync.h" -#include "dmxshadow.h" #include "dmxscrinit.h" #include "dmxcursor.h" #include "dmxgc.h" @@ -159,37 +158,18 @@ dmxBEScreenInit(ScreenPtr pScreen) XMapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); - if (dmxShadowFB) { - mask = (GCFunction | GCPlaneMask | GCClipMask); - gcvals.function = GXcopy; - gcvals.plane_mask = AllPlanes; - gcvals.clip_mask = None; - - dmxScreen->shadowGC = XCreateGC(dmxScreen->beDisplay, - dmxScreen->scrnWin, mask, &gcvals); - - dmxScreen->shadowFBImage = - XCreateImage(dmxScreen->beDisplay, - dmxScreen->beVisuals[dmxScreen->beDefVisualIndex]. - visual, dmxScreen->beDepth, ZPixmap, 0, - (char *) dmxScreen->shadow, dmxScreen->scrnWidth, - dmxScreen->scrnHeight, dmxScreen->beBPP, - PixmapBytePad(dmxScreen->scrnWidth, dmxScreen->beBPP)); - } - else { - /* Create default drawables (used during GC creation) */ - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) - for (j = 0; j < dmxScreen->beNumDepths; j++) - if ((dmxScreen->bePixmapFormats[i].depth == 1) || - (dmxScreen->bePixmapFormats[i].depth == - dmxScreen->beDepths[j])) { - dmxScreen->scrnDefDrawables[i] = (Drawable) - XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin, - 1, 1, - dmxScreen->bePixmapFormats[i].depth); - break; - } - } + /* Create default drawables (used during GC creation) */ + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) + for (j = 0; j < dmxScreen->beNumDepths; j++) + if ((dmxScreen->bePixmapFormats[i].depth == 1) || + (dmxScreen->bePixmapFormats[i].depth == + dmxScreen->beDepths[j])) { + dmxScreen->scrnDefDrawables[i] = (Drawable) + XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin, + 1, 1, + dmxScreen->bePixmapFormats[i].depth); + break; + } } /** Initialize screen number \a pScreen->myNum. */ @@ -215,19 +195,12 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[]) dmxGeneration = serverGeneration; } - if (dmxShadowFB) { - dmxScreen->shadow = shadowAlloc(dmxScreen->scrnWidth, - dmxScreen->scrnHeight, - dmxScreen->beBPP); - } - else { - if (!dmxInitGC(pScreen)) - return FALSE; - if (!dmxInitWindow(pScreen)) - return FALSE; - if (!dmxInitPixmap(pScreen)) - return FALSE; - } + if (!dmxInitGC(pScreen)) + return FALSE; + if (!dmxInitWindow(pScreen)) + return FALSE; + if (!dmxInitPixmap(pScreen)) + return FALSE; /* * Initalise the visual types. miSetVisualTypesAndMasks() requires @@ -267,7 +240,7 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[]) } fbScreenInit(pScreen, - dmxShadowFB ? dmxScreen->shadow : NULL, + NULL, dmxScreen->scrnWidth, dmxScreen->scrnHeight, dmxScreen->beXDPI, @@ -278,22 +251,14 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[]) pScreen->GetWindowPixmap = NULL; pScreen->SetWindowPixmap = NULL; - if (dmxShadowFB && !shadowInit(pScreen, dmxShadowUpdateProc, NULL)) - return FALSE; + MAXSCREENSALLOC(dmxCursorGeneration); + if (dmxCursorGeneration[pScreen->myNum] != serverGeneration) { + if (!(miPointerInitialize(pScreen, + &dmxPointerSpriteFuncs, + &dmxPointerCursorFuncs, FALSE))) + return FALSE; - if (dmxShadowFB) { - miDCInitialize(pScreen, &dmxPointerCursorFuncs); - } - else { - MAXSCREENSALLOC(dmxCursorGeneration); - if (dmxCursorGeneration[pScreen->myNum] != serverGeneration) { - if (!(miPointerInitialize(pScreen, - &dmxPointerSpriteFuncs, - &dmxPointerCursorFuncs, FALSE))) - return FALSE; - - dmxCursorGeneration[pScreen->myNum] = serverGeneration; - } + dmxCursorGeneration[pScreen->myNum] = serverGeneration; } DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen); @@ -301,49 +266,47 @@ dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[]) dmxBEScreenInit(pScreen); - if (!dmxShadowFB) { - /* Wrap GC functions */ - DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen); - - /* Wrap Window functions */ - DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen); - DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen); - DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen); - DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen, - pScreen); - DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen); - DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen); - DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen); - DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen); - DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen); - - DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen); - DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen); - - DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen); - - /* Wrap Image functions */ - DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen); - DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen); - - /* Wrap Pixmap functions */ - DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen); - DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen); - DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen); - - /* Wrap Font functions */ - DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen); - DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen); - - /* Wrap Colormap functions */ - DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen); - DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen); - DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen); - DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen); - - /* Wrap Shape functions */ - DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen); - } + /* Wrap GC functions */ + DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen); + + /* Wrap Window functions */ + DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen); + DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen); + DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen); + DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen, + pScreen); + DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen); + DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen); + DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen); + DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen); + DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen); + + DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen); + DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen); + + DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen); + + /* Wrap Image functions */ + DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen); + DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen); + + /* Wrap Pixmap functions */ + DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen); + DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen); + DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen); + + /* Wrap Font functions */ + DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen); + DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen); + + /* Wrap Colormap functions */ + DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen); + DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen); + DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen); + DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen); + + /* Wrap Shape functions */ + DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen); if (!dmxCreateDefColormap(pScreen)) return FALSE; @@ -370,22 +333,13 @@ dmxBECloseScreen(ScreenPtr pScreen) XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); dmxScreen->scrnWin = (Window) 0; - if (dmxShadowFB) { - /* Free the shadow GC and image assocated with the back-end server */ - XFreeGC(dmxScreen->beDisplay, dmxScreen->shadowGC); - dmxScreen->shadowGC = NULL; - XFree(dmxScreen->shadowFBImage); - dmxScreen->shadowFBImage = NULL; - } - else { - /* Free the default drawables */ - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { - if (dmxScreen->scrnDefDrawables[i]) { - XFreePixmap(dmxScreen->beDisplay, - dmxScreen->scrnDefDrawables[i]); - dmxScreen->scrnDefDrawables[i] = (Drawable) 0; - } - } + /* Free the default drawables */ + for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { + if (dmxScreen->scrnDefDrawables[i]) { + XFreePixmap(dmxScreen->beDisplay, + dmxScreen->scrnDefDrawables[i]); + dmxScreen->scrnDefDrawables[i] = (Drawable) 0; + } } /* Free resources allocated during initialization (in dmxinit.c) */ @@ -432,48 +386,41 @@ dmxCloseScreen(ScreenPtr pScreen) dmxResetFonts(); } - if (dmxShadowFB) { - /* Free the shadow framebuffer */ - free(dmxScreen->shadow); - } - else { - - /* Unwrap Shape functions */ - DMX_UNWRAP(SetShape, dmxScreen, pScreen); + /* Unwrap Shape functions */ + DMX_UNWRAP(SetShape, dmxScreen, pScreen); - /* Unwrap the pScreen functions */ - DMX_UNWRAP(CreateGC, dmxScreen, pScreen); + /* Unwrap the pScreen functions */ + DMX_UNWRAP(CreateGC, dmxScreen, pScreen); - DMX_UNWRAP(CreateWindow, dmxScreen, pScreen); - DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen); - DMX_UNWRAP(PositionWindow, dmxScreen, pScreen); - DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen); - DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen); - DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen); - DMX_UNWRAP(RestackWindow, dmxScreen, pScreen); - DMX_UNWRAP(WindowExposures, dmxScreen, pScreen); - DMX_UNWRAP(CopyWindow, dmxScreen, pScreen); + DMX_UNWRAP(CreateWindow, dmxScreen, pScreen); + DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen); + DMX_UNWRAP(PositionWindow, dmxScreen, pScreen); + DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen); + DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen); + DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen); + DMX_UNWRAP(RestackWindow, dmxScreen, pScreen); + DMX_UNWRAP(WindowExposures, dmxScreen, pScreen); + DMX_UNWRAP(CopyWindow, dmxScreen, pScreen); - DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen); - DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen); + DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen); + DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen); - DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen); + DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen); - DMX_UNWRAP(GetImage, dmxScreen, pScreen); - DMX_UNWRAP(GetSpans, dmxScreen, pScreen); + DMX_UNWRAP(GetImage, dmxScreen, pScreen); + DMX_UNWRAP(GetSpans, dmxScreen, pScreen); - DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen); - DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen); - DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen); + DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen); + DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen); + DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen); - DMX_UNWRAP(RealizeFont, dmxScreen, pScreen); - DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen); + DMX_UNWRAP(RealizeFont, dmxScreen, pScreen); + DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen); - DMX_UNWRAP(CreateColormap, dmxScreen, pScreen); - DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen); - DMX_UNWRAP(InstallColormap, dmxScreen, pScreen); - DMX_UNWRAP(StoreColors, dmxScreen, pScreen); - } + DMX_UNWRAP(CreateColormap, dmxScreen, pScreen); + DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen); + DMX_UNWRAP(InstallColormap, dmxScreen, pScreen); + DMX_UNWRAP(StoreColors, dmxScreen, pScreen); DMX_UNWRAP(SaveScreen, dmxScreen, pScreen); diff --git a/xorg-server/hw/dmx/dmxshadow.c b/xorg-server/hw/dmx/dmxshadow.c deleted file mode 100644 index 9b4bafc34..000000000 --- a/xorg-server/hw/dmx/dmxshadow.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2001 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation on the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * Authors: - * Kevin E. Martin <kem@redhat.com> - * David H. Dawes <dawes@xfree86.org> - * - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxshadow.h" - -/** \file - * This file provides support for the shadow frame buffer. */ - -/** Update the screen from the shadow frame buffer. */ -void -dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf) -{ - RegionPtr damage = &pBuf->damage; - int nbox = RegionNumRects(damage); - BoxPtr pbox = RegionRects(damage); - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - - if (!dmxScreen->beDisplay) - return; - - while (nbox--) { - XPutImage(dmxScreen->beDisplay, - dmxScreen->scrnWin, - dmxScreen->shadowGC, - dmxScreen->shadowFBImage, - pbox->x1, pbox->y1, - pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1); - - pbox++; - } - - dmxSync(dmxScreen, FALSE); -} diff --git a/xorg-server/hw/dmx/dmxshadow.h b/xorg-server/hw/dmx/dmxshadow.h deleted file mode 100644 index 081b4d1dc..000000000 --- a/xorg-server/hw/dmx/dmxshadow.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2001 Red Hat Inc., Durham, North Carolina. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation on the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -/* - * Authors: - * Kevin E. Martin <kem@redhat.com> - * David H. Dawes <dawes@xfree86.org> - * - */ - -/** \file - * Interface for shadow framebuffer support. \see dmxshadow.c */ - -#ifndef DMXSHADOW_H -#define DMXSHADOW_H - -#include "shadow.h" -#include "scrnintstr.h" - -extern void dmxShadowUpdateProc(ScreenPtr pScreen, shadowBufPtr pBuf); - -#endif /* DMXSHADOW_H */ diff --git a/xorg-server/hw/dmx/glxProxy/Makefile.am b/xorg-server/hw/dmx/glxProxy/Makefile.am index 4ee1036b3..c3df169e1 100644 --- a/xorg-server/hw/dmx/glxProxy/Makefile.am +++ b/xorg-server/hw/dmx/glxProxy/Makefile.am @@ -22,7 +22,6 @@ libglxproxy_a_SOURCES = compsize.c \ glxsingle.h \ glxswap.c \ glxswap.h \ - glxutil.c \ glxutil.h \ glxvendor.c \ glxvendor.h \ diff --git a/xorg-server/hw/dmx/glxProxy/glxcmds.c b/xorg-server/hw/dmx/glxProxy/glxcmds.c index 8cdb25ec6..335da37ac 100644 --- a/xorg-server/hw/dmx/glxProxy/glxcmds.c +++ b/xorg-server/hw/dmx/glxProxy/glxcmds.c @@ -2734,8 +2734,6 @@ __glXClientInfo(__GLXclientState * cl, GLbyte * pc) int to_screen = 0; int s; - cl->GLClientmajorVersion = req->major; - cl->GLClientminorVersion = req->minor; free(cl->GLClientextensions); buf = (const char *) (req + 1); cl->GLClientextensions = strdup(buf); diff --git a/xorg-server/hw/dmx/glxProxy/glxext.c b/xorg-server/hw/dmx/glxProxy/glxext.c index e72a040ed..b46970864 100644 --- a/xorg-server/hw/dmx/glxProxy/glxext.c +++ b/xorg-server/hw/dmx/glxProxy/glxext.c @@ -88,12 +88,6 @@ ResetClientState(int clientIndex) memset(cl, 0, sizeof(__GLXclientState)); cl->be_displays = keep_be_displays; - /* - ** By default, assume that the client supports - ** GLX major version 1 minor version 0 protocol. - */ - cl->GLClientmajorVersion = 1; - cl->GLClientminorVersion = 0; free(cl->GLClientextensions); memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *)); diff --git a/xorg-server/hw/dmx/glxProxy/glxserver.h b/xorg-server/hw/dmx/glxProxy/glxserver.h index ad9496619..754ad30a0 100644 --- a/xorg-server/hw/dmx/glxProxy/glxserver.h +++ b/xorg-server/hw/dmx/glxProxy/glxserver.h @@ -119,8 +119,6 @@ struct __GLXclientStateRec { /* Back pointer to X client record */ ClientPtr client; - int GLClientmajorVersion; - int GLClientminorVersion; char *GLClientextensions; GLXContextTag *be_currentCTag; diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.c b/xorg-server/hw/dmx/glxProxy/glxutil.c deleted file mode 100644 index f90dbf141..000000000 --- a/xorg-server/hw/dmx/glxProxy/glxutil.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * shall be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include "glxserver.h" -#include "glxutil.h" - -void -__glXNop(void) -{ -} diff --git a/xorg-server/hw/dmx/glxProxy/glxutil.h b/xorg-server/hw/dmx/glxProxy/glxutil.h index d3c72862d..605c07b43 100644 --- a/xorg-server/hw/dmx/glxProxy/glxutil.h +++ b/xorg-server/hw/dmx/glxProxy/glxutil.h @@ -31,8 +31,6 @@ * Silicon Graphics, Inc. */ -extern void __glXNop(void); - /* context helper routines */ extern __GLXcontext *__glXLookupContextByTag(__GLXclientState *, GLXContextTag); extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState * cl, diff --git a/xorg-server/hw/dmx/input/dmxbackend.c b/xorg-server/hw/dmx/input/dmxbackend.c index 9463c87d3..807e02328 100644 --- a/xorg-server/hw/dmx/input/dmxbackend.c +++ b/xorg-server/hw/dmx/input/dmxbackend.c @@ -419,10 +419,9 @@ dmxBackendCollectEvents(DevicePtr pDev, } break; case MotionNotify: - DMXDBG9("dmxBackendCollectEvents: MotionNotify %d/%d (mi %d)" + DMXDBG8("dmxBackendCollectEvents: MotionNotify %d/%d" " newscreen=%d: %d %d (e=%d; last=%d,%d)\n", dmxScreen->index, priv->myScreen, - miPointerCurrentScreen()->myNum, priv->newscreen, X.xmotion.x, X.xmotion.y, entered, priv->lastX, priv->lastY); @@ -579,9 +578,6 @@ dmxBackendLateReInit(DevicePtr pDev) GETPRIVFROMPDEV; int x, y; - DMXDBG1("dmxBackendLateReInit miPointerCurrentScreen() = %p\n", - miPointerCurrentScreen()); - dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */ dmxBackendInitPrivate(pDev); dmxBackendComputeCenter(priv); diff --git a/xorg-server/hw/dmx/input/dmxcommon.c b/xorg-server/hw/dmx/input/dmxcommon.c index 5f25e8832..db558b55f 100644 --- a/xorg-server/hw/dmx/input/dmxcommon.c +++ b/xorg-server/hw/dmx/input/dmxcommon.c @@ -502,11 +502,6 @@ dmxCommonMouOn(DevicePtr pDev) GETDMXINPUTFROMPRIV; priv->eventMask |= DMX_POINTER_EVENT_MASK; - if (dmxShadowFB) { - XWarpPointer(priv->display, priv->window, priv->window, - 0, 0, 0, 0, priv->initPointerX, priv->initPointerY); - dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE); - } if (!priv->be) { XSelectInput(priv->display, priv->window, priv->eventMask); AddEnabledDevice(XConnectionNumber(priv->display)); diff --git a/xorg-server/hw/dmx/input/usb-private.h b/xorg-server/hw/dmx/input/usb-private.h index 096607a34..2ecfdf636 100644 --- a/xorg-server/hw/dmx/input/usb-private.h +++ b/xorg-server/hw/dmx/input/usb-private.h @@ -102,8 +102,8 @@ typedef struct _myPrivate { int fd; /**< File descriptor */ unsigned char mask[EV_MAX / 8 + 1]; /**< Mask */ int numRel, numAbs, numLeds; /**< Counts */ - int relmap[DMX_MAX_AXES]; /**< Relative axis map */ - int absmap[DMX_MAX_AXES]; /**< Absolute axis map */ + int relmap[REL_CNT]; /**< Relative axis map */ + int absmap[ABS_CNT]; /**< Absolute axis map */ CARD32 kbdState[NUM_STATE_ENTRIES]; /**< Keyboard state */ DeviceIntPtr pKeyboard; /** Keyboard device */ diff --git a/xorg-server/hw/dmx/man/Xdmx.man b/xorg-server/hw/dmx/man/Xdmx.man index bbce85608..6b3feb13b 100644 --- a/xorg-server/hw/dmx/man/Xdmx.man +++ b/xorg-server/hw/dmx/man/Xdmx.man @@ -179,16 +179,6 @@ will switch to another VC in local (raw) mode. .RE .sp .TP 8 -.BI "-shadowfb" -This option turns on (legacy) support for the shadow frame buffer. -.sp -.TP 8 -.BI "-noshadowfb" -This option turns off (legacy) support for the shadow frame buffer. -Note that this option has been deprecated and will be removed in the -next release. -.sp -.TP 8 .BI "-nomulticursor" This option turns off support for displaying multiple cursors on overlapped back-end displays. This option is available for testing and diff --git a/xorg-server/hw/kdrive/ephyr/Makefile.am b/xorg-server/hw/kdrive/ephyr/Makefile.am index ab024373c..6b790fddd 100644 --- a/xorg-server/hw/kdrive/ephyr/Makefile.am +++ b/xorg-server/hw/kdrive/ephyr/Makefile.am @@ -1,3 +1,24 @@ +# Copyright © 2013 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. + SUBDIRS = man AM_CPPFLAGS = \ @@ -9,81 +30,45 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/exa if XV -LIBXEPHYR_HOSTXV=libxephyr-hostxv.la +XV_SRCS = ephyrvideo.c endif if DRI -LIBXEPHYR_HOSTDRI=libxephyr-hostdri.la -endif - -noinst_LTLIBRARIES = libxephyr-hostx.la $(LIBXEPHYR_HOSTXV) $(LIBXEPHYR_HOSTDRI) libxephyr.la - -bin_PROGRAMS = Xephyr - -HOSTX_SRCS = \ - hostx.c \ - hostx.h - -HOSTVIDEO_SRCS = \ - ephyrvideo.c \ - ephyrhostvideo.c \ - ephyrhostvideo.h - -HOSTDRI_SRCS = \ +DRI_SRCS = \ ephyrdriext.c \ ephyrdriext.h \ ephyrdri.c \ ephyrdri.h \ - XF86dri.c \ - xf86dri.h \ ephyrglxext.c \ ephyrglxext.h \ ephyrhostglx.c \ - ephyrhostglx.h - -XEPHYR_SRCS = \ - ephyr.c \ - ephyr.h \ - ephyrlog.h \ - ephyr_draw.c \ - os.c - -libxephyr_hostx_la_SOURCES = $(HOSTX_SRCS) - -if XV -libxephyr_hostxv_la_SOURCES = $(HOSTVIDEO_SRCS) -endif - -if DRI -libxephyr_hostdri_la_SOURCES = $(HOSTDRI_SRCS) + ephyrhostglx.h \ + $() endif -libxephyr_la_SOURCES = $(XEPHYR_SRCS) +bin_PROGRAMS = Xephyr Xephyr_SOURCES = \ - ephyrinit.c + ephyr.c \ + ephyr.h \ + ephyrlog.h \ + ephyr_draw.c \ + os.c \ + ephyrinit.c \ + hostx.c \ + hostx.h \ + $(XV_SRCS) \ + $(DRI_SRCS) \ + $() Xephyr_LDADD = \ - libxephyr.la \ - libxephyr-hostx.la \ - $(LIBXEPHYR_HOSTXV) \ - $(LIBXEPHYR_HOSTDRI) \ $(top_builddir)/exa/libexa.la \ @KDRIVE_LIBS@ \ @XEPHYR_LIBS@ -Xephyr_DEPENDENCIES = \ - libxephyr.la \ - libxephyr-hostx.la \ - $(LIBXEPHYR_HOSTXV) \ - $(LIBXEPHYR_HOSTDRI) \ - @KDRIVE_LOCAL_LIBS@ +Xephyr_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@ Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) relink: $(AM_V_at)rm -f $(bin_PROGRAMS) && $(MAKE) $(bin_PROGRAMS) - -EXTRA_DIST = \ - $(HOSTVIDEO_SRCS) \ - $(HOSTDRI_SRCS) diff --git a/xorg-server/hw/kdrive/ephyr/XF86dri.c b/xorg-server/hw/kdrive/ephyr/XF86dri.c deleted file mode 100644 index 15b62191f..000000000 --- a/xorg-server/hw/kdrive/ephyr/XF86dri.c +++ /dev/null @@ -1,654 +0,0 @@ -/* $XFree86: xc/lib/GL/dri/XF86dri.c,v 1.13 2002/10/30 12:51:25 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Kevin E. Martin <martin@valinux.com> - * Jens Owen <jens@tungstengraphics.com> - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -/* - * This file has been copied from the mesa source tree and a little bit - * modified by: - * - * Dodji Seketeli <dodji@openedhand.com> - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -/* - * including some server headers (like kdrive-config.h) - * might define the macro _XSERVER64 - * on 64 bits machines. That macro must _NOT_ be defined for Xlib - * client code, otherwise bad things happen. - * So let's undef that macro if necessary. - */ -#ifdef _XSERVER64 -#undef _XSERVER64 -#endif - -/* THIS IS NOT AN X CONSORTIUM STANDARD */ - -#include <X11/Xlibint.h> -#include <X11/extensions/Xext.h> -#include <X11/extensions/extutil.h> -#include <GL/glx.h> -#include "xf86dri.h" -#include <X11/dri/xf86driproto.h> -#include <limits.h> - -static XExtensionInfo _xf86dri_info_data; -static XExtensionInfo *xf86dri_info = &_xf86dri_info_data; -static char xf86dri_extension_name[] = XF86DRINAME; - -#define XF86DRICheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, xf86dri_extension_name, val) - -/***************************************************************************** - * * - * private utility routines * - * * - *****************************************************************************/ - -static int close_display(Display * dpy, XExtCodes * extCodes); - -static /* const */ XExtensionHooks xf86dri_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - close_display, /* close_display */ - NULL, /* wire_to_event */ - NULL, /* event_to_wire */ - NULL, /* error */ - NULL, /* error_string */ -}; - -static -XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info, - xf86dri_extension_name, - &xf86dri_extension_hooks, 0, NULL) - -static -XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info) - -/***************************************************************************** - * * - * public XFree86-DRI Extension routines * - * * - *****************************************************************************/ -#if 0 -#include <stdio.h> -#define TRACE(msg) fprintf(stderr,"XF86DRI%s\n", msg); -#else -#define TRACE(msg) -#endif -Bool -XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable); -Bool -XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable); - -Bool -XF86DRIQueryExtension(Display * dpy, int *event_basep, int *error_basep) -{ - XExtDisplayInfo *info = find_display(dpy); - - TRACE("QueryExtension..."); - if (XextHasExtension(info)) { - *event_basep = info->codes->first_event; - *error_basep = info->codes->first_error; - TRACE("QueryExtension... return True"); - return True; - } - else { - TRACE("QueryExtension... return False"); - return False; - } -} - -Bool -XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion, - int *patchVersion) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRIQueryVersionReply rep; - xXF86DRIQueryVersionReq *req; - - TRACE("QueryVersion..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIQueryVersion; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return False"); - return False; - } - *majorVersion = rep.majorVersion; - *minorVersion = rep.minorVersion; - *patchVersion = rep.patchVersion; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryVersion... return True"); - return True; -} - -Bool -XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen, Bool *isCapable) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRIQueryDirectRenderingCapableReply rep; - xXF86DRIQueryDirectRenderingCapableReq *req; - - TRACE("QueryDirectRenderingCapable..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIQueryDirectRenderingCapable, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIQueryDirectRenderingCapable; - req->screen = screen; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryDirectRenderingCapable... return False"); - return False; - } - *isCapable = rep.isCapable; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("QueryDirectRenderingCapable... return True"); - return True; -} - -Bool -XF86DRIOpenConnection(Display * dpy, int screen, - drm_handle_t * hSAREA, char **busIdString) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRIOpenConnectionReply rep; - xXF86DRIOpenConnectionReq *req; - - TRACE("OpenConnection..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIOpenConnection, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIOpenConnection; - req->screen = screen; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("OpenConnection... return False"); - return False; - } - - *hSAREA = rep.hSAREALow; - if (sizeof(drm_handle_t) == 8) { - int shift = 32; /* var to prevent warning on next line */ - - *hSAREA |= ((drm_handle_t) rep.hSAREAHigh) << shift; - } - - if (rep.length) { - if (rep.busIdStringLength < INT_MAX) - *busIdString = calloc(rep.busIdStringLength + 1, 1); - else - *busIdString = NULL; - if (*busIdString == NULL) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - TRACE("OpenConnection... return False"); - return False; - } - _XReadPad(dpy, *busIdString, rep.busIdStringLength); - } - else { - *busIdString = NULL; - } - UnlockDisplay(dpy); - SyncHandle(); - TRACE("OpenConnection... return True"); - return True; -} - -Bool -XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRIAuthConnectionReq *req; - xXF86DRIAuthConnectionReply rep; - - TRACE("AuthConnection..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIAuthConnection, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIAuthConnection; - req->screen = screen; - req->magic = magic; - rep.authenticated = 0; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse) || !rep.authenticated) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("AuthConnection... return False"); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - TRACE("AuthConnection... return True"); - return True; -} - -Bool -XF86DRICloseConnection(Display * dpy, int screen) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRICloseConnectionReq *req; - - TRACE("CloseConnection..."); - - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRICloseConnection, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRICloseConnection; - req->screen = screen; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CloseConnection... return True"); - return True; -} - -Bool -XF86DRIGetClientDriverName(Display * dpy, int screen, - int *ddxDriverMajorVersion, - int *ddxDriverMinorVersion, - int *ddxDriverPatchVersion, char **clientDriverName) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRIGetClientDriverNameReply rep; - xXF86DRIGetClientDriverNameReq *req; - - TRACE("GetClientDriverName..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIGetClientDriverName, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIGetClientDriverName; - req->screen = screen; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetClientDriverName... return False"); - return False; - } - - *ddxDriverMajorVersion = rep.ddxDriverMajorVersion; - *ddxDriverMinorVersion = rep.ddxDriverMinorVersion; - *ddxDriverPatchVersion = rep.ddxDriverPatchVersion; - - if (rep.length) { - if (rep.clientDriverNameLength < INT_MAX) - *clientDriverName = calloc(rep.clientDriverNameLength + 1, 1); - else - *clientDriverName = NULL; - if (*clientDriverName == NULL) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetClientDriverName... return False"); - return False; - } - _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength); - } - else { - *clientDriverName = NULL; - } - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetClientDriverName... return True"); - return True; -} - -Bool -XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID, - XID *context, drm_context_t * hHWContext) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRICreateContextReply rep; - xXF86DRICreateContextReq *req; - - TRACE("CreateContext..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRICreateContext, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRICreateContext; - req->visual = configID; - req->screen = screen; - *context = XAllocID(dpy); - req->context = *context; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateContext... return False"); - return False; - } - *hHWContext = rep.hHWContext; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateContext... return True"); - return True; -} - -Bool -XF86DRICreateContext(Display * dpy, int screen, Visual * visual, - XID *context, drm_context_t * hHWContext) -{ - return XF86DRICreateContextWithConfig(dpy, screen, visual->visualid, - context, hHWContext); -} - -GLboolean -XF86DRIDestroyContext(Display * dpy, int screen, XID context) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRIDestroyContextReq *req; - - TRACE("DestroyContext..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIDestroyContext, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIDestroyContext; - req->screen = screen; - req->context = context; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("DestroyContext... return True"); - return True; -} - -GLboolean -XF86DRICreateDrawable(Display * dpy, int screen, - XID drawable, drm_drawable_t * hHWDrawable) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRICreateDrawableReply rep; - xXF86DRICreateDrawableReq *req; - - TRACE("CreateDrawable..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRICreateDrawable, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRICreateDrawable; - req->screen = screen; - req->drawable = drawable; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateDrawable... return False"); - return False; - } - *hHWDrawable = rep.hHWDrawable; - UnlockDisplay(dpy); - SyncHandle(); - TRACE("CreateDrawable... return True"); - return True; -} - -static int -noopErrorHandler(Display * dpy, XErrorEvent * xerr) -{ - return 0; -} - -GLboolean -XF86DRIDestroyDrawable(Display * dpy, int screen, XID drawable) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRIDestroyDrawableReq *req; - int (*oldXErrorHandler) (Display *, XErrorEvent *); - - TRACE("DestroyDrawable..."); - XF86DRICheckExtension(dpy, info, False); - - /* This is called from the DRI driver, which used call it like this - * - * if (windowExists(drawable)) - * destroyDrawable(drawable); - * - * which is a textbook race condition - the window may disappear - * from the server between checking for its existance and - * destroying it. Instead we change the semantics of - * __DRIinterfaceMethodsRec::destroyDrawable() to succeed even if - * the windows is gone, by wrapping the destroy call in an error - * handler. */ - - XSync(dpy, GL_FALSE); - oldXErrorHandler = XSetErrorHandler(noopErrorHandler); - - LockDisplay(dpy); - GetReq(XF86DRIDestroyDrawable, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIDestroyDrawable; - req->screen = screen; - req->drawable = drawable; - UnlockDisplay(dpy); - SyncHandle(); - - XSetErrorHandler(oldXErrorHandler); - - TRACE("DestroyDrawable... return True"); - return True; -} - -Bool -XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, - unsigned int *index, unsigned int *stamp, - int *X, int *Y, int *W, int *H, - int *numClipRects, drm_clip_rect_t ** pClipRects, - int *backX, int *backY, - int *numBackClipRects, drm_clip_rect_t ** pBackClipRects) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRIGetDrawableInfoReply rep; - xXF86DRIGetDrawableInfoReq *req = NULL; - int total_rects; - - TRACE("GetDrawableInfo..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIGetDrawableInfo, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIGetDrawableInfo; - req->screen = screen; - req->drawable = drawable; - - if (!_XReply(dpy, (xReply *) &rep, 1, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDrawableInfo... return False"); - return False; - } - *index = rep.drawableTableIndex; - *stamp = rep.drawableTableStamp; - *X = (int) rep.drawableX; - *Y = (int) rep.drawableY; - *W = (int) rep.drawableWidth; - *H = (int) rep.drawableHeight; - *numClipRects = rep.numClipRects; - total_rects = *numClipRects; - - *backX = rep.backX; - *backY = rep.backY; - *numBackClipRects = rep.numBackClipRects; - total_rects += *numBackClipRects; - -#if 0 - /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks - * backwards compatibility (Because of the >> 2 shift) but the fix - * enables multi-threaded apps to work. - */ - if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) - - SIZEOF(xGenericReply) + - total_rects * sizeof(drm_clip_rect_t)) + - 3) & ~3) >> 2)) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDrawableInfo... return False"); - return False; - } -#endif - - if (*numClipRects) { - int len = sizeof(drm_clip_rect_t) * (*numClipRects); - - *pClipRects = (drm_clip_rect_t *) calloc(len, 1); - if (*pClipRects) - _XRead(dpy, (char *) *pClipRects, len); - } - else { - *pClipRects = NULL; - } - - if (*numBackClipRects) { - int len = sizeof(drm_clip_rect_t) * (*numBackClipRects); - - *pBackClipRects = (drm_clip_rect_t *) calloc(len, 1); - if (*pBackClipRects) - _XRead(dpy, (char *) *pBackClipRects, len); - } - else { - *pBackClipRects = NULL; - } - - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDrawableInfo... return True"); - return True; -} - -Bool -XF86DRIGetDeviceInfo(Display * dpy, int screen, drm_handle_t * hFrameBuffer, - int *fbOrigin, int *fbSize, int *fbStride, - int *devPrivateSize, void **pDevPrivate) -{ - XExtDisplayInfo *info = find_display(dpy); - xXF86DRIGetDeviceInfoReply rep; - xXF86DRIGetDeviceInfoReq *req; - - TRACE("GetDeviceInfo..."); - XF86DRICheckExtension(dpy, info, False); - - LockDisplay(dpy); - GetReq(XF86DRIGetDeviceInfo, req); - req->reqType = info->codes->major_opcode; - req->driReqType = X_XF86DRIGetDeviceInfo; - req->screen = screen; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDeviceInfo... return False"); - return False; - } - - *hFrameBuffer = rep.hFrameBufferLow; - if (sizeof(drm_handle_t) == 8) { - int shift = 32; /* var to prevent warning on next line */ - - *hFrameBuffer |= ((drm_handle_t) rep.hFrameBufferHigh) << shift; - } - - *fbOrigin = rep.framebufferOrigin; - *fbSize = rep.framebufferSize; - *fbStride = rep.framebufferStride; - *devPrivateSize = rep.devPrivateSize; - - if (rep.length) { - if (!(*pDevPrivate = (void *) calloc(rep.devPrivateSize, 1))) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDeviceInfo... return False"); - return False; - } - _XRead(dpy, (char *) *pDevPrivate, rep.devPrivateSize); - } - else { - *pDevPrivate = NULL; - } - - UnlockDisplay(dpy); - SyncHandle(); - TRACE("GetDeviceInfo... return True"); - return True; -} - -Bool -XF86DRIOpenFullScreen(Display * dpy, int screen, Drawable drawable) -{ - /* This function and the underlying X protocol are deprecated. - */ - (void) dpy; - (void) screen; - (void) drawable; - return False; -} - -Bool -XF86DRICloseFullScreen(Display * dpy, int screen, Drawable drawable) -{ - /* This function and the underlying X protocol are deprecated. - */ - (void) dpy; - (void) screen; - (void) drawable; - return True; -} diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index 632b7eee9..5a62402f3 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -26,6 +26,10 @@ #ifdef HAVE_CONFIG_H #include <kdrive-config.h> #endif + +#include <xcb/xcb_keysyms.h> +#include <X11/keysym.h> + #include "ephyr.h" #include "inputstr.h" @@ -33,6 +37,7 @@ #include "ephyrlog.h" #ifdef XF86DRI +#include <xcb/xf86dri.h> #include "ephyrdri.h" #include "ephyrdriext.h" #include "ephyrglxext.h" @@ -59,6 +64,16 @@ Bool EphyrWantGrayScale = 0; Bool EphyrWantResize = 0; Bool +host_has_extension(xcb_extension_t *extension) +{ + const xcb_query_extension_reply_t *rep; + + rep = xcb_get_extension_data(hostx_get_xcbconn(), extension); + + return rep && rep->present; +} + +Bool ephyrInitialize(KdCardInfo * card, EphyrPriv * priv) { #ifdef _MSC_VER @@ -90,8 +105,9 @@ ephyrCardInit(KdCardInfo * card) } Bool -ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv) +ephyrScreenInitialize(KdScreenInfo *screen) { + EphyrScrPriv *scrpriv = screen->driver; int width = 640, height = 480; CARD32 redMask, greenMask, blueMask; @@ -108,7 +124,7 @@ ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv) if (screen->fb.depth < hostx_get_depth() && (screen->fb.depth == 24 || screen->fb.depth == 16 || screen->fb.depth == 8)) { - hostx_set_server_depth(screen, screen->fb.depth); + scrpriv->server_depth = screen->fb.depth; } else ErrorF @@ -171,27 +187,6 @@ ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv) return ephyrMapFramebuffer(screen); } -Bool -ephyrScreenInit(KdScreenInfo * screen) -{ - EphyrScrPriv *scrpriv; - - scrpriv = calloc(1, sizeof(EphyrScrPriv)); - - if (!scrpriv) - return FALSE; - - screen->driver = scrpriv; - - if (!ephyrScreenInitialize(screen, scrpriv)) { - screen->driver = 0; - free(scrpriv); - return FALSE; - } - - return TRUE; -} - void * ephyrWindowLinear(ScreenPtr pScreen, CARD32 row, @@ -392,10 +387,7 @@ ephyrUnsetInternalDamage(ScreenPtr pScreen) KdScreenPriv(pScreen); KdScreenInfo *screen = pScreenPriv->screen; EphyrScrPriv *scrpriv = screen->driver; - PixmapPtr pPixmap = NULL; - pPixmap = (*pScreen->GetScreenPixmap) (pScreen); - DamageUnregister(&pPixmap->drawable, scrpriv->pDamage); DamageDestroy(scrpriv->pDamage); RemoveBlockAndWakeupHandlers(ephyrInternalDamageBlockHandler, @@ -660,7 +652,7 @@ ephyrInitScreen(ScreenPtr pScreen) } #endif /*XV*/ #ifdef XF86DRI - if (!ephyrNoDRI && !hostx_has_dri()) { + if (!ephyrNoDRI && !host_has_extension(&xcb_xf86dri_id)) { EPHYR_LOG("host x does not support DRI. Disabling DRI forwarding\n"); ephyrNoDRI = TRUE; } @@ -818,13 +810,13 @@ ephyrCrossScreen(ScreenPtr pScreen, Bool entering) { } -int ephyrCurScreen; /*current event screen */ +ScreenPtr ephyrCursorScreen; /* screen containing the cursor */ static void ephyrWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { OsBlockSIGIO(); - ephyrCurScreen = pScreen->myNum; + ephyrCursorScreen = pScreen; miPointerWarpCursor(inputInfo.pointer, pScreen, x, y); OsReleaseSIGIO(); @@ -834,8 +826,6 @@ miPointerScreenFuncRec ephyrPointerScreenFuncs = { ephyrCursorOffScreen, ephyrCrossScreen, ephyrWarpCursor, - NULL, - NULL }; #ifdef XF86DRI @@ -872,123 +862,327 @@ ephyrExposePairedWindow(int a_remote) } #endif /* XF86DRI */ -void -ephyrPoll(void) +static KdScreenInfo * +screen_from_window(Window w) { - EphyrHostXEvent ev; - - while (hostx_get_event(&ev)) { - switch (ev.type) { - case EPHYR_EV_MOUSE_MOTION: - if (!ephyrMouse || - !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { - EPHYR_LOG("skipping mouse motion:%d\n", ephyrCurScreen); - continue; - } - { - if (ev.data.mouse_motion.screen >= 0 - && (ephyrCurScreen != ev.data.mouse_motion.screen)) { - EPHYR_LOG("warping mouse cursor. " - "cur_screen%d, motion_screen:%d\n", - ephyrCurScreen, ev.data.mouse_motion.screen); - if (ev.data.mouse_motion.screen >= 0) { - ephyrWarpCursor - (inputInfo.pointer, - screenInfo.screens[ev.data.mouse_motion.screen], - ev.data.mouse_motion.x, ev.data.mouse_motion.y); - } - } - else { - int x = 0, y = 0; + int i = 0; + + for (i = 0; i < screenInfo.numScreens; i++) { + ScreenPtr pScreen = screenInfo.screens[i]; + KdPrivScreenPtr kdscrpriv = KdGetScreenPriv(pScreen); + KdScreenInfo *screen = kdscrpriv->screen; + EphyrScrPriv *scrpriv = screen->driver; + + if (scrpriv->win == w + || scrpriv->peer_win == w + || scrpriv->win_pre_existing == w) { + return screen; + } + } + + return NULL; +} +static void +ephyrProcessErrorEvent(xcb_generic_event_t *xev) +{ + xcb_generic_error_t *e = (xcb_generic_error_t *)xev; + + FatalError("X11 error\n" + "Error code: %hhu\n" + "Sequence number: %hu\n" + "Major code: %hhu\tMinor code: %hu\n" + "Error value: %u\n", + e->error_code, + e->sequence, + e->major_code, e->minor_code, + e->resource_id); +} + +static void +ephyrProcessExpose(xcb_generic_event_t *xev) +{ + xcb_expose_event_t *expose = (xcb_expose_event_t *)xev; + KdScreenInfo *screen = screen_from_window(expose->window); + EphyrScrPriv *scrpriv = screen->driver; + + /* Wait for the last expose event in a series of cliprects + * to actually paint our screen. + */ + if (expose->count != 0) + return; + + if (scrpriv) { + hostx_paint_rect(scrpriv->screen, 0, 0, 0, 0, + scrpriv->win_width, + scrpriv->win_height); + } else { + EPHYR_LOG_ERROR("failed to get host screen\n"); #ifdef XF86DRI - EphyrWindowPair *pair = NULL; + /* + * We only receive expose events when the expose event + * have be generated for a drawable that is a host X + * window managed by Xephyr. Host X windows managed by + * Xephyr exists for instance when Xephyr is asked to + * create a GL drawable in a DRI environment. + */ + ephyrExposePairedWindow(expose->window); +#endif /* XF86DRI */ + } +} + +static void +ephyrProcessMouseMotion(xcb_generic_event_t *xev) +{ + xcb_motion_notify_event_t *motion = (xcb_motion_notify_event_t *)xev; + KdScreenInfo *screen = screen_from_window(motion->event); + + if (!ephyrMouse || + !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { + EPHYR_LOG("skipping mouse motion:%d\n", screen->pScreen->myNum); + return; + } + + if (ephyrCursorScreen != screen->pScreen) { + EPHYR_LOG("warping mouse cursor. " + "cur_screen%d, motion_screen:%d\n", + ephyrCursorScreen, screen->pScreen->myNum); + ephyrWarpCursor(inputInfo.pointer, screen->pScreen, + motion->event_x, motion->event_y); + } + else { + int x = 0, y = 0; + +#ifdef XF86DRI + EphyrWindowPair *pair = NULL; #endif - EPHYR_LOG("enqueuing mouse motion:%d\n", ephyrCurScreen); - x = ev.data.mouse_motion.x; - y = ev.data.mouse_motion.y; - EPHYR_LOG("initial (x,y):(%d,%d)\n", x, y); + EPHYR_LOG("enqueuing mouse motion:%d\n", ephyrCurScreen); + x = motion->event_x; + y = motion->event_y; + EPHYR_LOG("initial (x,y):(%d,%d)\n", x, y); #ifdef XF86DRI - EPHYR_LOG("is this window peered by a gl drawable ?\n"); - if (findWindowPairFromRemote(ev.data.mouse_motion.window, - &pair)) { - EPHYR_LOG("yes, it is peered\n"); - x += pair->local->drawable.x; - y += pair->local->drawable.y; - } - else { - EPHYR_LOG("no, it is not peered\n"); - } - EPHYR_LOG("final (x,y):(%d,%d)\n", x, y); + EPHYR_LOG("is this window peered by a gl drawable ?\n"); + if (findWindowPairFromRemote(motion->event, &pair)) { + EPHYR_LOG("yes, it is peered\n"); + x += pair->local->drawable.x; + y += pair->local->drawable.y; + } + else { + EPHYR_LOG("no, it is not peered\n"); + } + EPHYR_LOG("final (x,y):(%d,%d)\n", x, y); #endif - KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0); + KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0); + } +} + +static void +ephyrProcessButtonPress(xcb_generic_event_t *xev) +{ + xcb_button_press_event_t *button = (xcb_button_press_event_t *)xev; + + if (!ephyrMouse || + !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { + EPHYR_LOG("skipping mouse press:%d\n", ephyrCurScreen); + return; + } + + ephyrUpdateModifierState(button->state); + /* This is a bit hacky. will break for button 5 ( defined as 0x10 ) + * Check KD_BUTTON defines in kdrive.h + */ + mouseState |= 1 << (button->detail - 1); + + EPHYR_LOG("enqueuing mouse press:%d\n", ephyrCurScreen); + KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0); +} + +static void +ephyrProcessButtonRelease(xcb_generic_event_t *xev) +{ + xcb_button_press_event_t *button = (xcb_button_press_event_t *)xev; + + if (!ephyrMouse || + !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { + return; + } + + ephyrUpdateModifierState(button->state); + mouseState &= ~(1 << (button->detail - 1)); + + EPHYR_LOG("enqueuing mouse release:%d\n", ephyrCurScreen); + KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, 0); +} + +static void +ephyrProcessKeyPress(xcb_generic_event_t *xev) +{ + xcb_key_press_event_t *key = (xcb_key_press_event_t *)xev; + + if (!ephyrKbd || + !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled) { + return; + } + + ephyrUpdateModifierState(key->state); + KdEnqueueKeyboardEvent(ephyrKbd, key->detail, FALSE); +} + +static void +ephyrProcessKeyRelease(xcb_generic_event_t *xev) +{ + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_key_release_event_t *key = (xcb_key_release_event_t *)xev; + static xcb_key_symbols_t *keysyms; + static int grabbed_screen = -1; + + if (!keysyms) + keysyms = xcb_key_symbols_alloc(conn); + + if (((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_L + || xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Shift_R) + && (key->state & XCB_MOD_MASK_CONTROL)) || + ((xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_L + || xcb_key_symbols_get_keysym(keysyms, key->detail, 0) == XK_Control_R) + && (key->state & XCB_MOD_MASK_SHIFT))) { + KdScreenInfo *screen = screen_from_window(key->event); + EphyrScrPriv *scrpriv = screen->driver; + + if (grabbed_screen != -1) { + xcb_ungrab_keyboard(conn, XCB_TIME_CURRENT_TIME); + xcb_ungrab_pointer(conn, XCB_TIME_CURRENT_TIME); + grabbed_screen = -1; + hostx_set_win_title(screen, + "(ctrl+shift grabs mouse and keyboard)"); + } + else { + /* Attempt grab */ + xcb_grab_keyboard_cookie_t kbgrabc = + xcb_grab_keyboard(conn, + TRUE, + scrpriv->win, + XCB_TIME_CURRENT_TIME, + XCB_GRAB_MODE_ASYNC, + XCB_GRAB_MODE_ASYNC); + xcb_grab_keyboard_reply_t *kbgrabr; + xcb_grab_pointer_cookie_t pgrabc = + xcb_grab_pointer(conn, + TRUE, + scrpriv->win, + 0, + XCB_GRAB_MODE_ASYNC, + XCB_GRAB_MODE_ASYNC, + scrpriv->win, + XCB_NONE, + XCB_TIME_CURRENT_TIME); + xcb_grab_pointer_reply_t *pgrabr; + kbgrabr = xcb_grab_keyboard_reply(conn, kbgrabc, NULL); + if (!kbgrabr || kbgrabr->status != XCB_GRAB_STATUS_SUCCESS) { + xcb_discard_reply(conn, pgrabc.sequence); + xcb_ungrab_pointer(conn, XCB_TIME_CURRENT_TIME); + } else { + pgrabr = xcb_grab_pointer_reply(conn, pgrabc, NULL); + if (!pgrabr || pgrabr->status != XCB_GRAB_STATUS_SUCCESS) + { + xcb_ungrab_keyboard(conn, + XCB_TIME_CURRENT_TIME); + } else { + grabbed_screen = scrpriv->mynum; + hostx_set_win_title + (screen, + "(ctrl+shift releases mouse and keyboard)"); } } - break; + } + } + + if (!ephyrKbd || + !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled) { + return; + } + + /* Still send the release event even if above has happened server + * will get confused with just an up event. Maybe it would be + * better to just block shift+ctrls getting to kdrive all + * together. + */ + ephyrUpdateModifierState(key->state); + KdEnqueueKeyboardEvent(ephyrKbd, key->detail, TRUE); +} + +static void +ephyrProcessConfigureNotify(xcb_generic_event_t *xev) +{ + xcb_configure_notify_event_t *configure = + (xcb_configure_notify_event_t *)xev; + KdScreenInfo *screen = screen_from_window(configure->window); + EphyrScrPriv *scrpriv = screen->driver; - case EPHYR_EV_MOUSE_PRESS: - if (!ephyrMouse || - !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) { - EPHYR_LOG("skipping mouse press:%d\n", ephyrCurScreen); - continue; + if (!scrpriv || + (scrpriv->win_pre_existing == None && !EphyrWantResize)) { + return; + } + +#ifdef RANDR + ephyrResizeScreen(screen->pScreen, configure->width, configure->height); +#endif /* RANDR */ +} + +void +ephyrPoll(void) +{ + xcb_connection_t *conn = hostx_get_xcbconn(); + + while (TRUE) { + xcb_generic_event_t *xev = xcb_poll_for_event(conn); + if (!xev) { + /* If our XCB connection has died (for example, our window was + * closed), exit now. + */ + if (xcb_connection_has_error(conn)) { + CloseWellKnownConnections(); + OsCleanup(1); + exit(1); } - EPHYR_LOG("enqueuing mouse press:%d\n", ephyrCurScreen); - ephyrUpdateModifierState(ev.key_state); - mouseState |= ev.data.mouse_down.button_num; - KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, - 0); + break; + } - case EPHYR_EV_MOUSE_RELEASE: - if (!ephyrMouse || - !((EphyrPointerPrivate *) ephyrMouse->driverPrivate)->enabled) - continue; - ephyrUpdateModifierState(ev.key_state); - mouseState &= ~ev.data.mouse_up.button_num; - EPHYR_LOG("enqueuing mouse release:%d\n", ephyrCurScreen); - KdEnqueuePointerEvent(ephyrMouse, mouseState | KD_MOUSE_DELTA, 0, 0, - 0); + switch (xev->response_type & 0x7f) { + case 0: + ephyrProcessErrorEvent(xev); break; - case EPHYR_EV_KEY_PRESS: - if (!ephyrKbd || - !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled) - continue; - ephyrUpdateModifierState(ev.key_state); - KdEnqueueKeyboardEvent(ephyrKbd, ev.data.key_down.scancode, FALSE); + case XCB_EXPOSE: + ephyrProcessExpose(xev); break; - case EPHYR_EV_KEY_RELEASE: - if (!ephyrKbd || - !((EphyrKbdPrivate *) ephyrKbd->driverPrivate)->enabled) - continue; - ephyrUpdateModifierState(ev.key_state); - KdEnqueueKeyboardEvent(ephyrKbd, ev.data.key_up.scancode, TRUE); + case XCB_MOTION_NOTIFY: + ephyrProcessMouseMotion(xev); break; -#ifdef XF86DRI - case EPHYR_EV_EXPOSE: - /* - * We only receive expose events when the expose event have - * be generated for a drawable that is a host X window managed - * by Xephyr. Host X windows managed by Xephyr exists for instance - * when Xephyr is asked to create a GL drawable in a DRI environment. - */ - ephyrExposePairedWindow(ev.data.expose.window); + case XCB_KEY_PRESS: + ephyrProcessKeyPress(xev); break; -#endif /* XF86DRI */ -#ifdef RANDR - case EPHYR_EV_CONFIGURE: - ephyrResizeScreen(screenInfo.screens[ev.data.configure.screen], - ev.data.configure.width, - ev.data.configure.height); + case XCB_KEY_RELEASE: + ephyrProcessKeyRelease(xev); + break; + + case XCB_BUTTON_PRESS: + ephyrProcessButtonPress(xev); + break; + + case XCB_BUTTON_RELEASE: + ephyrProcessButtonRelease(xev); break; -#endif /* RANDR */ - default: + case XCB_CONFIGURE_NOTIFY: + ephyrProcessConfigureNotify(xev); break; } + + free(xev); } } @@ -1102,7 +1296,7 @@ EphyrKeyboardInit(KdKeyboardInfo * ki) ki->driverPrivate = (EphyrKbdPrivate *) calloc(sizeof(EphyrKbdPrivate), 1); hostx_load_keymap(); - if (!ephyrKeySyms.map) { + if (!ephyrKeySyms.minKeyCode) { ErrorF("Couldn't load keymap from host\n"); return BadAlloc; } diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.h b/xorg-server/hw/kdrive/ephyr/ephyr.h index 1e9b930c7..d66c76e1e 100644..100755 --- a/xorg-server/hw/kdrive/ephyr/ephyr.h +++ b/xorg-server/hw/kdrive/ephyr/ephyr.h @@ -31,6 +31,7 @@ #include <libgen.h> #endif #include <signal.h> +#include <xcb/xcb_image.h> #include "os.h" /* for OsSignal() */ #include "kdrive.h" @@ -63,10 +64,24 @@ typedef struct _ephyrFakexaPriv { } EphyrFakexaPriv; typedef struct _ephyrScrPriv { + /* ephyr server info */ Rotation randr; Bool shadow; DamagePtr pDamage; EphyrFakexaPriv *fakexa; + + /* Host X window info */ + xcb_window_t win; + xcb_window_t win_pre_existing; /* Set via -parent option like xnest */ + xcb_window_t peer_win; /* Used for GL; should be at most one */ + xcb_image_t *ximg; + int win_width, win_height; + int server_depth; + unsigned char *fb_data; /* only used when host bpp != server bpp */ + xcb_shm_segment_info_t shminfo; + + KdScreenInfo *screen; + int mynum; /* Screen number */ } EphyrScrPriv; extern KdCardFuncs ephyrFuncs; @@ -82,10 +97,7 @@ Bool ephyrCardInit(KdCardInfo * card); Bool - ephyrScreenInit(KdScreenInfo * screen); - -Bool - ephyrScreenInitialize(KdScreenInfo * screen, EphyrScrPriv * scrpriv); +ephyrScreenInitialize(KdScreenInfo *screen); Bool ephyrInitScreen(ScreenPtr pScreen); diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdri.c b/xorg-server/hw/kdrive/ephyr/ephyrdri.c index 3a4a06301..16678fc5b 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrdri.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrdri.c @@ -29,10 +29,8 @@ #include <kdrive-config.h> #endif -#include <X11/Xutil.h> -#include <X11/Xlibint.h> -#include <GL/glx.h> -#include "xf86dri.h" +#include <X11/Xdefs.h> +#include <xcb/xf86dri.h> #include "hostx.h" #include "ephyrdri.h" #define _HAVE_XALLOC_DECLS @@ -49,13 +47,21 @@ Bool ephyrDRIQueryDirectRenderingCapable(int a_screen, Bool *a_is_capable) { - Display *dpy = hostx_get_display(); + xcb_connection_t *conn = hostx_get_xcbconn(); Bool is_ok = FALSE; + xcb_xf86dri_query_direct_rendering_capable_cookie_t cookie; + xcb_xf86dri_query_direct_rendering_capable_reply_t *reply; EPHYR_RETURN_VAL_IF_FAIL(a_is_capable, FALSE); EPHYR_LOG("enter\n"); - is_ok = XF86DRIQueryDirectRenderingCapable(dpy, DefaultScreen(dpy), - a_is_capable); + cookie = xcb_xf86dri_query_direct_rendering_capable(conn, + hostx_get_screen()); + reply = xcb_xf86dri_query_direct_rendering_capable_reply(conn, cookie, NULL); + if (reply) { + is_ok = TRUE; + *a_is_capable = reply->is_capable; + free(reply); + } EPHYR_LOG("leave. is_capable:%d, is_ok=%d\n", *a_is_capable, is_ok); return is_ok; @@ -65,31 +71,48 @@ Bool ephyrDRIOpenConnection(int a_screen, drm_handle_t * a_sarea, char **a_bus_id_string) { - Display *dpy = hostx_get_display(); + xcb_connection_t *conn = hostx_get_xcbconn(); Bool is_ok = FALSE; + xcb_xf86dri_open_connection_cookie_t cookie; + xcb_xf86dri_open_connection_reply_t *reply; EPHYR_RETURN_VAL_IF_FAIL(a_bus_id_string, FALSE); EPHYR_LOG("enter. screen:%d\n", a_screen); - is_ok = XF86DRIOpenConnection(dpy, DefaultScreen(dpy), - a_sarea, a_bus_id_string); - if (*a_bus_id_string) { - EPHYR_LOG("leave. bus_id_string:%s, is_ok:%d\n", - *a_bus_id_string, is_ok); - } - else { - EPHYR_LOG("leave. bus_id_string:null, is_ok:%d\n", is_ok); + cookie = xcb_xf86dri_open_connection(conn, hostx_get_screen()); + reply = xcb_xf86dri_open_connection_reply(conn, cookie, NULL); + if (!reply) + goto out; + *a_sarea = reply->sarea_handle_low; + if (sizeof(drm_handle_t) == 8) { + int shift = 32; + *a_sarea |= ((drm_handle_t) reply->sarea_handle_high) << shift; } + *a_bus_id_string = malloc(reply->bus_id_len + 1); + if (!*a_bus_id_string) + goto out; + memcpy(*a_bus_id_string, xcb_xf86dri_open_connection_bus_id(reply), reply->bus_id_len); + *a_bus_id_string[reply->bus_id_len] = '\0'; + is_ok = TRUE; +out: + free(reply); + EPHYR_LOG("leave. bus_id_string:%s, is_ok:%d\n", *a_bus_id_string, is_ok); return is_ok; } Bool ephyrDRIAuthConnection(int a_screen, drm_magic_t a_magic) { - Display *dpy = hostx_get_display(); + xcb_connection_t *conn = hostx_get_xcbconn(); + int screen = hostx_get_screen(); + xcb_xf86dri_auth_connection_cookie_t cookie; + xcb_xf86dri_auth_connection_reply_t *reply; Bool is_ok = FALSE; EPHYR_LOG("enter\n"); - is_ok = XF86DRIAuthConnection(dpy, DefaultScreen(dpy), a_magic); + cookie = xcb_xf86dri_auth_connection(conn, screen, a_magic); + reply = xcb_xf86dri_auth_connection_reply(conn, cookie, NULL); + is_ok = reply->authenticated; + free(reply); EPHYR_LOG("leave. is_ok:%d\n", is_ok); return is_ok; } @@ -97,13 +120,13 @@ ephyrDRIAuthConnection(int a_screen, drm_magic_t a_magic) Bool ephyrDRICloseConnection(int a_screen) { - Display *dpy = hostx_get_display(); - Bool is_ok = FALSE; + xcb_connection_t *conn = hostx_get_xcbconn(); + int screen = hostx_get_screen(); EPHYR_LOG("enter\n"); - is_ok = XF86DRICloseConnection(dpy, DefaultScreen(dpy)); + xcb_xf86dri_close_connection(conn, screen); EPHYR_LOG("leave\n"); - return is_ok; + return TRUE; } Bool @@ -113,7 +136,10 @@ ephyrDRIGetClientDriverName(int a_screen, int *a_ddx_driver_patch_version, char **a_client_driver_name) { - Display *dpy = hostx_get_display(); + xcb_connection_t *conn = hostx_get_xcbconn(); + int screen = hostx_get_screen(); + xcb_xf86dri_get_client_driver_name_cookie_t cookie; + xcb_xf86dri_get_client_driver_name_reply_t *reply; Bool is_ok = FALSE; EPHYR_RETURN_VAL_IF_FAIL(a_ddx_driver_major_version @@ -121,15 +147,27 @@ ephyrDRIGetClientDriverName(int a_screen, && a_ddx_driver_patch_version && a_client_driver_name, FALSE); EPHYR_LOG("enter\n"); - is_ok = XF86DRIGetClientDriverName(dpy, DefaultScreen(dpy), - a_ddx_driver_major_version, - a_ddx_driver_minor_version, - a_ddx_driver_patch_version, - a_client_driver_name); + cookie = xcb_xf86dri_get_client_driver_name(conn, screen); + reply = xcb_xf86dri_get_client_driver_name_reply(conn, cookie, NULL); + if (!reply) + goto out; + *a_ddx_driver_major_version = reply->client_driver_major_version; + *a_ddx_driver_minor_version = reply->client_driver_minor_version; + *a_ddx_driver_patch_version = reply->client_driver_patch_version; + *a_client_driver_name = malloc(reply->client_driver_name_len + 1); + if (!*a_client_driver_name) + goto out; + memcpy(*a_client_driver_name, + xcb_xf86dri_get_client_driver_name_client_driver_name(reply), + reply->client_driver_name_len); + (*a_client_driver_name)[reply->client_driver_name_len] = '\0'; + is_ok = TRUE; EPHYR_LOG("major:%d, minor:%d, patch:%d, name:%s\n", *a_ddx_driver_major_version, *a_ddx_driver_minor_version, *a_ddx_driver_patch_version, *a_client_driver_name); + out: + free(reply); EPHYR_LOG("leave:%d\n", is_ok); return is_ok; } @@ -139,17 +177,23 @@ ephyrDRICreateContext(int a_screen, int a_visual_id, CARD32 ctxt_id, drm_context_t * a_hw_ctxt) { - Display *dpy = hostx_get_display(); + xcb_connection_t *conn = hostx_get_xcbconn(); + int screen = hostx_get_screen(); Bool is_ok = FALSE; - Visual v; - XID returned_ctxt_id = ctxt_id; + xcb_xf86dri_create_context_cookie_t cookie; + xcb_xf86dri_create_context_reply_t *reply; + + ctxt_id = xcb_generate_id(conn); EPHYR_LOG("enter. screen:%d, visual:%d\n", a_screen, a_visual_id); - memset(&v, 0, sizeof(v)); - v.visualid = a_visual_id; - is_ok = XF86DRICreateContext(dpy, - DefaultScreen(dpy), - &v, &returned_ctxt_id, a_hw_ctxt); + cookie = xcb_xf86dri_create_context(conn, screen, a_visual_id, ctxt_id); + reply = xcb_xf86dri_create_context_reply(conn, cookie, NULL); + if (!reply) + goto out; + *a_hw_ctxt = reply->hw_context; + is_ok = TRUE; +out: + free(reply); EPHYR_LOG("leave:%d\n", is_ok); return is_ok; } @@ -157,13 +201,13 @@ ephyrDRICreateContext(int a_screen, Bool ephyrDRIDestroyContext(int a_screen, int a_context_id) { - Display *dpy = hostx_get_display(); - Bool is_ok = FALSE; + xcb_connection_t *conn = hostx_get_xcbconn (); + int screen = hostx_get_screen(); EPHYR_LOG("enter\n"); - is_ok = XF86DRIDestroyContext(dpy, DefaultScreen(dpy), a_context_id); - EPHYR_LOG("leave:%d\n", is_ok); - return is_ok; + xcb_xf86dri_destroy_context(conn, screen, a_context_id); + EPHYR_LOG("leave\n"); + return TRUE; } Bool @@ -171,11 +215,20 @@ ephyrDRICreateDrawable(int a_screen, int a_drawable, drm_drawable_t * a_hw_drawable) { Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); + xcb_connection_t *conn = hostx_get_xcbconn(); + int screen = hostx_get_screen(); + xcb_xf86dri_create_drawable_cookie_t cookie; + xcb_xf86dri_create_drawable_reply_t *reply; EPHYR_LOG("enter\n"); - is_ok = XF86DRICreateDrawable(dpy, DefaultScreen(dpy), - a_drawable, a_hw_drawable); + cookie = xcb_xf86dri_create_drawable(conn, screen, a_drawable); + reply = xcb_xf86dri_create_drawable_reply(conn, cookie, NULL); + if (!reply) + goto out; + *a_hw_drawable = reply->hw_drawable_handle; + is_ok = TRUE; +out: + free(reply); EPHYR_LOG("leave. is_ok:%d\n", is_ok); return is_ok; } @@ -206,7 +259,10 @@ ephyrDRIGetDrawableInfo(int a_screen, drm_clip_rect_t ** a_back_clip_rects) { Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); + xcb_connection_t *conn = hostx_get_xcbconn(); + int screen = hostx_get_screen(); + xcb_xf86dri_get_drawable_info_cookie_t cookie; + xcb_xf86dri_get_drawable_info_reply_t *reply = NULL; EphyrHostWindowAttributes attrs; EPHYR_RETURN_VAL_IF_FAIL(a_x && a_y && a_w && a_h @@ -218,16 +274,22 @@ ephyrDRIGetDrawableInfo(int a_screen, EPHYR_LOG_ERROR("failed to query host window attributes\n"); goto out; } - if (!XF86DRIGetDrawableInfo(dpy, DefaultScreen(dpy), a_drawable, - a_index, a_stamp, - a_x, a_y, - a_w, a_h, - a_num_clip_rects, a_clip_rects, - a_back_x, a_back_y, - a_num_back_clip_rects, a_back_clip_rects)) { - EPHYR_LOG_ERROR("XF86DRIGetDrawableInfo ()\n"); + cookie = xcb_xf86dri_get_drawable_info(conn, screen, a_drawable); + reply = xcb_xf86dri_get_drawable_info_reply(conn, cookie, NULL); + if (!reply) { + EPHYR_LOG_ERROR ("XF86DRIGetDrawableInfo ()\n"); goto out; } + *a_index = reply->drawable_table_index; + *a_stamp = reply->drawable_table_stamp; + *a_x = reply->drawable_origin_X; + *a_y = reply->drawable_origin_Y; + *a_w = reply->drawable_size_W; + *a_h = reply->drawable_size_H; + *a_num_clip_rects = reply->num_clip_rects; + *a_clip_rects = calloc(*a_num_clip_rects, sizeof(drm_clip_rect_t)); + memcpy(*a_clip_rects, xcb_xf86dri_get_drawable_info_clip_rects(reply), + *a_num_clip_rects * sizeof(drm_clip_rect_t)); EPHYR_LOG("host x,y,w,h: (%d,%d,%d,%d)\n", *a_x, *a_y, *a_w, *a_h); if (*a_num_clip_rects) { free(*a_back_clip_rects); @@ -247,6 +309,7 @@ ephyrDRIGetDrawableInfo(int a_screen, out: EPHYR_LOG("leave. index:%d, stamp:%d, x,y:(%d,%d), w,y:(%d,%d)\n", *a_index, *a_stamp, *a_x, *a_y, *a_w, *a_h); + free(reply); return is_ok; } @@ -259,13 +322,35 @@ ephyrDRIGetDeviceInfo(int a_screen, int *a_dev_private_size, void **a_dev_private) { Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); + xcb_connection_t *conn = hostx_get_xcbconn (); + int screen = hostx_get_screen(); + xcb_xf86dri_get_device_info_cookie_t cookie; + xcb_xf86dri_get_device_info_reply_t *reply; - EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE); + EPHYR_RETURN_VAL_IF_FAIL(conn, FALSE); EPHYR_LOG("enter\n"); - is_ok = XF86DRIGetDeviceInfo(dpy, DefaultScreen(dpy), a_frame_buffer, - a_fb_origin, a_fb_size, a_fb_stride, - a_dev_private_size, a_dev_private); + cookie = xcb_xf86dri_get_device_info(conn, screen); + reply = xcb_xf86dri_get_device_info_reply(conn, cookie, NULL); + if (!reply) + goto out; + *a_frame_buffer = reply->framebuffer_handle_low; + if (sizeof(drm_handle_t) == 8) { + int shift = 32; + *a_frame_buffer |= ((drm_handle_t)reply->framebuffer_handle_high) << shift; + } + *a_fb_origin = reply->framebuffer_origin_offset; + *a_fb_size = reply->framebuffer_size; + *a_fb_stride = reply->framebuffer_stride; + *a_dev_private_size = reply->device_private_size; + *a_dev_private = calloc(reply->device_private_size, 1); + if (!*a_dev_private) + goto out; + memcpy(*a_dev_private, + xcb_xf86dri_get_device_info_device_private(reply), + reply->device_private_size); + is_ok = TRUE; +out: + free(reply); EPHYR_LOG("leave:%d\n", is_ok); return is_ok; } diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c index 617ffb158..13df60a5b 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c @@ -39,6 +39,9 @@ #define _XF86DRI_SERVER_ #include <X11/dri/xf86dri.h> #include <X11/dri/xf86driproto.h> +#include <xcb/xcb.h> +#include <xcb/shape.h> +#include <xcb/xf86dri.h> #include "misc.h" #include "privates.h" #include "dixstruct.h" @@ -1319,12 +1322,12 @@ ephyrDRIExtensionInit(ScreenPtr a_screen) EphyrDRIScreenPrivPtr screen_priv = NULL; EPHYR_LOG("enter\n"); - if (!hostx_has_dri()) { + if (!host_has_extension(&xcb_xf86dri_id)) { EPHYR_LOG("host does not have DRI extension\n"); goto out; } EPHYR_LOG("host X does have DRI extension\n"); - if (!hostx_has_xshape()) { + if (!host_has_extension(&xcb_shape_id)) { EPHYR_LOG("host does not have XShape extension\n"); goto out; } diff --git a/xorg-server/hw/kdrive/ephyr/ephyrglxext.c b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c index 22d510891..632a9c474 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrglxext.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c @@ -29,6 +29,7 @@ #include <kdrive-config.h> #endif +#include <xcb/glx.h> #include "extnsionst.h" #include "ephyrglxext.h" #include "ephyrhostglx.h" @@ -83,7 +84,7 @@ ephyrHijackGLXExtension(void) { const void *(*dispatch_functions)[2]; - if (!hostx_has_glx()) { + if (!host_has_extension(&xcb_glx_id)) { EPHYR_LOG("host X does not have GLX\n"); return FALSE; } @@ -380,10 +381,9 @@ ephyrGLXQueryServerString(__GLXclientState * a_cl, GLbyte * a_pc) int length = 0; EPHYR_LOG("enter\n"); - if (!ephyrHostGLXGetStringFromServer(req->screen, - req->name, - EPHYR_HOST_GLX_QueryServerString, - &server_string)) { + if (!ephyrHostGLXQueryServerString(req->screen, + req->name, + &server_string)) { EPHYR_LOG_ERROR("failed to query string from host\n"); goto out; } @@ -724,9 +724,7 @@ ephyrGLXGetStringReal(__GLXclientState * a_cl, GLbyte * a_pc, Bool a_do_swap) a_pc += __GLX_SINGLE_HDR_SIZE; name = *(GLenum *) (a_pc + 0); EPHYR_LOG("context_tag:%d, name:%d\n", context_tag, name); - if (!ephyrHostGLXGetStringFromServer(context_tag, - name, - EPHYR_HOST_GLX_GetString, &string)) { + if (!ephyrHostGLXGetString(context_tag, name, &string)) { EPHYR_LOG_ERROR("failed to get string from server\n"); goto out; } diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c index 5ecb02d23..007524d04 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.c @@ -31,22 +31,10 @@ #include <kdrive-config.h> #endif -/* - * including some server headers (like kdrive-config.h) - * might define the macro _XSERVER64 - * on 64 bits machines. That macro must _NOT_ be defined for Xlib - * client code, otherwise bad things happen. - * So let's undef that macro if necessary. - */ -#ifdef _XSERVER64 -#undef _XSERVER64 -#endif - -#include <X11/Xlibint.h> -#include <GL/glx.h> -#include <GL/internal/glcore.h> +#include <X11/Xdefs.h> +#include <X11/Xmd.h> #include <GL/glxproto.h> -#include <GL/glxint.h> +#include <xcb/glx.h> #include "ephyrhostglx.h" #define _HAVE_XALLOC_DECLS #include "ephyrlog.h" @@ -62,41 +50,20 @@ enum VisualConfRequestType { static Bool ephyrHostGLXGetVisualConfigsInternal (enum VisualConfRequestType a_type, + xcb_glx_get_visual_configs_reply_t *reply, int32_t a_screen, - int32_t * a_num_visuals, - int32_t * a_num_props, int32_t * a_props_buf_size, int32_t ** a_props_buf); -Bool -ephyrHostGLXGetMajorOpcode(int *a_opcode) -{ - Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - static int opcode; - int first_event_return = 0, first_error_return = 0; - - EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE); - EPHYR_LOG("enter\n"); - if (!opcode) { - if (!XQueryExtension(dpy, GLX_EXTENSION_NAME, &opcode, - &first_event_return, &first_error_return)) { - EPHYR_LOG_ERROR("XQueryExtension() failed\n"); - goto out; - } - } - *a_opcode = opcode; - is_ok = TRUE; - out: - EPHYR_LOG("release\n"); - return is_ok; -} + int32_t *a_num_visuals, + int32_t *a_num_props, + int32_t *a_props_buf_size, + int32_t **a_props_buf); Bool ephyrHostGLXQueryVersion(int *a_major, int *a_minor) { Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - int major_opcode = 0; - xGLXQueryVersionReq *req = NULL; - xGLXQueryVersionReply reply; + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_glx_query_version_cookie_t cookie; + xcb_glx_query_version_reply_t *reply; EPHYR_RETURN_VAL_IF_FAIL(a_major && a_minor, FALSE); EPHYR_LOG("enter\n"); @@ -107,26 +74,14 @@ ephyrHostGLXQueryVersion(int *a_major, int *a_minor) return TRUE; } - if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { - EPHYR_LOG_ERROR("failed to get major opcode\n"); - goto out; - } - EPHYR_LOG("major opcode: %d\n", major_opcode); - /* Send the glXQueryVersion request */ - memset(&reply, 0, sizeof(reply)); - LockDisplay(dpy); - GetReq(GLXQueryVersion, req); - req->reqType = major_opcode; - req->glxCode = X_GLXQueryVersion; - req->majorVersion = 2; - req->minorVersion = 1; - _XReply(dpy, (xReply *) &reply, 0, False); - UnlockDisplay(dpy); - SyncHandle(); - - *a_major = glx_major = reply.majorVersion; - *a_minor = glx_minor = reply.minorVersion; + cookie = xcb_glx_query_version(conn, 2, 1); + reply = xcb_glx_query_version_reply(conn, cookie, NULL); + if (!reply) + goto out; + *a_major = reply->major_version; + *a_minor = reply->minor_version; + free(reply); EPHYR_LOG("major:%d, minor:%d\n", *a_major, *a_minor); @@ -136,129 +91,63 @@ ephyrHostGLXQueryVersion(int *a_major, int *a_minor) return is_ok; } -/** - * GLX protocol structure for the ficticious "GLXGenericGetString" request. - * - * This is a non-existant protocol packet. It just so happens that all of - * the real protocol packets used to request a string from the server have - * an identical binary layout. The only difference between them is the - * meaning of the \c for_whom field and the value of the \c glxCode. - * (this has been copied from the mesa source code) - */ -typedef struct GLXGenericGetString { - CARD8 reqType; - CARD8 glxCode; - CARD16 length B16; - CARD32 for_whom B32; - CARD32 name B32; -} xGLXGenericGetStringReq; - -/* These defines are only needed to make the GetReq macro happy. - */ -#define sz_xGLXGenericGetStringReq 12 -#define X_GLXGenericGetString 0 - Bool -ephyrHostGLXGetStringFromServer(int a_screen_number, - int a_string_name, - enum EphyrHostGLXGetStringOps a_op, - char **a_string) +ephyrHostGLXGetString(int a_context_tag, + int a_string_name, + char **a_string) { Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - int default_screen = DefaultScreen(dpy); - xGLXGenericGetStringReq *req = NULL; - xGLXSingleReply reply; - unsigned long length = 0, numbytes = 0; - int major_opcode = 0, get_string_op = 0; + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_glx_get_string_cookie_t cookie; + xcb_glx_get_string_reply_t *reply; - EPHYR_RETURN_VAL_IF_FAIL(dpy && a_string, FALSE); + EPHYR_RETURN_VAL_IF_FAIL(conn && a_string, FALSE); EPHYR_LOG("enter\n"); - switch (a_op) { - case EPHYR_HOST_GLX_QueryServerString: - get_string_op = X_GLXQueryServerString; - break; - case EPHYR_HOST_GLX_GetString: - get_string_op = X_GLsop_GetString; - EPHYR_LOG("Going to glXGetString. strname:%#x, ctxttag:%d\n", - a_string_name, a_screen_number); - break; - default: - EPHYR_LOG_ERROR("unknown EphyrHostGLXGetStringOp:%d\n", a_op); + cookie = xcb_glx_get_string(conn, a_context_tag, a_string_name); + reply = xcb_glx_get_string_reply(conn, cookie, NULL); + if (!reply) goto out; - } - - if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { - EPHYR_LOG_ERROR("failed to get major opcode\n"); - goto out; - } - EPHYR_LOG("major opcode: %d\n", major_opcode); - - LockDisplay(dpy); - - /* All of the GLX protocol requests for getting a string from the server - * look the same. The exact meaning of the a_for_whom field is usually - * either the screen number (for glXQueryServerString) or the context tag - * (for GLXSingle). - */ - GetReq(GLXGenericGetString, req); - req->reqType = major_opcode; - req->glxCode = get_string_op; - req->for_whom = default_screen; - req->name = a_string_name; - - _XReply(dpy, (xReply *) &reply, 0, False); - -#if UINT32_MAX >= (ULONG_MAX / 4) - if (reply.length >= (ULONG_MAX / 4)) { - _XEatDataWords(dpy, reply.length); - goto eat_out; - } -#endif - if (reply.length > 0) { - length = (unsigned long) reply.length * 4; - numbytes = reply.size; - if (numbytes > length) { - EPHYR_LOG_ERROR("string length %d longer than reply length %d\n", - numbytes, length); - goto eat_out; - } - } - EPHYR_LOG("going to get a string of size:%d\n", numbytes); - - if (numbytes < INT_MAX) - *a_string = Xcalloc(numbytes + 1, 1); - else - *a_string = NULL; - if (*a_string == NULL) { - EPHYR_LOG_ERROR("allocation failed\n"); - goto eat_out; - } + *a_string = malloc(reply->n + 1); + memcpy(*a_string, xcb_glx_get_string_string(reply), reply->n); + (*a_string)[reply->n] = '\0'; + free(reply); + is_ok = TRUE; +out: + EPHYR_LOG("leave\n"); + return is_ok; +} - if (_XRead(dpy, *a_string, numbytes)) { - EPHYR_LOG_ERROR("read failed\n"); - length = 0; /* if read failed, no idea how much to eat */ - } - else { - length -= numbytes; - EPHYR_LOG("strname:%#x, strvalue:'%s', strlen:%d\n", - a_string_name, *a_string, numbytes); - is_ok = TRUE; - } +Bool ephyrHostGLXQueryServerString(int a_screen_number, + int a_string_name, + char **a_string) +{ + Bool is_ok = FALSE; + xcb_connection_t *conn = hostx_get_xcbconn(); + int default_screen = hostx_get_screen(); + xcb_glx_query_server_string_cookie_t cookie; + xcb_glx_query_server_string_reply_t *reply; - eat_out: - _XEatData(dpy, length); - UnlockDisplay(dpy); - SyncHandle(); + EPHYR_RETURN_VAL_IF_FAIL(conn && a_string, FALSE); - out: + EPHYR_LOG("enter\n"); + cookie = xcb_glx_query_server_string(conn, default_screen, a_string_name); + reply = xcb_glx_query_server_string_reply(conn, cookie, NULL); + if (!reply) + goto out; + *a_string = malloc(reply->str_len + 1); + memcpy(*a_string, xcb_glx_query_server_string_string(reply), reply->str_len); + (*a_string)[reply->str_len] = '\0'; + free(reply); + is_ok = TRUE; +out: EPHYR_LOG("leave\n"); return is_ok; } static Bool ephyrHostGLXGetVisualConfigsInternal(enum VisualConfRequestType a_type, + xcb_glx_get_visual_configs_reply_t *reply, int32_t a_screen, int32_t * a_num_visuals, int32_t * a_num_props, @@ -266,110 +155,36 @@ ephyrHostGLXGetVisualConfigsInternal(enum VisualConfRequestType a_type, int32_t ** a_props_buf) { Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - xGLXGetVisualConfigsReq *req; - xGLXGetFBConfigsReq *fb_req; - xGLXVendorPrivateWithReplyReq *vpreq; - xGLXGetFBConfigsSGIXReq *sgi_req; - xGLXGetVisualConfigsReply reply; - char *server_glx_version = NULL, *server_glx_extensions = NULL; - int j = 0, - major_opcode = 0, - num_props = 0, - num_visuals = 0, props_buf_size = 0, props_per_visual_size = 0; + int num_props = 0, num_visuals = 0, props_buf_size = 0; + int props_per_visual_size = 0; int32_t *props_buf = NULL; - EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE); - - if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { - EPHYR_LOG_ERROR("failed to get opcode\n"); - goto out; - } - - LockDisplay(dpy); - switch (a_type) { - case EPHYR_GET_FB_CONFIG: - GetReq(GLXGetFBConfigs, fb_req); - fb_req->reqType = major_opcode; - fb_req->glxCode = X_GLXGetFBConfigs; - fb_req->screen = DefaultScreen(dpy); - break; - - case EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX: - GetReqExtra(GLXVendorPrivateWithReply, - sz_xGLXGetFBConfigsSGIXReq - - sz_xGLXVendorPrivateWithReplyReq, vpreq); - sgi_req = (xGLXGetFBConfigsSGIXReq *) vpreq; - sgi_req->reqType = major_opcode; - sgi_req->glxCode = X_GLXVendorPrivateWithReply; - sgi_req->vendorCode = X_GLXvop_GetFBConfigsSGIX; - sgi_req->screen = DefaultScreen(dpy); - break; - - case EPHYR_GET_VISUAL_CONFIGS: - GetReq(GLXGetVisualConfigs, req); - req->reqType = major_opcode; - req->glxCode = X_GLXGetVisualConfigs; - req->screen = DefaultScreen(dpy); - break; - } - - if (!_XReply(dpy, (xReply *) &reply, 0, False)) { - EPHYR_LOG_ERROR("unknown error\n"); - UnlockDisplay(dpy); - goto out; - } - if (!reply.numVisuals) { + if (!reply->num_visuals) { EPHYR_LOG_ERROR("screen does not support GL rendering\n"); - UnlockDisplay(dpy); - goto out; - } - num_visuals = reply.numVisuals; - - /* FIXME: Is the __GLX_MIN_CONFIG_PROPS test correct for - * FIXME: FBconfigs? - */ - /* Check number of properties */ - num_props = reply.numProps; - if ((num_props < __GLX_MIN_CONFIG_PROPS) || - (num_props > __GLX_MAX_CONFIG_PROPS)) { - /* Huh? Not in protocol defined limits. Punt */ - EPHYR_LOG_ERROR("got a bad reply to request\n"); - UnlockDisplay(dpy); goto out; } + num_visuals = reply->num_visuals; + + num_props = reply->num_properties; if (a_type != EPHYR_GET_VISUAL_CONFIGS) { num_props *= 2; } - props_per_visual_size = num_props * __GLX_SIZE_INT32; - props_buf_size = props_per_visual_size * reply.numVisuals; + props_per_visual_size = num_props * sizeof(uint32_t); + props_buf_size = props_per_visual_size * reply->num_visuals; props_buf = malloc(props_buf_size); - for (j = 0; j < reply.numVisuals; j++) { - if (_XRead(dpy, - &((char *) props_buf)[j * props_per_visual_size], - props_per_visual_size) != Success) { - EPHYR_LOG_ERROR("read failed\n"); - } - } - UnlockDisplay(dpy); + if (!props_buf) + goto out; + memcpy(props_buf, xcb_glx_get_visual_configs_property_list(reply), + props_buf_size); *a_num_visuals = num_visuals; - *a_num_props = reply.numProps; + *a_num_props = reply->num_properties; *a_props_buf_size = props_buf_size; *a_props_buf = props_buf; is_ok = TRUE; - out: - if (server_glx_version) { - XFree(server_glx_version); - server_glx_version = NULL; - } - if (server_glx_extensions) { - XFree(server_glx_extensions); - server_glx_extensions = NULL; - } - SyncHandle(); +out: return is_ok; } @@ -380,14 +195,27 @@ ephyrHostGLXGetVisualConfigs(int32_t a_screen, int32_t * a_props_buf_size, int32_t ** a_props_buf) { Bool is_ok = FALSE; + xcb_glx_get_visual_configs_cookie_t cookie; + xcb_glx_get_visual_configs_reply_t *reply; + xcb_connection_t *conn = hostx_get_xcbconn(); + int screen = hostx_get_screen(); EPHYR_LOG("enter\n"); - is_ok = ephyrHostGLXGetVisualConfigsInternal(EPHYR_GET_VISUAL_CONFIGS, - a_screen, - a_num_visuals, - a_num_props, - a_props_buf_size, a_props_buf); - + cookie = xcb_glx_get_visual_configs(conn, screen); + reply = xcb_glx_get_visual_configs_reply(conn, cookie, NULL); + if (!reply) + goto out; + is_ok = ephyrHostGLXGetVisualConfigsInternal + (EPHYR_GET_VISUAL_CONFIGS, + reply, + a_screen, + a_num_visuals, + a_num_props, + a_props_buf_size, + a_props_buf); + +out: + free(reply); EPHYR_LOG("leave:%d\n", is_ok); return is_ok; } @@ -399,12 +227,32 @@ ephyrHostGLXVendorPrivGetFBConfigsSGIX(int a_screen, int32_t * a_props_buf_size, int32_t ** a_props_buf) { - Bool is_ok = FALSE; + Bool is_ok=FALSE; + xcb_connection_t *conn = hostx_get_xcbconn(); + int screen = hostx_get_screen(); + xcb_glx_vendor_private_with_reply_cookie_t cookie; + union { + xcb_glx_vendor_private_with_reply_reply_t *vprep; + xcb_glx_get_visual_configs_reply_t *rep; + } reply; EPHYR_LOG("enter\n"); + cookie = xcb_glx_vendor_private_with_reply(conn, + X_GLXvop_GetFBConfigsSGIX, + 0, 4, (uint8_t *)&screen); + reply.vprep = xcb_glx_vendor_private_with_reply_reply(conn, cookie, NULL); + if (!reply.vprep) + goto out; is_ok = ephyrHostGLXGetVisualConfigsInternal (EPHYR_VENDOR_PRIV_GET_FB_CONFIG_SGIX, - a_screen, a_num_visuals, a_num_props, a_props_buf_size, a_props_buf); + reply.rep, + a_screen, + a_num_visuals, + a_num_props, + a_props_buf_size, + a_props_buf); +out: + free(reply.vprep); EPHYR_LOG("leave\n"); return is_ok; } @@ -413,39 +261,15 @@ Bool ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor, const char *a_extension_list) { - Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - xGLXClientInfoReq *req; + xcb_connection_t *conn = hostx_get_xcbconn(); int size; - int32_t major_opcode = 0; - - EPHYR_RETURN_VAL_IF_FAIL(dpy && a_extension_list, FALSE); - - if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { - EPHYR_LOG_ERROR("failed to get major opcode\n"); - goto out; - } - - LockDisplay(dpy); - GetReq(GLXClientInfo, req); - req->reqType = major_opcode; - req->glxCode = X_GLXClientInfo; - req->major = a_major; - req->minor = a_minor; + EPHYR_RETURN_VAL_IF_FAIL(conn && a_extension_list, FALSE); - size = strlen(a_extension_list) + 1; - req->length += bytes_to_int32(size); - req->numbytes = size; - Data(dpy, a_extension_list, size); + size = strlen (a_extension_list) + 1; + xcb_glx_client_info(conn, a_major, a_minor, size, a_extension_list); - UnlockDisplay(dpy); - SyncHandle(); - - is_ok = TRUE; - - out: - return is_ok; + return TRUE; } Bool @@ -457,9 +281,9 @@ ephyrHostGLXCreateContext(int a_screen, Bool a_direct, int code) { + xcb_connection_t *conn = hostx_get_xcbconn(); Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - int major_opcode = 0, remote_context_id = 0; + int remote_context_id = 0; EPHYR_LOG("enter. screen:%d, generic_id:%d, contextid:%d, rendertype:%d, " "direct:%d\n", a_screen, a_generic_id, a_context_id, @@ -471,39 +295,24 @@ ephyrHostGLXCreateContext(int a_screen, goto out; } - if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { - EPHYR_LOG_ERROR("failed to get major opcode\n"); - goto out; - } - - LockDisplay(dpy); - switch (code) { case X_GLXCreateContext: { - /* Send the glXCreateContext request */ - xGLXCreateContextReq *req; - GetReq(GLXCreateContext, req); - req->reqType = major_opcode; - req->glxCode = X_GLXCreateContext; - req->context = remote_context_id; - req->visual = a_generic_id; - req->screen = DefaultScreen(dpy); - req->shareList = a_share_list_ctxt_id; - req->isDirect = a_direct; - } + xcb_glx_create_context(conn, + remote_context_id, + a_generic_id, + hostx_get_screen(), + a_share_list_ctxt_id, + a_direct); + } case X_GLXCreateNewContext: { - /* Send the glXCreateNewContext request */ - xGLXCreateNewContextReq *req; - GetReq(GLXCreateNewContext, req); - req->reqType = major_opcode; - req->glxCode = X_GLXCreateNewContext; - req->context = remote_context_id; - req->fbconfig = a_generic_id; - req->screen = DefaultScreen(dpy); - req->renderType = a_render_type; - req->shareList = a_share_list_ctxt_id; - req->isDirect = a_direct; + xcb_glx_create_new_context(conn, + remote_context_id, + a_generic_id, + hostx_get_screen(), + a_render_type, + a_share_list_ctxt_id, + a_direct); } default: @@ -511,9 +320,6 @@ ephyrHostGLXCreateContext(int a_screen, EPHYR_LOG("Internal error! Invalid CreateContext code!\n"); } - UnlockDisplay(dpy); - SyncHandle(); - is_ok = TRUE; out: @@ -524,30 +330,19 @@ ephyrHostGLXCreateContext(int a_screen, Bool ephyrHostDestroyContext(int a_ctxt_id) { + xcb_connection_t *conn = hostx_get_xcbconn(); Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - int major_opcode = 0, remote_ctxt_id = 0; - xGLXDestroyContextReq *req = NULL; + int remote_ctxt_id = 0; EPHYR_LOG("enter:%d\n", a_ctxt_id); - if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { - EPHYR_LOG_ERROR("failed to get major opcode\n"); - goto out; - } if (!hostx_get_resource_id_peer(a_ctxt_id, &remote_ctxt_id)) { EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n"); goto out; } EPHYR_LOG("host context id:%d\n", remote_ctxt_id); - LockDisplay(dpy); - GetReq(GLXDestroyContext, req); - req->reqType = major_opcode; - req->glxCode = X_GLXDestroyContext; - req->context = remote_ctxt_id; - UnlockDisplay(dpy); - SyncHandle(); + xcb_glx_destroy_context(conn, remote_ctxt_id); is_ok = TRUE; @@ -560,81 +355,71 @@ Bool ephyrHostGLXMakeCurrent(int a_drawable, int a_readable, int a_glx_ctxt_id, int a_old_ctxt_tag, int *a_ctxt_tag) { + xcb_connection_t *conn = hostx_get_xcbconn(); Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - int32_t major_opcode = 0; int remote_glx_ctxt_id = 0; - xGLXMakeCurrentReply reply; EPHYR_RETURN_VAL_IF_FAIL(a_ctxt_tag, FALSE); EPHYR_LOG("enter. drawable:%d, read:%d, context:%d, oldtag:%d\n", a_drawable, a_readable, a_glx_ctxt_id, a_old_ctxt_tag); - if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { - EPHYR_LOG_ERROR("failed to get major opcode\n"); - goto out; - } if (!hostx_get_resource_id_peer(a_glx_ctxt_id, &remote_glx_ctxt_id)) { EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n"); goto out; } - LockDisplay(dpy); - /* If both drawables are the same, use the old MakeCurrent request. * Otherwise, if we have GLX 1.3 or higher, use the MakeContextCurrent * request which supports separate read and draw targets. Failing that, * try the SGI MakeCurrentRead extension. Logic cribbed from Mesa. */ if (a_drawable == a_readable) { - xGLXMakeCurrentReq *req; - - GetReq(GLXMakeCurrent, req); - req->reqType = major_opcode; - req->glxCode = X_GLXMakeCurrent; - req->drawable = a_drawable; - req->context = remote_glx_ctxt_id; - req->oldContextTag = a_old_ctxt_tag; + xcb_glx_make_current_cookie_t cookie; + xcb_glx_make_current_reply_t *reply; + cookie = xcb_glx_make_current(conn, + a_drawable, + remote_glx_ctxt_id, + a_old_ctxt_tag); + reply = xcb_glx_make_current_reply(conn, cookie, NULL); + if (!reply) + goto out; + *a_ctxt_tag = reply->context_tag; + free(reply); } else if (glx_major > 1 || glx_minor >= 3) { - xGLXMakeContextCurrentReq *req; - - GetReq(GLXMakeContextCurrent, req); - req->reqType = major_opcode; - req->glxCode = X_GLXMakeContextCurrent; - req->drawable = a_drawable; - req->readdrawable = a_readable; - req->context = remote_glx_ctxt_id; - req->oldContextTag = a_old_ctxt_tag; + xcb_glx_make_context_current_cookie_t cookie; + xcb_glx_make_context_current_reply_t *reply; + cookie = xcb_glx_make_context_current(conn, + a_old_ctxt_tag, + a_drawable, + a_readable, + remote_glx_ctxt_id); + reply = xcb_glx_make_context_current_reply(conn, cookie, NULL); + if (!reply) + goto out; + *a_ctxt_tag = reply->context_tag; + free(reply); } else { - xGLXVendorPrivateWithReplyReq *vpreq; - xGLXMakeCurrentReadSGIReq *req; - - GetReqExtra(GLXVendorPrivateWithReply, - (sz_xGLXMakeCurrentReadSGIReq - - sz_xGLXVendorPrivateWithReplyReq), - vpreq); - req = (xGLXMakeCurrentReadSGIReq *) vpreq; - req->reqType = major_opcode; - req->glxCode = X_GLXVendorPrivateWithReply; - req->vendorCode = X_GLXvop_MakeCurrentReadSGI; - req->drawable = a_drawable; - req->readable = a_readable; - req->context = remote_glx_ctxt_id; - req->oldContextTag = a_old_ctxt_tag; - } + xcb_glx_vendor_private_with_reply_cookie_t cookie; + xcb_glx_vendor_private_with_reply_reply_t *reply; + uint32_t data[3] = { + a_drawable, a_readable, remote_glx_ctxt_id, + }; - memset(&reply, 0, sizeof(reply)); - if (!_XReply(dpy, (xReply *) &reply, 0, False)) { - EPHYR_LOG_ERROR("failed to get reply from host\n"); - UnlockDisplay(dpy); - SyncHandle(); - goto out; + EPHYR_LOG("enter\n"); + cookie = xcb_glx_vendor_private_with_reply(conn, + X_GLXvop_MakeCurrentReadSGI, + a_old_ctxt_tag, + sizeof(data), + (uint8_t *)data); + reply = xcb_glx_vendor_private_with_reply_reply(conn, cookie, NULL); + + *a_ctxt_tag = reply->retval; + + free(reply); } - UnlockDisplay(dpy); - SyncHandle(); - *a_ctxt_tag = reply.contextTag; + EPHYR_LOG("context tag:%d\n", *a_ctxt_tag); is_ok = TRUE; @@ -643,79 +428,32 @@ ephyrHostGLXMakeCurrent(int a_drawable, int a_readable, return is_ok; } -#define X_GLXSingle 0 - -#define __EPHYR_GLX_SINGLE_PUT_CHAR(offset,a) \ - *((INT8 *) (pc + offset)) = a - -#define EPHYR_GLX_SINGLE_PUT_SHORT(offset,a) \ - *((INT16 *) (pc + offset)) = a - -#define EPHYR_GLX_SINGLE_PUT_LONG(offset,a) \ - *((INT32 *) (pc + offset)) = a - -#define EPHYR_GLX_SINGLE_PUT_FLOAT(offset,a) \ - *((FLOAT32 *) (pc + offset)) = a - -#define EPHYR_GLX_SINGLE_READ_XREPLY() \ - (void) _XReply(dpy, (xReply*) &reply, 0, False) - -#define EPHYR_GLX_SINGLE_GET_RETVAL(a,cast) \ - a = (cast) reply.retval - -#define EPHYR_GLX_SINGLE_GET_SIZE(a) \ - a = (GLint) reply.size - -#define EPHYR_GLX_SINGLE_GET_CHAR(p) \ - *p = *(GLbyte *)&reply.pad3; - -#define EPHYR_GLX_SINGLE_GET_SHORT(p) \ - *p = *(GLshort *)&reply.pad3; - -#define EPHYR_GLX_SINGLE_GET_LONG(p) \ - *p = *(GLint *)&reply.pad3; - -#define EPHYR_GLX_SINGLE_GET_FLOAT(p) \ - *p = *(GLfloat *)&reply.pad3; - Bool ephyrHostGetIntegerValue(int a_current_context_tag, int a_int, int *a_val) { + xcb_connection_t *conn = hostx_get_xcbconn(); Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - int major_opcode = 0, size = 0; - xGLXSingleReq *req = NULL; - xGLXSingleReply reply; - unsigned char *pc = NULL; + int size = 0; + xcb_glx_get_integerv_cookie_t cookie; + xcb_glx_get_integerv_reply_t *reply; EPHYR_RETURN_VAL_IF_FAIL(a_val, FALSE); EPHYR_LOG("enter\n"); - if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { - EPHYR_LOG_ERROR("failed to get major opcode\n"); + cookie = xcb_glx_get_integerv(conn, a_current_context_tag, a_int); + reply = xcb_glx_get_integerv_reply(conn, cookie, NULL); + if (!reply) goto out; - } - LockDisplay(dpy); - GetReqExtra(GLXSingle, 4, req); - req->reqType = major_opcode; - req->glxCode = X_GLsop_GetIntegerv; - req->contextTag = a_current_context_tag; - pc = ((unsigned char *) (req) + sz_xGLXSingleReq); - EPHYR_GLX_SINGLE_PUT_LONG(0, a_int); - EPHYR_GLX_SINGLE_READ_XREPLY(); - EPHYR_GLX_SINGLE_GET_SIZE(size); + size = reply->n; if (!size) { - UnlockDisplay(dpy); - SyncHandle(); EPHYR_LOG_ERROR("X_GLsop_GetIngerv failed\n"); goto out; } - EPHYR_GLX_SINGLE_GET_LONG(a_val); - UnlockDisplay(dpy); - SyncHandle(); + *a_val = reply->datum; is_ok = TRUE; - out: +out: + free(reply); EPHYR_LOG("leave\n"); return is_ok; } @@ -724,40 +462,29 @@ Bool ephyrHostIsContextDirect(int a_ctxt_id, int *a_is_direct) { Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - xGLXIsDirectReq *req = NULL; - xGLXIsDirectReply reply; - int major_opcode = 0, remote_glx_ctxt_id = 0; + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_glx_is_direct_cookie_t cookie; + xcb_glx_is_direct_reply_t *reply = NULL; + int remote_glx_ctxt_id = 0; EPHYR_LOG("enter\n"); - if (!ephyrHostGLXGetMajorOpcode(&major_opcode)) { - EPHYR_LOG_ERROR("failed to get major opcode\n"); + if (!hostx_get_resource_id_peer (a_ctxt_id, &remote_glx_ctxt_id)) { + EPHYR_LOG_ERROR ("failed to get remote glx ctxt id\n"); goto out; } - if (!hostx_get_resource_id_peer(a_ctxt_id, &remote_glx_ctxt_id)) { - EPHYR_LOG_ERROR("failed to get remote glx ctxt id\n"); - goto out; - } - memset(&reply, 0, sizeof(reply)); /* Send the glXIsDirect request */ - LockDisplay(dpy); - GetReq(GLXIsDirect, req); - req->reqType = major_opcode; - req->glxCode = X_GLXIsDirect; - req->context = remote_glx_ctxt_id; - if (!_XReply(dpy, (xReply *) &reply, 0, False)) { + cookie = xcb_glx_is_direct(conn, remote_glx_ctxt_id); + reply = xcb_glx_is_direct_reply(conn, cookie, NULL); + if (!reply) { EPHYR_LOG_ERROR("fail in reading reply from host\n"); - UnlockDisplay(dpy); - SyncHandle(); goto out; } - UnlockDisplay(dpy); - SyncHandle(); - *a_is_direct = reply.isDirect; + *a_is_direct = reply->is_direct; is_ok = TRUE; - out: +out: + free(reply); EPHYR_LOG("leave\n"); return is_ok; } diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h index 7ff515dc2..309d0f2f7 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h +++ b/xorg-server/hw/kdrive/ephyr/ephyrhostglx.h @@ -35,10 +35,12 @@ enum EphyrHostGLXGetStringOps { }; Bool ephyrHostGLXQueryVersion(int *a_maj, int *a_min); -Bool ephyrHostGLXGetStringFromServer(int a_screen_number, - int a_string_name, - enum EphyrHostGLXGetStringOps a_op, - char **a_string); +Bool ephyrHostGLXGetString(int a_context_tag, + int a_string_name, + char **a_string); +Bool ephyrHostGLXQueryServerString(int a_screen_number, + int a_string_name, + char **a_string); Bool ephyrHostGLXGetVisualConfigs(int a_screen, int32_t * a_num_visuals, int32_t * a_num_props, @@ -51,7 +53,6 @@ ephyrHostGLXVendorPrivGetFBConfigsSGIX(int a_screen, int32_t * a_num_props, int32_t * a_props_buf_size, int32_t ** a_props_buf); -Bool ephyrHostGLXGetMajorOpcode(int32_t * a_opcode); Bool ephyrHostGLXSendClientInfo(int32_t a_major, int32_t a_minor, const char *a_extension_list); Bool ephyrHostGLXCreateContext(int a_screen, diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c deleted file mode 100644 index a4f25c159..000000000 --- a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum <mallum@openedhand.com> - * - * Copyright © 2007 OpenedHand Ltd - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of OpenedHand Ltd not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OpenedHand Ltd makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Dodji Seketeli <dodji@openedhand.com> - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif - -#include <X11/Xlibint.h> -#define _HAVE_XALLOC_DECLS -#include "ephyrlog.h" -#include "ephyrhostproxy.h" -#include "hostx.h" - -/* byte swap a short */ -#define swaps(x, n) { \ - n = ((char *) (x))[0];\ - ((char *) (x))[0] = ((char *) (x))[1];\ - ((char *) (x))[1] = n; } - -#define GetXReq(req) \ - WORD64ALIGN ;\ - if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xReq *)(dpy->last_req = dpy->bufptr);\ - dpy->bufptr += SIZEOF(xReq);\ - dpy->request++ - -Bool -ephyrHostProxyDoForward(pointer a_request_buffer, - struct XReply *a_reply, Bool a_do_swap) -{ - Bool is_ok = FALSE; - int n = 0; - Display *dpy = hostx_get_display(); - xReq *in_req = (xReq *) a_request_buffer; - xReq *forward_req = NULL; - struct XReply reply; - - EPHYR_RETURN_VAL_IF_FAIL(in_req && dpy, FALSE); - - EPHYR_LOG("enter\n"); - - if (a_do_swap) { - swaps(&in_req->length); - } - EPHYR_LOG("Req {type:%d, data:%d, length:%d}\n", - in_req->reqType, in_req->data, in_req->length); - GetXReq(forward_req); - memmove(forward_req, in_req, 4); - - if (!_XReply(dpy, (xReply *) &reply, 0, FALSE)) { - EPHYR_LOG_ERROR("failed to get reply\n"); - goto out; - } - EPHYR_LOG("XReply{type:%d, foo:%d, seqnum:%d, length:%d}\n", - reply.type, reply.foo, reply.sequence_number, reply.length); - - if (a_reply) { - memmove(a_reply, &reply, sizeof(reply)); - } - is_ok = TRUE; - - out: - EPHYR_LOG("leave\n"); - return is_ok; -} diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h deleted file mode 100644 index 13721606a..000000000 --- a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum <mallum@openedhand.com> - * - * Copyright © 2007 OpenedHand Ltd - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of OpenedHand Ltd not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OpenedHand Ltd makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Dodji Seketeli <dodji@openedhand.com> - */ - -#ifndef __EPHYRHOSTPROXY_H__ -#define __EPHYRHOSTPROXY_H__ - -struct XReply { - int8_t type; /*X_Reply */ - int8_t foo; - int16_t sequence_number; - int32_t length; - /*following is some data up to 32 bytes lenght */ - int32_t pad0; - int32_t pad1; - int32_t pad2; - int32_t pad3; - int32_t pad4; - int32_t pad5; -}; - -Bool - -ephyrHostProxyDoForward(pointer a_request_buffer, - struct XReply *a_reply, Bool a_do_swap); - -#endif /*__EPHYRHOSTPROXY_H__*/ diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c deleted file mode 100644 index 99f0f5071..000000000 --- a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c +++ /dev/null @@ -1,975 +0,0 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum <mallum@openedhand.com> - * - * Copyright © 2007 OpenedHand Ltd - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of OpenedHand Ltd not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OpenedHand Ltd makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Dodji Seketeli <dodji@openedhand.com> - */ -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif -/* - * including some server headers (like kdrive-config.h) - * might define the macro _XSERVER64 - * on 64 bits machines. That macro must _NOT_ be defined for Xlib - * client code, otherwise bad things happen. - * So let's undef that macro if necessary. - */ -#ifdef _XSERVER64 -#undef _XSERVER64 -#endif -#include <X11/Xutil.h> -#include <X11/Xlibint.h> -#include <X11/extensions/Xvlib.h> -#include <X11/extensions/Xvproto.h> -#include <X11/extensions/Xext.h> -#include <X11/extensions/extutil.h> -#define _HAVE_XALLOC_DECLS - -#include "hostx.h" -#include "ephyrhostvideo.h" -#include "ephyrlog.h" - -#ifndef TRUE -#define TRUE 1 -#endif /*TRUE*/ -#ifndef FALSE -#define FALSE 0 -#endif /*FALSE*/ -static XExtensionInfo _xv_info_data; -static XExtensionInfo *xv_info = &_xv_info_data; -static const char *xv_extension_name = XvName; -static char *xv_error_string(Display * dpy, int code, XExtCodes * codes, - char *buf, int n); -static int xv_close_display(Display * dpy, XExtCodes * codes); -static Bool xv_wire_to_event(Display * dpy, XEvent * host, xEvent *wire); - -static XExtensionHooks xv_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - xv_close_display, /* close_display */ - xv_wire_to_event, /* wire_to_event */ - NULL, /* event_to_wire */ - NULL, /* error */ - xv_error_string /* error_string */ -}; - -static const char *xv_error_list[] = { - "BadPort", /* XvBadPort */ - "BadEncoding", /* XvBadEncoding */ - "BadControl" /* XvBadControl */ -}; - -#define XvCheckExtension(dpy, i, val) \ - XextCheckExtension(dpy, i, xv_extension_name, val) -#define XvGetReq(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(xv##name##Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (xv##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->reqType = info->codes->major_opcode;\ - req->xvReqType = xv_##name; \ - req->length = (SIZEOF(xv##name##Req))>>2;\ - dpy->bufptr += SIZEOF(xv##name##Req);\ - dpy->request++ - -static -XEXT_GENERATE_CLOSE_DISPLAY(xv_close_display, xv_info) - -static -XEXT_GENERATE_FIND_DISPLAY(xv_find_display, xv_info, - xv_extension_name, - &xv_extension_hooks, XvNumEvents, NULL) - -static -XEXT_GENERATE_ERROR_STRING(xv_error_string, xv_extension_name, - XvNumErrors, xv_error_list) - -struct _EphyrHostXVAdaptorArray { - XvAdaptorInfo *adaptors; - unsigned int nb_adaptors; -}; - -/*heavily copied from libx11*/ -#define BUFSIZE 2048 -static void -ephyrHostXVLogXErrorEvent(Display * a_display, - XErrorEvent * a_err_event, FILE * a_fp) -{ - char buffer[BUFSIZ]; - char mesg[BUFSIZ]; - char number[32]; - const char *mtype = "XlibMessage"; - register _XExtension *ext = (_XExtension *) NULL; - _XExtension *bext = (_XExtension *) NULL; - Display *dpy = a_display; - - XGetErrorText(dpy, a_err_event->error_code, buffer, BUFSIZ); - XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); - (void) fprintf(a_fp, "%s: %s\n ", mesg, buffer); - XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", - mesg, BUFSIZ); - (void) fprintf(a_fp, mesg, a_err_event->request_code); - if (a_err_event->request_code < 128) { - snprintf(number, sizeof(number), "%d", a_err_event->request_code); - XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); - } - else { - for (ext = dpy->ext_procs; - ext && (ext->codes.major_opcode != a_err_event->request_code); - ext = ext->next); - if (ext) - strcpy(buffer, ext->name); - else - buffer[0] = '\0'; - } - (void) fprintf(a_fp, " (%s)\n", buffer); - if (a_err_event->request_code >= 128) { - XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", - mesg, BUFSIZ); - fputs(" ", a_fp); - (void) fprintf(a_fp, mesg, a_err_event->minor_code); - if (ext) { - snprintf(mesg, sizeof(mesg), "%s.%d", - ext->name, a_err_event->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); - (void) fprintf(a_fp, " (%s)", buffer); - } - fputs("\n", a_fp); - } - if (a_err_event->error_code >= 128) { - /* kludge, try to find the extension that caused it */ - buffer[0] = '\0'; - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->error_string) - (*ext->error_string) (dpy, a_err_event->error_code, &ext->codes, - buffer, BUFSIZ); - if (buffer[0]) { - bext = ext; - break; - } - if (ext->codes.first_error && - ext->codes.first_error < (int) a_err_event->error_code && - (!bext || ext->codes.first_error > bext->codes.first_error)) - bext = ext; - } - if (bext) - snprintf(buffer, sizeof(buffer), "%s.%d", bext->name, - a_err_event->error_code - bext->codes.first_error); - else - strcpy(buffer, "Value"); - XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); - if (mesg[0]) { - fputs(" ", a_fp); - (void) fprintf(a_fp, mesg, a_err_event->resourceid); - fputs("\n", a_fp); - } - /* let extensions try to print the values */ - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->error_values) - (*ext->error_values) (dpy, a_err_event, a_fp); - } - } - else if ((a_err_event->error_code == BadWindow) || - (a_err_event->error_code == BadPixmap) || - (a_err_event->error_code == BadCursor) || - (a_err_event->error_code == BadFont) || - (a_err_event->error_code == BadDrawable) || - (a_err_event->error_code == BadColor) || - (a_err_event->error_code == BadGC) || - (a_err_event->error_code == BadIDChoice) || - (a_err_event->error_code == BadValue) || - (a_err_event->error_code == BadAtom)) { - if (a_err_event->error_code == BadValue) - XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", - mesg, BUFSIZ); - else if (a_err_event->error_code == BadAtom) - XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", - mesg, BUFSIZ); - else - XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", - mesg, BUFSIZ); - fputs(" ", a_fp); - (void) fprintf(a_fp, mesg, a_err_event->resourceid); - fputs("\n", a_fp); - } - XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", - mesg, BUFSIZ); - fputs(" ", a_fp); - (void) fprintf(a_fp, mesg, a_err_event->serial); - XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d", - mesg, BUFSIZ); - fputs("\n ", a_fp); - (void) fprintf(a_fp, mesg, dpy->request); - fputs("\n", a_fp); -} - -static int -ephyrHostXVErrorHandler(Display * a_display, XErrorEvent * a_error_event) -{ - EPHYR_LOG_ERROR("got an error from the host xserver:\n"); - ephyrHostXVLogXErrorEvent(a_display, a_error_event, stderr); - return Success; -} - -void -ephyrHostXVInit(void) -{ - static Bool s_initialized; - - if (s_initialized) - return; - XSetErrorHandler(ephyrHostXVErrorHandler); - s_initialized = TRUE; -} - -Bool -ephyrHostXVQueryAdaptors(EphyrHostXVAdaptorArray ** a_adaptors) -{ - EphyrHostXVAdaptorArray *result = NULL; - int ret = 0; - Bool is_ok = FALSE; - - EPHYR_RETURN_VAL_IF_FAIL(a_adaptors, FALSE); - - EPHYR_LOG("enter\n"); - - result = calloc(1, sizeof(EphyrHostXVAdaptorArray)); - if (!result) - goto out; - - ret = XvQueryAdaptors(hostx_get_display(), - DefaultRootWindow(hostx_get_display()), - &result->nb_adaptors, &result->adaptors); - if (ret != Success) { - EPHYR_LOG_ERROR("failed to query host adaptors: %d\n", ret); - goto out; - } - *a_adaptors = result; - is_ok = TRUE; - - out: - EPHYR_LOG("leave\n"); - return is_ok; -} - -void -ephyrHostXVAdaptorArrayDelete(EphyrHostXVAdaptorArray * a_adaptors) -{ - if (!a_adaptors) - return; - if (a_adaptors->adaptors) { - XvFreeAdaptorInfo(a_adaptors->adaptors); - a_adaptors->adaptors = NULL; - a_adaptors->nb_adaptors = 0; - } - XFree(a_adaptors); -} - -int -ephyrHostXVAdaptorArrayGetSize(const EphyrHostXVAdaptorArray * a_this) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this, -1); - return a_this->nb_adaptors; -} - -EphyrHostXVAdaptor * -ephyrHostXVAdaptorArrayAt(const EphyrHostXVAdaptorArray * a_this, int a_index) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL); - - if (a_index >= a_this->nb_adaptors) - return NULL; - return (EphyrHostXVAdaptor *) &a_this->adaptors[a_index]; -} - -char -ephyrHostXVAdaptorGetType(const EphyrHostXVAdaptor * a_this) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this, -1); - return ((const XvAdaptorInfo *) a_this)->type; -} - -const char * -ephyrHostXVAdaptorGetName(const EphyrHostXVAdaptor * a_this) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL); - - return ((const XvAdaptorInfo *) a_this)->name; -} - -EphyrHostVideoFormat * -ephyrHostXVAdaptorGetVideoFormats(const EphyrHostXVAdaptor * a_this, - int *a_nb_formats) -{ - EphyrHostVideoFormat *formats = NULL; - int nb_formats = 0, i = 0; - XVisualInfo *visual_info, visual_info_template; - int nb_visual_info; - - EPHYR_RETURN_VAL_IF_FAIL(a_this, NULL); - - nb_formats = ((const XvAdaptorInfo *) a_this)->num_formats; - formats = calloc(nb_formats, sizeof(EphyrHostVideoFormat)); - for (i = 0; i < nb_formats; i++) { - memset(&visual_info_template, 0, sizeof(visual_info_template)); - visual_info_template.visualid = - ((const XvAdaptorInfo *) a_this)->formats[i].visual_id; - visual_info = XGetVisualInfo(hostx_get_display(), - VisualIDMask, - &visual_info_template, &nb_visual_info); - formats[i].depth = ((const XvAdaptorInfo *) a_this)->formats[i].depth; - formats[i].visual_class = visual_info->class; - XFree(visual_info); - } - if (a_nb_formats) - *a_nb_formats = nb_formats; - return formats; -} - -int -ephyrHostXVAdaptorGetNbPorts(const EphyrHostXVAdaptor * a_this) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this, -1); - - return ((const XvAdaptorInfo *) a_this)->num_ports; -} - -int -ephyrHostXVAdaptorGetFirstPortID(const EphyrHostXVAdaptor * a_this) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this, -1); - - return ((const XvAdaptorInfo *) a_this)->base_id; -} - -Bool -ephyrHostXVAdaptorHasPutVideo(const EphyrHostXVAdaptor * a_this, Bool *a_result) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE); - - if ((((const XvAdaptorInfo *) a_this)->type & - (XvVideoMask | XvInputMask)) == (XvVideoMask | XvInputMask)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - -Bool -ephyrHostXVAdaptorHasGetVideo(const EphyrHostXVAdaptor * a_this, Bool *a_result) -{ - if ((((const XvAdaptorInfo *) a_this)->type & - (XvVideoMask | XvOutputMask)) == (XvVideoMask | XvOutputMask)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - -Bool -ephyrHostXVAdaptorHasPutStill(const EphyrHostXVAdaptor * a_this, Bool *a_result) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE); - - if ((((const XvAdaptorInfo *) a_this)->type & - (XvStillMask | XvInputMask)) == (XvStillMask | XvInputMask)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - -Bool -ephyrHostXVAdaptorHasGetStill(const EphyrHostXVAdaptor * a_this, Bool *a_result) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE); - - if ((((const XvAdaptorInfo *) a_this)->type & - (XvStillMask | XvOutputMask)) == (XvStillMask | XvOutputMask)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - -Bool -ephyrHostXVAdaptorHasPutImage(const EphyrHostXVAdaptor * a_this, Bool *a_result) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_this && a_result, FALSE); - - if ((((const XvAdaptorInfo *) a_this)->type & - (XvImageMask | XvInputMask)) == (XvImageMask | XvInputMask)) - *a_result = TRUE; - else - *a_result = FALSE; - return TRUE; -} - -Bool -ephyrHostXVQueryEncodings(int a_port_id, - EphyrHostEncoding ** a_encodings, - unsigned int *a_num_encodings) -{ - EphyrHostEncoding *encodings = NULL; - XvEncodingInfo *encoding_info = NULL; - unsigned int num_encodings = 0, i; - int ret = 0; - - EPHYR_RETURN_VAL_IF_FAIL(a_encodings && a_num_encodings, FALSE); - - ret = XvQueryEncodings(hostx_get_display(), - a_port_id, &num_encodings, &encoding_info); - if (num_encodings && encoding_info) { - encodings = calloc(num_encodings, sizeof(EphyrHostEncoding)); - for (i = 0; i < num_encodings; i++) { - encodings[i].id = encoding_info[i].encoding_id; - encodings[i].name = strdup(encoding_info[i].name); - encodings[i].width = encoding_info[i].width; - encodings[i].height = encoding_info[i].height; - encodings[i].rate.numerator = encoding_info[i].rate.numerator; - encodings[i].rate.denominator = encoding_info[i].rate.denominator; - } - } - if (encoding_info) { - XvFreeEncodingInfo(encoding_info); - encoding_info = NULL; - } - *a_encodings = encodings; - *a_num_encodings = num_encodings; - - if (ret != Success) - return FALSE; - return TRUE; -} - -void -ephyrHostEncodingsDelete(EphyrHostEncoding * a_encodings, int a_num_encodings) -{ - int i = 0; - - if (!a_encodings) - return; - for (i = 0; i < a_num_encodings; i++) { - free(a_encodings[i].name); - a_encodings[i].name = NULL; - } - free(a_encodings); -} - -void -ephyrHostAttributesDelete(EphyrHostAttribute * a_attributes) -{ - if (!a_attributes) - return; - XFree(a_attributes); -} - -Bool -ephyrHostXVQueryPortAttributes(int a_port_id, - EphyrHostAttribute ** a_attributes, - int *a_num_attributes) -{ - EPHYR_RETURN_VAL_IF_FAIL(a_attributes && a_num_attributes, FALSE); - - *a_attributes = - (EphyrHostAttribute *) XvQueryPortAttributes(hostx_get_display(), - a_port_id, - a_num_attributes); - - return TRUE; -} - -Bool -ephyrHostXVQueryImageFormats(int a_port_id, - EphyrHostImageFormat ** a_formats, - int *a_num_format) -{ - XvImageFormatValues *result = NULL; - - EPHYR_RETURN_VAL_IF_FAIL(a_formats && a_num_format, FALSE); - - result = XvListImageFormats(hostx_get_display(), a_port_id, a_num_format); - *a_formats = (EphyrHostImageFormat *) result; - return TRUE; - -} - -Bool -ephyrHostXVSetPortAttribute(int a_port_id, int a_atom, int a_attr_value) -{ - int res = Success; - - EPHYR_LOG("atom,name,value: (%d,%s,%d)\n", - a_atom, XGetAtomName(hostx_get_display(), a_atom), a_attr_value); - - res = XvSetPortAttribute(hostx_get_display(), - a_port_id, a_atom, a_attr_value); - if (res != Success) { - EPHYR_LOG_ERROR("XvSetPortAttribute() failed: %d\n", res); - return FALSE; - } - XFlush(hostx_get_display()); - EPHYR_LOG("leave\n"); - - return TRUE; -} - -Bool -ephyrHostXVGetPortAttribute(int a_port_id, int a_atom, int *a_attr_value) -{ - int res = Success; - Bool ret = FALSE; - - EPHYR_RETURN_VAL_IF_FAIL(a_attr_value, FALSE); - - EPHYR_LOG("enter, a_port_id: %d, a_atomid: %d, attr_name: %s\n", - a_port_id, a_atom, XGetAtomName(hostx_get_display(), a_atom)); - - res = XvGetPortAttribute(hostx_get_display(), - a_port_id, a_atom, a_attr_value); - if (res != Success) { - EPHYR_LOG_ERROR("XvGetPortAttribute() failed: %d \n", res); - goto out; - } - EPHYR_LOG("atom,value: (%d, %d)\n", a_atom, *a_attr_value); - - ret = TRUE; - - out: - EPHYR_LOG("leave\n"); - return ret; -} - -Bool -ephyrHostXVQueryBestSize(int a_port_id, - Bool a_motion, - unsigned int a_frame_w, - unsigned int a_frame_h, - unsigned int a_drw_w, - unsigned int a_drw_h, - unsigned int *a_actual_w, unsigned int *a_actual_h) -{ - int res = 0; - Bool is_ok = FALSE; - - EPHYR_RETURN_VAL_IF_FAIL(a_actual_w && a_actual_h, FALSE); - - EPHYR_LOG("enter: frame (%dx%d), drw (%dx%d)\n", - a_frame_w, a_frame_h, a_drw_w, a_drw_h); - - res = XvQueryBestSize(hostx_get_display(), - a_port_id, - a_motion, - a_frame_w, a_frame_h, - a_drw_w, a_drw_h, a_actual_w, a_actual_h); - if (res != Success) { - EPHYR_LOG_ERROR("XvQueryBestSize() failed: %d\n", res); - goto out; - } - XSync(hostx_get_display(), FALSE); - - EPHYR_LOG("actual (%dx%d)\n", *a_actual_w, *a_actual_h); - is_ok = TRUE; - - out: - EPHYR_LOG("leave\n"); - return is_ok; -} - -static Bool -xv_wire_to_event(Display * dpy, XEvent * host, xEvent *wire) -{ - XExtDisplayInfo *info = xv_find_display(dpy); - XvEvent *re = (XvEvent *) host; - xvEvent *event = (xvEvent *) wire; - - XvCheckExtension(dpy, info, False); - - switch ((event->u.u.type & 0x7F) - info->codes->first_event) { - case XvVideoNotify: - re->xvvideo.type = event->u.u.type & 0x7f; - re->xvvideo.serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - re->xvvideo.send_event = ((event->u.u.type & 0x80) != 0); - re->xvvideo.display = dpy; - re->xvvideo.time = event->u.videoNotify.time; - re->xvvideo.reason = event->u.videoNotify.reason; - re->xvvideo.drawable = event->u.videoNotify.drawable; - re->xvvideo.port_id = event->u.videoNotify.port; - break; - case XvPortNotify: - re->xvport.type = event->u.u.type & 0x7f; - re->xvport.serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - re->xvport.send_event = ((event->u.u.type & 0x80) != 0); - re->xvport.display = dpy; - re->xvport.time = event->u.portNotify.time; - re->xvport.port_id = event->u.portNotify.port; - re->xvport.attribute = event->u.portNotify.attribute; - re->xvport.value = event->u.portNotify.value; - break; - default: - return False; - } - - return True; -} - -Bool -ephyrHostXVQueryImageAttributes(int a_port_id, - int a_image_id /*image fourcc code */ , - unsigned short *a_width, - unsigned short *a_height, - int *a_image_size, - int *a_pitches, int *a_offsets) -{ - Display *dpy = hostx_get_display(); - Bool ret = FALSE; - XExtDisplayInfo *info = xv_find_display(dpy); - xvQueryImageAttributesReq *req = NULL; - xvQueryImageAttributesReply rep; - - EPHYR_RETURN_VAL_IF_FAIL(a_width, FALSE); - EPHYR_RETURN_VAL_IF_FAIL(a_height, FALSE); - EPHYR_RETURN_VAL_IF_FAIL(a_image_size, FALSE); - - XvCheckExtension(dpy, info, FALSE); - - LockDisplay(dpy); - - XvGetReq(QueryImageAttributes, req); - req->id = a_image_id; - req->port = a_port_id; - req->width = *a_width; - req->height = *a_height; - /* - * read the reply - */ - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - EPHYR_LOG_ERROR("QeryImageAttribute req failed\n"); - goto out; - } - if (a_pitches && a_offsets) { - _XRead(dpy, (char *) a_pitches, rep.num_planes << 2); - _XRead(dpy, (char *) a_offsets, rep.num_planes << 2); - } - else { - _XEatDataWords(dpy, rep.length); - } - *a_width = rep.width; - *a_height = rep.height; - *a_image_size = rep.data_size; - - ret = TRUE; - - out: - UnlockDisplay(dpy); - SyncHandle(); - return ret; -} - -Bool -ephyrHostGetAtom(const char *a_name, Bool a_create_if_not_exists, int *a_atom) -{ - int atom = None; - - EPHYR_RETURN_VAL_IF_FAIL(a_atom, FALSE); - - atom = XInternAtom(hostx_get_display(), a_name, a_create_if_not_exists); - if (atom == None) { - return FALSE; - } - *a_atom = atom; - return TRUE; -} - -char * -ephyrHostGetAtomName(int a_atom) -{ - return XGetAtomName(hostx_get_display(), a_atom); -} - -void -ephyrHostFree(void *a_pointer) -{ - if (a_pointer) - XFree(a_pointer); -} - -Bool -ephyrHostXVPutImage(int a_screen_num, - int a_port_id, - int a_image_id, - int a_drw_x, - int a_drw_y, - int a_drw_w, - int a_drw_h, - int a_src_x, - int a_src_y, - int a_src_w, - int a_src_h, - int a_image_width, - int a_image_height, - unsigned char *a_buf, - EphyrHostBox * a_clip_rects, int a_clip_rect_nums) -{ - Bool is_ok = TRUE; - XvImage *xv_image = NULL; - GC gc = 0; - XGCValues gc_values; - Display *dpy = hostx_get_display(); - XRectangle *rects = NULL; - int res = 0; - - EPHYR_RETURN_VAL_IF_FAIL(a_buf, FALSE); - - EPHYR_LOG("enter, num_clip_rects: %d\n", a_clip_rect_nums); - - memset(&gc_values, 0, sizeof(gc_values)); - gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values); - if (!gc) { - EPHYR_LOG_ERROR("failed to create gc \n"); - goto out; - } - xv_image = (XvImage *) XvCreateImage(hostx_get_display(), - a_port_id, a_image_id, - NULL, a_image_width, a_image_height); - if (!xv_image) { - EPHYR_LOG_ERROR("failed to create image\n"); - goto out; - } - xv_image->data = (char *) a_buf; - if (a_clip_rect_nums) { - int i = 0; - - rects = calloc(a_clip_rect_nums, sizeof(XRectangle)); - for (i = 0; i < a_clip_rect_nums; i++) { - rects[i].x = a_clip_rects[i].x1; - rects[i].y = a_clip_rects[i].y1; - rects[i].width = a_clip_rects[i].x2 - a_clip_rects[i].x1; - rects[i].height = a_clip_rects[i].y2 - a_clip_rects[i].y1; - EPHYR_LOG("(x,y,w,h): (%d,%d,%d,%d)\n", - rects[i].x, rects[i].y, rects[i].width, rects[i].height); - } - XSetClipRectangles(dpy, gc, 0, 0, rects, a_clip_rect_nums, YXBanded); - /*this always returns 1 */ - } - res = XvPutImage(dpy, a_port_id, - hostx_get_window(a_screen_num), - gc, xv_image, - a_src_x, a_src_y, a_src_w, a_src_h, - a_drw_x, a_drw_y, a_drw_w, a_drw_h); - if (res != Success) { - EPHYR_LOG_ERROR("XvPutImage() failed: %d\n", res); - goto out; - } - is_ok = TRUE; - - out: - if (xv_image) { - XFree(xv_image); - xv_image = NULL; - } - if (gc) { - XFreeGC(dpy, gc); - gc = NULL; - } - free(rects); - rects = NULL; - EPHYR_LOG("leave\n"); - return is_ok; -} - -Bool -ephyrHostXVPutVideo(int a_screen_num, int a_port_id, - int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, - int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) -{ - Bool is_ok = FALSE; - int res = FALSE; - GC gc = 0; - XGCValues gc_values; - Display *dpy = hostx_get_display(); - - EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE); - - gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values); - if (!gc) { - EPHYR_LOG_ERROR("failed to create gc \n"); - goto out; - } - res = XvPutVideo(dpy, a_port_id, hostx_get_window(a_screen_num), gc, - a_vid_x, a_vid_y, a_vid_w, a_vid_h, - a_drw_x, a_drw_y, a_drw_w, a_drw_h); - - if (res != Success) { - EPHYR_LOG_ERROR("XvPutVideo() failed: %d\n", res); - goto out; - } - - is_ok = TRUE; - - out: - if (gc) { - XFreeGC(dpy, gc); - gc = NULL; - } - return is_ok; -} - -Bool -ephyrHostXVGetVideo(int a_screen_num, int a_port_id, - int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, - int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) -{ - Bool is_ok = FALSE; - int res = FALSE; - GC gc = 0; - XGCValues gc_values; - Display *dpy = hostx_get_display(); - - EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE); - - gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values); - if (!gc) { - EPHYR_LOG_ERROR("failed to create gc \n"); - goto out; - } - res = XvGetVideo(dpy, a_port_id, hostx_get_window(a_screen_num), gc, - a_vid_x, a_vid_y, a_vid_w, a_vid_h, - a_drw_x, a_drw_y, a_drw_w, a_drw_h); - - if (res != Success) { - EPHYR_LOG_ERROR("XvGetVideo() failed: %d\n", res); - goto out; - } - - is_ok = TRUE; - - out: - if (gc) { - XFreeGC(dpy, gc); - gc = NULL; - } - return is_ok; -} - -Bool -ephyrHostXVPutStill(int a_screen_num, int a_port_id, - int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, - int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) -{ - Bool is_ok = FALSE; - int res = FALSE; - GC gc = 0; - XGCValues gc_values; - Display *dpy = hostx_get_display(); - - EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE); - - gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values); - if (!gc) { - EPHYR_LOG_ERROR("failed to create gc \n"); - goto out; - } - res = XvPutStill(dpy, a_port_id, hostx_get_window(a_screen_num), gc, - a_vid_x, a_vid_y, a_vid_w, a_vid_h, - a_drw_x, a_drw_y, a_drw_w, a_drw_h); - - if (res != Success) { - EPHYR_LOG_ERROR("XvPutStill() failed: %d\n", res); - goto out; - } - - is_ok = TRUE; - - out: - if (gc) { - XFreeGC(dpy, gc); - gc = NULL; - } - return is_ok; -} - -Bool -ephyrHostXVGetStill(int a_screen_num, int a_port_id, - int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, - int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h) -{ - Bool is_ok = FALSE; - int res = FALSE; - GC gc = 0; - XGCValues gc_values; - Display *dpy = hostx_get_display(); - - EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE); - - gc = XCreateGC(dpy, hostx_get_window(a_screen_num), 0L, &gc_values); - if (!gc) { - EPHYR_LOG_ERROR("failed to create gc \n"); - goto out; - } - res = XvGetStill(dpy, a_port_id, hostx_get_window(a_screen_num), gc, - a_vid_x, a_vid_y, a_vid_w, a_vid_h, - a_drw_x, a_drw_y, a_drw_w, a_drw_h); - - if (res != Success) { - EPHYR_LOG_ERROR("XvGetStill() failed: %d\n", res); - goto out; - } - - is_ok = TRUE; - - out: - if (gc) { - XFreeGC(dpy, gc); - gc = NULL; - } - return is_ok; -} - -Bool -ephyrHostXVStopVideo(int a_screen_num, int a_port_id) -{ - int ret = 0; - Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - - EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE); - - EPHYR_LOG("enter\n"); - - ret = XvStopVideo(dpy, a_port_id, hostx_get_window(a_screen_num)); - if (ret != Success) { - EPHYR_LOG_ERROR("XvStopVideo() failed: %d \n", ret); - goto out; - } - is_ok = TRUE; - - out: - EPHYR_LOG("leave\n"); - return is_ok; -} diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h deleted file mode 100644 index 0d3177277..000000000 --- a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum <mallum@openedhand.com> - * - * Copyright © 2007 OpenedHand Ltd - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of OpenedHand Ltd not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OpenedHand Ltd makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Dodji Seketeli <dodji@openedhand.com> - */ -#ifndef __EPHYRHOSTVIDEO_H__ -#define __EPHYRHOSTVIDEO_H__ - -typedef void *EphyrHostXVAdaptor; -typedef struct _EphyrHostXVAdaptorArray EphyrHostXVAdaptorArray; - -typedef struct _EphyrHostVideoFormat { - char depth; - short visual_class; -} EphyrHostVideoFormat; - -typedef struct _EphyrHostRational { - int numerator; - int denominator; -} EphyrHostRational; - -typedef struct _EphyrHostEncoding { - int id; - char *name; - unsigned short width, height; - EphyrHostRational rate; -} EphyrHostEncoding; - -typedef struct _EphyrHostAttribute { - int flags; - int min_value; - int max_value; - char *name; -} EphyrHostAttribute; - -typedef struct _EphyrHostImageFormat { - int id; /* Unique descriptor for the format */ - int type; /* XvRGB, XvYUV */ - int byte_order; /* LSBFirst, MSBFirst */ - char guid[16]; /* Globally Unique IDentifier */ - int bits_per_pixel; - int format; /* XvPacked, XvPlanar */ - int num_planes; - - /* for RGB formats only */ - int depth; - unsigned int red_mask; - unsigned int green_mask; - unsigned int blue_mask; - - /* for YUV formats only */ - unsigned int y_sample_bits; - unsigned int u_sample_bits; - unsigned int v_sample_bits; - unsigned int horz_y_period; - unsigned int horz_u_period; - unsigned int horz_v_period; - unsigned int vert_y_period; - unsigned int vert_u_period; - unsigned int vert_v_period; - char component_order[32]; /* eg. UYVY */ - int scanline_order; /* XvTopToBottom, XvBottomToTop */ -} EphyrHostImageFormat; - -typedef struct { - unsigned short x1, y1, x2, y2; -} EphyrHostBox; - -void ephyrHostXVInit(void); - -void ephyrHostFree(void *a_pointer); - -/* - * host adaptor array - */ -Bool ephyrHostXVQueryAdaptors(EphyrHostXVAdaptorArray ** a_adaptors); -void ephyrHostXVAdaptorArrayDelete(EphyrHostXVAdaptorArray * a_adaptors); -int ephyrHostXVAdaptorArrayGetSize(const EphyrHostXVAdaptorArray * a_this); -EphyrHostXVAdaptor *ephyrHostXVAdaptorArrayAt(const EphyrHostXVAdaptorArray * - a_this, int a_index); - -/* - * host adaptor - */ - -char ephyrHostXVAdaptorGetType(const EphyrHostXVAdaptor * a_this); -const char *ephyrHostXVAdaptorGetName(const EphyrHostXVAdaptor * a_this); -EphyrHostVideoFormat *ephyrHostXVAdaptorGetVideoFormats - (const EphyrHostXVAdaptor * a_this, int *a_nb_formats); -int ephyrHostXVAdaptorGetNbPorts(const EphyrHostXVAdaptor * a_this); -int ephyrHostXVAdaptorGetFirstPortID(const EphyrHostXVAdaptor * a_this); - -Bool ephyrHostXVAdaptorHasPutVideo(const EphyrHostXVAdaptor * a_this, - Bool *a_result); -Bool ephyrHostXVAdaptorHasGetVideo(const EphyrHostXVAdaptor * a_this, - Bool *a_result); -Bool ephyrHostXVAdaptorHasPutStill(const EphyrHostXVAdaptor * a_this, - Bool *a_result); -Bool ephyrHostXVAdaptorHasGetStill(const EphyrHostXVAdaptor * a_this, - Bool *a_result); -Bool ephyrHostXVAdaptorHasPutImage(const EphyrHostXVAdaptor * a_this, - Bool *a_result); - -/* - * encoding - */ -Bool ephyrHostXVQueryEncodings(int a_port_id, - EphyrHostEncoding ** a_encodings, - unsigned int *a_num_encodings); - -void ephyrHostEncodingsDelete(EphyrHostEncoding * a_encodings, - int a_num_encodings); - -/* - * attribute - */ -Bool ephyrHostXVQueryPortAttributes(int a_port_id, - EphyrHostAttribute ** a_attributes, - int *a_num_attributes); - -void ephyrHostAttributesDelete(EphyrHostAttribute * a_attributes); - -/* - * image format - */ - -Bool ephyrHostXVQueryImageFormats(int a_port_id, - EphyrHostImageFormat ** a_formats, - int *a_num_format); -/* - * Port Attribute Get/Set - */ -Bool ephyrHostXVSetPortAttribute(int a_port_id, int a_atom, int a_attr_value); -Bool ephyrHostXVGetPortAttribute(int a_port_id, int a_atom, int *a_attr_value); - -/* - *size query - */ -Bool ephyrHostXVQueryBestSize(int a_port_id, - Bool a_motion, - unsigned int a_frame_w, - unsigned int a_frame_h, - unsigned int a_drw_w, - unsigned int a_drw_h, - unsigned int *a_actual_w, - unsigned int *a_actual_h); - -Bool ephyrHostXVQueryImageAttributes(int a_port_id, - int a_image_id /*image fourcc code */ , - unsigned short *a_width, - unsigned short *a_height, - int *a_image_size, - int *a_pitches, int *a_offsets); -/* - * atom - */ -Bool ephyrHostGetAtom(const char *a_name, - Bool a_create_if_not_exists, int *a_atom); -char *ephyrHostGetAtomName(int a_atom); - -/* - *PutImage - * (ignore clipping for now) - */ -Bool ephyrHostXVPutImage(int a_screen_num, - int a_port_id, - int a_image_id, - int a_drw_x, - int a_drw_y, - int a_drw_w, - int a_drw_h, - int a_src_x, - int a_src_y, - int a_src_w, - int a_src_h, - int a_image_width, - int a_image_height, - unsigned char *a_buf, - EphyrHostBox * a_clip_rects, int a_clip_rect_nums); - -/* - * Putvideo/PutStill/GetVideo - */ -Bool ephyrHostXVPutVideo(int a_screen_num, - int a_port_id, - int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, - int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h); - -Bool ephyrHostXVGetVideo(int a_screen_num, - int a_port_id, - int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, - int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h); - -Bool ephyrHostXVPutStill(int a_screen_num, - int a_port_id, - int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, - int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h); - -Bool ephyrHostXVGetStill(int a_screen_num, - int a_port_id, - int a_vid_x, int a_vid_y, int a_vid_w, int a_vid_h, - int a_drw_x, int a_drw_y, int a_drw_w, int a_drw_h); - -/* - * StopVideo - */ -Bool ephyrHostXVStopVideo(int a_screen_num, int a_port_id); - -#endif /*__EPHYRHOSTVIDEO_H__*/ diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c index 8d134907c..218e3b00c 100644..100755 --- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c @@ -28,6 +28,7 @@ #endif #include "ephyr.h" #include "ephyrlog.h" +#include "glx_extinit.h" extern Window EphyrPreExistingHostWin; extern Bool EphyrWantGrayScale; @@ -55,9 +56,28 @@ InitCard(char *name) } #ifndef _MSC_VER +static const ExtensionModule ephyrExtensions[] = { +#ifdef GLXEXT + { GlxExtensionInit, "GLX", &noGlxExtension }, +#endif +}; + +static +void ephyrExtensionInit(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(ephyrExtensions); i++) + LoadExtension(&ephyrExtensions[i], TRUE); +} + + void InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) { + if (serverGeneration == 1) + ephyrExtensionInit(); + KdInitOutput(pScreenInfo, argc, argv); } @@ -115,7 +135,7 @@ ddxUseMsg(void) ErrorF("\nXephyr Option Usage:\n"); ErrorF("-parent <XID> Use existing window as Xephyr root win\n"); - ErrorF("-host-cursor Re-use exisiting X host server cursor\n"); + ErrorF("-sw-cursor Render cursors in software in Xephyr\n"); ErrorF("-fullscreen Attempt to run Xephyr fullscreen\n"); ErrorF("-grayscale Simulate 8bit grayscale\n"); ErrorF("-resizeable Make Xephyr windows resizeable\n"); @@ -149,6 +169,9 @@ processScreenArg(const char *screen_size, char *parent_id) screen = KdScreenInfoAdd(card); KdParseScreen(screen, screen_size); + screen->driver = calloc(1, sizeof(EphyrScrPriv)); + if (!screen->driver) + FatalError("Couldn't alloc screen private\n"); if (parent_id) { p_id = strtol(parent_id, NULL, 0); @@ -203,8 +226,12 @@ ddxProcessArgument(int argc, char **argv, int i) UseMsg(); exit(1); } + else if (!strcmp(argv[i], "-sw-cursor")) { + hostx_use_sw_cursor(); + return 1; + } else if (!strcmp(argv[i], "-host-cursor")) { - hostx_use_host_cursor(); + /* Compatibility with the old command line argument, now the default. */ return 1; } else if (!strcmp(argv[i], "-fullscreen")) { @@ -381,7 +408,7 @@ ephyrCursorEnable(ScreenPtr pScreen) KdCardFuncs ephyrFuncs = { ephyrCardInit, /* cardinit */ - ephyrScreenInit, /* scrinit */ + ephyrScreenInitialize, /* scrinit */ ephyrInitScreen, /* initScreen */ ephyrFinishInitScreen, /* finishInitScreen */ ephyrCreateResources, /* createRes */ diff --git a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c deleted file mode 100644 index c24238c04..000000000 --- a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum <mallum@openedhand.com> - * - * Copyright © 2007 OpenedHand Ltd - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of OpenedHand Ltd not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OpenedHand Ltd makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Dodji Seketeli <dodji@openedhand.com> - */ - -/* - * \file - * This file defines a proxy extension that forwards requests. - * When a request to extension FOO is sent to Xephyr, that request is forwared - * to the host X, without even trying to know what the request means. - */ - -#ifdef HAVE_CONFIG_H -#include <kdrive-config.h> -#endif - -#include "misc.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include "ephyrproxyext.h" -#define _HAVE_XALLOC_DECLS -#include "ephyrlog.h" -#include "ephyrhostproxy.h" -#include "hostx.h" - -static Bool ephyrProxyGetHostExtensionInfo(const char *a_ext_name, - int *a_major_opcode, - int *a_first_event, - int *a_first_error); - -static int ephyrProxyProcDispatch(ClientPtr client); - -static Bool -ephyrProxyGetHostExtensionInfo(const char *a_ext_name, - int *a_major_opcode, - int *a_first_event, int *a_first_error) -{ - return hostx_get_extension_info(a_ext_name, a_major_opcode, - a_first_event, a_first_error); -} - -static int -ephyrProxyProcDispatch(ClientPtr a_client) -{ - int res = BadImplementation; - struct XReply reply; - - if (!ephyrHostProxyDoForward(a_client->requestBuffer, &reply, FALSE)) { - EPHYR_LOG_ERROR("forwarding failed\n"); - goto out; - } - reply.sequence_number = a_client->sequence; - res = Success; - - WriteToClient(a_client, 32, &reply); - - out: - return res; -} - -static void -ephyrProxyProcReset(ExtensionEntry * a_entry) -{ -} - -Bool -ephyrProxyExtensionInit(const char *a_extension_name) -{ - Bool is_ok = FALSE; - int major_opcode = 0, first_event = 0, first_error = 0; - ExtensionEntry *ext = NULL; - - if (!ephyrProxyGetHostExtensionInfo(a_extension_name, - &major_opcode, - &first_event, &first_error)) { - EPHYR_LOG("failed to query extension %s from host\n", a_extension_name); - goto out; - } - ext = AddExtension((char *) a_extension_name, 0, 0, - ephyrProxyProcDispatch, - ephyrProxyProcDispatch, - ephyrProxyProcReset, StandardMinorOpcode); - if (!ext) { - EPHYR_LOG_ERROR("failed to add the extension\n"); - goto out; - } - is_ok = TRUE; - - out: - EPHYR_LOG("leave\n"); - return is_ok; -} diff --git a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.h b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.h deleted file mode 100644 index 018b69b34..000000000 --- a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum <mallum@openedhand.com> - * - * Copyright © 2007 OpenedHand Ltd - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of OpenedHand Ltd not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OpenedHand Ltd makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OpenedHand Ltd BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: - * Dodji Seketeli <dodji@openedhand.com> - */ -#ifndef __EPHYRPROXYEXT_H__ -#define __EPHYRPROXYEXT_H__ - -Bool ephyrProxyExtensionInit(const char *a_extension_name); - -#endif /*__EPHYRPROXYEXT_H__*/ diff --git a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c index dfc29f533..4a05721af 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c @@ -31,15 +31,17 @@ #endif #include <string.h> #include <X11/extensions/Xv.h> +#include <xcb/xcb.h> +#include <xcb/xcb_aux.h> +#include <xcb/xv.h> #include "ephyrlog.h" #include "kdrive.h" #include "kxv.h" #include "ephyr.h" #include "hostx.h" -#include "ephyrhostvideo.h" struct _EphyrXVPriv { - EphyrHostXVAdaptorArray *host_adaptors; + xcb_xv_query_adaptors_reply_t *host_adaptors; KdVideoAdaptorPtr adaptors; int num_adaptors; }; @@ -58,14 +60,8 @@ struct _EphyrPortPriv { }; typedef struct _EphyrPortPriv EphyrPortPriv; -static Bool DoSimpleClip(BoxPtr a_dst_drw, BoxPtr a_clipper, BoxPtr a_result); - static Bool ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom); -/* -static Bool ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom) ; -*/ - static EphyrXVPriv *ephyrXVPrivNew(void); static void ephyrXVPrivDelete(EphyrXVPriv * a_this); static Bool ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this); @@ -174,53 +170,18 @@ static int s_base_port_id; * ************/ static Bool -DoSimpleClip(BoxPtr a_dst_box, BoxPtr a_clipper, BoxPtr a_result) +adaptor_has_flags(const xcb_xv_adaptor_info_t *adaptor, uint32_t flags) { - BoxRec dstClippedBox; - - EPHYR_RETURN_VAL_IF_FAIL(a_dst_box && a_clipper && a_result, FALSE); - - /* - * setup the clipbox inside the destination. - */ - dstClippedBox.x1 = a_dst_box->x1; - dstClippedBox.x2 = a_dst_box->x2; - dstClippedBox.y1 = a_dst_box->y1; - dstClippedBox.y2 = a_dst_box->y2; - - /* - * if the cliper leftmost edge is inside - * the destination area then the leftmost edge of the resulting - * clipped box is the leftmost edge of the cliper. - */ - if (a_clipper->x1 > dstClippedBox.x1) - dstClippedBox.x1 = a_clipper->x1; - - /* - * if the cliper top edge is inside the destination area - * then the bottom horizontal edge of the resulting clipped box - * is the bottom edge of the cliper - */ - if (a_clipper->y1 > dstClippedBox.y1) - dstClippedBox.y1 = a_clipper->y1; - - /*ditto for right edge */ - if (a_clipper->x2 < dstClippedBox.x2) - dstClippedBox.x2 = a_clipper->x2; - - /*ditto for bottom edge */ - if (a_clipper->y2 < dstClippedBox.y2) - dstClippedBox.y2 = a_clipper->y2; - - memcpy(a_result, &dstClippedBox, sizeof(dstClippedBox)); - return TRUE; + return (adaptor->type & flags) == flags; } static Bool ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom) { + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_intern_atom_cookie_t cookie; + xcb_intern_atom_reply_t *reply; const char *atom_name = NULL; - int host_atom = None; EPHYR_RETURN_VAL_IF_FAIL(a_host_atom, FALSE); @@ -232,43 +193,18 @@ ephyrLocalAtomToHost(int a_local_atom, int *a_host_atom) if (!atom_name) return FALSE; - if (!ephyrHostGetAtom(atom_name, FALSE, &host_atom) || host_atom == None) { + cookie = xcb_intern_atom(conn, FALSE, strlen(atom_name), atom_name); + reply = xcb_intern_atom_reply(conn, cookie, NULL); + if (!reply || reply->atom == None) { EPHYR_LOG_ERROR("no atom for string %s defined in host X\n", atom_name); return FALSE; } - *a_host_atom = host_atom; - return TRUE; -} - -/* - Not used yed. -static Bool -ephyrHostAtomToLocal (int a_host_atom, int *a_local_atom) -{ - Bool is_ok=FALSE ; - char *atom_name=NULL ; - int atom=None ; - - EPHYR_RETURN_VAL_IF_FAIL (a_local_atom, FALSE) ; - - atom_name = ephyrHostGetAtomName (a_host_atom) ; - if (!atom_name) - goto out ; - - atom = MakeAtom (atom_name, strlen (atom_name), TRUE) ; - if (atom == None) - goto out ; - *a_local_atom = atom ; - is_ok = TRUE ; + *a_host_atom = reply->atom; + free(reply); -out: - if (atom_name) { - ephyrHostFree (atom_name) ; - } - return is_ok ; + return TRUE; } -*/ /************** *</helpers> @@ -321,8 +257,6 @@ ephyrXVPrivNew(void) goto error; } - ephyrHostXVInit(); - if (!ephyrXVPrivQueryHostAdaptors(xv_priv)) { EPHYR_LOG_ERROR("failed to query the host x for xv properties\n"); goto error; @@ -351,7 +285,7 @@ ephyrXVPrivDelete(EphyrXVPriv * a_this) if (!a_this) return; if (a_this->host_adaptors) { - ephyrHostXVAdaptorArrayDelete(a_this->host_adaptors); + free(a_this->host_adaptors); a_this->host_adaptors = NULL; } free(a_this->adaptors); @@ -360,72 +294,174 @@ ephyrXVPrivDelete(EphyrXVPriv * a_this) EPHYR_LOG("leave\n"); } -static KdVideoEncodingPtr -videoEncodingDup(EphyrHostEncoding * a_encodings, int a_num_encodings) +static Bool +translate_video_encodings(KdVideoAdaptorPtr adaptor, + xcb_xv_adaptor_info_t *host_adaptor) { - KdVideoEncodingPtr result = NULL; - int i = 0; + xcb_connection_t *conn = hostx_get_xcbconn(); + int i; + xcb_xv_query_encodings_cookie_t cookie; + xcb_xv_query_encodings_reply_t *reply; + xcb_xv_encoding_info_iterator_t encoding_it; + + cookie = xcb_xv_query_encodings(conn, host_adaptor->base_id); + reply = xcb_xv_query_encodings_reply(conn, cookie, NULL); + if (!reply) + return FALSE; + + adaptor->nEncodings = reply->num_encodings; + adaptor->pEncodings = calloc(adaptor->nEncodings, + sizeof(*adaptor->pEncodings)); + if (!adaptor->pEncodings) { + free(reply); + return FALSE; + } + + encoding_it = xcb_xv_query_encodings_info_iterator(reply); + for (i = 0; i < adaptor->nEncodings; i++) { + xcb_xv_encoding_info_t *encoding_info = encoding_it.data; + KdVideoEncodingPtr encoding = &adaptor->pEncodings[i]; - EPHYR_RETURN_VAL_IF_FAIL(a_encodings && a_num_encodings, NULL); + encoding->id = encoding_info->encoding; + encoding->name = strndup(xcb_xv_encoding_info_name(encoding_info), + encoding_info->name_size); + encoding->width = encoding_info->width; + encoding->height = encoding_info->height; + encoding->rate.numerator = encoding_info->rate.numerator; + encoding->rate.denominator = encoding_info->rate.denominator; - result = calloc(a_num_encodings, sizeof(KdVideoEncodingRec)); - for (i = 0; i < a_num_encodings; i++) { - result[i].id = a_encodings[i].id; - result[i].name = strdup(a_encodings[i].name); - result[i].width = a_encodings[i].width; - result[i].height = a_encodings[i].height; - result[i].rate.numerator = a_encodings[i].rate.numerator; - result[i].rate.denominator = a_encodings[i].rate.denominator; + xcb_xv_encoding_info_next(&encoding_it); } - return result; + + free(reply); + return TRUE; } -static KdAttributePtr -portAttributesDup(EphyrHostAttribute * a_encodings, int a_num_encodings) +static Bool +translate_xv_attributes(KdVideoAdaptorPtr adaptor, + xcb_xv_adaptor_info_t *host_adaptor) { + xcb_connection_t *conn = hostx_get_xcbconn(); int i = 0; - KdAttributePtr result = NULL; + xcb_xv_attribute_info_iterator_t it; + xcb_xv_query_port_attributes_cookie_t cookie = + xcb_xv_query_port_attributes(conn, host_adaptor->base_id); + xcb_xv_query_port_attributes_reply_t *reply = + xcb_xv_query_port_attributes_reply(conn, cookie, NULL); - EPHYR_RETURN_VAL_IF_FAIL(a_encodings && a_num_encodings, NULL); + if (!reply) + return FALSE; - result = calloc(a_num_encodings, sizeof(KdAttributeRec)); - if (!result) { + adaptor->nAttributes = reply->num_attributes; + adaptor->pAttributes = calloc(reply->num_attributes, + sizeof(*adaptor->pAttributes)); + if (!adaptor->pAttributes) { EPHYR_LOG_ERROR("failed to allocate attributes\n"); - return NULL; + free(reply); + return FALSE; } - for (i = 0; i < a_num_encodings; i++) { - result[i].flags = a_encodings[i].flags; - result[i].min_value = a_encodings[i].min_value; - result[i].max_value = a_encodings[i].max_value; - result[i].name = strdup(a_encodings[i].name); + + it = xcb_xv_query_port_attributes_attributes_iterator(reply); + for (i = 0; i < reply->num_attributes; i++) { + KdAttributePtr attribute = &adaptor->pAttributes[i]; + + attribute->flags = it.data->flags; + attribute->min_value = it.data->min; + attribute->max_value = it.data->max; + attribute->name = strndup(xcb_xv_attribute_info_name(it.data), + it.data->size); + + /* make sure atoms of attrs names are created in xephyr */ + MakeAtom(xcb_xv_attribute_info_name(it.data), it.data->size, TRUE); + + xcb_xv_attribute_info_next(&it); } - return result; + + free(reply); + return TRUE; +} + +static Bool +translate_xv_image_formats(KdVideoAdaptorPtr adaptor, + xcb_xv_adaptor_info_t *host_adaptor) +{ + xcb_connection_t *conn = hostx_get_xcbconn(); + int i = 0; + xcb_xv_list_image_formats_cookie_t cookie = + xcb_xv_list_image_formats(conn, host_adaptor->base_id); + xcb_xv_list_image_formats_reply_t *reply = + xcb_xv_list_image_formats_reply(conn, cookie, NULL); + xcb_xv_image_format_info_t *formats; + + if (!reply) + return FALSE; + + adaptor->nImages = reply->num_formats; + adaptor->pImages = calloc(reply->num_formats, sizeof(KdImageRec)); + if (!adaptor->pImages) { + free(reply); + return FALSE; + } + + formats = xcb_xv_list_image_formats_format(reply); + for (i = 0; i < reply->num_formats; i++) { + KdImagePtr image = &adaptor->pImages[i]; + + image->id = formats[i].id; + image->type = formats[i].type; + image->byte_order = formats[i].byte_order; + memcpy(image->guid, formats[i].guid, 16); + image->bits_per_pixel = formats[i].bpp; + image->format = formats[i].format; + image->num_planes = formats[i].num_planes; + image->depth = formats[i].depth; + image->red_mask = formats[i].red_mask; + image->green_mask = formats[i].green_mask; + image->blue_mask = formats[i].blue_mask; + image->y_sample_bits = formats[i].y_sample_bits; + image->u_sample_bits = formats[i].u_sample_bits; + image->v_sample_bits = formats[i].v_sample_bits; + image->horz_y_period = formats[i].vhorz_y_period; + image->horz_u_period = formats[i].vhorz_u_period; + image->horz_v_period = formats[i].vhorz_v_period; + image->vert_y_period = formats[i].vvert_y_period; + image->vert_u_period = formats[i].vvert_u_period; + image->vert_v_period = formats[i].vvert_v_period; + memcpy(image->component_order, formats[i].vcomp_order, 32); + image->scanline_order = formats[i].vscanline_order; + } + + free(reply); + return TRUE; } static Bool ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this) { - EphyrHostXVAdaptor *cur_host_adaptor = NULL; - EphyrHostVideoFormat *video_formats = NULL; - EphyrHostEncoding *encodings = NULL; - EphyrHostAttribute *attributes = NULL; - EphyrHostImageFormat *image_formats = NULL; - int num_video_formats = 0, base_port_id = 0, - num_attributes = 0, num_formats = 0, i = 0, port_priv_offset = 0; - unsigned num_encodings = 0; + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_screen_t *xscreen = xcb_aux_get_screen(conn, hostx_get_screen()); + int base_port_id = 0, i = 0, port_priv_offset = 0; Bool is_ok = FALSE; + xcb_generic_error_t *e = NULL; + xcb_xv_adaptor_info_iterator_t it; EPHYR_RETURN_VAL_IF_FAIL(a_this, FALSE); EPHYR_LOG("enter\n"); - if (!ephyrHostXVQueryAdaptors(&a_this->host_adaptors)) { - EPHYR_LOG_ERROR("failed to query host adaptors\n"); - goto out; + { + xcb_xv_query_adaptors_cookie_t cookie = + xcb_xv_query_adaptors(conn, xscreen->root); + a_this->host_adaptors = xcb_xv_query_adaptors_reply(conn, cookie, &e); + if (e) { + free(e); + EPHYR_LOG_ERROR("failed to query host adaptors\n"); + goto out; + } } + if (a_this->host_adaptors) - a_this->num_adaptors = - ephyrHostXVAdaptorArrayGetSize(a_this->host_adaptors); + a_this->num_adaptors = a_this->host_adaptors->num_adaptors; if (a_this->num_adaptors < 0) { EPHYR_LOG_ERROR("failed to get number of host adaptors\n"); goto out; @@ -442,28 +478,28 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this) goto out; } } + + it = xcb_xv_query_adaptors_info_iterator(a_this->host_adaptors); for (i = 0; i < a_this->num_adaptors; i++) { + xcb_xv_adaptor_info_t *cur_host_adaptor = it.data; + xcb_xv_format_t *format = xcb_xv_adaptor_info_formats(cur_host_adaptor); int j = 0; - cur_host_adaptor = ephyrHostXVAdaptorArrayAt(a_this->host_adaptors, i); - if (!cur_host_adaptor) - continue; - a_this->adaptors[i].nPorts = - ephyrHostXVAdaptorGetNbPorts(cur_host_adaptor); + a_this->adaptors[i].nPorts = cur_host_adaptor->num_ports; if (a_this->adaptors[i].nPorts <= 0) { EPHYR_LOG_ERROR("Could not find any port of adaptor %d\n", i); continue; } - a_this->adaptors[i].type = ephyrHostXVAdaptorGetType(cur_host_adaptor); + a_this->adaptors[i].type = cur_host_adaptor->type; a_this->adaptors[i].type |= XvWindowMask; a_this->adaptors[i].flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; - if (ephyrHostXVAdaptorGetName(cur_host_adaptor)) - a_this->adaptors[i].name = - strdup(ephyrHostXVAdaptorGetName(cur_host_adaptor)); - else + a_this->adaptors[i].name = + strndup(xcb_xv_adaptor_info_name(cur_host_adaptor), + cur_host_adaptor->name_size); + if (!a_this->adaptors[i].name) a_this->adaptors[i].name = strdup("Xephyr Video Overlay"); - base_port_id = ephyrHostXVAdaptorGetFirstPortID(cur_host_adaptor); + base_port_id = cur_host_adaptor->base_id; if (base_port_id < 0) { EPHYR_LOG_ERROR("failed to get port id for adaptor %d\n", i); continue; @@ -471,24 +507,24 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this) if (!s_base_port_id) s_base_port_id = base_port_id; - if (!ephyrHostXVQueryEncodings(base_port_id, - &encodings, &num_encodings)) { + if (!translate_video_encodings(&a_this->adaptors[i], + cur_host_adaptor)) { EPHYR_LOG_ERROR("failed to get encodings for port port id %d," " adaptors %d\n", base_port_id, i); continue; } - a_this->adaptors[i].nEncodings = num_encodings; - a_this->adaptors[i].pEncodings = - videoEncodingDup(encodings, num_encodings); - video_formats = (EphyrHostVideoFormat *) - ephyrHostXVAdaptorGetVideoFormats(cur_host_adaptor, - &num_video_formats); - a_this->adaptors[i].pFormats = (KdVideoFormatPtr) video_formats; - a_this->adaptors[i].nFormats = num_video_formats; - /* got a_this->adaptors[i].nPorts already - a_this->adaptors[i].nPorts = - ephyrHostXVAdaptorGetNbPorts (cur_host_adaptor) ; - */ + + a_this->adaptors[i].nFormats = cur_host_adaptor->num_formats; + a_this->adaptors[i].pFormats = + calloc(cur_host_adaptor->num_formats, + sizeof(*a_this->adaptors[i].pFormats)); + for (j = 0; j < cur_host_adaptor->num_formats; j++) { + xcb_visualtype_t *visual = + xcb_aux_find_visual_by_id(xscreen, format[j].visual); + a_this->adaptors[i].pFormats[j].depth = format[j].depth; + a_this->adaptors[i].pFormats[j].class = visual->_class; + } + a_this->adaptors[i].pPortPrivates = calloc(a_this->adaptors[i].nPorts, sizeof(DevUnion) + sizeof(EphyrPortPriv)); @@ -504,41 +540,26 @@ ephyrXVPrivQueryHostAdaptors(EphyrXVPriv * a_this) port_priv->xv_priv = a_this; a_this->adaptors[i].pPortPrivates[j].ptr = port_priv; } - if (!ephyrHostXVQueryPortAttributes(base_port_id, - &attributes, &num_attributes)) { + + if (!translate_xv_attributes(&a_this->adaptors[i], cur_host_adaptor)) { + { EPHYR_LOG_ERROR("failed to get port attribute " "for adaptor %d\n", i); continue; } - a_this->adaptors[i].pAttributes = - portAttributesDup(attributes, num_attributes); - a_this->adaptors[i].nAttributes = num_attributes; - /*make sure atoms of attrs names are created in xephyr */ - for (j = 0; j < a_this->adaptors[i].nAttributes; j++) { - if (a_this->adaptors[i].pAttributes[j].name) - MakeAtom(a_this->adaptors[i].pAttributes[j].name, - strlen(a_this->adaptors[i].pAttributes[j].name), TRUE); } - if (!ephyrHostXVQueryImageFormats(base_port_id, - &image_formats, &num_formats)) { + + if (!translate_xv_image_formats(&a_this->adaptors[i], cur_host_adaptor)) { EPHYR_LOG_ERROR("failed to get image formats " "for adaptor %d\n", i); continue; } - a_this->adaptors[i].pImages = (KdImagePtr) image_formats; - a_this->adaptors[i].nImages = num_formats; + + xcb_xv_adaptor_info_next(&it); } is_ok = TRUE; out: - if (encodings) { - ephyrHostEncodingsDelete(encodings, num_encodings); - encodings = NULL; - } - if (attributes) { - ephyrHostAttributesDelete(attributes); - attributes = NULL; - } EPHYR_LOG("leave\n"); return is_ok; } @@ -547,14 +568,16 @@ static Bool ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this) { int i = 0; - Bool has_it = FALSE; - EphyrHostXVAdaptor *cur_host_adaptor = NULL; + xcb_xv_adaptor_info_iterator_t it; EPHYR_RETURN_VAL_IF_FAIL(a_this, FALSE); EPHYR_LOG("enter\n"); + it = xcb_xv_query_adaptors_info_iterator(a_this->host_adaptors); for (i = 0; i < a_this->num_adaptors; i++) { + xcb_xv_adaptor_info_t *cur_host_adaptor = it.data; + a_this->adaptors[i].ReputImage = ephyrReputImage; a_this->adaptors[i].StopVideo = ephyrStopVideo; a_this->adaptors[i].SetPortAttribute = ephyrSetPortAttribute; @@ -562,50 +585,25 @@ ephyrXVPrivSetAdaptorsHooks(EphyrXVPriv * a_this) a_this->adaptors[i].QueryBestSize = ephyrQueryBestSize; a_this->adaptors[i].QueryImageAttributes = ephyrQueryImageAttributes; - cur_host_adaptor = ephyrHostXVAdaptorArrayAt(a_this->host_adaptors, i); - if (!cur_host_adaptor) { - EPHYR_LOG_ERROR("failed to get host adaptor at index %d\n", i); - continue; - } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasPutImage(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_IMAGE_MASK | XCB_XV_TYPE_INPUT_MASK)) a_this->adaptors[i].PutImage = ephyrPutImage; - } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasPutVideo(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_INPUT_MASK)) a_this->adaptors[i].PutVideo = ephyrPutVideo; - } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasGetVideo(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_VIDEO_MASK | XCB_XV_TYPE_OUTPUT_MASK)) a_this->adaptors[i].GetVideo = ephyrGetVideo; - } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasPutStill(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_INPUT_MASK)) a_this->adaptors[i].PutStill = ephyrPutStill; - } - has_it = FALSE; - if (!ephyrHostXVAdaptorHasGetStill(cur_host_adaptor, &has_it)) { - EPHYR_LOG_ERROR("error\n"); - } - if (has_it) { + if (adaptor_has_flags(cur_host_adaptor, + XCB_XV_TYPE_STILL_MASK | XCB_XV_TYPE_OUTPUT_MASK)) a_this->adaptors[i].GetStill = ephyrGetStill; - } } EPHYR_LOG("leave\n"); return TRUE; @@ -691,20 +689,27 @@ ephyrXVPrivGetImageBufSize(int a_port_id, unsigned short a_width, unsigned short a_height, int *a_size) { + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_xv_query_image_attributes_cookie_t cookie; + xcb_xv_query_image_attributes_reply_t *reply; Bool is_ok = FALSE; - unsigned short width = a_width, height = a_height; EPHYR_RETURN_VAL_IF_FAIL(a_size, FALSE); EPHYR_LOG("enter\n"); - if (!ephyrHostXVQueryImageAttributes(a_port_id, a_image_id, - &width, &height, a_size, NULL, NULL)) { - EPHYR_LOG_ERROR("failed to get image attributes\n"); + cookie = xcb_xv_query_image_attributes(conn, + a_port_id, a_image_id, + a_width, a_height); + reply = xcb_xv_query_image_attributes_reply(conn, cookie, NULL); + if (!reply) goto out; - } + + *a_size = reply->data_size; is_ok = TRUE; + free(reply); + out: EPHYR_LOG("leave\n"); return is_ok; @@ -741,15 +746,14 @@ ephyrXVPrivSaveImageToPortPriv(EphyrPortPriv * a_port_priv, static void ephyrStopVideo(KdScreenInfo * a_info, pointer a_port_priv, Bool a_exit) { + xcb_connection_t *conn = hostx_get_xcbconn(); EphyrPortPriv *port_priv = a_port_priv; + EphyrScrPriv *scrpriv = a_info->driver; - EPHYR_RETURN_IF_FAIL(a_info && a_info->pScreen); EPHYR_RETURN_IF_FAIL(port_priv); EPHYR_LOG("enter\n"); - if (!ephyrHostXVStopVideo(a_info->pScreen->myNum, port_priv->port_number)) { - EPHYR_LOG_ERROR("XvStopVideo() failed\n"); - } + xcb_xv_stop_video(conn, port_priv->port_number, scrpriv->win); EPHYR_LOG("leave\n"); } @@ -757,6 +761,7 @@ static int ephyrSetPortAttribute(KdScreenInfo * a_info, Atom a_attr_name, int a_attr_value, pointer a_port_priv) { + xcb_connection_t *conn = hostx_get_xcbconn(); int res = Success, host_atom = 0; EphyrPortPriv *port_priv = a_port_priv; Bool is_attr_valid = FALSE; @@ -797,12 +802,9 @@ ephyrSetPortAttribute(KdScreenInfo * a_info, */ } - if (!ephyrHostXVSetPortAttribute(port_priv->port_number, - host_atom, a_attr_value)) { - EPHYR_LOG_ERROR("failed to set port attribute\n"); - res = BadMatch; - goto out; - } + xcb_xv_set_port_attribute(conn, port_priv->port_number, + host_atom, a_attr_value); + xcb_flush(conn); res = Success; out: @@ -814,8 +816,12 @@ static int ephyrGetPortAttribute(KdScreenInfo * a_screen_info, Atom a_attr_name, int *a_attr_value, pointer a_port_priv) { + xcb_connection_t *conn = hostx_get_xcbconn(); int res = Success, host_atom = 0; EphyrPortPriv *port_priv = a_port_priv; + xcb_generic_error_t *e; + xcb_xv_get_port_attribute_cookie_t cookie; + xcb_xv_get_port_attribute_reply_t *reply; EPHYR_RETURN_VAL_IF_FAIL(port_priv, BadMatch); EPHYR_RETURN_VAL_IF_FAIL(ValidAtom(a_attr_name), BadMatch); @@ -830,12 +836,17 @@ ephyrGetPortAttribute(KdScreenInfo * a_screen_info, goto out; } - if (!ephyrHostXVGetPortAttribute(port_priv->port_number, - host_atom, a_attr_value)) { - EPHYR_LOG_ERROR("failed to get port attribute\n"); + cookie = xcb_xv_get_port_attribute(conn, port_priv->port_number, host_atom); + reply = xcb_xv_get_port_attribute_reply(conn, cookie, &e); + if (e) { + EPHYR_LOG_ERROR ("XvGetPortAttribute() failed: %d \n", e->error_code); + free(e); res = BadMatch; goto out; } + *a_attr_value = reply->value; + + free(reply); res = Success; out: @@ -853,21 +864,117 @@ ephyrQueryBestSize(KdScreenInfo * a_info, unsigned int *a_prefered_w, unsigned int *a_prefered_h, pointer a_port_priv) { - int res = 0; + xcb_connection_t *conn = hostx_get_xcbconn(); EphyrPortPriv *port_priv = a_port_priv; + xcb_xv_query_best_size_cookie_t cookie = + xcb_xv_query_best_size(conn, + port_priv->port_number, + a_src_w, a_src_h, + a_drw_w, a_drw_h, + a_motion); + xcb_xv_query_best_size_reply_t *reply = + xcb_xv_query_best_size_reply(conn, cookie, NULL); + + EPHYR_LOG("enter: frame (%dx%d), drw (%dx%d)\n", + a_src_w, a_src_h, a_drw_w, a_drw_h); + + if (!reply) { + EPHYR_LOG_ERROR ("XvQueryBestSize() failed\n"); + return; + } + *a_prefered_w = reply->actual_width; + *a_prefered_h = reply->actual_height; + EPHYR_LOG("actual (%dx%d)\n", *a_prefered_w, *a_prefered_h); + free(reply); - EPHYR_RETURN_IF_FAIL(port_priv); + EPHYR_LOG("leave\n"); +} - EPHYR_LOG("enter\n"); - res = ephyrHostXVQueryBestSize(port_priv->port_number, - a_motion, - a_src_w, a_src_h, - a_drw_w, a_drw_h, - a_prefered_w, a_prefered_h); - if (!res) { - EPHYR_LOG_ERROR("Failed to query best size\n"); + +static Bool +ephyrHostXVPutImage(KdScreenInfo * a_info, + EphyrPortPriv *port_priv, + int a_image_id, + int a_drw_x, + int a_drw_y, + int a_drw_w, + int a_drw_h, + int a_src_x, + int a_src_y, + int a_src_w, + int a_src_h, + int a_image_width, + int a_image_height, + unsigned char *a_buf, + BoxPtr a_clip_rects, int a_clip_rect_nums) +{ + EphyrScrPriv *scrpriv = a_info->driver; + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_gcontext_t gc; + Bool is_ok = TRUE; + xcb_rectangle_t *rects = NULL; + int data_len, width, height; + xcb_xv_query_image_attributes_cookie_t image_attr_cookie; + xcb_xv_query_image_attributes_reply_t *image_attr_reply; + + EPHYR_RETURN_VAL_IF_FAIL(a_buf, FALSE); + + EPHYR_LOG("enter, num_clip_rects: %d\n", a_clip_rect_nums); + + image_attr_cookie = xcb_xv_query_image_attributes(conn, + port_priv->port_number, + a_image_id, + a_image_width, + a_image_height); + image_attr_reply = xcb_xv_query_image_attributes_reply(conn, + image_attr_cookie, + NULL); + if (!image_attr_reply) + goto out; + data_len = image_attr_reply->data_size; + width = image_attr_reply->width; + height = image_attr_reply->height; + free(image_attr_reply); + + gc = xcb_generate_id(conn); + xcb_create_gc(conn, gc, scrpriv->win, 0, NULL); + + if (a_clip_rect_nums) { + int i = 0; + rects = calloc(a_clip_rect_nums, sizeof(xcb_rectangle_t)); + for (i=0; i < a_clip_rect_nums; i++) { + rects[i].x = a_clip_rects[i].x1; + rects[i].y = a_clip_rects[i].y1; + rects[i].width = a_clip_rects[i].x2 - a_clip_rects[i].x1; + rects[i].height = a_clip_rects[i].y2 - a_clip_rects[i].y1; + EPHYR_LOG("(x,y,w,h): (%d,%d,%d,%d)\n", + rects[i].x, rects[i].y, rects[i].width, rects[i].height); + } + xcb_set_clip_rectangles(conn, + XCB_CLIP_ORDERING_YX_BANDED, + gc, + 0, + 0, + a_clip_rect_nums, + rects); + free(rects); } + xcb_xv_put_image(conn, + port_priv->port_number, + scrpriv->win, + gc, + a_image_id, + a_src_x, a_src_y, a_src_w, a_src_h, + a_drw_x, a_drw_y, a_drw_w, a_drw_h, + width, height, + data_len, a_buf); + xcb_free_gc(conn, gc); + + is_ok = TRUE; + +out: EPHYR_LOG("leave\n"); + return is_ok; } static int @@ -896,13 +1003,12 @@ ephyrPutImage(KdScreenInfo * a_info, EPHYR_LOG("enter\n"); - if (!ephyrHostXVPutImage(a_info->pScreen->myNum, - port_priv->port_number, + if (!ephyrHostXVPutImage(a_info, port_priv, a_id, a_drw_x, a_drw_y, a_drw_w, a_drw_h, a_src_x, a_src_y, a_src_w, a_src_h, a_width, a_height, a_buf, - (EphyrHostBox *) RegionRects(a_clipping_region), + RegionRects(a_clipping_region), RegionNumRects(a_clipping_region))) { EPHYR_LOG_ERROR("EphyrHostXVPutImage() failed\n"); goto out; @@ -972,8 +1078,8 @@ ephyrReputImage(KdScreenInfo * a_info, EPHYR_LOG_ERROR("has null image buf in cache\n"); goto out; } - if (!ephyrHostXVPutImage(a_info->pScreen->myNum, - port_priv->port_number, + if (!ephyrHostXVPutImage(a_info, + port_priv, port_priv->image_id, a_drw_x, a_drw_y, port_priv->drw_w, port_priv->drw_h, @@ -981,7 +1087,7 @@ ephyrReputImage(KdScreenInfo * a_info, port_priv->src_w, port_priv->src_h, port_priv->image_width, port_priv->image_height, port_priv->image_buf, - (EphyrHostBox *) RegionRects(a_clipping_region), + RegionRects(a_clipping_region), RegionNumRects(a_clipping_region))) { EPHYR_LOG_ERROR("ephyrHostXVPutImage() failed\n"); goto out; @@ -1003,38 +1109,26 @@ ephyrPutVideo(KdScreenInfo * a_info, short a_drw_w, short a_drw_h, RegionPtr a_clipping_region, pointer a_port_priv) { + EphyrScrPriv *scrpriv = a_info->driver; + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_gcontext_t gc; EphyrPortPriv *port_priv = a_port_priv; - BoxRec clipped_area, dst_box; - int result = BadImplementation; EPHYR_RETURN_VAL_IF_FAIL(a_info->pScreen, BadValue); EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue); EPHYR_LOG("enter\n"); - dst_box.x1 = a_drw_x; - dst_box.x2 = a_drw_x + a_drw_w; - dst_box.y1 = a_drw_y; - dst_box.y2 = a_drw_y + a_drw_h; + gc = xcb_generate_id(conn); + xcb_create_gc(conn, gc, scrpriv->win, 0, NULL); + xcb_xv_put_video(conn, port_priv->port_number, + scrpriv->win, gc, + a_vid_x, a_vid_y, a_vid_w, a_vid_h, + a_drw_x, a_drw_y, a_drw_w, a_drw_h); + xcb_free_gc(conn, gc); - if (!DoSimpleClip(&dst_box, - RegionExtents(a_clipping_region), &clipped_area)) { - EPHYR_LOG_ERROR("failed to simple clip\n"); - goto out; - } - - if (!ephyrHostXVPutVideo(a_info->pScreen->myNum, - port_priv->port_number, - a_vid_x, a_vid_y, a_vid_w, a_vid_h, - a_drw_x, a_drw_y, a_drw_w, a_drw_h)) { - EPHYR_LOG_ERROR("ephyrHostXVPutVideo() failed\n"); - goto out; - } - result = Success; - - out: EPHYR_LOG("leave\n"); - return result; + return Success; } static int @@ -1046,38 +1140,27 @@ ephyrGetVideo(KdScreenInfo * a_info, short a_drw_w, short a_drw_h, RegionPtr a_clipping_region, pointer a_port_priv) { + EphyrScrPriv *scrpriv = a_info->driver; + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_gcontext_t gc; EphyrPortPriv *port_priv = a_port_priv; - BoxRec clipped_area, dst_box; - int result = BadImplementation; EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue); EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue); EPHYR_LOG("enter\n"); - dst_box.x1 = a_drw_x; - dst_box.x2 = a_drw_x + a_drw_w; - dst_box.y1 = a_drw_y; - dst_box.y2 = a_drw_y + a_drw_h; - - if (!DoSimpleClip(&dst_box, - RegionExtents(a_clipping_region), &clipped_area)) { - EPHYR_LOG_ERROR("failed to simple clip\n"); - goto out; - } + gc = xcb_generate_id(conn); + xcb_create_gc(conn, gc, scrpriv->win, 0, NULL); + xcb_xv_get_video(conn, port_priv->port_number, + scrpriv->win, gc, + a_vid_x, a_vid_y, a_vid_w, a_vid_h, + a_drw_x, a_drw_y, a_drw_w, a_drw_h); - if (!ephyrHostXVGetVideo(a_info->pScreen->myNum, - port_priv->port_number, - a_vid_x, a_vid_y, a_vid_w, a_vid_h, - a_drw_x, a_drw_y, a_drw_w, a_drw_h)) { - EPHYR_LOG_ERROR("ephyrHostXVGetVideo() failed\n"); - goto out; - } - result = Success; + xcb_free_gc(conn, gc); - out: EPHYR_LOG("leave\n"); - return result; + return Success; } static int @@ -1089,38 +1172,26 @@ ephyrPutStill(KdScreenInfo * a_info, short a_drw_w, short a_drw_h, RegionPtr a_clipping_region, pointer a_port_priv) { + EphyrScrPriv *scrpriv = a_info->driver; + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_gcontext_t gc; EphyrPortPriv *port_priv = a_port_priv; - BoxRec clipped_area, dst_box; - int result = BadImplementation; EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue); EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue); EPHYR_LOG("enter\n"); - dst_box.x1 = a_drw_x; - dst_box.x2 = a_drw_x + a_drw_w; - dst_box.y1 = a_drw_y; - dst_box.y2 = a_drw_y + a_drw_h; - - if (!DoSimpleClip(&dst_box, - RegionExtents(a_clipping_region), &clipped_area)) { - EPHYR_LOG_ERROR("failed to simple clip\n"); - goto out; - } + gc = xcb_generate_id(conn); + xcb_create_gc(conn, gc, scrpriv->win, 0, NULL); + xcb_xv_put_still(conn, port_priv->port_number, + scrpriv->win, gc, + a_vid_x, a_vid_y, a_vid_w, a_vid_h, + a_drw_x, a_drw_y, a_drw_w, a_drw_h); + xcb_free_gc(conn, gc); - if (!ephyrHostXVPutStill(a_info->pScreen->myNum, - port_priv->port_number, - a_vid_x, a_vid_y, a_vid_w, a_vid_h, - a_drw_x, a_drw_y, a_drw_w, a_drw_h)) { - EPHYR_LOG_ERROR("ephyrHostXVPutStill() failed\n"); - goto out; - } - result = Success; - - out: EPHYR_LOG("leave\n"); - return result; + return Success; } static int @@ -1132,38 +1203,26 @@ ephyrGetStill(KdScreenInfo * a_info, short a_drw_w, short a_drw_h, RegionPtr a_clipping_region, pointer a_port_priv) { + EphyrScrPriv *scrpriv = a_info->driver; + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_gcontext_t gc; EphyrPortPriv *port_priv = a_port_priv; - BoxRec clipped_area, dst_box; - int result = BadImplementation; EPHYR_RETURN_VAL_IF_FAIL(a_info && a_info->pScreen, BadValue); EPHYR_RETURN_VAL_IF_FAIL(a_drawable && port_priv, BadValue); EPHYR_LOG("enter\n"); - dst_box.x1 = a_drw_x; - dst_box.x2 = a_drw_x + a_drw_w; - dst_box.y1 = a_drw_y; - dst_box.y2 = a_drw_y + a_drw_h; - - if (!DoSimpleClip(&dst_box, - RegionExtents(a_clipping_region), &clipped_area)) { - EPHYR_LOG_ERROR("failed to simple clip\n"); - goto out; - } + gc = xcb_generate_id(conn); + xcb_create_gc(conn, gc, scrpriv->win, 0, NULL); + xcb_xv_get_still(conn, port_priv->port_number, + scrpriv->win, gc, + a_vid_x, a_vid_y, a_vid_w, a_vid_h, + a_drw_x, a_drw_y, a_drw_w, a_drw_h); + xcb_free_gc(conn, gc); - if (!ephyrHostXVGetStill(a_info->pScreen->myNum, - port_priv->port_number, - a_vid_x, a_vid_y, a_vid_w, a_vid_h, - a_drw_x, a_drw_y, a_drw_w, a_drw_h)) { - EPHYR_LOG_ERROR("ephyrHostXVGetStill() failed\n"); - goto out; - } - result = Success; - - out: EPHYR_LOG("leave\n"); - return result; + return Success; } static int @@ -1172,6 +1231,9 @@ ephyrQueryImageAttributes(KdScreenInfo * a_info, unsigned short *a_w, unsigned short *a_h, int *a_pitches, int *a_offsets) { + xcb_connection_t *conn = hostx_get_xcbconn(); + xcb_xv_query_image_attributes_cookie_t cookie; + xcb_xv_query_image_attributes_reply_t *reply; int image_size = 0; EPHYR_RETURN_VAL_IF_FAIL(a_w && a_h, FALSE); @@ -1179,13 +1241,25 @@ ephyrQueryImageAttributes(KdScreenInfo * a_info, EPHYR_LOG("enter: dim (%dx%d), pitches: %p, offsets: %p\n", *a_w, *a_h, a_pitches, a_offsets); - if (!ephyrHostXVQueryImageAttributes(s_base_port_id, - a_id, - a_w, a_h, - &image_size, a_pitches, a_offsets)) { - EPHYR_LOG_ERROR("EphyrHostXVQueryImageAttributes() failed\n"); + cookie = xcb_xv_query_image_attributes(conn, + s_base_port_id, a_id, + *a_w, *a_h); + reply = xcb_xv_query_image_attributes_reply(conn, cookie, NULL); + if (!reply) goto out; + + *a_w = reply->width; + *a_h = reply->height; + if (a_pitches && a_offsets) { + memcpy(a_pitches, xcb_xv_query_image_attributes_pitches(reply), + reply->num_planes << 2); + memcpy(a_offsets, xcb_xv_query_image_attributes_offsets(reply), + reply->num_planes << 2); } + image_size = reply->data_size; + + free(reply); + EPHYR_LOG("image size: %d, dim (%dx%d)\n", image_size, *a_w, *a_h); out: diff --git a/xorg-server/hw/kdrive/ephyr/hostx.c b/xorg-server/hw/kdrive/ephyr/hostx.c index 849ea43e0..b10168186 100644..100755 --- a/xorg-server/hw/kdrive/ephyr/hostx.c +++ b/xorg-server/hw/kdrive/ephyr/hostx.c @@ -27,17 +27,6 @@ #include <kdrive-config.h> #endif -/* - * including some server headers (like kdrive-config.h) - * might define the macro _XSERVER64 - * on 64 bits machines. That macro must _NOT_ be defined for Xlib - * client code, otherwise bad things happen. - * So let's undef that macro if necessary. - */ -#ifdef _XSERVER64 -#undef _XSERVER64 -#endif - #include "hostx.h" #include <stdlib.h> @@ -53,56 +42,36 @@ #include <sys/time.h> #endif -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/Xatom.h> #include <X11/keysym.h> -#include <X11/extensions/XShm.h> -#include <X11/extensions/shape.h> +#include <xcb/xcb.h> +#include <xcb/xproto.h> +#include <xcb/xcb_icccm.h> +#include <xcb/xcb_aux.h> +#include <xcb/shm.h> +#include <xcb/xcb_image.h> +#include <xcb/shape.h> +#include <xcb/xcb_keysyms.h> #ifdef XF86DRI -#include <GL/glx.h> -#endif /* XF86DRI */ +#include <xcb/xf86dri.h> +#include <xcb/glx.h> +#endif /* XF86DRI */ #include "ephyrlog.h" - -#ifdef XF86DRI -extern Bool XF86DRIQueryExtension(Display * dpy, - int *event_basep, int *error_basep); -#endif - -/* - * All xlib calls go here, which gets built as its own .a . - * Mixing kdrive and xlib headers causes all sorts of types - * to get clobbered. - */ - -struct EphyrHostScreen { - Window win; - Window win_pre_existing; /* Set via -parent option like xnest */ - Window peer_win; /* Used for GL; should be at most one */ - XImage *ximg; - int win_width, win_height; - int server_depth; - unsigned char *fb_data; /* only used when host bpp != server bpp */ - XShmSegmentInfo shminfo; - - void *info; /* Pointer to the screen this is associated with */ - int mynum; /* Screen number */ -}; +#include "ephyr.h" struct EphyrHostXVars { char *server_dpy_name; - Display *dpy; + xcb_connection_t *conn; int screen; - Visual *visual; + xcb_visualtype_t *visual; Window winroot; - GC gc; + xcb_gcontext_t gc; int depth; - Bool use_host_cursor; + Bool use_sw_cursor; Bool use_fullscreen; Bool have_shm; int n_screens; - struct EphyrHostScreen *screens; + KdScreenInfo **screens; long damage_debug_msec; @@ -128,57 +97,17 @@ char *ephyrTitle = NULL; static void hostx_set_fullscreen_hint(void); -/* X Error traps */ - -static int trapped_error_code = 0; -static int (*old_error_handler) (Display * d, XErrorEvent * e); - #define host_depth_matches_server(_vars) (HostX.depth == (_vars)->server_depth) -static struct EphyrHostScreen * -host_screen_from_screen_info(EphyrScreenInfo * screen) -{ - int i; - - for (i = 0; i < HostX.n_screens; i++) { - if (HostX.screens[i].info == screen) { - return &HostX.screens[i]; - } - } - return NULL; -} - -static int -error_handler(Display * display, XErrorEvent * error) -{ - trapped_error_code = error->error_code; - return 0; -} - -static void -hostx_errors_trap(void) -{ - trapped_error_code = 0; - old_error_handler = XSetErrorHandler(error_handler); -} - -static int -hostx_errors_untrap(void) -{ - XSetErrorHandler(old_error_handler); - return trapped_error_code; -} - int -hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height) +hostx_want_screen_size(KdScreenInfo *screen, int *width, int *height) { - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); + EphyrScrPriv *scrpriv = screen->driver; - if (host_screen && - (host_screen->win_pre_existing != None || - HostX.use_fullscreen == True)) { - *width = host_screen->win_width; - *height = host_screen->win_height; + if (scrpriv && (scrpriv->win_pre_existing != None || + HostX.use_fullscreen == TRUE)) { + *width = scrpriv->win_width; + *height = scrpriv->win_height; return 1; } @@ -186,17 +115,18 @@ hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height) } void -hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num) +hostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num) { + EphyrScrPriv *scrpriv = screen->driver; int index = HostX.n_screens; HostX.n_screens += 1; HostX.screens = realloc(HostX.screens, - HostX.n_screens * sizeof(struct EphyrHostScreen)); - memset(&HostX.screens[index], 0, sizeof(struct EphyrHostScreen)); + HostX.n_screens * sizeof(HostX.screens[0])); + HostX.screens[index] = screen; - HostX.screens[index].info = screen; - HostX.screens[index].win_pre_existing = win_id; + scrpriv->screen = screen; + scrpriv->win_pre_existing = win_id; } void @@ -210,58 +140,68 @@ hostx_set_display_name(char *name) } void -hostx_set_screen_number(EphyrScreenInfo screen, int number) +hostx_set_screen_number(KdScreenInfo *screen, int number) { - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); + EphyrScrPriv *scrpriv = screen->driver; - if (host_screen) { - host_screen->mynum = number; - hostx_set_win_title(host_screen->info, ""); + if (scrpriv) { + scrpriv->mynum = number; + hostx_set_win_title(screen, ""); } } void -hostx_set_win_title(EphyrScreenInfo screen, const char *extra_text) +hostx_set_win_title(KdScreenInfo *screen, const char *extra_text) { - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); + EphyrScrPriv *scrpriv = screen->driver; - if (!host_screen) + if (!scrpriv) return; if (ephyrTitle) { - XStoreName(HostX.dpy, host_screen->win, ephyrTitle); - } - else { + xcb_icccm_set_wm_name(HostX.conn, + scrpriv->win, + XCB_ATOM_STRING, + 8, + strlen(ephyrTitle), + ephyrTitle); + } else { #define BUF_LEN 256 char buf[BUF_LEN + 1]; memset(buf, 0, BUF_LEN + 1); snprintf(buf, BUF_LEN, "Xephyr on %s.%d %s", HostX.server_dpy_name, - host_screen->mynum, (extra_text != NULL) ? extra_text : ""); - - XStoreName(HostX.dpy, host_screen->win, buf); + scrpriv->mynum, (extra_text != NULL) ? extra_text : ""); + + xcb_icccm_set_wm_name(HostX.conn, + scrpriv->win, + XCB_ATOM_STRING, + 8, + strlen(buf), + buf); + xcb_flush(HostX.conn); } } int hostx_want_host_cursor(void) { - return HostX.use_host_cursor; + return !HostX.use_sw_cursor; } void -hostx_use_host_cursor(void) +hostx_use_sw_cursor(void) { - HostX.use_host_cursor = True; + HostX.use_sw_cursor = TRUE; } int -hostx_want_preexisting_window(EphyrScreenInfo screen) +hostx_want_preexisting_window(KdScreenInfo *screen) { - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); + EphyrScrPriv *scrpriv = screen->driver; - if (host_screen && host_screen->win_pre_existing) { + if (scrpriv && scrpriv->win_pre_existing) { return 1; } else { @@ -272,7 +212,7 @@ hostx_want_preexisting_window(EphyrScreenInfo screen) void hostx_use_fullscreen(void) { - HostX.use_fullscreen = True; + HostX.use_fullscreen = TRUE; } int @@ -281,21 +221,35 @@ hostx_want_fullscreen(void) return HostX.use_fullscreen; } +static xcb_intern_atom_cookie_t cookie_WINDOW_STATE, + cookie_WINDOW_STATE_FULLSCREEN; + static void hostx_set_fullscreen_hint(void) { - Atom atom_WINDOW_STATE, atom_WINDOW_STATE_FULLSCREEN; + xcb_atom_t atom_WINDOW_STATE, atom_WINDOW_STATE_FULLSCREEN; int index; + xcb_intern_atom_reply_t *reply; + + reply = xcb_intern_atom_reply(HostX.conn, cookie_WINDOW_STATE, NULL); + atom_WINDOW_STATE = reply->atom; + free(reply); - atom_WINDOW_STATE = XInternAtom(HostX.dpy, "_NET_WM_STATE", False); - atom_WINDOW_STATE_FULLSCREEN - = XInternAtom(HostX.dpy, "_NET_WM_STATE_FULLSCREEN", False); + reply = xcb_intern_atom_reply(HostX.conn, cookie_WINDOW_STATE_FULLSCREEN, + NULL); + atom_WINDOW_STATE_FULLSCREEN = reply->atom; + free(reply); for (index = 0; index < HostX.n_screens; index++) { - XChangeProperty(HostX.dpy, HostX.screens[index].win, - atom_WINDOW_STATE, XA_ATOM, 32, - PropModeReplace, - (unsigned char *) &atom_WINDOW_STATE_FULLSCREEN, 1); + EphyrScrPriv *scrpriv = HostX.screens[index]->driver; + xcb_change_property(HostX.conn, + PropModeReplace, + scrpriv->win, + atom_WINDOW_STATE, + XCB_ATOM_ATOM, + 32, + 1, + &atom_WINDOW_STATE_FULLSCREEN); } } @@ -330,171 +284,216 @@ hostx_set_title(char *title) #pragma does_not_return(exit) #endif -static int _X_NORETURN -x_io_error_handler(Display * dpy) -{ - ErrorF("Lost connection to X server: %s\n", strerror(errno)); - CloseWellKnownConnections(); - OsCleanup(1); - exit(1); -} - int hostx_init(void) { - XSetWindowAttributes attr; - Cursor empty_cursor; - Pixmap cursor_pxm; - XColor col; + uint32_t attr; + xcb_cursor_t empty_cursor; + xcb_pixmap_t cursor_pxm; + uint16_t red, green, blue; + uint32_t pixel; int index; char *tmpstr; - XClassHint *class_hint; - - attr.event_mask = - ButtonPressMask - | ButtonReleaseMask - | PointerMotionMask - | KeyPressMask - | KeyReleaseMask - | ExposureMask - | StructureNotifyMask; + char *class_hint; + size_t class_len; + const xcb_query_extension_reply_t *shm_rep; + xcb_screen_t *xscreen; + + attr = + XCB_EVENT_MASK_BUTTON_PRESS + | XCB_EVENT_MASK_BUTTON_RELEASE + | XCB_EVENT_MASK_POINTER_MOTION + | XCB_EVENT_MASK_KEY_PRESS + | XCB_EVENT_MASK_KEY_RELEASE + | XCB_EVENT_MASK_EXPOSURE + | XCB_EVENT_MASK_STRUCTURE_NOTIFY; EPHYR_DBG("mark"); - if ((HostX.dpy = XOpenDisplay(getenv("DISPLAY"))) == NULL) { + if ((HostX.conn = xcb_connect(NULL, &HostX.screen)) == NULL) { fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n"); exit(1); } - XSetIOErrorHandler(x_io_error_handler); - - HostX.screen = DefaultScreen(HostX.dpy); - HostX.winroot = RootWindow(HostX.dpy, HostX.screen); - HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL); - HostX.depth = DefaultDepth(HostX.dpy, HostX.screen); - HostX.visual = DefaultVisual(HostX.dpy, HostX.screen); - - class_hint = XAllocClassHint(); + xscreen = xcb_aux_get_screen(HostX.conn, HostX.screen); + HostX.winroot = xscreen->root; + HostX.gc = xcb_generate_id(HostX.conn); + HostX.depth = xscreen->root_depth; + HostX.visual = xcb_aux_find_visual_by_id(xscreen, xscreen->root_visual); + + xcb_create_gc(HostX.conn, HostX.gc, HostX.winroot, 0, NULL); + cookie_WINDOW_STATE = xcb_intern_atom(HostX.conn, FALSE, + strlen("_NET_WM_STATE"), + "_NET_WM_STATE"); + cookie_WINDOW_STATE_FULLSCREEN = + xcb_intern_atom(HostX.conn, FALSE, + strlen("_NET_WM_STATE_FULLSCREEN"), + "_NET_WM_STATE_FULLSCREEN"); for (index = 0; index < HostX.n_screens; index++) { - struct EphyrHostScreen *host_screen = &HostX.screens[index]; - - host_screen->server_depth = HostX.depth; - if (host_screen->win_pre_existing != None) { - Status result; - XWindowAttributes prewin_attr; + KdScreenInfo *screen = HostX.screens[index]; + EphyrScrPriv *scrpriv = screen->driver; - /* Get screen size from existing window */ - - hostx_errors_trap(); + scrpriv->win = xcb_generate_id(HostX.conn); + scrpriv->server_depth = HostX.depth; + scrpriv->ximg = NULL; - result = XGetWindowAttributes(HostX.dpy, - host_screen->win_pre_existing, - &prewin_attr); + if (scrpriv->win_pre_existing != XCB_WINDOW_NONE) { + xcb_get_geometry_reply_t *prewin_geom; + xcb_get_geometry_cookie_t cookie; + xcb_generic_error_t *e = NULL; - if (hostx_errors_untrap() || !result) { - fprintf(stderr, "\nXephyr -parent window' does not exist!\n"); - exit(1); + /* Get screen size from existing window */ + cookie = xcb_get_geometry(HostX.conn, + scrpriv->win_pre_existing); + prewin_geom = xcb_get_geometry_reply(HostX.conn, cookie, &e); + + if (e) { + free(e); + free(prewin_geom); + fprintf (stderr, "\nXephyr -parent window' does not exist!\n"); + exit (1); } - host_screen->win_width = prewin_attr.width; - host_screen->win_height = prewin_attr.height; - - host_screen->win = XCreateWindow(HostX.dpy, - host_screen->win_pre_existing, - 0, 0, - host_screen->win_width, - host_screen->win_height, - 0, - CopyFromParent, - CopyFromParent, - CopyFromParent, - CWEventMask, &attr); + scrpriv->win_width = prewin_geom->width; + scrpriv->win_height = prewin_geom->height; + + free(prewin_geom); + + xcb_create_window(HostX.conn, + XCB_COPY_FROM_PARENT, + scrpriv->win, + scrpriv->win_pre_existing, + 0,0, + scrpriv->win_width, + scrpriv->win_height, + 0, + XCB_WINDOW_CLASS_COPY_FROM_PARENT, + XCB_COPY_FROM_PARENT, + XCB_CW_EVENT_MASK, + &attr); } else { - host_screen->win = XCreateWindow(HostX.dpy, HostX.winroot, 0, 0, 100, 100, /* will resize */ - 0, - CopyFromParent, - CopyFromParent, - CopyFromParent, - CWEventMask, &attr); - - hostx_set_win_title(host_screen->info, + xcb_create_window(HostX.conn, + XCB_COPY_FROM_PARENT, + scrpriv->win, + HostX.winroot, + 0,0,100,100, /* will resize */ + 0, + XCB_WINDOW_CLASS_COPY_FROM_PARENT, + XCB_COPY_FROM_PARENT, + XCB_CW_EVENT_MASK, + &attr); + + hostx_set_win_title(screen, "(ctrl+shift grabs mouse and keyboard)"); if (HostX.use_fullscreen) { - host_screen->win_width = DisplayWidth(HostX.dpy, HostX.screen); - host_screen->win_height = - DisplayHeight(HostX.dpy, HostX.screen); + scrpriv->win_width = xscreen->width_in_pixels; + scrpriv->win_height = xscreen->height_in_pixels; hostx_set_fullscreen_hint(); } + tmpstr = getenv("RESOURCE_NAME"); + if (tmpstr && (!ephyrResNameFromCmd)) + ephyrResName = tmpstr; + class_len = strlen(ephyrResName) + 1 + strlen("Xephyr") + 1; + class_hint = malloc(class_len); if (class_hint) { - tmpstr = getenv("RESOURCE_NAME"); - if (tmpstr && (!ephyrResNameFromCmd)) - ephyrResName = tmpstr; - class_hint->res_name = ephyrResName; - class_hint->res_class = "Xephyr"; - XSetClassHint(hostx_get_display(), host_screen->win, - class_hint); - + strcpy(class_hint, ephyrResName); + strcpy(class_hint + strlen(ephyrResName) + 1, "Xephyr"); + xcb_change_property(HostX.conn, + XCB_PROP_MODE_REPLACE, + scrpriv->win, + XCB_ATOM_WM_CLASS, + XCB_ATOM_STRING, + 8, + class_len, + class_hint); + free(class_hint); } - } } - if (class_hint) - XFree(class_hint); + if (!xcb_aux_parse_color("red", &red, &green, &blue)) { + xcb_lookup_color_cookie_t c = + xcb_lookup_color(HostX.conn, xscreen->default_colormap, 3, "red"); + xcb_lookup_color_reply_t *reply = + xcb_lookup_color_reply(HostX.conn, c, NULL); + red = reply->exact_red; + green = reply->exact_green; + blue = reply->exact_blue; + free(reply); + } + + { + xcb_alloc_color_cookie_t c = xcb_alloc_color(HostX.conn, + xscreen->default_colormap, + red, green, blue); + xcb_alloc_color_reply_t *r = xcb_alloc_color_reply(HostX.conn, c, NULL); + red = r->red; + green = r->green; + blue = r->blue; + pixel = r->pixel; + free(r); + } - XParseColor(HostX.dpy, DefaultColormap(HostX.dpy, HostX.screen), - "red", &col); - XAllocColor(HostX.dpy, DefaultColormap(HostX.dpy, HostX.screen), &col); - XSetForeground(HostX.dpy, HostX.gc, col.pixel); + xcb_change_gc(HostX.conn, HostX.gc, XCB_GC_FOREGROUND, &pixel); - if (!hostx_want_host_cursor()) { + if (!hostx_want_host_cursor ()) { /* Ditch the cursor, we provide our 'own' */ - cursor_pxm = XCreatePixmap(HostX.dpy, HostX.winroot, 1, 1, 1); - memset(&col, 0, sizeof(col)); - empty_cursor = XCreatePixmapCursor(HostX.dpy, - cursor_pxm, cursor_pxm, - &col, &col, 1, 1); + cursor_pxm = xcb_generate_id(HostX.conn); + xcb_create_pixmap(HostX.conn, 1, cursor_pxm, HostX.winroot, 1, 1); + empty_cursor = xcb_generate_id(HostX.conn); + xcb_create_cursor(HostX.conn, + empty_cursor, + cursor_pxm, cursor_pxm, + 0,0,0, + 0,0,0, + 1,1); for (index = 0; index < HostX.n_screens; index++) { - XDefineCursor(HostX.dpy, HostX.screens[index].win, empty_cursor); - } - XFreePixmap(HostX.dpy, cursor_pxm); - } + KdScreenInfo *screen = HostX.screens[index]; + EphyrScrPriv *scrpriv = screen->driver; - for (index = 0; index < HostX.n_screens; index++) { - HostX.screens[index].ximg = NULL; + xcb_change_window_attributes(HostX.conn, + scrpriv->win, + XCB_CW_CURSOR, + &empty_cursor); + } + xcb_free_pixmap(HostX.conn, cursor_pxm); } - /* Try to get share memory ximages for a little bit more speed */ #ifdef _MSC_VER __asm int 3; #else - if (!XShmQueryExtension(HostX.dpy) || getenv("XEPHYR_NO_SHM")) { + /* Try to get share memory ximages for a little bit more speed */ + shm_rep = xcb_get_extension_data(HostX.conn, &xcb_shm_id); + if (!shm_rep || !shm_rep->present || getenv("XEPHYR_NO_SHM")) { fprintf(stderr, "\nXephyr unable to use SHM XImages\n"); - HostX.have_shm = False; + HostX.have_shm = FALSE; } else { - /* Really really check we have shm - better way ? */ - XShmSegmentInfo shminfo; - - HostX.have_shm = True; + /* Really really check we have shm - better way ?*/ + xcb_shm_segment_info_t shminfo; + xcb_generic_error_t *e; + xcb_void_cookie_t cookie; + xcb_shm_seg_t shmseg; - shminfo.shmid = shmget(IPC_PRIVATE, 1, IPC_CREAT | 0777); - shminfo.shmaddr = shmat(shminfo.shmid, 0, 0); - shminfo.readOnly = True; + HostX.have_shm = TRUE; - hostx_errors_trap(); + shminfo.shmid = shmget(IPC_PRIVATE, 1, IPC_CREAT|0777); + shminfo.shmaddr = shmat(shminfo.shmid,0,0); - XShmAttach(HostX.dpy, &shminfo); - XSync(HostX.dpy, False); + shmseg = xcb_generate_id(HostX.conn); + cookie = xcb_shm_attach_checked(HostX.conn, shmseg, shminfo.shmid, + TRUE); + e = xcb_request_check(HostX.conn, cookie); - if (hostx_errors_untrap()) { + if (e) { fprintf(stderr, "\nXephyr unable to use SHM XImages\n"); - HostX.have_shm = False; + HostX.have_shm = FALSE; + free(e); } shmdt(shminfo.shmaddr); @@ -502,7 +501,7 @@ hostx_init(void) } #endif - XFlush(HostX.dpy); + xcb_flush(HostX.conn); /* Setup the pause time between paints when debugging updates */ @@ -523,51 +522,42 @@ hostx_get_depth(void) } int -hostx_get_server_depth(EphyrScreenInfo screen) +hostx_get_server_depth(KdScreenInfo *screen) { - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); + EphyrScrPriv *scrpriv = screen->driver; - return host_screen ? host_screen->server_depth : 0; -} - -void -hostx_set_server_depth(EphyrScreenInfo screen, int depth) -{ - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); - - if (host_screen) - host_screen->server_depth = depth; + return scrpriv ? scrpriv->server_depth : 0; } int -hostx_get_bpp(EphyrScreenInfo screen) +hostx_get_bpp(KdScreenInfo *screen) { - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); + EphyrScrPriv *scrpriv = screen->driver; - if (!host_screen) + if (!scrpriv) return 0; - if (host_depth_matches_server(host_screen)) - return HostX.visual->bits_per_rgb; + if (host_depth_matches_server(scrpriv)) + return HostX.visual->bits_per_rgb_value; else - return host_screen->server_depth; /*XXX correct ? */ + return scrpriv->server_depth; /*XXX correct ?*/ } void -hostx_get_visual_masks(EphyrScreenInfo screen, +hostx_get_visual_masks(KdScreenInfo *screen, CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk) { - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); + EphyrScrPriv *scrpriv = screen->driver; - if (!host_screen) + if (!scrpriv) return; - if (host_depth_matches_server(host_screen)) { + if (host_depth_matches_server(scrpriv)) { *rmsk = HostX.visual->red_mask; *gmsk = HostX.visual->green_mask; *bmsk = HostX.visual->blue_mask; } - else if (host_screen->server_depth == 16) { + else if (scrpriv->server_depth == 16) { /* Assume 16bpp 565 */ *rmsk = 0xf800; *gmsk = 0x07e0; @@ -628,17 +618,14 @@ hostx_set_cmap_entry(unsigned char idx, * by fakexa for storing offscreen pixmap data. */ void * -hostx_screen_init(EphyrScreenInfo screen, +hostx_screen_init(KdScreenInfo *screen, int width, int height, int buffer_height, int *bytes_per_line, int *bits_per_pixel) { - int bitmap_pad; - Bool shm_success = False; - XSizeHints *size_hints; - - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); + EphyrScrPriv *scrpriv = screen->driver; + Bool shm_success = FALSE; - if (!host_screen) { + if (!scrpriv) { fprintf(stderr, "%s: Error in accessing hostx data\n", __FUNCTION__); exit(1); } @@ -646,7 +633,7 @@ hostx_screen_init(EphyrScreenInfo screen, EPHYR_DBG("host_screen=%p wxh=%dx%d, buffer_height=%d", host_screen, width, height, buffer_height); - if (host_screen->ximg != NULL) { + if (scrpriv->ximg != NULL) { /* Free up the image data if previously used * i.ie called by server reset */ @@ -655,111 +642,118 @@ hostx_screen_init(EphyrScreenInfo screen, #ifdef _MSC_VER __asm int 3; #else - XShmDetach(HostX.dpy, &host_screen->shminfo); - XDestroyImage(host_screen->ximg); - shmdt(host_screen->shminfo.shmaddr); - shmctl(host_screen->shminfo.shmid, IPC_RMID, 0); + xcb_shm_detach(HostX.conn, scrpriv->shminfo.shmseg); + xcb_image_destroy(scrpriv->ximg); + shmdt(scrpriv->shminfo.shmaddr); + shmctl(scrpriv->shminfo.shmid, IPC_RMID, 0); #endif } else { - free(host_screen->ximg->data); - host_screen->ximg->data = NULL; + free(scrpriv->ximg->data); + scrpriv->ximg->data = NULL; - XDestroyImage(host_screen->ximg); + xcb_image_destroy(scrpriv->ximg); } } if (HostX.have_shm) { - host_screen->ximg = #ifdef _MSC_VER __asm int 3; #else - host_screen->ximg = - XShmCreateImage(HostX.dpy, HostX.visual, HostX.depth, ZPixmap, NULL, - &host_screen->shminfo, width, buffer_height); - - host_screen->shminfo.shmid = + scrpriv->ximg = xcb_image_create_native(HostX.conn, + width, + buffer_height, + XCB_IMAGE_FORMAT_Z_PIXMAP, + HostX.depth, + NULL, + ~0, + NULL); + + scrpriv->shminfo.shmid = shmget(IPC_PRIVATE, - host_screen->ximg->bytes_per_line * buffer_height, + scrpriv->ximg->stride * buffer_height, IPC_CREAT | 0777); - host_screen->ximg->data = shmat(host_screen->shminfo.shmid, 0, 0); - host_screen->shminfo.shmaddr = host_screen->ximg->data; + scrpriv->ximg->data = shmat(scrpriv->shminfo.shmid, 0, 0); + scrpriv->shminfo.shmaddr = scrpriv->ximg->data; - if (host_screen->ximg->data == (char *) -1) { + if (scrpriv->ximg->data == (uint8_t *) -1) { EPHYR_DBG ("Can't attach SHM Segment, falling back to plain XImages"); - HostX.have_shm = False; - XDestroyImage(host_screen->ximg); - shmctl(host_screen->shminfo.shmid, IPC_RMID, 0); + HostX.have_shm = FALSE; + xcb_image_destroy (scrpriv->ximg); + shmctl(scrpriv->shminfo.shmid, IPC_RMID, 0); } else { - EPHYR_DBG("SHM segment attached %p", host_screen->shminfo.shmaddr); - host_screen->shminfo.readOnly = False; - XShmAttach(HostX.dpy, &host_screen->shminfo); - shm_success = True; + EPHYR_DBG("SHM segment attached %p", scrpriv->shminfo.shmaddr); + scrpriv->shminfo.shmseg = xcb_generate_id(HostX.conn); + xcb_shm_attach(HostX.conn, + scrpriv->shminfo.shmseg, + scrpriv->shminfo.shmid, + FALSE); + shm_success = TRUE; } #endif } if (!shm_success) { - bitmap_pad = (HostX.depth > 16) ? 32 : ((HostX.depth > 8) ? 16 : 8); - - EPHYR_DBG("Creating image %dx%d for screen host_screen=%p\n", - width, buffer_height, host_screen); - host_screen->ximg = XCreateImage(HostX.dpy, - HostX.visual, - HostX.depth, - ZPixmap, 0, 0, - width, buffer_height, bitmap_pad, 0); - - host_screen->ximg->data = - malloc(host_screen->ximg->bytes_per_line * buffer_height); + EPHYR_DBG("Creating image %dx%d for screen scrpriv=%p\n", + width, buffer_height, scrpriv); + scrpriv->ximg = xcb_image_create_native(HostX.conn, + width, + buffer_height, + XCB_IMAGE_FORMAT_Z_PIXMAP, + HostX.depth, + NULL, + ~0, + NULL); + + scrpriv->ximg->data = + malloc(scrpriv->ximg->stride * buffer_height); } - *bytes_per_line = host_screen->ximg->bytes_per_line; - *bits_per_pixel = host_screen->ximg->bits_per_pixel; - - XResizeWindow(HostX.dpy, host_screen->win, width, height); - - /* Ask the WM to keep our size static */ - if (host_screen->win_pre_existing == None && !EphyrWantResize) { - size_hints = XAllocSizeHints(); - size_hints->max_width = size_hints->min_width = width; - size_hints->max_height = size_hints->min_height = height; - size_hints->flags = PMinSize | PMaxSize; - XSetWMNormalHints(HostX.dpy, host_screen->win, size_hints); - XFree(size_hints); + *bytes_per_line = scrpriv->ximg->stride; + *bits_per_pixel = scrpriv->ximg->bpp; + + if (scrpriv->win_pre_existing == None && !EphyrWantResize) { + /* Ask the WM to keep our size static */ + xcb_size_hints_t size_hints = {0}; + size_hints.max_width = size_hints.min_width = width; + size_hints.max_height = size_hints.min_height = height; + size_hints.flags = (XCB_ICCCM_SIZE_HINT_P_MIN_SIZE | + XCB_ICCCM_SIZE_HINT_P_MAX_SIZE); + xcb_icccm_set_wm_normal_hints(HostX.conn, scrpriv->win, + &size_hints); } - XMapWindow(HostX.dpy, host_screen->win); + xcb_map_window(HostX.conn, scrpriv->win); - XSync(HostX.dpy, False); + xcb_aux_sync(HostX.conn); - host_screen->win_width = width; - host_screen->win_height = height; + scrpriv->win_width = width; + scrpriv->win_height = height; - if (host_depth_matches_server(host_screen)) { + if (host_depth_matches_server(scrpriv)) { EPHYR_DBG("Host matches server"); - return host_screen->ximg->data; + return scrpriv->ximg->data; } else { - EPHYR_DBG("server bpp %i", host_screen->server_depth >> 3); - host_screen->fb_data = - malloc(width * buffer_height * (host_screen->server_depth >> 3)); - return host_screen->fb_data; + EPHYR_DBG("server bpp %i", scrpriv->server_depth >> 3); + scrpriv->fb_data = + malloc(width * buffer_height * (scrpriv->server_depth >> 3)); + return scrpriv->fb_data; } } -static void hostx_paint_debug_rect(struct EphyrHostScreen *host_screen, +static void hostx_paint_debug_rect(KdScreenInfo *screen, int x, int y, int width, int height); void -hostx_paint_rect(EphyrScreenInfo screen, +hostx_paint_rect(KdScreenInfo *screen, int sx, int sy, int dx, int dy, int width, int height) { - struct EphyrHostScreen *host_screen = host_screen_from_screen_info(screen); + EphyrScrPriv *scrpriv = screen->driver; - EPHYR_DBG("painting in screen %d\n", host_screen->mynum); + EPHYR_DBG("painting in screen %d\n", scrpriv->mynum); /* * Copy the image data updated by the shadow layer @@ -767,7 +761,7 @@ hostx_paint_rect(EphyrScreenInfo screen, */ if (HostXWantDamageDebug) { - hostx_paint_debug_rect(host_screen, dx, dy, width, height); + hostx_paint_debug_rect(screen, dx, dy, width, height); } /* @@ -782,23 +776,23 @@ hostx_paint_rect(EphyrScreenInfo screen, * ... and it will be slower than the matching depth case. */ - if (!host_depth_matches_server(host_screen)) { - int x, y, idx, bytes_per_pixel = (host_screen->server_depth >> 3); + if (!host_depth_matches_server(scrpriv)) { + int x, y, idx, bytes_per_pixel = (scrpriv->server_depth >> 3); unsigned char r, g, b; unsigned long host_pixel; - EPHYR_DBG("Unmatched host depth host_screen=%p\n", host_screen); + EPHYR_DBG("Unmatched host depth scrpriv=%p\n", scrpriv); for (y = sy; y < sy + height; y++) for (x = sx; x < sx + width; x++) { idx = - (host_screen->win_width * y * bytes_per_pixel) + + (scrpriv->win_width * y * bytes_per_pixel) + (x * bytes_per_pixel); - switch (host_screen->server_depth) { + switch (scrpriv->server_depth) { case 16: { unsigned short pixel = - *(unsigned short *) (host_screen->fb_data + idx); + *(unsigned short *) (scrpriv->fb_data + idx); r = ((pixel & 0xf800) >> 8); g = ((pixel & 0x07e0) >> 3); @@ -806,14 +800,15 @@ hostx_paint_rect(EphyrScreenInfo screen, host_pixel = (r << 16) | (g << 8) | (b); - XPutPixel(host_screen->ximg, x, y, host_pixel); + xcb_image_put_pixel(scrpriv->ximg, x, y, host_pixel); break; } case 8: { unsigned char pixel = - *(unsigned char *) (host_screen->fb_data + idx); - XPutPixel(host_screen->ximg, x, y, HostX.cmap[pixel]); + *(unsigned char *) (scrpriv->fb_data + idx); + xcb_image_put_pixel(scrpriv->ximg, x, y, + HostX.cmap[pixel]); break; } default: @@ -826,27 +821,32 @@ hostx_paint_rect(EphyrScreenInfo screen, #ifdef _MSC_VER __asm int 3; #else - XShmPutImage(HostX.dpy, host_screen->win, - HostX.gc, host_screen->ximg, - sx, sy, dx, dy, width, height, False); + xcb_image_shm_put(HostX.conn, scrpriv->win, + HostX.gc, scrpriv->ximg, + scrpriv->shminfo, + sx, sy, dx, dy, width, height, FALSE); #endif } else { - XPutImage(HostX.dpy, host_screen->win, HostX.gc, host_screen->ximg, - sx, sy, dx, dy, width, height); + xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, scrpriv->ximg, + dx, dy, 0); } - XSync(HostX.dpy, False); + xcb_aux_sync(HostX.conn); } static void -hostx_paint_debug_rect(struct EphyrHostScreen *host_screen, +hostx_paint_debug_rect(KdScreenInfo *screen, int x, int y, int width, int height) { #ifdef _MSC_VER __asm int 3; #else + EphyrScrPriv *scrpriv = screen->driver; struct timespec tspec; + xcb_rectangle_t rect = { .x = x, .y = y, .width = width, .height = height }; + xcb_void_cookie_t cookie; + xcb_generic_error_t *e; tspec.tv_sec = HostX.damage_debug_msec / (1000000); tspec.tv_nsec = (HostX.damage_debug_msec % 1000000) * 1000; @@ -856,8 +856,10 @@ hostx_paint_debug_rect(struct EphyrHostScreen *host_screen, /* fprintf(stderr, "Xephyr updating: %i+%i %ix%i\n", x, y, width, height); */ - XFillRectangle(HostX.dpy, host_screen->win, HostX.gc, x, y, width, height); - XSync(HostX.dpy, False); + cookie = xcb_poly_fill_rectangle_checked(HostX.conn, scrpriv->win, + HostX.gc, 1, &rect); + e = xcb_request_check(HostX.conn, cookie); + free(e); /* nanosleep seems to work better than usleep for me... */ nanosleep(&tspec, NULL); @@ -867,304 +869,112 @@ hostx_paint_debug_rect(struct EphyrHostScreen *host_screen, void hostx_load_keymap(void) { - XID *keymap; - int host_width, min_keycode, max_keycode, width; - int i, j; + int min_keycode, max_keycode; - XDisplayKeycodes(HostX.dpy, &min_keycode, &max_keycode); + min_keycode = xcb_get_setup(HostX.conn)->min_keycode; + max_keycode = xcb_get_setup(HostX.conn)->max_keycode; EPHYR_DBG("min: %d, max: %d", min_keycode, max_keycode); - keymap = XGetKeyboardMapping(HostX.dpy, - min_keycode, - max_keycode - min_keycode + 1, &host_width); - - /* Try and copy the hosts keymap into our keymap to avoid loads - * of messing around. - * - * kdrive cannot can have more than 4 keysyms per keycode - * so we only copy at most the first 4 ( xorg has 6 per keycode, XVNC 2 ) - */ - width = (host_width > 4) ? 4 : host_width; - - ephyrKeySyms.map = (CARD32 *) calloc(sizeof(CARD32), - (max_keycode - min_keycode + 1) * - width); - if (!ephyrKeySyms.map) - goto out; - - for (i = 0; i < (max_keycode - min_keycode + 1); i++) - for (j = 0; j < width; j++) - ephyrKeySyms.map[(i * width) + j] = - (CARD32) keymap[(i * host_width) + j]; - - EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width); - ephyrKeySyms.minKeyCode = min_keycode; ephyrKeySyms.maxKeyCode = max_keycode; - ephyrKeySyms.mapWidth = width; - - out: - XFree(keymap); } -static struct EphyrHostScreen * -host_screen_from_window(Window w) +xcb_connection_t * +hostx_get_xcbconn(void) { - int index = 0; - struct EphyrHostScreen *result = NULL; - - for (index = 0; index < HostX.n_screens; index++) { - if (HostX.screens[index].win == w - || HostX.screens[index].peer_win == w - || HostX.screens[index].win_pre_existing == w) { - result = &HostX.screens[index]; - goto out; - } - } - - out: - return result; + return HostX.conn; } int -hostx_get_event(EphyrHostXEvent * ev) +hostx_get_screen(void) { - XEvent xev; - static int grabbed_screen = -1; - - if (XPending(HostX.dpy)) { - XNextEvent(HostX.dpy, &xev); - - switch (xev.type) { - case Expose: - /* Not so great event compression, but works ok */ - while (XCheckTypedWindowEvent(HostX.dpy, xev.xexpose.window, - Expose, &xev)); - { - struct EphyrHostScreen *host_screen = - host_screen_from_window(xev.xexpose.window); - if (host_screen) { - hostx_paint_rect(host_screen->info, 0, 0, 0, 0, - host_screen->win_width, - host_screen->win_height); - } - else { - EPHYR_LOG_ERROR("failed to get host screen\n"); - ev->type = EPHYR_EV_EXPOSE; - ev->data.expose.window = xev.xexpose.window; - return 1; - } - } - return 0; - - case MotionNotify: - { - struct EphyrHostScreen *host_screen = - host_screen_from_window(xev.xmotion.window); - - ev->type = EPHYR_EV_MOUSE_MOTION; - ev->data.mouse_motion.x = xev.xmotion.x; - ev->data.mouse_motion.y = xev.xmotion.y; - ev->data.mouse_motion.window = xev.xmotion.window; - ev->data.mouse_motion.screen = - (host_screen ? host_screen->mynum : -1); - } - return 1; - - case ButtonPress: - ev->type = EPHYR_EV_MOUSE_PRESS; - ev->key_state = xev.xkey.state; - /* - * This is a bit hacky. will break for button 5 ( defined as 0x10 ) - * Check KD_BUTTON defines in kdrive.h - */ - ev->data.mouse_down.button_num = 1 << (xev.xbutton.button - 1); - return 1; - - case ButtonRelease: - ev->type = EPHYR_EV_MOUSE_RELEASE; - ev->key_state = xev.xkey.state; - ev->data.mouse_up.button_num = 1 << (xev.xbutton.button - 1); - return 1; - - case KeyPress: - { - ev->type = EPHYR_EV_KEY_PRESS; - ev->key_state = xev.xkey.state; - ev->data.key_down.scancode = xev.xkey.keycode; - return 1; - } - case KeyRelease: - - if ((XKeycodeToKeysym(HostX.dpy, xev.xkey.keycode, 0) == XK_Shift_L - || XKeycodeToKeysym(HostX.dpy, xev.xkey.keycode, - 0) == XK_Shift_R) - && (xev.xkey.state & ControlMask)) { - struct EphyrHostScreen *host_screen = - host_screen_from_window(xev.xexpose.window); - - if (grabbed_screen != -1) { - XUngrabKeyboard(HostX.dpy, CurrentTime); - XUngrabPointer(HostX.dpy, CurrentTime); - grabbed_screen = -1; - hostx_set_win_title(host_screen->info, - "(ctrl+shift grabs mouse and keyboard)"); - } - else { - /* Attempt grab */ - if (XGrabKeyboard(HostX.dpy, host_screen->win, True, - GrabModeAsync, - GrabModeAsync, CurrentTime) == 0) { - if (XGrabPointer(HostX.dpy, host_screen->win, True, - NoEventMask, - GrabModeAsync, - GrabModeAsync, - host_screen->win, None, - CurrentTime) == 0) { - grabbed_screen = host_screen->mynum; - hostx_set_win_title - (host_screen->info, - "(ctrl+shift releases mouse and keyboard)"); - } - else /* Failed pointer grabm ungrab keyboard */ - XUngrabKeyboard(HostX.dpy, CurrentTime); - } - } - } - - /* Still send the release event even if above has happened - * server will get confused with just an up event. - * Maybe it would be better to just block shift+ctrls getting to - * kdrive all togeather. - */ - ev->type = EPHYR_EV_KEY_RELEASE; - ev->key_state = xev.xkey.state; - ev->data.key_up.scancode = xev.xkey.keycode; - return 1; - - case ConfigureNotify: - { - struct EphyrHostScreen *host_screen; - - /* event compression as for Expose events, cause - * we don't want to resize the framebuffer for - * every single change */ - while (XCheckTypedWindowEvent(HostX.dpy, xev.xconfigure.window, - ConfigureNotify, &xev)); - host_screen = host_screen_from_window(xev.xconfigure.window); - - if (!host_screen || - (host_screen->win_pre_existing == None && !EphyrWantResize)) { - return 0; - } - - ev->type = EPHYR_EV_CONFIGURE; - ev->data.configure.width = xev.xconfigure.width; - ev->data.configure.height = xev.xconfigure.height; - ev->data.configure.window = xev.xconfigure.window; - ev->data.configure.screen = host_screen->mynum; - - return 1; - } - default: - break; - - } - } - return 0; -} - -void * -hostx_get_display(void) -{ - return HostX.dpy; + return HostX.screen; } int hostx_get_window(int a_screen_number) { + EphyrScrPriv *scrpriv; if (a_screen_number < 0 || a_screen_number >= HostX.n_screens) { EPHYR_LOG_ERROR("bad screen number:%d\n", a_screen_number); return 0; } - return HostX.screens[a_screen_number].win; + scrpriv = HostX.screens[a_screen_number]->driver; + return scrpriv->win; } int hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attrs) { - XWindowAttributes attrs; - - memset(&attrs, 0, sizeof(attrs)); - - if (!XGetWindowAttributes(hostx_get_display(), a_window, &attrs)) { - return FALSE; - } - a_attrs->x = attrs.x; - a_attrs->y = attrs.y; - a_attrs->width = attrs.width; - a_attrs->height = attrs.height; - if (attrs.visual) - a_attrs->visualid = attrs.visual->visualid; + xcb_get_geometry_cookie_t geom_cookie; + xcb_get_window_attributes_cookie_t attr_cookie; + xcb_get_geometry_reply_t *geom_reply; + xcb_get_window_attributes_reply_t *attr_reply; + + geom_cookie = xcb_get_geometry(HostX.conn, a_window); + attr_cookie = xcb_get_window_attributes(HostX.conn, a_window); + geom_reply = xcb_get_geometry_reply(HostX.conn, geom_cookie, NULL); + attr_reply = xcb_get_window_attributes_reply(HostX.conn, attr_cookie, NULL); + + a_attrs->x = geom_reply->x; + a_attrs->y = geom_reply->y; + a_attrs->width = geom_reply->width; + a_attrs->height = geom_reply->height; + a_attrs->visualid = attr_reply->visual; + + free(geom_reply); + free(attr_reply); return TRUE; } int -hostx_get_extension_info(const char *a_ext_name, - int *a_major_opcode, - int *a_first_event, int *a_first_error) -{ - if (!a_ext_name || !a_major_opcode || !a_first_event || !a_first_error) - return 0; - if (!XQueryExtension(HostX.dpy, - a_ext_name, - a_major_opcode, a_first_event, a_first_error)) { - return 0; - } - return 1; -} - -int hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries) { - Display *dpy = hostx_get_display(); - Bool is_ok = False; - XVisualInfo templ, *visuals = NULL; + Bool is_ok = FALSE; EphyrHostVisualInfo *host_visuals = NULL; - int nb_items = 0, i = 0; + int nb_items = 0, i = 0, screen_num; + xcb_screen_iterator_t screens; + xcb_depth_iterator_t depths; - EPHYR_RETURN_VAL_IF_FAIL(a_visuals && a_num_entries && dpy, False); + EPHYR_RETURN_VAL_IF_FAIL(a_visuals && a_num_entries, FALSE); EPHYR_LOG("enter\n"); - memset(&templ, 0, sizeof(templ)); - visuals = XGetVisualInfo(dpy, VisualNoMask, &templ, &nb_items); - if (!visuals) { - EPHYR_LOG_ERROR("host does not advertise any visual\n"); - goto out; + + screens = xcb_setup_roots_iterator(xcb_get_setup(HostX.conn)); + for (screen_num = 0; screens.rem; screen_num++, xcb_screen_next(&screens)) { + depths = xcb_screen_allowed_depths_iterator(screens.data); + for (; depths.rem; xcb_depth_next(&depths)) { + xcb_visualtype_t *visuals = xcb_depth_visuals(depths.data); + EphyrHostVisualInfo *tmp_visuals = + realloc(host_visuals, + (nb_items + depths.data->visuals_len) + * sizeof(EphyrHostVisualInfo)); + if (!tmp_visuals) { + goto out; + } + host_visuals = tmp_visuals; + for (i = 0; i < depths.data->visuals_len; i++) { + host_visuals[nb_items + i].visualid = visuals[i].visual_id; + host_visuals[nb_items + i].screen = screen_num; + host_visuals[nb_items + i].depth = depths.data->depth; + host_visuals[nb_items + i].class = visuals[i]._class; + host_visuals[nb_items + i].red_mask = visuals[i].red_mask; + host_visuals[nb_items + i].green_mask = visuals[i].green_mask; + host_visuals[nb_items + i].blue_mask = visuals[i].blue_mask; + host_visuals[nb_items + i].colormap_size = visuals[i].colormap_entries; + host_visuals[nb_items + i].bits_per_rgb = visuals[i].bits_per_rgb_value; + } + nb_items += depths.data->visuals_len; + } } + EPHYR_LOG("host advertises %d visuals\n", nb_items); - host_visuals = calloc(nb_items, sizeof(EphyrHostVisualInfo)); - for (i = 0; i < nb_items; i++) { - host_visuals[i].visualid = visuals[i].visualid; - host_visuals[i].screen = visuals[i].screen; - host_visuals[i].depth = visuals[i].depth; - host_visuals[i].class = visuals[i].class; - host_visuals[i].red_mask = visuals[i].red_mask; - host_visuals[i].green_mask = visuals[i].green_mask; - host_visuals[i].blue_mask = visuals[i].blue_mask; - host_visuals[i].colormap_size = visuals[i].colormap_size; - host_visuals[i].bits_per_rgb = visuals[i].bits_per_rgb; - } *a_visuals = host_visuals; *a_num_entries = nb_items; host_visuals = NULL; is_ok = TRUE; - out: - if (visuals) { - XFree(visuals); - visuals = NULL; - } +out: free(host_visuals); host_visuals = NULL; EPHYR_LOG("leave\n"); @@ -1178,54 +988,58 @@ hostx_create_window(int a_screen_number, int a_visual_id, int *a_host_peer /*out parameter */ ) { Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - XVisualInfo *visual_info = NULL, visual_info_templ; - int visual_mask = VisualIDMask; - Window win = None; - int nb_visuals = 0, winmask = 0; - XSetWindowAttributes attrs; + xcb_window_t win; + int winmask = 0; + uint32_t attrs[2]; + xcb_screen_t *screen = xcb_aux_get_screen(HostX.conn, hostx_get_screen()); + xcb_visualtype_t *visual; + int depth = 0; + EphyrScrPriv *scrpriv = HostX.screens[a_screen_number]->driver; - EPHYR_RETURN_VAL_IF_FAIL(dpy && a_geometry, FALSE); + EPHYR_RETURN_VAL_IF_FAIL(screen && a_geometry, FALSE); EPHYR_LOG("enter\n"); - /*get visual */ - memset(&visual_info, 0, sizeof(visual_info)); - visual_info_templ.visualid = a_visual_id; - visual_info = XGetVisualInfo(dpy, visual_mask, - &visual_info_templ, &nb_visuals); - if (!visual_info) { - EPHYR_LOG_ERROR("argh, could not find a remote visual with id:%d\n", - a_visual_id); + visual = xcb_aux_find_visual_by_id(screen, a_visual_id); + if (!visual) { + EPHYR_LOG_ERROR ("argh, could not find a remote visual with id:%d\n", + a_visual_id); goto out; } - memset(&attrs, 0, sizeof(attrs)); - attrs.colormap = XCreateColormap(dpy, - RootWindow(dpy, - visual_info->screen), - visual_info->visual, AllocNone); - attrs.event_mask = ButtonPressMask - | ButtonReleaseMask - | PointerMotionMask | KeyPressMask | KeyReleaseMask | ExposureMask; - winmask = CWColormap | CWEventMask; - - win = XCreateWindow(dpy, hostx_get_window(a_screen_number), - a_geometry->x, a_geometry->y, - a_geometry->width, a_geometry->height, 0, - visual_info->depth, CopyFromParent, - visual_info->visual, winmask, &attrs); - if (win == None) { - EPHYR_LOG_ERROR("failed to create peer window\n"); - goto out; - } - if (HostX.screens[a_screen_number].peer_win == None) { - HostX.screens[a_screen_number].peer_win = win; + depth = xcb_aux_get_depth_of_visual(screen, a_visual_id); + + winmask = XCB_CW_EVENT_MASK | XCB_CW_COLORMAP; + attrs[0] = XCB_EVENT_MASK_BUTTON_PRESS + |XCB_EVENT_MASK_BUTTON_RELEASE + |XCB_EVENT_MASK_POINTER_MOTION + |XCB_EVENT_MASK_KEY_PRESS + |XCB_EVENT_MASK_KEY_RELEASE + |XCB_EVENT_MASK_EXPOSURE; + attrs[1] = xcb_generate_id(HostX.conn); + xcb_create_colormap(HostX.conn, + XCB_COLORMAP_ALLOC_NONE, + attrs[1], + hostx_get_window(a_screen_number), + a_visual_id); + + win = xcb_generate_id(HostX.conn); + xcb_create_window(HostX.conn, + depth, + win, + hostx_get_window (a_screen_number), + a_geometry->x, a_geometry->y, + a_geometry->width, a_geometry->height, 0, + XCB_WINDOW_CLASS_COPY_FROM_PARENT, + a_visual_id, winmask, attrs); + + if (scrpriv->peer_win == XCB_NONE) { + scrpriv->peer_win = win; } else { EPHYR_LOG_ERROR("multiple peer windows created for same screen\n"); } - XFlush(dpy); - XMapWindow(dpy, win); + xcb_flush(HostX.conn); + xcb_map_window(HostX.conn, win); *a_host_peer = win; is_ok = TRUE; out: @@ -1236,26 +1050,31 @@ hostx_create_window(int a_screen_number, int hostx_destroy_window(int a_win) { - Display *dpy = hostx_get_display(); - - EPHYR_RETURN_VAL_IF_FAIL(dpy, FALSE); - XDestroyWindow(dpy, a_win); - XFlush(dpy); + xcb_destroy_window(HostX.conn, a_win); + xcb_flush(HostX.conn); return TRUE; } int hostx_set_window_geometry(int a_win, EphyrBox * a_geo) { - Display *dpy = hostx_get_display(); + uint32_t mask = XCB_CONFIG_WINDOW_X + | XCB_CONFIG_WINDOW_Y + | XCB_CONFIG_WINDOW_WIDTH + | XCB_CONFIG_WINDOW_HEIGHT; + uint32_t values[4]; - EPHYR_RETURN_VAL_IF_FAIL(dpy && a_geo, FALSE); + EPHYR_RETURN_VAL_IF_FAIL(a_geo, FALSE); EPHYR_LOG("enter. x,y,w,h:(%d,%d,%d,%d)\n", a_geo->x, a_geo->y, a_geo->width, a_geo->height); - XMoveWindow(dpy, a_win, a_geo->x, a_geo->y); - XResizeWindow(dpy, a_win, a_geo->width, a_geo->height); + values[0] = a_geo->x; + values[1] = a_geo->y; + values[2] = a_geo->width; + values[3] = a_geo->height; + xcb_configure_window(HostX.conn, a_win, mask, values); + EPHYR_LOG("leave\n"); return TRUE; } @@ -1265,15 +1084,16 @@ hostx_set_window_bounding_rectangles(int a_window, EphyrRect * a_rects, int a_num_rects) { Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); int i = 0; - XRectangle *rects = NULL; + xcb_rectangle_t *rects = NULL; - EPHYR_RETURN_VAL_IF_FAIL(dpy && a_rects, FALSE); + EPHYR_RETURN_VAL_IF_FAIL(a_rects, FALSE); EPHYR_LOG("enter. num rects:%d\n", a_num_rects); - rects = calloc(a_num_rects, sizeof(XRectangle)); + rects = calloc(a_num_rects, sizeof (xcb_rectangle_t)); + if (!rects) + goto out; for (i = 0; i < a_num_rects; i++) { rects[i].x = a_rects[i].x1; rects[i].y = a_rects[i].y1; @@ -1282,74 +1102,23 @@ hostx_set_window_bounding_rectangles(int a_window, EPHYR_LOG("borders clipped to rect[x:%d,y:%d,w:%d,h:%d]\n", rects[i].x, rects[i].y, rects[i].width, rects[i].height); } - /*this aways returns 1 */ -#ifdef _MSC_VER - __asm int 3; -#else - XShapeCombineRectangles(dpy, a_window, ShapeBounding, 0, 0, - rects, a_num_rects, ShapeSet, YXBanded); -#endif + xcb_shape_rectangles(HostX.conn, + XCB_SHAPE_SO_SET, + XCB_SHAPE_SK_BOUNDING, + XCB_CLIP_ORDERING_YX_BANDED, + a_window, + 0, 0, + a_num_rects, + rects); is_ok = TRUE; +out: free(rects); rects = NULL; EPHYR_LOG("leave\n"); return is_ok; } -int -hostx_set_window_clipping_rectangles(int a_window, - EphyrRect * a_rects, int a_num_rects) -{ - Bool is_ok = FALSE; - Display *dpy = hostx_get_display(); - int i = 0; - XRectangle *rects = NULL; - - EPHYR_RETURN_VAL_IF_FAIL(dpy && a_rects, FALSE); - - EPHYR_LOG("enter. num rects:%d\n", a_num_rects); - - rects = calloc(a_num_rects, sizeof(XRectangle)); - for (i = 0; i < a_num_rects; i++) { - rects[i].x = a_rects[i].x1; - rects[i].y = a_rects[i].y1; - rects[i].width = abs(a_rects[i].x2 - a_rects[i].x1); - rects[i].height = abs(a_rects[i].y2 - a_rects[i].y1); - EPHYR_LOG("clipped to rect[x:%d,y:%d,w:%d,h:%d]\n", - rects[i].x, rects[i].y, rects[i].width, rects[i].height); - } - /*this aways returns 1 */ -#ifdef _MSC_VER - __asm int 3; -#else - XShapeCombineRectangles(dpy, a_window, ShapeClip, 0, 0, - rects, a_num_rects, ShapeSet, YXBanded); -#endif - is_ok = TRUE; - - free(rects); - rects = NULL; - EPHYR_LOG("leave\n"); - return is_ok; -} - -int -hostx_has_xshape(void) -{ - int event_base = 0, error_base = 0; -#ifdef _MSC_VER - __asm int 3; -#else - Display *dpy = hostx_get_display(); - - if (!XShapeQueryExtension(dpy, &event_base, &error_base)) { - return FALSE; - } -#endif - return TRUE; -} - #ifdef XF86DRI typedef struct { int is_valid; @@ -1366,7 +1135,6 @@ hostx_allocate_resource_id_peer(int a_local_resource_id, { int i = 0; ResourcePair *peer = NULL; - Display *dpy = hostx_get_display(); /* * first make sure a resource peer @@ -1391,7 +1159,7 @@ hostx_allocate_resource_id_peer(int a_local_resource_id, } } if (peer) { - peer->remote_id = XAllocID(dpy); + peer->remote_id = xcb_generate_id(HostX.conn); peer->local_id = a_local_resource_id; peer->is_valid = TRUE; } @@ -1423,31 +1191,4 @@ hostx_get_resource_id_peer(int a_local_resource_id, int *a_remote_resource_id) return FALSE; } -int -hostx_has_dri(void) -{ - int event_base = 0, error_base = 0; - Display *dpy = hostx_get_display(); - - if (!dpy) - return FALSE; - - if (!XF86DRIQueryExtension(dpy, &event_base, &error_base)) { - return FALSE; - } - return TRUE; -} - -int -hostx_has_glx(void) -{ - Display *dpy = hostx_get_display(); - int event_base = 0, error_base = 0; - - if (!glXQueryExtension(dpy, &event_base, &error_base)) { - return FALSE; - } - return TRUE; -} - #endif /* XF86DRI */ diff --git a/xorg-server/hw/kdrive/ephyr/hostx.h b/xorg-server/hw/kdrive/ephyr/hostx.h index 04b4ad081..f2350efba 100644 --- a/xorg-server/hw/kdrive/ephyr/hostx.h +++ b/xorg-server/hw/kdrive/ephyr/hostx.h @@ -28,6 +28,8 @@ #include <X11/X.h> #include <X11/Xmd.h> +#include <xcb/xcb.h> +#include "ephyr.h" #define EPHYR_WANT_DEBUG 0 @@ -43,69 +45,12 @@ #endif typedef struct EphyrHostXVars EphyrHostXVars; -typedef struct EphyrHostXEvent EphyrHostXEvent; -typedef void *EphyrScreenInfo; -typedef enum EphyrHostXEventType { - EPHYR_EV_MOUSE_MOTION, - EPHYR_EV_MOUSE_PRESS, - EPHYR_EV_MOUSE_RELEASE, - EPHYR_EV_KEY_PRESS, - EPHYR_EV_KEY_RELEASE, - EPHYR_EV_EXPOSE, - EPHYR_EV_CONFIGURE, -} EphyrHostXEventType; - -/* I can't believe it's not a KeySymsRec. */ + typedef struct { int minKeyCode; int maxKeyCode; - int mapWidth; - CARD32 *map; } EphyrKeySyms; -struct EphyrHostXEvent { - EphyrHostXEventType type; - - union { - struct mouse_motion { - int x; - int y; - int screen; - int window; - } mouse_motion; - - struct mouse_down { - int button_num; - } mouse_down; - - struct mouse_up { - int button_num; - } mouse_up; - - struct key_up { - int scancode; - } key_up; - - struct key_down { - int scancode; - } key_down; - - struct expose { - int window; - } expose; - - struct configure { - int width; - int height; - int screen; - int window; - } configure; - - } data; - - int key_state; -}; - typedef struct { VisualID visualid; int screen; @@ -133,13 +78,13 @@ typedef struct { } EphyrRect; int - hostx_want_screen_size(EphyrScreenInfo screen, int *width, int *height); +hostx_want_screen_size(KdScreenInfo *screen, int *width, int *height); int hostx_want_host_cursor(void); void - hostx_use_host_cursor(void); + hostx_use_sw_cursor(void); void hostx_use_fullscreen(void); @@ -148,7 +93,7 @@ int hostx_want_fullscreen(void); int - hostx_want_preexisting_window(EphyrScreenInfo screen); +hostx_want_preexisting_window(KdScreenInfo *screen); void hostx_use_preexisting_window(unsigned long win_id); @@ -166,52 +111,50 @@ int hostx_init(void); void - hostx_add_screen(EphyrScreenInfo screen, unsigned long win_id, int screen_num); +hostx_add_screen(KdScreenInfo *screen, unsigned long win_id, int screen_num); void hostx_set_display_name(char *name); void - hostx_set_screen_number(EphyrScreenInfo screen, int number); +hostx_set_screen_number(KdScreenInfo *screen, int number); void - hostx_set_win_title(EphyrScreenInfo screen, const char *extra_text); +hostx_set_win_title(KdScreenInfo *screen, const char *extra_text); int hostx_get_depth(void); int - hostx_get_server_depth(EphyrScreenInfo screen); - -void - hostx_set_server_depth(EphyrScreenInfo screen, int depth); +hostx_get_server_depth(KdScreenInfo *screen); int - hostx_get_bpp(void *info); +hostx_get_bpp(KdScreenInfo *screen); void - hostx_get_visual_masks(void *info, CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk); +hostx_get_visual_masks(KdScreenInfo *screen, + CARD32 *rmsk, CARD32 *gmsk, CARD32 *bmsk); void hostx_set_cmap_entry(unsigned char idx, unsigned char r, unsigned char g, unsigned char b); -void *hostx_screen_init(EphyrScreenInfo screen, +void *hostx_screen_init(KdScreenInfo *screen, int width, int height, int buffer_height, int *bytes_per_line, int *bits_per_pixel); void - -hostx_paint_rect(EphyrScreenInfo screen, +hostx_paint_rect(KdScreenInfo *screen, int sx, int sy, int dx, int dy, int width, int height); void hostx_load_keymap(void); -int - hostx_get_event(EphyrHostXEvent * ev); +xcb_connection_t * +hostx_get_xcbconn(void); -void *hostx_get_display(void); +int +hostx_get_screen(void); int hostx_get_window(int a_screen_number); @@ -220,11 +163,6 @@ int hostx_get_window_attributes(int a_window, EphyrHostWindowAttributes * a_attr); int - -hostx_get_extension_info(const char *a_ext_name, - int *a_major_opcode, - int *a_first_even, int *a_first_error); -int hostx_get_visuals_info(EphyrHostVisualInfo ** a_visuals, int *a_num_entries); int hostx_create_window(int a_screen_number, @@ -238,9 +176,7 @@ int hostx_set_window_geometry(int a_win, EphyrBox * a_geo); int hostx_set_window_bounding_rectangles(int a_window, EphyrRect * a_rects, int a_num_rects); -int hostx_set_window_clipping_rectangles(int a_window, - EphyrRect * a_rects, int a_num_rects); -int hostx_has_xshape(void); +int host_has_extension(xcb_extension_t *extension); #ifdef XF86DRI int hostx_lookup_peer_window(void *a_local_window, diff --git a/xorg-server/hw/kdrive/ephyr/xf86dri.h b/xorg-server/hw/kdrive/ephyr/xf86dri.h deleted file mode 100644 index 88d3f3bf1..000000000 --- a/xorg-server/hw/kdrive/ephyr/xf86dri.h +++ /dev/null @@ -1,124 +0,0 @@ -/* $XFree86: xc/lib/GL/dri/xf86dri.h,v 1.8 2002/10/30 12:51:25 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -Copyright 2000 VA Linux Systems, Inc. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/** - * \file xf86dri.h - * Protocol numbers and function prototypes for DRI X protocol. - * - * \author Kevin E. Martin <martin@valinux.com> - * \author Jens Owen <jens@tungstengraphics.com> - * \author Rickard E. (Rik) Faith <faith@valinux.com> - */ - -#ifndef _XF86DRI_H_ -#define _XF86DRI_H_ - -#include <X11/Xfuncproto.h> -#include <xf86drm.h> - -#define X_XF86DRIQueryVersion 0 -#define X_XF86DRIQueryDirectRenderingCapable 1 -#define X_XF86DRIOpenConnection 2 -#define X_XF86DRICloseConnection 3 -#define X_XF86DRIGetClientDriverName 4 -#define X_XF86DRICreateContext 5 -#define X_XF86DRIDestroyContext 6 -#define X_XF86DRICreateDrawable 7 -#define X_XF86DRIDestroyDrawable 8 -#define X_XF86DRIGetDrawableInfo 9 -#define X_XF86DRIGetDeviceInfo 10 -#define X_XF86DRIAuthConnection 11 -#define X_XF86DRIOpenFullScreen 12 /* Deprecated */ -#define X_XF86DRICloseFullScreen 13 /* Deprecated */ - -#define XF86DRINumberEvents 0 - -#define XF86DRIClientNotLocal 0 -#define XF86DRIOperationNotSupported 1 -#define XF86DRINumberErrors (XF86DRIOperationNotSupported + 1) - -#ifndef _XF86DRI_SERVER_ - -_XFUNCPROTOBEGIN - -Bool XF86DRIQueryExtension(Display * dpy, int *event_base, int *error_base); - -Bool XF86DRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion, - int *patchVersion); - -Bool XF86DRIQueryDirectRenderingCapable(Display * dpy, int screen, - Bool *isCapable); - -Bool XF86DRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA, - char **busIDString); - -Bool XF86DRIAuthConnection(Display * dpy, int screen, drm_magic_t magic); - -Bool XF86DRICloseConnection(Display * dpy, int screen); - -Bool XF86DRIGetClientDriverName(Display * dpy, int screen, - int *ddxDriverMajorVersion, - int *ddxDriverMinorVersion, - int *ddxDriverPatchVersion, - char **clientDriverName); - -Bool XF86DRICreateContext(Display * dpy, int screen, Visual * visual, - XID *ptr_to_returned_context_id, - drm_context_t * hHWContext); - -Bool XF86DRICreateContextWithConfig(Display * dpy, int screen, int configID, - XID *ptr_to_returned_context_id, - drm_context_t * hHWContext); - -extern GLboolean XF86DRIDestroyContext(Display * dpy, int screen, - XID context_id); - -extern GLboolean XF86DRICreateDrawable(Display * dpy, int screen, - XID drawable, - drm_drawable_t * hHWDrawable); - -extern GLboolean XF86DRIDestroyDrawable(Display * dpy, int screen, - XID drawable); - -Bool XF86DRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable, - unsigned int *index, unsigned int *stamp, - int *X, int *Y, int *W, int *H, - int *numClipRects, drm_clip_rect_t ** pClipRects, - int *backX, int *backY, - int *numBackClipRects, - drm_clip_rect_t ** pBackClipRects); - -Bool XF86DRIGetDeviceInfo(Display * dpy, int screen, - drm_handle_t * hFrameBuffer, int *fbOrigin, - int *fbSize, int *fbStride, int *devPrivateSize, - void **pDevPrivate); - -_XFUNCPROTOEND -#endif /* _XF86DRI_SERVER_ */ -#endif /* _XF86DRI_H_ */ diff --git a/xorg-server/hw/xfree86/Makefile.am b/xorg-server/hw/xfree86/Makefile.am index d568e0d7e..59cfb5f6f 100644 --- a/xorg-server/hw/xfree86/Makefile.am +++ b/xorg-server/hw/xfree86/Makefile.am @@ -84,21 +84,28 @@ os-support/solaris/solaris-@SOLARIS_INOUT_ARCH@.il: $(MAKE) $(AM_MAKEFLAGS) solaris-@SOLARIS_INOUT_ARCH@.il endif -# do not use $(mkdir_p) if you want automake 1.7 to work +# Without logdir, X will post an error on the terminal and will not start install-data-local: - mkdir -p $(DESTDIR)$(logdir) - + $(AM_V_GEN)$(MKDIR_P) $(DESTDIR)$(logdir) +if CYGWIN + $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a +endif -install-exec-local: install-binPROGRAMS - (cd $(DESTDIR)$(bindir) && rm -f X && ln -s Xorg X) +install-exec-hook: + (cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) Xorg$(EXEEXT) X) if INSTALL_SETUID chown root $(DESTDIR)$(bindir)/Xorg chmod u+s $(DESTDIR)$(bindir)/Xorg endif + +uninstall-local: if CYGWIN - $(INSTALL_DATA) libXorg.exe.a $(DESTDIR)$(libdir)/libXorg.exe.a + $(AM_V_at)rm -f $(DESTDIR)$(libdir)/libXorg.exe.a endif +uninstall-hook: + $(AM_V_at)rm -f $(DESTDIR)$(bindir)/X + # Use variables from XORG_MANPAGE_SECTIONS and X Server configuration # Do not include manpages.am as values are not appropriate for rc files CONF_SUBSTS = -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' \ diff --git a/xorg-server/hw/xfree86/common/xf86Cursor.c b/xorg-server/hw/xfree86/common/xf86Cursor.c index 65a9e8264..7d0776eaa 100644 --- a/xorg-server/hw/xfree86/common/xf86Cursor.c +++ b/xorg-server/hw/xfree86/common/xf86Cursor.c @@ -72,9 +72,6 @@ static miPointerScreenFuncRec xf86PointerScreenFuncs = { xf86CursorOffScreen, xf86CrossScreen, xf86WarpCursor, - /* let miPointerInitialize take care of these */ - NULL, - NULL }; static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS]; diff --git a/xorg-server/hw/xfree86/modes/xf86Rotate.c b/xorg-server/hw/xfree86/modes/xf86Rotate.c index a3937478f..495af9ba7 100644 --- a/xorg-server/hw/xfree86/modes/xf86Rotate.c +++ b/xorg-server/hw/xfree86/modes/xf86Rotate.c @@ -272,14 +272,10 @@ xf86RotateDestroy(xf86CrtcPtr crtc) screenDrawable = &pScreen->root->drawable; /* Free damage structure */ if (xf86_config->rotation_damage_registered) { - if (screenDrawable) - DamageUnregister(screenDrawable, - xf86_config->rotation_damage); xf86_config->rotation_damage_registered = FALSE; DisableLimitedSchedulingLatency(); } - if (screenDrawable) - DamageDestroy(xf86_config->rotation_damage); + DamageDestroy(xf86_config->rotation_damage); xf86_config->rotation_damage = NULL; } } diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c index 185b2b951..fe1a76413 100644 --- a/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c +++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_init.c @@ -42,6 +42,7 @@ #include <sys/file.h> #include <assert.h> #include <mach.h> +#include <hurd.h> int xf86ProcessArgument(int argc, char **argv, int i) diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c index 6ac9efdfe..8e089cadb 100644 --- a/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c +++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_mmap.c @@ -27,6 +27,7 @@ #include<mach.h> #include<device/device.h> #include<mach/machine/mach_i386.h> +#include <hurd.h> #include <X11/X.h> diff --git a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c index 72474ba10..b3b94c9f2 100644 --- a/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c +++ b/xorg-server/hw/xfree86/os-support/hurd/hurd_video.c @@ -28,6 +28,7 @@ #include <mach.h> #include <device/device.h> #include <mach/machine/mach_i386.h> +#include <hurd.h> #include <X11/X.h> #include "input.h" diff --git a/xorg-server/hw/xfree86/os-support/shared/vidmem.c b/xorg-server/hw/xfree86/os-support/shared/vidmem.c index 514fc2fa7..68ed30e41 100644 --- a/xorg-server/hw/xfree86/os-support/shared/vidmem.c +++ b/xorg-server/hw/xfree86/os-support/shared/vidmem.c @@ -257,16 +257,3 @@ xf86LinearVidMem(void) xf86InitVidMem(); return vidMemInfo.linearSupported; } - -void -xf86MapReadSideEffects(int ScreenNum, int Flags, pointer base, - unsigned long Size) -{ - if (!(Flags & VIDMEM_READSIDEEFFECT)) - return; - - if (!vidMemInfo.initialised || !vidMemInfo.readSideEffects) - return; - - vidMemInfo.readSideEffects(ScreenNum, base, Size); -} diff --git a/xorg-server/hw/xfree86/os-support/xf86OSpriv.h b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h index 65769c16f..bd734f554 100644 --- a/xorg-server/hw/xfree86/os-support/xf86OSpriv.h +++ b/xorg-server/hw/xfree86/os-support/xf86OSpriv.h @@ -38,7 +38,6 @@ typedef pointer (*SetWCProcPtr) (int, unsigned long, unsigned long, Bool, MessageType); typedef void (*ProtectMemProcPtr) (int, pointer, unsigned long, Bool); typedef void (*UndoWCProcPtr) (int, pointer); -typedef void (*ReadSideEffectsProcPtr) (int, pointer, unsigned long); typedef struct { Bool initialised; @@ -47,7 +46,6 @@ typedef struct { ProtectMemProcPtr protectMem; SetWCProcPtr setWC; UndoWCProcPtr undoWC; - ReadSideEffectsProcPtr readSideEffects; Bool linearSupported; } VidMemInfo, *VidMemInfoPtr; diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h index 6be594651..106168aba 100644 --- a/xorg-server/hw/xfree86/os-support/xf86_OSproc.h +++ b/xorg-server/hw/xfree86/os-support/xf86_OSproc.h @@ -136,8 +136,6 @@ extern _X_EXPORT _X_DEPRECATED pointer xf86MapVidMem(int, int, unsigned long, unsigned long); extern _X_EXPORT _X_DEPRECATED void xf86UnMapVidMem(int, pointer, unsigned long); -extern _X_EXPORT _X_DEPRECATED void xf86MapReadSideEffects(int, int, pointer, - unsigned long); extern _X_EXPORT int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int); extern _X_EXPORT Bool xf86EnableIO(void); diff --git a/xorg-server/hw/xfree86/vbe/vbe.c b/xorg-server/hw/xfree86/vbe/vbe.c index f0344af9c..39f0cefb6 100644 --- a/xorg-server/hw/xfree86/vbe/vbe.c +++ b/xorg-server/hw/xfree86/vbe/vbe.c @@ -319,10 +319,8 @@ vbeReadEDID(vbeInfoPtr pVbe) } xf86MonPtr -vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) +vbeDoEDID(vbeInfoPtr pVbe, pointer unused) { - xf86MonPtr pMonitor; - pointer pModule; unsigned char *DDC_data = NULL; if (!pVbe) @@ -330,23 +328,12 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) if (pVbe->version < 0x200) return NULL; - if (!(pModule = pDDCModule)) { - pModule = - xf86LoadSubModule(pVbe->pInt10->pScrn, "ddc"); - if (!pModule) - return NULL; - } - DDC_data = vbeReadEDID(pVbe); if (!DDC_data) return NULL; - pMonitor = xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data); - - if (!pDDCModule) - xf86UnloadSubModule(pModule); - return pMonitor; + return xf86InterpretEDID(pVbe->pInt10->pScrn->scrnIndex, DDC_data); } #define GET_UNALIGNED2(x) \ diff --git a/xorg-server/hw/xnest/GCOps.c b/xorg-server/hw/xnest/GCOps.c index e26a1363b..7b1956de0 100644 --- a/xorg-server/hw/xnest/GCOps.c +++ b/xorg-server/hw/xnest/GCOps.c @@ -94,15 +94,29 @@ xnestPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y, } } +static int +xnestIgnoreErrorHandler (Display *display, + XErrorEvent *event) +{ + return False; /* return value is ignored */ +} + void xnestGetImage(DrawablePtr pDrawable, int x, int y, int w, int h, unsigned int format, unsigned long planeMask, char *pImage) { XImage *ximage; int length; + int (*old_handler)(Display*, XErrorEvent*); + + /* we may get BadMatch error when xnest window is minimized */ + XSync(xnestDisplay, False); + old_handler = XSetErrorHandler (xnestIgnoreErrorHandler); ximage = XGetImage(xnestDisplay, xnestDrawable(pDrawable), x, y, w, h, planeMask, format); + XSync(xnestDisplay, False); + XSetErrorHandler(old_handler); if (ximage) { length = ximage->bytes_per_line * ximage->height; diff --git a/xorg-server/hw/xnest/Pixmap.c b/xorg-server/hw/xnest/Pixmap.c index 13e1610fd..2902acd56 100644 --- a/xorg-server/hw/xnest/Pixmap.c +++ b/xorg-server/hw/xnest/Pixmap.c @@ -78,6 +78,21 @@ xnestDestroyPixmap(PixmapPtr pPixmap) return TRUE; } +Bool +xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData) +{ + if(!xnestPixmapPriv(pPixmap)->pixmap && width > 0 && height > 0) { + xnestPixmapPriv(pPixmap)->pixmap = + XCreatePixmap(xnestDisplay, + xnestDefaultWindows[pPixmap->drawable.pScreen->myNum], + width, height, depth); + } + + return miModifyPixmapHeader(pPixmap, width, height, depth, + bitsPerPixel, devKind, pPixData); +} + RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap) { diff --git a/xorg-server/hw/xnest/Screen.c b/xorg-server/hw/xnest/Screen.c index 58b5a1199..abb4d372d 100644 --- a/xorg-server/hw/xnest/Screen.c +++ b/xorg-server/hw/xnest/Screen.c @@ -282,6 +282,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) pScreen->CreatePixmap = xnestCreatePixmap; pScreen->DestroyPixmap = xnestDestroyPixmap; + pScreen->ModifyPixmapHeader = xnestModifyPixmapHeader; /* Font procedures */ diff --git a/xorg-server/hw/xnest/XNPixmap.h b/xorg-server/hw/xnest/XNPixmap.h index 268ba1e8b..5b2e796fe 100644 --- a/xorg-server/hw/xnest/XNPixmap.h +++ b/xorg-server/hw/xnest/XNPixmap.h @@ -33,6 +33,8 @@ typedef struct { PixmapPtr xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint); Bool xnestDestroyPixmap(PixmapPtr pPixmap); +Bool xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData); RegionPtr xnestPixmapToRegion(PixmapPtr pPixmap); #endif /* XNESTPIXMAP_H */ diff --git a/xorg-server/hw/xquartz/GL/glcontextmodes.c b/xorg-server/hw/xquartz/GL/glcontextmodes.c index dc97f89e4..1ce3570c8 100644 --- a/xorg-server/hw/xquartz/GL/glcontextmodes.c +++ b/xorg-server/hw/xquartz/GL/glcontextmodes.c @@ -555,7 +555,6 @@ _gl_context_modes_are_same(const __GLcontextModes * a, (a->stencilBits == b->stencilBits) && (a->numAuxBuffers == b->numAuxBuffers) && (a->level == b->level) && - (a->pixmapMode == b->pixmapMode) && (a->visualRating == b->visualRating) && (a->transparentPixel == b->transparentPixel) && diff --git a/xorg-server/hw/xquartz/GL/visualConfigs.c b/xorg-server/hw/xquartz/GL/visualConfigs.c index a00abf29a..92142cb0d 100644 --- a/xorg-server/hw/xquartz/GL/visualConfigs.c +++ b/xorg-server/hw/xquartz/GL/visualConfigs.c @@ -144,7 +144,6 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) c->level = 0; c->indexBits = 0; - c->pixmapMode = 0; // TODO: What should this be? if(conf->accelerated) { c->visualRating = GLX_NONE; diff --git a/xorg-server/hw/xquartz/xpr/xprCursor.c b/xorg-server/hw/xquartz/xpr/xprCursor.c index 0392a4639..4168f7c53 100644 --- a/xorg-server/hw/xquartz/xpr/xprCursor.c +++ b/xorg-server/hw/xquartz/xpr/xprCursor.c @@ -305,8 +305,6 @@ static miPointerScreenFuncRec quartzScreenFuncsRec = { QuartzCursorOffScreen, QuartzCrossScreen, QuartzWarpCursor, - NULL, - NULL }; /* diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c index 082c5ad3e..1179dc248 100644 --- a/xorg-server/hw/xwin/glx/indirect.c +++ b/xorg-server/hw/xwin/glx/indirect.c @@ -1896,7 +1896,6 @@ fbConfigToPixelFormat(__GLXconfig * mode, PIXELFORMATDESCRIPTOR * pfdret, pfd.cAuxBuffers = mode->numAuxBuffers; /* mode->level ? */ - /* mode->pixmapMode ? */ *pfdret = pfd; @@ -2108,7 +2107,6 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen) // pfd.dwLayerMask; // ignored // pfd.dwDamageMask; // ignored - c->base.pixmapMode = 0; c->base.visualID = -1; // will be set by __glXScreenInit() /* EXT_visual_rating / GLX 1.2 */ @@ -2199,9 +2197,6 @@ glxWinCreateConfigs(HDC hdc, glxWinScreen * screen) else c->base.swapMethod = GLX_SWAP_UNDEFINED_OML; - /* EXT_import_context */ - c->base.screen = screen->base.pScreen->myNum; - /* EXT_texture_from_pixmap */ c->base.bindToTextureRgb = -1; c->base.bindToTextureRgba = -1; @@ -2449,7 +2444,6 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen) } c->base.level = 0; - c->base.pixmapMode = 0; // ??? c->base.visualID = -1; // will be set by __glXScreenInit() /* EXT_visual_rating / GLX 1.2 */ @@ -2582,9 +2576,6 @@ glxWinCreateConfigsExt(HDC hdc, glxWinScreen * screen) c->base.swapMethod = GLX_SWAP_UNDEFINED_OML; } - /* EXT_import_context */ - c->base.screen = screen->base.pScreen->myNum; - /* EXT_texture_from_pixmap */ /* Mesa's DRI configs always have bindToTextureRgb/Rgba TRUE (see driCreateConfigs(), so setting diff --git a/xorg-server/include/cursorstr.h b/xorg-server/include/cursorstr.h index 68ab2ecfd..2157954c9 100644 --- a/xorg-server/include/cursorstr.h +++ b/xorg-server/include/cursorstr.h @@ -78,10 +78,8 @@ typedef struct _Cursor { int refcnt; PrivateRec *devPrivates; /* set by pScr->RealizeCursor */ XID id; -#ifdef XFIXES CARD32 serialNumber; Atom name; -#endif } CursorRec; #define CURSOR_REC_SIZE (sizeof(CursorRec) + dixPrivatesSize(PRIVATE_CURSOR)) diff --git a/xorg-server/include/dixstruct.h b/xorg-server/include/dixstruct.h index 132521673..7226760e9 100644 --- a/xorg-server/include/dixstruct.h +++ b/xorg-server/include/dixstruct.h @@ -61,7 +61,6 @@ typedef enum { ClientStateInitial, ClientStateGone } ClientState; -#ifdef XFIXES typedef struct _saveSet { struct _Window *windowPtr; Bool toRoot; @@ -73,16 +72,6 @@ typedef struct _saveSet { #define SaveSetAssignWindow(ss,w) ((ss).windowPtr = (w)) #define SaveSetAssignToRoot(ss,tr) ((ss).toRoot = (tr)) #define SaveSetAssignMap(ss,m) ((ss).map = (m)) -#else -typedef struct _Window *SaveSetElt; - -#define SaveSetWindow(ss) (ss) -#define SaveSetToRoot(ss) FALSE -#define SaveSetShouldMap(ss) TRUE -#define SaveSetAssignWindow(ss,w) ((ss) = (w)) -#define SaveSetAssignToRoot(ss,tr) -#define SaveSetAssignMap(ss,m) -#endif typedef struct _Client { pointer requestBuffer; diff --git a/xorg-server/include/extinit.h b/xorg-server/include/extinit.h index 5690d7b01..6d67bf2e5 100644 --- a/xorg-server/include/extinit.h +++ b/xorg-server/include/extinit.h @@ -140,10 +140,8 @@ extern void XFree86BigfontExtensionInit(void); extern void BigReqExtensionInit(void); -#ifdef XFIXES extern _X_EXPORT Bool noXFixesExtension; extern void XFixesExtensionInit(void); -#endif extern void XInputExtensionInit(void); extern _X_EXPORT void AssignTypeAndName(DeviceIntPtr dev, diff --git a/xorg-server/include/list.h b/xorg-server/include/list.h index 3ed11ea02..7bf3cc5f4 100644 --- a/xorg-server/include/list.h +++ b/xorg-server/include/list.h @@ -213,7 +213,7 @@ xorg_list_del(struct xorg_list *entry) * * @return True if the list contains one or more elements or False otherwise. */ -static inline Bool +static inline int xorg_list_is_empty(struct xorg_list *head) { return head->next == head; diff --git a/xorg-server/include/privates.h b/xorg-server/include/privates.h index 2c8864b8a..0abdce784 100644 --- a/xorg-server/include/privates.h +++ b/xorg-server/include/privates.h @@ -46,7 +46,6 @@ typedef enum { PRIVATE_CURSOR_BITS, /* extension privates */ - PRIVATE_DBE_WINDOW, PRIVATE_DAMAGE, PRIVATE_GLYPH, PRIVATE_GLYPHSET, diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c index b1ceaa4dc..7e916209f 100644 --- a/xorg-server/mi/miinitext.c +++ b/xorg-server/mi/miinitext.c @@ -86,7 +86,6 @@ SOFTWARE. #undef DBE #undef SCREENSAVER #undef RANDR -#undef XFIXES #undef DAMAGE #undef COMPOSITE #undef MITSHM @@ -168,9 +167,7 @@ static ExtensionToggle ExtensionToggleList[] = { {"XFree86-VidModeExtension", &noXFree86VidModeExtension}, #endif #endif -#ifdef XFIXES {"XFIXES", &noXFixesExtension}, -#endif #ifdef PANORAMIX {"XINERAMA", &noPanoramiXExtension}, #endif @@ -263,10 +260,8 @@ static const ExtensionModule staticExtensions[] = { */ {PseudoramiXExtensionInit, "PseudoramiX", &noPseudoramiXExtension}, #endif -#ifdef XFIXES /* must be before Render to layer DisplayCursor correctly */ {XFixesExtensionInit, "XFIXES", &noXFixesExtension}, -#endif #ifdef XF86BIGFONT {XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension}, #endif diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c index b8503f450..5d591a1dc 100644 --- a/xorg-server/mi/mipointer.c +++ b/xorg-server/mi/mipointer.c @@ -118,13 +118,6 @@ miPointerInitialize(ScreenPtr pScreen, return FALSE; pScreenPriv->spriteFuncs = spriteFuncs; pScreenPriv->screenFuncs = screenFuncs; - /* - * check for uninitialized methods - */ - if (!screenFuncs->EnqueueEvent) - screenFuncs->EnqueueEvent = mieqEnqueue; - if (!screenFuncs->NewEventScreen) - screenFuncs->NewEventScreen = mieqSwitchScreen; pScreenPriv->waitForUpdate = waitForUpdate; pScreenPriv->showTransparent = FALSE; pScreenPriv->CloseScreen = pScreen->CloseScreen; @@ -363,7 +356,7 @@ miPointerWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) pPointer = MIPOINTER(pDev); if (pPointer->pScreen != pScreen) { - (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, TRUE); + mieqSwitchScreen(pDev, pScreen, TRUE); changedScreen = TRUE; } @@ -480,7 +473,7 @@ miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y) pScreen = screenInfo.screens[screen_no]; pScreenPriv = GetScreenPrivate(pScreen); - (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, FALSE); + mieqSwitchScreen(pDev, pScreen, FALSE); NewCurrentScreen(pDev, pScreen, x, y); pPointer->limits.x2 = pScreen->width; @@ -488,15 +481,6 @@ miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y) } /** - * @return The current screen of the VCP - */ -ScreenPtr -miPointerCurrentScreen(void) -{ - return miPointerGetScreen(inputInfo.pointer); -} - -/** * @return The current screen of the given device or NULL. */ ScreenPtr @@ -617,8 +601,7 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y); if (newScreen != pScreen) { pScreen = newScreen; - (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, - FALSE); + mieqSwitchScreen(pDev, pScreen, FALSE); /* Smash the confine to the new screen */ pPointer->limits.x2 = pScreen->width; pPointer->limits.y2 = pScreen->height; diff --git a/xorg-server/mi/mipointer.h b/xorg-server/mi/mipointer.h index f89dff31e..bdeed1242 100644 --- a/xorg-server/mi/mipointer.h +++ b/xorg-server/mi/mipointer.h @@ -71,13 +71,6 @@ typedef struct _miPointerScreenFuncRec { int /* x */ , int /* y */ ); - void (*EnqueueEvent) (DeviceIntPtr /* pDev */ , - InternalEvent * /* event */ - ); - void (*NewEventScreen) (DeviceIntPtr /* pDev */ , - ScreenPtr /* pScr */ , - Bool /* set_dequeue_screen */ - ); } miPointerScreenFuncRec, *miPointerScreenFuncPtr; extern _X_EXPORT Bool miDCInitialize(ScreenPtr /*pScreen */ , @@ -98,11 +91,6 @@ extern _X_EXPORT void miPointerWarpCursor(DeviceIntPtr /*pDev */ , int /*y */ ); -/* Deprecated in favour of miPointerGetScreen. */ -extern _X_EXPORT ScreenPtr -miPointerCurrentScreen(void -) _X_DEPRECATED; - extern _X_EXPORT ScreenPtr miPointerGetScreen(DeviceIntPtr pDev); extern _X_EXPORT void diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c index 3ef25e75f..bbd097b4f 100644 --- a/xorg-server/mi/misprite.c +++ b/xorg-server/mi/misprite.c @@ -86,10 +86,6 @@ typedef struct { /* os layer procedures */ ScreenBlockHandlerProcPtr BlockHandler; - /* device cursor procedures */ - DeviceCursorInitializeProcPtr DeviceCursorInitialize; - DeviceCursorCleanupProcPtr DeviceCursorCleanup; - xColorItem colors[2]; ColormapPtr pInstalledMap; ColormapPtr pColormap; @@ -150,8 +146,7 @@ static void miSpriteDisableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv) { if (pScreenPriv->damageRegistered) { - DamageUnregister(&(pScreen->GetScreenPixmap(pScreen)->drawable), - pScreenPriv->pDamage); + DamageUnregister(pScreenPriv->pDamage); pScreenPriv->damageRegistered = 0; } } @@ -329,9 +324,6 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) pScreenPriv->BlockHandler = NULL; - pScreenPriv->DeviceCursorInitialize = pScreen->DeviceCursorInitialize; - pScreenPriv->DeviceCursorCleanup = pScreen->DeviceCursorCleanup; - pScreenPriv->pInstalledMap = NULL; pScreenPriv->pColormap = NULL; pScreenPriv->colors[SOURCE_COLOR].red = 0; diff --git a/xorg-server/mi/miwideline.c b/xorg-server/mi/miwideline.c index 242f3f8b0..ff64ab5d4 100644 --- a/xorg-server/mi/miwideline.c +++ b/xorg-server/mi/miwideline.c @@ -998,7 +998,7 @@ miLineProjectingCap(DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel, { int xorgi = 0, yorgi = 0; int lw; - PolyEdgeRec lefts[2], rights[2]; + PolyEdgeRec lefts[4], rights[4]; int lefty, righty, topy, bottomy; PolyEdgePtr left, right; PolyEdgePtr top, bottom; @@ -1170,7 +1170,7 @@ miWideSegment(DrawablePtr pDrawable, PolyEdgePtr top, bottom; int lefty, righty, topy, bottomy; int signdx; - PolyEdgeRec lefts[2], rights[2]; + PolyEdgeRec lefts[4], rights[4]; LineFacePtr tface; int lw = pGC->lineWidth; @@ -1524,7 +1524,7 @@ miWideDashSegment(DrawablePtr pDrawable, PolyVertexRec vertices[4]; PolyVertexRec saveRight, saveBottom; PolySlopeRec slopes[4]; - PolyEdgeRec left[2], right[2]; + PolyEdgeRec left[4], right[4]; LineFaceRec lcapFace, rcapFace; int nleft, nright; int h; diff --git a/xorg-server/miext/damage/damage.c b/xorg-server/miext/damage/damage.c index 70e1807cd..bcbce68d1 100644 --- a/xorg-server/miext/damage/damage.c +++ b/xorg-server/miext/damage/damage.c @@ -119,51 +119,6 @@ getDrawableDamageRef(DrawablePtr pDrawable) DamagePtr *pPrev = (DamagePtr *) \ dixLookupPrivateAddr(&(pWindow)->devPrivates, damageWinPrivateKey) -static void -damageReportDamagePostRendering(DamagePtr pDamage, RegionPtr pOldDamage, - RegionPtr pDamageRegion) -{ - BoxRec tmpBox; - RegionRec tmpRegion, newDamage; - Bool was_empty; - - RegionUnion(&newDamage, pOldDamage, pDamageRegion); - - switch (pDamage->damageLevel) { - case DamageReportRawRegion: - (*pDamage->damageReportPostRendering) (pDamage, pDamageRegion, - pDamage->closure); - break; - case DamageReportDeltaRegion: - RegionNull(&tmpRegion); - RegionSubtract(&tmpRegion, pDamageRegion, pOldDamage); - if (RegionNotEmpty(&tmpRegion)) { - (*pDamage->damageReportPostRendering) (pDamage, &tmpRegion, - pDamage->closure); - } - RegionUninit(&tmpRegion); - break; - case DamageReportBoundingBox: - tmpBox = *RegionExtents(pOldDamage); - if (!BOX_SAME(&tmpBox, RegionExtents(&newDamage))) { - (*pDamage->damageReportPostRendering) (pDamage, &newDamage, - pDamage->closure); - } - break; - case DamageReportNonEmpty: - was_empty = !RegionNotEmpty(pOldDamage); - if (was_empty && RegionNotEmpty(&newDamage)) { - (*pDamage->damageReportPostRendering) (pDamage, &newDamage, - pDamage->closure); - } - break; - case DamageReportNone: - break; - } - - RegionUninit(&newDamage); -} - #if DAMAGE_DEBUG_ENABLE static void _damageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, @@ -299,14 +254,10 @@ damageRegionAppend(DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, RegionTranslate(pDamageRegion, -draw_x, -draw_y); /* Store damage region if needed after submission. */ - if (pDamage->reportAfter || pDamage->damageMarker) + if (pDamage->reportAfter) RegionUnion(&pDamage->pendingDamage, &pDamage->pendingDamage, pDamageRegion); - /* Duplicate current damage if needed. */ - if (pDamage->damageMarker) - RegionCopy(&pDamage->backupDamage, &pDamage->damage); - /* Report damage now, if desired. */ if (!pDamage->reportAfter) { if (pDamage->damageReport) @@ -335,12 +286,6 @@ damageRegionProcessPending(DrawablePtr pDrawable) drawableDamage(pDrawable); for (; pDamage != NULL; pDamage = pDamage->pNext) { - /* submit damage marker whenever possible. */ - if (pDamage->damageMarker) - (*pDamage->damageMarker) (pDrawable, pDamage, - &pDamage->backupDamage, - &pDamage->pendingDamage, - pDamage->closure); if (pDamage->reportAfter) { /* It's possible that there is only interest in postRendering reporting. */ if (pDamage->damageReport) @@ -350,10 +295,8 @@ damageRegionProcessPending(DrawablePtr pDrawable) &pDamage->pendingDamage); } - if (pDamage->reportAfter || pDamage->damageMarker) + if (pDamage->reportAfter) RegionEmpty(&pDamage->pendingDamage); - if (pDamage->damageMarker) - RegionEmpty(&pDamage->backupDamage); } } @@ -1336,7 +1279,7 @@ damageDamageChars(DrawablePtr pDrawable, #define TT_POLY16 2 #define TT_IMAGE16 3 -static int +static void damageText(DrawablePtr pDrawable, GCPtr pGC, int x, @@ -1345,39 +1288,29 @@ damageText(DrawablePtr pDrawable, char *chars, FontEncoding fontEncoding, Bool textType) { CharInfoPtr *charinfo; - CharInfoPtr *info; unsigned long i; unsigned int n; - int w; Bool imageblt; imageblt = (textType == TT_IMAGE8) || (textType == TT_IMAGE16); + if (!checkGCDamage(pDrawable, pGC)) + return; + charinfo = malloc(count * sizeof(CharInfoPtr)); if (!charinfo) - return x; + return; GetGlyphs(pGC->font, count, (unsigned char *) chars, fontEncoding, &i, charinfo); n = (unsigned int) i; - w = 0; - if (!imageblt) - for (info = charinfo; i--; info++) - w += (*info)->metrics.characterWidth; if (n != 0) { damageDamageChars(pDrawable, pGC->font, x + pDrawable->x, y + pDrawable->y, n, charinfo, imageblt, pGC->subWindowMode); - if (imageblt) - (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, n, charinfo, - FONTGLYPHS(pGC->font)); - else - (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, n, charinfo, - FONTGLYPHS(pGC->font)); } free(charinfo); - return x + w; } static int @@ -1385,12 +1318,9 @@ damagePolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); - - if (checkGCDamage(pDrawable, pGC)) - x = damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, - Linear8Bit, TT_POLY8); - else - x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); + damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, + TT_POLY8); + x = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); damageRegionProcessPending(pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; @@ -1401,14 +1331,10 @@ damagePolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); - - if (checkGCDamage(pDrawable, pGC)) - x = damageText(pDrawable, pGC, x, y, (unsigned long) count, - (char *) chars, - FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, - TT_POLY16); - else - x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); + damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, + FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, + TT_POLY16); + x = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); damageRegionProcessPending(pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); return x; @@ -1419,12 +1345,9 @@ damageImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); - - if (checkGCDamage(pDrawable, pGC)) - damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, - Linear8Bit, TT_IMAGE8); - else - (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); + damageText(pDrawable, pGC, x, y, (unsigned long) count, chars, Linear8Bit, + TT_IMAGE8); + (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); damageRegionProcessPending(pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1434,13 +1357,10 @@ damageImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars) { DAMAGE_GC_OP_PROLOGUE(pGC, pDrawable); - - if (checkGCDamage(pDrawable, pGC)) - damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, - FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, - TT_IMAGE16); - else - (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); + damageText(pDrawable, pGC, x, y, (unsigned long) count, (char *) chars, + FONTLASTROW(pGC->font) == 0 ? Linear16Bit : TwoD16Bit, + TT_IMAGE16); + (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); damageRegionProcessPending(pDrawable); DAMAGE_GC_OP_EPILOGUE(pGC, pDrawable); } @@ -1637,7 +1557,6 @@ damageDestroyWindow(WindowPtr pWindow) damageScrPriv(pScreen); while ((pDamage = damageGetWinPriv(pWindow))) { - DamageUnregister(&pWindow->drawable, pDamage); DamageDestroy(pDamage); } unwrap(pScrPriv, pScreen, DestroyWindow); @@ -1786,9 +1705,7 @@ DamageCreate(DamageReportFunc damageReport, pDamage->reportAfter = FALSE; pDamage->damageReport = damageReport; - pDamage->damageReportPostRendering = NULL; pDamage->damageDestroy = damageDestroy; - pDamage->damageMarker = NULL; pDamage->pScreen = pScreen; (*pScrPriv->funcs.Create) (pDamage); @@ -1844,8 +1761,9 @@ DamageDrawInternal(ScreenPtr pScreen, Bool enable) } void -DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage) +DamageUnregister(DamagePtr pDamage) { + DrawablePtr pDrawable = pDamage->pDrawable; ScreenPtr pScreen = pDrawable->pScreen; damageScrPriv(pScreen); @@ -1888,6 +1806,9 @@ DamageDestroy(DamagePtr pDamage) damageScrPriv(pScreen); + if (pDamage->pDrawable) + DamageUnregister(pDamage); + if (pDamage->damageDestroy) (*pDamage->damageDestroy) (pDamage, pDamage->closure); (*pScrPriv->funcs.Destroy) (pDamage); @@ -1956,17 +1877,6 @@ DamageRegionProcessPending(DrawablePtr pDrawable) damageRegionProcessPending(pDrawable); } -/* If a damage marker is provided, then this function must be called after rendering is done. */ -/* Please do call back so any future enhancements can assume this function is called. */ -/* There are no strict timing requirements for calling this function, just as soon as (is cheaply) possible. */ -void -DamageRegionRendered(DrawablePtr pDrawable, DamagePtr pDamage, - RegionPtr pOldDamage, RegionPtr pRegion) -{ - if (pDamage->damageReportPostRendering) - damageReportDamagePostRendering(pDamage, pOldDamage, pRegion); -} - /* This call is very odd, i'm leaving it intact for API sake, but please don't use it. */ void DamageDamageRegion(DrawablePtr pDrawable, const RegionPtr pRegion) @@ -1986,15 +1896,6 @@ DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter) pDamage->reportAfter = reportAfter; } -void -DamageSetPostRenderingFunctions(DamagePtr pDamage, - DamageReportFunc damageReportPostRendering, - DamageMarkerFunc damageMarker) -{ - pDamage->damageReportPostRendering = damageReportPostRendering; - pDamage->damageMarker = damageMarker; -} - DamageScreenFuncsPtr DamageGetScreenFuncs(ScreenPtr pScreen) { diff --git a/xorg-server/miext/damage/damage.h b/xorg-server/miext/damage/damage.h index c2c313a15..525b2db5d 100644 --- a/xorg-server/miext/damage/damage.h +++ b/xorg-server/miext/damage/damage.h @@ -41,12 +41,6 @@ typedef void (*DamageReportFunc) (DamagePtr pDamage, RegionPtr pRegion, void *closure); typedef void (*DamageDestroyFunc) (DamagePtr pDamage, void *closure); -/* It's the responsibility of the driver to duplicate both regions. */ -/* At some point DamageRegionRendered() must be called. */ -typedef void (*DamageMarkerFunc) (DrawablePtr pDrawable, DamagePtr pDamage, - RegionPtr pOldDamage, RegionPtr pRegion, - void *closure); - typedef void (*DamageScreenCreateFunc) (DamagePtr); typedef void (*DamageScreenRegisterFunc) (DrawablePtr, DamagePtr); typedef void (*DamageScreenUnregisterFunc) (DrawablePtr, DamagePtr); @@ -80,7 +74,7 @@ extern _X_EXPORT void DamageRegister(DrawablePtr pDrawable, DamagePtr pDamage); extern _X_EXPORT void - DamageUnregister(DrawablePtr pDrawable, DamagePtr pDamage); + DamageUnregister(DamagePtr pDamage); extern _X_EXPORT void DamageDestroy(DamagePtr pDamage); @@ -105,12 +99,6 @@ extern _X_EXPORT void extern _X_EXPORT void DamageRegionProcessPending(DrawablePtr pDrawable); -/* Call this some time after rendering is done, only relevant when a damageMarker is provided. */ -extern _X_EXPORT void - -DamageRegionRendered(DrawablePtr pDrawable, DamagePtr pDamage, - RegionPtr pOldDamage, RegionPtr pRegion); - /* Call this when you create a new Damage and you wish to send an initial damage message (to it). */ extern _X_EXPORT void DamageReportDamage(DamagePtr pDamage, RegionPtr pDamageRegion); @@ -122,12 +110,6 @@ extern _X_EXPORT void extern _X_EXPORT void DamageSetReportAfterOp(DamagePtr pDamage, Bool reportAfter); -extern _X_EXPORT void - -DamageSetPostRenderingFunctions(DamagePtr pDamage, - DamageReportFunc damageReportPostRendering, - DamageMarkerFunc damageMarker); - extern _X_EXPORT DamageScreenFuncsPtr DamageGetScreenFuncs(ScreenPtr); #endif /* _DAMAGE_H_ */ diff --git a/xorg-server/miext/damage/damagestr.h b/xorg-server/miext/damage/damagestr.h index 89189905e..36753ee20 100644 --- a/xorg-server/miext/damage/damagestr.h +++ b/xorg-server/miext/damage/damagestr.h @@ -44,13 +44,10 @@ typedef struct _damage { DrawablePtr pDrawable; DamageReportFunc damageReport; - DamageReportFunc damageReportPostRendering; DamageDestroyFunc damageDestroy; - DamageMarkerFunc damageMarker; Bool reportAfter; RegionRec pendingDamage; /* will be flushed post submission at the latest */ - RegionRec backupDamage; /* for use with damageMarker */ ScreenPtr pScreen; PrivateRec *devPrivates; } DamageRec; diff --git a/xorg-server/miext/shadow/Makefile.am b/xorg-server/miext/shadow/Makefile.am index 1db8a26b4..27cf41422 100644 --- a/xorg-server/miext/shadow/Makefile.am +++ b/xorg-server/miext/shadow/Makefile.am @@ -7,6 +7,7 @@ sdk_HEADERS = shadow.h endif libshadow_la_SOURCES = \ + c2p_core.h \ shadow.c \ shadow.h \ shafb4.c \ diff --git a/xorg-server/miext/shadow/shadow.c b/xorg-server/miext/shadow/shadow.c index 2d869e54b..1a9088c43 100644 --- a/xorg-server/miext/shadow/shadow.c +++ b/xorg-server/miext/shadow/shadow.c @@ -219,7 +219,7 @@ shadowRemove(ScreenPtr pScreen, PixmapPtr pPixmap) shadowBuf(pScreen); if (pBuf->pPixmap) { - DamageUnregister(&pBuf->pPixmap->drawable, pBuf->pDamage); + DamageUnregister(pBuf->pDamage); pBuf->update = 0; pBuf->window = 0; pBuf->randr = 0; diff --git a/xorg-server/miext/sync/misync.c b/xorg-server/miext/sync/misync.c index d24921a18..b6914d18d 100644 --- a/xorg-server/miext/sync/misync.c +++ b/xorg-server/miext/sync/misync.c @@ -182,20 +182,21 @@ miSyncSetup(ScreenPtr pScreen) &miSyncScreenDestroyFence }; - if (dixPrivateKeyRegistered(syncScreenPrivateKey)) - return TRUE; - - if (!dixRegisterPrivateKey(syncScreenPrivateKey, PRIVATE_SCREEN, - sizeof(SyncScreenPrivRec))) - return FALSE; + if (!dixPrivateKeyRegistered(syncScreenPrivateKey)) { + if (!dixRegisterPrivateKey(syncScreenPrivateKey, PRIVATE_SCREEN, + sizeof(SyncScreenPrivRec))) + return FALSE; + } pScreenPriv = SYNC_SCREEN_PRIV(pScreen); - pScreenPriv->funcs = miSyncScreenFuncs; + if (pScreenPriv->funcs.CreateFence) { + pScreenPriv->funcs = miSyncScreenFuncs; - /* Wrap CloseScreen to clean up */ - pScreenPriv->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = SyncCloseScreen; + /* Wrap CloseScreen to clean up */ + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = SyncCloseScreen; + } return TRUE; } diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c index d3e7da599..c8e15cfea 100644 --- a/xorg-server/os/access.c +++ b/xorg-server/os/access.c @@ -163,6 +163,10 @@ SOFTWARE. /* #endif */ #endif +#if defined(IPv6) && defined(AF_INET6) +#include <arpa/inet.h> +#endif + #endif /* WIN32 */ #define X_INCLUDE_NETDB_H @@ -631,10 +635,6 @@ CarryOnTheOldWay: #endif #if defined(IPv6) && defined(AF_INET6) -#include <arpa/inet.h> -#endif - -#if defined(IPv6) && defined(AF_INET6) static void in6_fillscopeid(struct sockaddr_in6 *sin6) { diff --git a/xorg-server/os/io.c b/xorg-server/os/io.c index 39c7bf160..2c8b05a76 100644 --- a/xorg-server/os/io.c +++ b/xorg-server/os/io.c @@ -206,27 +206,17 @@ YieldControlDeath(void) timesThisConnection = 0; } -int -ReadRequestFromClient(ClientPtr client) +/* If an input buffer was empty, either free it if it is too big or link it + * into our list of free input buffers. This means that different clients can + * share the same input buffer (at different times). This was done to save + * memory. + */ +static void +NextAvailableInput(OsCommPtr oc) { - OsCommPtr oc = (OsCommPtr) client->osPrivate; - ConnectionInputPtr oci = oc->input; - int fd = oc->fd; - unsigned int gotnow, needed; - int result; - register xReq *request; - Bool need_header; - Bool move_header; - - /* If an input buffer was empty, either free it if it is too big - * or link it into our list of free input buffers. This means that - * different clients can share the same input buffer (at different - * times). This was done to save memory. - */ - if (AvailableInput) { if (AvailableInput != oc) { - register ConnectionInputPtr aci = AvailableInput->input; + ConnectionInputPtr aci = AvailableInput->input; if (aci->size > BUFWATERMARK) { free(aci->buffer); @@ -236,10 +226,25 @@ ReadRequestFromClient(ClientPtr client) aci->next = FreeInputs; FreeInputs = aci; } - AvailableInput->input = (ConnectionInputPtr) NULL; + AvailableInput->input = NULL; } - AvailableInput = (OsCommPtr) NULL; + AvailableInput = NULL; } +} + +int +ReadRequestFromClient(ClientPtr client) +{ + OsCommPtr oc = (OsCommPtr) client->osPrivate; + ConnectionInputPtr oci = oc->input; + int fd = oc->fd; + unsigned int gotnow, needed; + int result; + register xReq *request; + Bool need_header; + Bool move_header; + + NextAvailableInput(oc); /* make sure we have an input buffer */ @@ -494,22 +499,8 @@ InsertFakeRequest(ClientPtr client, char *data, int count) int fd = oc->fd; int gotnow, moveup; - if (AvailableInput) { - if (AvailableInput != oc) { - ConnectionInputPtr aci = AvailableInput->input; + NextAvailableInput(oc); - if (aci->size > BUFWATERMARK) { - free(aci->buffer); - free(aci); - } - else { - aci->next = FreeInputs; - FreeInputs = aci; - } - AvailableInput->input = (ConnectionInputPtr) NULL; - } - AvailableInput = (OsCommPtr) NULL; - } if (!oci) { if ((oci = FreeInputs)) FreeInputs = oci->next; @@ -814,7 +805,7 @@ WriteToClient(ClientPtr who, int count, const void *__buf) } } #endif - if (oco->count + count + padBytes > oco->size) { + if (oco->count == 0 || oco->count + count + padBytes > oco->size) { FD_CLR(oc->fd, &OutputPending); if (!XFD_ANYSET(&OutputPending)) { CriticalOutputPending = FALSE; diff --git a/xorg-server/os/utils.c b/xorg-server/os/utils.c index 750bd8dfb..ddd3c0c7d 100644 --- a/xorg-server/os/utils.c +++ b/xorg-server/os/utils.c @@ -172,9 +172,7 @@ Bool noXFree86DRIExtension = FALSE; #ifdef XF86VIDMODE Bool noXFree86VidModeExtension = FALSE; #endif -#ifdef XFIXES Bool noXFixesExtension = FALSE; -#endif #ifdef PANORAMIX /* Xinerama is disabled by default unless enabled via +xinerama */ Bool noPanoramiXExtension = TRUE; diff --git a/xorg-server/randr/rrpointer.c b/xorg-server/randr/rrpointer.c index ec803e9d1..eb6b6770c 100644 --- a/xorg-server/randr/rrpointer.c +++ b/xorg-server/randr/rrpointer.c @@ -82,7 +82,7 @@ RRPointerToNearestCrtc(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, else dx = 0; if (y < crtc->y) - dy = crtc->y - x; + dy = crtc->y - y; else if (y > crtc->y + scan_height) dy = y - (crtc->y + scan_height); else diff --git a/xorg-server/test/.gitignore b/xorg-server/test/.gitignore index 363d4b683..acbda7a57 100644 --- a/xorg-server/test/.gitignore +++ b/xorg-server/test/.gitignore @@ -3,6 +3,7 @@ hashtabletest input list misc +os string touch xfree86 diff --git a/xorg-server/xkeyboard-config/NEWS b/xorg-server/xkeyboard-config/NEWS index 03ffac45a..c0db1c6d5 100644 --- a/xorg-server/xkeyboard-config/NEWS +++ b/xorg-server/xkeyboard-config/NEWS @@ -1,3 +1,4 @@ +2.10.1 Critical fix 2.10 10+ bugs fixed 37 cleanup commits by Benno Schulenberg Updated 12 translations diff --git a/xorg-server/xkeyboard-config/configure.ac b/xorg-server/xkeyboard-config/configure.ac index 12b6440fe..51f070c68 100644 --- a/xorg-server/xkeyboard-config/configure.ac +++ b/xorg-server/xkeyboard-config/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(xkeyboard-config, 2.10) +AC_INIT(xkeyboard-config, 2.10.1) AC_CONFIG_SRCDIR(rules/base.xml.in) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE |