Merge branch 'master' of ssh://git.freedesktop.org/git/mesa/mesa into pipe-video
[mesa.git] / src / gallium / winsys / g3dvl / dri / dri2.c
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 #define NEED_REPLIES
35 #include <stdio.h>
36 #include <X11/Xlibint.h>
37 #include <X11/extensions/Xext.h>
38 #include <X11/extensions/extutil.h>
39 #include <X11/extensions/dri2proto.h>
40 #include "xf86drm.h"
41 #include "dri2.h"
42 #if 0
43 #include "glxclient.h"
44 #include "GL/glxext.h"
45 #endif
46
47 /* Allow the build to work with an older versions of dri2proto.h and
48 * dri2tokens.h.
49 */
50 #if DRI2_MINOR < 1
51 #undef DRI2_MINOR
52 #define DRI2_MINOR 1
53 #define X_DRI2GetBuffersWithFormat 7
54 #endif
55
56
57 static char dri2ExtensionName[] = DRI2_NAME;
58 static XExtensionInfo *dri2Info;
59 static XEXT_GENERATE_CLOSE_DISPLAY (DRI2CloseDisplay, dri2Info)
60
61 static Bool
62 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire);
63 static Status
64 DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire);
65
66 static /* const */ XExtensionHooks dri2ExtensionHooks = {
67 NULL, /* create_gc */
68 NULL, /* copy_gc */
69 NULL, /* flush_gc */
70 NULL, /* free_gc */
71 NULL, /* create_font */
72 NULL, /* free_font */
73 DRI2CloseDisplay, /* close_display */
74 DRI2WireToEvent, /* wire_to_event */
75 DRI2EventToWire, /* event_to_wire */
76 NULL, /* error */
77 NULL, /* error_string */
78 };
79
80 static XEXT_GENERATE_FIND_DISPLAY (DRI2FindDisplay,
81 dri2Info,
82 dri2ExtensionName,
83 &dri2ExtensionHooks,
84 0, NULL)
85
86 static Bool
87 DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
88 {
89 #if 0
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 =
104 (glx_info->codes->first_event + GLX_BufferSwapComplete) & 0x75;
105 aevent->send_event = (awire->type & 0x80) != 0;
106 aevent->display = dpy;
107 aevent->drawable = awire->drawable;
108 switch (awire->event_type) {
109 case DRI2_EXCHANGE_COMPLETE:
110 aevent->event_type = GLX_EXCHANGE_COMPLETE_INTEL;
111 break;
112 case DRI2_BLIT_COMPLETE:
113 aevent->event_type = GLX_BLIT_COMPLETE_INTEL;
114 break;
115 case DRI2_FLIP_COMPLETE:
116 aevent->event_type = GLX_FLIP_COMPLETE_INTEL;
117 break;
118 default:
119 /* unknown swap completion type */
120 return False;
121 }
122 aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo;
123 aevent->msc = ((CARD64)awire->msc_hi << 32) | awire->msc_lo;
124 aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
125 return True;
126 }
127 #endif
128 #ifdef DRI2_InvalidateBuffers
129 case DRI2_InvalidateBuffers:
130 {
131 xDRI2InvalidateBuffers *awire = (xDRI2InvalidateBuffers *)wire;
132
133 dri2InvalidateBuffers(dpy, awire->drawable);
134 return False;
135 }
136 #endif
137 default:
138 /* client doesn't support server event */
139 break;
140 }
141 #endif
142 return False;
143 }
144
145 /* We don't actually support this. It doesn't make sense for clients to
146 * send each other DRI2 events.
147 */
148 static Status
149 DRI2EventToWire(Display *dpy, XEvent *event, xEvent *wire)
150 {
151 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
152
153 XextCheckExtension(dpy, info, dri2ExtensionName, False);
154
155 switch (event->type) {
156 default:
157 /* client doesn't support server event */
158 break;
159 }
160
161 return Success;
162 }
163
164 Bool
165 DRI2QueryExtension(Display * dpy, int *eventBase, int *errorBase)
166 {
167 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
168
169 if (XextHasExtension(info)) {
170 *eventBase = info->codes->first_event;
171 *errorBase = info->codes->first_error;
172 return True;
173 }
174
175 return False;
176 }
177
178 Bool
179 DRI2QueryVersion(Display * dpy, int *major, int *minor)
180 {
181 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
182 xDRI2QueryVersionReply rep;
183 xDRI2QueryVersionReq *req;
184 int i, nevents;
185
186 XextCheckExtension(dpy, info, dri2ExtensionName, False);
187
188 LockDisplay(dpy);
189 GetReq(DRI2QueryVersion, req);
190 req->reqType = info->codes->major_opcode;
191 req->dri2ReqType = X_DRI2QueryVersion;
192 req->majorVersion = DRI2_MAJOR;
193 req->minorVersion = DRI2_MINOR;
194 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
195 UnlockDisplay(dpy);
196 SyncHandle();
197 return False;
198 }
199 *major = rep.majorVersion;
200 *minor = rep.minorVersion;
201 UnlockDisplay(dpy);
202 SyncHandle();
203
204 switch (rep.minorVersion) {
205 case 1:
206 nevents = 0;
207 break;
208 case 2:
209 nevents = 1;
210 break;
211 case 3:
212 default:
213 nevents = 2;
214 break;
215 }
216
217 for (i = 0; i < nevents; i++) {
218 XESetWireToEvent (dpy, info->codes->first_event + i, DRI2WireToEvent);
219 XESetEventToWire (dpy, info->codes->first_event + i, DRI2EventToWire);
220 }
221
222 return True;
223 }
224
225 Bool
226 DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
227 {
228 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
229 xDRI2ConnectReply rep;
230 xDRI2ConnectReq *req;
231
232 XextCheckExtension(dpy, info, dri2ExtensionName, False);
233
234 LockDisplay(dpy);
235 GetReq(DRI2Connect, req);
236 req->reqType = info->codes->major_opcode;
237 req->dri2ReqType = X_DRI2Connect;
238 req->window = window;
239 req->driverType = DRI2DriverDRI;
240 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
241 UnlockDisplay(dpy);
242 SyncHandle();
243 return False;
244 }
245
246 if (rep.driverNameLength == 0 && rep.deviceNameLength == 0) {
247 UnlockDisplay(dpy);
248 SyncHandle();
249 return False;
250 }
251
252 *driverName = Xmalloc(rep.driverNameLength + 1);
253 if (*driverName == NULL) {
254 _XEatData(dpy,
255 ((rep.driverNameLength + 3) & ~3) +
256 ((rep.deviceNameLength + 3) & ~3));
257 UnlockDisplay(dpy);
258 SyncHandle();
259 return False;
260 }
261 _XReadPad(dpy, *driverName, rep.driverNameLength);
262 (*driverName)[rep.driverNameLength] = '\0';
263
264 *deviceName = Xmalloc(rep.deviceNameLength + 1);
265 if (*deviceName == NULL) {
266 Xfree(*driverName);
267 _XEatData(dpy, ((rep.deviceNameLength + 3) & ~3));
268 UnlockDisplay(dpy);
269 SyncHandle();
270 return False;
271 }
272 _XReadPad(dpy, *deviceName, rep.deviceNameLength);
273 (*deviceName)[rep.deviceNameLength] = '\0';
274
275 UnlockDisplay(dpy);
276 SyncHandle();
277
278 return True;
279 }
280
281 Bool
282 DRI2Authenticate(Display * dpy, XID window, drm_magic_t magic)
283 {
284 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
285 xDRI2AuthenticateReq *req;
286 xDRI2AuthenticateReply rep;
287
288 XextCheckExtension(dpy, info, dri2ExtensionName, False);
289
290 LockDisplay(dpy);
291 GetReq(DRI2Authenticate, req);
292 req->reqType = info->codes->major_opcode;
293 req->dri2ReqType = X_DRI2Authenticate;
294 req->window = window;
295 req->magic = magic;
296
297 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
298 UnlockDisplay(dpy);
299 SyncHandle();
300 return False;
301 }
302
303 UnlockDisplay(dpy);
304 SyncHandle();
305
306 return rep.authenticated;
307 }
308
309 void
310 DRI2CreateDrawable(Display * dpy, XID drawable)
311 {
312 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
313 xDRI2CreateDrawableReq *req;
314
315 XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
316
317 LockDisplay(dpy);
318 GetReq(DRI2CreateDrawable, req);
319 req->reqType = info->codes->major_opcode;
320 req->dri2ReqType = X_DRI2CreateDrawable;
321 req->drawable = drawable;
322 UnlockDisplay(dpy);
323 SyncHandle();
324 }
325
326 void
327 DRI2DestroyDrawable(Display * dpy, XID drawable)
328 {
329 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
330 xDRI2DestroyDrawableReq *req;
331
332 XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
333
334 XSync(dpy, False);
335
336 LockDisplay(dpy);
337 GetReq(DRI2DestroyDrawable, req);
338 req->reqType = info->codes->major_opcode;
339 req->dri2ReqType = X_DRI2DestroyDrawable;
340 req->drawable = drawable;
341 UnlockDisplay(dpy);
342 SyncHandle();
343 }
344
345 DRI2Buffer *
346 DRI2GetBuffers(Display * dpy, XID drawable,
347 int *width, int *height,
348 unsigned int *attachments, int count, int *outCount)
349 {
350 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
351 xDRI2GetBuffersReply rep;
352 xDRI2GetBuffersReq *req;
353 DRI2Buffer *buffers;
354 xDRI2Buffer repBuffer;
355 CARD32 *p;
356 int i;
357
358 XextCheckExtension(dpy, info, dri2ExtensionName, False);
359
360 LockDisplay(dpy);
361 GetReqExtra(DRI2GetBuffers, count * 4, req);
362 req->reqType = info->codes->major_opcode;
363 req->dri2ReqType = X_DRI2GetBuffers;
364 req->drawable = drawable;
365 req->count = count;
366 p = (CARD32 *) & req[1];
367 for (i = 0; i < count; i++)
368 p[i] = attachments[i];
369
370 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
371 UnlockDisplay(dpy);
372 SyncHandle();
373 return NULL;
374 }
375
376 *width = rep.width;
377 *height = rep.height;
378 *outCount = rep.count;
379
380 buffers = Xmalloc(rep.count * sizeof buffers[0]);
381 if (buffers == NULL) {
382 _XEatData(dpy, rep.count * sizeof repBuffer);
383 UnlockDisplay(dpy);
384 SyncHandle();
385 return NULL;
386 }
387
388 for (i = 0; i < rep.count; i++) {
389 _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
390 buffers[i].attachment = repBuffer.attachment;
391 buffers[i].name = repBuffer.name;
392 buffers[i].pitch = repBuffer.pitch;
393 buffers[i].cpp = repBuffer.cpp;
394 buffers[i].flags = repBuffer.flags;
395 }
396
397 UnlockDisplay(dpy);
398 SyncHandle();
399
400 return buffers;
401 }
402
403
404 DRI2Buffer *
405 DRI2GetBuffersWithFormat(Display * dpy, XID drawable,
406 int *width, int *height,
407 unsigned int *attachments, int count, int *outCount)
408 {
409 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
410 xDRI2GetBuffersReply rep;
411 xDRI2GetBuffersReq *req;
412 DRI2Buffer *buffers;
413 xDRI2Buffer repBuffer;
414 CARD32 *p;
415 int i;
416
417 XextCheckExtension(dpy, info, dri2ExtensionName, False);
418
419 LockDisplay(dpy);
420 GetReqExtra(DRI2GetBuffers, count * (4 * 2), req);
421 req->reqType = info->codes->major_opcode;
422 req->dri2ReqType = X_DRI2GetBuffersWithFormat;
423 req->drawable = drawable;
424 req->count = count;
425 p = (CARD32 *) & req[1];
426 for (i = 0; i < (count * 2); i++)
427 p[i] = attachments[i];
428
429 if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
430 UnlockDisplay(dpy);
431 SyncHandle();
432 return NULL;
433 }
434
435 *width = rep.width;
436 *height = rep.height;
437 *outCount = rep.count;
438
439 buffers = Xmalloc(rep.count * sizeof buffers[0]);
440 if (buffers == NULL) {
441 _XEatData(dpy, rep.count * sizeof repBuffer);
442 UnlockDisplay(dpy);
443 SyncHandle();
444 return NULL;
445 }
446
447 for (i = 0; i < rep.count; i++) {
448 _XReadPad(dpy, (char *) &repBuffer, sizeof repBuffer);
449 buffers[i].attachment = repBuffer.attachment;
450 buffers[i].name = repBuffer.name;
451 buffers[i].pitch = repBuffer.pitch;
452 buffers[i].cpp = repBuffer.cpp;
453 buffers[i].flags = repBuffer.flags;
454 }
455
456 UnlockDisplay(dpy);
457 SyncHandle();
458
459 return buffers;
460 }
461
462
463 void
464 DRI2CopyRegion(Display * dpy, XID drawable, XserverRegion region,
465 CARD32 dest, CARD32 src)
466 {
467 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
468 xDRI2CopyRegionReq *req;
469 xDRI2CopyRegionReply rep;
470
471 XextSimpleCheckExtension(dpy, info, dri2ExtensionName);
472
473 LockDisplay(dpy);
474 GetReq(DRI2CopyRegion, req);
475 req->reqType = info->codes->major_opcode;
476 req->dri2ReqType = X_DRI2CopyRegion;
477 req->drawable = drawable;
478 req->region = region;
479 req->dest = dest;
480 req->src = src;
481
482 _XReply(dpy, (xReply *) & rep, 0, xFalse);
483
484 UnlockDisplay(dpy);
485 SyncHandle();
486 }
487
488 #ifdef X_DRI2SwapBuffers
489 static void
490 load_swap_req(xDRI2SwapBuffersReq *req, CARD64 target, CARD64 divisor,
491 CARD64 remainder)
492 {
493 req->target_msc_hi = target >> 32;
494 req->target_msc_lo = target & 0xffffffff;
495 req->divisor_hi = divisor >> 32;
496 req->divisor_lo = divisor & 0xffffffff;
497 req->remainder_hi = remainder >> 32;
498 req->remainder_lo = remainder & 0xffffffff;
499 }
500
501 static CARD64
502 vals_to_card64(CARD32 lo, CARD32 hi)
503 {
504 return (CARD64)hi << 32 | lo;
505 }
506
507 void DRI2SwapBuffers(Display *dpy, XID drawable, CARD64 target_msc,
508 CARD64 divisor, CARD64 remainder, CARD64 *count)
509 {
510 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
511 xDRI2SwapBuffersReq *req;
512 xDRI2SwapBuffersReply rep;
513
514 XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
515
516 LockDisplay(dpy);
517 GetReq(DRI2SwapBuffers, req);
518 req->reqType = info->codes->major_opcode;
519 req->dri2ReqType = X_DRI2SwapBuffers;
520 req->drawable = drawable;
521 load_swap_req(req, target_msc, divisor, remainder);
522
523 _XReply(dpy, (xReply *)&rep, 0, xFalse);
524
525 *count = vals_to_card64(rep.swap_lo, rep.swap_hi);
526
527 UnlockDisplay(dpy);
528 SyncHandle();
529 }
530 #endif
531
532 #ifdef X_DRI2GetMSC
533 Bool DRI2GetMSC(Display *dpy, XID drawable, CARD64 *ust, CARD64 *msc,
534 CARD64 *sbc)
535 {
536 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
537 xDRI2GetMSCReq *req;
538 xDRI2MSCReply rep;
539
540 XextCheckExtension (dpy, info, dri2ExtensionName, False);
541
542 LockDisplay(dpy);
543 GetReq(DRI2GetMSC, req);
544 req->reqType = info->codes->major_opcode;
545 req->dri2ReqType = X_DRI2GetMSC;
546 req->drawable = drawable;
547
548 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
549 UnlockDisplay(dpy);
550 SyncHandle();
551 return False;
552 }
553
554 *ust = vals_to_card64(rep.ust_lo, rep.ust_hi);
555 *msc = vals_to_card64(rep.msc_lo, rep.msc_hi);
556 *sbc = vals_to_card64(rep.sbc_lo, rep.sbc_hi);
557
558 UnlockDisplay(dpy);
559 SyncHandle();
560
561 return True;
562 }
563 #endif
564
565 #ifdef X_DRI2WaitMSC
566 static void
567 load_msc_req(xDRI2WaitMSCReq *req, CARD64 target, CARD64 divisor,
568 CARD64 remainder)
569 {
570 req->target_msc_hi = target >> 32;
571 req->target_msc_lo = target & 0xffffffff;
572 req->divisor_hi = divisor >> 32;
573 req->divisor_lo = divisor & 0xffffffff;
574 req->remainder_hi = remainder >> 32;
575 req->remainder_lo = remainder & 0xffffffff;
576 }
577
578 Bool DRI2WaitMSC(Display *dpy, XID drawable, CARD64 target_msc, CARD64 divisor,
579 CARD64 remainder, CARD64 *ust, CARD64 *msc, CARD64 *sbc)
580 {
581 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
582 xDRI2WaitMSCReq *req;
583 xDRI2MSCReply rep;
584
585 XextCheckExtension (dpy, info, dri2ExtensionName, False);
586
587 LockDisplay(dpy);
588 GetReq(DRI2WaitMSC, req);
589 req->reqType = info->codes->major_opcode;
590 req->dri2ReqType = X_DRI2WaitMSC;
591 req->drawable = drawable;
592 load_msc_req(req, target_msc, divisor, remainder);
593
594 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
595 UnlockDisplay(dpy);
596 SyncHandle();
597 return False;
598 }
599
600 *ust = ((CARD64)rep.ust_hi << 32) | (CARD64)rep.ust_lo;
601 *msc = ((CARD64)rep.msc_hi << 32) | (CARD64)rep.msc_lo;
602 *sbc = ((CARD64)rep.sbc_hi << 32) | (CARD64)rep.sbc_lo;
603
604 UnlockDisplay(dpy);
605 SyncHandle();
606
607 return True;
608 }
609 #endif
610
611 #ifdef X_DRI2WaitSBC
612 static void
613 load_sbc_req(xDRI2WaitSBCReq *req, CARD64 target)
614 {
615 req->target_sbc_hi = target >> 32;
616 req->target_sbc_lo = target & 0xffffffff;
617 }
618
619 Bool DRI2WaitSBC(Display *dpy, XID drawable, CARD64 target_sbc, CARD64 *ust,
620 CARD64 *msc, CARD64 *sbc)
621 {
622 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
623 xDRI2WaitSBCReq *req;
624 xDRI2MSCReply rep;
625
626 XextCheckExtension (dpy, info, dri2ExtensionName, False);
627
628 LockDisplay(dpy);
629 GetReq(DRI2WaitSBC, req);
630 req->reqType = info->codes->major_opcode;
631 req->dri2ReqType = X_DRI2WaitSBC;
632 req->drawable = drawable;
633 load_sbc_req(req, target_sbc);
634
635 if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) {
636 UnlockDisplay(dpy);
637 SyncHandle();
638 return False;
639 }
640
641 *ust = ((CARD64)rep.ust_hi << 32) | rep.ust_lo;
642 *msc = ((CARD64)rep.msc_hi << 32) | rep.msc_lo;
643 *sbc = ((CARD64)rep.sbc_hi << 32) | rep.sbc_lo;
644
645 UnlockDisplay(dpy);
646 SyncHandle();
647
648 return True;
649 }
650 #endif
651
652 #ifdef X_DRI2SwapInterval
653 void DRI2SwapInterval(Display *dpy, XID drawable, int interval)
654 {
655 XExtDisplayInfo *info = DRI2FindDisplay(dpy);
656 xDRI2SwapIntervalReq *req;
657
658 XextSimpleCheckExtension (dpy, info, dri2ExtensionName);
659
660 LockDisplay(dpy);
661 GetReq(DRI2SwapInterval, req);
662 req->reqType = info->codes->major_opcode;
663 req->dri2ReqType = X_DRI2SwapInterval;
664 req->drawable = drawable;
665 req->interval = interval;
666 UnlockDisplay(dpy);
667 SyncHandle();
668 }
669 #endif