summaryrefslogtreecommitdiff
path: root/tests/kms_content_protection.c
diff options
context:
space:
mode:
authorBhanuprakash Modem <bhanuprakash.modem@intel.com>2021-05-12 22:35:27 +0530
committerPetri Latvala <petri.latvala@intel.com>2021-05-18 10:03:49 +0300
commite4179322b350b019631b64f04ef84224c965210a (patch)
treee8f743ce835aecb8125a6a0dc842423bb8f44d7a /tests/kms_content_protection.c
parent83a9adbc9e855a5b554e6a0206b7b359aefe3096 (diff)
tests/kms_content_protection: Fix mode selection for 2x tests
This patch will find the connector/mode combination that fits into the bandwidth when more than one monitor is connected. Example: When two monitors connected through MST, the second monitor also tries to use the same mode. So two such modes may not fit into the link bandwidth. So, iterate through connected outputs & modes and find a combination of modes those fit into the link BW. V2: * Fix commit message (Ankit) Cc: Imre Deak <imre.deak@intel.com> Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com> Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Diffstat (limited to 'tests/kms_content_protection.c')
-rw-r--r--tests/kms_content_protection.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 5a75b871..1d1a439a 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -452,39 +452,18 @@ static bool sink_hdcp2_capable(igt_output_t *output)
return strstr(buf, "HDCP2.2");
}
-static void prepare_modeset_on_mst_output(igt_output_t *output, enum pipe pipe)
+static void prepare_modeset_on_mst_output(igt_output_t *output)
{
- drmModeConnectorPtr c = output->config.connector;
drmModeModeInfo *mode;
igt_plane_t *primary;
- int i, width, height;
+ int width, height;
+ enum pipe pipe = output->pending_pipe;
mode = igt_output_get_mode(output);
- /*
- * TODO: Add logic to use the highest possible modes on each output.
- * Currently using 2k modes by default on all the outputs.
- */
- igt_debug("Before mode override: Output %s Mode hdisplay %d Mode vdisplay %d\n",
- output->name, mode->hdisplay, mode->vdisplay);
-
- if (mode->hdisplay > 1920 && mode->vdisplay > 1080) {
- for (i = 0; i < c->count_modes; i++) {
- if (c->modes[i].hdisplay <= 1920 && c->modes[i].vdisplay <= 1080) {
- mode = &c->modes[i];
- igt_output_override_mode(output, mode);
- break;
- }
- }
- }
-
- igt_debug("After mode overide: Output %s Mode hdisplay %d Mode vdisplay %d\n",
- output->name, mode->hdisplay, mode->vdisplay);
-
width = mode->hdisplay;
height = mode->vdisplay;
- igt_output_set_pipe(output, pipe);
primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
igt_plane_set_fb(primary, NULL);
igt_plane_set_fb(primary, pipe % 2 ? &data.red : &data.green);
@@ -624,7 +603,8 @@ test_content_protection_mst(int content_type)
igt_assert_f(igt_pipe_connector_valid(pipe, output), "Output-pipe combination invalid\n");
- prepare_modeset_on_mst_output(output, pipe);
+ igt_output_set_pipe(output, pipe);
+ prepare_modeset_on_mst_output(output);
mst_output[dp_mst_outputs++] = output;
pipe++;
@@ -635,6 +615,17 @@ test_content_protection_mst(int content_type)
igt_require_f(dp_mst_outputs > 1, "No DP MST set up with >= 2 outputs found in a single topology\n");
+ if (igt_display_try_commit_atomic(display,
+ DRM_MODE_ATOMIC_TEST_ONLY |
+ DRM_MODE_ATOMIC_ALLOW_MODESET,
+ NULL) != 0) {
+ bool found = igt_override_all_active_output_modes_to_fit_bw(display);
+ igt_require_f(found, "No valid mode combo found for MST modeset\n");
+
+ for (count = 0; count < dp_mst_outputs; count++)
+ prepare_modeset_on_mst_output(mst_output[count]);
+ }
+
ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
igt_require_f(ret == 0, "Commit failure during MST modeset\n");