From: Rodrigo Siqueira Jordao <Rodrigo.Siqueira@amd.com>
To: Alex Hung <alex.hung@amd.com>, igt-dev@lists.freedesktop.org
Cc: harry.wentland@amd.com, mark.broadworth@amd.com, sunpeng.li@amd.com
Subject: Re: [PATCH 5/5] tools/amd_hdmi_compliance: Add timeout option
Date: Tue, 29 Oct 2024 10:06:57 -0600 [thread overview]
Message-ID: <659820d5-c81e-4b5d-bd35-820608832598@amd.com> (raw)
In-Reply-To: <20241024210345.511501-5-alex.hung@amd.com>
On 10/24/24 3:03 PM, Alex Hung wrote:
> From: Stylon Wang <stylon.wang@amd.com>
>
> [WHY]
> Displaying test pattern only exits by user manually pressing enter.
>
> [HOW]
> Add option -e to exit with timeout and still allows pressing enter.
>
> Signed-off-by: Alex Hung <alex.hung@amd.com>
> Signed-off-by: Stylon Wang <stylon.wang@amd.com>
> ---
> tools/amd_hdmi_compliance.c | 35 ++++++++++++++++++++++++++++++++---
> 1 file changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/tools/amd_hdmi_compliance.c b/tools/amd_hdmi_compliance.c
> index 49fc21d5a..e810b61ba 100644
> --- a/tools/amd_hdmi_compliance.c
> +++ b/tools/amd_hdmi_compliance.c
> @@ -23,6 +23,8 @@
> #include "igt.h"
> #include "igt_sysfs.h"
> #include <fcntl.h>
> +#include <signal.h>
> +#include <string.h>
>
> /* Common test data */
> typedef struct data {
> @@ -34,6 +36,7 @@ typedef struct data {
> igt_pipe_t *pipe;
> enum pipe pipe_id;
> bool use_virtual_connector;
> + int timeout_seconds;
> } data_t;
>
> /* Video modes indexed by VIC */
> @@ -370,6 +373,12 @@ static drmModeModeInfo test_modes[] = {
> },
> };
>
> +static void signal_handler(int signo)
> +{
> + if (signo == SIGALRM)
> + igt_info("Timeout and exit\n");
> +}
> +
> /* Common test setup. */
> static void test_init(data_t *data, int conn_id)
> {
> @@ -402,6 +411,19 @@ static void test_init(data_t *data, int conn_id)
>
> igt_output_set_pipe(data->output, data->pipe_id);
>
> + if (data->timeout_seconds > 0) {
> + struct sigaction sa;
> +
> + memset(&sa, 0, sizeof(struct sigaction));
> + sa.sa_handler = signal_handler;
> + /* without SA_RESTART so getchar() is not restarted on signal */
> + sa.sa_flags = 0;
> +
> + if (sigaction(SIGALRM, &sa, NULL))
> + igt_info("cannot set up timeout: %s\n", strerror(errno));
> + else
> + alarm(data->timeout_seconds);
> + }
> }
>
> /* Common test cleanup. */
> @@ -412,8 +434,11 @@ static void test_fini(data_t *data)
>
> static void wait_for_keypress(void)
> {
> - while (getchar() != '\n')
> - ;
> + int c;
> +
> + do {
> + c = getchar();
> + } while (c != '\n' && c != EOF);
> }
>
> /* Write 0 or 1 to debugfs entry "force_yuv420_output" of connector */
> @@ -478,7 +503,7 @@ static void test_vic_mode(data_t *data, int vic, int conn_id)
> test_fini(data);
> }
>
> -const char *optstr = "hvt:i:b:y:";
> +const char *optstr = "hvt:i:b:y:e:";
> static void usage(const char *name)
> {
> igt_info("Usage: %s options\n", name);
> @@ -488,6 +513,7 @@ static void usage(const char *name)
> igt_info("-i conn_id Use connector by ID\n");
> igt_info("-b max_bpc Set \"max bpc\" connector property\n");
> igt_info("-y 0|1 Write 0 or 1 to connector's debugfs force_yuv420_output\n");
> + igt_info("-e seconds number of seconds to display test pattern and exit\n");
> igt_info("NOTE: if -i is not specified, first connected HDMI connector will be used for -t, -b and -y\n");
> }
>
> @@ -519,6 +545,9 @@ int main(int argc, char **argv)
> case 'y':
> force_yuv_420 = atoi(optarg);
> break;
> + case 'e':
> + data.timeout_seconds = atoi(optarg);
> + break;
> default:
> case 'h':
> usage(argv[0]);
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
next prev parent reply other threads:[~2024-10-29 16:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 21:03 [PATCH 1/5] tools/amd_hdmi_compliance: Additional functionalities Alex Hung
2024-10-24 21:03 ` [PATCH 2/5] tools/amd_hdmi_compliance: Fix atomic commit failure Alex Hung
2024-10-29 16:02 ` Rodrigo Siqueira Jordao
2024-10-24 21:03 ` [PATCH 3/5] tools/amd_hdmi_compliance: Fix VIC 0 not working Alex Hung
2024-10-29 16:03 ` Rodrigo Siqueira Jordao
2024-10-24 21:03 ` [PATCH 4/5] tools/amd_hdmi_compliance: Support VIC 91 and 92 Alex Hung
2024-10-29 16:04 ` Rodrigo Siqueira Jordao
2024-10-24 21:03 ` [PATCH 5/5] tools/amd_hdmi_compliance: Add timeout option Alex Hung
2024-10-29 16:06 ` Rodrigo Siqueira Jordao [this message]
2024-10-24 22:46 ` ✗ Fi.CI.BAT: failure for series starting with [1/5] tools/amd_hdmi_compliance: Additional functionalities Patchwork
2024-10-24 23:25 ` ✗ CI.xeBAT: " Patchwork
2024-10-28 13:39 ` Hung, Alex
2024-10-29 17:27 ` Kamil Konieczny
2024-10-26 7:09 ` ✗ CI.xeFULL: " Patchwork
2024-10-29 12:14 ` Patchwork
2024-10-29 16:01 ` [PATCH 1/5] " Rodrigo Siqueira Jordao
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=659820d5-c81e-4b5d-bd35-820608832598@amd.com \
--to=rodrigo.siqueira@amd.com \
--cc=alex.hung@amd.com \
--cc=harry.wentland@amd.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=mark.broadworth@amd.com \
--cc=sunpeng.li@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.