Commit ee7ca670 authored by Eric Anholt's avatar Eric Anholt Committed by Adam Jackson

glamor: Make sure that GLAMOR_MEMORY pixmaps don't retain an FBO.

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.
Reviewed-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
parent a96c6d46
......@@ -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);
......
......@@ -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) {
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment