1
0
Fork 0

onscreen/native: Avoid dereferencing gbm.next_fb when not in MODE_GBM

Such as with MODE_EGL_DEVICE.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3436
Fixes: 40950f99b3 ("drm-buffer-gbm: Do not call ensure_fb_id from...")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3708>
This commit is contained in:
Daniel van Vugt 2024-04-17 13:34:22 +08:00
parent 040800268f
commit d53da38198

View file

@ -1384,6 +1384,17 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
g_set_object (&onscreen_native->gbm.next_fb, secondary_gpu_fb);
else
g_set_object (&onscreen_native->gbm.next_fb, primary_gpu_fb);
if (!meta_drm_buffer_ensure_fb_id (onscreen_native->gbm.next_fb, &error))
{
g_warning ("Failed to ensure KMS FB ID on %s: %s",
meta_device_file_get_path (render_device_file),
error->message);
frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
meta_onscreen_native_notify_frame_complete (onscreen);
return;
}
break;
case META_RENDERER_NATIVE_MODE_SURFACELESS:
break;
@ -1393,17 +1404,6 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
#endif
}
if (!meta_drm_buffer_ensure_fb_id (onscreen_native->gbm.next_fb, &error))
{
g_warning ("Failed to ensure KMS FB ID on %s: %s",
meta_device_file_get_path (render_device_file),
error->message);
frame_info->flags |= COGL_FRAME_INFO_FLAG_SYMBOLIC;
meta_onscreen_native_notify_frame_complete (onscreen);
return;
}
/*
* If we changed EGL context, cogl will have the wrong idea about what is
* current, making it fail to set it when it needs to. Avoid that by making