backends/drm: fix some problems with rotation

source and buffer rotation / sizes were used wrongly in a few places
This commit is contained in:
Xaver Hugl 2022-04-20 15:38:01 +02:00
parent c3954eab8f
commit d2d0049213
5 changed files with 8 additions and 21 deletions

View file

@ -30,7 +30,7 @@ DrmLeaseEglGbmLayer::DrmLeaseEglGbmLayer(EglGbmBackend *backend, DrmPipeline *pi
QSharedPointer<DrmBuffer> DrmLeaseEglGbmLayer::testBuffer()
{
const auto mods = m_pipeline->formats().value(DRM_FORMAT_XRGB8888);
const auto size = m_pipeline->sourceSize();
const auto size = m_pipeline->bufferSize();
if (!m_buffer || m_buffer->size() != size || !(mods.isEmpty() || mods.contains(m_buffer->modifier()))) {
gbm_bo *newBo;
if (mods.isEmpty()) {

View file

@ -368,15 +368,6 @@ QSize DrmPipeline::bufferSize() const
return modeSize;
}
QSize DrmPipeline::sourceSize() const
{
const auto modeSize = pending.mode->size();
if (pending.sourceTransformation & (DrmPlane::Transformation::Rotate90 | DrmPlane::Transformation::Rotate270)) {
return modeSize.transposed();
}
return modeSize;
}
bool DrmPipeline::isCursorVisible() const
{
const QRect mode = QRect(QPoint(), pending.mode->size());

View file

@ -79,10 +79,6 @@ public:
bool modesetPresentPending() const;
void resetModesetPresentPending();
void printDebugInfo() const;
/**
* which size buffers for rendering should have
*/
QSize sourceSize() const;
/**
* what size buffers submitted to this pipeline should have
*/

View file

@ -33,7 +33,7 @@ DrmQPainterLayer::DrmQPainterLayer(DrmQPainterBackend *backend, DrmPipeline *pip
OutputLayerBeginFrameInfo DrmQPainterLayer::beginFrame()
{
if (!doesSwapchainFit()) {
m_swapchain = QSharedPointer<DumbSwapchain>::create(m_pipeline->gpu(), m_pipeline->sourceSize(), DRM_FORMAT_XRGB8888);
m_swapchain = QSharedPointer<DumbSwapchain>::create(m_pipeline->gpu(), m_pipeline->bufferSize(), DRM_FORMAT_XRGB8888);
}
QRegion needsRepaint;
if (!m_swapchain->acquireBuffer(&needsRepaint)) {
@ -55,14 +55,14 @@ void DrmQPainterLayer::endFrame(const QRegion &renderedRegion, const QRegion &da
QSharedPointer<DrmBuffer> DrmQPainterLayer::testBuffer()
{
if (!doesSwapchainFit()) {
m_swapchain = QSharedPointer<DumbSwapchain>::create(m_pipeline->gpu(), m_pipeline->sourceSize(), DRM_FORMAT_XRGB8888);
m_swapchain = QSharedPointer<DumbSwapchain>::create(m_pipeline->gpu(), m_pipeline->bufferSize(), DRM_FORMAT_XRGB8888);
}
return m_swapchain->currentBuffer();
}
bool DrmQPainterLayer::doesSwapchainFit() const
{
return m_swapchain && m_swapchain->size() == m_pipeline->sourceSize();
return m_swapchain && m_swapchain->size() == m_pipeline->bufferSize();
}
QSharedPointer<DrmBuffer> DrmQPainterLayer::currentBuffer() const
@ -112,7 +112,7 @@ DrmLeaseQPainterLayer::DrmLeaseQPainterLayer(DrmQPainterBackend *backend, DrmPip
QSharedPointer<DrmBuffer> DrmLeaseQPainterLayer::testBuffer()
{
const auto size = m_pipeline->sourceSize();
const auto size = m_pipeline->bufferSize();
if (!m_buffer || m_buffer->size() != size) {
m_buffer = QSharedPointer<DrmDumbBuffer>::create(m_pipeline->gpu(), size, DRM_FORMAT_XRGB8888);
}

View file

@ -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.bufferTransformation, damagedRegion);
const auto ret = m_surface.endRendering(m_pipeline->pending.sourceTransformation, damagedRegion);
if (ret.has_value()) {
std::tie(m_currentBuffer, m_currentDamage) = ret.value();
}
@ -77,7 +77,7 @@ QRegion EglGbmLayer::currentDamage() const
QSharedPointer<DrmBuffer> EglGbmLayer::testBuffer()
{
if (!m_surface.doesSurfaceFit(m_pipeline->sourceSize(), m_pipeline->formats())) {
if (!m_surface.doesSurfaceFit(m_pipeline->bufferSize(), m_pipeline->formats())) {
renderTestBuffer();
}
return m_currentBuffer;
@ -115,7 +115,7 @@ bool EglGbmLayer::scanout(SurfaceItem *surfaceItem)
}
const auto surface = item->surface();
const auto buffer = qobject_cast<KWaylandServer::LinuxDmaBufV1ClientBuffer *>(surface->buffer());
if (!buffer || buffer->planes().isEmpty() || buffer->size() != m_pipeline->sourceSize()) {
if (!buffer || buffer->planes().isEmpty() || buffer->size() != m_pipeline->bufferSize()) {
return false;
}