Skip to content

Commit

Permalink
gbm: Set max bpc for high bit depth videos
Browse files Browse the repository at this point in the history
  • Loading branch information
popcornmix committed Dec 3, 2021
1 parent 991a13c commit fcdcf4f
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ void CVideoLayerBridgeDRMPRIME::Disable()
m_DRM->AddProperty(connector, "Colorspace", value);
}

CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting max bpc to 8", __FUNCTION__);
result = m_DRM->AddProperty(connector, "max bpc", 8);
if (!result)
{
CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - failed to reset max bpc to 8", __FUNCTION__);
}

// disable HDR metadata
if (connector->SupportsProperty("HDR_OUTPUT_METADATA"))
{
Expand Down Expand Up @@ -185,6 +192,11 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer)

auto connector = m_DRM->GetConnector();

int bpc = 8;

if (picture.colorBits > 8)
bpc = 12;

std::tie(result, value) = connector->GetPropertyValue("Colorspace", GetColorimetry(picture));
if (result)
{
Expand All @@ -194,6 +206,10 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer)
m_DRM->SetActive(true);
}

CLog::Log(LOGDEBUG, "CVideoLayerBridgeDRMPRIME::{} - setting max bpc to {} ({})", __FUNCTION__,
bpc, result);
result = m_DRM->AddProperty(connector, "max bpc", bpc);

if (connector->SupportsProperty("HDR_OUTPUT_METADATA"))
{
m_hdr_metadata.metadata_type = HDMI_STATIC_METADATA_TYPE1;
Expand Down

0 comments on commit fcdcf4f

Please sign in to comment.