aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/drm/drm.c11
-rw-r--r--backend/drm/renderer.c14
-rw-r--r--include/backend/drm/renderer.h4
3 files changed, 13 insertions, 16 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 32fbb35b..337d38d8 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -486,9 +486,8 @@ static bool drm_connector_commit_buffer(struct wlr_output *output) {
assert(output->pending.committed & WLR_OUTPUT_STATE_BUFFER);
switch (output->pending.buffer_type) {
case WLR_OUTPUT_STATE_BUFFER_RENDER:
- if (!drm_fb_lock_surface(&plane->pending_fb, drm, &plane->surf,
- &plane->mgpu_surf)) {
- wlr_drm_conn_log(conn, WLR_ERROR, "drm_fb_lock_surface failed");
+ if (!drm_plane_lock_surface(plane, drm)) {
+ wlr_drm_conn_log(conn, WLR_ERROR, "drm_plane_lock_surface failed");
return false;
}
break;
@@ -681,8 +680,7 @@ static bool drm_connector_pageflip_renderer(struct wlr_drm_connector *conn) {
if (!drm_surface_render_black_frame(&plane->surf)) {
return false;
}
- if (!drm_fb_lock_surface(&plane->pending_fb, drm, &plane->surf,
- &plane->mgpu_surf)) {
+ if (!drm_plane_lock_surface(plane, drm)) {
return false;
}
}
@@ -949,8 +947,7 @@ static bool drm_connector_set_cursor(struct wlr_output *output,
wlr_render_texture_with_matrix(rend, texture, matrix, 1.0);
wlr_renderer_end(rend);
- if (!drm_fb_lock_surface(&plane->pending_fb, drm, &plane->surf,
- &plane->mgpu_surf)) {
+ if (!drm_plane_lock_surface(plane, drm)) {
return false;
}
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
index d3b2c8b7..ae9e2dce 100644
--- a/backend/drm/renderer.c
+++ b/backend/drm/renderer.c
@@ -294,17 +294,17 @@ void drm_fb_clear(struct wlr_drm_fb **fb_ptr) {
*fb_ptr = NULL;
}
-bool drm_fb_lock_surface(struct wlr_drm_fb **fb_ptr, struct wlr_drm_backend *drm,
- struct wlr_drm_surface *surf, struct wlr_drm_surface *mgpu) {
- assert(surf->back_buffer != NULL);
-
- struct wlr_buffer *buffer = wlr_buffer_lock(surf->back_buffer);
+bool drm_plane_lock_surface(struct wlr_drm_plane *plane,
+ struct wlr_drm_backend *drm) {
+ assert(plane->surf.back_buffer != NULL);
+ struct wlr_buffer *buffer = wlr_buffer_lock(plane->surf.back_buffer);
// Unset the current EGL context ASAP, because other operations may require
// making another context current.
- drm_surface_unset_current(surf);
+ drm_surface_unset_current(&plane->surf);
- bool ok = drm_fb_import(fb_ptr, drm, buffer, mgpu, NULL);
+ bool ok = drm_fb_import(&plane->pending_fb, drm, buffer,
+ &plane->mgpu_surf, NULL);
wlr_buffer_unlock(buffer);
return ok;
}
diff --git a/include/backend/drm/renderer.h b/include/backend/drm/renderer.h
index fdc8a75d..e0ed8dac 100644
--- a/include/backend/drm/renderer.h
+++ b/include/backend/drm/renderer.h
@@ -46,8 +46,6 @@ void finish_drm_renderer(struct wlr_drm_renderer *renderer);
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_lock_surface(struct wlr_drm_fb **fb, struct wlr_drm_backend *drm,
- struct wlr_drm_surface *surf, struct wlr_drm_surface *mgpu);
bool drm_fb_import(struct wlr_drm_fb **fb, struct wlr_drm_backend *drm,
struct wlr_buffer *buf, struct wlr_drm_surface *mgpu,
const struct wlr_drm_format_set *formats);
@@ -62,5 +60,7 @@ bool drm_plane_init_surface(struct wlr_drm_plane *plane,
struct wlr_drm_backend *drm, int32_t width, uint32_t height,
uint32_t format, bool with_modifiers);
void drm_plane_finish_surface(struct wlr_drm_plane *plane);
+bool drm_plane_lock_surface(struct wlr_drm_plane *plane,
+ struct wlr_drm_backend *drm);
#endif