From cfed5766b7c5e0bfc8af3b70ed1fd15b66af2642 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 19 May 2020 17:41:47 +0200 Subject: backend/drm: fix current EGL context on multi-GPU get_tex_for_bo changes the current EGL context. Rendering operations must immediately follow drm_surface_make_current. Closes: https://github.com/swaywm/wlroots/issues/2209 --- backend/drm/renderer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'backend/drm') diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 82077617..09546ee6 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -390,20 +390,19 @@ struct gbm_bo *drm_fb_acquire(struct wlr_drm_fb *fb, struct wlr_drm_backend *drm /* Perform copy across GPUs */ - struct wlr_renderer *renderer = mgpu->renderer->wlr_rend; - - if (!drm_surface_make_current(mgpu, NULL)) { + struct wlr_texture *tex = get_tex_for_bo(mgpu->renderer, fb->bo); + if (!tex) { return NULL; } - struct wlr_texture *tex = get_tex_for_bo(mgpu->renderer, fb->bo); - if (!tex) { + if (!drm_surface_make_current(mgpu, NULL)) { return NULL; } float mat[9]; wlr_matrix_projection(mat, 1, 1, WL_OUTPUT_TRANSFORM_NORMAL); + struct wlr_renderer *renderer = mgpu->renderer->wlr_rend; wlr_renderer_begin(renderer, mgpu->width, mgpu->height); wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 0.0 }); wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f); -- cgit v1.2.3