backend/drm: drop drm_surface_{make,unset}_current

This commit is contained in:
Simon Ser 2021-07-12 17:22:22 +02:00
parent ebb661532c
commit 9b99570869
2 changed files with 0 additions and 32 deletions

View file

@ -72,8 +72,6 @@ bool init_drm_surface(struct wlr_drm_surface *surf,
surf->width = width; surf->width = width;
surf->height = height; surf->height = height;
wlr_buffer_unlock(surf->back_buffer);
surf->back_buffer = NULL;
wlr_swapchain_destroy(surf->swapchain); wlr_swapchain_destroy(surf->swapchain);
surf->swapchain = NULL; surf->swapchain = NULL;
@ -93,38 +91,11 @@ static void finish_drm_surface(struct wlr_drm_surface *surf) {
return; return;
} }
wlr_buffer_unlock(surf->back_buffer);
wlr_swapchain_destroy(surf->swapchain); wlr_swapchain_destroy(surf->swapchain);
memset(surf, 0, sizeof(*surf)); memset(surf, 0, sizeof(*surf));
} }
bool drm_surface_make_current(struct wlr_drm_surface *surf,
int *buffer_age) {
wlr_buffer_unlock(surf->back_buffer);
surf->back_buffer = wlr_swapchain_acquire(surf->swapchain, buffer_age);
if (surf->back_buffer == NULL) {
wlr_log(WLR_ERROR, "Failed to acquire swapchain buffer");
return false;
}
if (!renderer_bind_buffer(surf->renderer->wlr_rend, surf->back_buffer)) {
wlr_log(WLR_ERROR, "Failed to bind buffer to renderer");
return false;
}
return true;
}
void drm_surface_unset_current(struct wlr_drm_surface *surf) {
assert(surf->back_buffer != NULL);
renderer_bind_buffer(surf->renderer->wlr_rend, NULL);
wlr_buffer_unlock(surf->back_buffer);
surf->back_buffer = NULL;
}
struct wlr_buffer *drm_surface_blit(struct wlr_drm_surface *surf, struct wlr_buffer *drm_surface_blit(struct wlr_drm_surface *surf,
struct wlr_buffer *buffer) { struct wlr_buffer *buffer) {
struct wlr_renderer *renderer = surf->renderer->wlr_rend; struct wlr_renderer *renderer = surf->renderer->wlr_rend;

View file

@ -26,7 +26,6 @@ struct wlr_drm_surface {
uint32_t height; uint32_t height;
struct wlr_swapchain *swapchain; struct wlr_swapchain *swapchain;
struct wlr_buffer *back_buffer;
}; };
struct wlr_drm_fb { struct wlr_drm_fb {
@ -46,8 +45,6 @@ void finish_drm_renderer(struct wlr_drm_renderer *renderer);
bool init_drm_surface(struct wlr_drm_surface *surf, bool init_drm_surface(struct wlr_drm_surface *surf,
struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height, struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
const struct wlr_drm_format *drm_format); const struct wlr_drm_format *drm_format);
bool drm_surface_make_current(struct wlr_drm_surface *surf, int *buffer_age);
void drm_surface_unset_current(struct wlr_drm_surface *surf);
bool drm_fb_import(struct wlr_drm_fb **fb, struct wlr_drm_backend *drm, bool drm_fb_import(struct wlr_drm_fb **fb, struct wlr_drm_backend *drm,
struct wlr_buffer *buf, const struct wlr_drm_format_set *formats); struct wlr_buffer *buf, const struct wlr_drm_format_set *formats);