[PATCH i-g-t v3 21/29] lib/unigraf: Add connector configuration
Louis Chauvet
louis.chauvet at bootlin.com
Sat Aug 23 02:11:41 UTC 2025
As multiple connectors can be present on the DUT, add a configuration to
tell which connector is used by the Unigraf.
The configuration will look like:
[Unigraf]
Device=UCD-500 [2434C620]
Role=DisplayPort Source and Sink
Input=DP RX
Connector=DP-4
Signed-off-by: Louis Chauvet <louis.chauvet at bootlin.com>
---
lib/unigraf/unigraf.c | 20 ++++++++++++++++++++
lib/unigraf/unigraf.h | 11 +++++++++++
2 files changed, 31 insertions(+)
diff --git a/lib/unigraf/unigraf.c b/lib/unigraf/unigraf.c
index 6b11fb7744a78d003b064183127c2666d4c36c74..41c1015aa942ccaf9c93890656d403997b19e661 100644
--- a/lib/unigraf/unigraf.c
+++ b/lib/unigraf/unigraf.c
@@ -10,6 +10,7 @@
#include "unigraf.h"
#include "TSI_types.h"
#include "TSI.h"
+#include "igt_kms.h"
#include "igt_rc.h"
#define unigraf_debug(fmt, ...) igt_debug("TSI:%p: " fmt, unigraf_device, ##__VA_ARGS__)
@@ -44,6 +45,11 @@ static char *unigraf_connector_name;
*/
#define UNIGRAF_CONFIG_INPUT_NAME "Input"
+/**
+ * UNIGRAF_CONFIG_CONNECTOR_NAME - Key of the connector name in the configuration file
+ */
+#define UNIGRAF_CONFIG_CONNECTOR_NAME "Connector"
+
/**
* UNIGRAF_DEFAULT_ROLE_NAME - Default role name to search on the unigraf device
*/
@@ -170,6 +176,11 @@ static int unigraf_find_input(const char *request)
return chosen_input;
}
+drmModeConnectorPtr unigraf_get_connector(int drm_fd)
+{
+ return igt_get_connector_from_name(drm_fd, unigraf_connector_name);
+}
+
bool unigraf_open_device(int drm_fd)
{
TSI_RESULT r;
@@ -230,6 +241,15 @@ bool unigraf_open_device(int drm_fd)
unigraf_debug("No input name configured.\n");
cfg_input = NULL;
}
+
+ cfg_error = NULL;
+ unigraf_connector_name = g_key_file_get_string(igt_key_file, cfg_group,
+ UNIGRAF_CONFIG_CONNECTOR_NAME,
+ &cfg_error);
+ if (cfg_error) {
+ unigraf_debug("No connector name configured, will autodetect.\n");
+ unigraf_connector_name = NULL;
+ }
}
unigraf_assert(TSIX_DEV_RescanDevices(0, TSI_DEVCAP_VIDEO_CAPTURE, 0));
diff --git a/lib/unigraf/unigraf.h b/lib/unigraf/unigraf.h
index 95c86a8cd428725d4e3a28bb91158800c840654c..553a732d746e5465472a81405f885add6a3a7c47 100644
--- a/lib/unigraf/unigraf.h
+++ b/lib/unigraf/unigraf.h
@@ -5,6 +5,7 @@
#include <stdbool.h>
#include <stdint.h>
+#include <xf86drmMode.h>
/**
* unigraf_assert: Helper macro to assert a TSI return value and retrieve a detailed error message.
@@ -47,6 +48,16 @@ bool unigraf_open_device(int drm_fd);
*/
void unigraf_require_device(int drm_fd);
+/**
+ * unigraf_get_connector() - Get a DRM connector for the Unigraf device
+ * @drm_fd: DRM file descriptor
+ *
+ * Returns: A pointer to the drmModeConnector connected to the unigraf device,
+ * or NULL if the operation failed. The caller is responsible for freeing this
+ * pointer with drmModeFreeConnector().
+ */
+drmModeConnectorPtr unigraf_get_connector(int drm_fd);
+
/**
* unigraf_read_edid() - Read the EDID from the specified input
* @dev: The device handle
--
2.50.1
More information about the igt-dev
mailing list