Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/egl_gbm_backend.cpp
Show First 20 Lines • Show All 209 Lines • ▼ Show 20 Line(s) | 202 | [drmOutput, this] { | |||
---|---|---|---|---|---|
210 | } | 210 | } | ||
211 | resetOutput(*it, drmOutput); | 211 | resetOutput(*it, drmOutput); | ||
212 | } | 212 | } | ||
213 | ); | 213 | ); | ||
214 | m_outputs << o; | 214 | m_outputs << o; | ||
215 | } | 215 | } | ||
216 | } | 216 | } | ||
217 | 217 | | |||
218 | bool EglGbmBackend::makeContextCurrent(const Output &output) | 218 | bool EglGbmBackend::makeContextCurrent(const Output &_output) | ||
219 | { | 219 | { | ||
220 | const EGLSurface surface = output.eglSurface; | 220 | const EGLSurface surface = _output.eglSurface; | ||
221 | if (surface == EGL_NO_SURFACE) { | 221 | if (surface == EGL_NO_SURFACE) { | ||
222 | return false; | 222 | return false; | ||
223 | } | 223 | } | ||
224 | if (eglMakeCurrent(eglDisplay(), surface, surface, context()) == EGL_FALSE) { | 224 | if (eglMakeCurrent(eglDisplay(), surface, surface, context()) == EGL_FALSE) { | ||
225 | qCCritical(KWIN_DRM) << "Make Context Current failed"; | 225 | qCCritical(KWIN_DRM) << "Make Context Current failed"; | ||
226 | return false; | 226 | return false; | ||
227 | } | 227 | } | ||
228 | 228 | | |||
229 | EGLint error = eglGetError(); | 229 | EGLint error = eglGetError(); | ||
230 | if (error != EGL_SUCCESS) { | 230 | if (error != EGL_SUCCESS) { | ||
231 | qCWarning(KWIN_DRM) << "Error occurred while creating context " << error; | 231 | qCWarning(KWIN_DRM) << "Error occurred while creating context " << error; | ||
232 | return false; | 232 | return false; | ||
233 | } | 233 | } | ||
234 | // TODO: ensure the viewport is set correctly each time | | |||
235 | const QSize &overall = screens()->size(); | | |||
236 | const QRect &v = output.output->geometry(); | | |||
237 | // TODO: are the values correct? | | |||
238 | | ||||
239 | qreal scale = output.output->scale(); | | |||
240 | 234 | | |||
235 | DrmOutput* output = _output.output; | ||||
zzag: Abuse of `auto`. | |||||
Please align pointers to the right. Side note: It would be great to use clang-format so we don't have to deal with coding style issues. zzag: Please align pointers to the right.
Side note: It would be great to use clang-format so we… | |||||
236 | const QRect v = orientateRect(output, output->geometry()); | ||||
237 | const qreal scale = output->scale(); | ||||
238 | const QSize overall = screens()->size(); | ||||
239 | const QSize orientedOverall = output->orientateSize(overall) * scale; | ||||
241 | glViewport(-v.x() * scale, (v.height() - overall.height() + v.y()) * scale, | 240 | glViewport(-v.x() * scale, (v.height() - overall.height() + v.y()) * scale, | ||
242 | overall.width() * scale, overall.height() * scale); | 241 | orientedOverall.width(), orientedOverall.height()); | ||
242 | | ||||
243 | return true; | 243 | return true; | ||
244 | } | 244 | } | ||
245 | 245 | | |||
246 | bool EglGbmBackend::initBufferConfigs() | 246 | bool EglGbmBackend::initBufferConfigs() | ||
247 | { | 247 | { | ||
248 | const EGLint config_attribs[] = { | 248 | const EGLint config_attribs[] = { | ||
249 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | 249 | EGL_SURFACE_TYPE, EGL_WINDOW_BIT, | ||
250 | EGL_RED_SIZE, 1, | 250 | EGL_RED_SIZE, 1, | ||
▲ Show 20 Lines • Show All 176 Lines • Show Last 20 Lines |
Abuse of auto.