[igt-dev] [i-g-t v5 01/52] lib/igt_kms: Add a helper for valid pipe/output constraint
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Tue Nov 15 16:58:24 UTC 2022
Add an IGT helper to check the given pipe/output combo is valid to decide
whether to run/skip the subtest.
Example:
* Pipe-D can't support mode > 5K
* To use 8K mode on a pipe then consecutive pipe must be available & free.
* MSO is supported only on PIPE_A/PIPE_B.
This helper is supposed to be a superset of all constraints of pipe/output
combo. But as of now, this helper supports only Bigjoiner.
V2:
- Rename the helper
- Add is_i915 constraint
- Add pre-condition check (igt_output_set_pipe called)
- Update documentaion
- Minor cleanup in Bigjoiner helper
Cc: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Reviewed-by: Petri Latvala <petri.latvala at intel.com>
---
lib/igt_kms.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++---
lib/igt_kms.h | 1 +
2 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 921a623d..38aa85d1 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -5824,6 +5824,7 @@ bool igt_check_bigjoiner_support(igt_display_t *display)
{
uint8_t i, total_pipes = 0, pipes_in_use = 0;
enum pipe p;
+ igt_output_t *output;
struct {
enum pipe idx;
drmModeModeInfo *mode;
@@ -5837,9 +5838,7 @@ bool igt_check_bigjoiner_support(igt_display_t *display)
* Get list of pipes in use those were set by igt_output_set_pipe()
* just before calling this function.
*/
- for (i = 0 ; i < display->n_outputs; i++) {
- igt_output_t *output = &display->outputs[i];
-
+ for_each_connected_output(display, output) {
if (output->pending_pipe == PIPE_NONE)
continue;
@@ -5905,3 +5904,47 @@ bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo *mode)
return true;
}
+
+/*
+ * i915_pipe_output_combo_valid:
+ * @display: a pointer to an #igt_display_t structure
+ *
+ * Every individual test must use igt_output_set_pipe() before calling this
+ * helper, so that this function will get all active pipes from connected
+ * outputs (i.e. pending_pipe != PIPE_NONE) and check the selected combo is
+ * valid or not.
+ *
+ * This helper is supposed to be a superset of all constraints of pipe/output
+ * combo.
+ *
+ * Example:
+ * * Pipe-D can't support mode > 5K
+ * * To use 8K mode on a pipe then consecutive pipe must be free.
+ * * MSO is supported only on PIPE_A/PIPE_B.
+ *
+ * Returns: true if a valid pipe/output mode combo found, else false
+ */
+bool i915_pipe_output_combo_valid(igt_display_t *display)
+{
+ int combo = 0;
+ igt_output_t *output;
+
+ if (!is_i915_device(display->drm_fd))
+ return true;
+
+ for_each_connected_output(display, output) {
+ if (output->pending_pipe == PIPE_NONE)
+ continue;
+
+ combo++;
+ }
+
+ igt_assert_f(combo, "At least one pipe/output combo needed.\n");
+
+ /*
+ * Check the given pipe/output combo is valid for Bigjoiner.
+ *
+ * TODO: Update this helper to support other features like MSO.
+ */
+ return igt_check_bigjoiner_support(display);
+}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index b09441d0..0c4ab7ae 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -999,5 +999,6 @@ bool igt_max_bpc_constraint(igt_display_t *display, enum pipe pipe,
igt_output_t *output, int bpc);
bool igt_check_bigjoiner_support(igt_display_t *display);
bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo *mode);
+bool i915_pipe_output_combo_valid(igt_display_t *display);
#endif /* __IGT_KMS_H__ */
--
2.38.0
More information about the igt-dev
mailing list