[PATCH i-g-t v2 18/26] lib/unigraf: Allows sst/mst configuration
Louis Chauvet
louis.chauvet at bootlin.com
Thu Jul 17 18:46:38 UTC 2025
Unigraf devices can emulate both SST and MST display port. In order to
write tests using both, add fews helper to manipulate them.
The define TSI_DPRX_NOT_DOCUMENTED_SIDEBAND_MSG_SUPPORT is taken from the
python SDK, as it was not defined by the C sdk nor documented.
---
lib/unigraf/unigraf.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++
lib/unigraf/unigraf.h | 34 +++++++++++++++++++++++++++++
2 files changed, 93 insertions(+)
diff --git a/lib/unigraf/unigraf.c b/lib/unigraf/unigraf.c
index 565d63d985b1ea99e839c377d7b87876ba2a12c4..15ded642c2fc6900a6722bdeb62c7126b23e9cee 100644
--- a/lib/unigraf/unigraf.c
+++ b/lib/unigraf/unigraf.c
@@ -313,3 +313,62 @@ void unigraf_plug(void)
igt_assert(unigraf_device);
unigraf_write(TSI_DPRX_HPD_FORCE, &d, sizeof(d));
}
+
+void unigraf_set_sst(void) {
+ int link_flags = 0xFFFFFFFF;
+ igt_assert(unigraf_device);
+ unigraf_unplug();
+ unigraf_assert(TSIX_TS_GetConfigItem(unigraf_device, TSI_DPRX_LINK_FLAGS, &link_flags, sizeof(link_flags)));
+ link_flags &= ~(TSI_DPRX_LINK_FLAGS_MST | TSI_DPRX_NOT_DOCUMENTED_SIDEBAND_MSG_SUPPORT);
+ unigraf_write(TSI_DPRX_LINK_FLAGS, &link_flags, sizeof(link_flags));
+ unigraf_plug();
+ unigraf_hpd_pulse(500000);
+}
+
+void unigraf_set_mst(void) {
+ int link_flags = 0xFFFFFFFF;
+ igt_assert(unigraf_device);
+ unigraf_assert(TSIX_TS_GetConfigItem(unigraf_device, TSI_DPRX_LINK_FLAGS, &link_flags, sizeof(link_flags)));
+ link_flags |= TSI_DPRX_LINK_FLAGS_MST | TSI_DPRX_NOT_DOCUMENTED_SIDEBAND_MSG_SUPPORT;
+ unigraf_write(TSI_DPRX_LINK_FLAGS, &link_flags, sizeof(link_flags));
+}
+
+int unigraf_get_mst_stream_max_count(void)
+{
+ int previous_count;
+ int max_count = -1;
+
+ // You can write any value to the register, but the actual value will not be more than the supported sink count.
+ previous_count = unigraf_get_mst_stream_count();
+ unigraf_write(TSI_DPRX_MST_SINK_COUNT, &max_count, sizeof(max_count));
+ max_count = unigraf_get_mst_stream_count();
+
+ unigraf_write(TSI_DPRX_MST_SINK_COUNT, &previous_count, sizeof(previous_count));
+ return max_count;
+}
+
+int unigraf_get_mst_stream_count(void)
+{
+ int count;
+ igt_assert(unigraf_device);
+
+ unigraf_assert(TSIX_TS_GetConfigItem(unigraf_device, TSI_DPRX_MST_SINK_COUNT, &count, sizeof(count)));
+
+ return count;
+}
+
+bool unigraf_set_mst_stream_count(int count) {
+ int new_count;
+
+ unigraf_write(TSI_DPRX_MST_SINK_COUNT, &count, sizeof(count));
+ new_count = unigraf_get_mst_stream_count();
+
+ igt_warn_on_f(count != new_count, "IGT:%p: Requested MST stream count (%d) differ from what was applied by the device (%d)\n", unigraf_device, count, new_count);
+
+ return count == new_count;
+}
+void unigraf_select_stream(int stream)
+{
+ igt_assert(unigraf_device);
+ unigraf_write(TSI_DPRX_STREAM_SELECT, &stream, sizeof(stream));
+}
diff --git a/lib/unigraf/unigraf.h b/lib/unigraf/unigraf.h
index 7f6438da66b688b4b7d8aaa6f124474bd2c1d042..6ecd1248cdd70a2af99ae09ae19f9fc8c061ff56 100644
--- a/lib/unigraf/unigraf.h
+++ b/lib/unigraf/unigraf.h
@@ -81,4 +81,38 @@ void unigraf_plug(void);
*/
void unigraf_unplug(void);
+/**
+ * unigraf_set_sst() - Configure the device for Single Stream Transport mode
+ *
+ * This function sets the device to operate in Single Stream Transport (SST) mode.
+ */
+void unigraf_set_sst(void);
+
+/**
+ * unigraf_set_mst() - Configure the device for Multi Stream Transport mode
+ *
+ * This function sets the device to operate in Multi Stream Transport (MST) mode.
+ */
+void unigraf_set_mst(void);
+
+/**
+ * unigraf_get_mst_stream_count() - Get the current number of MST streams
+ *
+ * Returns: The current number of MST streams configured on the device.
+ */
+int unigraf_get_mst_stream_count(void);
+
+/**
+ * unigraf_set_mst_stream_count() - Set the number of accepted stream count
+ *
+ * Returns true when the stream count was properly applied, false if the final stream count is not the one requested
+ */
+bool unigraf_set_mst_stream_count(int count);
+
+/**
+ * unigraf_get_mst_stream_max_count() - Get the maximum number of stream count accepted by the device
+ * Caution: This function can be destructive to some configuration: the only way to get the information is to try and read the new value.
+ */
+int unigraf_get_mst_stream_max_count(void);
+
#endif // UNIGRAF_H
--
2.50.0
More information about the igt-dev
mailing list