glamor_composite_choose_shader() may upload our scratch pixmaps to get a Render operation completed. We don't want to hang onto GL memory for our scratch pixmaps, since we'll just have to reallocate them at a new w/h next time around, and the contents will be updated as well.
Signed-off-by: Eric Anholt <e...@anholt.net> --- glamor/glamor_fbo.c | 1 + glamor/glamor_picture.c | 13 ++++++++----- glamor/glamor_render.c | 11 +++++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c index 5bfffe5..0bfc1dd 100644 --- a/glamor/glamor_fbo.c +++ b/glamor/glamor_fbo.c @@ -510,6 +510,7 @@ glamor_pixmap_destroy_fbo(PixmapPtr pixmap) for (i = 0; i < priv->block_wcnt * priv->block_hcnt; i++) glamor_destroy_fbo(glamor_priv, priv->fbo_array[i]); free(priv->fbo_array); + priv->fbo_array = NULL; } else { fbo = glamor_pixmap_detach_fbo(priv); diff --git a/glamor/glamor_picture.c b/glamor/glamor_picture.c index e91461c..9bb2c74 100644 --- a/glamor/glamor_picture.c +++ b/glamor/glamor_picture.c @@ -797,9 +797,10 @@ glamor_put_bits(char *dst_bits, int dst_stride, char *src_bits, } } -/* Upload picture to texture. We may need to flip the y axis or - * wire alpha to 1. So we may conditional create fbo for the picture. - * */ +/** + * Uploads a picture based on a GLAMOR_MEMORY pixmap to a texture in a + * temporary FBO. + */ Bool glamor_upload_picture_to_texture(PicturePtr picture) { @@ -810,9 +811,12 @@ glamor_upload_picture_to_texture(PicturePtr picture) glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); GLenum format, type; int no_alpha, revert, swap_rb; - glamor_pixmap_private *pixmap_priv; + glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap); Bool force_clip; + assert(glamor_pixmap_is_memory(pixmap)); + assert(!pixmap_priv->fbo); + if (glamor_get_tex_format_type_from_pixmap(pixmap, picture->format, &format, @@ -825,7 +829,6 @@ glamor_upload_picture_to_texture(PicturePtr picture) if (glamor_pixmap_upload_prepare(pixmap, format, no_alpha, revert, swap_rb)) return FALSE; - pixmap_priv = glamor_get_pixmap_private(pixmap); force_clip = glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP; if (glamor_pixmap_priv_is_large(pixmap_priv) || force_clip) { diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index d47e7d7..65f7059 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -1125,7 +1125,7 @@ glamor_composite_with_shader(CARD8 op, &key, &shader, &op_info, &saved_source_format, ca_state)) { glamor_fallback("glamor_composite_choose_shader failed\n"); - return ret; + goto fail; } if (ca_state == CA_TWO_PASS) { if (!glamor_composite_choose_shader(PictOpAdd, source, mask, dest, @@ -1135,7 +1135,7 @@ glamor_composite_with_shader(CARD8 op, &key_ca, &shader_ca, &op_info_ca, &saved_source_format, ca_state)) { glamor_fallback("glamor_composite_choose_shader failed\n"); - return ret; + goto fail; } } @@ -1267,6 +1267,13 @@ glamor_composite_with_shader(CARD8 op, source->format = saved_source_format; ret = TRUE; + +fail: + if (mask_pixmap && glamor_pixmap_is_memory(mask_pixmap)) + glamor_pixmap_destroy_fbo(mask_pixmap); + if (source_pixmap && glamor_pixmap_is_memory(source_pixmap)) + glamor_pixmap_destroy_fbo(source_pixmap); + return ret; } -- 2.7.0 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel