[Mesa-dev] [PATCH 04/13] egl: Convert configs to use shifts instead of masks

Adam Jackson ajax at redhat.com
Tue Jan 29 22:32:52 UTC 2019


On Mon, 2019-01-28 at 10:42 -0800, Kevin Strasser wrote:

> @@ -237,19 +268,35 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
>           break;
>  
>        case __DRI_ATTRIB_RED_MASK:
> -         dri_masks[0] = value;
> +         dri_shifts[0] = ffs(value) - 1;
> +         break;
> +
> +      case __DRI_ATTRIB_RED_SHIFT:
> +         dri_shifts[0] = value;
>           break;

I kind of want some paranoia here (for both cases) along the lines of:

    int shift = dri_shifts[x];
    if (shift != -1 && shift != value /* or ffs(value) - 1 */)
        assert(!"inconsistent config mask/shift");

That's probably being too cautious, certainly not worth blocking this
series for.

- ajax


More information about the mesa-dev mailing list