aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-07-08 16:23:22 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-07-09 15:31:19 -0400
commitfde56c20b4711e20edfafcaba67341f71e2c1c10 (patch)
tree695a338fe5161d60ff074f10c111761063013c13 /backend/drm
parent017555651b01a2e4fbdda9d59b29c847094d57b7 (diff)
backend/drm: move legacy-specific checks to legacy.c
Now that we have a test_only arg in crtc_commit, we can move the legacy checks to legacy.c.
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/drm.c8
-rw-r--r--backend/drm/legacy.c15
2 files changed, 15 insertions, 8 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 403e5d7c..daf6b379 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -419,14 +419,6 @@ 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_drm_conn_log(conn, WLR_DEBUG,
diff --git a/backend/drm/legacy.c b/backend/drm/legacy.c
index ca23bb1c..7c18b3e3 100644
--- a/backend/drm/legacy.c
+++ b/backend/drm/legacy.c
@@ -8,9 +8,24 @@
#include "backend/drm/iface.h"
#include "backend/drm/util.h"
+static bool legacy_crtc_test(struct wlr_drm_connector *conn,
+ const struct wlr_output_state *state) {
+ if ((state->committed & WLR_OUTPUT_STATE_BUFFER) &&
+ state->buffer_type == WLR_OUTPUT_STATE_BUFFER_SCANOUT) {
+ wlr_drm_conn_log(conn, WLR_DEBUG,
+ "Cannot use direct scan-out with legacy KMS API");
+ return false;
+ }
+
+ return true;
+}
+
static bool legacy_crtc_commit(struct wlr_drm_backend *drm,
struct wlr_drm_connector *conn, const struct wlr_output_state *state,
uint32_t flags, bool test_only) {
+ if (!legacy_crtc_test(conn, state)) {
+ return false;
+ }
if (test_only) {
return true;
}