backend/drm: use new rendering API

master
Simon Ser 2 years ago committed by Alexander Orzechowski
parent 93a6acae9f
commit 8fe29e6bd1

@ -99,29 +99,36 @@ struct wlr_buffer *drm_surface_blit(struct wlr_drm_surface *surf,
struct wlr_buffer *dst = wlr_swapchain_acquire(surf->swapchain, NULL); struct wlr_buffer *dst = wlr_swapchain_acquire(surf->swapchain, NULL);
if (!dst) { if (!dst) {
wlr_log(WLR_ERROR, "Failed to acquire multi-GPU swapchain buffer"); wlr_log(WLR_ERROR, "Failed to acquire multi-GPU swapchain buffer");
wlr_texture_destroy(tex); goto error_tex;
return NULL;
} }
float mat[9]; struct wlr_render_pass *pass = wlr_renderer_begin_buffer_pass(renderer, dst);
wlr_matrix_identity(mat); if (pass == NULL) {
wlr_matrix_scale(mat, surf->swapchain->width, surf->swapchain->height); wlr_log(WLR_ERROR, "Failed to begin render pass with multi-GPU destination buffer");
goto error_dst;
if (!wlr_renderer_begin_with_buffer(renderer, dst)) {
wlr_log(WLR_ERROR, "Failed to bind multi-GPU destination buffer");
wlr_buffer_unlock(dst);
wlr_texture_destroy(tex);
return NULL;
} }
wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 0.0 }); wlr_render_pass_add_rect(pass, &(struct wlr_render_rect_options){
wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f); .box = { .width = dst->width, .height = dst->height },
.blend_mode = WLR_RENDER_BLEND_MODE_NONE,
wlr_renderer_end(renderer); });
wlr_render_pass_add_texture(pass, &(struct wlr_render_texture_options){
.texture = tex,
});
if (!wlr_render_pass_submit(pass)) {
wlr_log(WLR_ERROR, "Failed to submit multi-GPU render pass");
goto error_dst;
}
wlr_texture_destroy(tex); wlr_texture_destroy(tex);
return dst; return dst;
error_dst:
wlr_buffer_unlock(dst);
error_tex:
wlr_texture_destroy(tex);
return NULL;
} }

Loading…
Cancel
Save