tests/chamelium: Integrate the chamelium v3
Subsystems (2)
v3 cover tests/chamelium: Integrate the chamelium v3
Hi all,
This patch series introduces a new wrapper for the Chameleon v3 board, a testing tool used primarily for Chromebooks, but also by community members to increase test coverage of graphic devices. The Chameleon v3 is an upgrade from its predecessor, with the ability to emulate 2 HDMI and 2 DisplayPort devices, including MST devices.
The board can read and analyze any stream on the DisplayPort and HDMI cables, and even take captures, making it an ideal tool for testing hardware, driver, and user space behavior in specific situations, such as screen hotplugging and multiple MST screens. However, the changes between the v2 and v3, such as the addition of MST support and the removal of CRC for screen captures, would require significant modifications to the existing tests and wrappers.
To avoid this complexity and ensure that the Chameleon v3 is fully supported and the v2 is not broken, I wrote a new wrapper with simplicity and ease of use in mind. The Chameleon v3 wrapper should only manage the Chameleon itself, without the need for DRM displays, EDID caching/modifications, or state machines. This approach will make it easier for developers to use the Chameleon v3 and contribute to its development.
This series depends on:
-https://lore.kernel.org/igt-dev/[email protected] -https://lore.kernel.org/igt-dev/[email protected] -https://lore.kernel.org/igt-dev/[email protected]
In addition, I will send more series to:
- add more methods to the chamelium wrapper
- add new options in the configuration file to configure the chamelium
- add tests for the cv3
---
Changes in v3:
- Rebased and splitted the series
- Fixed few build issues
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Mainly splitting and cleaning work since the RFC,
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Louis Chauvet (5):
lib/chamelium/v3: Introduce the foundation for the Chamelium v3 wrapper lib/chamelium/v3: Introduce initialization and cleanup of Chamelium-related structures lib/chamelium/v3: Add method to discover Chamelium ports lib/chamelium/v3: Implement method to retrieve Chamelium port names tests/chamelium/v3: Implement a basic Chamelium v3 accessibility test
lib/chamelium/v3/igt_chamelium.c | 309 ++++++++++++++++++++++++++++ lib/chamelium/v3/igt_chamelium.h | 52 +++++ lib/igt_kms.c | 8 + lib/meson.build | 12 +- lib/tests/meson.build | 4 + meson.build | 15 +- meson_options.txt | 4 + tests/chamelium/v3/kms_chamelium_v3_basic.c | 30 +++ tests/meson.build | 26 +++ 9 files changed, 458 insertions(+), 2 deletions(-)
---
base-commit: 9b8c0f6da8898f760bfaa2113455eb84b68a69f4
change-id: 20240522-dev-remove-static-ports-9382ffbbf146
prerequisite-message-id: [email protected]
prerequisite-patch-id: 0562bbe57a0b489e7f46a51717c54ea26296cb8c
prerequisite-patch-id: a16d6fdd238eab5a91630d0934c9186669406fc7
prerequisite-patch-id: c7fcc64d709f283da748a0f9bbe3bd6143d76300
prerequisite-patch-id: 09fc5e2f569fa8287e767ceb353bc0a0f94ae2e1
prerequisite-patch-id: 63cf2f6323333bb8cbd0dbbd883b5c9fe373dea1
prerequisite-message-id: [email protected]
prerequisite-patch-id: 90ffdddeda6dd4cd2ae64e60fb31b0bbfee0250f
prerequisite-patch-id: d62e9d4981a68ac6e71544ab2a3dfec37dfa3299
prerequisite-patch-id: 3d898f58702cc303e18d3afc487e46f68641989b
prerequisite-patch-id: 57f5446073d42a01c29e6ff8a24f6609eedb49a1
prerequisite-patch-id: e6d6ee4ecd0e738a60091b19449c8622bb8bb6ae
prerequisite-message-id: [email protected]
prerequisite-patch-id: 4ac6bf11d25e80e99d5607d4864c3c7b4273dde3
prerequisite-patch-id: 2246b4289eca0b8e8b02519051af7564b0875a2a
prerequisite-patch-id: 394057bc39308265a03e026ac924f88d3d933d49
prerequisite-patch-id: ad1f0838e81fa620013313316afd35a3d5c146fa
Best regards,
Signature · 1 line
Louis Chauvet <[email protected]>
PATCH v3 1/5 lib/chamelium/v3: Introduce the foundation for the Chamelium v3 wrapper
Adds a build option to enable building the Chamelium v3 wrapper.
--- lib/chamelium/v3/igt_chamelium.c | 9 +++++++++ lib/chamelium/v3/igt_chamelium.h | 8 ++++++++ lib/igt_kms.c | 8 ++++++++ lib/meson.build | 12 +++++++++++- lib/tests/meson.build | 4 ++++ meson.build | 15 ++++++++++++++- meson_options.txt | 4 ++++ tests/meson.build | 25 +++++++++++++++++++++++++ 8 files changed, 83 insertions(+), 2 deletions(-)
lib/chamelium/v3/igt_chamelium.c new file +9 -0
@@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT + +#include <igt_core.h> +#include "igt_chamelium.h" + +void chamelium_v3_init (void ) +{ +igt_info ("Using chamelium v3\n" ); +}
lib/chamelium/v3/igt_chamelium.h new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef V3_IGT_CHAMELIUM_H +#define V3_IGT_CHAMELIUM_H + +void chamelium_v3_init (void ); + +#endif //V3_IGT_CHAMELIUM_H
lib/igt_kms.c +8 -0
@@ -2908,7 +2908,14 @@ void igt_display_require(igt_display_t *display, int drm_fd)if (!resources) goto out; +/* +* FIXME: Dirty hack to avoid those lines when chamelium v3 is used +* +* Must be replaced with a configuration file information, so the end user can choose if the +* chamelium must be connected or not. +*/ #ifdef HAVE_CHAMELIUM_V2 +#ifndef HAVE_CHAMELIUM_V3 { struct chamelium *chamelium;
@@ -2923,6 +2930,7 @@ void igt_display_require(igt_display_t *display, int drm_fd)chamelium_deinit_rpc_only (chamelium); } } +#endif #endif igt_require_f(resources->count_crtcs <= IGT_MAX_PIPES,
lib/meson.build +11 -1
@@ -195,7 +195,6 @@ if chamelium_v2.found() 'chamelium/v2/igt_chamelium.c', 'chamelium/v2/igt_chamelium_stream.c' ] - lib_sources += 'monitor_edids/monitor_edids_helper.c' endif if build_xe_eudebug
@@ -203,6 +202,17 @@ if build_xe_eudebug lib_sources += 'xe/xe_eudebug.c' endif +if chamelium_v3.found() + lib_deps += chamelium_v3 + lib_sources += [ + 'chamelium/v3/igt_chamelium.c', + ] +endif + +if chamelium_v2.found() or chamelium_v3.found() + lib_sources += 'monitor_edids/monitor_edids_helper.c' +endif + if libprocps.found() lib_deps += libprocps else
lib/tests/meson.build +4 -0
@@ -41,6 +41,10 @@ if chamelium_v2.found() lib_tests += 'igt_audio' endif +if chamelium_v3.found() + lib_deps += chamelium_v3 +endif + foreach lib_test : lib_tests exec = executable(lib_test, lib_test + '.c', install : false, dependencies : igt_deps)
meson.build +14 -1
@@ -87,6 +87,7 @@ foreach cc_arg : cc_args endforeach build_chamelium_v2 = get_option('chamelium_v2') +build_chamelium_v3 = get_option('chamelium_v3') build_docs = get_option('docs') build_tests = not get_option('tests').disabled() build_xe = not get_option('xe_driver').disabled()
@@ -174,7 +175,7 @@ if not xmlrpc.found() and xmlrpc_cmd.found() endif endif -if build_chamelium_v2.enabled() and not (xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()) +if (build_chamelium_v2.enabled() or build_chamelium_v3.enabled()) and not (xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()) error('Chamelium build forced and required dependency xmlrpc not found') endif
@@ -197,6 +198,18 @@ endif build_info += 'Build Chamelium v2 test: @0@'.format(chamelium_v2.found()) + +if xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found() and libcurl.found() + config.set('HAVE_CHAMELIUM_V3', 1) + chamelium_v3 = declare_dependency(dependencies : [ + xmlrpc, + xmlrpc_util, + xmlrpc_client, + ]) +else + chamelium_v3 = disabler() +endif + pthreads = dependency('threads') math = cc.find_library('m') realtime = cc.find_library('rt')
meson_options.txt +4 -0
@@ -12,6 +12,10 @@ option('chamelium_v2', type : 'feature', description : 'Build Chamelium v2 test') +option('chamelium_v3', + type : 'feature', + description : 'Build Chamelium v3 tests') + option('valgrind', type : 'feature', description : 'Build with support for valgrind annotations')
tests/meson.build +25 -0
@@ -340,6 +340,9 @@ chamelium_v2_progs = [ 'kms_chamelium_hpd', ] +chamelium_v3_progs = [ +] + test_deps = [ igt_deps ] if libdrm_nouveau.found()
@@ -457,6 +460,28 @@ if chamelium_v2.found() test_deps += chamelium_v2 endif +if chamelium_v3.found() + foreach prog : chamelium_v3_progs + testexe = executable(prog, + [join_paths('chamelium', 'v3', prog + '.c')], + dependencies : test_deps, + install_dir : libexecdir, + install_rpath : libexecdir_rpathdir, + install : true) + test_list += prog + test_executables += testexe + name = prog.split('/').get(-1) + if not meson.is_cross_build() + testlist_files += custom_target(name + '.testlist', + build_by_default : true, + command : [testexe, '--show-testlist'], + capture : true, + output : name + '.testlist') + endif + endforeach + test_deps += chamelium_v3 +endif + subdir('amdgpu') subdir('msm')
Signature · 1 line
2.46.2
Re: [PATCH i-g-t v3 1/5] lib/chamelium/v3: Introduce the foundation for the Chamelium v3 wrapper
Hi Louis,
Quoted 137 lines · Louis Chauvet
Adds a build option to enable building the Chamelium v3 wrapper.
Signed-off-by Louis Chauvet <[email protected]>--- lib/chamelium/v3/igt_chamelium.c | 9 +++++++++ lib/chamelium/v3/igt_chamelium.h | 8 ++++++++ lib/igt_kms.c | 8 ++++++++ lib/meson.build | 12 +++++++++++- lib/tests/meson.build | 4 ++++ meson.build | 15 ++++++++++++++- meson_options.txt | 4 ++++ tests/meson.build | 25 +++++++++++++++++++++++++ 8 files changed, 83 insertions(+), 2 deletions(-)lib/chamelium/v3/igt_chamelium.c new file +9
-0@@ -0,0 +1,9 @@ +// SPDX-License-Identifier: MIT + +#include <igt_core.h> +#include "igt_chamelium.h" + +void chamelium_v3_init (void ) +{ +igt_info ("Using chamelium v3\n" ); +}lib/chamelium/v3/igt_chamelium.h new file +8
-0@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef V3_IGT_CHAMELIUM_H +#define V3_IGT_CHAMELIUM_H + +void chamelium_v3_init (void ); + +#endif //V3_IGT_CHAMELIUM_H lib/igt_kms.c +8
-0@@ -2908,7 +2908,14 @@ void igt_display_require(igt_display_t *display, int drm_fd)if (!resources) goto out; +/* +* FIXME: Dirty hack to avoid those lines when chamelium v3 is used +* +* Must be replaced with a configuration file information, so the end user can choose if the +* chamelium must be connected or not. +*/ #ifdef HAVE_CHAMELIUM_V2 +#ifndef HAVE_CHAMELIUM_V3 { struct chamelium *chamelium;@@ -2923,6 +2930,7 @@ void igt_display_require(igt_display_t *display, int drm_fd)chamelium_deinit_rpc_only (chamelium); } } +#endif #endif igt_require_f(resources->count_crtcs <= IGT_MAX_PIPES,lib/meson.build +11
-1@@ -195,7 +195,6 @@ if chamelium_v2.found() 'chamelium/v2/igt_chamelium.c', 'chamelium/v2/igt_chamelium_stream.c' ] - lib_sources += 'monitor_edids/monitor_edids_helper.c' endif if build_xe_eudebug@@ -203,6 +202,17 @@ if build_xe_eudebug lib_sources += 'xe/xe_eudebug.c' endif +if chamelium_v3.found() + lib_deps += chamelium_v3 + lib_sources += [ + 'chamelium/v3/igt_chamelium.c', + ] +endif + +if chamelium_v2.found() or chamelium_v3.found() + lib_sources += 'monitor_edids/monitor_edids_helper.c' +endif + if libprocps.found() lib_deps += libprocps elselib/tests/meson.build +4
-0@@ -41,6 +41,10 @@ if chamelium_v2.found() lib_tests += 'igt_audio' endif +if chamelium_v3.found() + lib_deps += chamelium_v3 +endif + foreach lib_test : lib_tests exec = executable(lib_test, lib_test + '.c', install : false, dependencies : igt_deps)meson.build +2
-1@@ -87,6 +87,7 @@ foreach cc_arg : cc_args endforeach build_chamelium_v2 = get_option('chamelium_v2') +build_chamelium_v3 = get_option('chamelium_v3') build_docs = get_option('docs') build_tests = not get_option('tests').disabled() build_xe = not get_option('xe_driver').disabled()@@ -174,7 +175,7 @@ if not xmlrpc.found() and xmlrpc_cmd.found() endif endif -if build_chamelium_v2.enabled() and not (xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()) +if (build_chamelium_v2.enabled() or build_chamelium_v3.enabled()) and not (xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()) error('Chamelium build forced and required dependency xmlrpc not found') endif
meson.build endif · line 199
Quoted 2 lines
meson.build +0
-0@@ -197,6 +198,18 @@ endif build_info += 'Build Chamelium v2 test: @0@'.format(chamelium_v2.found())
We need to add this for Chamelium v3 test also?
Quoted 65 lines
meson.build +12
-0+ +if xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found() and libcurl.found() + config.set('HAVE_CHAMELIUM_V3', 1) + chamelium_v3 = declare_dependency(dependencies : [ + xmlrpc, + xmlrpc_util, + xmlrpc_client, + ]) +else + chamelium_v3 = disabler() +endif + pthreads = dependency('threads') math = cc.find_library('m') realtime = cc.find_library('rt')meson_options.txt +4
-0@@ -12,6 +12,10 @@ option('chamelium_v2', type : 'feature', description : 'Build Chamelium v2 test') +option('chamelium_v3', + type : 'feature', + description : 'Build Chamelium v3 tests') + option('valgrind', type : 'feature', description : 'Build with support for valgrind annotations')tests/meson.build +18
-0@@ -340,6 +340,9 @@ chamelium_v2_progs = [ 'kms_chamelium_hpd', ] +chamelium_v3_progs = [ +] + test_deps = [ igt_deps ] if libdrm_nouveau.found()@@ -457,6 +460,28 @@ if chamelium_v2.found() test_deps += chamelium_v2 endif +if chamelium_v3.found() + foreach prog : chamelium_v3_progs + testexe = executable(prog, + [join_paths('chamelium', 'v3', prog + '.c')], + dependencies : test_deps, + install_dir : libexecdir, + install_rpath : libexecdir_rpathdir, + install : true) + test_list += prog + test_executables += testexe + name = prog.split('/').get(-1) + if not meson.is_cross_build() + testlist_files += custom_target(name + '.testlist', + build_by_default : true, + command : [testexe, '--show-testlist'],
tests/meson.build if chamelium_v2.found() · line 487
Quoted 10 lines
tests/meson.build +7
-0+ capture : true, + output : name + '.testlist') + endif + endforeach + test_deps += chamelium_v3 +endif + subdir('amdgpu') subdir('msm')
Regards,
Vignesh
Re: [i-g-t, v3, 1/5] lib/chamelium/v3: Introduce the foundation for the Chamelium v3 wrapper
In reply to Louis ChauvetHello,
Quoted 14 lines · Louis Chauvet
Adds a build option to enable building the Chamelium v3 wrapper.
Signed-off-by Louis Chauvet <[email protected]>--- lib/chamelium/v3/igt_chamelium.c | 9 +++++++++ lib/chamelium/v3/igt_chamelium.h | 8 ++++++++ lib/igt_kms.c | 8 ++++++++ lib/meson.build | 12 +++++++++++- lib/tests/meson.build | 4 ++++ meson.build | 15 ++++++++++++++- meson_options.txt | 4 ++++ tests/meson.build | 25 +++++++++++++++++++++++++ 8 files changed, 83 insertions(+), 2 deletions(-)
Can you please sent all below series together, need to test changes once before reviewing.
[1] [https://patchwork.freedesktop.org/series/137915/]
[2] [https://patchwork.freedesktop.org/series/137925/]
[3] [https://patchwork.freedesktop.org/series/140319/]
[4] [https://patchwork.freedesktop.org/series/140328/]
Thanks and Regards
Kunal Joshi
PATCH v3 2/5 lib/chamelium/v3: Introduce initialization and cleanup of Chamelium-related structures
In reply to Louis ChauvetIn preparation for utilizing the Chamelium in tests, this commit introduces a few helper functions to read the Chamelium configuration from a file and initialize RPC-related structures.
--- lib/chamelium/v3/igt_chamelium.c | 148 ++++++++++++++++++++++++++++++++++++++- lib/chamelium/v3/igt_chamelium.h | 39 ++++++++++- 2 files changed, 183 insertions(+), 4 deletions(-)
lib/chamelium/v3/igt_chamelium.c +145 -3
@@ -1,9 +1,151 @@// SPDX-License-Identifier: MIT -#include <igt_core.h> +#include <xmlrpc-c/base.h> +#include <xmlrpc-c/client.h> +#include "igt_chamelium.h" +#include "igt_core.h" +#include "igt_rc.h" + +#define CHAMELIUM_CONFIG_SECTION "Chameliumv3" +#define CHAMELIUM_CONFIG_URL "URL" + +struct igt_chamelium_v3 { +xmlrpc_env env; +xmlrpc_client *client; +char *url; + +struct igt_list_head port_mapping; +}; + +/** +* chamelium_v3_port_mapping_alloc - Allocate a port mapping with some default values +* +* @port_mapping: port mapping to free. The caller must remove the element from the list. +*/ +static struct chamelium_v3_port_mapping *chamelium_v3_port_mapping_alloc (void ) +{ +struct chamelium_v3_port_mapping *port_mapping =malloc (sizeof (*port_mapping)); + +igt_assert (port_mapping); + port_mapping->connector_name =NULL ; + port_mapping->mst_path =NULL ; + port_mapping->port_id =0 ; + port_mapping->parent_id =0 ; + port_mapping->is_children = false; +return port_mapping; +} -void chamelium_v3_init (void ) +/** +* chamelium_v3_port_mapping_free - Free memory assiciated with a port mapping +* +* @port_mapping: port mapping to free. The caller must remove the element from the list. +*/ +static void chamelium_v3_port_mapping_free (struct chamelium_v3_port_mapping *port_mapping) { -igt_info ("Using chamelium v3\n" ); +if (port_mapping->connector_name) +free (port_mapping->connector_name); +if (port_mapping->mst_path) +free (port_mapping->mst_path); +free (port_mapping); } + +/** +* chamelium_v3_init() - Initialize the RPC connexion with a chamelium +* +* @url: URL to connect to the chamelium +* +* Returns a igt_chamelium_v3 pointer, which must be freed by chamelium_v3_uninit. +*/ +struct igt_chamelium_v3 *chamelium_v3_init (char *url) +{ +struct igt_chamelium_v3 *chamelium =malloc (sizeof (struct igt_chamelium_v3 )); +struct xmlrpc_clientparms clientparms; +struct xmlrpc_curl_xportparms curlparms; + +if (!chamelium) +return NULL ; + +memset (chamelium,0 ,sizeof (*chamelium)); +memset (&clientparms,0 ,sizeof (clientparms)); +memset (&curlparms,0 ,sizeof (curlparms)); + +/* curl's timeout is in milliseconds */ + curlparms.timeout =10 *1000 ; + + clientparms.transport ="curl" ; + clientparms.transportparmsP = &curlparms; + clientparms.transportparm_size =XMLRPC_CXPSIZE (timeout); + +/* Setup the libxmlrpc context */ +xmlrpc_env_init (&chamelium->env); +xmlrpc_client_setup_global_const (&chamelium->env); +xmlrpc_client_create (&chamelium->env,XMLRPC_CLIENT_NO_FLAGS ,PACKAGE , +PACKAGE_VERSION , &clientparms,0 , &chamelium->client); +if (chamelium->env.fault_occurred) { +igt_debug ("Failed to init xmlrpc: %s\n" , + chamelium->env.fault_string); + goto error; + } + + chamelium->url =strdup (url); +IGT_INIT_LIST_HEAD (&chamelium->port_mapping); + +return chamelium; +error: +chamelium_v3_uninit (chamelium); +return NULL ; +} + +/** +* chamelium_v3_init_from_config() - Initialize the RPC connexion with a chamelium from the config +* file +* +* Returns a igt_chamelium_v3 pointer, which must be freed by chamelium_v3_uninit. +*/ +struct igt_chamelium_v3 *chamelium_v3_init_from_config (void ) +{ +struct igt_chamelium_v3 *chamelium; +GError *error =NULL ; +char *url; + +if (!igt_key_file) { +igt_debug ("No configuration file available for chamelium\n" ); +return NULL ; + } + + url =g_key_file_get_string (igt_key_file,CHAMELIUM_CONFIG_SECTION ,CHAMELIUM_CONFIG_URL , + &error); +if (!url) { +igt_debug ("Couldn't read chamelium URL from config file: %s\n" , error->message); +return false; + } + + chamelium =chamelium_v3_init (url); +free (url); +return chamelium; +} + +/** +* chamelium_v3_uninit() - Free the resources used by a chamelium +* +* @chamelium: The Chamelium instance to free +* +* Frees the resources used by a connection to the chamelium that was set up +* with chamelium_rpc_init(). +*/ +void chamelium_v3_uninit (struct igt_chamelium_v3 *chamelium) +{ +struct chamelium_v3_port_mapping *port_mapping, *tmp_port_mapping; + +/* Destroy any mapping we created to make sure we don't leak them */ +igt_list_for_each_entry_safe (port_mapping, tmp_port_mapping, &chamelium->port_mapping, + link) { +chamelium_v3_port_mapping_free (port_mapping); + } +xmlrpc_client_destroy (chamelium->client); +xmlrpc_env_clean (&chamelium->env); +free (chamelium->url); +free (chamelium); +} +
lib/chamelium/v3/igt_chamelium.h +38 -1
@@ -3,6 +3,43 @@#ifndef V3_IGT_CHAMELIUM_H #define V3_IGT_CHAMELIUM_H -void chamelium_v3_init (void ); +#include <stdint.h> + +#include "igt_list.h" + +struct igt_chamelium_v3 ; +typedef uint32_t chamelium_v3_port_id ; + +/** struct chamelium_v3_port_mapping - Represent a mapping between a DRM connector and a port on +* the chamelium +* +* @port_id: Chamelium port ID. +* @connector_name: DRM connector name, used to identify the connector in DRM, mutually exclusive +* with @mst_path +* @mst_path: MST path property, used to identify the connector in DRM, mutually exclusive with +* @mst_path +* @is_children: Used to indicate that this chamelium port is a children and can't be plugged alone +* @parent_id: Used when @is_children is true to point to the correct parent in chamelium +* @link: Linked list structure +*/ +struct chamelium_v3_port_mapping { +chamelium_v3_port_id port_id; + +/* For normal DRM connector */ +char *connector_name; + +/* For MST connector */ +char *mst_path; +bool is_children; +chamelium_v3_port_id parent_id; + +/* Implementation details */ +struct igt_list_head link; +}; + +struct igt_chamelium_v3 *chamelium_v3_init (char *url); +struct igt_chamelium_v3 *chamelium_v3_init_from_config (void ); + +void chamelium_v3_uninit (struct igt_chamelium_v3 *chamelium);#endif //V3_IGT_CHAMELIUM_H
Signature · 1 line
2.46.2
PATCH v3 3/5 lib/chamelium/v3: Add method to discover Chamelium ports
In reply to Louis ChauvetSince Chamelium v3 ports can change (recently added MST ports, for example), they need to be discovered to prevent using an incorrect port.
This commit introduces the RPC calls GetSupportedPorts, IsMst, and GetChildren to list all ports, check if a port is MST-capable, and fetch the child ports of MST ports, respectively.
--- lib/chamelium/v3/igt_chamelium.c | 133 +++++++++++++++++++++++++++++++++++++++ lib/chamelium/v3/igt_chamelium.h | 6 ++ 2 files changed, 139 insertions(+)
lib/chamelium/v3/igt_chamelium.c +133 -0
@@ -149,3 +149,136 @@ void chamelium_v3_uninit(struct igt_chamelium_v3 *chamelium)free (chamelium); } +/** +* __chamelium_rpc - Call a remote function on the chamelium +* +* @chamelium: Chamelium to call the function on +* @method_name: RPC endpoint name +* @format_str: RPC parameters description +* @...: RPC parameters +* +* Returns a xmlrpc_value that contains the call result. +*/ +static xmlrpc_value *__chamelium_rpc (struct igt_chamelium_v3 *chamelium, +const char *method_name, +const char *format_str, + ...) +{ +xmlrpc_value *res; +va_list va_args; + +if (chamelium->env.fault_occurred) { +xmlrpc_env_clean (&chamelium->env); +xmlrpc_env_init (&chamelium->env); + } +va_start (va_args, format_str); +xmlrpc_client_call2f_va (&chamelium->env, chamelium->client, + chamelium->url, method_name, format_str, &res, + va_args); +va_end (va_args); +igt_assert_f (!chamelium->env.fault_occurred, +"Chamelium RPC call[%s] failed: %s\n" , method_name, + chamelium->env.fault_string); +return res; +} + +/* +* For the RPC calls, please refer to the python code [1] for documentation. +* +* [1]: https://chromium.googlesource.com/chromiumos/platform/chameleon/+/refs/heads/main/v3/chameleond/v3.py +*/ + +/** +* chamelium_v3_get_supported_ports - Get the list of ports on the chamelium +* +* @chamelium: Chamelium to get the ports from +* @port_ids: Out pointer for the list of port ids +* +* Returns the number of element stored in @port_ids. The caller must free this pointer when not +* used anymore. +*/ +int chamelium_v3_get_supported_ports (struct igt_chamelium_v3 *chamelium, +chamelium_v3_port_id **port_ids) +{ +xmlrpc_value *res, *res_port; +int port_count, i; + +igt_assert (port_ids); + +igt_debug ("RPC GetSupportedPorts()\n" ); + res =__chamelium_rpc (chamelium,"GetSupportedPorts" ,"()" ); + + port_count =xmlrpc_array_size (&chamelium->env, res); + *port_ids =calloc (port_count,sizeof (**port_ids)); + +for (i =0 ; i < port_count; i++) { +xmlrpc_array_read_item (&chamelium->env, res, i, &res_port); +xmlrpc_read_int (&chamelium->env, res_port, (int *)&(*port_ids)[i]); +xmlrpc_DECREF (res_port); + } +xmlrpc_DECREF (res); + +return port_count; +} + +/** +* chamelium_v3_get_supported_ports - Get the list of children port for a specific port on the +* chamelium +* +* @chamelium: Chamelium to get the ports from +* @port_id: Parent port id to get the children port from +* @port_ids: Out pointer for the list of port ids +* +* MST ports on the chamelium have children ports that can be plugged independently, but are always +* connected with a parent connector. +* +* Returns the number of element stored in @port_ids. The caller must free this pointer when not +* used anymore. +*/ +int chamelium_v3_get_children (struct igt_chamelium_v3 *chamelium,chamelium_v3_port_id port_id, +chamelium_v3_port_id **port_ids) +{ +xmlrpc_value *res, *res_port; +int port_count, i; + +igt_debug ("RPC GetChildren(%d)\n" , port_id); + res =__chamelium_rpc (chamelium,"GetChildren" ,"(i)" , port_id); + + port_count =xmlrpc_array_size (&chamelium->env, res); + *port_ids =calloc (port_count,sizeof (**port_ids)); + +for (i =0 ; i < port_count; i++) { +xmlrpc_array_read_item (&chamelium->env, res, i, &res_port); +xmlrpc_read_int (&chamelium->env, res_port, (int *)&(*port_ids)[i]); +xmlrpc_DECREF (res_port); + } +xmlrpc_DECREF (res); + +return port_count; +} + +/** +* chamelium_v3_is_mst - Get the MST support for a specific port +* +* @chamelium: Chamelium to get the ports from +* @port_id: Port to get the support from +* +* Not all ports on the chamelium support MST. This functions allows checking if a specific port +* supports MST. +* +* Returns true if the @port_id supports MST. +*/ +bool chamelium_v3_is_mst (struct igt_chamelium_v3 *chamelium,chamelium_v3_port_id port_id) +{ +xmlrpc_value *res; +xmlrpc_bool is_mst; + +igt_debug ("RPC IsMst(%d)\n" , port_id); + res =__chamelium_rpc (chamelium,"IsMst" ,"(i)" , port_id); + +xmlrpc_read_bool (&chamelium->env, res, &is_mst); + +xmlrpc_DECREF (res); + +return is_mst; +}
lib/chamelium/v3/igt_chamelium.h +6 -0
@@ -42,4 +42,10 @@ struct igt_chamelium_v3 *chamelium_v3_init_from_config(void);void chamelium_v3_uninit (struct igt_chamelium_v3 *chamelium); +int chamelium_v3_get_supported_ports (struct igt_chamelium_v3 *chamelium, +chamelium_v3_port_id **port_ids); +int chamelium_v3_get_children (struct igt_chamelium_v3 *chamelium,chamelium_v3_port_id port_id, +chamelium_v3_port_id **port_ids); +bool chamelium_v3_is_mst (struct igt_chamelium_v3 *chamelium,chamelium_v3_port_id port_id); +#endif //V3_IGT_CHAMELIUM_H
Signature · 1 line
2.46.2
PATCH v3 4/5 lib/chamelium/v3: Implement method to retrieve Chamelium port names
In reply to Louis ChauvetChamelium ports have descriptive names associated with them. This commit introduces an RPC call to fetch these names, facilitating easier debugging and better understanding of the port configuration.
--- lib/chamelium/v3/igt_chamelium.c | 25 +++++++++++++++++++++++++ lib/chamelium/v3/igt_chamelium.h | 1 + 2 files changed, 26 insertions(+)
lib/chamelium/v3/igt_chamelium.c +25 -0
@@ -282,3 +282,28 @@ bool chamelium_v3_is_mst(struct igt_chamelium_v3 *chamelium, chamelium_v3_port_ireturn is_mst; } + +/** +* chamelium_v3_get_port_name - Get the port name from its id +* +* @chamelium: Chamelium to get the ports from +* @port_id: Port to get the name +* +* Returns a string containing the port name for @port_id. The caller must free this pointer when +* not used anymore. +*/ +char *chamelium_v3_get_port_name (struct igt_chamelium_v3 *chamelium, +chamelium_v3_port_id port_id) +{ +xmlrpc_value *res; +char *port_name; + +igt_debug ("RPC GetPortName(%d)\n" , port_id); + res =__chamelium_rpc (chamelium,"GetPortName" ,"(i)" , port_id); + +xmlrpc_read_string (&chamelium->env, res, (const char **)&port_name); + +xmlrpc_DECREF (res); + +return port_name; +}
lib/chamelium/v3/igt_chamelium.h +1 -0
@@ -47,5 +47,6 @@ int chamelium_v3_get_supported_ports(struct igt_chamelium_v3 *chamelium,int chamelium_v3_get_children (struct igt_chamelium_v3 *chamelium,chamelium_v3_port_id port_id,chamelium_v3_port_id **port_ids);bool chamelium_v3_is_mst (struct igt_chamelium_v3 *chamelium,chamelium_v3_port_id port_id); +char *chamelium_v3_get_port_name (struct igt_chamelium_v3 *chamelium,chamelium_v3_port_id port_id);#endif //V3_IGT_CHAMELIUM_H
Signature · 1 line
2.46.2
PATCH v3 5/5 tests/chamelium/v3: Implement a basic Chamelium v3 accessibility test
In reply to Louis ChauvetUtilizing the RPC calls introduced earlier, this commit adds a simple test to verify if the Chamelium v3 device is accessible.
--- tests/chamelium/v3/kms_chamelium_v3_basic.c | 30 +++++++++++++++++++++++++++++ tests/meson.build | 1 + 2 files changed, 31 insertions(+)
tests/chamelium/v3/kms_chamelium_v3_basic.c new file +30 -0
@@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT + +#include <igt.h> +#include "chamelium/v3/igt_chamelium.h" + +igt_main +{ +struct igt_chamelium_v3 *chamelium; + +igt_describe ("Test if the chamelium can list all the ports." ); + igt_subtest("chamelium-list-ports") { +chamelium_v3_port_id *ports; +int port_count; + + chamelium =chamelium_v3_init_from_config (); + + port_count =chamelium_v3_get_supported_ports (chamelium, &ports); + +for (int i =0 ; i < port_count; i++) { +char *name =chamelium_v3_get_port_name (chamelium, ports[i]); + +igt_info ("Port %d: name: %s\n" , ports[i], name); +free (name); + } + +free (ports); + +chamelium_v3_uninit (chamelium); + } +}
tests/meson.build +1 -0
@@ -341,6 +341,7 @@ chamelium_v2_progs = [ ] chamelium_v3_progs = [ + 'kms_chamelium_v3_basic', ] test_deps = [ igt_deps ]
Signature · 1 line
2.46.2
Patchwork
CI✗ Fi.CI.BUILD: failure for tests/chamelium: Integrate the chamelium v3
In reply to Louis Chauvet== Series Details ==
== Series Details ==
Series: tests/chamelium: Integrate the chamelium v3
URL : https://patchwork.freedesktop.org/series/140328/
State : failure
== Summary ==
Applying: lib/chamelium/v3: Introduce the foundation for the Chamelium v3 wrapper Patch failed at 0001 lib/chamelium/v3: Introduce the foundation for the Chamelium v3 wrapper When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Re: ✗ Fi.CI.BUILD: failure for tests/chamelium: Integrate the chamelium v3
Quoted 6 lines · Patchwork
== Series Details ==
Series: tests/chamelium: Integrate the chamelium v3
URL : https://patchwork.freedesktop.org/series/140328/
State : failure
Quoted 7 lines
== Summary ==
Applying:
lib/chamelium/v3: Introduce the foundation for the Chamelium v3 wrapper Patch failed at 0001lib/chamelium/v3: Introduce the foundation for the Chamelium v3 wrapper When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Hi,
This fail is expected, as it depends on previous series:
- [email protected]
- [email protected]
- [email protected]
Thanks,
Louis Chauvet
Signature · 3 lines
Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Hi Louis,
Quoted 25 lines · Louis Chauvet
Hi all,
This patch series introduces a new wrapper for the Chameleon v3 board, a testing tool used primarily for Chromebooks, but also by community members to increase test coverage of graphic devices. The Chameleon v3 is an upgrade from its predecessor, with the ability to emulate 2 HDMI and 2 DisplayPort devices, including MST devices.
The board can read and analyze any stream on the DisplayPort and HDMI cables, and even take captures, making it an ideal tool for testing hardware, driver, and user space behavior in specific situations, such as screen hotplugging and multiple MST screens. However, the changes between the v2 and v3, such as the addition of MST support and the removal of CRC for screen captures, would require significant modifications to the existing tests and wrappers.
To avoid this complexity and ensure that the Chameleon v3 is fully supported and the v2 is not broken, I wrote a new wrapper with simplicity and ease of use in mind. The Chameleon v3 wrapper should only manage the Chameleon itself, without the need for DRM displays, EDID caching/modifications, or state machines. This approach will make it easier for developers to use the Chameleon v3 and contribute to its development.
This series depends on:
Review
Quoted 3 lines
(quoted diff) +0
-3-https://lore.kernel.org/igt-dev/[email protected] -https://lore.kernel.org/igt-dev/[email protected] -https://lore.kernel.org/igt-dev/[email protected]
I have tested this series and the dependent patches,
https://gitlab.freedesktop.org/vigneshraman/igt-gpu-tools/-/commits/test-chamelium-v3-fix/?ref_type=heads
kms_chamelium_v3_basic test passes in drm-ci,
https://gitlab.freedesktop.org/vigneshraman/linux/-/jobs/66445667
Regards,
Vignesh
Quoted 56 lines
In addition, I will send more series to:
- add more methods to the chamelium wrapper
- add new options in the configuration file to configure the chamelium
- add tests for the cv3---
Changes in v3:
- Rebased and splitted the series
- Fixed few build issues
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- Mainly splitting and cleaning work since the RFC,
- Link to v1: https://lore.kernel.org/r/[email protected]---
Louis Chauvet (5):
lib/chamelium/v3: Introduce the foundation for the Chamelium v3 wrapperlib/chamelium/v3: Introduce initialization and cleanup of Chamelium-related structureslib/chamelium/v3: Add method to discover Chamelium portslib/chamelium/v3: Implement method to retrieve Chamelium port names tests/chamelium/v3: Implement a basic Chamelium v3 accessibility testlib/chamelium/v3/igt_chamelium.c | 309 ++++++++++++++++++++++++++++ lib/chamelium/v3/igt_chamelium.h | 52 +++++ lib/igt_kms.c | 8 + lib/meson.build | 12 +- lib/tests/meson.build | 4 + meson.build | 15 +- meson_options.txt | 4 + tests/chamelium/v3/kms_chamelium_v3_basic.c | 30 +++ tests/meson.build | 26 +++ 9 files changed, 458 insertions(+), 2 deletions(-)---
base-commit:9b8c0f6da8898f760bfaa2113455eb84b68a69f4
change-id: 20240522-dev-remove-static-ports-9382ffbbf146
prerequisite-message-id: [email protected]
prerequisite-patch-id:0562bbe57a0b489e7f46a51717c54ea26296cb8c
prerequisite-patch-id:a16d6fdd238eab5a91630d0934c9186669406fc7
prerequisite-patch-id:c7fcc64d709f283da748a0f9bbe3bd6143d76300
prerequisite-patch-id:09fc5e2f569fa8287e767ceb353bc0a0f94ae2e1
prerequisite-patch-id:63cf2f6323333bb8cbd0dbbd883b5c9fe373dea1
prerequisite-message-id: [email protected]
prerequisite-patch-id:90ffdddeda6dd4cd2ae64e60fb31b0bbfee0250f
prerequisite-patch-id:d62e9d4981a68ac6e71544ab2a3dfec37dfa3299
prerequisite-patch-id:3d898f58702cc303e18d3afc487e46f68641989b
prerequisite-patch-id:57f5446073d42a01c29e6ff8a24f6609eedb49a1
prerequisite-patch-id:e6d6ee4ecd0e738a60091b19449c8622bb8bb6ae
prerequisite-message-id: [email protected]
prerequisite-patch-id:4ac6bf11d25e80e99d5607d4864c3c7b4273dde3
prerequisite-patch-id:2246b4289eca0b8e8b02519051af7564b0875a2a
prerequisite-patch-id:394057bc39308265a03e026ac924f88d3d933d49
prerequisite-patch-id:ad1f0838e81fa620013313316afd35a3d5c146faBest regards,