Fix build with old libdrm headers

This commit is contained in:
Cameron Gutman 2022-01-29 00:28:46 -06:00
commit e0fd84d6f5
2 changed files with 38 additions and 1 deletions

View file

@ -370,7 +370,8 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params)
// If we have an HDR output metadata property, construct the metadata blob
// to apply when we are called to enter HDR mode.
if (m_HdrOutputMetadataProp != nullptr) {
struct hdr_output_metadata outputMetadata;
DrmDefs::hdr_output_metadata outputMetadata;
outputMetadata.metadata_type = 0; // HDMI_STATIC_METADATA_TYPE1
outputMetadata.hdmi_metadata_type1.eotf = params->hdrMetadata.eotf;
outputMetadata.hdmi_metadata_type1.metadata_type = params->hdrMetadata.staticMetadataDescriptorId;

View file

@ -5,6 +5,42 @@
#include <xf86drm.h>
#include <xf86drmMode.h>
// Newer libdrm headers have these HDR structs, but some older ones don't.
namespace DrmDefs
{
// HDR structs is copied from linux include/linux/hdmi.h
struct hdr_metadata_infoframe
{
uint8_t eotf;
uint8_t metadata_type;
struct
{
uint16_t x, y;
} display_primaries[3];
struct
{
uint16_t x, y;
} white_point;
uint16_t max_display_mastering_luminance;
uint16_t min_display_mastering_luminance;
uint16_t max_cll;
uint16_t max_fall;
};
struct hdr_output_metadata
{
uint32_t metadata_type;
union {
struct hdr_metadata_infoframe hdmi_metadata_type1;
};
};
}
class DrmRenderer : public IFFmpegRenderer {
public:
DrmRenderer();