summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/xorg-xserver/xserver-xf86-dri-lite/xserver-DRI2Swapbuffer.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/xorg-xserver/xserver-xf86-dri-lite/xserver-DRI2Swapbuffer.patch')
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xf86-dri-lite/xserver-DRI2Swapbuffer.patch179
1 files changed, 0 insertions, 179 deletions
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xf86-dri-lite/xserver-DRI2Swapbuffer.patch b/meta/recipes-graphics/xorg-xserver/xserver-xf86-dri-lite/xserver-DRI2Swapbuffer.patch
deleted file mode 100644
index 2754170d2f..0000000000
--- a/meta/recipes-graphics/xorg-xserver/xserver-xf86-dri-lite/xserver-DRI2Swapbuffer.patch
+++ /dev/null
@@ -1,179 +0,0 @@
1diff --git a/glx/glxdri2.c b/glx/glxdri2.c
2index 146ea82..3b5338b 100644
3--- a/glx/glxdri2.c
4+++ b/glx/glxdri2.c
5@@ -70,6 +70,7 @@ struct __GLXDRIscreen {
6
7 const __DRIcoreExtension *core;
8 const __DRIdri2Extension *dri2;
9+ const __DRI2flushExtension *flush;
10 const __DRIcopySubBufferExtension *copySubBuffer;
11 const __DRIswapControlExtension *swapControl;
12 const __DRItexBufferExtension *texBuffer;
13@@ -135,10 +136,14 @@ __glXDRIdrawableCopySubBuffer(__GLXdrawable *drawable,
14 static GLboolean
15 __glXDRIdrawableSwapBuffers(__GLXdrawable *drawable)
16 {
17- __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable;
18+ __GLXDRIdrawable *priv = (__GLXDRIdrawable *) drawable;
19+ __GLXDRIscreen *screen = priv->screen;
20+
21+ if (!DRI2SwapBuffers(drawable->pDraw))
22+ return FALSE;
23
24- __glXDRIdrawableCopySubBuffer(drawable, 0, 0,
25- private->width, private->height);
26+ if (screen->flush->flushInvalidate)
27+ (*screen->flush->flushInvalidate)(priv->driDrawable);
28
29 return TRUE;
30 }
31diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
32index 580383d..23e6467 100644
33--- a/hw/xfree86/dri2/dri2.c
34+++ b/hw/xfree86/dri2/dri2.c
35@@ -70,6 +70,7 @@ typedef struct _DRI2Screen {
36 DRI2CreateBufferProcPtr CreateBuffer;
37 DRI2DestroyBufferProcPtr DestroyBuffer;
38 DRI2CopyRegionProcPtr CopyRegion;
39+ DRI2SwapBuffersProcPtr SwapBuffers;
40
41 HandleExposuresProcPtr HandleExposures;
42 } DRI2ScreenRec, *DRI2ScreenPtr;
43@@ -422,6 +423,49 @@ DRI2CopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
44 return Success;
45 }
46
47+Bool
48+DRI2SwapBuffers(DrawablePtr pDraw)
49+{
50+ DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
51+ DRI2DrawablePtr pPriv;
52+ DRI2BufferPtr pDestBuffer, pSrcBuffer;
53+ int i;
54+
55+ pPriv = DRI2GetDrawable(pDraw);
56+ if (pPriv == NULL)
57+ return FALSE;
58+
59+ pDestBuffer = NULL;
60+ pSrcBuffer = NULL;
61+ for (i = 0; i < pPriv->bufferCount; i++)
62+ {
63+ if (pPriv->buffers[i]->attachment == DRI2BufferFrontLeft)
64+ pDestBuffer = (DRI2BufferPtr) pPriv->buffers[i];
65+ if (pPriv->buffers[i]->attachment == DRI2BufferBackLeft)
66+ pSrcBuffer = (DRI2BufferPtr) pPriv->buffers[i];
67+ }
68+ if (pSrcBuffer == NULL || pDestBuffer == NULL)
69+ return FALSE;
70+
71+ if (ds->SwapBuffers) {
72+ if ((*ds->SwapBuffers)(pDraw, pDestBuffer, pSrcBuffer))
73+ return TRUE;
74+ }
75+
76+ BoxRec box;
77+ RegionRec region;
78+
79+ box.x1 = 0;
80+ box.y1 = 0;
81+ box.x2 = pDraw->width;
82+ box.y2 = pDraw->height;
83+ REGION_INIT(drawable->pDraw->pScreen, &region, &box, 0);
84+ if (DRI2CopyRegion(pDraw, &region, DRI2BufferFrontLeft, DRI2BufferBackLeft) != Success)
85+ return FALSE;
86+
87+ return TRUE;
88+}
89+
90 void
91 DRI2DestroyDrawable(DrawablePtr pDraw)
92 {
93@@ -538,6 +582,9 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
94 }
95 ds->CopyRegion = info->CopyRegion;
96
97+ if (info->version >= 3)
98+ ds->SwapBuffers = info->SwapBuffers;
99+
100 dixSetPrivate(&pScreen->devPrivates, dri2ScreenPrivateKey, ds);
101
102 xf86DrvMsg(pScreen->myNum, X_INFO, "[DRI2] Setup complete\n");
103diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
104index f369267..e2784dd 100644
105--- a/hw/xfree86/dri2/dri2.h
106+++ b/hw/xfree86/dri2/dri2.h
107@@ -67,6 +67,10 @@ typedef void (*DRI2CopyRegionProcPtr)(DrawablePtr pDraw,
108 DRI2BufferPtr pDestBuffer,
109 DRI2BufferPtr pSrcBuffer);
110
111+typedef Bool (*DRI2SwapBuffersProcPtr)(DrawablePtr pDraw,
112+ DRI2BufferPtr pFrontBuffer,
113+ DRI2BufferPtr pBackBuffer);
114+
115 typedef void (*DRI2WaitProcPtr)(WindowPtr pWin,
116 unsigned int sequence);
117
118@@ -90,6 +94,7 @@ typedef struct {
119 DRI2CreateBuffersProcPtr CreateBuffers;
120 DRI2DestroyBuffersProcPtr DestroyBuffers;
121 DRI2CopyRegionProcPtr CopyRegion;
122+ DRI2SwapBuffersProcPtr SwapBuffers;
123 DRI2WaitProcPtr Wait;
124
125 /**
126@@ -153,4 +158,6 @@ extern _X_EXPORT DRI2Buffer2Ptr *DRI2GetBuffersWithFormat(DrawablePtr pDraw,
127 int *width, int *height, unsigned int *attachments, int count,
128 int *out_count);
129
130+extern _X_EXPORT Bool DRI2SwapBuffers(DrawablePtr pDraw);
131+
132 #endif
133diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
134index 3c06174..67b419b 100644
135--- a/hw/xfree86/dri2/dri2ext.c
136+++ b/hw/xfree86/dri2/dri2ext.c
137@@ -81,7 +81,7 @@ ProcDRI2QueryVersion(ClientPtr client)
138 rep.length = 0;
139 rep.sequenceNumber = client->sequence;
140 rep.majorVersion = 1;
141- rep.minorVersion = 1;
142+ rep.minorVersion = 2;
143
144 if (client->swapped) {
145 swaps(&rep.sequenceNumber, n);
146@@ -323,6 +323,24 @@ ProcDRI2CopyRegion(ClientPtr client)
147 }
148
149 static int
150+ProcDRI2SwapBuffers(ClientPtr client)
151+{
152+ REQUEST(xDRI2SwapBuffersReq);
153+ DrawablePtr pDrawable;
154+ int status;
155+
156+ REQUEST_SIZE_MATCH(xDRI2SwapBuffersReq);
157+
158+ if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
159+ return status;
160+
161+ if (!DRI2SwapBuffers(pDrawable))
162+ return BadAlloc;
163+
164+ return client->noClientException;
165+}
166+
167+static int
168 ProcDRI2Dispatch (ClientPtr client)
169 {
170 REQUEST(xReq);
171@@ -350,6 +368,8 @@ ProcDRI2Dispatch (ClientPtr client)
172 return ProcDRI2CopyRegion(client);
173 case X_DRI2GetBuffersWithFormat:
174 return ProcDRI2GetBuffersWithFormat(client);
175+ case X_DRI2SwapBuffers:
176+ return ProcDRI2SwapBuffers(client);
177 default:
178 return BadRequest;
179 }