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.
This commit is contained in:
Simon Ser 2021-06-18 12:15:08 +02:00 committed by Kenny Levinsen
parent 15c8453ba1
commit 2f615468b6
6 changed files with 63 additions and 8 deletions

View file

@ -14,6 +14,16 @@
#include <wlr/types/wlr_box.h>
#include <wlr/types/wlr_output.h>
/**
* Output state fields that don't require backend support. Backends can ignore
* them without breaking the API contract.
*/
#define WLR_OUTPUT_STATE_BACKEND_OPTIONAL \
(WLR_OUTPUT_STATE_DAMAGE | \
WLR_OUTPUT_STATE_SCALE | \
WLR_OUTPUT_STATE_TRANSFORM | \
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED)
/**
* A backend implementation of wlr_output.
*