From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [i-g-t 3/4] tests/intel/kms_frontbuffer_tracking: Re-use devid & display_ver
Date: Wed, 27 Dec 2023 19:00:19 +0530 [thread overview]
Message-ID: <20231227133020.685916-3-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20231227133020.685916-1-bhanuprakash.modem@intel.com>
Instead of querying for devid & display_ver, just cache them
and re-use where ever it's required.
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
tests/intel/kms_frontbuffer_tracking.c | 37 +++++++++++---------------
1 file changed, 15 insertions(+), 22 deletions(-)
diff --git a/tests/intel/kms_frontbuffer_tracking.c b/tests/intel/kms_frontbuffer_tracking.c
index 5324a0bef..2a2690d18 100644
--- a/tests/intel/kms_frontbuffer_tracking.c
+++ b/tests/intel/kms_frontbuffer_tracking.c
@@ -1302,6 +1302,8 @@ struct {
igt_display_t display;
struct buf_ops *bops;
+ uint32_t devid;
+ unsigned display_ver;
} drm;
struct {
@@ -2873,8 +2875,6 @@ static bool enable_features_for_test(const struct test_mode *t)
static void check_test_requirements(const struct test_mode *t)
{
- int ver;
-
if (t->pipes == PIPE_DUAL)
igt_require_f(scnd_mode_params.output,
"Can't test dual pipes with the current outputs\n");
@@ -2904,8 +2904,7 @@ static void check_test_requirements(const struct test_mode *t)
igt_require(t->pipes == opt.only_pipes);
/* Kernel disables fbc for display versions 12 and 13 if psr is enabled. */
- ver = intel_display_ver(intel_get_drm_devid(drm.fd));
- if (ver >= 12 && ver <= 13)
+ if (drm.display_ver >= 12 && drm.display_ver <= 13)
igt_require_f(!((t->feature & FEATURE_PSR) &&
(t->feature & FEATURE_FBC)),
"Can't test PSR and FBC together\n");
@@ -3081,11 +3080,9 @@ static bool is_valid_plane(igt_plane_t *plane)
static void plane_fbc_rte_subtest(const struct test_mode *t)
{
- int ver;
igt_plane_t *plane;
- ver = intel_display_ver(intel_get_drm_devid(drm.fd));
- igt_require_f((ver >= 20), "Can't test fbc for each plane\n");
+ igt_require_f((drm.display_ver >= 20), "Can't test fbc for each plane\n");
prepare_subtest_data(t, NULL);
unset_all_crtcs();
@@ -3294,8 +3291,6 @@ static void multidraw_subtest(const struct test_mode *t)
static bool format_is_valid(int feature_flags,
enum pixel_format format)
{
- int devid = intel_get_drm_devid(drm.fd);
-
if (!(feature_flags & FEATURE_FBC))
return true;
@@ -3303,7 +3298,7 @@ static bool format_is_valid(int feature_flags,
case FORMAT_RGB888:
return true;
case FORMAT_RGB565:
- if (IS_GEN2(devid) || IS_G4X(devid))
+ if (IS_GEN2(drm.devid) || IS_G4X(drm.devid))
return false;
return true;
case FORMAT_RGB101010:
@@ -3374,19 +3369,17 @@ static void format_draw_subtest(const struct test_mode *t)
static bool tiling_is_valid(int feature_flags, enum tiling_type tiling)
{
- int devid = intel_get_drm_devid(drm.fd);
-
if (!(feature_flags & FEATURE_FBC))
return true;
switch (tiling) {
case TILING_LINEAR:
- return AT_LEAST_GEN(devid, 9);
+ return AT_LEAST_GEN(drm.devid, 9);
case TILING_X:
case TILING_Y:
return true;
case TILING_4:
- return AT_LEAST_GEN(devid, 12);
+ return AT_LEAST_GEN(drm.devid, 12);
default:
igt_assert(false);
return false;
@@ -3805,7 +3798,7 @@ static void scaledprimary_subtest(const struct test_mode *t)
struct igt_fb new_fb, *old_fb;
struct modeset_params *params = pick_params(t);
struct fb_region *reg = ¶ms->primary;
- int gen = intel_display_ver(intel_get_drm_devid(drm.fd));
+ int gen = drm.display_ver;
int src_y_upscale = ALIGN(reg->h / 4, 4);
igt_require_f(gen >= 9,
@@ -3990,7 +3983,7 @@ static void farfromfence_subtest(const struct test_mode *t)
struct draw_pattern_info *pattern = &pattern1;
struct fb_region *target;
int max_height, assertions = 0;
- int gen = intel_display_ver(intel_get_drm_devid(drm.fd));
+ int gen = drm.display_ver;
switch (gen) {
case 2:
@@ -4461,13 +4454,13 @@ struct option long_options[] = {
igt_main_args("", long_options, help_str, opt_handler, NULL)
{
struct test_mode t;
- int devid;
enum pipe pipe;
igt_output_t *output;
igt_fixture {
setup_environment();
- devid = intel_get_drm_devid(drm.fd);
+ drm.devid = intel_get_drm_devid(drm.fd);
+ drm.display_ver = intel_display_ver(drm.devid);
}
for (t.feature = 0; t.feature < FEATURE_COUNT; t.feature++) {
@@ -4765,14 +4758,14 @@ igt_main_args("", long_options, help_str, opt_handler, NULL)
/* Tiling Y is only supported on GEN9+ */
if (t.tiling == TILING_Y) {
- igt_require(AT_LEAST_GEN(devid, 9));
- igt_require(!intel_get_device_info(devid)->has_4tile);
+ igt_require(AT_LEAST_GEN(drm.devid, 9));
+ igt_require(!intel_get_device_info(drm.devid)->has_4tile);
}
/* Tiling 4 is only supported on GEN12+ */
if (t.tiling == TILING_4) {
- igt_require(AT_LEAST_GEN(devid, 12));
- igt_require(intel_get_device_info(devid)->has_4tile);
+ igt_require(AT_LEAST_GEN(drm.devid, 12));
+ igt_require(intel_get_device_info(drm.devid)->has_4tile);
}
if (tiling_is_valid(t.feature, t.tiling))
--
2.40.0
next prev parent reply other threads:[~2023-12-27 13:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-27 13:30 [i-g-t 1/4] lib/i915/intel_drrs: Fix igt helper to get drrs status Bhanuprakash Modem
2023-12-27 13:30 ` [i-g-t 2/4] tests/intel/kms_frontbuffer_tracking: Drop unused macros Bhanuprakash Modem
2024-01-05 6:02 ` [i-g-t,2/4] " Joshi, Kunal1
2023-12-27 13:30 ` Bhanuprakash Modem [this message]
2024-01-05 6:36 ` [i-g-t, 3/4] tests/intel/kms_frontbuffer_tracking: Re-use devid & display_ver Joshi, Kunal1
2023-12-27 13:30 ` [i-g-t 4/4] tests/intel/kms_dirtyfb: Fix few fixtures Bhanuprakash Modem
2024-01-05 6:40 ` [i-g-t,4/4] " Joshi, Kunal1
2023-12-28 7:50 ` [i-g-t 1/7] lib/i915/intel_drrs: Fix igt helper to get drrs status Bhanuprakash Modem
2023-12-28 7:51 ` [i-g-t 1/4] " Bhanuprakash Modem
2024-01-05 6:00 ` [i-g-t,1/4] " Joshi, Kunal1
2024-01-05 5:49 ` [i-g-t 1/7] " Joshi, Kunal1
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=20231227133020.685916-3-bhanuprakash.modem@intel.com \
--to=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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