Merge branch '7.8'
[mesa.git] / src / gallium / state_trackers / egl / x11 / native_ximage.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.8
4 *
5 * Copyright (C) 2009-2010 Chia-I Wu <olv@0xlab.org>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 #include <assert.h>
26 #include <sys/ipc.h>
27 #include <sys/types.h>
28 #include <sys/shm.h>
29 #include <X11/Xlib.h>
30 #include <X11/Xutil.h>
31 #include "util/u_memory.h"
32 #include "util/u_math.h"
33 #include "util/u_format.h"
34 #include "pipe/p_compiler.h"
35 #include "util/u_inlines.h"
36 #include "state_tracker/xlib_sw_winsys.h"
37 #include "target-helpers/wrap_screen.h"
38 #include "util/u_debug.h"
39 #include "softpipe/sp_public.h"
40 #include "llvmpipe/lp_public.h"
41 #include "cell/ppu/cell_public.h"
42 #include "egllog.h"
43
44 #include "native_x11.h"
45 #include "x11_screen.h"
46
47 enum ximage_surface_type {
48 XIMAGE_SURFACE_TYPE_WINDOW,
49 XIMAGE_SURFACE_TYPE_PIXMAP,
50 XIMAGE_SURFACE_TYPE_PBUFFER
51 };
52
53 struct ximage_display {
54 struct native_display base;
55 Display *dpy;
56 boolean own_dpy;
57
58 struct native_event_handler *event_handler;
59
60 struct x11_screen *xscr;
61 int xscr_number;
62
63 struct ximage_config *configs;
64 int num_configs;
65 };
66
67 struct ximage_buffer {
68 struct pipe_texture *texture;
69 struct xlib_drawable xdraw;
70 };
71
72 struct ximage_surface {
73 struct native_surface base;
74 Drawable drawable;
75 enum ximage_surface_type type;
76 enum pipe_format color_format;
77 XVisualInfo visual;
78 struct ximage_display *xdpy;
79
80 unsigned int server_stamp;
81 unsigned int client_stamp;
82 int width, height;
83 struct ximage_buffer buffers[NUM_NATIVE_ATTACHMENTS];
84 uint valid_mask;
85
86 struct pipe_surface *draw_surface;
87 };
88
89 struct ximage_config {
90 struct native_config base;
91 const XVisualInfo *visual;
92 };
93
94 static INLINE struct ximage_display *
95 ximage_display(const struct native_display *ndpy)
96 {
97 return (struct ximage_display *) ndpy;
98 }
99
100 static INLINE struct ximage_surface *
101 ximage_surface(const struct native_surface *nsurf)
102 {
103 return (struct ximage_surface *) nsurf;
104 }
105
106 static INLINE struct ximage_config *
107 ximage_config(const struct native_config *nconf)
108 {
109 return (struct ximage_config *) nconf;
110 }
111
112 static void
113 ximage_surface_free_buffer(struct native_surface *nsurf,
114 enum native_attachment which)
115 {
116 struct ximage_surface *xsurf = ximage_surface(nsurf);
117 struct ximage_buffer *xbuf = &xsurf->buffers[which];
118
119 pipe_texture_reference(&xbuf->texture, NULL);
120 }
121
122 static boolean
123 ximage_surface_alloc_buffer(struct native_surface *nsurf,
124 enum native_attachment which)
125 {
126 struct ximage_surface *xsurf = ximage_surface(nsurf);
127 struct ximage_buffer *xbuf = &xsurf->buffers[which];
128 struct pipe_screen *screen = xsurf->xdpy->base.screen;
129 struct pipe_texture templ;
130
131 /* free old data */
132 if (xbuf->texture)
133 ximage_surface_free_buffer(&xsurf->base, which);
134
135 memset(&templ, 0, sizeof(templ));
136 templ.target = PIPE_TEXTURE_2D;
137 templ.format = xsurf->color_format;
138 templ.width0 = xsurf->width;
139 templ.height0 = xsurf->height;
140 templ.depth0 = 1;
141 templ.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
142
143 if (xsurf->type != XIMAGE_SURFACE_TYPE_PBUFFER) {
144 switch (which) {
145 case NATIVE_ATTACHMENT_FRONT_LEFT:
146 case NATIVE_ATTACHMENT_FRONT_RIGHT:
147 templ.tex_usage |= PIPE_TEXTURE_USAGE_SCANOUT;
148 break;
149 case NATIVE_ATTACHMENT_BACK_LEFT:
150 case NATIVE_ATTACHMENT_BACK_RIGHT:
151 templ.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
152 break;
153 default:
154 break;
155 }
156 }
157 xbuf->texture = screen->texture_create(screen, &templ);
158 if (xbuf->texture) {
159 xbuf->xdraw.visual = xsurf->visual.visual;
160 xbuf->xdraw.depth = xsurf->visual.depth;
161 xbuf->xdraw.drawable = xsurf->drawable;
162 }
163
164 /* clean up the buffer if allocation failed */
165 if (!xbuf->texture)
166 ximage_surface_free_buffer(&xsurf->base, which);
167
168 return (xbuf->texture != NULL);
169 }
170
171 /**
172 * Update the geometry of the surface. Return TRUE if the geometry has changed
173 * since last call.
174 */
175 static boolean
176 ximage_surface_update_geometry(struct native_surface *nsurf)
177 {
178 struct ximage_surface *xsurf = ximage_surface(nsurf);
179 Status ok;
180 Window root;
181 int x, y;
182 unsigned int w, h, border, depth;
183 boolean updated = FALSE;
184
185 /* pbuffer has fixed geometry */
186 if (xsurf->type == XIMAGE_SURFACE_TYPE_PBUFFER)
187 return FALSE;
188
189 ok = XGetGeometry(xsurf->xdpy->dpy, xsurf->drawable,
190 &root, &x, &y, &w, &h, &border, &depth);
191 if (ok && (xsurf->width != w || xsurf->height != h)) {
192 xsurf->width = w;
193 xsurf->height = h;
194
195 xsurf->server_stamp++;
196 updated = TRUE;
197 }
198
199 return updated;
200 }
201
202 static void
203 ximage_surface_notify_invalid(struct native_surface *nsurf)
204 {
205 struct ximage_surface *xsurf = ximage_surface(nsurf);
206 struct ximage_display *xdpy = xsurf->xdpy;
207
208 xdpy->event_handler->invalid_surface(&xdpy->base,
209 &xsurf->base, xsurf->server_stamp);
210 }
211
212 /**
213 * Update the buffers of the surface. It is a slow function due to the
214 * round-trip to the server.
215 */
216 static boolean
217 ximage_surface_update_buffers(struct native_surface *nsurf, uint buffer_mask)
218 {
219 struct ximage_surface *xsurf = ximage_surface(nsurf);
220 boolean updated;
221 uint new_valid;
222 int att;
223
224 updated = ximage_surface_update_geometry(&xsurf->base);
225 if (updated) {
226 /* all buffers become invalid */
227 xsurf->valid_mask = 0x0;
228 }
229 else {
230 buffer_mask &= ~xsurf->valid_mask;
231 /* all requested buffers are valid */
232 if (!buffer_mask) {
233 xsurf->client_stamp = xsurf->server_stamp;
234 return TRUE;
235 }
236 }
237
238 new_valid = 0x0;
239 for (att = 0; att < NUM_NATIVE_ATTACHMENTS; att++) {
240 if (native_attachment_mask_test(buffer_mask, att)) {
241 /* reallocate the texture */
242 if (!ximage_surface_alloc_buffer(&xsurf->base, att))
243 break;
244
245 new_valid |= (1 << att);
246 if (buffer_mask == new_valid)
247 break;
248 }
249 }
250
251 xsurf->valid_mask |= new_valid;
252 xsurf->client_stamp = xsurf->server_stamp;
253
254 return (new_valid == buffer_mask);
255 }
256
257 static boolean
258 ximage_surface_draw_buffer(struct native_surface *nsurf,
259 enum native_attachment which)
260 {
261 struct ximage_surface *xsurf = ximage_surface(nsurf);
262 struct ximage_buffer *xbuf = &xsurf->buffers[which];
263 struct pipe_screen *screen = xsurf->xdpy->base.screen;
264 struct pipe_surface *psurf;
265
266 if (xsurf->type == XIMAGE_SURFACE_TYPE_PBUFFER)
267 return TRUE;
268
269 assert(xsurf->drawable && xbuf->texture);
270
271 psurf = xsurf->draw_surface;
272 if (!psurf || psurf->texture != xbuf->texture) {
273 pipe_surface_reference(&xsurf->draw_surface, NULL);
274
275 psurf = screen->get_tex_surface(screen,
276 xbuf->texture, 0, 0, 0, PIPE_BUFFER_USAGE_CPU_READ);
277 if (!psurf)
278 return FALSE;
279
280 xsurf->draw_surface = psurf;
281 }
282
283 screen->flush_frontbuffer(screen, psurf, &xbuf->xdraw);
284
285 return TRUE;
286 }
287
288 static boolean
289 ximage_surface_flush_frontbuffer(struct native_surface *nsurf)
290 {
291 struct ximage_surface *xsurf = ximage_surface(nsurf);
292 boolean ret;
293
294 ret = ximage_surface_draw_buffer(&xsurf->base,
295 NATIVE_ATTACHMENT_FRONT_LEFT);
296 /* force buffers to be updated in next validation call */
297 xsurf->server_stamp++;
298 ximage_surface_notify_invalid(&xsurf->base);
299
300 return ret;
301 }
302
303 static boolean
304 ximage_surface_swap_buffers(struct native_surface *nsurf)
305 {
306 struct ximage_surface *xsurf = ximage_surface(nsurf);
307 struct ximage_buffer *xfront, *xback, xtmp;
308 boolean ret;
309
310 /* display the back buffer first */
311 ret = ximage_surface_draw_buffer(&xsurf->base,
312 NATIVE_ATTACHMENT_BACK_LEFT);
313 /* force buffers to be updated in next validation call */
314 xsurf->server_stamp++;
315 ximage_surface_notify_invalid(&xsurf->base);
316
317 xfront = &xsurf->buffers[NATIVE_ATTACHMENT_FRONT_LEFT];
318 xback = &xsurf->buffers[NATIVE_ATTACHMENT_BACK_LEFT];
319
320 /* skip swapping unless there is a front buffer */
321 if (xfront->texture) {
322 xtmp = *xfront;
323 *xfront = *xback;
324 *xback = xtmp;
325 }
326
327 return ret;
328 }
329
330 static boolean
331 ximage_surface_validate(struct native_surface *nsurf, uint attachment_mask,
332 unsigned int *seq_num, struct pipe_texture **textures,
333 int *width, int *height)
334 {
335 struct ximage_surface *xsurf = ximage_surface(nsurf);
336
337 if (xsurf->client_stamp != xsurf->server_stamp ||
338 (xsurf->valid_mask & attachment_mask) != attachment_mask) {
339 if (!ximage_surface_update_buffers(&xsurf->base, attachment_mask))
340 return FALSE;
341 }
342
343 if (seq_num)
344 *seq_num = xsurf->client_stamp;
345
346 if (textures) {
347 int att;
348 for (att = 0; att < NUM_NATIVE_ATTACHMENTS; att++) {
349 if (native_attachment_mask_test(attachment_mask, att)) {
350 struct ximage_buffer *xbuf = &xsurf->buffers[att];
351
352 textures[att] = NULL;
353 pipe_texture_reference(&textures[att], xbuf->texture);
354 }
355 }
356 }
357
358 if (width)
359 *width = xsurf->width;
360 if (height)
361 *height = xsurf->height;
362
363 return TRUE;
364 }
365
366 static void
367 ximage_surface_wait(struct native_surface *nsurf)
368 {
369 struct ximage_surface *xsurf = ximage_surface(nsurf);
370 XSync(xsurf->xdpy->dpy, FALSE);
371 /* TODO XGetImage and update the front texture */
372 }
373
374 static void
375 ximage_surface_destroy(struct native_surface *nsurf)
376 {
377 struct ximage_surface *xsurf = ximage_surface(nsurf);
378 int i;
379
380 pipe_surface_reference(&xsurf->draw_surface, NULL);
381
382 for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++)
383 ximage_surface_free_buffer(&xsurf->base, i);
384
385 free(xsurf);
386 }
387
388 static struct ximage_surface *
389 ximage_display_create_surface(struct native_display *ndpy,
390 enum ximage_surface_type type,
391 Drawable drawable,
392 const struct native_config *nconf)
393 {
394 struct ximage_display *xdpy = ximage_display(ndpy);
395 struct ximage_config *xconf = ximage_config(nconf);
396 struct ximage_surface *xsurf;
397
398 xsurf = CALLOC_STRUCT(ximage_surface);
399 if (!xsurf)
400 return NULL;
401
402 xsurf->xdpy = xdpy;
403 xsurf->type = type;
404 xsurf->color_format = xconf->base.color_format;
405 xsurf->drawable = drawable;
406
407 if (xsurf->type != XIMAGE_SURFACE_TYPE_PBUFFER) {
408 xsurf->drawable = drawable;
409 xsurf->visual = *xconf->visual;
410 /* initialize the geometry */
411 ximage_surface_update_buffers(&xsurf->base, 0x0);
412 }
413
414 xsurf->base.destroy = ximage_surface_destroy;
415 xsurf->base.swap_buffers = ximage_surface_swap_buffers;
416 xsurf->base.flush_frontbuffer = ximage_surface_flush_frontbuffer;
417 xsurf->base.validate = ximage_surface_validate;
418 xsurf->base.wait = ximage_surface_wait;
419
420 return xsurf;
421 }
422
423 static struct native_surface *
424 ximage_display_create_window_surface(struct native_display *ndpy,
425 EGLNativeWindowType win,
426 const struct native_config *nconf)
427 {
428 struct ximage_surface *xsurf;
429
430 xsurf = ximage_display_create_surface(ndpy, XIMAGE_SURFACE_TYPE_WINDOW,
431 (Drawable) win, nconf);
432 return (xsurf) ? &xsurf->base : NULL;
433 }
434
435 static struct native_surface *
436 ximage_display_create_pixmap_surface(struct native_display *ndpy,
437 EGLNativePixmapType pix,
438 const struct native_config *nconf)
439 {
440 struct ximage_surface *xsurf;
441
442 xsurf = ximage_display_create_surface(ndpy, XIMAGE_SURFACE_TYPE_PIXMAP,
443 (Drawable) pix, nconf);
444 return (xsurf) ? &xsurf->base : NULL;
445 }
446
447 static struct native_surface *
448 ximage_display_create_pbuffer_surface(struct native_display *ndpy,
449 const struct native_config *nconf,
450 uint width, uint height)
451 {
452 struct ximage_surface *xsurf;
453
454 xsurf = ximage_display_create_surface(ndpy, XIMAGE_SURFACE_TYPE_PBUFFER,
455 (Drawable) None, nconf);
456 if (xsurf) {
457 xsurf->width = width;
458 xsurf->height = height;
459 }
460 return (xsurf) ? &xsurf->base : NULL;
461 }
462
463 static enum pipe_format
464 choose_format(const XVisualInfo *vinfo)
465 {
466 enum pipe_format fmt;
467 /* TODO elaborate the formats */
468 switch (vinfo->depth) {
469 case 32:
470 fmt = PIPE_FORMAT_B8G8R8A8_UNORM;
471 break;
472 case 24:
473 fmt = PIPE_FORMAT_B8G8R8X8_UNORM;
474 break;
475 case 16:
476 fmt = PIPE_FORMAT_B5G6R5_UNORM;
477 break;
478 default:
479 fmt = PIPE_FORMAT_NONE;
480 break;
481 }
482
483 return fmt;
484 }
485
486 static const struct native_config **
487 ximage_display_get_configs(struct native_display *ndpy, int *num_configs)
488 {
489 struct ximage_display *xdpy = ximage_display(ndpy);
490 const struct native_config **configs;
491 int i;
492
493 /* first time */
494 if (!xdpy->configs) {
495 const XVisualInfo *visuals;
496 int num_visuals, count, j;
497
498 visuals = x11_screen_get_visuals(xdpy->xscr, &num_visuals);
499 if (!visuals)
500 return NULL;
501
502 /*
503 * Create two configs for each visual.
504 * One with depth/stencil buffer; one without
505 */
506 xdpy->configs = calloc(num_visuals * 2, sizeof(*xdpy->configs));
507 if (!xdpy->configs)
508 return NULL;
509
510 count = 0;
511 for (i = 0; i < num_visuals; i++) {
512 for (j = 0; j < 2; j++) {
513 struct ximage_config *xconf = &xdpy->configs[count];
514 __GLcontextModes *mode = &xconf->base.mode;
515
516 xconf->visual = &visuals[i];
517 xconf->base.color_format = choose_format(xconf->visual);
518 if (xconf->base.color_format == PIPE_FORMAT_NONE)
519 continue;
520
521 x11_screen_convert_visual(xdpy->xscr, xconf->visual, mode);
522 /* support double buffer mode */
523 mode->doubleBufferMode = TRUE;
524
525 xconf->base.depth_format = PIPE_FORMAT_NONE;
526 xconf->base.stencil_format = PIPE_FORMAT_NONE;
527 /* create the second config with depth/stencil buffer */
528 if (j == 1) {
529 xconf->base.depth_format = PIPE_FORMAT_Z24S8_UNORM;
530 xconf->base.stencil_format = PIPE_FORMAT_Z24S8_UNORM;
531 mode->depthBits = 24;
532 mode->stencilBits = 8;
533 mode->haveDepthBuffer = TRUE;
534 mode->haveStencilBuffer = TRUE;
535 }
536
537 mode->maxPbufferWidth = 4096;
538 mode->maxPbufferHeight = 4096;
539 mode->maxPbufferPixels = 4096 * 4096;
540 mode->drawableType =
541 GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT;
542 mode->swapMethod = GLX_SWAP_EXCHANGE_OML;
543
544 if (mode->alphaBits)
545 mode->bindToTextureRgba = TRUE;
546 else
547 mode->bindToTextureRgb = TRUE;
548
549 count++;
550 }
551 }
552
553 xdpy->num_configs = count;
554 }
555
556 configs = malloc(xdpy->num_configs * sizeof(*configs));
557 if (configs) {
558 for (i = 0; i < xdpy->num_configs; i++)
559 configs[i] = (const struct native_config *) &xdpy->configs[i];
560 if (num_configs)
561 *num_configs = xdpy->num_configs;
562 }
563 return configs;
564 }
565
566 static boolean
567 ximage_display_is_pixmap_supported(struct native_display *ndpy,
568 EGLNativePixmapType pix,
569 const struct native_config *nconf)
570 {
571 struct ximage_display *xdpy = ximage_display(ndpy);
572 enum pipe_format fmt;
573 uint depth;
574
575 depth = x11_drawable_get_depth(xdpy->xscr, (Drawable) pix);
576 switch (depth) {
577 case 32:
578 fmt = PIPE_FORMAT_B8G8R8A8_UNORM;
579 break;
580 case 24:
581 fmt = PIPE_FORMAT_B8G8R8X8_UNORM;
582 break;
583 case 16:
584 fmt = PIPE_FORMAT_B5G6R5_UNORM;
585 break;
586 default:
587 fmt = PIPE_FORMAT_NONE;
588 break;
589 }
590
591 return (fmt == nconf->color_format);
592 }
593
594 static int
595 ximage_display_get_param(struct native_display *ndpy,
596 enum native_param_type param)
597 {
598 int val;
599
600 switch (param) {
601 case NATIVE_PARAM_USE_NATIVE_BUFFER:
602 /* private buffers are allocated */
603 val = FALSE;
604 break;
605 default:
606 val = 0;
607 break;
608 }
609
610 return val;
611 }
612
613 static void
614 ximage_display_destroy(struct native_display *ndpy)
615 {
616 struct ximage_display *xdpy = ximage_display(ndpy);
617
618 if (xdpy->configs)
619 free(xdpy->configs);
620
621 xdpy->base.screen->destroy(xdpy->base.screen);
622
623 x11_screen_destroy(xdpy->xscr);
624 if (xdpy->own_dpy)
625 XCloseDisplay(xdpy->dpy);
626 free(xdpy);
627 }
628
629
630 /* Helper function to build a subset of a driver stack consisting of
631 * one of the software rasterizers (cell, llvmpipe, softpipe) and the
632 * xlib winsys.
633 *
634 * This function could be shared, but currently causes headaches for
635 * the build systems, particularly scons if we try.
636 *
637 * Long term, want to avoid having global #defines for things like
638 * GALLIUM_LLVMPIPE, GALLIUM_CELL, etc. Scons already eliminates
639 * those #defines, so things that are painful for it now are likely to
640 * be painful for other build systems in the future.
641 */
642 static struct pipe_screen *
643 swrast_xlib_create_screen( Display *display )
644 {
645 struct sw_winsys *winsys;
646 struct pipe_screen *screen = NULL;
647
648 /* Create the underlying winsys, which performs presents to Xlib
649 * drawables:
650 */
651 winsys = xlib_create_sw_winsys( display );
652 if (winsys == NULL)
653 return NULL;
654
655 /* Create a software rasterizer on top of that winsys. Use
656 * llvmpipe if it is available.
657 */
658 #if defined(GALLIUM_LLVMPIPE)
659 if (screen == NULL &&
660 !debug_get_bool_option("GALLIUM_NO_LLVM", FALSE))
661 screen = llvmpipe_create_screen( winsys );
662 #endif
663
664 if (screen == NULL)
665 screen = softpipe_create_screen( winsys );
666
667 if (screen == NULL)
668 goto fail;
669
670 /* Inject any wrapping layers we want to here:
671 */
672 return gallium_wrap_screen( screen );
673
674 fail:
675 if (winsys)
676 winsys->destroy( winsys );
677
678 return NULL;
679 }
680
681
682
683 struct native_display *
684 x11_create_ximage_display(EGLNativeDisplayType dpy,
685 struct native_event_handler *event_handler)
686 {
687 struct ximage_display *xdpy;
688
689 xdpy = CALLOC_STRUCT(ximage_display);
690 if (!xdpy)
691 return NULL;
692
693 xdpy->dpy = dpy;
694 if (!xdpy->dpy) {
695 xdpy->dpy = XOpenDisplay(NULL);
696 if (!xdpy->dpy) {
697 free(xdpy);
698 return NULL;
699 }
700 xdpy->own_dpy = TRUE;
701 }
702
703 xdpy->event_handler = event_handler;
704
705 xdpy->xscr_number = DefaultScreen(xdpy->dpy);
706 xdpy->xscr = x11_screen_create(xdpy->dpy, xdpy->xscr_number);
707 if (!xdpy->xscr) {
708 free(xdpy);
709 return NULL;
710 }
711
712 xdpy->base.screen = swrast_xlib_create_screen(xdpy->dpy);
713
714 xdpy->base.destroy = ximage_display_destroy;
715 xdpy->base.get_param = ximage_display_get_param;
716
717 xdpy->base.get_configs = ximage_display_get_configs;
718 xdpy->base.is_pixmap_supported = ximage_display_is_pixmap_supported;
719 xdpy->base.create_window_surface = ximage_display_create_window_surface;
720 xdpy->base.create_pixmap_surface = ximage_display_create_pixmap_surface;
721 xdpy->base.create_pbuffer_surface = ximage_display_create_pbuffer_surface;
722
723 return &xdpy->base;
724 }