Changeset View
Standalone View
plugins/platforms/drm/egl_gbm_backend.cpp
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Line(s) | 134 | { | |||
---|---|---|---|---|---|
151 | 151 | | |||
152 | return makeContextCurrent(m_outputs.first()); | 152 | return makeContextCurrent(m_outputs.first()); | ||
153 | } | 153 | } | ||
154 | 154 | | |||
155 | void EglGbmBackend::createOutput(DrmOutput *drmOutput) | 155 | void EglGbmBackend::createOutput(DrmOutput *drmOutput) | ||
156 | { | 156 | { | ||
157 | Output o; | 157 | Output o; | ||
158 | o.output = drmOutput; | 158 | o.output = drmOutput; | ||
159 | o.gbmSurface = gbm_surface_create(m_backend->gbmDevice(), drmOutput->size().width(), drmOutput->size().height(), | 159 | auto size = drmOutput->pixelSize(); | ||
160 | | ||||
161 | o.gbmSurface = gbm_surface_create(m_backend->gbmDevice(), size.width(), size.height(), | ||||
romangg: You could add to `struct Output` a value for that, which you then use in makeContextCurrent. | |||||
Better: Add an additional variable of the "real" unscaled output size in DrmOutput with appropriate getter to also solve the rounding issue from the other Diff. romangg: Better: Add an additional variable of the "real" unscaled output size in DrmOutput with… | |||||
I like that. Taking that one step further. I'll just make size() the native size and adjust the rest of the code to that. davidedmundson: I like that. Taking that one step further. I'll just make size() the native size and adjust the… | |||||
Assuming that you mean with native size the unscaled output size: Just make sure that size() is not used anywhere in the compositor to determine the right rendering size for the compositor internal output representations (which should be native size divided by scaling factor if I've understood it correctly). romangg: Assuming that you mean with native size the unscaled output size: Just make sure that size() is… | |||||
160 | GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); | 162 | GBM_FORMAT_XRGB8888, GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); | ||
161 | if (!o.gbmSurface) { | 163 | if (!o.gbmSurface) { | ||
162 | qCCritical(KWIN_DRM) << "Create gbm surface failed"; | 164 | qCCritical(KWIN_DRM) << "Create gbm surface failed"; | ||
163 | return; | 165 | return; | ||
164 | } | 166 | } | ||
165 | o.eglSurface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), (void *)o.gbmSurface, nullptr); | 167 | o.eglSurface = eglCreatePlatformWindowSurfaceEXT(eglDisplay(), config(), (void *)o.gbmSurface, nullptr); | ||
166 | if (o.eglSurface == EGL_NO_SURFACE) { | 168 | if (o.eglSurface == EGL_NO_SURFACE) { | ||
167 | qCCritical(KWIN_DRM) << "Create Window Surface failed"; | 169 | qCCritical(KWIN_DRM) << "Create Window Surface failed"; | ||
Show All 18 Lines | 177 | { | |||
186 | if (error != EGL_SUCCESS) { | 188 | if (error != EGL_SUCCESS) { | ||
187 | qCWarning(KWIN_DRM) << "Error occurred while creating context " << error; | 189 | qCWarning(KWIN_DRM) << "Error occurred while creating context " << error; | ||
188 | return false; | 190 | return false; | ||
189 | } | 191 | } | ||
190 | // TODO: ensure the viewport is set correctly each time | 192 | // TODO: ensure the viewport is set correctly each time | ||
191 | const QSize &overall = screens()->size(); | 193 | const QSize &overall = screens()->size(); | ||
192 | const QRect &v = output.output->geometry(); | 194 | const QRect &v = output.output->geometry(); | ||
193 | // TODO: are the values correct? | 195 | // TODO: are the values correct? | ||
194 | glViewport(-v.x(), v.height() - overall.height() - v.y(), overall.width(), overall.height()); | 196 | | ||
197 | qreal scale = output.output->scale(); | ||||
198 | | ||||
I still don't think this is the right way to use scale here. But it's currently not possible to test it with scale > 1, is it? I tried to use the scale option from D3159, but initialOutputScale is currently only available for X11WindowedBackend. Can you make the test option usable in the DRM backend as well? This won't test different scale factors on multiple monitors though. romangg: I still don't think this is the right way to use scale here. But it's currently not possible to… | |||||
199 | glViewport(-v.x() * scale, (v.height() - overall.height() - v.y()) * scale, | ||||
200 | overall.width() * scale, overall.height() * scale); | ||||
195 | return true; | 201 | return true; | ||
196 | } | 202 | } | ||
197 | 203 | | |||
198 | bool EglGbmBackend::initBufferConfigs() | 204 | bool EglGbmBackend::initBufferConfigs() | ||
199 | { | 205 | { | ||
200 | const EGLint config_attribs[] = { | 206 | const EGLint config_attribs[] = { | ||
201 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | 207 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | ||
202 | EGL_RED_SIZE, 1, | 208 | EGL_RED_SIZE, 1, | ||
▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines |
You could add to struct Output a value for that, which you then use in makeContextCurrent.