diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp index 72b584b19d042..bcb4badb9be2f 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp @@ -158,12 +158,11 @@ void CVideoLayerBridgeDRMPRIME::Configure(CVideoBufferDRMPRIME* buffer) const VideoPicture& picture = buffer->GetPicture(); struct plane* plane = m_DRM->GetVideoPlane(); - if (m_DRM->SupportsProperty(plane, "COLOR_ENCODING") && - m_DRM->SupportsProperty(plane, "COLOR_RANGE")) - { + if (m_DRM->SupportsPropertyAndValue(plane, "COLOR_ENCODING", GetColorEncoding(picture))) m_DRM->AddProperty(plane, "COLOR_ENCODING", GetColorEncoding(picture)); + + if (m_DRM->SupportsPropertyAndValue(plane, "COLOR_RANGE", GetColorRange(picture))) m_DRM->AddProperty(plane, "COLOR_RANGE", GetColorRange(picture)); - } struct connector* connector = m_DRM->GetConnector(); if (m_DRM->SupportsProperty(connector, "HDR_OUTPUT_METADATA")) diff --git a/xbmc/windowing/gbm/DRMUtils.cpp b/xbmc/windowing/gbm/DRMUtils.cpp index 4e69047dfd4e8..513dd38dfd30f 100644 --- a/xbmc/windowing/gbm/DRMUtils.cpp +++ b/xbmc/windowing/gbm/DRMUtils.cpp @@ -203,6 +203,32 @@ bool CDRMUtils::SupportsProperty(struct drm_object *object, const char *name) return false; } +bool CDRMUtils::SupportsPropertyAndValue(struct drm_object* object, + const char* name, + uint64_t value) +{ + for (uint32_t i = 0; i < object->props->count_props; i++) + { + if (!StringUtils::EqualsNoCase(object->props_info[i]->name, name)) + continue; + + if (drm_property_type_is(object->props_info[i], DRM_MODE_PROP_ENUM) != 0) + { + for (int j = 0; j < object->props_info[i]->count_enums; j++) + { + if (object->props_info[i]->enums[j].value == value) + return true; + } + } + + CLog::Log(LOGDEBUG, "CDRMUtils::{} - property '{}' does not support value '{}'", __FUNCTION__, + name, value); + break; + } + + return false; +} + uint32_t CDRMUtils::GetPropertyId(struct drm_object *object, const char *name) { for (uint32_t i = 0; i < object->props->count_props; i++) diff --git a/xbmc/windowing/gbm/DRMUtils.h b/xbmc/windowing/gbm/DRMUtils.h index d12b7fda277e8..5c2174c9ea1a8 100644 --- a/xbmc/windowing/gbm/DRMUtils.h +++ b/xbmc/windowing/gbm/DRMUtils.h @@ -103,6 +103,7 @@ class CDRMUtils virtual bool SetMode(const RESOLUTION_INFO& res); bool SupportsProperty(struct drm_object *object, const char *name); + bool SupportsPropertyAndValue(struct drm_object* object, const char* name, uint64_t value); virtual bool AddProperty(struct drm_object *object, const char *name, uint64_t value) { return false; } virtual bool SetProperty(struct drm_object *object, const char *name, uint64_t value) { return false; }