[platforms/hwcomposer] Add scaling support
Summary: Despite plasma frameworks doing it's own scaling with fonts, it's been requested to use kwin/wayland scaling. Like DRM, when kscreen is not used, scale value is loaded from a config file. Config format is [HWComposerOutputs][0] Scale=N The 0 is to map similarly to DRM and support multi-screen, but with a screen index rather than a UUID based on EDID. Because we don't support multi screen this is always 0 for now. Test Plan: Ran with the config value unset and with the config value at Scale=3. Reviewers: #kwin, romangg Reviewed By: #kwin, romangg Subscribers: bshah, romangg, nicolasfella, zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D18810
This commit is contained in:
parent
d6f98d1ecc
commit
3dc22d7d88
3 changed files with 29 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "wayland_server.h"
|
||||
// KWayland
|
||||
#include <KWayland/Server/output_interface.h>
|
||||
// KDE
|
||||
#include <KConfigGroup>
|
||||
// Qt
|
||||
#include <QKeyEvent>
|
||||
#include <QDBusConnection>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue