diff --git a/include/libcamera/formats.h.in b/include/libcamera/formats.h.in index 9bbf1912..f20c60c9 100644 --- a/include/libcamera/formats.h.in +++ b/include/libcamera/formats.h.in @@ -33,10 +33,12 @@ constexpr uint64_t __mod(unsigned int vendor, unsigned int mod) (static_cast(mod) << 0); } +constexpr uint32_t kDrmFormatBigEndian = uint32_t(1) << 31; /* DRM_FORMAT_BIG_ENDIAN */ + } /* namespace */ {% for f in formats -%} -constexpr PixelFormat {{f.name}}(__fourcc({{f.fourcc}}), __mod({{f.mod}})); +constexpr PixelFormat {{f.name}}(__fourcc({{f.fourcc}}){{ ' | kDrmFormatBigEndian' if f.big_endian }}, __mod({{f.mod}})); {% endfor %} } /* namespace formats */ diff --git a/utils/codegen/gen-formats.py b/utils/codegen/gen-formats.py index 1f9def58..7542d884 100755 --- a/utils/codegen/gen-formats.py +++ b/utils/codegen/gen-formats.py @@ -59,13 +59,12 @@ def generate_formats(formats, drm_fourcc): for format in formats: name, format = format.popitem() fourcc = drm_fourcc.fourcc(format['fourcc']) - if format.get('big-endian'): - fourcc += '| DRM_FORMAT_BIG_ENDIAN' data = { 'name': name, 'fourcc': fourcc, 'mod': '0, 0', + 'big_endian': format.get('big_endian'), } mod = format.get('mod')