aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c11
-rw-r--r--backend/headless/output.c13
-rw-r--r--backend/wayland/output.c18
-rw-r--r--backend/x11/output.c18
4 files changed, 52 insertions, 8 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index d845a888..53d49d17 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -334,6 +334,10 @@ static bool drm_connector_attach_render(struct wlr_output *output,
return make_drm_surface_current(&conn->crtc->primary->surf, buffer_age);
}
+static bool drm_connector_test(struct wlr_output *output) {
+ return true;
+}
+
static bool drm_connector_commit_buffer(struct wlr_output *output) {
struct wlr_drm_connector *conn = get_drm_connector_from_output(output);
struct wlr_drm_backend *drm = get_drm_backend_from_backend(output->backend);
@@ -455,6 +459,10 @@ static bool drm_connector_set_custom_mode(struct wlr_output *output,
static bool drm_connector_commit(struct wlr_output *output) {
struct wlr_drm_backend *drm = get_drm_backend_from_backend(output->backend);
+ if (!drm_connector_test(output)) {
+ return false;
+ }
+
if (!drm->session->active) {
return false;
}
@@ -501,7 +509,7 @@ static bool drm_connector_commit(struct wlr_output *output) {
static void fill_empty_gamma_table(size_t size,
uint16_t *r, uint16_t *g, uint16_t *b) {
- assert(0xFFFF < UINT64_MAX / (size - 1));
+ assert(0xFFFF < UINT64_MAX / (size - 1));
for (uint32_t i = 0; i < size; ++i) {
uint16_t val = (uint64_t)0xffff * i / (size - 1);
r[i] = g[i] = b[i] = val;
@@ -1068,6 +1076,7 @@ static const struct wlr_output_impl output_impl = {
.move_cursor = drm_connector_move_cursor,
.destroy = drm_connector_destroy,
.attach_render = drm_connector_attach_render,
+ .test = drm_connector_test,
.commit = drm_connector_commit,
.set_gamma = set_drm_connector_gamma,
.get_gamma_size = drm_connector_get_gamma_size,
diff --git a/backend/headless/output.c b/backend/headless/output.c
index a2836159..326c9605 100644
--- a/backend/headless/output.c
+++ b/backend/headless/output.c
@@ -57,7 +57,7 @@ static bool output_attach_render(struct wlr_output *wlr_output,
buffer_age);
}
-static bool output_commit(struct wlr_output *wlr_output) {
+static bool output_test(struct wlr_output *wlr_output) {
if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ENABLED) {
wlr_log(WLR_DEBUG, "Cannot disable a headless output");
return false;
@@ -65,6 +65,17 @@ static bool output_commit(struct wlr_output *wlr_output) {
if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) {
assert(wlr_output->pending.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM);
+ }
+
+ return true;
+}
+
+static bool output_commit(struct wlr_output *wlr_output) {
+ if (!output_test(wlr_output)) {
+ return false;
+ }
+
+ if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) {
if (!output_set_custom_mode(wlr_output,
wlr_output->pending.custom_mode.width,
wlr_output->pending.custom_mode.height,
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index 1f00209b..1a1835e1 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -197,17 +197,28 @@ static bool output_attach_buffer(struct wlr_output *wlr_output,
return true;
}
+static bool output_test(struct wlr_output *wlr_output) {
+ if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ENABLED) {
+ wlr_log(WLR_DEBUG, "Cannot disable a Wayland output");
+ return false;
+ }
+
+ if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) {
+ assert(wlr_output->pending.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM);
+ }
+
+ return true;
+}
+
static bool output_commit(struct wlr_output *wlr_output) {
struct wlr_wl_output *output =
get_wl_output_from_output(wlr_output);
- if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ENABLED) {
- wlr_log(WLR_DEBUG, "Cannot disable a Wayland output");
+ if (!output_test(wlr_output)) {
return false;
}
if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) {
- assert(wlr_output->pending.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM);
if (!output_set_custom_mode(wlr_output,
wlr_output->pending.custom_mode.width,
wlr_output->pending.custom_mode.height,
@@ -419,6 +430,7 @@ static const struct wlr_output_impl output_impl = {
.destroy = output_destroy,
.attach_render = output_attach_render,
.attach_buffer = output_attach_buffer,
+ .test = output_test,
.commit = output_commit,
.set_cursor = output_set_cursor,
.move_cursor = output_move_cursor,
diff --git a/backend/x11/output.c b/backend/x11/output.c
index 9d184c48..6546c23e 100644
--- a/backend/x11/output.c
+++ b/backend/x11/output.c
@@ -99,17 +99,28 @@ static bool output_attach_render(struct wlr_output *wlr_output,
return wlr_egl_make_current(&x11->egl, output->surf, buffer_age);
}
+static bool output_test(struct wlr_output *wlr_output) {
+ if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ENABLED) {
+ wlr_log(WLR_DEBUG, "Cannot disable an X11 output");
+ return false;
+ }
+
+ if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) {
+ assert(wlr_output->pending.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM);
+ }
+
+ return true;
+}
+
static bool output_commit(struct wlr_output *wlr_output) {
struct wlr_x11_output *output = get_x11_output_from_output(wlr_output);
struct wlr_x11_backend *x11 = output->x11;
- if (wlr_output->pending.committed & WLR_OUTPUT_STATE_ENABLED) {
- wlr_log(WLR_DEBUG, "Cannot disable an X11 output");
+ if (!output_test(wlr_output)) {
return false;
}
if (wlr_output->pending.committed & WLR_OUTPUT_STATE_MODE) {
- assert(wlr_output->pending.mode_type == WLR_OUTPUT_STATE_MODE_CUSTOM);
if (!output_set_custom_mode(wlr_output,
wlr_output->pending.custom_mode.width,
wlr_output->pending.custom_mode.height,
@@ -152,6 +163,7 @@ static bool output_commit(struct wlr_output *wlr_output) {
static const struct wlr_output_impl output_impl = {
.destroy = output_destroy,
.attach_render = output_attach_render,
+ .test = output_test,
.commit = output_commit,
};