File U_dri2_add_DRI2CreateDrawable2.patch of Package xorg-x11-server

From 8a87acc9e57be740e3bd252567622246051a0723 Mon Sep 17 00:00:00 2001
From: Michel Dänzer <michel.daenzer@amd.com>
Date: Thu, 12 Jul 2012 11:16:36 +0000
Subject: dri2: Add DRI2CreateDrawable2.

Same as DRI2CreateDrawable, except it can return the DRI2 specific XID of the
DRI2 drawable reference to the base drawable.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
---
Index: xorg-server-1.12.3/hw/xfree86/dri2/dri2.c
===================================================================
--- xorg-server-1.12.3.orig/hw/xfree86/dri2/dri2.c
+++ xorg-server-1.12.3/hw/xfree86/dri2/dri2.c
@@ -280,8 +280,9 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv
 }
 
 int
-DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
-                   DRI2InvalidateProcPtr invalidate, void *priv)
+DRI2CreateDrawable2(ClientPtr client, DrawablePtr pDraw, XID id,
+                    DRI2InvalidateProcPtr invalidate, void *priv,
+                    XID *dri2_id_out)
 {
     DRI2DrawablePtr pPriv;
     XID dri2_id;
@@ -298,9 +299,19 @@ DRI2CreateDrawable(ClientPtr client, Dra
     if (rc != Success)
         return rc;
 
+    if (dri2_id_out)
+        *dri2_id_out = dri2_id;
+
     return Success;
 }
 
+int
+DRI2CreateDrawable(ClientPtr client, DrawablePtr pDraw, XID id,
+                   DRI2InvalidateProcPtr invalidate, void *priv)
+{
+    return DRI2CreateDrawable2(client, pDraw, id, invalidate, priv, NULL);
+}
+
 static int
 DRI2DrawableGone(pointer p, XID id)
 {
Index: xorg-server-1.12.3/hw/xfree86/dri2/dri2.h
===================================================================
--- xorg-server-1.12.3.orig/hw/xfree86/dri2/dri2.h
+++ xorg-server-1.12.3/hw/xfree86/dri2/dri2.h
@@ -237,6 +237,13 @@ extern _X_EXPORT int DRI2CreateDrawable(
 
 extern _X_EXPORT void DRI2DestroyDrawable(DrawablePtr pDraw);
 
+extern _X_EXPORT int DRI2CreateDrawable2(ClientPtr client,
+                                         DrawablePtr pDraw,
+                                         XID id,
+                                         DRI2InvalidateProcPtr invalidate,
+                                         void *priv,
+                                         XID *dri2_id_out);
+
 extern _X_EXPORT DRI2BufferPtr *DRI2GetBuffers(DrawablePtr pDraw,
                                                int *width,
                                                int *height,