st/dri: Remove some debug prints
[mesa.git] / src / gallium / state_trackers / dri / dri_drawable.c
1 /**************************************************************************
2 *
3 * Copyright 2009, VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27 /*
28 * Author: Keith Whitwell <keithw@vmware.com>
29 * Author: Jakob Bornecrantz <wallbraker@gmail.com>
30 */
31
32 #include "dri_screen.h"
33 #include "dri_context.h"
34 #include "dri_drawable.h"
35
36 #include "pipe/p_context.h"
37 #include "pipe/p_screen.h"
38 #include "pipe/p_inlines.h"
39 #include "state_tracker/drm_api.h"
40 #include "state_tracker/dri1_api.h"
41 #include "state_tracker/st_public.h"
42 #include "state_tracker/st_context.h"
43 #include "state_tracker/st_cb_fbo.h"
44
45 #include "util/u_memory.h"
46
47 static struct pipe_surface *
48 dri_surface_from_handle(struct drm_api *api,
49 struct pipe_screen *screen,
50 unsigned handle,
51 enum pipe_format format,
52 unsigned width, unsigned height, unsigned pitch)
53 {
54 struct pipe_surface *surface = NULL;
55 struct pipe_texture *texture = NULL;
56 struct pipe_texture templat;
57 struct pipe_buffer *buf = NULL;
58
59 buf = api->buffer_from_handle(api, screen, "dri2 buffer", handle);
60 if (!buf)
61 return NULL;
62
63 memset(&templat, 0, sizeof(templat));
64 templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
65 templat.target = PIPE_TEXTURE_2D;
66 templat.last_level = 0;
67 templat.depth[0] = 1;
68 templat.format = format;
69 templat.width[0] = width;
70 templat.height[0] = height;
71 pf_get_block(templat.format, &templat.block);
72
73 texture = screen->texture_blanket(screen, &templat, &pitch, buf);
74
75 /* we don't need the buffer from this point on */
76 pipe_buffer_reference(&buf, NULL);
77
78 if (!texture)
79 return NULL;
80
81 surface = screen->get_tex_surface(screen, texture, 0, 0, 0,
82 PIPE_BUFFER_USAGE_GPU_READ |
83 PIPE_BUFFER_USAGE_GPU_WRITE);
84
85 /* we don't need the texture from this point on */
86 pipe_texture_reference(&texture, NULL);
87 return surface;
88 }
89
90 /**
91 * Pixmaps have will have the same name of fake front and front.
92 */
93 static boolean
94 dri2_check_if_pixmap(__DRIbuffer *buffers, int count)
95 {
96 boolean found = FALSE;
97 boolean is_pixmap = FALSE;
98 unsigned name;
99 int i;
100
101 for (i = 0; i < count; i++) {
102 switch (buffers[i].attachment) {
103 case __DRI_BUFFER_FRONT_LEFT:
104 case __DRI_BUFFER_FAKE_FRONT_LEFT:
105 if (found) {
106 is_pixmap = buffers[i].name == name;
107 } else {
108 name = buffers[i].name;
109 found = TRUE;
110 }
111 default:
112 continue;
113 }
114 }
115
116 return is_pixmap;
117 }
118
119 /**
120 * This will be called a drawable is known to have been resized.
121 */
122 void
123 dri_get_buffers(__DRIdrawablePrivate * dPriv)
124 {
125
126 struct dri_drawable *drawable = dri_drawable(dPriv);
127 struct pipe_surface *surface = NULL;
128 struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
129 __DRIbuffer *buffers = NULL;
130 __DRIscreen *dri_screen = drawable->sPriv;
131 __DRIdrawable *dri_drawable = drawable->dPriv;
132 struct drm_api *api = ((struct dri_screen*)(dri_screen->private))->api;
133 boolean have_depth = FALSE;
134 int i, count;
135
136 buffers = (*dri_screen->dri2.loader->getBuffers) (dri_drawable,
137 &dri_drawable->w,
138 &dri_drawable->h,
139 drawable->attachments,
140 drawable->
141 num_attachments, &count,
142 dri_drawable->
143 loaderPrivate);
144
145 if (buffers == NULL) {
146 return;
147 }
148
149 /* set one cliprect to cover the whole dri_drawable */
150 dri_drawable->x = 0;
151 dri_drawable->y = 0;
152 dri_drawable->backX = 0;
153 dri_drawable->backY = 0;
154 dri_drawable->numClipRects = 1;
155 dri_drawable->pClipRects[0].x1 = 0;
156 dri_drawable->pClipRects[0].y1 = 0;
157 dri_drawable->pClipRects[0].x2 = dri_drawable->w;
158 dri_drawable->pClipRects[0].y2 = dri_drawable->h;
159 dri_drawable->numBackClipRects = 1;
160 dri_drawable->pBackClipRects[0].x1 = 0;
161 dri_drawable->pBackClipRects[0].y1 = 0;
162 dri_drawable->pBackClipRects[0].x2 = dri_drawable->w;
163 dri_drawable->pBackClipRects[0].y2 = dri_drawable->h;
164
165 if (drawable->old_num == count &&
166 drawable->old_w == dri_drawable->w &&
167 drawable->old_h == dri_drawable->h &&
168 memcmp(drawable->old, buffers, sizeof(__DRIbuffer) * count) == 0) {
169 return;
170 } else {
171 drawable->old_num = count;
172 drawable->old_w = dri_drawable->w;
173 drawable->old_h = dri_drawable->h;
174 memcpy(drawable->old, buffers, sizeof(__DRIbuffer) * count);
175 }
176
177 drawable->is_pixmap = dri2_check_if_pixmap(buffers, count);
178
179 for (i = 0; i < count; i++) {
180 enum pipe_format format = 0;
181 int index = 0;
182
183 switch (buffers[i].attachment) {
184 case __DRI_BUFFER_FRONT_LEFT:
185 continue;
186 case __DRI_BUFFER_FAKE_FRONT_LEFT:
187 index = ST_SURFACE_FRONT_LEFT;
188 format = drawable->color_format;
189 break;
190 case __DRI_BUFFER_BACK_LEFT:
191 index = ST_SURFACE_BACK_LEFT;
192 format = drawable->color_format;
193 break;
194 case __DRI_BUFFER_DEPTH:
195 index = ST_SURFACE_DEPTH;
196 format = drawable->depth_format;
197 break;
198 case __DRI_BUFFER_STENCIL:
199 index = ST_SURFACE_DEPTH;
200 format = drawable->stencil_format;
201 break;
202 case __DRI_BUFFER_ACCUM:
203 default:
204 assert(0);
205 }
206
207 if (index == ST_SURFACE_DEPTH) {
208 if (have_depth)
209 continue;
210 else
211 have_depth = TRUE;
212 }
213
214 surface = dri_surface_from_handle(api,
215 screen,
216 buffers[i].name,
217 format,
218 dri_drawable->w,
219 dri_drawable->h, buffers[i].pitch);
220
221 st_set_framebuffer_surface(drawable->stfb, index, surface);
222 pipe_surface_reference(&surface, NULL);
223 }
224 /* this needed, or else the state tracker fails to pick the new buffers */
225 st_resize_framebuffer(drawable->stfb, dri_drawable->w, dri_drawable->h);
226 }
227
228 /**
229 * These are used for GLX_EXT_texture_from_pixmap
230 */
231 void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
232 GLint format, __DRIdrawable *dPriv)
233 {
234 struct dri_drawable *drawable = dri_drawable(dPriv);
235 struct pipe_surface *ps;
236
237 dri_get_buffers(drawable->dPriv);
238 st_get_framebuffer_surface(drawable->stfb, ST_SURFACE_FRONT_LEFT, &ps);
239
240 st_bind_texture_surface(ps, target == GL_TEXTURE_2D ? ST_TEXTURE_2D :
241 ST_TEXTURE_RECT, 0,
242 format == GLX_TEXTURE_FORMAT_RGBA_EXT ?
243 PIPE_FORMAT_R8G8B8A8_UNORM : PIPE_FORMAT_R8G8B8X8_UNORM);
244 }
245
246 void dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
247 __DRIdrawable *dPriv)
248 {
249 dri2_set_tex_buffer2(pDRICtx, target, GLX_TEXTURE_FORMAT_RGBA_EXT, dPriv);
250 }
251
252 void
253 dri_flush_frontbuffer(struct pipe_screen *screen,
254 struct pipe_surface *surf, void *context_private)
255 {
256 struct dri_context *ctx = (struct dri_context *)context_private;
257 struct dri_drawable *drawable = dri_drawable(ctx->dPriv);
258 __DRIdrawable *dri_drawable = ctx->dPriv;
259 __DRIscreen *dri_screen = ctx->sPriv;
260
261 /* XXX Does this function get called with DRI1? */
262
263 if (ctx->dPriv == NULL) {
264 debug_printf("%s: no drawable bound to context\n", __func__);
265 return;
266 }
267
268 #if 0
269 /* TODO if rendering to pixmaps is slow enable this code. */
270 if (drawable->is_pixmap)
271 return;
272 #endif
273
274 (*dri_screen->dri2.loader->flushFrontBuffer)(dri_drawable,
275 dri_drawable->loaderPrivate);
276 }
277
278 /**
279 * This is called when we need to set up GL rendering to a new X window.
280 */
281 boolean
282 dri_create_buffer(__DRIscreenPrivate * sPriv,
283 __DRIdrawablePrivate * dPriv,
284 const __GLcontextModes * visual, boolean isPixmap)
285 {
286 struct dri_screen *screen = sPriv->private;
287 struct dri_drawable *drawable = NULL;
288 int i;
289
290 if (isPixmap)
291 goto fail; /* not implemented */
292
293 drawable = CALLOC_STRUCT(dri_drawable);
294 if (drawable == NULL)
295 goto fail;
296
297 drawable->color_format = (visual->redBits == 8) ?
298 PIPE_FORMAT_A8R8G8B8_UNORM : PIPE_FORMAT_R5G6B5_UNORM;
299
300 switch(visual->depthBits) {
301 default:
302 case 0:
303 drawable->depth_format = PIPE_FORMAT_NONE;
304 break;
305 case 16:
306 drawable->depth_format = PIPE_FORMAT_Z16_UNORM;
307 break;
308 case 24:
309 if (visual->stencilBits == 0) {
310 drawable->depth_format = (screen->d_depth_bits_last) ?
311 PIPE_FORMAT_X8Z24_UNORM:
312 PIPE_FORMAT_Z24X8_UNORM;
313 } else {
314 drawable->depth_format = (screen->sd_depth_bits_last) ?
315 PIPE_FORMAT_S8Z24_UNORM:
316 PIPE_FORMAT_Z24S8_UNORM;
317 }
318 break;
319 }
320
321 switch(visual->stencilBits) {
322 default:
323 case 0:
324 drawable->stencil_format = PIPE_FORMAT_NONE;
325 break;
326 case 8:
327 drawable->stencil_format = (screen->sd_depth_bits_last) ?
328 PIPE_FORMAT_S8Z24_UNORM:
329 PIPE_FORMAT_Z24S8_UNORM;
330 break;
331 }
332
333 drawable->stfb = st_create_framebuffer(visual,
334 drawable->color_format,
335 drawable->depth_format,
336 drawable->stencil_format,
337 dPriv->w,
338 dPriv->h, (void *)drawable);
339 if (drawable->stfb == NULL)
340 goto fail;
341
342 drawable->sPriv = sPriv;
343 drawable->dPriv = dPriv;
344 dPriv->driverPrivate = (void *)drawable;
345
346 /* setup dri2 buffers information */
347 /* TODO incase of double buffer visual, delay fake creation */
348 i = 0;
349 drawable->attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
350 drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
351
352 if (visual->doubleBufferMode)
353 drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT;
354 if (visual->depthBits)
355 drawable->attachments[i++] = __DRI_BUFFER_DEPTH;
356 if (visual->stencilBits)
357 drawable->attachments[i++] = __DRI_BUFFER_STENCIL;
358 drawable->num_attachments = i;
359
360 drawable->desired_fences = 2;
361
362 return GL_TRUE;
363 fail:
364 FREE(drawable);
365 return GL_FALSE;
366 }
367
368 static struct pipe_fence_handle *
369 dri_swap_fences_pop_front(struct dri_drawable *draw)
370 {
371 struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
372 struct pipe_fence_handle *fence = NULL;
373
374 if (draw->cur_fences >= draw->desired_fences) {
375 screen->fence_reference(screen, &fence, draw->swap_fences[draw->tail]);
376 screen->fence_reference(screen, &draw->swap_fences[draw->tail++], NULL);
377 --draw->cur_fences;
378 draw->tail &= DRI_SWAP_FENCES_MASK;
379 }
380 return fence;
381 }
382
383 static void
384 dri_swap_fences_push_back(struct dri_drawable *draw,
385 struct pipe_fence_handle *fence)
386 {
387 struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
388
389 if (!fence)
390 return;
391
392 if (draw->cur_fences < DRI_SWAP_FENCES_MAX) {
393 draw->cur_fences++;
394 screen->fence_reference(screen, &draw->swap_fences[draw->head++],
395 fence);
396 draw->head &= DRI_SWAP_FENCES_MASK;
397 }
398 }
399
400 void
401 dri_destroy_buffer(__DRIdrawablePrivate * dPriv)
402 {
403 struct dri_drawable *drawable = dri_drawable(dPriv);
404 struct pipe_fence_handle *fence;
405 struct pipe_screen *screen = dri_screen(drawable->sPriv)->pipe_screen;
406
407 st_unreference_framebuffer(drawable->stfb);
408 drawable->desired_fences = 0;
409 while (drawable->cur_fences) {
410 fence = dri_swap_fences_pop_front(drawable);
411 screen->fence_reference(screen, &fence, NULL);
412 }
413
414 FREE(drawable);
415 }
416
417 static void
418 dri1_update_drawables_locked(struct dri_context *ctx,
419 __DRIdrawablePrivate * driDrawPriv,
420 __DRIdrawablePrivate * driReadPriv)
421 {
422 if (ctx->stLostLock) {
423 ctx->stLostLock = FALSE;
424 if (driDrawPriv == driReadPriv)
425 DRI_VALIDATE_DRAWABLE_INFO(ctx->sPriv, driDrawPriv);
426 else
427 DRI_VALIDATE_TWO_DRAWABLES_INFO(ctx->sPriv, driDrawPriv,
428 driReadPriv);
429 }
430 }
431
432 /**
433 * This ensures all contexts which bind to a drawable pick up the
434 * drawable change and signal new buffer state.
435 * Calling st_resize_framebuffer for each context may seem like overkill,
436 * but no new buffers will actually be allocated if the dimensions don't
437 * change.
438 */
439
440 static void
441 dri1_propagate_drawable_change(struct dri_context *ctx)
442 {
443 __DRIdrawablePrivate *dPriv = ctx->dPriv;
444 __DRIdrawablePrivate *rPriv = ctx->rPriv;
445 boolean flushed = FALSE;
446
447 if (dPriv && ctx->d_stamp != dPriv->lastStamp) {
448
449 st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
450 flushed = TRUE;
451 ctx->d_stamp = dPriv->lastStamp;
452 st_resize_framebuffer(dri_drawable(dPriv)->stfb, dPriv->w, dPriv->h);
453
454 }
455
456 if (rPriv && dPriv != rPriv && ctx->r_stamp != rPriv->lastStamp) {
457
458 if (!flushed)
459 st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
460 ctx->r_stamp = rPriv->lastStamp;
461 st_resize_framebuffer(dri_drawable(rPriv)->stfb, rPriv->w, rPriv->h);
462
463 } else if (rPriv && dPriv == rPriv) {
464
465 ctx->r_stamp = ctx->d_stamp;
466
467 }
468 }
469
470 void
471 dri1_update_drawables(struct dri_context *ctx,
472 struct dri_drawable *draw, struct dri_drawable *read)
473 {
474 dri_lock(ctx);
475 dri1_update_drawables_locked(ctx, draw->dPriv, read->dPriv);
476 dri_unlock(ctx);
477
478 dri1_propagate_drawable_change(ctx);
479 }
480
481 static INLINE boolean
482 dri1_intersect_src_bbox(struct drm_clip_rect *dst,
483 int dst_x,
484 int dst_y,
485 const struct drm_clip_rect *src,
486 const struct drm_clip_rect *bbox)
487 {
488 int xy1;
489 int xy2;
490
491 xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 :
492 (int)bbox->x1 + dst_x;
493 xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 :
494 (int)bbox->x2 + dst_x;
495 if (xy1 >= xy2 || xy1 < 0)
496 return FALSE;
497
498 dst->x1 = xy1;
499 dst->x2 = xy2;
500
501 xy1 = ((int)src->y1 > (int)bbox->y1 + dst_y) ? src->y1 :
502 (int)bbox->y1 + dst_y;
503 xy2 = ((int)src->y2 < (int)bbox->y2 + dst_y) ? src->y2 :
504 (int)bbox->y2 + dst_y;
505 if (xy1 >= xy2 || xy1 < 0)
506 return FALSE;
507
508 dst->y1 = xy1;
509 dst->y2 = xy2;
510 return TRUE;
511 }
512
513 static void
514 dri1_swap_copy(struct dri_context *ctx,
515 struct pipe_surface *dst,
516 struct pipe_surface *src,
517 __DRIdrawablePrivate * dPriv, const struct drm_clip_rect *bbox)
518 {
519 struct pipe_context *pipe = ctx->pipe;
520 struct drm_clip_rect clip;
521 struct drm_clip_rect *cur;
522 int i;
523
524 cur = dPriv->pClipRects;
525
526 for (i = 0; i < dPriv->numClipRects; ++i) {
527 if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox))
528 pipe->surface_copy(pipe, dst, clip.x1, clip.y1,
529 src,
530 (int)clip.x1 - dPriv->x,
531 (int)clip.y1 - dPriv->y,
532 clip.x2 - clip.x1, clip.y2 - clip.y1);
533 }
534 }
535
536 static void
537 dri1_copy_to_front(struct dri_context *ctx,
538 struct pipe_surface *surf,
539 __DRIdrawablePrivate * dPriv,
540 const struct drm_clip_rect *sub_box,
541 struct pipe_fence_handle **fence)
542 {
543 struct pipe_context *pipe = ctx->pipe;
544 boolean save_lost_lock;
545 uint cur_w;
546 uint cur_h;
547 struct drm_clip_rect bbox;
548 boolean visible = TRUE;
549
550 *fence = NULL;
551
552 dri_lock(ctx);
553 save_lost_lock = ctx->stLostLock;
554 dri1_update_drawables_locked(ctx, dPriv, dPriv);
555 st_get_framebuffer_dimensions(dri_drawable(dPriv)->stfb, &cur_w, &cur_h);
556
557 bbox.x1 = 0;
558 bbox.x2 = cur_w;
559 bbox.y1 = 0;
560 bbox.y2 = cur_h;
561
562 if (sub_box)
563 visible = dri1_intersect_src_bbox(&bbox, 0, 0, &bbox, sub_box);
564
565 if (visible && __dri1_api_hooks->present_locked) {
566
567 __dri1_api_hooks->present_locked(pipe,
568 surf,
569 dPriv->pClipRects,
570 dPriv->numClipRects,
571 dPriv->x, dPriv->y, &bbox, fence);
572
573 } else if (visible && __dri1_api_hooks->front_srf_locked) {
574
575 struct pipe_surface *front = __dri1_api_hooks->front_srf_locked(pipe);
576
577 if (front)
578 dri1_swap_copy(ctx, front, surf, dPriv, &bbox);
579
580 st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, fence);
581 }
582
583 ctx->stLostLock = save_lost_lock;
584
585 /**
586 * FIXME: Revisit this: Update drawables on copy_sub_buffer ?
587 */
588
589 if (!sub_box)
590 dri1_update_drawables_locked(ctx, ctx->dPriv, ctx->rPriv);
591
592 dri_unlock(ctx);
593 dri1_propagate_drawable_change(ctx);
594 }
595
596 void
597 dri1_flush_frontbuffer(struct pipe_screen *screen,
598 struct pipe_surface *surf, void *context_private)
599 {
600 struct dri_context *ctx = (struct dri_context *)context_private;
601 struct pipe_fence_handle *dummy_fence;
602
603 dri1_copy_to_front(ctx, surf, ctx->dPriv, NULL, &dummy_fence);
604 screen->fence_reference(screen, &dummy_fence, NULL);
605
606 /**
607 * FIXME: Do we need swap throttling here?
608 */
609 }
610
611 void
612 dri_swap_buffers(__DRIdrawablePrivate * dPriv)
613 {
614 struct dri_context *ctx;
615 struct pipe_surface *back_surf;
616 struct dri_drawable *draw = dri_drawable(dPriv);
617 struct pipe_screen *screen = dri_screen(draw->sPriv)->pipe_screen;
618 struct pipe_fence_handle *fence;
619 struct st_context *st = st_get_current();
620
621 assert(__dri1_api_hooks != NULL);
622
623 if (!st)
624 return; /* For now */
625
626 ctx = (struct dri_context *)st->pipe->priv;
627
628 st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
629 if (back_surf) {
630 st_notify_swapbuffers(draw->stfb);
631 st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
632 fence = dri_swap_fences_pop_front(draw);
633 if (fence) {
634 (void)screen->fence_finish(screen, fence, 0);
635 screen->fence_reference(screen, &fence, NULL);
636 }
637 dri1_copy_to_front(ctx, back_surf, dPriv, NULL, &fence);
638 dri_swap_fences_push_back(draw, fence);
639 screen->fence_reference(screen, &fence, NULL);
640 }
641 }
642
643 void
644 dri_copy_sub_buffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)
645 {
646 struct pipe_screen *screen = dri_screen(dPriv->driScreenPriv)->pipe_screen;
647 struct drm_clip_rect sub_bbox;
648 struct dri_context *ctx;
649 struct pipe_surface *back_surf;
650 struct dri_drawable *draw = dri_drawable(dPriv);
651 struct pipe_fence_handle *dummy_fence;
652 struct st_context *st = st_get_current();
653
654 assert(__dri1_api_hooks != NULL);
655
656 if (!st)
657 return;
658
659 ctx = (struct dri_context *)st->pipe->priv;
660
661 sub_bbox.x1 = x;
662 sub_bbox.x2 = x + w;
663 sub_bbox.y1 = y;
664 sub_bbox.y2 = y + h;
665
666 st_get_framebuffer_surface(draw->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
667 if (back_surf) {
668 st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
669 dri1_copy_to_front(ctx, back_surf, dPriv, &sub_bbox, &dummy_fence);
670 screen->fence_reference(screen, &dummy_fence, NULL);
671 }
672 }
673
674 /* vim: set sw=3 ts=8 sts=3 expandtab: */