backends/drm: work around HDR screens being stupid about the minimum luminance

Apparently some HDR screens only show the minimum luminance if you send them a value of zero,
instead of the minimum luminance they report in the EDID. To work around that, assume the
minimum value of the transfer function instead of what the screen reports as the minimum.

BUG: 494128
wilder/Plasma/6.3
Xaver Hugl 1 year ago
parent 47f800c127
commit c8849b83c1
  1. 4
      src/backends/drm/drm_output.cpp

@ -394,7 +394,9 @@ ColorDescription DrmOutput::createColorDescription(const std::shared_ptr<OutputC
const double maxPeakBrightness = effectiveHdr ? props->maxPeakBrightnessOverride.value_or(m_state.maxPeakBrightnessOverride).value_or(m_connector->edid()->desiredMaxLuminance().value_or(800)) : 200;
const double referenceLuminance = effectiveHdr ? props->referenceLuminance.value_or(m_state.referenceLuminance) : maxPeakBrightness;
const auto transferFunction = TransferFunction{effectiveHdr ? TransferFunction::PerceptualQuantizer : TransferFunction::gamma22}.relativeScaledTo(referenceLuminance);
const double minBrightness = effectiveHdr ? props->minBrightnessOverride.value_or(m_state.minBrightnessOverride).value_or(m_connector->edid()->desiredMinLuminance()) : transferFunction.minLuminance;
// HDR screens are weird, sending them the min. luminance from the EDID does *not* make all of them present the darkest luminance the display can show
// to work around that, (unless overridden by the user), assume the min. luminance of the transfer function instead
const double minBrightness = effectiveHdr ? props->minBrightnessOverride.value_or(m_state.minBrightnessOverride).value_or(TransferFunction::defaultMinLuminanceFor(TransferFunction::PerceptualQuantizer)) : transferFunction.minLuminance;
return ColorDescription(containerColorimetry, transferFunction, referenceLuminance, minBrightness, maxAverageBrightness, maxPeakBrightness, masteringColorimetry, sdrColorimetry);
}

Loading…
Cancel
Save