diff options
author | Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> | 2013-07-16 14:24:04 +0300 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-08-16 10:56:00 -0700 |
commit | d224bb92187fd3af930a3528c9cee91f16aa30dc (patch) | |
tree | a5ed27cd5e8f568b2b51e72d1de207b1f0992485 | |
parent | 0d5fe3a2312624674b8484f8255ae5f6ed0fba72 (diff) | |
download | weston-d224bb92187fd3af930a3528c9cee91f16aa30dc.tar.gz weston-d224bb92187fd3af930a3528c9cee91f16aa30dc.tar.bz2 weston-d224bb92187fd3af930a3528c9cee91f16aa30dc.zip |
nested: Fix skipping frames due to texture update without a context
Calls into cairo-gles may change the current context, so it was only by
chance that sometimes we had the proper one as current and updated the
correct texture in surface_attach().
In order to fix this, calling display_acquire_window_surface() before
binding the texture for setup is necessary. However this call has the
side effect of allocating a cairo surface for the window. At flush time,
the existence of this surface will cause an eglSwapBuffers(), even
if no rendering was done to it, leading to undefined contents on the
screen. This happens when the idle redraw task runs while there is a
pending frame callback.
Workaround this by moving the texture setup from surface_attach() to the
redraw handler, so that the cairo surface is only allocated when
redering is done.
-rw-r--r-- | clients/nested.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clients/nested.c b/clients/nested.c index 244bbcae..67938c0c 100644 --- a/clients/nested.c +++ b/clients/nested.c @@ -137,6 +137,15 @@ redraw_handler(struct widget *widget, void *data) cairo_fill(cr); wl_list_for_each(s, &nested->surface_list, link) { + display_acquire_window_surface(nested->display, + nested->window, NULL); + + glBindTexture(GL_TEXTURE_2D, s->texture); + image_target_texture_2d(GL_TEXTURE_2D, s->image); + + display_release_window_surface(nested->display, + nested->window); + cairo_set_operator(cr, CAIRO_OPERATOR_OVER); cairo_set_source_surface(cr, s->cairo_surface, allocation.x + 10, @@ -314,9 +323,6 @@ surface_attach(struct wl_client *client, surface->texture, width, height); - glBindTexture(GL_TEXTURE_2D, surface->texture); - image_target_texture_2d(GL_TEXTURE_2D, surface->image); - window_schedule_redraw(nested->window); } |