int width, height;
struct ximage_buffer buffers[NUM_NATIVE_ATTACHMENTS];
uint valid_mask;
+
+ struct pipe_surface *draw_surface;
};
struct ximage_config {
assert(xsurf->drawable && xbuf->texture);
- /* what's the cost of surface creation? */
- psurf = screen->get_tex_surface(screen,
- xbuf->texture, 0, 0, 0, PIPE_BUFFER_USAGE_CPU_READ);
- if (!psurf)
- return FALSE;
+ psurf = xsurf->draw_surface;
+ if (!psurf || psurf->texture != xbuf->texture) {
+ pipe_surface_reference(&xsurf->draw_surface, NULL);
- screen->flush_frontbuffer(screen, psurf, &xbuf->xdraw);
+ psurf = screen->get_tex_surface(screen,
+ xbuf->texture, 0, 0, 0, PIPE_BUFFER_USAGE_CPU_READ);
+ if (!psurf)
+ return FALSE;
- pipe_surface_reference(&psurf, NULL);
+ xsurf->draw_surface = psurf;
+ }
+
+ screen->flush_frontbuffer(screen, psurf, &xbuf->xdraw);
return TRUE;
}
struct ximage_surface *xsurf = ximage_surface(nsurf);
int i;
+ pipe_surface_reference(&xsurf->draw_surface, NULL);
+
for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++)
ximage_surface_free_buffer(&xsurf->base, i);