From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH igt 7/8] tests/kms_fbc_crc: extract fill_mmap_{cpu, gtt}()
Date: Thu, 7 May 2015 15:56:35 -0300 [thread overview]
Message-ID: <1431024996-2267-8-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>
Just like we have fill_render() and fill_blt(). I'm also going to use
fill_mmap_gtt() for the code that generates the reference CRCs.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
tests/kms_fbc_crc.c | 35 +++++++++++++++++++++++++----------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/tests/kms_fbc_crc.c b/tests/kms_fbc_crc.c
index a66aa51..b52ac29 100644
--- a/tests/kms_fbc_crc.c
+++ b/tests/kms_fbc_crc.c
@@ -190,6 +190,29 @@ static void fill_render(data_t *data, uint32_t handle,
gem_bo_busy(data->drm_fd, handle);
}
+static void fill_mmap_cpu(data_t *data, uint32_t handle, unsigned char color)
+{
+ void *ptr;
+
+ ptr = gem_mmap__cpu(data->drm_fd, handle, 0, 4096, PROT_WRITE);
+ gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_CPU,
+ I915_GEM_DOMAIN_CPU);
+ memset(ptr, color, 4);
+ munmap(ptr, 4096);
+ gem_sw_finish(data->drm_fd, handle);
+}
+
+static void fill_mmap_gtt(data_t *data, uint32_t handle, unsigned char color)
+{
+ void *ptr;
+
+ ptr = gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE);
+ gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_GTT,
+ I915_GEM_DOMAIN_GTT);
+ memset(ptr, color, 4);
+ munmap(ptr, 4096);
+}
+
static bool fbc_enabled(data_t *data)
{
FILE *status;
@@ -237,24 +260,16 @@ static void test_crc(data_t *data, enum test_mode mode)
}
switch (mode) {
- void *ptr;
drm_intel_context *context = NULL;
case TEST_PAGE_FLIP:
break;
case TEST_MMAP_CPU:
case TEST_PAGE_FLIP_AND_MMAP_CPU:
- ptr = gem_mmap__cpu(data->drm_fd, handle, 0, 4096, PROT_WRITE);
- gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
- memset(ptr, 0xff, 4);
- munmap(ptr, 4096);
- gem_sw_finish(data->drm_fd, handle);
+ fill_mmap_cpu(data, handle, 0xff);
break;
case TEST_MMAP_GTT:
case TEST_PAGE_FLIP_AND_MMAP_GTT:
- ptr = gem_mmap__gtt(data->drm_fd, handle, 4096, PROT_WRITE);
- gem_set_domain(data->drm_fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
- memset(ptr, 0xff, 4);
- munmap(ptr, 4096);
+ fill_mmap_gtt(data, handle, 0xff);
break;
case TEST_BLT:
case TEST_PAGE_FLIP_AND_BLT:
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next 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 ` Paulo Zanoni [this message]
2015-05-07 18:56 ` [PATCH igt 8/8] tests/kms_fb_crc: fix the reference CRC checking Paulo Zanoni
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-8-git-send-email-przanoni@gmail.com \
--to=przanoni@gmail.com \
--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