Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Modem, Bhanuprakash" <bhanuprakash.modem@intel.com>
To: Swati Sharma <swati2.sharma@intel.com>, <igt-dev@lists.freedesktop.org>
Cc: ankit.k.nautiyal@freedesktop.org
Subject: Re: [igt-dev] [PATCH i-g-t 2/4] lib/igt_kms: add helper for dp-mst connector id
Date: Mon, 7 Aug 2023 21:59:50 +0530	[thread overview]
Message-ID: <e6ad0cd1-fa68-01fd-a6ad-a106117767fd@intel.com> (raw)
In-Reply-To: <20230806164729.1016167-3-swati2.sharma@intel.com>

Hi Swati,

On Sun-06-08-2023 10:17 pm, Swati Sharma wrote:
> Helper is added which returns dp-mst connector id.
> 
> Signed-off-by: Swati Sharma <swati2.sharma@intel.com>
> ---
>   lib/igt_kms.c | 40 ++++++++++++++++++++++++++++++++++++++++
>   lib/igt_kms.h |  1 +
>   2 files changed, 41 insertions(+)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 6034ff70c..c0bfa73fe 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -6050,3 +6050,43 @@ bool igt_check_output_is_dp_mst(int drm_fd, igt_output_t *output)
>   
>   	return true;
>   }
> +
> +static int parse_path_blob(char *blob_data)
> +{
> +	int connector_id;
> +	char *encoder;
> +
> +	encoder = strtok(blob_data, ":");
> +	igt_assert_f(!strcmp(encoder, "mst"), "PATH connector property expected to have 'mst'\n");
> +
> +	connector_id = atoi(strtok(NULL, "-"));
> +
> +	return connector_id;
> +}
> +
> +/**
> + * igt_get_dp_mst_connector_id
> + * @drmfd: Handle to open drm device
> + * @output: Target output
> + *
> + * Returns: dp-mst connector id.
> + */
> +int igt_get_dp_mst_connector_id(int drm_fd, igt_output_t *output)
> +{
> +	drmModePropertyBlobPtr path_blob = NULL;
> +	uint64_t path_blob_id;
> +	drmModeConnector *connector = output->config.connector;
> +	int connector_id;
> +
> +	igt_assert(kmstest_get_property(drm_fd, connector->connector_id,
> +		   DRM_MODE_OBJECT_CONNECTOR, "PATH", NULL,
> +		   &path_blob_id, NULL));
> +
> +	igt_assert(path_blob = drmModeGetPropertyBlob(drm_fd, path_blob_id));
> +
> +	connector_id = parse_path_blob((char *) path_blob->data);
> +
> +	drmModeFreePropertyBlob(path_blob);
> +
> +	return connector_id;

I can write this helper as:

int igt_get_dp_mst_connector_id() {
     if igt_check_output_is_dp_mst()
         return 0; // Not sure if connector_id can be zero

     <get PATH property & parse the connector id outof it>
     return connector_id;
}

Test:
You can directly call igt_get_dp_mst_connector_id(), no need to check 
for the output type (dp-mst).

- Bhanu

> +}
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 9a46e7a5c..6f978ed55 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1005,5 +1005,6 @@ bool igt_check_bigjoiner_support(igt_display_t *display);
>   bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo *mode);
>   bool i915_pipe_output_combo_valid(igt_display_t *display);
>   bool igt_check_output_is_dp_mst(int drmfd, igt_output_t *output);
> +int igt_get_dp_mst_connector_id(int drm_fd, igt_output_t *output);
>   
>   #endif /* __IGT_KMS_H__ */

  reply	other threads:[~2023-08-07 16:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-06 16:47 [igt-dev] [PATCH i-g-t 0/4] dp-mst helpers Swati Sharma
2023-08-06 16:47 ` [igt-dev] [PATCH i-g-t 1/4] lib/igt_kms: add helper to check if output is mst Swati Sharma
2023-08-06 16:47 ` [igt-dev] [PATCH i-g-t 2/4] lib/igt_kms: add helper for dp-mst connector id Swati Sharma
2023-08-07 16:29   ` Modem, Bhanuprakash [this message]
2023-08-10  6:15     ` Sharma, Swati2
2023-08-07 17:02   ` Modem, Bhanuprakash
2023-08-06 16:47 ` [igt-dev] [PATCH i-g-t 3/4] tests/kms: use dp-mst helpers Swati Sharma
2023-08-06 16:47 ` [igt-dev] [PATCH i-g-t 4/4] tests/kms_color: skip deep-color test for mst Swati Sharma
2023-08-06 17:27 ` [igt-dev] ○ CI.xeBAT: info for dp-mst helpers Patchwork
2023-08-06 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2023-08-06 19:02 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2023-08-08 15:49 ` [igt-dev] ✗ CI.xeBAT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-08-08 19:40 [igt-dev] [PATCH i-g-t 0/4] " Swati Sharma
2023-08-08 19:40 ` [igt-dev] [PATCH i-g-t 2/4] lib/igt_kms: add helper for dp-mst connector id Swati Sharma

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=e6ad0cd1-fa68-01fd-a6ad-a106117767fd@intel.com \
    --to=bhanuprakash.modem@intel.com \
    --cc=ankit.k.nautiyal@freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=swati2.sharma@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