Hi, On 12 January 2017 at 17:45, Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> wrote: > On Thu, Jan 12, 2017 at 05:04:46PM +0000, Daniel Stone wrote: >> Implicit is clever but horrible. AFAICT, the only way to do it >> properly would be to have a nested forwards loop walk when you first >> hit a modifier, searching for further occurrences of that modifier to >> collect the complete set of formats that modifier applies to. > > Not sure for what that is the "only way". In fact I can't right now > think of any operation that would require an extra loop necessarily. > For some things you might just want to look for a specific > format+modifier combo, for that it doesn't matter how many blocks there > are. Right, that just needs a local variable to act as a counter. > And if you want to transform the reply into some less convoluted > form, well then you'd just need some modifier+dynamic format list thing, > or if you want to keep to bitmasks you'd either need a bitmask that can > grow when running out of bits or just make it big enough to handle a > sufficiently large worst case number of bits. > > Dunno, maybe I just lack imagination. Then again, I'm not even sure if > we're talking about userspace of kernel code here, which might explain > my general confusion :) I'm talking about userspace, where I want to have: struct drm_plane { struct { uint32_t format; uint64_t modifiers[]; } formats[]; } Rather than keeping the original format around and doing the lookup every time. Cheers, Daniel _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx