aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rusak <lorusak@gmail.com>2020-04-19 17:49:10 -0700
committerGitHub <noreply@github.com>2020-04-19 17:49:10 -0700
commitd6da11548992f78f6597a1a818058f22fd9fcedc (patch)
tree9df38561c0074ea5e0699ac634a28be87c098591
parentb164c7f9b9b935637a5a20e87b582c3190cde388 (diff)
parent8198d7b771445f947ce4961e5290c4586c0c9c59 (diff)
Merge pull request #17650 from lrusak/drm-properties
[GBM] CVideoLayerBridgeDRMPRIME: query supported values before setting them
-rw-r--r--xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp7
-rw-r--r--xbmc/windowing/gbm/DRMUtils.cpp26
-rw-r--r--xbmc/windowing/gbm/DRMUtils.h1
3 files changed, 30 insertions, 4 deletions
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender/VideoLayerBridgeDRMPRIME.cpp
index 72b584b19d..bcb4badb9b 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 4e69047dfd..513dd38dfd 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 d12b7fda27..5c2174c9ea 100644
--- a/xbmc/windowing/gbm/DRMUtils.h
+++ b/xbmc/windowing/gbm/DRMUtils.h
@@ -103,6 +103,7 @@ public:
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; }