drisw: Avoid crashing when swrast_loader == NULL
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Fri, 4 Apr 2025 09:41:37 +0000 (17:41 +0800)
committerTimo Aaltonen <tjaalton@debian.org>
Mon, 19 May 2025 10:49:49 +0000 (13:49 +0300)
commit0a8dd2ce493cea4100dd8d4ce2c08ceb92ef48d8
treeb50b11c7d464e7f6da405b0084106f5690e53951
parentd2f0656e87abfffca7bd9eba3a5ef172ecd004f8
drisw: Avoid crashing when swrast_loader == NULL

This is a blanket fix for all the segfaults in `drisw_init_screen()`
when `swrast_loader` is NULL, since 1de7c86bc1. A similar more targeted
fix for vmwgfx can be found in f3b8d7da46 ("egl: never select swrast
for vmwgfx"). We can safely return NULL because the caller
`driCreateNewScreen3` handles NULL, as does its own callers.

As this is currently the top crasher of gnome-shell since Ubuntu
upgraded to Mesa 25 and it seems to be coming from multiple different
drivers still, we want a universal fix to at least stop the crash
reports. People can figure out which drivers still need tweaking in
`dri2_load_driver` or elsewhere later.

Fixes: 1de7c86bc1 ("dri: pass through a type enum for creating screen instead of driver_extensions")
Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12678 (radeon)
Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12859 (radeon)
Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12300 (nvidia-drm)
Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12462 (nvidia-drm)
Bug-Ubuntu: https://bugs.launchpad.net/bugs/2101817

Gbp-Pq: Name drisw-Avoid-crashing-when-swrast_loader-NULL.patch
src/gallium/frontends/dri/drisw.c