From a7c514dad30ab7fe7d684ed1e8ccb6df100edc1c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 21 Aug 2009 00:50:05 +0100 Subject: Handle the new DRI protocol as well --- src/glamo-dri2.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/glamo-dri2.c b/src/glamo-dri2.c index 4186bfa..ae62ef4 100644 --- a/src/glamo-dri2.c +++ b/src/glamo-dri2.c @@ -57,8 +57,20 @@ typedef struct { } GlamoDRI2BufferPrivateRec, *GlamoDRI2BufferPrivatePtr; -static DRI2BufferPtr glamoCreateBuffers(DrawablePtr pDraw, - unsigned int *attachments, int count) +#ifdef USE_DRI2_1_1_0 + +static DRI2BufferPtr glamoCreateBuffer(DrawablePtr pDraw, + unsigned int attachment, + unsigned int format) +{ + DRI2BufferPtr buffer; + return buffer; +} + +#else + +static DRI2BufferPtr glamoCreateBuffer(DrawablePtr pDraw, + unsigned int *attachments, int count) { ScreenPtr pScreen = pDraw->pScreen; DRI2BufferPtr buffers; @@ -115,6 +127,26 @@ static DRI2BufferPtr glamoCreateBuffers(DrawablePtr pDraw, return buffers; } +#endif + +#ifdef USE_DRI2_1_1_0 + +static void glamoDestroyBuffer(DrawablePtr pDraw, + DRI2BufferPtr buffer) +{ + ScreenPtr pScreen = pDraw->pScreen; + int i; + GlamoDRI2BufferPrivatePtr private; + + private = buffer.driverPrivate; + (*pScreen->DestroyPixmap)(private->pPixmap); + + if ( buffer ) { + xfree(buffer.driverPrivate); + } +} + +#else static void glamoDestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count) @@ -134,6 +166,8 @@ static void glamoDestroyBuffers(DrawablePtr pDraw, } } +#endif + static void glamoCopyRegion(DrawablePtr pDraw, RegionPtr pRegion, DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer) @@ -171,8 +205,13 @@ void driScreenInit(ScreenPtr pScreen) dri2info.deviceName = p; dri2info.driverName = "glamo"; +#ifdef USE_DRI2_1_1_0 + dri2info.CreateBuffer = glamoCreateBuffer; + dri2info.DestroyBuffer = glamoDestroyBuffer; +#else dri2info.CreateBuffers = glamoCreateBuffers; dri2info.DestroyBuffers = glamoDestroyBuffers; +#endif dri2info.CopyRegion = glamoCopyRegion; if ( !DRI2ScreenInit(pScreen, &dri2info) ) return; -- cgit v1.2.3