egl/gbm: Fix config validation
authorRobin Murphy <robin.murphy@arm.com>
Sat, 21 Sep 2019 17:07:28 +0000 (18:07 +0100)
committerEric Engestrom <eric.engestrom@intel.com>
Tue, 1 Oct 2019 13:45:15 +0000 (14:45 +0100)
In converting to shift/size-based validation, we lost a condition from
the ARGB/XRGB equivalence check, which left it working one way round
but not the other, and broke applications like glmark2-es2-drm on some
platforms. Restore the equivalent check that *both* configs actually
have an alpha channel before considering a mismatch.

Fixes: 7b4ed2b513ef ("egl: Convert configs to use shifts and sizes instead of masks")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
src/egl/drivers/dri2/platform_drm.c

index 7b13129ee3aa2c85ac8c190878ea10e42ec39b72..d0ab172d65901d11e8b672c5e1054ce6f6e8d2bc 100644 (file)
@@ -122,11 +122,13 @@ dri2_drm_config_is_compatible(struct dri2_egl_display *dri2_dpy,
    if (shifts[0] != visual->rgba_shifts.red ||
        shifts[1] != visual->rgba_shifts.green ||
        shifts[2] != visual->rgba_shifts.blue ||
-       (shifts[3] > -1 && shifts[3] != visual->rgba_shifts.alpha) ||
+       (shifts[3] > -1 && visual->rgba_shifts.alpha > -1 &&
+        shifts[3] != visual->rgba_shifts.alpha) ||
        sizes[0] != visual->rgba_sizes.red ||
        sizes[1] != visual->rgba_sizes.green ||
        sizes[2] != visual->rgba_sizes.blue ||
-       (sizes[3] > 0 && sizes[3] != visual->rgba_sizes.alpha) ||
+       (sizes[3] > 0 && visual->rgba_sizes.alpha > 0 &&
+        sizes[3] != visual->rgba_sizes.alpha) ||
        is_float != visual->is_float) {
       return false;
    }