From 08781845fedd50fcf5133454bbabf91a6b2cb2d0 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 20 Jul 2021 14:31:46 -0700 Subject: [PATCH] egl/surfaceless: try kms_swrast before swrast Before commit f7e0cdcf1a5, we tried these in order - if (!ForceSoftware) surfaceless_probe_device(disp, false); - surfaceless_probe_device(disp, true); - surfaceless_probe_device_sw(disp); The commit changed it to - surfaceless_probe_device(disp, ForceSoftware); - surfaceless_probe_device_sw(disp); and broke 2D virtio-gpu and vgem when ForceSoftware is false. This commit restores the old behavior. Fixes: f7e0cdcf1a5 ("egl/surfaceless: simplify dri2_initialize_surfaceless()") Signed-off-by: Chia-I Wu Reviewed-by: Adam Jackson Reviewed-by: Emil Velikov Part-of: (cherry picked from commit 384181921c23fc7630b4a7d373f5b6755d20c8af) --- .pick_status.json | 2 +- src/egl/drivers/dri2/platform_surfaceless.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 65b4ff5fbef..ff36443a338 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1147,7 +1147,7 @@ "description": "egl/surfaceless: try kms_swrast before swrast", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "f7e0cdcf1a5b639b4df610be600fa5d8db100289" }, diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c index 2cd909c75a2..a420eb09ff6 100644 --- a/src/egl/drivers/dri2/platform_surfaceless.c +++ b/src/egl/drivers/dri2/platform_surfaceless.c @@ -327,14 +327,18 @@ dri2_initialize_surfaceless(_EGLDisplay *disp) dri2_dpy->fd = -1; disp->DriverData = (void *) dri2_dpy; + /* When ForceSoftware is false, we try the HW driver. When ForceSoftware + * is true, we try kms_swrast and swrast in order. + */ driver_loaded = surfaceless_probe_device(disp, disp->Options.ForceSoftware); + if (!driver_loaded && disp->Options.ForceSoftware) { + _eglLog(_EGL_DEBUG, "Falling back to surfaceless swrast without DRM."); + driver_loaded = surfaceless_probe_device_sw(disp); + } if (!driver_loaded) { - _eglLog(_EGL_DEBUG, "Falling back to surfaceless swrast without DRM."); - if (!surfaceless_probe_device_sw(disp)) { - err = "DRI2: failed to load driver"; - goto cleanup; - } + err = "DRI2: failed to load driver"; + goto cleanup; } if (!dri2_create_screen(disp)) {