diff --git a/plugins/platforms/hwcomposer/egl_hwcomposer_backend.cpp b/plugins/platforms/hwcomposer/egl_hwcomposer_backend.cpp index 3c96db1185..5207545bdb 100644 --- a/plugins/platforms/hwcomposer/egl_hwcomposer_backend.cpp +++ b/plugins/platforms/hwcomposer/egl_hwcomposer_backend.cpp @@ -130,6 +130,10 @@ bool EglHwcomposerBackend::makeContextCurrent() qCWarning(KWIN_HWCOMPOSER) << "Error occurred while creating context " << error; return false; } + + const QSize overall = m_backend->size(); + glViewport(0, 0, overall.width(), overall.height()); + return true; } diff --git a/plugins/platforms/hwcomposer/hwcomposer_backend.cpp b/plugins/platforms/hwcomposer/hwcomposer_backend.cpp index 651d1e5756..da1ca11bdd 100644 --- a/plugins/platforms/hwcomposer/hwcomposer_backend.cpp +++ b/plugins/platforms/hwcomposer/hwcomposer_backend.cpp @@ -27,6 +27,8 @@ along with this program. If not, see . #include "wayland_server.h" // KWayland #include +// KDE +#include // Qt #include #include @@ -253,7 +255,7 @@ void HwcomposerBackend::init() setReady(true); } -QSize HwcomposerBackend::screenSize() const +QSize HwcomposerBackend::size() const { if (m_output) { return m_output->pixelSize(); @@ -261,6 +263,22 @@ QSize HwcomposerBackend::screenSize() const return QSize(); } +QSize HwcomposerBackend::screenSize() const +{ + if (m_output) { + return m_output->pixelSize() / m_output->scale(); + } + return QSize(); +} + +int HwcomposerBackend::scale() const + { + if (m_output) { + return m_output->scale(); + } + return 1; +} + void HwcomposerBackend::initLights() { hw_module_t *lightsModule = nullptr; @@ -510,6 +528,9 @@ HwcomposerOutput::HwcomposerOutput(hwc_composer_device_1_t *device) setInternal(true); setEnabled(true); setDpmsSupported(true); + + const auto outputGroup = kwinApp()->config()->group("HWComposerOutputs").group("0"); + setScale(outputGroup.readEntry("Scale", 1)); setWaylandMode(m_pixelSize, mode.refreshRate); } diff --git a/plugins/platforms/hwcomposer/hwcomposer_backend.h b/plugins/platforms/hwcomposer/hwcomposer_backend.h index 32d3dd7fc9..35fbfb7af2 100644 --- a/plugins/platforms/hwcomposer/hwcomposer_backend.h +++ b/plugins/platforms/hwcomposer/hwcomposer_backend.h @@ -80,11 +80,11 @@ public: Outputs outputs() const override; Outputs enabledOutputs() const override; - QSize size() const { - return screenSize(); - } + QSize size() const; QSize screenSize() const override; + int scale() const; + HwcomposerWindow *createSurface(); hwc_composer_device_1_t *device() const {