egl/android: use software rendering when appropriate
authorGurchetan Singh <gurchetansingh@chromium.org>
Wed, 13 Mar 2019 17:59:59 +0000 (10:59 -0700)
committerGurchetan Singh <gurchetansingh@chromium.org>
Wed, 27 Mar 2019 17:26:21 +0000 (17:26 +0000)
Now the init logic fallbacks to or forces software rendering.

v2: simplify flow (@eric)

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/egl/drivers/dri2/platform_android.c

index b6d58338d469cd2e1746cd3f77ebb4aa438b939e..e25a6f73ed829a356fa155e26036f4034c740739 100644 (file)
@@ -1545,14 +1545,11 @@ EGLBoolean
 dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
 {
    _EGLDevice *dev;
+   bool device_opened = false;
    struct dri2_egl_display *dri2_dpy;
    const char *err;
    int ret;
 
-   /* Not supported yet */
-   if (disp->Options.ForceSoftware)
-      return EGL_FALSE;
-
    dri2_dpy = calloc(1, sizeof(*dri2_dpy));
    if (!dri2_dpy)
       return _eglError(EGL_BAD_ALLOC, "eglInitialize");
@@ -1566,8 +1563,12 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp)
    }
 
    disp->DriverData = (void *) dri2_dpy;
+   if (!disp->Options.ForceSoftware)
+      device_opened = droid_open_device(disp, false);
+   if (!device_opened)
+      device_opened = droid_open_device(disp, true);
 
-   if (!droid_open_device(disp, false)) {
+   if (!device_opened) {
       err = "DRI2: failed to open device";
       goto cleanup;
    }