gl-renderer: Do not attach the first buffer twice

When gl_renderer_attach is called, surface->buffer_ref.buffer points to the buffer.
So if the surface state needs to be created, we have :
gl_renderer_attach -> get_surface_state -> gl_renderer_create_surface -> gl_renderer_attach

Fixes: 895b1fdcb2 ("gl-renderer: Attach buffer during surface state creation if possible")
Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
This commit is contained in:
Loïc Yhuel 2023-09-08 19:39:49 +02:00 committed by Daniel Stone
parent 7dcde16f22
commit 623646bbfd

View File

@ -3211,6 +3211,11 @@ gl_renderer_attach(struct weston_surface *es, struct weston_buffer *buffer)
struct gl_surface_state *gs = get_surface_state(es);
bool ret = false;
/* If get_surface_state called gl_renderer_create_surface, it did
* attach the buffer */
if (gs->buffer_ref.buffer == buffer)
return;
/* SHM buffers are a little special in that they are allocated
* per-surface rather than per-buffer, because we keep a shadow
* copy of the SHM data in a GL texture; for these we need to