gl-renderer: Take direct-display into consideration

The buffer_init function added with commit 83b37c0ac4, "renderers: pull
dmabuf initial setup out of attach", doesn't take into consideration the
the buffer's direct-display property.

Previously, gl_renderer_attach_dmabuf, wasn't being called when dmabuf's
direct-display  was turned on, but with commit 83b37c0ac4 this has been changed.

So with commit 83b37c0ac4, linux_dmabuf_buffer_get_user_data will never
return a valid gb (gl buffer state), causing a crash using
direct-display extension. This adds an explicit check to return early
when this happens.

Fixes: 83b37c0ac4, "renderers: pull dmabuf initial setup out of attach"
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2024-12-01 23:05:23 +02:00
parent dae61f3321
commit bf7b2311e7

View file

@ -3617,7 +3617,8 @@ gl_renderer_buffer_init(struct weston_compositor *etc,
{
struct gl_buffer_state *gb;
if (buffer->type != WESTON_BUFFER_DMABUF)
if (buffer->type != WESTON_BUFFER_DMABUF ||
(buffer->type == WESTON_BUFFER_DMABUF && buffer->direct_display))
return;
/* Thanks to linux-dmabuf being totally independent of libweston,