From: "Sharma, Swati2" <swati2.sharma@intel.com>
To: Jessica Zhang <quic_jesszhan@quicinc.com>,
Petri Latvala <adrinael@adrinael.net>,
Arkadiusz Hiler <arek@hiler.eu>,
Kamil Konieczny <kamil.konieczny@linux.intel.com>,
Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>,
Bhanuprakash Modem <bhanuprakash.modem@intel.com>,
Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: <quic_abhinavk@quicinc.com>, <igt-dev@lists.freedesktop.org>,
Alex Hung <alex.hung@amd.com>,
Esha Bharadwaj <quic_ebharadw@quicinc.com>
Subject: Re: [PATCH i-g-t v5 1/3] lib/igt_kms: Add helper to get encoder index
Date: Mon, 10 Feb 2025 17:35:33 +0530 [thread overview]
Message-ID: <03447e41-33cb-4c5c-8557-c941e49669d3@intel.com> (raw)
In-Reply-To: <20250128-igt-cwb-v5-1-82652cec29a3@quicinc.com>
Hi Jessica,
On 29-01-2025 08:59 am, Jessica Zhang wrote:
> From: Esha Bharadwaj <quic_ebharadw@quicinc.com>
>
> Move the get_encoder_idx() helper within the kms_setmode test to
> lib/igt_kms
>
> Signed-off-by: Esha Bharadwaj <quic_ebharadw@quicinc.com>
> Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
> ---
> lib/igt_kms.c | 15 +++++++++++++++
> lib/igt_kms.h | 1 +
> tests/kms_setmode.c | 14 ++------------
> 3 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 90f44b4d3a8607d1caedccf50691fae7aaf2d079..4b14c94e226a9a103bc3a3bc26099566a6eb274b 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -3324,6 +3324,21 @@ void igt_display_fini(igt_display_t *display)
> display->planes = NULL;
> }
>
> +/**
> + * kmstest_get_encoder_idx:
> + * @resources: libdrm resources pointer
> + * @encoder: libdrm encoder pointer
> + *
> + * Get encoder index from encoder_id
> + */
> +int kmstest_get_encoder_idx(drmModeRes *resources, drmModeEncoder *encoder)
> +{
> + for (int i = 0; i < resources->count_encoders; i++)
> + if (resources->encoders[i] == encoder->encoder_id)
> + return i;
> + igt_assert(0);
> +}
> +
> static void igt_display_refresh(igt_display_t *display)
> {
> igt_output_t *output;
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 8810123fbebeb68f5c549c434d6ca69a123cfb90..e4f7b6c62fd536aa4ea3eb3153d8e1935cf560fd 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -314,6 +314,7 @@ void kmstest_dumb_destroy(int fd, uint32_t handle);
> void kmstest_wait_for_pageflip(int fd);
> void kmstest_wait_for_pageflip_timeout(int fd, uint64_t timeout_us);
> unsigned int kmstest_get_vblank(int fd, int pipe, unsigned int flags);
> +int kmstest_get_encoder_idx(drmModeRes *resources, drmModeEncoder *encoder);
>
> bool kms_has_vblank(int fd);
>
> diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
> index d61cfeb9af22c12ae1f5aad5d06ccb9e01fc52d3..600524d98359fbf713be99de931e53b8ecf167b0 100644
> --- a/tests/kms_setmode.c
> +++ b/tests/kms_setmode.c
> @@ -268,16 +268,6 @@ found:
> *mode_ret = *mode;
> }
>
> -static int get_encoder_idx(drmModeRes *resources, drmModeEncoder *encoder)
> -{
> - int i;
> -
> - for (i = 0; i < resources->count_encoders; i++)
> - if (resources->encoders[i] == encoder->encoder_id)
> - return i;
> - igt_assert(0);
> -}
> -
> static void get_crtc_config_str(struct crtc_config *crtc, char *buf,
> size_t buf_size)
> {
> @@ -370,7 +360,7 @@ static void setup_crtcs(const struct test_config *tconf,
> config_valid &= !!(encoder->possible_crtcs &
> (1 << crtc->crtc_idx));
>
> - encoder_mask |= 1 << get_encoder_idx(resources,
> + encoder_mask |= 1 << kmstest_get_encoder_idx(resources,
> encoder);
Fix indentation here. Alignment should match open parenthesis.
With this fixed,
Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
> config_valid &= !(encoder_mask &
> ~encoder->possible_clones);
> @@ -396,7 +386,7 @@ static void setup_crtcs(const struct test_config *tconf,
> idx = cconf[i].crtc_idx;
>
> encoder = drmModeGetEncoder(drm_fd, connector->encoders[idx]);
> - encoder_usage_count[get_encoder_idx(resources, encoder)]++;
> + encoder_usage_count[kmstest_get_encoder_idx(resources, encoder)]++;
> drmModeFreeEncoder(encoder);
> }
> for (i = 0; i < resources->count_encoders; i++)
>
next prev parent reply other threads:[~2025-02-10 12:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-29 3:29 [PATCH i-g-t v5 0/3] tests/kms_writeback: Add clone mode subtest Jessica Zhang
2025-01-29 3:29 ` [PATCH i-g-t v5 1/3] lib/igt_kms: Add helper to get encoder index Jessica Zhang
2025-01-30 12:51 ` Kamil Konieczny
2025-02-10 12:05 ` Sharma, Swati2 [this message]
2025-01-29 3:29 ` [PATCH i-g-t v5 2/3] lib/igt_kms: loosen duplicate check in igt_display_refresh Jessica Zhang
2025-01-30 12:59 ` Kamil Konieczny
2025-01-29 3:29 ` [PATCH i-g-t v5 3/3] tests/kms_writeback: Add subtest for valid clone mode Jessica Zhang
2025-01-29 6:13 ` ✓ Xe.CI.BAT: success for tests/kms_writeback: Add clone mode subtest (rev7) Patchwork
2025-01-29 6:26 ` ✓ i915.CI.BAT: " Patchwork
2025-01-29 15:54 ` ✗ i915.CI.Full: failure " Patchwork
2025-01-29 19:33 ` ✗ Xe.CI.Full: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2024-10-17 1:22 [PATCH i-g-t v5 0/3] tests/kms_writeback: Add clone mode subtest Jessica Zhang
2024-10-17 1:22 ` [PATCH i-g-t v5 1/3] lib/igt_kms: Add helper to get encoder index Jessica Zhang
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=03447e41-33cb-4c5c-8557-c941e49669d3@intel.com \
--to=swati2.sharma@intel.com \
--cc=adrinael@adrinael.net \
--cc=alex.hung@amd.com \
--cc=arek@hiler.eu \
--cc=ashutosh.dixit@intel.com \
--cc=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=juhapekka.heikkila@gmail.com \
--cc=kamil.konieczny@linux.intel.com \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_ebharadw@quicinc.com \
--cc=quic_jesszhan@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox