aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-06-18 12:15:08 +0200
committerKenny Levinsen <kl@kl.wtf>2021-06-20 23:17:08 +0200
commit2f615468b68d49c8ec03ceffa751f8425d4c9b6b (patch)
treedff89e08ce6be6041fc9060762ad534166faa9ba /backend/drm
parent15c8453ba11d70e1cc271d5cebed307fe43cd4ba (diff)
backend: add output state allow-lists
Right now, when a new output state field is added, all backends by default won't reject it. This means we need to add new checks to each and every backend when we introduce a new state field. Instead, introduce a bitmask of supported output state fields in each backend, and error out if the user has submitted an unknown field. Some fields don't need any backend involvment to work. These are listed in WLR_OUTPUT_STATE_BACKEND_OPTIONAL as a convenience.
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/drm.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index caf27d71..b56cf6d5 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -31,6 +31,13 @@
#include "types/wlr_buffer.h"
#include "util/signal.h"
+static const uint32_t SUPPORTED_OUTPUT_STATE =
+ WLR_OUTPUT_STATE_BACKEND_OPTIONAL |
+ WLR_OUTPUT_STATE_BUFFER |
+ WLR_OUTPUT_STATE_MODE |
+ WLR_OUTPUT_STATE_ENABLED |
+ WLR_OUTPUT_STATE_GAMMA_LUT;
+
bool check_drm_features(struct wlr_drm_backend *drm) {
if (drmGetCap(drm->fd, DRM_CAP_CURSOR_WIDTH, &drm->cursor_width)) {
drm->cursor_width = 64;
@@ -435,6 +442,13 @@ static bool drm_connector_test(struct wlr_output *output) {
return false;
}
+ uint32_t unsupported = output->pending.committed & ~SUPPORTED_OUTPUT_STATE;
+ if (unsupported != 0) {
+ wlr_log(WLR_DEBUG, "Unsupported output state fields: 0x%"PRIx32,
+ unsupported);
+ return false;
+ }
+
if ((output->pending.committed & WLR_OUTPUT_STATE_ENABLED) &&
output->pending.enabled) {
if (output->current_mode == NULL &&