From f490622fca4ec175193f68587b9c647a2ab515f4 Mon Sep 17 00:00:00 2001 From: Sultan Alsawaf Date: Tue, 14 Feb 2023 19:41:50 -0800 Subject: [PATCH] present: Document the TearFree flip reasons in PresentFlipReason Adding new flip reasons after the TearFree ones would break the assumption that `reason >= PRESENT_FLIP_REASON_DRIVER_TEARFREE` implies either of the TearFree reasons. Document this in the PresentFlipReason enum in order to save someone a very bad headache in the future. Signed-off-by: Sultan Alsawaf Reviewed-by: Martin Roukala --- present/present.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/present/present.h b/present/present.h index 1d7b0ce42..a3f34a929 100644 --- a/present/present.h +++ b/present/present.h @@ -30,6 +30,12 @@ typedef enum { PRESENT_FLIP_REASON_UNKNOWN, PRESENT_FLIP_REASON_BUFFER_FORMAT, + + /* Don't add new flip reasons after the TearFree ones, since it's expected + * that the TearFree reasons are the highest ones in order to allow doing + * `reason >= PRESENT_FLIP_REASON_DRIVER_TEARFREE` to check if a reason is + * PRESENT_FLIP_REASON_DRIVER_TEARFREE{_FLIPPING}. + */ PRESENT_FLIP_REASON_DRIVER_TEARFREE, PRESENT_FLIP_REASON_DRIVER_TEARFREE_FLIPPING } PresentFlipReason;