All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petri Latvala <petri.latvala@intel.com>
To: Rohith Iyer <quic_rohiiyer@quicinc.com>
Cc: igt-dev@lists.freedesktop.org, quic_aravindh@quicinc.com
Subject: Re: [igt-dev] [PATCH i-g-t v1 1/3] lib/igt_kms: Add helper to parse mode string
Date: Tue, 26 Jul 2022 08:43:31 +0300	[thread overview]
Message-ID: <Yt9/Aw7MCZKx7PkP@platvala-desk.ger.corp.intel.com> (raw)
In-Reply-To: <20220713222235.11655-2-quic_rohiiyer@quicinc.com>

On Wed, Jul 13, 2022 at 03:22:33PM -0700, Rohith Iyer wrote:
> Add helper method to parse a mode string from command line


In this form the string doesn't have to be from command line at all
call sites.


>, and verify
> correct number of arguments. This standardizes parsing mode strings.
> 
> Signed-off-by: Rohith Iyer <quic_rohiiyer@quicinc.com>
> ---
>  lib/igt_kms.c | 26 ++++++++++++++++++++++++++
>  lib/igt_kms.h |  1 +
>  2 files changed, 27 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index d8867f09..6df6658a 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -5739,3 +5739,29 @@ bool igt_check_bigjoiner_support(igt_display_t *display)
>  
>  	return true;
>  }
> +
> +/**
> + * igt_parse_mode_string:
> + * @mode_string: a pointer to the optarg

With the above said, the parameter is just the modeline string.

> + * @mode: a pointer to a drm mode structure
> + *
> + * Parse mode string from command line and populate mode
> + *
> + * Format: <clock(MHz)>,<hdisp>,<hsync-start>,<hsync-end>,<htotal>,<vdisp>,<vsync-start>,
> + * <vsync-end>,<vtotal>
> + *
> + * Returns: true if the correct number of arguments are entered, else false.
> + */
> +bool igt_parse_mode_string(char *mode_string, drmModeModeInfo *mode)

const char *mode_string


-- 
Petri Latvala


> +{
> +	float force_clock;
> +
> +	if (sscanf(mode_string, "%f,%hu,%hu,%hu,%hu,%hu,%hu,%hu,%hu",
> +	   &force_clock, &mode->hdisplay, &mode->hsync_start, &mode->hsync_end, &mode->htotal,
> +	   &mode->vdisplay, &mode->vsync_start, &mode->vsync_end, &mode->vtotal) != 9)
> +		return false;
> +
> +	mode->clock = force_clock * 1000;
> +
> +	return true;
> +}
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 4b67708d..8d946a25 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -972,5 +972,6 @@ void igt_sort_connector_modes(drmModeConnector *connector,
>  		int (*comparator)(const void *, const void*));
>  
>  bool igt_check_bigjoiner_support(igt_display_t *display);
> +bool igt_parse_mode_string(char *mode_string, drmModeModeInfo *mode);
>  
>  #endif /* __IGT_KMS_H__ */
> -- 
> 2.31.0
> 

  reply	other threads:[~2022-07-26  5:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 22:22 [igt-dev] [PATCH i-g-t v1 0/3] kms_writeback enhancements Rohith Iyer
2022-07-13 22:22 ` [igt-dev] [PATCH i-g-t v1 1/3] lib/igt_kms: Add helper to parse mode string Rohith Iyer
2022-07-26  5:43   ` Petri Latvala [this message]
2022-07-29 17:59     ` Rohith Iyer
2022-07-13 22:22 ` [igt-dev] [PATCH i-g-t v1 2/3] tests/testdisplay: Use igt_parse_mode_string for command line arguments Rohith Iyer
2022-07-26  5:52   ` Petri Latvala
2022-07-13 22:22 ` [igt-dev] [PATCH i-g-t v1 3/3] tests/kms_writeback: Enhance kms_writeback for custom modes Rohith Iyer
2022-07-28 10:12   ` Petri Latvala
2022-07-13 22:30 ` [igt-dev] ✗ GitLab.Pipeline: warning for kms_writeback enhancements Patchwork
2022-07-13 22:59 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-07-13 23:00 ` [igt-dev] ✗ GitLab.Pipeline: warning for kms_writeback enhancements (rev2) Patchwork
2022-07-13 23:29 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-07-13 23:30 ` [igt-dev] ✗ GitLab.Pipeline: warning for kms_writeback enhancements (rev3) Patchwork
2022-07-13 23:57 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2022-07-14  3:35 ` [igt-dev] ✗ Fi.CI.IGT: failure for kms_writeback enhancements Patchwork
2022-07-14  4:43 ` [igt-dev] ✗ Fi.CI.IGT: failure for kms_writeback enhancements (rev2) Patchwork
2022-07-14  5:40 ` [igt-dev] ✓ Fi.CI.IGT: success for kms_writeback enhancements (rev3) Patchwork
2022-07-15 22:13 ` [igt-dev] [PATCH i-g-t v1 0/3] kms_writeback enhancements Abhinav Kumar

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=Yt9/Aw7MCZKx7PkP@platvala-desk.ger.corp.intel.com \
    --to=petri.latvala@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=quic_aravindh@quicinc.com \
    --cc=quic_rohiiyer@quicinc.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.