ascent12 / drm_info

Moved to https://gitlab.freedesktop.org/emersion/drm_info
MIT License
64 stars 13 forks source link

Dynamically generate format lookup table from drm_fourcc header #30

Closed soreau closed 5 years ago

soreau commented 5 years ago

This eliminates the need to maintain a list of formats used for converting from fourcc codes to the prettier version by parsing drm_fourcc.h directly and building a header for use in pretty.c

emersion commented 5 years ago

If we auto-generate code for formats, we should probably do the same for modifiers too.

emersion commented 5 years ago

For reference, here's a similar Python script that generates Go: https://git.sr.ht/~emersion/go-drm/tree/master/fourcc.py

Here we don't need the #define values so it's not necessary to go as far as compiling and running a C executable to get them. Also the pkg-config stuff can be taken from Meson (as you do currently).

soreau commented 5 years ago

For reference, here's a similar Python script that generates Go: https://git.sr.ht/~emersion/go-drm/tree/master/fourcc.py

This was a huge help, thanks.

If we auto-generate code for formats, we should probably do the same for modifiers too.

Done.

I'd accept something which is written in Python 3

Done.

soreau commented 5 years ago

@ascent12 I think I've addressed all your concerns, let me know if there's anything else.

The build bot doesn't seem to be able to import python module but it builds fine here.

soreau commented 5 years ago

@emersion Thanks for the review.

I found that '^#define (DRM_FORMAT_MOD_BROADCOM\w+(?=\s))' is more correct and doesn't require stripping the result.

ascent12 commented 5 years ago

Thanks