From: Gurchetan Singh Date: Wed, 13 Mar 2019 17:49:20 +0000 (-0700) Subject: egl/android: use swrast option in droid_load_driver X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d4e7982b6ef494775556de333f8ad00d082d748b;p=mesa.git egl/android: use swrast option in droid_load_driver Load the kms_swrast driver when specified. Doesn't work with drm_gralloc. v2: remove unneeded line (@eric) v3: Remove swrast_loader_extensions (@evelikov) Reviewed-by: Emil Velikov Reviewed-by: Eric Engestrom --- diff --git a/src/egl/drivers/dri2/platform_android.c b/src/egl/drivers/dri2/platform_android.c index 1c508b9feb3..b6d58338d46 100644 --- a/src/egl/drivers/dri2/platform_android.c +++ b/src/egl/drivers/dri2/platform_android.c @@ -1365,6 +1365,21 @@ droid_load_driver(_EGLDisplay *disp, bool swrast) goto error; } #else + if (swrast) { + /* Use kms swrast only with vgem / virtio_gpu. + * virtio-gpu fallbacks to software rendering when 3D features + * are unavailable since 6c5ab. + */ + if (strcmp(dri2_dpy->driver_name, "vgem") == 0 || + strcmp(dri2_dpy->driver_name, "virtio_gpu") == 0) { + free(dri2_dpy->driver_name); + dri2_dpy->driver_name = strdup("kms_swrast"); + } else { + err = "DRI3: failed to find software capable driver"; + goto error; + } + } + dri2_dpy->loader_extensions = droid_image_loader_extensions; if (!dri2_load_driver_dri3(disp)) { err = "DRI3: failed to load driver"; @@ -1432,6 +1447,9 @@ droid_open_device(_EGLDisplay *disp, bool swrast) struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp); int fd = -1, err = -EINVAL; + if (swrast) + return EGL_FALSE; + if (dri2_dpy->gralloc->perform) err = dri2_dpy->gralloc->perform(dri2_dpy->gralloc, GRALLOC_MODULE_PERFORM_GET_DRM_FD,