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

Strasser, Kevin kevin.strasser at intel.com
Wed Jan 30 02:13:52 UTC 2019


Adam Jackson wrote:
> 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.

I can see how that might save some headaches for developers adding additional
formats. I'll submit a follow up patch to add that assert here and in the
dri2_get_rgba_shift helper function.

Thanks,
Kevin


More information about the mesa-dev mailing list