From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 7/8] tests/i915/kms_flip_tiling: Stick pipe_crc into data_t
Date: Thu, 14 Oct 2021 01:17:26 +0300 [thread overview]
Message-ID: <20211013221727.6392-8-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20211013221727.6392-1-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Dunno why the pipe_crc has its own variable visible throughout
the whole file. Just stuff it into data_t where everything else
lives.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/i915/kms_flip_tiling.c | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/tests/i915/kms_flip_tiling.c b/tests/i915/kms_flip_tiling.c
index 8eecb20c49b9..604f01dd3766 100644
--- a/tests/i915/kms_flip_tiling.c
+++ b/tests/i915/kms_flip_tiling.c
@@ -39,29 +39,24 @@ typedef struct {
int gen;
uint32_t testformat;
struct igt_fb fb[2];
+ igt_pipe_crc_t *pipe_crc;
} data_t;
-static igt_pipe_crc_t *_pipe_crc;
-
-static igt_pipe_crc_t *pipe_crc_new(data_t *data, int pipe)
+static void pipe_crc_free(data_t *data)
{
- if (_pipe_crc) {
- igt_pipe_crc_free(_pipe_crc);
- _pipe_crc = NULL;
- }
+ if (!data->pipe_crc)
+ return;
- _pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
- igt_assert(_pipe_crc);
-
- return _pipe_crc;
+ igt_pipe_crc_free(data->pipe_crc);
+ data->pipe_crc = NULL;
}
-static void pipe_crc_free(void)
+static void pipe_crc_new(data_t *data, int pipe)
{
- if (_pipe_crc) {
- igt_pipe_crc_free(_pipe_crc);
- _pipe_crc = NULL;
- }
+ pipe_crc_free(data);
+
+ data->pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+ igt_assert(data->pipe_crc);
}
static int try_commit(igt_display_t *display)
@@ -75,11 +70,10 @@ test_flip_tiling(data_t *data, enum pipe pipe, igt_output_t *output, uint64_t mo
{
drmModeModeInfo *mode;
igt_plane_t *primary;
- igt_pipe_crc_t *pipe_crc;
igt_crc_t reference_crc, crc;
int fb_id, ret;
- pipe_crc = pipe_crc_new(data, pipe);
+ pipe_crc_new(data, pipe);
igt_output_set_pipe(output, pipe);
mode = igt_output_get_mode(output);
@@ -104,7 +98,7 @@ test_flip_tiling(data_t *data, enum pipe pipe, igt_output_t *output, uint64_t mo
igt_require_f(try_commit(&data->display) == 0,
"commit failed with " IGT_MODIFIER_FMT "\n",
IGT_MODIFIER_ARGS(modifier[1]));
- igt_pipe_crc_collect_crc(pipe_crc, &reference_crc);
+ igt_pipe_crc_collect_crc(data->pipe_crc, &reference_crc);
/* Commit the first fb. */
igt_plane_set_fb(primary, &data->fb[0]);
@@ -124,7 +118,7 @@ test_flip_tiling(data_t *data, enum pipe pipe, igt_output_t *output, uint64_t mo
kmstest_wait_for_pageflip(data->drm_fd);
/* Get a crc and compare with the reference. */
- igt_pipe_crc_collect_crc(pipe_crc, &crc);
+ igt_pipe_crc_collect_crc(data->pipe_crc, &crc);
igt_assert_crc_equal(&reference_crc, &crc);
}
@@ -135,7 +129,7 @@ static void test_cleanup(data_t *data, enum pipe pipe, igt_output_t *output)
/* Clean up. */
igt_plane_set_fb(primary, NULL);
- pipe_crc_free();
+ pipe_crc_free(data);
igt_output_set_pipe(output, PIPE_ANY);
igt_display_commit(&data->display);
--
2.32.0
next prev parent reply other threads:[~2021-10-13 22:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-13 22:17 [igt-dev] [PATCH i-g-t 0/8] Promote kms_flip_tiling to general Ville Syrjala
2021-10-13 22:17 ` [igt-dev] [PATCH i-g-t 1/8] lib/fb: Introduce igt_fb_modifier_name() Ville Syrjala
2021-10-18 6:51 ` Karthik B S
2021-10-13 22:17 ` [igt-dev] [PATCH i-g-t 2/8] tests/kms_plane: Use IGT_MODIFIER_{FMT, ARGS} Ville Syrjala
2021-10-18 6:53 ` Karthik B S
2021-10-13 22:17 ` [igt-dev] [PATCH i-g-t 3/8] tests/i915/kms_flip_tiling: Drop ancient stride change restrictin Ville Syrjala
2021-10-18 6:56 ` Karthik B S
2021-10-13 22:17 ` [igt-dev] [PATCH i-g-t 4/8] tests/i915/kms_flip_tiling: Replace i915 interlace check with try_commit Ville Syrjala
2021-10-18 6:57 ` Karthik B S
2021-10-13 22:17 ` [igt-dev] [PATCH i-g-t 5/8] tests/i915/kms_flip_tiling: Generalize away copy-pasta Ville Syrjala
2021-10-18 7:02 ` Karthik B S
2021-10-18 7:28 ` Ville Syrjälä
2021-10-18 7:35 ` Karthik B S
2021-10-18 7:36 ` Ville Syrjälä
2021-10-13 22:17 ` [igt-dev] [PATCH i-g-t 6/8] tests/i915/kms_flip_tiling: Drop useless i915 include Ville Syrjala
2021-10-18 7:03 ` Karthik B S
2021-10-13 22:17 ` Ville Syrjala [this message]
2021-10-18 7:04 ` [igt-dev] [PATCH i-g-t 7/8] tests/i915/kms_flip_tiling: Stick pipe_crc into data_t Karthik B S
2021-10-13 22:17 ` [igt-dev] [PATCH i-g-t 8/8] tests/i915/kms_flip_tiling: Keep CRC running all the time Ville Syrjala
2021-10-18 7:05 ` Karthik B S
2021-10-13 23:07 ` [igt-dev] ✓ Fi.CI.BAT: success for Promote kms_flip_tiling to general Patchwork
2021-10-14 0:10 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20211013221727.6392-8-ville.syrjala@linux.intel.com \
--to=ville.syrjala@linux.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 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.