Re-enable proper gamma ramps with AMS

Instead of downgrading everyone else to legacy gamma, only exclude
the huge and buggy gamma ramp of Intel TIgerLake hardware.
master
Xaver Hugl 3 years ago
parent eb62728f1f
commit 4206046f12

@ -353,7 +353,8 @@ void ColorDevice::update()
uint16_t *blueChannel = gammaRamp.blue();
for (uint32_t i = 0; i < gammaRamp.size(); ++i) {
const uint16_t index = (i * 0xffff) / (gammaRamp.size() - 1);
// ensure 64 bit calculation to prevent overflows
const uint16_t index = (static_cast<uint64_t>(i) * 0xffff) / (gammaRamp.size() - 1);
const uint16_t in[3] = { index, index, index };
uint16_t out[3] = { 0 };

@ -24,6 +24,7 @@ DrmCrtc::DrmCrtc(DrmGpu *gpu, uint32_t crtcId, int pipeIndex, DrmPlane *primaryP
PropertyDefinition(QByteArrayLiteral("ACTIVE"), Requirement::Required),
PropertyDefinition(QByteArrayLiteral("VRR_ENABLED"), Requirement::Optional),
PropertyDefinition(QByteArrayLiteral("GAMMA_LUT"), Requirement::Optional),
PropertyDefinition(QByteArrayLiteral("GAMMA_LUT_SIZE"), Requirement::Optional)
}, DRM_MODE_OBJECT_CRTC)
, m_crtc(drmModeGetCrtc(gpu->fd(), crtcId))
, m_pipeIndex(pipeIndex)
@ -81,6 +82,10 @@ void DrmCrtc::setNext(const QSharedPointer<DrmBuffer> &buffer)
int DrmCrtc::gammaRampSize() const
{
// limit atomic gamma ramp to 4096 to work around https://gitlab.freedesktop.org/drm/intel/-/issues/3916
if (auto prop = getProp(PropertyIndex::Gamma_LUT_Size); prop && prop->current() <= 4096) {
return prop->current();
}
return m_crtc->gamma_size;
}

@ -34,6 +34,7 @@ public:
Active,
VrrEnabled,
Gamma_LUT,
Gamma_LUT_Size,
Count
};

Loading…
Cancel
Save