diff --git a/plugins/platforms/drm/drm_buffer_gbm.cpp b/plugins/platforms/drm/drm_buffer_gbm.cpp index 136fbb828..11a0a2cd9 100644 --- a/plugins/platforms/drm/drm_buffer_gbm.cpp +++ b/plugins/platforms/drm/drm_buffer_gbm.cpp @@ -46,6 +46,7 @@ DrmSurfaceBuffer::DrmSurfaceBuffer(int fd, const std::shared_ptr &su return; } m_size = QSize(gbm_bo_get_width(m_bo), gbm_bo_get_height(m_bo)); + qCritical() << "creating buffer" << m_size; if (drmModeAddFB(fd, m_size.width(), m_size.height(), 24, 32, gbm_bo_get_stride(m_bo), gbm_bo_get_handle(m_bo).u32, &m_bufferId) != 0) { qCWarning(KWIN_DRM) << "drmModeAddFB failed"; } diff --git a/plugins/platforms/drm/drm_output.cpp b/plugins/platforms/drm/drm_output.cpp index bfc9d4026..eed6316a4 100644 --- a/plugins/platforms/drm/drm_output.cpp +++ b/plugins/platforms/drm/drm_output.cpp @@ -1031,13 +1031,19 @@ bool DrmOutput::doAtomicCommit(AtomicCommitMode mode) bool DrmOutput::atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable) { if (enable) { + int h = m_mode.hdisplay, v = m_mode.vdisplay; + if (orientation() == Qt::InvertedPortraitOrientation) + std::swap(v, h); + m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::SrcX), 0); m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::SrcY), 0); - m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::SrcW), m_mode.hdisplay << 16); - m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::SrcH), m_mode.vdisplay << 16); - m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::CrtcW), m_mode.hdisplay); - m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::CrtcH), m_mode.vdisplay); + m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::SrcW), h << 16); + m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::SrcH), v << 16); + m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::CrtcW), h); + m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::CrtcH), v); m_primaryPlane->setValue(int(DrmPlane::PropertyIndex::CrtcId), m_crtc->id()); + + qCritical() << "requested mode" << "xxxx" << h << v << orientation(); } else { if (m_backend->deleteBufferAfterPageFlip()) { delete m_primaryPlane->current(); diff --git a/plugins/platforms/drm/egl_gbm_backend.cpp b/plugins/platforms/drm/egl_gbm_backend.cpp index 48ec495b2..bb351e04a 100644 --- a/plugins/platforms/drm/egl_gbm_backend.cpp +++ b/plugins/platforms/drm/egl_gbm_backend.cpp @@ -170,8 +170,13 @@ bool EglGbmBackend::resetOutput(Output &o, DrmOutput *drmOutput) o.output = drmOutput; auto size = drmOutput->pixelSize(); + if (drmOutput->orientation() == Qt::InvertedPortraitOrientation) { + std::swap(size.rheight(), size.rwidth()); + } + auto gbmSurface = std::make_shared(m_backend->gbmDevice(), size.width(), size.height(), GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + qCritical() << "created gbm surface" << gbmSurface.get() << size; if (!gbmSurface) { qCCritical(KWIN_DRM) << "Create gbm surface failed"; return false; @@ -191,6 +196,7 @@ bool EglGbmBackend::resetOutput(Output &o, DrmOutput *drmOutput) o.eglSurface = eglSurface; o.gbmSurface = gbmSurface; } + qCritical() << "resetOutput!" << size; return true; } @@ -307,6 +313,9 @@ void EglGbmBackend::presentOnOutput(EglGbmBackend::Output &o) { eglSwapBuffers(eglDisplay(), o.eglSurface); o.buffer = m_backend->createBuffer(o.gbmSurface); + +// qDebug() << "presenting on output" << o.buffer->size() << o.output->pixelSize() << o.output->physicalSize(); + qDebug() << "presenting on output" << o.buffer << o.output->pixelSize() << o.output->physicalSize(); if(m_remoteaccessManager && gbm_surface_has_free_buffers(o.gbmSurface->surface())) { // GBM surface is released on page flip so // we should pass the buffer before it's presented @@ -322,8 +331,11 @@ void EglGbmBackend::presentOnOutput(EglGbmBackend::Output &o) void EglGbmBackend::screenGeometryChanged(const QSize &size) { - Q_UNUSED(size) - // TODO, create new buffer? + qCritical() << "new screen geometry" << size; + const auto outputs = m_backend->drmOutputs(); + for (DrmOutput *drmOutput: outputs) { + createOutput(drmOutput); + } } SceneOpenGLTexturePrivate *EglGbmBackend::createBackendTexture(SceneOpenGLTexture *texture) diff --git a/wayland_server.cpp b/wayland_server.cpp index 16220f42c..d52698ea1 100644 --- a/wayland_server.cpp +++ b/wayland_server.cpp @@ -225,10 +225,13 @@ public: const auto servicesFound = KServiceTypeTrader::self()->query(QStringLiteral("Application"), serviceQuery); if (servicesFound.isEmpty()) { + qCDebug(KWIN_CORE) << "could not find the desktop file for" << client->executablePath(); return {}; } - return servicesFound.first()->property("X-KDE-Wayland-Interfaces").toStringList(); + const auto interfaces = servicesFound.first()->property("X-KDE-Wayland-Interfaces").toStringList(); + qCDebug(KWIN_CORE) << "interfaces for" << client->executablePath() << interfaces; + return interfaces; } QSet interfacesBlackList = {"org_kde_kwin_remote_access_manager", "org_kde_plasma_window_management", "org_kde_kwin_fake_input", "org_kde_kwin_keystate"}; @@ -253,7 +256,6 @@ public: requestedInterfaces = fetchRequestedInterfaces(client); client->setProperty("requestedInterfaces", requestedInterfaces); } - qCDebug(KWIN_CORE) << "interfaces for" << client->executablePath() << requestedInterfaces << interfaceName << requestedInterfaces.toStringList().contains(QString::fromUtf8(interfaceName)); if (!requestedInterfaces.toStringList().contains(QString::fromUtf8(interfaceName))) { qCWarning(KWIN_CORE) << "Did not grant the interface" << interfaceName << "to" << client->executablePath() << ". Please request it under X-KDE-Wayland-Interfaces"; return false;