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,14 +1384,6 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
g_set_object (&onscreen_native->gbm.next_fb, secondary_gpu_fb); g_set_object (&onscreen_native->gbm.next_fb, secondary_gpu_fb);
else else
g_set_object (&onscreen_native->gbm.next_fb, primary_gpu_fb); g_set_object (&onscreen_native->gbm.next_fb, primary_gpu_fb);
break;
case META_RENDERER_NATIVE_MODE_SURFACELESS:
break;
#ifdef HAVE_EGL_DEVICE
case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
break;
#endif
}
if (!meta_drm_buffer_ensure_fb_id (onscreen_native->gbm.next_fb, &error)) if (!meta_drm_buffer_ensure_fb_id (onscreen_native->gbm.next_fb, &error))
{ {
@ -1403,6 +1395,14 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
meta_onscreen_native_notify_frame_complete (onscreen); meta_onscreen_native_notify_frame_complete (onscreen);
return; return;
} }
break;
case META_RENDERER_NATIVE_MODE_SURFACELESS:
break;
#ifdef HAVE_EGL_DEVICE
case META_RENDERER_NATIVE_MODE_EGL_DEVICE:
break;
#endif
}
/* /*
* If we changed EGL context, cogl will have the wrong idea about what is * If we changed EGL context, cogl will have the wrong idea about what is