backend/drm: add support for wlr_swapchain multi-GPU

master
Simon Ser 4 years ago
parent 8058e338ea
commit c881008e1c

@ -292,11 +292,12 @@ void drm_fb_clear(struct wlr_drm_fb *fb) {
fb->bo = NULL; fb->bo = NULL;
if (fb->mgpu_bo) { if (fb->mgpu_bo) {
// TODO assert(fb->mgpu_surf);
/*assert(fb->mgpu_surf); gbm_bo_destroy(fb->mgpu_bo);
gbm_surface_release_buffer(fb->mgpu_surf->gbm, fb->mgpu_bo); wlr_buffer_unlock(fb->mgpu_wlr_buf);
fb->mgpu_bo = NULL; fb->mgpu_bo = NULL;
fb->mgpu_surf = NULL;*/ fb->mgpu_wlr_buf = NULL;
fb->mgpu_surf = NULL;
} }
} }
@ -430,18 +431,15 @@ struct gbm_bo *drm_fb_acquire(struct wlr_drm_fb *fb, struct wlr_drm_backend *drm
wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f); wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f);
wlr_renderer_end(renderer); wlr_renderer_end(renderer);
// TODO struct wlr_drm_fb mgpu_fb = {
/*if (!wlr_egl_swap_buffers(&mgpu->renderer->egl, mgpu->egl, NULL)) { .bo = fb->mgpu_bo,
wlr_log(WLR_ERROR, "Failed to swap buffers"); .wlr_buf = fb->mgpu_wlr_buf,
return NULL; };
} if (!drm_fb_lock_surface(&mgpu_fb, mgpu)) {
return false;
fb->mgpu_bo = gbm_surface_lock_front_buffer(mgpu->gbm);
if (!fb->mgpu_bo) {
wlr_log(WLR_ERROR, "Failed to lock front buffer");
return NULL;
} }
fb->mgpu_bo = mgpu_fb.bo;
fb->mgpu_surf = mgpu;*/ fb->mgpu_wlr_buf = mgpu_fb.wlr_buf;
fb->mgpu_surf = mgpu;
return fb->mgpu_bo; return fb->mgpu_bo;
} }

@ -39,6 +39,7 @@ struct wlr_drm_fb {
struct wlr_drm_surface *mgpu_surf; struct wlr_drm_surface *mgpu_surf;
struct gbm_bo *mgpu_bo; struct gbm_bo *mgpu_bo;
struct wlr_buffer *mgpu_wlr_buf;
}; };
bool init_drm_renderer(struct wlr_drm_backend *drm, bool init_drm_renderer(struct wlr_drm_backend *drm,

Loading…
Cancel
Save