| 1 |
--- ./GL/glx/glxdrawable.h.mesa-copy-sub-buffer 2006-07-06 21:40:41.000000000 -0400
|
| 2 |
+++ ./GL/glx/glxdrawable.h 2006-07-06 21:56:33.000000000 -0400
|
| 3 |
@@ -58,6 +58,8 @@
|
| 4 |
void (*destroy)(__GLXdrawable *private);
|
| 5 |
GLboolean (*resize)(__GLXdrawable *private);
|
| 6 |
GLboolean (*swapBuffers)(__GLXdrawable *);
|
| 7 |
+ void (*copySubBuffer)(__GLXdrawable *drawable,
|
| 8 |
+ int x, int y, int w, int h);
|
| 9 |
|
| 10 |
/*
|
| 11 |
** list of drawable private structs
|
| 12 |
--- ./GL/glx/glxcmds.c.mesa-copy-sub-buffer 2006-07-06 21:40:41.000000000 -0400
|
| 13 |
+++ ./GL/glx/glxcmds.c 2006-07-06 22:30:01.000000000 -0400
|
| 14 |
@@ -1331,21 +1331,14 @@
|
| 15 |
|
| 16 |
/*****************************************************************************/
|
| 17 |
|
| 18 |
-/*
|
| 19 |
-** NOTE: There is no portable implementation for swap buffers as of
|
| 20 |
-** this time that is of value. Consequently, this code must be
|
| 21 |
-** implemented by somebody other than SGI.
|
| 22 |
-*/
|
| 23 |
-int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
|
| 24 |
+static __GLXdrawable *
|
| 25 |
+SyncContextGetDrawable (__GLXclientState *cl, GLXContextTag tag,
|
| 26 |
+ XID drawId, int *status)
|
| 27 |
{
|
| 28 |
ClientPtr client = cl->client;
|
| 29 |
DrawablePtr pDraw;
|
| 30 |
- xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
|
| 31 |
- GLXContextTag tag = req->contextTag;
|
| 32 |
- XID drawId = req->drawable;
|
| 33 |
__GLXpixmap *pGlxPixmap;
|
| 34 |
__GLXcontext *glxc = NULL;
|
| 35 |
- int error;
|
| 36 |
|
| 37 |
/*
|
| 38 |
** Check that the GLX drawable is valid.
|
| 39 |
@@ -1361,11 +1354,11 @@
|
| 40 |
** Drawable is an X pixmap, which is not allowed.
|
| 41 |
*/
|
| 42 |
client->errorValue = drawId;
|
| 43 |
- return __glXBadDrawable;
|
| 44 |
+ *status = __glXBadDrawable;
|
| 45 |
+ return NULL;
|
| 46 |
}
|
| 47 |
} else {
|
| 48 |
- pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId,
|
| 49 |
- __glXPixmapRes);
|
| 50 |
+ pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, __glXPixmapRes);
|
| 51 |
if (pGlxPixmap) {
|
| 52 |
/*
|
| 53 |
** Drawable is a GLX pixmap.
|
| 54 |
@@ -1375,21 +1368,23 @@
|
| 55 |
** Drawable is neither a X window nor a GLX pixmap.
|
| 56 |
*/
|
| 57 |
client->errorValue = drawId;
|
| 58 |
- return __glXBadDrawable;
|
| 59 |
+ *status = __glXBadDrawable;
|
| 60 |
+ return NULL;
|
| 61 |
}
|
| 62 |
}
|
| 63 |
|
| 64 |
if (tag) {
|
| 65 |
glxc = __glXLookupContextByTag(cl, tag);
|
| 66 |
if (!glxc) {
|
| 67 |
- return __glXBadContextTag;
|
| 68 |
+ *status = __glXBadContextTag;
|
| 69 |
+ return NULL;
|
| 70 |
}
|
| 71 |
/*
|
| 72 |
** The calling thread is swapping its current drawable. In this case,
|
| 73 |
** glxSwapBuffers is in both GL and X streams, in terms of
|
| 74 |
** sequentiality.
|
| 75 |
*/
|
| 76 |
- if (__glXForceCurrent(cl, tag, &error)) {
|
| 77 |
+ if (__glXForceCurrent(cl, tag, status)) {
|
| 78 |
/*
|
| 79 |
** Do whatever is needed to make sure that all preceding requests
|
| 80 |
** in both streams are completed before the swap is executed.
|
| 81 |
@@ -1397,33 +1392,53 @@
|
| 82 |
CALL_Finish( GET_DISPATCH(), () );
|
| 83 |
__GLX_NOTE_FLUSHED_CMDS(glxc);
|
| 84 |
} else {
|
| 85 |
- return error;
|
| 86 |
+ return NULL;
|
| 87 |
}
|
| 88 |
}
|
| 89 |
|
| 90 |
+ *status = Success;
|
| 91 |
if (pDraw) {
|
| 92 |
- __GLXdrawable *glxPriv;
|
| 93 |
+ __GLXdrawable *glxPriv;
|
| 94 |
|
| 95 |
if (glxc) {
|
| 96 |
glxPriv = __glXGetDrawable(glxc, pDraw, drawId);
|
| 97 |
if (glxPriv == NULL) {
|
| 98 |
- return __glXBadDrawable;
|
| 99 |
+ *status = __glXBadDrawable;
|
| 100 |
+ return NULL;
|
| 101 |
}
|
| 102 |
}
|
| 103 |
else {
|
| 104 |
glxPriv = __glXFindDrawable(drawId);
|
| 105 |
if (glxPriv == NULL) {
|
| 106 |
/* This is a window we've never seen before, do nothing */
|
| 107 |
- return Success;
|
| 108 |
+ return NULL;
|
| 109 |
}
|
| 110 |
}
|
| 111 |
|
| 112 |
- if ((*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) {
|
| 113 |
- return __glXBadDrawable;
|
| 114 |
- }
|
| 115 |
+ return glxPriv;
|
| 116 |
}
|
| 117 |
|
| 118 |
- return Success;
|
| 119 |
+ return NULL;
|
| 120 |
+}
|
| 121 |
+
|
| 122 |
+/*
|
| 123 |
+** NOTE: There is no portable implementation for swap buffers as of
|
| 124 |
+** this time that is of value. Consequently, this code must be
|
| 125 |
+** implemented by somebody other than SGI.
|
| 126 |
+*/
|
| 127 |
+int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc)
|
| 128 |
+{
|
| 129 |
+ xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc;
|
| 130 |
+ GLXContextTag tag = req->contextTag;
|
| 131 |
+ __GLXdrawable *glxPriv;
|
| 132 |
+ int status;
|
| 133 |
+
|
| 134 |
+ glxPriv = SyncContextGetDrawable (cl, tag, req->drawable, &status);
|
| 135 |
+ if (glxPriv && (*glxPriv->swapBuffers)(glxPriv) == GL_FALSE) {
|
| 136 |
+ return __glXBadDrawable;
|
| 137 |
+ }
|
| 138 |
+
|
| 139 |
+ return status;
|
| 140 |
}
|
| 141 |
|
| 142 |
|
| 143 |
@@ -1544,6 +1559,30 @@
|
| 144 |
pGlxPixmap);
|
| 145 |
}
|
| 146 |
|
| 147 |
+int __glXCopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
|
| 148 |
+{
|
| 149 |
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
|
| 150 |
+ GLXContextTag tag = req->contextTag;
|
| 151 |
+ __GLXdrawable *glxPriv;
|
| 152 |
+ GLXDrawable drawId;
|
| 153 |
+ int x, y, width, height;
|
| 154 |
+ int status;
|
| 155 |
+
|
| 156 |
+ pc += __GLX_VENDPRIV_HDR_SIZE;
|
| 157 |
+
|
| 158 |
+ drawId = *((CARD32 *) (pc));
|
| 159 |
+ x = *((INT32 *) (pc + 4));
|
| 160 |
+ y = *((INT32 *) (pc + 8));
|
| 161 |
+ width = *((INT32 *) (pc + 12));
|
| 162 |
+ height = *((INT32 *) (pc + 16));
|
| 163 |
+
|
| 164 |
+ glxPriv = SyncContextGetDrawable (cl, tag, drawId, &status);
|
| 165 |
+ if (glxPriv)
|
| 166 |
+ (*glxPriv->copySubBuffer)(glxPriv, x, y, width, height);
|
| 167 |
+
|
| 168 |
+ return status;
|
| 169 |
+}
|
| 170 |
+
|
| 171 |
/*
|
| 172 |
** Get drawable attributes
|
| 173 |
*/
|
| 174 |
@@ -2173,7 +2212,9 @@
|
| 175 |
case X_GLXvop_BindTexImageEXT:
|
| 176 |
return __glXBindTexImageEXT(cl, pc);
|
| 177 |
case X_GLXvop_ReleaseTexImageEXT:
|
| 178 |
- return __glXReleaseTexImageEXT(cl, pc);
|
| 179 |
+ return __glXReleaseTexImageEXT(cl, pc);
|
| 180 |
+ case X_GLXvop_CopySubBufferMESA:
|
| 181 |
+ return __glXCopySubBufferMESA(cl, pc);
|
| 182 |
}
|
| 183 |
#endif
|
| 184 |
|
| 185 |
--- ./GL/glx/glxdri.c.mesa-copy-sub-buffer 2006-07-06 21:40:41.000000000 -0400
|
| 186 |
+++ ./GL/glx/glxdri.c 2006-07-06 21:59:38.000000000 -0400
|
| 187 |
@@ -112,12 +112,28 @@
|
| 188 |
* months ago. :(
|
| 189 |
* 20050727 - Gut all the old interfaces. This breaks compatability with
|
| 190 |
* any DRI driver built to any previous version.
|
| 191 |
+ * 20060314 - Added support for GLX_MESA_copy_sub_buffer.
|
| 192 |
*/
|
| 193 |
+
|
| 194 |
#define INTERNAL_VERSION 20050727
|
| 195 |
|
| 196 |
static const char CREATE_NEW_SCREEN_FUNC[] =
|
| 197 |
"__driCreateNewScreen_" STRINGIFY (INTERNAL_VERSION);
|
| 198 |
|
| 199 |
+/* The DRI driver entry point version wasn't bumped when the
|
| 200 |
+ * copySubBuffer functionality was added to the DRI drivers, but the
|
| 201 |
+ * functionality is still conditional on the value of the
|
| 202 |
+ * internal_api_version passed to __driCreateNewScreen. However, the
|
| 203 |
+ * screen constructor doesn't fail for a DRI driver that's older than
|
| 204 |
+ * the passed in version number, so there's no way we can know for
|
| 205 |
+ * sure that we can actually use the copySubBuffer functionality. But
|
| 206 |
+ * since the earliest (and at this point only) released mesa version
|
| 207 |
+ * (6.5) that uses the 20050727 entry point does have copySubBuffer,
|
| 208 |
+ * we'll just settle for that. We still have to pass in a higher to
|
| 209 |
+ * the screen constructor to enable the functionality.
|
| 210 |
+ */
|
| 211 |
+#define COPY_SUB_BUFFER_INTERNAL_VERSION 20060314
|
| 212 |
+
|
| 213 |
static void
|
| 214 |
__glXDRIleaveServer(void)
|
| 215 |
{
|
| 216 |
@@ -177,6 +193,27 @@
|
| 217 |
return TRUE;
|
| 218 |
}
|
| 219 |
|
| 220 |
+static void
|
| 221 |
+__glXDRIdrawableCopySubBuffer(__GLXdrawable *basePrivate,
|
| 222 |
+ int x, int y, int w, int h)
|
| 223 |
+{
|
| 224 |
+ __GLXDRIdrawable *private = (__GLXDRIdrawable *) basePrivate;
|
| 225 |
+ __GLXDRIscreen *screen;
|
| 226 |
+
|
| 227 |
+ /* FIXME: We're jumping through hoops here to get the DRIdrawable
|
| 228 |
+ * which the dri driver tries to keep to it self... cf. FIXME in
|
| 229 |
+ * createDrawable. */
|
| 230 |
+
|
| 231 |
+ screen = (__GLXDRIscreen *) __glXgetActiveScreen(private->base.pDraw->pScreen->myNum);
|
| 232 |
+ private->driDrawable = (screen->driScreen.getDrawable)(NULL,
|
| 233 |
+ private->base.drawId,
|
| 234 |
+ screen->driScreen.private);
|
| 235 |
+
|
| 236 |
+ (*private->driDrawable->copySubBuffer)(NULL,
|
| 237 |
+ private->driDrawable->private,
|
| 238 |
+ x, y, w, h);
|
| 239 |
+}
|
| 240 |
+
|
| 241 |
static __GLXdrawable *
|
| 242 |
__glXDRIcontextCreateDrawable(__GLXcontext *context,
|
| 243 |
DrawablePtr pDraw,
|
| 244 |
@@ -195,10 +232,11 @@
|
| 245 |
return NULL;
|
| 246 |
}
|
| 247 |
|
| 248 |
- private->base.destroy = __glXDRIdrawableDestroy;
|
| 249 |
- private->base.resize = __glXDRIdrawableResize;
|
| 250 |
- private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
|
| 251 |
-
|
| 252 |
+ private->base.destroy = __glXDRIdrawableDestroy;
|
| 253 |
+ private->base.resize = __glXDRIdrawableResize;
|
| 254 |
+ private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
|
| 255 |
+ private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
|
| 256 |
+
|
| 257 |
#if 0
|
| 258 |
/* FIXME: It would only be natural that we called
|
| 259 |
* driScreen->createNewDrawable here but the DRI drivers manage
|
| 260 |
@@ -218,7 +256,6 @@
|
| 261 |
return &private->base;
|
| 262 |
}
|
| 263 |
|
| 264 |
-
|
| 265 |
static void
|
| 266 |
__glXDRIcontextDestroy(__GLXcontext *baseContext)
|
| 267 |
{
|
| 268 |
@@ -770,7 +807,7 @@
|
| 269 |
__DRIframebuffer framebuffer;
|
| 270 |
int fd = -1;
|
| 271 |
int status;
|
| 272 |
- int api_ver = INTERNAL_VERSION;
|
| 273 |
+ int api_ver = COPY_SUB_BUFFER_INTERNAL_VERSION;
|
| 274 |
drm_magic_t magic;
|
| 275 |
drmVersionPtr version;
|
| 276 |
char *driverName;
|
| 277 |
--- ./GL/glx/g_disptab.h.mesa-copy-sub-buffer 2006-03-11 19:11:33.000000000 -0500
|
| 278 |
+++ ./GL/glx/g_disptab.h 2006-07-06 21:56:33.000000000 -0400
|
| 279 |
@@ -48,6 +48,7 @@
|
| 280 |
extern int __glXSwapBuffers(__GLXclientState*, GLbyte*);
|
| 281 |
extern int __glXBindTexImageEXT(__GLXclientState *cl, GLbyte *pc);
|
| 282 |
extern int __glXReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc);
|
| 283 |
+extern int __glXCopySubBufferMESA(__GLXclientState *cl, GLbyte *pc);
|
| 284 |
extern int __glXGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
|
| 285 |
extern int __glXUseXFont(__GLXclientState*, GLbyte*);
|
| 286 |
extern int __glXCreateGLXPixmap(__GLXclientState*, GLbyte*);
|
| 287 |
@@ -76,6 +77,7 @@
|
| 288 |
extern int __glXSwapSwapBuffers(__GLXclientState*, GLbyte*);
|
| 289 |
extern int __glXSwapBindTexImageEXT(__GLXclientState *cl, GLbyte *pc);
|
| 290 |
extern int __glXSwapReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc);
|
| 291 |
+extern int __glXSwapReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc);
|
| 292 |
extern int __glXSwapGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc);
|
| 293 |
extern int __glXSwapUseXFont(__GLXclientState*, GLbyte*);
|
| 294 |
extern int __glXSwapCreateGLXPixmap(__GLXclientState*, GLbyte*);
|
| 295 |
@@ -105,4 +107,11 @@
|
| 296 |
extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE];
|
| 297 |
extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[__GLX_RENDER_TABLE_SIZE];
|
| 298 |
extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE];
|
| 299 |
+
|
| 300 |
+/* Copied from mesa src/glx/x11/glxcmds.c
|
| 301 |
+ *
|
| 302 |
+ * Apparently there's no standardized opcode for this extension.
|
| 303 |
+ */
|
| 304 |
+#define X_GLXvop_CopySubBufferMESA 5154 /* temporary */
|
| 305 |
+
|
| 306 |
#endif /* _GLX_g_disptab_h_ */
|
| 307 |
--- ./GL/glx/glxscreens.c.mesa-copy-sub-buffer 2006-03-20 15:10:29.000000000 -0500
|
| 308 |
+++ ./GL/glx/glxscreens.c 2006-07-06 21:56:33.000000000 -0400
|
| 309 |
@@ -139,6 +139,7 @@
|
| 310 |
"GLX_SGIX_swap_barrier "
|
| 311 |
#endif
|
| 312 |
"GLX_SGIX_fbconfig "
|
| 313 |
+ "GLX_MESA_copy_sub_buffer "
|
| 314 |
;
|
| 315 |
|
| 316 |
__GLXscreen **__glXActiveScreens;
|
| 317 |
--- ./GL/glx/glxcmdsswap.c.mesa-copy-sub-buffer 2006-04-02 22:09:15.000000000 -0400
|
| 318 |
+++ ./GL/glx/glxcmdsswap.c 2006-07-06 21:56:33.000000000 -0400
|
| 319 |
@@ -432,6 +432,31 @@
|
| 320 |
return __glXReleaseTexImageEXT(cl, (GLbyte *)pc);
|
| 321 |
}
|
| 322 |
|
| 323 |
+int __glXSwapCopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
|
| 324 |
+{
|
| 325 |
+ xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
|
| 326 |
+ GLXDrawable *drawId;
|
| 327 |
+ int *buffer;
|
| 328 |
+
|
| 329 |
+ (void) drawId;
|
| 330 |
+ (void) buffer;
|
| 331 |
+
|
| 332 |
+ __GLX_DECLARE_SWAP_VARIABLES;
|
| 333 |
+
|
| 334 |
+ pc += __GLX_VENDPRIV_HDR_SIZE;
|
| 335 |
+
|
| 336 |
+ __GLX_SWAP_SHORT(&req->length);
|
| 337 |
+ __GLX_SWAP_INT(&req->contextTag);
|
| 338 |
+ __GLX_SWAP_INT(pc);
|
| 339 |
+ __GLX_SWAP_INT(pc + 4);
|
| 340 |
+ __GLX_SWAP_INT(pc + 8);
|
| 341 |
+ __GLX_SWAP_INT(pc + 12);
|
| 342 |
+ __GLX_SWAP_INT(pc + 16);
|
| 343 |
+
|
| 344 |
+ return __glXCopySubBufferMESA(cl, pc);
|
| 345 |
+
|
| 346 |
+}
|
| 347 |
+
|
| 348 |
int __glXSwapGetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc)
|
| 349 |
{
|
| 350 |
xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc;
|
| 351 |
@@ -899,7 +924,9 @@
|
| 352 |
case X_GLXvop_BindTexImageEXT:
|
| 353 |
return __glXSwapBindTexImageEXT(cl, pc);
|
| 354 |
case X_GLXvop_ReleaseTexImageEXT:
|
| 355 |
- return __glXSwapReleaseTexImageEXT(cl, pc);
|
| 356 |
+ return __glXSwapReleaseTexImageEXT(cl, pc);
|
| 357 |
+ case X_GLXvop_CopySubBufferMESA:
|
| 358 |
+ return __glXSwapCopySubBufferMESA(cl, pc);
|
| 359 |
}
|
| 360 |
#endif
|
| 361 |
|