Implment DRM EGL scaling
Summary: We need to set the viewport so that we scale from device pixels to global compositor space. Test Plan: Ran kwin_wayland properly on my laptop without setting KWIN_COMPOSE. Most things worked. Reviewers: #plasma Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D3504
This commit is contained in:
parent
61bb907bb4
commit
86b7189b8f
1 changed files with 8 additions and 2 deletions
|
@ -156,7 +156,9 @@ void EglGbmBackend::createOutput(DrmOutput *drmOutput)
|
||||||
{
|
{
|
||||||
Output o;
|
Output o;
|
||||||
o.output = drmOutput;
|
o.output = drmOutput;
|
||||||
o.gbmSurface = gbm_surface_create(m_backend->gbmDevice(), drmOutput->size().width(), drmOutput->size().height(),
|
auto size = drmOutput->pixelSize();
|
||||||
|
|
||||||
|
o.gbmSurface = gbm_surface_create(m_backend->gbmDevice(), size.width(), size.height(),
|
||||||
GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
||||||
if (!o.gbmSurface) {
|
if (!o.gbmSurface) {
|
||||||
qCCritical(KWIN_DRM) << "Create gbm surface failed";
|
qCCritical(KWIN_DRM) << "Create gbm surface failed";
|
||||||
|
@ -191,7 +193,11 @@ bool EglGbmBackend::makeContextCurrent(const Output &output)
|
||||||
const QSize &overall = screens()->size();
|
const QSize &overall = screens()->size();
|
||||||
const QRect &v = output.output->geometry();
|
const QRect &v = output.output->geometry();
|
||||||
// TODO: are the values correct?
|
// TODO: are the values correct?
|
||||||
glViewport(-v.x(), v.height() - overall.height() - v.y(), overall.width(), overall.height());
|
|
||||||
|
qreal scale = output.output->scale();
|
||||||
|
|
||||||
|
glViewport(-v.x() * scale, (v.height() - overall.height() - v.y()) * scale,
|
||||||
|
overall.width() * scale, overall.height() * scale);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue