gl-renderer: Split buffer state from surface state [weston_buffer epic part 3]
After !767 (merged) has made weston_buffer
a) useful and b) available (how novel!), this MR reworks how the GL renderer handles surface and buffer state. In particular, every surface had a gl_surface_state
which potentially stored a shadow of the buffer content, information about its type, a reference to any EGLImage, and a GL texture. The attach path was quite convoluted and was prone to leaks and confusion.
Now that we have a weston_buffer
to hang off, this MR cleans things up so that buffer state is stored separately. Each dmabuf or EGL buffer is provided with its own gl_buffer_state
storing the EGLImage, format, texture, etc, which is stored persistently and only referenced by the surface. Doing this allows us to delete our reference-counted EGLImage structure, in favour of something which stores the complete buffer state.
When SHM buffers are attached to a surface, the surface creates an ephemeral gl_buffer_state
referencing the shadow copy we take of the SHM content.
This MR also deletes a bunch of places where the GL renderer shadowed core buffer state.