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
icc-effect-5.14.5
David Edmundson 2016-11-24 20:48:21 +00:00
parent 61bb907bb4
commit 86b7189b8f
1 changed files with 8 additions and 2 deletions

View File

@ -156,7 +156,9 @@ void EglGbmBackend::createOutput(DrmOutput *drmOutput)
{
Output o;
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);
if (!o.gbmSurface) {
qCCritical(KWIN_DRM) << "Create gbm surface failed";
@ -191,7 +193,11 @@ bool EglGbmBackend::makeContextCurrent(const Output &output)
const QSize &overall = screens()->size();
const QRect &v = output.output->geometry();
// 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;
}