Files
external_libcamera/include/libcamera/formats.h.in
Barnabás Pőcze 7602181be1 utils: codegen: gen-formats.py: Fix big endian formats
First, there is a single big endian format defined in `formats.yaml`: RGB565_BE.
However, while the yaml file specifies "big_endian: true", the python script
looks for a key named "big-endian". Causing `RGB565{,_BE}` both to be the same.

Second, the python script simply appends " | DRM_FORMAT_BIG_ENDIAN" to the
fourcc of the format. However, there is no definition of that macro is
available in the only user, `formats.h.in`.

Fix the first one by checking for "big_endian" in the script as well, and
fix the second one by defining a constant with the same value and using that.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Fixes: 7c496f1c54 ("utils: gen-formats: Support big-endian DRM formats")
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-09-08 10:56:38 +02:00

47 lines
1002 B
C

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2020, Google Inc.
*
* Formats
*
* This file is auto-generated. Do not edit.
*/
#pragma once
#include <stdint.h>
#include <libcamera/pixel_format.h>
namespace libcamera {
namespace formats {
namespace {
constexpr uint32_t __fourcc(char a, char b, char c, char d)
{
return (static_cast<uint32_t>(a) << 0) |
(static_cast<uint32_t>(b) << 8) |
(static_cast<uint32_t>(c) << 16) |
(static_cast<uint32_t>(d) << 24);
}
constexpr uint64_t __mod(unsigned int vendor, unsigned int mod)
{
return (static_cast<uint64_t>(vendor) << 56) |
(static_cast<uint64_t>(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}}){{ ' | kDrmFormatBigEndian' if f.big_endian }}, __mod({{f.mod}}));
{% endfor %}
} /* namespace formats */
} /* namespace libcamera */