summaryrefslogtreecommitdiff
path: root/lib/igt_kms.c
diff options
context:
space:
mode:
authorKunal Joshi <kunal1.joshi@intel.com>2021-04-26 15:02:03 +0530
committerKunal Joshi <kunal1.joshi@intel.com>2021-04-26 19:57:27 +0530
commitc16bef698086eca8c68f583dde463d6418bccd8b (patch)
treec5dfc52905db5ed72e1abaf1eaec971d51dd66ca /lib/igt_kms.c
parent3f43ae9fd22dc5a517786b984dc3aa717997664f (diff)
Make basic chamelium function accessible to other tests
There are many use case where we can integrate chamelium with other tests, Migrating some of basic chamelium functions to igt_chamelium lib to avoid Code rewriting. v2: Moved one more function reset_state from tests/kms_chamelium to lib/igt_chamelium. v3: - Shifted disabling of modeset to igt_kms - Replace connection_str with kmstest_connector_status_str (Petri) - Generalized require__connector_present (Petri) - Avoided using data_chamelium_t struct (Petri) v4: - Moved function to library (Petri) - Renamed some functions and added documentation (Petri) v6: - Documentation of functions(Petri) - Shifted function to igt_kms and renamed (Petri) Signed-off-by: Kunal Joshi <kunal1.joshi@intel.com> Signed-off-by: Karthik B S <karthik.b.s@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/igt_kms.c')
-rw-r--r--lib/igt_kms.c100
1 files changed, 100 insertions, 0 deletions
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 08d429a8..4285f1d0 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -376,6 +376,83 @@ const struct edid *igt_kms_get_3d_edid(void)
return edid;
}
+/**
+ * igt_kms_get_aspect_ratio_edid:
+ *
+ * Gets the base edid block, which includes the following modes
+ * and different aspect ratio
+ *
+ * - 1920x1080 60Hz
+ * - 1280x720 60Hz
+ * - 1024x768 60Hz
+ * - 800x600 60Hz
+ * - 640x480 60Hz
+ *
+ * Returns: a basic edid block with aspect ratio block
+ */
+const struct edid *igt_kms_get_aspect_ratio_edid(void)
+{
+ static unsigned char raw_edid[2 * EDID_BLOCK_SIZE] = {0};
+ struct edid *edid;
+ struct edid_ext *edid_ext;
+ struct edid_cea *edid_cea;
+ char *cea_data;
+ struct edid_cea_data_block *block;
+ size_t cea_data_size = 0, vsdb_size;
+ const struct cea_vsdb *vsdb;
+
+ edid = (struct edid *) raw_edid;
+ memcpy(edid, igt_kms_get_base_edid(), sizeof(struct edid));
+ edid->extensions_len = 1;
+ edid_ext = &edid->extensions[0];
+ edid_cea = &edid_ext->data.cea;
+ cea_data = edid_cea->data;
+
+ /* The HDMI VSDB advertises support for InfoFrames */
+ block = (struct edid_cea_data_block *) &cea_data[cea_data_size];
+ vsdb = cea_vsdb_get_hdmi_default(&vsdb_size);
+ cea_data_size += edid_cea_data_block_set_vsdb(block, vsdb,
+ vsdb_size);
+
+ /* Short Video Descriptor */
+ block = (struct edid_cea_data_block *) &cea_data[cea_data_size];
+ cea_data_size += edid_cea_data_block_set_svd(block, edid_ar_svds,
+ sizeof(edid_ar_svds));
+
+ assert(cea_data_size <= sizeof(edid_cea->data));
+
+ edid_ext_set_cea(edid_ext, cea_data_size, 0, 0);
+
+ edid_update_checksum(edid);
+
+ return edid;
+}
+
+/**
+ * igt_kms_get_custom_edid:
+ *
+ * @edid: enum to specify which edid block is required
+ * returns pointer to requested edid block
+ *
+ * Returns: required edid
+ */
+const struct edid *igt_kms_get_custom_edid(enum igt_custom_edid_type edid)
+{
+ switch (edid) {
+ case IGT_CUSTOM_EDID_BASE:
+ return igt_kms_get_base_edid();
+ case IGT_CUSTOM_EDID_ALT:
+ return igt_kms_get_alt_edid();
+ case IGT_CUSTOM_EDID_HDMI_AUDIO:
+ return igt_kms_get_hdmi_audio_edid();
+ case IGT_CUSTOM_EDID_DP_AUDIO:
+ return igt_kms_get_dp_audio_edid();
+ case IGT_CUSTOM_EDID_ASPECT_RATIO:
+ return igt_kms_get_aspect_ratio_edid();
+ }
+ assert(0); /* unreachable */
+}
+
const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
[IGT_PLANE_SRC_X] = "SRC_X",
[IGT_PLANE_SRC_Y] = "SRC_Y",
@@ -2276,6 +2353,29 @@ const drmModeModeInfo *igt_std_1024_mode_get(void)
return &std_1024_mode;
}
+/*
+ * igt_modeset_disable_all_outputs
+ * @diplay: igt display structure
+ *
+ * Modeset to disable all output
+ *
+ * We need to do a modeset disabling all output to get the next
+ * HPD event on TypeC port
+ */
+void igt_modeset_disable_all_outputs(igt_display_t *display)
+{
+ int i;
+
+ for (i = 0; i < display->n_outputs; i++) {
+ igt_output_t *output = &display->outputs[i];
+
+ igt_output_set_pipe(output, PIPE_NONE);
+ }
+
+ igt_display_commit2(display, COMMIT_ATOMIC);
+
+}
+
static void igt_pipe_fini(igt_pipe_t *pipe)
{
free(pipe->planes);