On 09/05/16 23:57, Laurent Pinchart wrote: >> fwiw, I guess a lot of data from that table could these days be >> replaced w/ some of the drm format helpers >> (drm_format_num_planes()/drm_format_plane_cpp()/drm_format_{horz,vert}_chrom >> a_subsampling()/etc) > > I don't like those helpers as they're inefficient. Drivers often need to know > multiple pieces of information about a format, and the API forces look-ups > for > every piece of information needed. > > Would it make sense to add a drm_format_info() function that returns a > pointer > to a data structure that describes the format, and reimplement the existing > helpers on top of that ?
I do like that idea. A table implementation might possibly be faster even with the current API. Those big switch-cases compile into a big pile of if-else-if-else-ifs, whereas a for loop would compile into just a few instructions. But just guessing here =). In theory, the table could be sorted, making the lookup much faster, but I'm not sure if that's worth the effort. Tomi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20160510/cfffbd03/attachment.sig>