diff options
author | marha <marha@users.sourceforge.net> | 2011-09-22 15:42:49 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-22 15:42:49 +0200 |
commit | 46d4f558531910ca1f3297da85b99334d6de2921 (patch) | |
tree | 60c37077eb160948fe317a17ec4c19bef679aa35 /xorg-server/hw/xfree86/dri2 | |
parent | 0bf6df93b9fdbb7902bf1014d605c6876a3ad035 (diff) | |
parent | c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (diff) | |
download | vcxsrv-46d4f558531910ca1f3297da85b99334d6de2921.tar.gz vcxsrv-46d4f558531910ca1f3297da85b99334d6de2921.tar.bz2 vcxsrv-46d4f558531910ca1f3297da85b99334d6de2921.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/Xext/dpms.c
xorg-server/Xext/saver.c
xorg-server/Xext/security.c
xorg-server/Xext/shape.c
xorg-server/Xext/sync.c
xorg-server/Xi/opendev.c
xorg-server/fb/wfbrename.h
xorg-server/glx/glxserver.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/mi/miarc.c
xorg-server/mi/miwideline.c
xorg-server/os/io.c
xorg-server/render/mipict.c
Diffstat (limited to 'xorg-server/hw/xfree86/dri2')
-rw-r--r-- | xorg-server/hw/xfree86/dri2/dri2.c | 41 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/dri2/dri2.h | 31 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/dri2/dri2ext.c | 16 |
3 files changed, 78 insertions, 10 deletions
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c index af3bcaefe..a97508d21 100644 --- a/xorg-server/hw/xfree86/dri2/dri2.c +++ b/xorg-server/hw/xfree86/dri2/dri2.c @@ -102,6 +102,8 @@ typedef struct _DRI2Screen { DRI2GetMSCProcPtr GetMSC; DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; DRI2AuthMagicProcPtr AuthMagic; + DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; + DRI2SwapLimitValidateProcPtr SwapLimitValidate; HandleExposuresProcPtr HandleExposures; @@ -191,6 +193,36 @@ DRI2AllocateDrawable(DrawablePtr pDraw) return pPriv; } +Bool +DRI2SwapLimit(DrawablePtr pDraw, int swap_limit) +{ + DRI2DrawablePtr pPriv = DRI2GetDrawable(pDraw); + DRI2ScreenPtr ds; + if (!pPriv) + return FALSE; + + ds = pPriv->dri2_screen; + + if (!ds->SwapLimitValidate + || !ds->SwapLimitValidate(pDraw, swap_limit)) + return FALSE; + + pPriv->swap_limit = swap_limit; + + /* Check throttling */ + if (pPriv->swapsPending >= pPriv->swap_limit) + return TRUE; + + if (pPriv->target_sbc == -1 && !pPriv->blockedOnMsc) { + if (pPriv->blockedClient) { + AttendClient(pPriv->blockedClient); + pPriv->blockedClient = NULL; + } + } + + return TRUE; +} + typedef struct DRI2DrawableRefRec { XID id; XID dri2_id; @@ -352,6 +384,10 @@ allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds, } else { *buffer = pPriv->buffers[old_buf]; + + if (ds->ReuseBufferNotify) + (*ds->ReuseBufferNotify)(pDraw, *buffer); + pPriv->buffers[old_buf] = NULL; return FALSE; } @@ -1128,6 +1164,11 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info) ds->AuthMagic = info->AuthMagic; } + if (info->version >= 6) { + ds->ReuseBufferNotify = info->ReuseBufferNotify; + ds->SwapLimitValidate = info->SwapLimitValidate; + } + /* * if the driver doesn't provide an AuthMagic function or the info struct * version is too low, it relies on the old method (using libdrm) or fail diff --git a/xorg-server/hw/xfree86/dri2/dri2.h b/xorg-server/hw/xfree86/dri2/dri2.h index 2a41ead5b..9c93209d1 100644 --- a/xorg-server/hw/xfree86/dri2/dri2.h +++ b/xorg-server/hw/xfree86/dri2/dri2.h @@ -110,6 +110,16 @@ typedef DRI2BufferPtr (*DRI2CreateBufferProcPtr)(DrawablePtr pDraw, typedef void (*DRI2DestroyBufferProcPtr)(DrawablePtr pDraw, DRI2BufferPtr buffer); /** + * Notifies driver when DRI2GetBuffers reuses a dri2 buffer. + * + * Driver may rename the dri2 buffer in this notify if it is required. + * + * \param pDraw drawable whose count we want + * \param buffer buffer that will be returned to client + */ +typedef void (*DRI2ReuseBufferNotifyProcPtr)(DrawablePtr pDraw, + DRI2BufferPtr buffer); +/** * Get current media stamp counter values * * This callback is used to support the SGI_video_sync and OML_sync_control @@ -159,9 +169,22 @@ typedef void (*DRI2InvalidateProcPtr)(DrawablePtr pDraw, void *data); /** + * DRI2 calls this hook when ever swap_limit is going to be changed. Default + * implementation for the hook only accepts one as swap_limit. If driver can + * support other swap_limits it has to implement supported limits with this + * callback. + * + * \param pDraw drawable whos swap_limit is going to be changed + * \param swap_limit new swap_limit that going to be set + * \return TRUE if limit is support, FALSE if not. + */ +typedef Bool (*DRI2SwapLimitValidateProcPtr)(DrawablePtr pDraw, + int swap_limit); + +/** * Version of the DRI2InfoRec structure defined in this header */ -#define DRI2INFOREC_VERSION 5 +#define DRI2INFOREC_VERSION 6 typedef struct { unsigned int version; /**< Version of this struct */ @@ -189,6 +212,11 @@ typedef struct { /* added in version 5 */ DRI2AuthMagicProcPtr AuthMagic; + + /* added in version 6 */ + + DRI2ReuseBufferNotifyProcPtr ReuseBufferNotify; + DRI2SwapLimitValidateProcPtr SwapLimitValidate; } DRI2InfoRec, *DRI2InfoPtr; extern _X_EXPORT int DRI2EventBase; @@ -251,6 +279,7 @@ extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffersWithFormat(DrawablePtr pDraw, int *out_count); extern _X_EXPORT void DRI2SwapInterval(DrawablePtr pDrawable, int interval); +extern _X_EXPORT Bool DRI2SwapLimit(DrawablePtr pDraw, int swap_limit); extern _X_EXPORT int DRI2SwapBuffers(ClientPtr client, DrawablePtr pDrawable, CARD64 target_msc, CARD64 divisor, CARD64 remainder, CARD64 *swap_target, diff --git a/xorg-server/hw/xfree86/dri2/dri2ext.c b/xorg-server/hw/xfree86/dri2/dri2ext.c index 552b26b7c..934abf6de 100644 --- a/xorg-server/hw/xfree86/dri2/dri2ext.c +++ b/xorg-server/hw/xfree86/dri2/dri2ext.c @@ -71,10 +71,9 @@ ProcDRI2QueryVersion(ClientPtr client) { REQUEST(xDRI2QueryVersionReq); xDRI2QueryVersionReply rep; - int n; if (client->swapped) - swaps(&stuff->length, n); + swaps(&stuff->length); REQUEST_SIZE_MATCH(xDRI2QueryVersionReq); rep.type = X_Reply; @@ -84,10 +83,10 @@ ProcDRI2QueryVersion(ClientPtr client) rep.minorVersion = dri2_minor; if (client->swapped) { - swaps(&rep.sequenceNumber, n); - swapl(&rep.length, n); - swapl(&rep.majorVersion, n); - swapl(&rep.minorVersion, n); + swaps(&rep.sequenceNumber); + swapl(&rep.length); + swapl(&rep.majorVersion); + swapl(&rep.minorVersion); } WriteToClient(client, sizeof(xDRI2QueryVersionReply), &rep); @@ -585,16 +584,15 @@ SProcDRI2Connect(ClientPtr client) { REQUEST(xDRI2ConnectReq); xDRI2ConnectReply rep; - int n; /* If the client is swapped, it's not local. Talk to the hand. */ - swaps(&stuff->length, n); + swaps(&stuff->length); if (sizeof(*stuff) / 4 != client->req_len) return BadLength; rep.sequenceNumber = client->sequence; - swaps(&rep.sequenceNumber, n); + swaps(&rep.sequenceNumber); rep.length = 0; rep.driverNameLength = 0; rep.deviceNameLength = 0; |