[PATCH v2 03/10] dri2: Change driver interface to support DRI2Drawable
Ville Syrjälä
ville.syrjala at nokia.com
Thu Feb 10 07:40:34 PST 2011
On Tue, Feb 08, 2011 at 11:42:49PM +0200, ext Pauli wrote:
> From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
>
> To let DRI2Drawable exists longer than Drawable driver has to use
> DRI2DrawablePtr to complete swaps and MSC waits. This allows DRI2 to
> clean up after all operations complete without accessing the freed
> DrawablePtr.
>
> v2:
> * Refactor interface to allow tracking when client is gone
>
> Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> ---
> hw/xfree86/dri2/dri2.c | 118 +++++++++++++++++++++++++++++------------------
> hw/xfree86/dri2/dri2.h | 41 +++++++++++++++-
> 2 files changed, 111 insertions(+), 48 deletions(-)
>
> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> index 91ae1a0..7e3e0fd 100644
> --- a/hw/xfree86/dri2/dri2.c
> +++ b/hw/xfree86/dri2/dri2.c
> @@ -95,11 +95,11 @@ typedef struct _DRI2Screen {
> unsigned int lastSequence;
>
> DRI2CreateBufferProcPtr CreateBuffer;
> - DRI2DestroyBufferProcPtr DestroyBuffer;
> + DRI2DestroyBuffer2ProcPtr DestroyBuffer;
> DRI2CopyRegionProcPtr CopyRegion;
> DRI2ScheduleSwapProcPtr ScheduleSwap;
> DRI2GetMSCProcPtr GetMSC;
> - DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
> + DRI2ScheduleWaitMSC2ProcPtr ScheduleWaitMSC;
> DRI2AuthMagicProcPtr AuthMagic;
>
> HandleExposuresProcPtr HandleExposures;
> @@ -107,6 +107,11 @@ typedef struct _DRI2Screen {
> ConfigNotifyProcPtr ConfigNotify;
> } DRI2ScreenRec;
>
> +typedef struct _DRI2SwapCompleteDataRec {
> + ClientPtr client;
> + void *data;
> +} DRI2SwapCompleteDataRec, *DRI2SwapCompleteDataPtr;
> +
> static DRI2ScreenPtr
> DRI2GetScreen(ScreenPtr pScreen)
> {
> @@ -137,6 +142,12 @@ DRI2DrawableGetDrawable(DRI2DrawablePtr pPriv)
> return pPriv->drawable;
> }
>
> +ScreenPtr
> +DRI2DrawableGetScreen(DRI2DrawablePtr pPriv)
> +{
> + return pPriv->dri2_screen->screen;
> +}
> +
> static unsigned long
> DRI2DrawableSerial(DrawablePtr pDraw)
> {
> @@ -323,6 +334,7 @@ static int DRI2DrawableGone(pointer p, XID id)
> return Success;
>
> pDraw = pPriv->drawable;
> +
> if (pDraw->type == DRAWABLE_WINDOW) {
> pWin = (WindowPtr) pDraw;
> dixSetPrivate(&pWin->devPrivates, dri2WindowPrivateKey, NULL);
> @@ -333,7 +345,7 @@ static int DRI2DrawableGone(pointer p, XID id)
>
> if (pPriv->buffers != NULL) {
> for (i = 0; i < pPriv->bufferCount; i++)
> - (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
> + (*ds->DestroyBuffer)(pPriv, pPriv->buffers[i]);
>
> free(pPriv->buffers);
> }
> @@ -394,7 +406,7 @@ update_dri2_drawable_buffers(DRI2DrawablePtr pPriv, DrawablePtr pDraw,
> if (pPriv->buffers != NULL) {
> for (i = 0; i < pPriv->bufferCount; i++) {
> if (pPriv->buffers[i] != NULL) {
> - (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
> + (*ds->DestroyBuffer)(pPriv, pPriv->buffers[i]);
> }
> }
>
> @@ -531,7 +543,7 @@ err_out:
>
> for (i = 0; i < count; i++) {
> if (buffers[i] != NULL)
> - (*ds->DestroyBuffer)(pDraw, buffers[i]);
> + (*ds->DestroyBuffer)(pPriv, buffers[i]);
> }
>
> free(buffers);
> @@ -684,14 +696,11 @@ DRI2CanExchange(DrawablePtr pDraw)
> }
>
> void
> -DRI2WaitMSCComplete(ClientPtr client, DrawablePtr pDraw, int frame,
> - unsigned int tv_sec, unsigned int tv_usec)
> +DRI2WaitMSCComplete2(DRI2DrawablePtr pPriv, int frame,
> + unsigned int tv_sec, unsigned int tv_usec,
> + void *data)
> {
> - DRI2DrawablePtr pPriv;
> -
> - pPriv = DRI2GetDrawable(pDraw);
> - if (pPriv == NULL)
> - return;
> + ClientPtr client = data;
Why void* instead of ClientPtr?
--
Ville Syrjälä
More information about the xorg-devel
mailing list