From: Ander Conselvan de Oliveira <ander.conselvan.de.olive...@intel.com>

When a renderer switch happens, it is possible that when the surface
state is created, a buffer for the given surface is already available.
In that case, run the attach routine so that the pixel contents are
properly set. Otherwise, it would only be set when a new attach request
is made for that surface.

This makes the renderer transition seamless, without leaving a black
screen as before. (As long as --disable-early-buffer-release is passed
to compositor-drm).
---
 man/weston-drm.man |    5 +++--
 src/gl-renderer.c  |    8 +++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/man/weston-drm.man b/man/weston-drm.man
index d3d0b70..0c5f6de 100644
--- a/man/weston-drm.man
+++ b/man/weston-drm.man
@@ -110,8 +110,9 @@ instead of using the current tty.
 .B \-\-disable\-early\-buffer\-release
 Don't release buffers early and instead keep references to them as
 long as any surface uses them, even if the compositor has an
-internal copy of the buffer contents. This causes some clients to
-allocate more memory than necessary.
+internal copy of the buffer contents. This prevents artifacts when
+doing a renderer switch, but causes some clients to allocate more
+memory than necessary.
 .
 .\" ***************************************************************
 .SH ENVIRONMENT
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index 5e1b396..218fca4 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -883,7 +883,8 @@ gl_renderer_flush_damage(struct weston_surface *surface)
        if (!texture_used)
                return;
 
-       if (!pixman_region32_not_empty(&gs->texture_damage))
+       if (!pixman_region32_not_empty(&gs->texture_damage) &&
+           !gs->needs_full_upload)
                goto done;
 
        switch (wl_shm_buffer_get_format(buffer->shm_buffer)) {
@@ -1240,6 +1241,11 @@ gl_renderer_create_surface(struct weston_surface 
*surface)
        wl_signal_add(&gr->destroy_signal,
                      &gs->renderer_destroy_listener);
 
+       if (surface->buffer_ref.buffer) {
+               gl_renderer_attach(surface, surface->buffer_ref.buffer);
+               gl_renderer_flush_damage(surface);
+       }
+
        return 0;
 }
 
-- 
1.7.9.5

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to