From: Jani Nikula <jani.nikula@intel.com>
To: Pranay Samala <pranay.samala@intel.com>, igt-dev@lists.freedesktop.org
Cc: karthik.b.s@intel.com, kunal1.joshi@intel.com,
sameer.lattannavar@intel.com, pranay.samala@intel.com
Subject: Re: [PATCH i-g-t v3 4/5] tests/kms: Add parse_bitmask support for user
Date: Thu, 03 Apr 2025 18:18:03 +0300 [thread overview]
Message-ID: <8734ep1dg4.fsf@intel.com> (raw)
In-Reply-To: <20250401092015.818465-5-pranay.samala@intel.com>
On Tue, 01 Apr 2025, Pranay Samala <pranay.samala@intel.com> wrote:
> The user can dynamically provide a mask during execution, giving them
> more control over the debug mask. This is useful in scenarios where
> different masks are needed for different tests or configurations without
> modifying the code itself.
*Why* are different debug masks useful? What are you trying to
accomplish?
> If the user does not provide a mask, the system defaults to 0x04.
Why? What is this based on? You might mention it's KMS, but it lacks
e.g. DP messages which might be useful for link training fallback. And
some other masks might be useful for other tests.
> This
> ensures that the test can still run without requiring any extra input.
>
> Fixes: a2ab0ec12ef4 ("tests/kms_atomic_transition: Reducing debug loglevel dynamically")
> Fixes: 4baeb7397d71 ("tests/intel/kms_dp_linktrain_fallback: Reduce debug loglevel dynamically")
> Fixes: 7a8a3744466f ("tests/kms_cursor_legacy: Reduce debug loglevel dynamically")
> Signed-off-by: Pranay Samala <pranay.samala@intel.com>
> ---
> tests/intel/kms_dp_linktrain_fallback.c | 37 +++++++++++++++++++------
> tests/kms_atomic_transition.c | 24 ++++++++--------
> tests/kms_cursor_legacy.c | 37 ++++++++++++++++++-------
> 3 files changed, 68 insertions(+), 30 deletions(-)
>
> diff --git a/tests/intel/kms_dp_linktrain_fallback.c b/tests/intel/kms_dp_linktrain_fallback.c
> index 6a872efd2..a6f7b586f 100644
> --- a/tests/intel/kms_dp_linktrain_fallback.c
> +++ b/tests/intel/kms_dp_linktrain_fallback.c
> @@ -608,12 +608,33 @@ static bool run_dsc_sst_fallaback_test(data_t *data)
> return ran;
> }
>
> -igt_main
> +static unsigned int parse_bitmask;
> +static unsigned int def_mask = 0x4;
What do you gain by having two variables for this?
Neither parse_bitmask nor def_mask describe *what* mask they represent.
> +
> +static int opt_handler(int opt, int opt_index, void *_data)
> +{
> + switch (opt) {
> + case 'b':
> + parse_bitmask = strtoul(optarg, NULL, 16);
> + break;
> + }
> +
> + return IGT_OPT_HANDLER_SUCCESS;
> +}
> +
> +static const struct option long_opts[] = {
> + { .name = "bitmask", .has_arg = true, .val = 'b', },
> + {}
> +};
> +
> +static const char help_str[] =
> + " --bitmask\t\tSpecify a bitmask in hexadecimal\n";
How is that in any way helpful to the user? Which bitmask?
And why does it have to be in hex? Just leave the strtoul base parameter
to 0 and you can use the exact same values as you'd use for drm.debug
parameter i.e. 0x prefix for hex.
Ditto for the duplication in other files.
> +
> +igt_main_args("", long_opts, help_str, opt_handler, NULL)
> {
> data_t data = {};
>
> igt_fixture {
> - int dir, current_log_level;
> data.drm_fd = drm_open_driver_master(DRIVER_INTEL |
> DRIVER_XE);
> kmstest_set_vt_graphics_mode();
> @@ -621,14 +642,12 @@ igt_main
> igt_display_require_output(&data.display);
> for_each_pipe(&data.display, data.pipe)
> data.n_pipes++;
> - dir = igt_sysfs_drm_module_params_open();
> - if (dir >= 0) {
> - current_log_level = igt_drm_debug_level_get(dir);
> - close(dir);
>
> - if (current_log_level > 10)
> - igt_drm_debug_level_update(10);
> - }
> + if (parse_bitmask)
> + igt_drm_debug_mask_update(parse_bitmask);
> + else
> + igt_drm_debug_mask_update(def_mask);
> +
> /*
> * Some environments may have environment
> * variable set to ignore long hpd, disable it for this test
> diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
> index 2b64424ce..a92edc2b1 100644
> --- a/tests/kms_atomic_transition.c
> +++ b/tests/kms_atomic_transition.c
> @@ -1096,6 +1096,9 @@ static bool pipe_output_combo_valid(igt_display_t *display,
> return ret;
> }
>
> +static unsigned int parse_bitmask;
> +static unsigned int def_mask = 0x4;
> +
> static int opt_handler(int opt, int opt_index, void *_data)
> {
> data_t *data = _data;
> @@ -1104,6 +1107,9 @@ static int opt_handler(int opt, int opt_index, void *_data)
> case 'e':
> data->extended = true;
> break;
> + case 'b':
> + parse_bitmask = strtoul(optarg, NULL, 16);
> + break;
> }
>
> return IGT_OPT_HANDLER_SUCCESS;
> @@ -1111,11 +1117,13 @@ static int opt_handler(int opt, int opt_index, void *_data)
>
> static const struct option long_opts[] = {
> { .name = "extended", .has_arg = false, .val = 'e', },
> + { .name = "bitmask", .has_arg = true, .val = 'b', },
> {}
> };
>
> static const char help_str[] =
> - " --extended\t\tRun the extended tests\n";
> + " --extended\t\tRun the extended tests\n"
> + " --bitmask\t\tSpecify a bitmask in hexadecimal\n";
>
> static data_t data;
>
> @@ -1174,8 +1182,6 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
> int pipe_count = 0;
>
> igt_fixture {
> - int dir, current_log_level;
> -
> data.drm_fd = drm_open_driver_master(DRIVER_ANY);
>
> kmstest_set_vt_graphics_mode();
> @@ -1188,14 +1194,10 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
> for_each_connected_output(&data.display, output)
> count++;
>
> - dir = igt_sysfs_drm_module_params_open();
> - if (dir >= 0) {
> - current_log_level = igt_drm_debug_level_get(dir);
> - close(dir);
> -
> - if (current_log_level > 10)
> - igt_drm_debug_level_update(10);
> - }
> + if (parse_bitmask)
> + igt_drm_debug_mask_update(parse_bitmask);
> + else
> + igt_drm_debug_mask_update(def_mask);
> }
>
> igt_describe("Check toggling of primary plane with vblank");
> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
> index 44f031e7b..09d511935 100644
> --- a/tests/kms_cursor_legacy.c
> +++ b/tests/kms_cursor_legacy.c
> @@ -1823,7 +1823,29 @@ static void modeset_atomic_cursor_hotspot(igt_display_t *display)
> igt_remove_fb(display->drm_fd, &cursor_fb);
> }
>
> -igt_main
> +static unsigned int parse_bitmask;
> +static unsigned int def_mask = 0x4;
> +
> +static int opt_handler(int opt, int opt_index, void *_data)
> +{
> + switch (opt) {
> + case 'b':
> + parse_bitmask = strtoul(optarg, NULL, 16);
> + break;
> + }
> +
> + return IGT_OPT_HANDLER_SUCCESS;
> +}
> +
> +static const struct option long_opts[] = {
> + { .name = "bitmask", .has_arg = true, .val = 'b', },
> + {}
> +};
> +
> +static const char help_str[] =
> + " --bitmask\t\tSpecify a bitmask in hexadecimal\n";
> +
> +igt_main_args("", long_opts, help_str, opt_handler, NULL)
> {
> const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
> igt_display_t display = { .drm_fd = -1 };
> @@ -1839,7 +1861,6 @@ igt_main
> };
>
> igt_fixture {
> - int dir, current_log_level;
> display.drm_fd = drm_open_driver_master(DRIVER_ANY);
> kmstest_set_vt_graphics_mode();
>
> @@ -1851,14 +1872,10 @@ igt_main
> */
> intel_psr2_restore = i915_psr2_sel_fetch_to_psr1(display.drm_fd, NULL);
>
> - dir = igt_sysfs_drm_module_params_open();
> - if (dir >= 0) {
> - current_log_level = igt_drm_debug_level_get(dir);
> - close(dir);
> -
> - if (current_log_level > 10)
> - igt_drm_debug_level_update(10);
> - }
> + if (parse_bitmask)
> + igt_drm_debug_mask_update(parse_bitmask);
> + else
> + igt_drm_debug_mask_update(def_mask);
> }
>
> igt_describe("Test checks how many cursor updates we can fit between vblanks "
--
Jani Nikula, Intel
next prev parent reply other threads:[~2025-04-03 15:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 9:20 [PATCH i-g-t v3 0/5] Refactor DRM Debug Severity Handling for Pranay Samala
2025-04-01 9:20 ` [PATCH i-g-t v3 1/5] lib/igt_sysfs: Usage of Original debug mask to read/reset Pranay Samala
2025-04-23 11:49 ` [i-g-t,v3,1/5] " Joshi, Kunal1
2025-04-01 9:20 ` [PATCH i-g-t v3 2/5] lib/igt_sysfs: Rename debug level APIs/variables to debug mask Pranay Samala
2025-04-23 11:56 ` [i-g-t,v3,2/5] " Joshi, Kunal1
2025-04-01 9:20 ` [PATCH i-g-t v3 3/5] lib/igt_sysfs: Update new debug mask requested by user Pranay Samala
2025-04-01 9:20 ` [PATCH i-g-t v3 4/5] tests/kms: Add parse_bitmask support for user Pranay Samala
2025-04-03 15:18 ` Jani Nikula [this message]
2025-04-23 12:23 ` [i-g-t,v3,4/5] " Joshi, Kunal1
2025-04-01 9:20 ` [PATCH i-g-t v3 5/5] lib/igt_sysfs: Move igt_exit_handler into test Pranay Samala
2025-04-01 10:04 ` [PATCH i-g-t v3 0/5] Refactor DRM Debug Severity Handling for Samala, Pranay
2025-04-01 12:24 ` ✗ i915.CI.BAT: failure for " Patchwork
2025-04-01 12:30 ` ✓ Xe.CI.BAT: success " Patchwork
2025-04-01 14:39 ` ✗ Xe.CI.Full: failure " Patchwork
2025-04-06 22:24 ` Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8734ep1dg4.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=karthik.b.s@intel.com \
--cc=kunal1.joshi@intel.com \
--cc=pranay.samala@intel.com \
--cc=sameer.lattannavar@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox