backends/drm: rename transformation variables to be more intuitive
This commit is contained in:
parent
d2d0049213
commit
de73dfae35
7 changed files with 24 additions and 24 deletions
|
@ -423,8 +423,8 @@ bool DrmGpu::testPendingConfiguration()
|
||||||
// try again without hw rotation
|
// try again without hw rotation
|
||||||
bool hwRotationUsed = false;
|
bool hwRotationUsed = false;
|
||||||
for (const auto &pipeline : qAsConst(m_pipelines)) {
|
for (const auto &pipeline : qAsConst(m_pipelines)) {
|
||||||
hwRotationUsed |= (pipeline->pending.bufferTransformation != DrmPlane::Transformations(DrmPlane::Transformation::Rotate0));
|
hwRotationUsed |= (pipeline->pending.bufferOrientation != DrmPlane::Transformations(DrmPlane::Transformation::Rotate0));
|
||||||
pipeline->pending.bufferTransformation = DrmPlane::Transformation::Rotate0;
|
pipeline->pending.bufferOrientation = DrmPlane::Transformation::Rotate0;
|
||||||
}
|
}
|
||||||
return hwRotationUsed ? checkCrtcAssignment(connectors, crtcs) : false;
|
return hwRotationUsed ? checkCrtcAssignment(connectors, crtcs) : false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,9 +358,9 @@ bool DrmOutput::queueChanges(const OutputConfiguration &config)
|
||||||
m_pipeline->pending.mode = *it;
|
m_pipeline->pending.mode = *it;
|
||||||
m_pipeline->pending.overscan = props->overscan;
|
m_pipeline->pending.overscan = props->overscan;
|
||||||
m_pipeline->pending.rgbRange = props->rgbRange;
|
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()) {
|
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;
|
m_pipeline->pending.enabled = props->enabled;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -238,7 +238,7 @@ void DrmPipeline::prepareAtomicModeset()
|
||||||
pending.crtc->setPending(DrmCrtc::PropertyIndex::ModeId, activePending() ? pending.mode->blobId() : 0);
|
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()->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()) {
|
if (pending.crtc->cursorPlane()) {
|
||||||
pending.crtc->cursorPlane()->setTransformation(DrmPlane::Transformation::Rotate0);
|
pending.crtc->cursorPlane()->setTransformation(DrmPlane::Transformation::Rotate0);
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ void DrmPipeline::applyPendingChanges()
|
||||||
QSize DrmPipeline::bufferSize() const
|
QSize DrmPipeline::bufferSize() const
|
||||||
{
|
{
|
||||||
const auto modeSize = pending.mode->size();
|
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.transposed();
|
||||||
}
|
}
|
||||||
return modeSize;
|
return modeSize;
|
||||||
|
@ -431,7 +431,7 @@ bool DrmPipeline::needsModeset() const
|
||||||
|| pending.active != m_current.active
|
|| pending.active != m_current.active
|
||||||
|| pending.mode != m_current.mode
|
|| pending.mode != m_current.mode
|
||||||
|| pending.rgbRange != m_current.rgbRange
|
|| pending.rgbRange != m_current.rgbRange
|
||||||
|| pending.bufferTransformation != m_current.bufferTransformation
|
|| pending.bufferOrientation != m_current.bufferOrientation
|
||||||
|| m_connector->linkStatus() == DrmConnector::LinkStatus::Bad
|
|| m_connector->linkStatus() == DrmConnector::LinkStatus::Bad
|
||||||
|| m_modesetPresentPending;
|
|| m_modesetPresentPending;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,9 +108,9 @@ public:
|
||||||
QSharedPointer<DrmDumbBuffer> cursorBo;
|
QSharedPointer<DrmDumbBuffer> cursorBo;
|
||||||
|
|
||||||
// the transformation that this pipeline will apply to submitted buffers
|
// 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
|
// the transformation that buffers submitted to the pipeline should have
|
||||||
DrmPlane::Transformations sourceTransformation = DrmPlane::Transformation::Rotate0;
|
DrmPlane::Transformations renderOrientation = DrmPlane::Transformation::Rotate0;
|
||||||
};
|
};
|
||||||
State pending;
|
State pending;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ OutputLayerBeginFrameInfo EglGbmLayer::beginFrame()
|
||||||
m_scanoutBuffer.reset();
|
m_scanoutBuffer.reset();
|
||||||
m_dmabufFeedback.renderingSurface();
|
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)
|
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)
|
void EglGbmLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
|
||||||
{
|
{
|
||||||
Q_UNUSED(renderedRegion)
|
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()) {
|
if (ret.has_value()) {
|
||||||
std::tie(m_currentBuffer, m_currentDamage) = ret.value();
|
std::tie(m_currentBuffer, m_currentDamage) = ret.value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ void EglGbmLayerSurface::destroyResources()
|
||||||
m_oldGbmSurface.reset();
|
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
|
// gbm surface
|
||||||
if (doesGbmSurfaceFit(m_gbmSurface.data(), bufferSize, formats)) {
|
if (doesGbmSurfaceFit(m_gbmSurface.data(), bufferSize, formats)) {
|
||||||
|
@ -76,14 +76,14 @@ OutputLayerBeginFrameInfo EglGbmLayerSurface::startRendering(const QSize &buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
// shadow buffer
|
// shadow buffer
|
||||||
const QSize renderSize = (renderTransform & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) ? m_gbmSurface->size().transposed() : m_gbmSurface->size();
|
const QSize renderSize = (renderOrientation & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) ? m_gbmSurface->size().transposed() : m_gbmSurface->size();
|
||||||
if (doesShadowBufferFit(m_shadowBuffer.data(), renderSize, renderTransform, bufferTransform)) {
|
if (doesShadowBufferFit(m_shadowBuffer.data(), renderSize, renderOrientation, bufferOrientation)) {
|
||||||
m_oldShadowBuffer.reset();
|
m_oldShadowBuffer.reset();
|
||||||
} else {
|
} else {
|
||||||
if (doesShadowBufferFit(m_oldShadowBuffer.data(), renderSize, renderTransform, bufferTransform)) {
|
if (doesShadowBufferFit(m_oldShadowBuffer.data(), renderSize, renderOrientation, bufferOrientation)) {
|
||||||
m_shadowBuffer = m_oldShadowBuffer;
|
m_shadowBuffer = m_oldShadowBuffer;
|
||||||
} else {
|
} else {
|
||||||
if (renderTransform != bufferTransform) {
|
if (renderOrientation != bufferOrientation) {
|
||||||
const auto format = m_eglBackend->gbmFormatForDrmFormat(m_gbmSurface->format());
|
const auto format = m_eglBackend->gbmFormatForDrmFormat(m_gbmSurface->format());
|
||||||
if (!format.has_value()) {
|
if (!format.has_value()) {
|
||||||
return {};
|
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) {
|
if (m_shadowBuffer) {
|
||||||
GLFramebuffer::popFramebuffer();
|
GLFramebuffer::popFramebuffer();
|
||||||
// TODO handle bufferTransform != Rotate0
|
// TODO handle bufferOrientation != Rotate0
|
||||||
m_shadowBuffer->render(renderTransform);
|
m_shadowBuffer->render(renderOrientation);
|
||||||
}
|
}
|
||||||
GLFramebuffer::popFramebuffer();
|
GLFramebuffer::popFramebuffer();
|
||||||
QSharedPointer<DrmBuffer> buffer;
|
QSharedPointer<DrmBuffer> buffer;
|
||||||
|
@ -230,9 +230,9 @@ bool EglGbmLayerSurface::doesGbmSurfaceFit(GbmSurface *surf, const QSize &size,
|
||||||
&& (surf->modifiers().isEmpty() || formats[surf->format()] == surf->modifiers());
|
&& (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();
|
return buffer && buffer->texture()->size() == size && buffer->drmFormat() == m_gbmSurface->format();
|
||||||
} else {
|
} else {
|
||||||
return buffer == nullptr;
|
return buffer == nullptr;
|
||||||
|
|
|
@ -41,9 +41,9 @@ public:
|
||||||
EglGbmLayerSurface(DrmGpu *gpu, EglGbmBackend *eglBackend);
|
EglGbmLayerSurface(DrmGpu *gpu, EglGbmBackend *eglBackend);
|
||||||
~EglGbmLayerSurface();
|
~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);
|
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;
|
bool doesSurfaceFit(const QSize &size, const QMap<uint32_t, QVector<uint64_t>> &formats) const;
|
||||||
QSharedPointer<GLTexture> texture() const;
|
QSharedPointer<GLTexture> texture() const;
|
||||||
|
@ -55,7 +55,7 @@ private:
|
||||||
bool createGbmSurface(const QSize &size, const QMap<uint32_t, QVector<uint64_t>> &formats);
|
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 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;
|
bool doesSwapchainFit(DumbSwapchain *swapchain) const;
|
||||||
|
|
||||||
QSharedPointer<DrmBuffer> importBuffer();
|
QSharedPointer<DrmBuffer> importBuffer();
|
||||||
|
|
Loading…
Reference in a new issue