From: Jessica Zhang <quic_jesszhan@quicinc.com>
To: 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: Alex Hung <alex.hung@amd.com>, <quic_abhinavk@quicinc.com>,
<igt-dev@lists.freedesktop.org>,
Esha Bharadwaj <quic_ebharadw@quicinc.com>,
Jessica Zhang <quic_jesszhan@quicinc.com>
Subject: [PATCH i-g-t v4 2/4] lib/igt_kms: Add helper to get encoder index
Date: Wed, 25 Sep 2024 13:37:19 -0700 [thread overview]
Message-ID: <20240925-igt-cwb-v4-2-e516cd1e888e@quicinc.com> (raw)
In-Reply-To: <20240925-igt-cwb-v4-0-e516cd1e888e@quicinc.com>
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 b40470c02..f5fab7f73 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3271,6 +3271,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 25ba50916..72fe3b3b1 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -295,6 +295,7 @@ void *kmstest_dumb_map_buffer(int fd, uint32_t handle, uint64_t size,
void kmstest_dumb_destroy(int fd, uint32_t handle);
void kmstest_wait_for_pageflip(int fd);
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 bc7b8fabb..c504d5a56 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);
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++)
--
2.34.1
next prev parent reply other threads:[~2024-09-25 20:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 20:37 [PATCH i-g-t v4 0/4] tests/kms_writeback: Add clone mode subtest Jessica Zhang
2024-09-25 20:37 ` [PATCH i-g-t v4 1/4] tests/kms_writeback: clear writeback properties in teardown path Jessica Zhang
2024-09-25 20:46 ` Abhinav Kumar
2024-10-14 13:52 ` Kamil Konieczny
2024-10-14 19:05 ` Abhinav Kumar
2024-09-25 20:37 ` Jessica Zhang [this message]
2024-09-25 21:10 ` [PATCH i-g-t v4 2/4] lib/igt_kms: Add helper to get encoder index Abhinav Kumar
2024-09-25 20:37 ` [PATCH i-g-t v4 3/4] lib/igt_kms: loosen duplicate check in igt_display_refresh Jessica Zhang
2024-09-25 21:00 ` Abhinav Kumar
2024-09-25 20:37 ` [PATCH i-g-t v4 4/4] tests/kms_writeback: Add dump for valid clone mode Jessica Zhang
2024-09-25 21:55 ` Abhinav Kumar
2024-10-14 12:32 ` Juha-Pekka Heikkila
2024-09-26 9:20 ` ✗ Fi.CI.BAT: failure for tests/kms_writeback: Add clone mode subtest (rev4) Patchwork
2024-09-26 9:39 ` ✗ CI.xeBAT: " Patchwork
2024-09-27 0:56 ` ✗ CI.xeFULL: " 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=20240925-igt-cwb-v4-2-e516cd1e888e@quicinc.com \
--to=quic_jesszhan@quicinc.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 \
/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