diff options
author | Simon Ser <contact@emersion.fr> | 2020-05-19 17:41:47 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2020-05-19 21:32:38 +0200 |
commit | cfed5766b7c5e0bfc8af3b70ed1fd15b66af2642 (patch) | |
tree | 27fefac328bd807157a94588df125b541ae23567 /backend/drm | |
parent | 1edc42157bbb01b25ec27750f883fd84ee5908d6 (diff) |
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
Diffstat (limited to 'backend/drm')
-rw-r--r-- | backend/drm/renderer.c | 9 |
1 files changed, 4 insertions, 5 deletions
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); |