summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-08-21 00:50:05 +0100
committerThomas White <taw@bitwiz.org.uk>2009-08-21 00:50:05 +0100
commita7c514dad30ab7fe7d684ed1e8ccb6df100edc1c (patch)
tree4cc084dde2ef0e55c3ff727a58c2bb3e5e35708e
parentedc1fcddb57fad07e1ed212424378247e0d2a0a2 (diff)
Handle the new DRI protocol as well
-rw-r--r--src/glamo-dri2.c43
1 files 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;