From patchwork Wed Jan 28 01:59:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 5722811 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5B14DBFFA8 for ; Wed, 28 Jan 2015 01:59:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6F2020212 for ; Wed, 28 Jan 2015 01:59:12 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 8204920263 for ; Wed, 28 Jan 2015 01:59:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 19ADF6E5E0; Tue, 27 Jan 2015 17:59:09 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 9AF736E5E0 for ; Tue, 27 Jan 2015 17:59:07 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 27 Jan 2015 17:55:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,478,1418112000"; d="scan'208";a="657666505" Received: from bthurber-mobl.amr.corp.intel.com (HELO localhost) ([10.252.142.7]) by fmsmga001.fm.intel.com with ESMTP; 27 Jan 2015 17:59:06 -0800 From: Ben Widawsky To: Intel GFX Date: Tue, 27 Jan 2015 17:59:06 -0800 Message-Id: <1422410346-10524-1-git-send-email-benjamin.widawsky@intel.com> X-Mailer: git-send-email 2.2.2 Cc: Ben Widawsky , Ben Widawsky Subject: [Intel-gfx] [PATCH] gem_render_copy: Provide an all pixels check X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ben Widawsky --- tests/gem_render_copy.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c index 006b6f5..6348eee 100644 --- a/tests/gem_render_copy.c +++ b/tests/gem_render_copy.c @@ -69,6 +69,7 @@ typedef struct { uint32_t linear[WIDTH * HEIGHT]; } data_t; static int opt_dump_png = false; +static int check_all_pixels = false; static void scratch_buf_write_to_png(struct igt_buf *buf, const char *filename) { @@ -125,6 +126,10 @@ static int opt_handler(int opt, int opt_index) opt_dump_png = true; } + if (opt == 'a') { + check_all_pixels = true; + } + return 0; } @@ -136,7 +141,7 @@ int main(int argc, char **argv) igt_render_copyfunc_t render_copy = NULL; int opt_dump_aub = igt_aub_dump_enabled(); - igt_simple_init_parse_opts(argc, argv, "d", NULL, NULL, opt_handler); + igt_simple_init_parse_opts(argc, argv, "da", NULL, NULL, opt_handler); igt_fixture { data.drm_fd = drm_open_any_render(); @@ -170,6 +175,14 @@ int main(int argc, char **argv) drm_intel_bufmgr_gem_set_aub_dump(data.bufmgr, true); } + /* This will copy the src to the mid point of the dst buffer. Presumably + * the out of bounds accesses will get clipped. + * Resulting buffer should look like: + * _______ + * |dst|dst| + * |dst|src| + * ------- + */ render_copy(batch, NULL, &src, 0, 0, WIDTH, HEIGHT, &dst, WIDTH / 2, HEIGHT / 2); @@ -183,6 +196,23 @@ int main(int argc, char **argv) AUB_DUMP_BMP_FORMAT_ARGB_8888, STRIDE, 0); drm_intel_bufmgr_gem_set_aub_dump(data.bufmgr, false); + } else if (check_all_pixels) { + uint32_t val; + int i, j; + gem_read(data.drm_fd, dst.bo->handle, 0, + data.linear, sizeof(data.linear)); + for (i = 0; i < WIDTH; i++) { + for (j = 0; j < HEIGHT; j++) { + uint32_t color = DST_COLOR; + val = data.linear[j * WIDTH + i]; + if (j >= HEIGHT/2 && i >= WIDTH/2) + color = SRC_COLOR; + + igt_assert_f(val == color, + "Expected 0x%08x, found 0x%08x at (%d,%d)\n", + color, val, i, j); + } + } } else { scratch_buf_check(&data, &dst, 10, 10, DST_COLOR); scratch_buf_check(&data, &dst, WIDTH - 10, HEIGHT - 10, SRC_COLOR);