dri2.c revision d2fe97a209134ff5267e8aa065865c3398bfb280
1/* 2 * Copyright © 2008 Red Hat, Inc. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Soft- 6 * ware"), to deal in the Software without restriction, including without 7 * limitation the rights to use, copy, modify, merge, publish, distribute, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, provided that the above copyright 10 * notice(s) and this permission notice appear in all copies of the Soft- 11 * ware and that both the above copyright notice(s) and this permission 12 * notice appear in supporting documentation. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- 16 * ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY 17 * RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN 18 * THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- 19 * QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 20 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 21 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- 22 * MANCE OF THIS SOFTWARE. 23 * 24 * Except as contained in this notice, the name of a copyright holder shall 25 * not be used in advertising or otherwise to promote the sale, use or 26 * other dealings in this Software without prior written authorization of 27 * the copyright holder. 28 * 29 * Authors: 30 * Kristian Høgsberg (krh@redhat.com) 31 */ 32 33 34#ifdef GLX_DIRECT_RENDERING 35 36#include <stdio.h> 37#include <X11/Xlibint.h> 38#include <X11/extensions/Xext.h> 39#include <X11/extensions/extutil.h> 40#include <X11/extensions/dri2proto.h> 41#include "xf86drm.h" 42#include "dri2.h" 43#include "glxclient.h" 44#include "GL/glxext.h" 45 46/* Allow the build to work with an older versions of dri2proto.h and 47 * dri2tokens.h. 48 */ 49#if DRI2_MINOR < 1 50#undef DRI2_MINOR 51#define DRI2_MINOR 1 52#define X_DRI2GetBuffersWithFormat 7 53#endif 54 55 56static char dri2ExtensionName[] = DRI2_NAME; 57static XExtensionInfo *dri2Info; 58static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info) 59 60static Bool 61DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire); 62static Status 63DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire); 64static int 65DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code); 66 67static /* const */ XExtensionHooks dri2ExtensionHooks = { 68 NULL, /* create_gc */ 69 NULL, /* copy_gc */ 70 NULL, /* flush_gc */ 71 NULL, /* free_gc */ 72 NULL, /* create_font */ 73 NULL, /* free_font */ 74 DRI2CloseDisplay, /* close_display */ 75 DRI2WireToEvent, /* wire_to_event */ 76 DRI2EventToWire, /* event_to_wire */ 77 DRI2Error, /* error */ 78 NULL, /* error_string */ 79}; 80 81static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay, 82 dri2Info, 83 dri2ExtensionName, 84 &dri2ExtensionHooks, 85 0, NULL) 86 87static Bool 88DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire) 89{ 90 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 91 XExtDisplayInfo *glx_info = __glXFindDisplay(dpy); 92 93 XextCheckExtension(dpy, info, dri2ExtensionName, False); 94 95 switch ((wire->u.u.type & 0x7f) - info->codes->first_event) { 96 97#ifdef X_DRI2SwapBuffers 98 case DRI2_BufferSwapComplete: 99 { 100 GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event; 101 xDRI2BufferSwapComplete *awire = (xDRI2BufferSwapComplete *)wire; 102 aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire); 103 aevent->type = glx_info->codes->first_event + GLX_BufferSwapComplete; 104 aevent->send_event = (awire->type & 0x80) != 0; 105 aevent->display = dpy; 106 aevent->drawable = awire->drawable; 107 switch (awire->event_type) { 108 case DRI2_EXCHANGE_COMPLETE: 109 aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL; 110 break; 111 case DRI2_BLIT_COMPLETE: 112 aevent->event_type = GLX_COPY_COMPLETE_INTEL; 113 break; 114 case DRI2_FLIP_COMPLETE: 115 aevent->event_type = GLX_FLIP_COMPLETE_INTEL; 116 break; 117 default: 118 /* unknown swap completion type */ 119 return False; 120 } 121 aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; 122 aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo; 123 aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo; 124 return True; 125 } 126#endif 127#ifdef DRI2_InvalidateBuffers 128 case DRI2_InvalidateBuffers: 129 { 130 xDRI2InvalidateBuffers *awire = (xDRI2InvalidateBuffers *)wire; 131 132 dri2InvalidateBuffers(dpy, awire->drawable); 133 return False; 134 } 135#endif 136 default: 137 /* client doesn't support server event */ 138 break; 139 } 140 141 return False; 142} 143 144/* We don't actually support this. It doesn't make sense for clients to 145 * send each other DRI2 events. 146 */ 147static Status 148DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire) 149{ 150 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 151 152 XextCheckExtension(dpy, info, dri2ExtensionName, False); 153 154 switch (event->type) { 155 default: 156 /* client doesn't support server event */ 157 break; 158 } 159 160 return Success; 161} 162 163static int 164DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code) 165{ 166 if (err->majorCode == codes->major_opcode && 167 err->errorCode == BadDrawable && 168 err->minorCode == X_DRI2CopyRegion) 169 return True; 170 171 return False; 172} 173 174Bool 175DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase) 176{ 177 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 178 179 if (XextHasExtension(info)) { 180 *eventBase = info->codes->first_event; 181 *errorBase = info->codes->first_error; 182 return True; 183 } 184 185 return False; 186} 187 188Bool 189DRI2QueryVersion(Display * dpy, int *major, int *minor) 190{ 191 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 192 xDRI2QueryVersionReply rep; 193 xDRI2QueryVersionReq *req; 194 int i, nevents; 195 196 XextCheckExtension(dpy, info, dri2ExtensionName, False); 197 198 LockDisplay(dpy); 199 GetReq(DRI2QueryVersion, req); 200 req->reqType = info->codes->major_opcode; 201 req->dri2ReqType = X_DRI2QueryVersion; 202 req->majorVersion = DRI2_MAJOR; 203 req->minorVersion = DRI2_MINOR; 204 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { 205 UnlockDisplay(dpy); 206 SyncHandle(); 207 return False; 208 } 209 *major = rep.majorVersion; 210 *minor = rep.minorVersion; 211 UnlockDisplay(dpy); 212 SyncHandle(); 213 214 switch (rep.minorVersion) { 215 case 1: 216 nevents = 0; 217 break; 218 case 2: 219 nevents = 1; 220 break; 221 case 3: 222 default: 223 nevents = 2; 224 break; 225 } 226 227 for (i = 0; i < nevents; i++) { 228 XESetWireToEvent (dpy, info->codes->first_event + i, DRI2WireToEvent); 229 XESetEventToWire (dpy, info->codes->first_event + i, DRI2EventToWire); 230 } 231 232 return True; 233} 234 235Bool 236DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName) 237{ 238 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 239 xDRI2ConnectReply rep; 240 xDRI2ConnectReq *req; 241 242 XextCheckExtension(dpy, info, dri2ExtensionName, False); 243 244 LockDisplay(dpy); 245 GetReq(DRI2Connect, req); 246 req->reqType = info->codes->major_opcode; 247 req->dri2ReqType = X_DRI2Connect; 248 req->window = window; 249 req->driverType = DRI2DriverDRI; 250 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { 251 UnlockDisplay(dpy); 252 SyncHandle(); 253 return False; 254 } 255 256 if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) { 257 UnlockDisplay(dpy); 258 SyncHandle(); 259 return False; 260 } 261 262 *driverName = Xmalloc(rep.driverNameLength + 1); 263 if (*driverName == NULL) { 264 _XEatData(dpy, 265 ((rep.driverNameLength + 3) & ~3) + 266 ((rep.deviceNameLength + 3) & ~3)); 267 UnlockDisplay(dpy); 268 SyncHandle(); 269 return False; 270 } 271 _XReadPad(dpy, *driverName, rep.driverNameLength); 272 (*driverName)[rep.driverNameLength] = '\0'; 273 274 *deviceName = Xmalloc(rep.deviceNameLength + 1); 275 if (*deviceName == NULL) { 276 Xfree(*driverName); 277 _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3)); 278 UnlockDisplay(dpy); 279 SyncHandle(); 280 return False; 281 } 282 _XReadPad(dpy, *deviceName, rep.deviceNameLength); 283 (*deviceName)[rep.deviceNameLength] = '\0'; 284 285 UnlockDisplay(dpy); 286 SyncHandle(); 287 288 return True; 289} 290 291Bool 292DRI2Authenticate(Display * dpy, XID window, drm_magic_t magic) 293{ 294 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 295 xDRI2AuthenticateReq *req; 296 xDRI2AuthenticateReply rep; 297 298 XextCheckExtension(dpy, info, dri2ExtensionName, False); 299 300 LockDisplay(dpy); 301 GetReq(DRI2Authenticate, req); 302 req->reqType = info->codes->major_opcode; 303 req->dri2ReqType = X_DRI2Authenticate; 304 req->window = window; 305 req->magic = magic; 306 307 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { 308 UnlockDisplay(dpy); 309 SyncHandle(); 310 return False; 311 } 312 313 UnlockDisplay(dpy); 314 SyncHandle(); 315 316 return rep.authenticated; 317} 318 319void 320DRI2CreateDrawable(Display * dpy, XID drawable) 321{ 322 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 323 xDRI2CreateDrawableReq *req; 324 325 XextSimpleCheckExtension(dpy, info, dri2ExtensionName); 326 327 LockDisplay(dpy); 328 GetReq(DRI2CreateDrawable, req); 329 req->reqType = info->codes->major_opcode; 330 req->dri2ReqType = X_DRI2CreateDrawable; 331 req->drawable = drawable; 332 UnlockDisplay(dpy); 333 SyncHandle(); 334} 335 336void 337DRI2DestroyDrawable(Display * dpy, XID drawable) 338{ 339 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 340 xDRI2DestroyDrawableReq *req; 341 342 XextSimpleCheckExtension(dpy, info, dri2ExtensionName); 343 344 XSync(dpy, False); 345 346 LockDisplay(dpy); 347 GetReq(DRI2DestroyDrawable, req); 348 req->reqType = info->codes->major_opcode; 349 req->dri2ReqType = X_DRI2DestroyDrawable; 350 req->drawable = drawable; 351 UnlockDisplay(dpy); 352 SyncHandle(); 353} 354 355DRI2Buffer * 356DRI2GetBuffers(Display * dpy, XID drawable, 357 int *width, int *height, 358 unsigned int *attachments, int count, int *outCount) 359{ 360 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 361 xDRI2GetBuffersReply rep; 362 xDRI2GetBuffersReq *req; 363 DRI2Buffer *buffers; 364 xDRI2Buffer repBuffer; 365 CARD32 *p; 366 int i; 367 368 XextCheckExtension(dpy, info, dri2ExtensionName, False); 369 370 LockDisplay(dpy); 371 GetReqExtra(DRI2GetBuffers, count * 4, req); 372 req->reqType = info->codes->major_opcode; 373 req->dri2ReqType = X_DRI2GetBuffers; 374 req->drawable = drawable; 375 req->count = count; 376 p = (CARD32 *) & req[1]; 377 for (i = 0; i < count; i++) 378 p[i] = attachments[i]; 379 380 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { 381 UnlockDisplay(dpy); 382 SyncHandle(); 383 return NULL; 384 } 385 386 *width = rep.width; 387 *height = rep.height; 388 *outCount = rep.count; 389 390 buffers = Xmalloc(rep.count * sizeof buffers[0]); 391 if (buffers == NULL) { 392 _XEatData(dpy, rep.count * sizeof repBuffer); 393 UnlockDisplay(dpy); 394 SyncHandle(); 395 return NULL; 396 } 397 398 for (i = 0; i < rep.count; i++) { 399 _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer); 400 buffers[i].attachment = repBuffer.attachment; 401 buffers[i].name = repBuffer.name; 402 buffers[i].pitch = repBuffer.pitch; 403 buffers[i].cpp = repBuffer.cpp; 404 buffers[i].flags = repBuffer.flags; 405 } 406 407 UnlockDisplay(dpy); 408 SyncHandle(); 409 410 return buffers; 411} 412 413 414DRI2Buffer * 415DRI2GetBuffersWithFormat(Display * dpy, XID drawable, 416 int *width, int *height, 417 unsigned int *attachments, int count, int *outCount) 418{ 419 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 420 xDRI2GetBuffersReply rep; 421 xDRI2GetBuffersReq *req; 422 DRI2Buffer *buffers; 423 xDRI2Buffer repBuffer; 424 CARD32 *p; 425 int i; 426 427 XextCheckExtension(dpy, info, dri2ExtensionName, False); 428 429 LockDisplay(dpy); 430 GetReqExtra(DRI2GetBuffers, count * (4 * 2), req); 431 req->reqType = info->codes->major_opcode; 432 req->dri2ReqType = X_DRI2GetBuffersWithFormat; 433 req->drawable = drawable; 434 req->count = count; 435 p = (CARD32 *) & req[1]; 436 for (i = 0; i < (count * 2); i++) 437 p[i] = attachments[i]; 438 439 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) { 440 UnlockDisplay(dpy); 441 SyncHandle(); 442 return NULL; 443 } 444 445 *width = rep.width; 446 *height = rep.height; 447 *outCount = rep.count; 448 449 buffers = Xmalloc(rep.count * sizeof buffers[0]); 450 if (buffers == NULL) { 451 _XEatData(dpy, rep.count * sizeof repBuffer); 452 UnlockDisplay(dpy); 453 SyncHandle(); 454 return NULL; 455 } 456 457 for (i = 0; i < rep.count; i++) { 458 _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer); 459 buffers[i].attachment = repBuffer.attachment; 460 buffers[i].name = repBuffer.name; 461 buffers[i].pitch = repBuffer.pitch; 462 buffers[i].cpp = repBuffer.cpp; 463 buffers[i].flags = repBuffer.flags; 464 } 465 466 UnlockDisplay(dpy); 467 SyncHandle(); 468 469 return buffers; 470} 471 472 473void 474DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region, 475 CARD32 dest, CARD32 src) 476{ 477 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 478 xDRI2CopyRegionReq *req; 479 xDRI2CopyRegionReply rep; 480 481 XextSimpleCheckExtension(dpy, info, dri2ExtensionName); 482 483 LockDisplay(dpy); 484 GetReq(DRI2CopyRegion, req); 485 req->reqType = info->codes->major_opcode; 486 req->dri2ReqType = X_DRI2CopyRegion; 487 req->drawable = drawable; 488 req->region = region; 489 req->dest = dest; 490 req->src = src; 491 492 _XReply(dpy, (xReply *) & rep, 0, xFalse); 493 494 UnlockDisplay(dpy); 495 SyncHandle(); 496} 497 498#ifdef X_DRI2SwapBuffers 499static void 500load_swap_req(xDRI2SwapBuffersReq *req, CARD64 target, CARD64 divisor, 501 CARD64 remainder) 502{ 503 req->target_msc_hi = target >> 32; 504 req->target_msc_lo = target & 0xffffffff; 505 req->divisor_hi = divisor >> 32; 506 req->divisor_lo = divisor & 0xffffffff; 507 req->remainder_hi = remainder >> 32; 508 req->remainder_lo = remainder & 0xffffffff; 509} 510 511static CARD64 512vals_to_card64(CARD32 lo, CARD32 hi) 513{ 514 return (CARD64)hi << 32 | lo; 515} 516 517void DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc, 518 CARD64 divisor, CARD64 remainder, CARD64 *count) 519{ 520 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 521 xDRI2SwapBuffersReq *req; 522 xDRI2SwapBuffersReply rep; 523 524 XextSimpleCheckExtension (dpy, info, dri2ExtensionName); 525 526 LockDisplay(dpy); 527 GetReq(DRI2SwapBuffers, req); 528 req->reqType = info->codes->major_opcode; 529 req->dri2ReqType = X_DRI2SwapBuffers; 530 req->drawable = drawable; 531 load_swap_req(req, target_msc, divisor, remainder); 532 533 _XReply(dpy, (xReply *)&rep, 0, xFalse); 534 535 *count = vals_to_card64(rep.swap_lo, rep.swap_hi); 536 537 UnlockDisplay(dpy); 538 SyncHandle(); 539} 540#endif 541 542#ifdef X_DRI2GetMSC 543Bool DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc, 544 CARD64 *sbc) 545{ 546 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 547 xDRI2GetMSCReq *req; 548 xDRI2MSCReply rep; 549 550 XextCheckExtension (dpy, info, dri2ExtensionName, False); 551 552 LockDisplay(dpy); 553 GetReq(DRI2GetMSC, req); 554 req->reqType = info->codes->major_opcode; 555 req->dri2ReqType = X_DRI2GetMSC; 556 req->drawable = drawable; 557 558 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { 559 UnlockDisplay(dpy); 560 SyncHandle(); 561 return False; 562 } 563 564 *ust = vals_to_card64(rep.ust_lo, rep.ust_hi); 565 *msc = vals_to_card64(rep.msc_lo, rep.msc_hi); 566 *sbc = vals_to_card64(rep.sbc_lo, rep.sbc_hi); 567 568 UnlockDisplay(dpy); 569 SyncHandle(); 570 571 return True; 572} 573#endif 574 575#ifdef X_DRI2WaitMSC 576static void 577load_msc_req(xDRI2WaitMSCReq *req, CARD64 target, CARD64 divisor, 578 CARD64 remainder) 579{ 580 req->target_msc_hi = target >> 32; 581 req->target_msc_lo = target & 0xffffffff; 582 req->divisor_hi = divisor >> 32; 583 req->divisor_lo = divisor & 0xffffffff; 584 req->remainder_hi = remainder >> 32; 585 req->remainder_lo = remainder & 0xffffffff; 586} 587 588Bool DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor, 589 CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc) 590{ 591 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 592 xDRI2WaitMSCReq *req; 593 xDRI2MSCReply rep; 594 595 XextCheckExtension (dpy, info, dri2ExtensionName, False); 596 597 LockDisplay(dpy); 598 GetReq(DRI2WaitMSC, req); 599 req->reqType = info->codes->major_opcode; 600 req->dri2ReqType = X_DRI2WaitMSC; 601 req->drawable = drawable; 602 load_msc_req(req, target_msc, divisor, remainder); 603 604 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { 605 UnlockDisplay(dpy); 606 SyncHandle(); 607 return False; 608 } 609 610 *ust = ((CARD64)rep.ust_hi << 32) | (CARD64)rep.ust_lo; 611 *msc = ((CARD64)rep.msc_hi << 32) | (CARD64)rep.msc_lo; 612 *sbc = ((CARD64)rep.sbc_hi << 32) | (CARD64)rep.sbc_lo; 613 614 UnlockDisplay(dpy); 615 SyncHandle(); 616 617 return True; 618} 619#endif 620 621#ifdef X_DRI2WaitSBC 622static void 623load_sbc_req(xDRI2WaitSBCReq *req, CARD64 target) 624{ 625 req->target_sbc_hi = target >> 32; 626 req->target_sbc_lo = target & 0xffffffff; 627} 628 629Bool DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust, 630 CARD64 *msc, CARD64 *sbc) 631{ 632 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 633 xDRI2WaitSBCReq *req; 634 xDRI2MSCReply rep; 635 636 XextCheckExtension (dpy, info, dri2ExtensionName, False); 637 638 LockDisplay(dpy); 639 GetReq(DRI2WaitSBC, req); 640 req->reqType = info->codes->major_opcode; 641 req->dri2ReqType = X_DRI2WaitSBC; 642 req->drawable = drawable; 643 load_sbc_req(req, target_sbc); 644 645 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { 646 UnlockDisplay(dpy); 647 SyncHandle(); 648 return False; 649 } 650 651 *ust = ((CARD64)rep.ust_hi << 32) | rep.ust_lo; 652 *msc = ((CARD64)rep.msc_hi << 32) | rep.msc_lo; 653 *sbc = ((CARD64)rep.sbc_hi << 32) | rep.sbc_lo; 654 655 UnlockDisplay(dpy); 656 SyncHandle(); 657 658 return True; 659} 660#endif 661 662#ifdef X_DRI2SwapInterval 663void DRI2SwapInterval(Display *dpy, XID drawable, int interval) 664{ 665 XExtDisplayInfo *info = DRI2FindDisplay(dpy); 666 xDRI2SwapIntervalReq *req; 667 668 XextSimpleCheckExtension (dpy, info, dri2ExtensionName); 669 670 LockDisplay(dpy); 671 GetReq(DRI2SwapInterval, req); 672 req->reqType = info->codes->major_opcode; 673 req->dri2ReqType = X_DRI2SwapInterval; 674 req->drawable = drawable; 675 req->interval = interval; 676 UnlockDisplay(dpy); 677 SyncHandle(); 678} 679#endif 680 681#endif /* GLX_DIRECT_RENDERING */ 682