aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-06 19:47:04 +0200
committerKenny Levinsen <kl@kl.wtf>2021-06-13 10:57:17 +0200
commit3345eaca894deaf264f752786c5001b2de9ffdb0 (patch)
tree6137709bcdcd738777f9a43ea8cbbf5d434a1172
parenteca5d2f37f03a2044628f7084ca83d96b0f80395 (diff)
backend/drm: remove test_buffer
Instead, call drm_connector_set_pending_fb.
-rw-r--r--backend/drm/drm.c39
1 files changed, 14 insertions, 25 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 48b55e41..35aa773a 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -387,29 +387,6 @@ static bool drm_crtc_page_flip(struct wlr_drm_connector *conn,
return true;
}
-static bool test_buffer(struct wlr_drm_connector *conn,
- struct wlr_buffer *wlr_buffer) {
- struct wlr_drm_backend *drm = conn->backend;
-
- /* Legacy never gets to have nice things. But I doubt this would ever work,
- * and there is no reliable way to try, without risking messing up the
- * modesetting state. */
- if (drm->iface == &legacy_iface) {
- return false;
- }
-
- struct wlr_drm_crtc *crtc = conn->crtc;
- if (!crtc) {
- return false;
- }
-
- if (!drm_fb_import(&crtc->primary->pending_fb, drm, wlr_buffer,
- &crtc->primary->formats)) {
- return false;
- }
- 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;
@@ -429,9 +406,18 @@ static bool drm_connector_set_pending_fb(struct wlr_drm_connector *conn,
}
break;
case WLR_OUTPUT_STATE_BUFFER_SCANOUT:;
+ /* Legacy never gets to have nice things. But I doubt this would ever work,
+ * and there is no reliable way to try, without risking messing up the
+ * modesetting state. */
+ if (drm->iface == &legacy_iface) {
+ wlr_drm_conn_log(conn, WLR_DEBUG,
+ "Cannot use direct scan-out with legacy KMS API");
+ return false;
+ }
if (!drm_fb_import(&plane->pending_fb, drm, state->buffer,
&crtc->primary->formats)) {
- wlr_log(WLR_ERROR, "Failed to import buffer");
+ wlr_drm_conn_log(conn, WLR_DEBUG,
+ "Failed to import buffer for scan-out");
return false;
}
break;
@@ -469,7 +455,10 @@ static bool drm_connector_test(struct wlr_output *output) {
if ((output->pending.committed & WLR_OUTPUT_STATE_BUFFER) &&
output->pending.buffer_type == WLR_OUTPUT_STATE_BUFFER_SCANOUT) {
- if (!test_buffer(conn, output->pending.buffer)) {
+ if (!drm_connector_set_pending_fb(conn, &output->pending)) {
+ return false;
+ }
+ if (!drm_crtc_commit(conn, &output->pending, DRM_MODE_ATOMIC_TEST_ONLY)) {
return false;
}
}