backends/drm: always do color management on NVidia GPUs
This comes with a small performance hit but ensures that night color works BUG: 450327 BUG: 468895
This commit is contained in:
parent
964254e2a5
commit
cdafbbbd6f
6 changed files with 14 additions and 8 deletions
|
@ -46,7 +46,7 @@ EglGbmCursorLayer::EglGbmCursorLayer(EglGbmBackend *eglBackend, DrmPipeline *pip
|
|||
|
||||
std::optional<OutputLayerBeginFrameInfo> EglGbmCursorLayer::beginFrame()
|
||||
{
|
||||
return m_surface.startRendering(m_pipeline->gpu()->cursorSize(), drmToTextureRotation(m_pipeline) | TextureTransform::MirrorY, m_pipeline->cursorFormats(), m_pipeline->colorDescription(), m_pipeline->output()->channelFactors());
|
||||
return m_surface.startRendering(m_pipeline->gpu()->cursorSize(), drmToTextureRotation(m_pipeline) | TextureTransform::MirrorY, m_pipeline->cursorFormats(), m_pipeline->colorDescription(), m_pipeline->output()->channelFactors(), m_pipeline->output()->needsColormanagement());
|
||||
}
|
||||
|
||||
bool EglGbmCursorLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
|
||||
|
|
|
@ -59,7 +59,7 @@ std::optional<OutputLayerBeginFrameInfo> EglGbmLayer::beginFrame()
|
|||
m_scanoutBuffer.reset();
|
||||
m_dmabufFeedback.renderingSurface();
|
||||
|
||||
return m_surface.startRendering(m_pipeline->mode()->size(), drmToTextureRotation(m_pipeline) | TextureTransform::MirrorY, m_pipeline->formats(), m_pipeline->colorDescription(), m_pipeline->output()->channelFactors());
|
||||
return m_surface.startRendering(m_pipeline->mode()->size(), drmToTextureRotation(m_pipeline) | TextureTransform::MirrorY, m_pipeline->formats(), m_pipeline->colorDescription(), m_pipeline->output()->channelFactors(), m_pipeline->output()->needsColormanagement());
|
||||
}
|
||||
|
||||
bool EglGbmLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
|
||||
|
|
|
@ -59,7 +59,7 @@ void EglGbmLayerSurface::destroyResources()
|
|||
m_oldSurface = {};
|
||||
}
|
||||
|
||||
std::optional<OutputLayerBeginFrameInfo> EglGbmLayerSurface::startRendering(const QSize &bufferSize, TextureTransforms transformation, const QMap<uint32_t, QVector<uint64_t>> &formats, const ColorDescription &colorDescription, const QVector3D &channelFactors)
|
||||
std::optional<OutputLayerBeginFrameInfo> EglGbmLayerSurface::startRendering(const QSize &bufferSize, TextureTransforms transformation, const QMap<uint32_t, QVector<uint64_t>> &formats, const ColorDescription &colorDescription, const QVector3D &channelFactors, bool enableColormanagement)
|
||||
{
|
||||
if (!checkSurface(bufferSize, formats)) {
|
||||
return std::nullopt;
|
||||
|
@ -102,7 +102,7 @@ std::optional<OutputLayerBeginFrameInfo> EglGbmLayerSurface::startRendering(cons
|
|||
m_surface.intermediaryColorDescription = colorDescription;
|
||||
}
|
||||
}
|
||||
if (m_surface.intermediaryColorDescription != colorDescription) {
|
||||
if (enableColormanagement) {
|
||||
if (!m_surface.shadowBuffer) {
|
||||
m_surface.shadowTexture = std::make_shared<GLTexture>(GL_RGBA16F, m_surface.gbmSwapchain->size());
|
||||
m_surface.shadowBuffer = std::make_shared<GLFramebuffer>(m_surface.shadowTexture.get());
|
||||
|
@ -123,7 +123,7 @@ std::optional<OutputLayerBeginFrameInfo> EglGbmLayerSurface::startRendering(cons
|
|||
|
||||
bool EglGbmLayerSurface::endRendering(const QRegion &damagedRegion)
|
||||
{
|
||||
if (m_surface.intermediaryColorDescription != m_surface.targetColorDescription) {
|
||||
if (m_surface.shadowTexture) {
|
||||
const auto &[texture, fbo] = m_surface.textureCache[m_surface.currentBuffer->bo()];
|
||||
GLFramebuffer::pushFramebuffer(fbo.get());
|
||||
ShaderBinder binder(ShaderTrait::MapTexture | ShaderTrait::TransformColorspace);
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
EglGbmLayerSurface(DrmGpu *gpu, EglGbmBackend *eglBackend, BufferTarget target = BufferTarget::Normal, FormatOption formatOption = FormatOption::PreferAlpha);
|
||||
~EglGbmLayerSurface();
|
||||
|
||||
std::optional<OutputLayerBeginFrameInfo> startRendering(const QSize &bufferSize, TextureTransforms transformation, const QMap<uint32_t, QVector<uint64_t>> &formats, const ColorDescription &colorDescription, const QVector3D &channelFactors);
|
||||
std::optional<OutputLayerBeginFrameInfo> startRendering(const QSize &bufferSize, TextureTransforms transformation, const QMap<uint32_t, QVector<uint64_t>> &formats, const ColorDescription &colorDescription, const QVector3D &channelFactors, bool enableColormanagement);
|
||||
bool endRendering(const QRegion &damagedRegion);
|
||||
|
||||
bool doesSurfaceFit(const QSize &size, const QMap<uint32_t, QVector<uint64_t>> &formats) const;
|
||||
|
|
|
@ -479,7 +479,7 @@ DrmOutputLayer *DrmOutput::cursorLayer() const
|
|||
|
||||
bool DrmOutput::setGammaRamp(const std::shared_ptr<ColorTransformation> &transformation)
|
||||
{
|
||||
if (!m_pipeline->active() || m_pipeline->colorimetry() != NamedColorimetry::BT709 || m_pipeline->transferFunction() != NamedTransferFunction::sRGB) {
|
||||
if (!m_pipeline->active() || needsColormanagement()) {
|
||||
return false;
|
||||
}
|
||||
m_pipeline->setGammaRamp(transformation);
|
||||
|
@ -500,7 +500,7 @@ bool DrmOutput::setChannelFactors(const QVector3D &rgb)
|
|||
return true;
|
||||
}
|
||||
m_channelFactors = rgb;
|
||||
if (m_pipeline->colorimetry() == NamedColorimetry::BT709 && m_pipeline->transferFunction() == NamedTransferFunction::sRGB) {
|
||||
if (needsColormanagement()) {
|
||||
if (!m_pipeline->active()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -527,4 +527,9 @@ QVector3D DrmOutput::channelFactors() const
|
|||
{
|
||||
return m_channelFactors;
|
||||
}
|
||||
|
||||
bool DrmOutput::needsColormanagement() const
|
||||
{
|
||||
return m_pipeline->colorimetry() != NamedColorimetry::BT709 || m_pipeline->transferFunction() != NamedTransferFunction::sRGB || m_gpu->isNVidia();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
bool setGammaRamp(const std::shared_ptr<ColorTransformation> &transformation) override;
|
||||
bool setChannelFactors(const QVector3D &rgb) override;
|
||||
QVector3D channelFactors() const;
|
||||
bool needsColormanagement() const;
|
||||
|
||||
private:
|
||||
bool setDrmDpmsMode(DpmsMode mode);
|
||||
|
|
Loading…
Reference in a new issue