summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-07-29 16:25:56 -0700
committerEric Anholt <[email protected]>2019-08-13 10:30:01 -0700
commit86ae3c218662a302a96003010f331ac3d3153147 (patch)
treeeb49c9026c66b2498a724be70de1b2bde0f0e95f /src/egl
parent6a8d39dccdc1268e439a9ea0bc6fc89b3cd36815 (diff)
surfaceless: Fix swrast-path segfault when loader doesn't know driver name.
If we're hitting the swrast fallback path here, it's probably because we stumbled across a KMS-only device (such as the ASpeed that some of our CI runners have) that will then return a NULL driver_name. Don't crash in that case. Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/platform_surfaceless.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c
index 210f8188b96..8eeb2d4ed43 100644
--- a/src/egl/drivers/dri2/platform_surfaceless.c
+++ b/src/egl/drivers/dri2/platform_surfaceless.c
@@ -294,8 +294,9 @@ surfaceless_probe_device(_EGLDisplay *disp, bool swrast)
* are unavailable since 6c5ab, and kms_swrast is more
* feature complete than swrast.
*/
- if (strcmp(driver_name, "vgem") == 0 ||
- strcmp(driver_name, "virtio_gpu") == 0)
+ if (driver_name &&
+ (strcmp(driver_name, "vgem") == 0 ||
+ strcmp(driver_name, "virtio_gpu") == 0))
dri2_dpy->driver_name = strdup("kms_swrast");
free(driver_name);
} else {