backends/drm: rename transformation variables to be more intuitive

This commit is contained in:
Xaver Hugl 2022-04-20 15:50:08 +02:00
parent d2d0049213
commit de73dfae35
7 changed files with 24 additions and 24 deletions

View file

@ -423,8 +423,8 @@ bool DrmGpu::testPendingConfiguration()
// try again without hw rotation
bool hwRotationUsed = false;
for (const auto &pipeline : qAsConst(m_pipelines)) {
hwRotationUsed |= (pipeline->pending.bufferTransformation != DrmPlane::Transformations(DrmPlane::Transformation::Rotate0));
pipeline->pending.bufferTransformation = DrmPlane::Transformation::Rotate0;
hwRotationUsed |= (pipeline->pending.bufferOrientation != DrmPlane::Transformations(DrmPlane::Transformation::Rotate0));
pipeline->pending.bufferOrientation = DrmPlane::Transformation::Rotate0;
}
return hwRotationUsed ? checkCrtcAssignment(connectors, crtcs) : false;
}

View file

@ -358,9 +358,9 @@ bool DrmOutput::queueChanges(const OutputConfiguration &config)
m_pipeline->pending.mode = *it;
m_pipeline->pending.overscan = props->overscan;
m_pipeline->pending.rgbRange = props->rgbRange;
m_pipeline->pending.sourceTransformation = outputToPlaneTransform(props->transform);
m_pipeline->pending.renderOrientation = outputToPlaneTransform(props->transform);
if (!envOnlySoftwareRotations && m_gpu->atomicModeSetting()) {
m_pipeline->pending.bufferTransformation = m_pipeline->pending.sourceTransformation;
m_pipeline->pending.bufferOrientation = m_pipeline->pending.renderOrientation;
}
m_pipeline->pending.enabled = props->enabled;
return true;

View file

@ -238,7 +238,7 @@ void DrmPipeline::prepareAtomicModeset()
pending.crtc->setPending(DrmCrtc::PropertyIndex::ModeId, activePending() ? pending.mode->blobId() : 0);
pending.crtc->primaryPlane()->setPending(DrmPlane::PropertyIndex::CrtcId, activePending() ? pending.crtc->id() : 0);
pending.crtc->primaryPlane()->setTransformation(pending.bufferTransformation);
pending.crtc->primaryPlane()->setTransformation(pending.bufferOrientation);
if (pending.crtc->cursorPlane()) {
pending.crtc->cursorPlane()->setTransformation(DrmPlane::Transformation::Rotate0);
}
@ -362,7 +362,7 @@ void DrmPipeline::applyPendingChanges()
QSize DrmPipeline::bufferSize() const
{
const auto modeSize = pending.mode->size();
if (pending.bufferTransformation & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) {
if (pending.bufferOrientation & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) {
return modeSize.transposed();
}
return modeSize;
@ -431,7 +431,7 @@ bool DrmPipeline::needsModeset() const
|| pending.active != m_current.active
|| pending.mode != m_current.mode
|| pending.rgbRange != m_current.rgbRange
|| pending.bufferTransformation != m_current.bufferTransformation
|| pending.bufferOrientation != m_current.bufferOrientation
|| m_connector->linkStatus() == DrmConnector::LinkStatus::Bad
|| m_modesetPresentPending;
}

View file

@ -108,9 +108,9 @@ public:
QSharedPointer<DrmDumbBuffer> cursorBo;
// the transformation that this pipeline will apply to submitted buffers
DrmPlane::Transformations bufferTransformation = DrmPlane::Transformation::Rotate0;
DrmPlane::Transformations bufferOrientation = DrmPlane::Transformation::Rotate0;
// the transformation that buffers submitted to the pipeline should have
DrmPlane::Transformations sourceTransformation = DrmPlane::Transformation::Rotate0;
DrmPlane::Transformations renderOrientation = DrmPlane::Transformation::Rotate0;
};
State pending;

View file

@ -53,7 +53,7 @@ OutputLayerBeginFrameInfo EglGbmLayer::beginFrame()
m_scanoutBuffer.reset();
m_dmabufFeedback.renderingSurface();
return m_surface.startRendering(m_pipeline->bufferSize(), m_pipeline->pending.sourceTransformation, m_pipeline->pending.bufferTransformation, m_pipeline->formats());
return m_surface.startRendering(m_pipeline->bufferSize(), m_pipeline->pending.renderOrientation, m_pipeline->pending.bufferOrientation, m_pipeline->formats());
}
void EglGbmLayer::aboutToStartPainting(const QRegion &damagedRegion)
@ -64,7 +64,7 @@ void EglGbmLayer::aboutToStartPainting(const QRegion &damagedRegion)
void EglGbmLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
{
Q_UNUSED(renderedRegion)
const auto ret = m_surface.endRendering(m_pipeline->pending.sourceTransformation, damagedRegion);
const auto ret = m_surface.endRendering(m_pipeline->pending.renderOrientation, damagedRegion);
if (ret.has_value()) {
std::tie(m_currentBuffer, m_currentDamage) = ret.value();
}

View file

@ -53,7 +53,7 @@ void EglGbmLayerSurface::destroyResources()
m_oldGbmSurface.reset();
}
OutputLayerBeginFrameInfo EglGbmLayerSurface::startRendering(const QSize &bufferSize, DrmPlane::Transformations renderTransform, DrmPlane::Transformations bufferTransform, const QMap<uint32_t, QVector<uint64_t>> &formats)
OutputLayerBeginFrameInfo EglGbmLayerSurface::startRendering(const QSize &bufferSize, DrmPlane::Transformations renderOrientation, DrmPlane::Transformations bufferOrientation, const QMap<uint32_t, QVector<uint64_t>> &formats)
{
// gbm surface
if (doesGbmSurfaceFit(m_gbmSurface.data(), bufferSize, formats)) {
@ -76,14 +76,14 @@ OutputLayerBeginFrameInfo EglGbmLayerSurface::startRendering(const QSize &buffer
}
// shadow buffer
const QSize renderSize = (renderTransform & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) ? m_gbmSurface->size().transposed() : m_gbmSurface->size();
if (doesShadowBufferFit(m_shadowBuffer.data(), renderSize, renderTransform, bufferTransform)) {
const QSize renderSize = (renderOrientation & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) ? m_gbmSurface->size().transposed() : m_gbmSurface->size();
if (doesShadowBufferFit(m_shadowBuffer.data(), renderSize, renderOrientation, bufferOrientation)) {
m_oldShadowBuffer.reset();
} else {
if (doesShadowBufferFit(m_oldShadowBuffer.data(), renderSize, renderTransform, bufferTransform)) {
if (doesShadowBufferFit(m_oldShadowBuffer.data(), renderSize, renderOrientation, bufferOrientation)) {
m_shadowBuffer = m_oldShadowBuffer;
} else {
if (renderTransform != bufferTransform) {
if (renderOrientation != bufferOrientation) {
const auto format = m_eglBackend->gbmFormatForDrmFormat(m_gbmSurface->format());
if (!format.has_value()) {
return {};
@ -125,12 +125,12 @@ void EglGbmLayerSurface::aboutToStartPainting(DrmOutput *output, const QRegion &
}
}
std::optional<std::tuple<QSharedPointer<DrmBuffer>, QRegion>> EglGbmLayerSurface::endRendering(DrmPlane::Transformations renderTransform, const QRegion &damagedRegion)
std::optional<std::tuple<QSharedPointer<DrmBuffer>, QRegion>> EglGbmLayerSurface::endRendering(DrmPlane::Transformations renderOrientation, const QRegion &damagedRegion)
{
if (m_shadowBuffer) {
GLFramebuffer::popFramebuffer();
// TODO handle bufferTransform != Rotate0
m_shadowBuffer->render(renderTransform);
// TODO handle bufferOrientation != Rotate0
m_shadowBuffer->render(renderOrientation);
}
GLFramebuffer::popFramebuffer();
QSharedPointer<DrmBuffer> buffer;
@ -230,9 +230,9 @@ bool EglGbmLayerSurface::doesGbmSurfaceFit(GbmSurface *surf, const QSize &size,
&& (surf->modifiers().isEmpty() || formats[surf->format()] == surf->modifiers());
}
bool EglGbmLayerSurface::doesShadowBufferFit(ShadowBuffer *buffer, const QSize &size, DrmPlane::Transformations renderTransform, DrmPlane::Transformations bufferTransform) const
bool EglGbmLayerSurface::doesShadowBufferFit(ShadowBuffer *buffer, const QSize &size, DrmPlane::Transformations renderOrientation, DrmPlane::Transformations bufferOrientation) const
{
if (renderTransform != bufferTransform) {
if (renderOrientation != bufferOrientation) {
return buffer && buffer->texture()->size() == size && buffer->drmFormat() == m_gbmSurface->format();
} else {
return buffer == nullptr;

View file

@ -41,9 +41,9 @@ public:
EglGbmLayerSurface(DrmGpu *gpu, EglGbmBackend *eglBackend);
~EglGbmLayerSurface();
OutputLayerBeginFrameInfo startRendering(const QSize &bufferSize, DrmPlane::Transformations renderTransform, DrmPlane::Transformations bufferTransform, const QMap<uint32_t, QVector<uint64_t>> &formats);
OutputLayerBeginFrameInfo startRendering(const QSize &bufferSize, DrmPlane::Transformations renderOrientation, DrmPlane::Transformations bufferOrientation, const QMap<uint32_t, QVector<uint64_t>> &formats);
void aboutToStartPainting(DrmOutput *output, const QRegion &damagedRegion);
std::optional<std::tuple<QSharedPointer<DrmBuffer>, QRegion>> endRendering(DrmPlane::Transformations renderTransform, const QRegion &damagedRegion);
std::optional<std::tuple<QSharedPointer<DrmBuffer>, QRegion>> endRendering(DrmPlane::Transformations renderOrientation, const QRegion &damagedRegion);
bool doesSurfaceFit(const QSize &size, const QMap<uint32_t, QVector<uint64_t>> &formats) const;
QSharedPointer<GLTexture> texture() const;
@ -55,7 +55,7 @@ private:
bool createGbmSurface(const QSize &size, const QMap<uint32_t, QVector<uint64_t>> &formats);
bool doesGbmSurfaceFit(GbmSurface *surf, const QSize &size, const QMap<uint32_t, QVector<uint64_t>> &formats) const;
bool doesShadowBufferFit(ShadowBuffer *buffer, const QSize &size, DrmPlane::Transformations renderTransform, DrmPlane::Transformations bufferTransform) const;
bool doesShadowBufferFit(ShadowBuffer *buffer, const QSize &size, DrmPlane::Transformations renderOrientation, DrmPlane::Transformations bufferOrientation) const;
bool doesSwapchainFit(DumbSwapchain *swapchain) const;
QSharedPointer<DrmBuffer> importBuffer();