From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 2/3] tests/kms_plane: Pipeline crc capture and flips
Date: Wed, 26 Feb 2020 22:51:37 +0200 [thread overview]
Message-ID: <20200226205137.13958-1-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20200221205054.19734-2-ville.syrjala@linux.intel.com>
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Eliminate some dead time used to wait for crcs by pipelining
the flips and crc capture.
On KBL:
time kms_plane --r pixel-format-pipe-A-planes
- real 0m22,592s
+ real 0m14,527s
time kms_plane --r pixel-format-pipe-A-planes --extended
- real 1m8,090s
+ real 0m38,738s
To keep the code somewhat sane we only pipeline while
capturing the colors for a single pixel format. That does
still leave a few non-pipelined frames when switching from
one pixel format to another. Which explains why the extended
test gets closer to the -50% mark as it tests more colors and
thus has a larger proportion of optimally pipelined flips.
Not sure how horrible the code would become if we tried to
maintain the pipelining throughout the test. For now let's
just accept the small victory and move on.
v2: Use igt_pipe_crc_get_for_frame() to make sure we get the
right crc even if the next fb preparation takes longer
than one frame
v3: Don't assume more than one color
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tests/kms_plane.c | 107 +++++++++++++++++++++++++++++++---------------
1 file changed, 73 insertions(+), 34 deletions(-)
diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 9ef3a7f3c1b0..8a5b89b2ae95 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -440,15 +440,14 @@ static bool set_c8_legacy_lut(data_t *data, enum pipe pipe,
return true;
}
-static void test_format_plane_color(data_t *data, enum pipe pipe,
- igt_plane_t *plane,
- uint32_t format, uint64_t modifier,
- int width, int height,
- enum igt_color_encoding color_encoding,
- enum igt_color_range color_range,
- const color_t *c, igt_crc_t *crc, struct igt_fb *fb)
+static void prepare_format_color(data_t *data, enum pipe pipe,
+ igt_plane_t *plane,
+ uint32_t format, uint64_t modifier,
+ int width, int height,
+ enum igt_color_encoding color_encoding,
+ enum igt_color_range color_range,
+ const color_t *c, struct igt_fb *fb)
{
- struct igt_fb old_fb = *fb;
cairo_t *cr;
if (data->crop == 0 || format == DRM_FORMAT_XRGB8888) {
@@ -499,11 +498,6 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
igt_fb_set_size(fb, plane, width, height);
igt_plane_set_size(plane, width, height);
}
-
- igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
- igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, crc);
-
- igt_remove_fb(data->drm_fd, &old_fb);
}
static int num_unique_crcs(const igt_crc_t crc[], int num_crc)
@@ -525,6 +519,62 @@ static int num_unique_crcs(const igt_crc_t crc[], int num_crc)
return num_unique_crc;
}
+static void capture_format_crcs(data_t *data, enum pipe pipe,
+ igt_plane_t *plane,
+ uint32_t format, uint64_t modifier,
+ int width, int height,
+ enum igt_color_encoding encoding,
+ enum igt_color_range range,
+ igt_crc_t crc[], struct igt_fb *fb)
+{
+ unsigned int vblank[ARRAY_SIZE(colors_extended)];
+ int i;
+
+ for (i = 0; i < data->num_colors; i++) {
+ const color_t *c = &data->colors[i];
+ struct igt_fb old_fb = *fb;
+
+ prepare_format_color(data, pipe, plane, format, modifier,
+ width, height, encoding, range, c, fb);
+
+ /*
+ * The flip issued during frame N will latch
+ * at the start of frame N+1, and its CRC will
+ * be ready at the start of frame N+2. So the
+ * CRC captured here before the flip is issued
+ * is for frame N-2.
+ */
+ if (i >= 2)
+ igt_pipe_crc_get_for_frame(data->drm_fd, data->pipe_crc,
+ vblank[i - 2], &crc[i - 2]);
+
+ igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
+ /*
+ * TODO: Use flip events to get this. Would also allow
+ * switching to non-blocking commits so that the next
+ * fb can be prepared in parallel to waiting for the
+ * flip to complete.
+ *
+ * crc is available one frame after the flip latches
+ */
+ vblank[i] = kmstest_get_vblank(data->drm_fd, pipe, 0) + 1;
+
+ igt_remove_fb(data->drm_fd, &old_fb);
+ }
+
+ /*
+ * Get the remaining two crcs
+ *
+ * TODO: avoid the extra wait by maintaining the pipeline
+ * between different pixel formats as well? Could get messy.
+ */
+ if (i >= 2)
+ igt_pipe_crc_get_for_frame(data->drm_fd, data->pipe_crc,
+ vblank[i - 2], &crc[i - 2]);
+ igt_pipe_crc_get_for_frame(data->drm_fd, data->pipe_crc,
+ vblank[i - 1], &crc[i - 1]);
+}
+
static bool test_format_plane_colors(data_t *data, enum pipe pipe,
igt_plane_t *plane,
uint32_t format, uint64_t modifier,
@@ -534,21 +584,17 @@ static bool test_format_plane_colors(data_t *data, enum pipe pipe,
igt_crc_t ref_crc[],
struct igt_fb *fb)
{
- int crc_mismatch_count = 0;
+ igt_crc_t crc[ARRAY_SIZE(colors_extended)];
unsigned int crc_mismatch_mask = 0;
+ int crc_mismatch_count = 0;
bool result = true;
+ int i;
- for (int i = 0; i < data->num_colors; i++) {
- const color_t *c = &data->colors[i];
- igt_crc_t crc;
-
- test_format_plane_color(data, pipe, plane,
- format, modifier,
- width, height,
- encoding, range,
- c, &crc, fb);
+ capture_format_crcs(data, pipe, plane, format, modifier,
+ width, height, encoding, range, crc, fb);
- if (!igt_check_crc_equal(&crc, &ref_crc[i])) {
+ for (i = 0; i < data->num_colors; i++) {
+ if (!igt_check_crc_equal(&crc[i], &ref_crc[i])) {
crc_mismatch_count++;
crc_mismatch_mask |= (1 << i);
result = false;
@@ -700,16 +746,9 @@ static bool test_format_plane(data_t *data, enum pipe pipe,
igt_remove_fb(data->drm_fd, &test_fb);
}
- for (int i = 0; i < data->num_colors; i++) {
- const color_t *c = &data->colors[i];
-
- test_format_plane_color(data, pipe, plane,
- format, modifier,
- width, height,
- IGT_COLOR_YCBCR_BT709,
- IGT_COLOR_YCBCR_LIMITED_RANGE,
- c, &ref_crc[i], &fb);
- }
+ capture_format_crcs(data, pipe, plane, format, modifier,
+ width, height, IGT_COLOR_YCBCR_BT709,
+ IGT_COLOR_YCBCR_LIMITED_RANGE, ref_crc, &fb);
/*
* Make sure we have some difference between the colors. This
--
2.24.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-02-26 20:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-21 20:50 [igt-dev] [PATCH i-g-t 1/3] lib/igt_debugfs: Add igt_crc_get_for_frame() Ville Syrjala
2020-02-21 20:50 ` [igt-dev] [PATCH i-g-t 2/3] tests/kms_plane: Pipeline crc capture and flips Ville Syrjala
2020-02-26 20:51 ` Ville Syrjala [this message]
2020-02-21 20:50 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_plane: Use non-blocking commits for pixel format tests Ville Syrjala
2020-02-26 20:52 ` [igt-dev] [PATCH i-g-t v2 " Ville Syrjala
2020-02-21 21:21 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/igt_debugfs: Add igt_crc_get_for_frame() Patchwork
2020-02-24 12:49 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2020-02-26 21:50 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib/igt_debugfs: Add igt_crc_get_for_frame() (rev3) Patchwork
2020-02-27 12:01 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2020-02-27 13:59 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_debugfs: Add igt_crc_get_for_frame() Juha-Pekka Heikkila
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=20200226205137.13958-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox