summaryrefslogtreecommitdiff
path: root/lib/igt_kms.h
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-09-21 16:07:48 +0200
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-10-20 11:18:30 +0200
commit66fb466eb5ea5aa0c728ae15244ae08ede2b3b58 (patch)
tree6fd4aa6440eec7ec1dd4866a44163afa1e261782 /lib/igt_kms.h
parent5e42c6232dab3a7bb96963aec5a9f90e169df20c (diff)
lib/igt_kms: Rework pipe properties to be more atomic, v7.
In the future I want to allow tests to commit more properties, but for this to work I have to fix all properties to work better with atomic commit. Instead of special casing each property make a bitmask for all property changed flags, and try to commit all properties. This has been the most involved one, since legacy pipe commit still handles a lot of the properties differently from the rest. Changes since v1: - Dump all changed properties on commit. - Fix bug in igt_pipe_refresh(). Changes since v2: - Set pipe ACTIVE property changed flag on init. Changes since v3: - Add a missing igt_pipe_refresh() to kms_atomic_interruptible. Changes since v4: - Perform error handling when setting custom crtc properties. Changes since v5: - Only attempt to commit changes properties. Changes since v6: - Clear OUT_FENCE_PTR on succesful commit. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Diffstat (limited to 'lib/igt_kms.h')
-rw-r--r--lib/igt_kms.h77
1 files changed, 30 insertions, 47 deletions
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index f87f8be3..b53127ff 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -313,27 +313,13 @@ struct igt_pipe {
int plane_primary;
igt_plane_t *planes;
- uint32_t atomic_props_crtc[IGT_NUM_CRTC_PROPS];
-
- uint64_t background; /* Background color MSB BGR 16bpc LSB */
- uint32_t background_changed : 1;
- uint32_t background_property;
-
- uint64_t degamma_blob;
- uint32_t degamma_property;
- uint64_t ctm_blob;
- uint32_t ctm_property;
- uint64_t gamma_blob;
- uint32_t gamma_property;
- uint32_t color_mgmt_changed : 1;
+ uint64_t changed;
+ uint32_t props[IGT_NUM_CRTC_PROPS];
+ uint64_t values[IGT_NUM_CRTC_PROPS];
uint32_t crtc_id;
- uint64_t mode_blob;
- bool mode_changed;
-
int32_t out_fence_fd;
- bool out_fence_requested;
};
typedef struct {
@@ -527,17 +513,6 @@ static inline bool igt_output_is_connected(igt_output_t *output)
igt_plane_set_prop_changed(plane, prop); \
} while (0)
-/**
- * igt_atomic_populate_crtc_req:
- * @req: A pointer to drmModeAtomicReq
- * @pipe: A pointer igt_pipe_t
- * @prop: one of igt_atomic_crtc_properties
- * @value: the value to add
- */
-#define igt_atomic_populate_crtc_req(req, pipe, prop, value) \
- igt_assert_lt(0, drmModeAtomicAddProperty(req, pipe->crtc_id,\
- pipe->atomic_props_crtc[prop], value))
-
#define igt_output_is_prop_changed(output, prop) \
(!!((output)->changed & (1 << (prop))))
#define igt_output_set_prop_changed(output, prop) \
@@ -552,26 +527,34 @@ static inline bool igt_output_is_connected(igt_output_t *output)
igt_output_set_prop_changed(output, prop); \
} while (0)
-/*
- * igt_pipe_refresh:
- * @display: a pointer to an #igt_display_t structure
- * @pipe: Pipe to refresh
- * @force: Should be set to true if mode_blob is no longer considered
- * to be valid, for example after doing an atomic commit during fork or closing display fd.
- *
- * Requests the pipe to be part of the state on next update.
- * This is useful when state may have been out of sync after
- * a fork, or we just want to be sure the pipe is included
- * in the next commit.
- */
-static inline void
-igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force)
-{
- if (force)
- display->pipes[pipe].mode_blob = 0;
+#define igt_pipe_obj_is_prop_changed(pipe_obj, prop) \
+ (!!((pipe_obj)->changed & (1 << (prop))))
- display->pipes[pipe].mode_changed = true;
-}
+#define igt_pipe_is_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_is_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_set_prop_changed(pipe_obj, prop) \
+ (pipe_obj)->changed |= 1 << (prop)
+
+#define igt_pipe_set_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_set_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_clear_prop_changed(pipe_obj, prop) \
+ (pipe_obj)->changed &= ~(1 << (prop))
+
+#define igt_pipe_clear_prop_changed(display, pipe, prop) \
+ igt_pipe_obj_clear_prop_changed(&(display)->pipes[(pipe)], prop)
+
+#define igt_pipe_obj_set_prop_value(pipe_obj, prop, value) \
+ do { \
+ (pipe_obj)->values[prop] = (value); \
+ igt_pipe_obj_set_prop_changed(pipe_obj, prop); \
+ } while (0)
+
+#define igt_pipe_set_prop_value(display, pipe, prop, value) \
+ igt_pipe_obj_set_prop_value(&(display)->pipes[(pipe)], prop, value)
+
+void igt_pipe_refresh(igt_display_t *display, enum pipe pipe, bool force);
void igt_enable_connectors(void);
void igt_reset_connectors(void);