From 2f615468b68d49c8ec03ceffa751f8425d4c9b6b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 18 Jun 2021 12:15:08 +0200 Subject: 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. --- include/wlr/interfaces/wlr_output.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index a727da61..83a8c321 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -14,6 +14,16 @@ #include #include +/** + * 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. * -- cgit v1.2.3