rhi: Pick up HDR maxColorComponentValue from UIScreen if available
Although QRhiSwapChainHdrInfo uses 'max' for this value, it's used by Qt Multimedia's QVideoWindowPrivate::render() as the current maximum, so we need to reflect UIScreen's currentEDRHeadroom rather than potentialEDRHeadroom (the absolute max), the same way we reflect maximumExtendedDynamicRangeColorComponentValue and not maximumPotentialExtendedDynamicRangeColorComponentValue from NSScreen. As we don't support HDRExtendedSrgbLinear on < iOS 16 there is no point in providing a heuristic fallback based on the iPhone 12 spec. Pick-to: 6.5 6.6 Change-Id: If071bb64f269ce16886206df05eb9f27d260bf15 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>bb10
parent
38a00d2c97
commit
74319d05b1
|
|
@ -6331,22 +6331,24 @@ QRhiSwapChainHdrInfo QMetalSwapChain::hdrInfo()
|
|||
{
|
||||
QRhiSwapChainHdrInfo info;
|
||||
info.limitsType = QRhiSwapChainHdrInfo::ColorComponentValue;
|
||||
if (m_format == SDR) {
|
||||
info.limits.colorComponentValue.maxColorComponentValue = 1;
|
||||
return info;
|
||||
info.limits.colorComponentValue.maxColorComponentValue = 1;
|
||||
info.isHardCodedDefaults = true;
|
||||
|
||||
if (m_format != SDR && m_window) {
|
||||
// Must use m_window, not window, given this may be called before createOrResize().
|
||||
#ifdef Q_OS_MACOS
|
||||
NSView *view = reinterpret_cast<NSView *>(m_window->winId());
|
||||
info.limits.colorComponentValue.maxColorComponentValue = view.window.screen.maximumExtendedDynamicRangeColorComponentValue;
|
||||
info.isHardCodedDefaults = false;
|
||||
#else
|
||||
if (@available(iOS 16.0, *)) {
|
||||
UIView *view = reinterpret_cast<UIView *>(m_window->winId());
|
||||
info.limits.colorComponentValue.maxColorComponentValue = view.window.windowScene.screen.currentEDRHeadroom;
|
||||
info.isHardCodedDefaults = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
info.isHardCodedDefaults = false;
|
||||
// Must use m_window, not window, given this may be called before createOrResize().
|
||||
NSView *view = reinterpret_cast<NSView *>(m_window->winId());
|
||||
info.limits.colorComponentValue.maxColorComponentValue = view.window.screen.maximumExtendedDynamicRangeColorComponentValue;
|
||||
#else
|
||||
// ### Fixme: Maybe retrieve the brightness from the screen and if we're not at full brightness we might be able to do more.
|
||||
// For now, assume 2, in line with iPhone 12 specs that claim 625 nits max brightness and 1200 nits max HDR brightness.
|
||||
info.isHardCodedDefaults = true;
|
||||
info.limits.colorComponentValue.maxColorComponentValue = 2;
|
||||
#endif
|
||||
return info;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue