Improve robustness of DRM property value handling
This commit is contained in:
parent
46d58e55a3
commit
5f89636ed7
2 changed files with 19 additions and 12 deletions
|
|
@ -53,14 +53,6 @@ extern "C" {
|
|||
#define DRM_FORMAT_XYUV8888 fourcc_code('X', 'Y', 'U', 'V')
|
||||
#endif
|
||||
|
||||
// Values for "Colorspace" connector property
|
||||
#ifndef DRM_MODE_COLORIMETRY_DEFAULT
|
||||
#define DRM_MODE_COLORIMETRY_DEFAULT 0
|
||||
#endif
|
||||
#ifndef DRM_MODE_COLORIMETRY_BT2020_RGB
|
||||
#define DRM_MODE_COLORIMETRY_BT2020_RGB 9
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
|
@ -785,7 +777,8 @@ void DrmRenderer::setHdrMode(bool enabled)
|
|||
}
|
||||
|
||||
if (auto prop = m_Connector.property("max bpc")) {
|
||||
m_PropSetter.set(*prop, enabled ? 10 : 8);
|
||||
auto range = prop->range();
|
||||
m_PropSetter.set(*prop, std::clamp<uint64_t>(enabled ? 10 : 8, range.first, range.second));
|
||||
}
|
||||
|
||||
if (auto prop = m_Connector.property("HDR_OUTPUT_METADATA")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue