diff options
author | Simon Ser <contact@emersion.fr> | 2021-04-06 19:40:52 +0200 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2021-06-13 10:57:17 +0200 |
commit | 758f117442c274aa37016b37b07b0bf548c636af (patch) | |
tree | bb899c46300c653799e8cb8ff1712c1d107e074f | |
parent | f55b43ddd6ba5ceb66f730d897920ddb7befd772 (diff) |
backend/drm: move drm_connector_set_pending_fb up
This will be used in drm_connector_test shortly.
-rw-r--r-- | backend/drm/drm.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index bff2b5d8..1f9a8384 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -414,6 +414,36 @@ static bool test_buffer(struct wlr_drm_connector *conn, return drm_crtc_commit(conn, &conn->output.pending, DRM_MODE_ATOMIC_TEST_ONLY); } +static bool drm_connector_set_pending_fb(struct wlr_drm_connector *conn, + const struct wlr_output_state *state) { + struct wlr_drm_backend *drm = conn->backend; + + struct wlr_drm_crtc *crtc = conn->crtc; + if (!crtc) { + return false; + } + struct wlr_drm_plane *plane = crtc->primary; + + assert(state->committed & WLR_OUTPUT_STATE_BUFFER); + switch (state->buffer_type) { + case WLR_OUTPUT_STATE_BUFFER_RENDER: + if (!drm_plane_lock_surface(plane, drm)) { + wlr_drm_conn_log(conn, WLR_ERROR, "drm_plane_lock_surface failed"); + return false; + } + break; + case WLR_OUTPUT_STATE_BUFFER_SCANOUT:; + if (!drm_fb_import(&plane->pending_fb, drm, state->buffer, + &crtc->primary->formats)) { + wlr_log(WLR_ERROR, "Failed to import buffer"); + return false; + } + break; + } + + return true; +} + static bool drm_connector_alloc_crtc(struct wlr_drm_connector *conn); static bool drm_connector_test(struct wlr_output *output) { @@ -447,36 +477,6 @@ static bool drm_connector_test(struct wlr_output *output) { return true; } -static bool drm_connector_set_pending_fb(struct wlr_drm_connector *conn, - const struct wlr_output_state *state) { - struct wlr_drm_backend *drm = conn->backend; - - struct wlr_drm_crtc *crtc = conn->crtc; - if (!crtc) { - return false; - } - struct wlr_drm_plane *plane = crtc->primary; - - assert(state->committed & WLR_OUTPUT_STATE_BUFFER); - switch (state->buffer_type) { - case WLR_OUTPUT_STATE_BUFFER_RENDER: - if (!drm_plane_lock_surface(plane, drm)) { - wlr_drm_conn_log(conn, WLR_ERROR, "drm_plane_lock_surface failed"); - return false; - } - break; - case WLR_OUTPUT_STATE_BUFFER_SCANOUT:; - if (!drm_fb_import(&plane->pending_fb, drm, state->buffer, - &crtc->primary->formats)) { - wlr_log(WLR_ERROR, "Failed to import buffer"); - return false; - } - break; - } - - return true; -} - bool drm_connector_supports_vrr(struct wlr_drm_connector *conn) { struct wlr_drm_backend *drm = conn->backend; |