From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH igt 8/8] tests/kms_fb_crc: fix the reference CRC checking
Date: Thu, 7 May 2015 15:56:36 -0300 [thread overview]
Message-ID: <1431024996-2267-9-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1431024996-2267-1-git-send-email-przanoni@gmail.com>
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
Now we get the reference CRCs on separate untiled FBs just to make
sure FBC is not there to mess the CRC computation. We also get the
reference CRCs for buffers that were drawn in the same way that we
draw them during the tests, so we can finally get rid of that FIXME
comment we have!
With this, kms_fbc_crc now actually tests something instead of just
wasting CPU cycles...
Fixes regression introduced by:
commit 562bbe12f6fb75811a746c742a28d32a17b26aa9
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date: Fri Feb 27 22:04:18 2015 +0100
tests: Remove usage of igt_crc_equal and _non_null
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
tests/kms_fbc_crc.c | 117 ++++++++++++++++++++++++++++++++++++----------------
1 file changed, 82 insertions(+), 35 deletions(-)
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index b52ac29..37221ac 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -56,7 +56,7 @@ enum test_mode {
typedef struct {
int drm_fd;
- igt_crc_t ref_crc[2];
+ igt_crc_t ref_crc[4];
igt_pipe_crc_t *pipe_crc;
drm_intel_bufmgr *bufmgr;
drm_intel_context *ctx[2];
@@ -234,13 +234,32 @@ static bool wait_for_fbc_enabled(data_t *data)
static void check_crc(data_t *data, enum test_mode mode)
{
igt_pipe_crc_t *pipe_crc = data->pipe_crc;
- igt_crc_t crc;
+ igt_crc_t crc, *ref_crc;
+
+ switch (mode) {
+ case TEST_PAGE_FLIP:
+ ref_crc = &data->ref_crc[1];
+ break;
+ case TEST_MMAP_CPU:
+ case TEST_MMAP_GTT:
+ case TEST_BLT:
+ case TEST_RENDER:
+ case TEST_CONTEXT:
+ ref_crc = &data->ref_crc[2];
+ break;
+ case TEST_PAGE_FLIP_AND_MMAP_CPU:
+ case TEST_PAGE_FLIP_AND_MMAP_GTT:
+ case TEST_PAGE_FLIP_AND_BLT:
+ case TEST_PAGE_FLIP_AND_RENDER:
+ case TEST_PAGE_FLIP_AND_CONTEXT:
+ ref_crc = &data->ref_crc[3];
+ break;
+ default:
+ igt_assert(false);
+ }
igt_pipe_crc_collect_crc(pipe_crc, &crc);
- if (mode == TEST_PAGE_FLIP)
- igt_assert_crc_equal(&crc, &data->ref_crc[1]);
- else
- ;/* FIXME: missing reference CRCs */
+ igt_assert_crc_equal(&crc, ref_crc);
}
static void test_crc(data_t *data, enum test_mode mode)
@@ -321,27 +340,71 @@ static bool prepare_crtc(data_t *data)
return true;
}
+static void create_fbs(data_t *data, bool tiled, struct igt_fb *fbs)
+{
+ int rc;
+ drmModeModeInfo *mode = igt_output_get_mode(data->output);
+ uint64_t tiling = tiled ? LOCAL_I915_FORMAT_MOD_X_TILED :
+ LOCAL_DRM_FORMAT_MOD_NONE;
+
+ rc = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888, tiling,
+ 0.0, 0.0, 0.0, &fbs[0]);
+ igt_assert(rc);
+ rc = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+ DRM_FORMAT_XRGB8888, tiling,
+ 0.1, 0.1, 0.1, &fbs[1]);
+ igt_assert(rc);
+}
+
+/* Since we want to be really safe that the CRCs are actually what we really
+ * want, use untiled FBs, so FBC won't happen to disrupt things. Also do the
+ * drawing before setting the modes, just to be sure. */
+static void get_ref_crcs(data_t *data)
+{
+ igt_display_t *display = &data->display;
+ struct igt_fb fbs[4];
+ int i;
+
+ create_fbs(data, false, &fbs[0]);
+ create_fbs(data, false, &fbs[2]);
+
+ fill_mmap_gtt(data, fbs[2].gem_handle, 0xff);
+ fill_mmap_gtt(data, fbs[3].gem_handle, 0xff);
+
+ for (i = 0; i < 4; i++) {
+ igt_plane_set_fb(data->primary, &fbs[i]);
+ igt_display_commit(display);
+ igt_wait_for_vblank(data->drm_fd, data->pipe);
+ igt_assert(!fbc_enabled(data));
+ igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc[i]);
+ igt_assert(!fbc_enabled(data));
+ }
+
+ igt_plane_set_fb(data->primary, &data->fb[1]);
+ igt_display_commit(display);
+
+ for (i = 0; i < 4; i++)
+ igt_remove_fb(data->drm_fd, &fbs[i]);
+}
+
static bool prepare_test(data_t *data, enum test_mode test_mode)
{
igt_display_t *display = &data->display;
igt_output_t *output = data->output;
- drmModeModeInfo *mode;
igt_pipe_crc_t *pipe_crc;
- int rc;
data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
- mode = igt_output_get_mode(data->output);
- rc = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
- DRM_FORMAT_XRGB8888,
- LOCAL_I915_FORMAT_MOD_X_TILED,
- 0.0, 0.0, 0.0, &data->fb[0]);
- igt_assert(rc);
- rc = igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
- DRM_FORMAT_XRGB8888,
- LOCAL_I915_FORMAT_MOD_X_TILED,
- 0.1, 0.1, 0.1, &data->fb[1]);
- igt_assert(rc);
+ create_fbs(data, true, data->fb);
+
+ igt_pipe_crc_free(data->pipe_crc);
+ data->pipe_crc = NULL;
+ pipe_crc = igt_pipe_crc_new(data->pipe,
+ INTEL_PIPE_CRC_SOURCE_AUTO);
+ data->pipe_crc = pipe_crc;
+
+ get_ref_crcs(data);
/* scanout = fb[1] */
igt_plane_set_fb(data->primary, &data->fb[1]);
@@ -359,19 +422,6 @@ static bool prepare_test(data_t *data, enum test_mode test_mode)
return false;
}
- igt_pipe_crc_free(data->pipe_crc);
- data->pipe_crc = NULL;
-
- pipe_crc = igt_pipe_crc_new(data->pipe,
- INTEL_PIPE_CRC_SOURCE_AUTO);
-
- data->pipe_crc = pipe_crc;
-
- igt_wait_for_vblank(data->drm_fd, data->pipe);
-
- /* get reference crc for fb[1] */
- igt_pipe_crc_collect_crc(pipe_crc, &data->ref_crc[1]);
-
if (test_mode == TEST_CONTEXT || test_mode == TEST_PAGE_FLIP_AND_CONTEXT) {
data->ctx[0] = drm_intel_gem_context_create(data->bufmgr);
igt_assert(data->ctx[0]);
@@ -405,9 +455,6 @@ static bool prepare_test(data_t *data, enum test_mode test_mode)
igt_wait_for_vblank(data->drm_fd, data->pipe);
- /* get reference crc for fb[0] */
- igt_pipe_crc_collect_crc(pipe_crc, &data->ref_crc[0]);
-
return true;
}
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2015-05-07 18:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-07 18:56 [PATCH igt 0/8] Make kms_fbc_crc useful again Paulo Zanoni
2015-05-07 18:56 ` [PATCH igt 1/8] tests/kms_fbc_crc: exec_nop() can also invalidate FBC Paulo Zanoni
2015-05-07 18:56 ` [PATCH igt 2/8] tests/kms_fbc_crc: increase the FBC wait timeout Paulo Zanoni
2015-05-07 18:56 ` [PATCH igt 3/8] tests/kms_fbc_crc: unify flip handling Paulo Zanoni
2015-05-07 18:56 ` [PATCH igt 4/8] tests/kms_fbc_crc: refactor context handling code Paulo Zanoni
2015-05-07 18:56 ` [PATCH igt 5/8] tests/kms_fbc_crc: extract check_crc() Paulo Zanoni
2015-05-07 18:56 ` [PATCH igt 6/8] tests/kms_fbc_crc: make the blt test draw the same pattern Paulo Zanoni
2015-05-07 18:56 ` [PATCH igt 7/8] tests/kms_fbc_crc: extract fill_mmap_{cpu, gtt}() Paulo Zanoni
2015-05-07 18:56 ` Paulo Zanoni [this message]
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=1431024996-2267-9-git-send-email-przanoni@gmail.com \
--to=przanoni@gmail.com \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.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