aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-10-26 10:31:36 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-10-26 07:01:34 -0600
commitbf42630d321c85a179d910fce47d61b32a7399d2 (patch)
tree155cc786eba79aaef7ea20d3e35e9347249da75b
parent3d6ca9942db43ca182d91b115597a4ca7f367eef (diff)
output: refuse to enable with zero mode
This can happen if the compositor enables an output without picking a mode, or performs a modeset with a zero width/height.
-rw-r--r--types/output/output.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/types/output/output.c b/types/output/output.c
index 0b431733..9222459c 100644
--- a/types/output/output.c
+++ b/types/output/output.c
@@ -547,6 +547,16 @@ static bool output_basic_test(struct wlr_output *output) {
enabled = output->pending.enabled;
}
+ if (enabled && (output->pending.committed & (WLR_OUTPUT_STATE_ENABLED |
+ WLR_OUTPUT_STATE_MODE))) {
+ int pending_width, pending_height;
+ output_pending_resolution(output, &pending_width, &pending_height);
+ if (pending_width == 0 || pending_height == 0) {
+ wlr_log(WLR_DEBUG, "Tried to enable an output with a zero mode");
+ return false;
+ }
+ }
+
if (!enabled && output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
wlr_log(WLR_DEBUG, "Tried to commit a buffer on a disabled output");
return false;