From patchwork Thu Apr 10 12:08:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Antti_Koskip=C3=A4=C3=A4?= X-Patchwork-Id: 3962351 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1D469C0DA2 for ; Thu, 10 Apr 2014 12:08:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 45F8E204F6 for ; Thu, 10 Apr 2014 12:08:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3AFD020629 for ; Thu, 10 Apr 2014 12:08:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A1BE36E209; Thu, 10 Apr 2014 05:08:35 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by gabe.freedesktop.org (Postfix) with ESMTP id 3951D6E201 for ; Thu, 10 Apr 2014 05:08:35 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 10 Apr 2014 05:08:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,834,1389772800"; d="scan'208";a="417335597" Received: from sahapukki.fi.intel.com ([10.237.72.180]) by azsmga001.ch.intel.com with ESMTP; 10 Apr 2014 05:08:13 -0700 From: Antti Koskipaa To: intel-gfx@lists.freedesktop.org Date: Thu, 10 Apr 2014 15:08:09 +0300 Message-Id: <1397131692-2857-6-git-send-email-antti.koskipaa@linux.intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1397131692-2857-1-git-send-email-antti.koskipaa@linux.intel.com> References: <1397131692-2857-1-git-send-email-antti.koskipaa@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t v2 5/8] kms_cursor_crc: Add reference software rendering X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 This patch first render the cursor with hardware rendering and then with software, acquiring the CRC in both cases so they can be properly compared. Say goodbye to crc_must_match variable. Signed-off-by: Antti Koskipaa --- tests/kms_cursor_crc.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index 94baa94..85ff243 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -52,14 +52,17 @@ typedef struct { igt_output_t *output; enum pipe pipe; igt_crc_t ref_crc; - bool crc_must_match; int left, right, top, bottom; + int screenw, screenh; int curw, curh; /* cursor size */ } test_data_t; static void draw_cursor(cairo_t *cr, int x, int y, int w) { w /= 2; + /* Cairo doesn't like to be fed numbers that are too wild */ + if ((x < SHRT_MIN) || (x > SHRT_MAX) || (y < SHRT_MIN) || (y > SHRT_MAX)) + return; cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE); /* 4 color rectangles in the corners, RGBY */ igt_paint_color_alpha(cr, x, y, w, w, 1.0, 0.0, 0.0, 1.0); @@ -105,23 +108,31 @@ static void do_single_test(test_data_t *test_data, int x, int y) data_t *data = test_data->data; igt_display_t *display = &data->display; igt_pipe_crc_t *pipe_crc = data->pipe_crc[test_data->pipe]; - igt_crc_t crc; + igt_crc_t crc, ref_crc; igt_plane_t *cursor; + cairo_t *cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb); printf("."); fflush(stdout); + /* Hardware test */ cursor_enable(test_data); cursor = igt_output_get_plane(test_data->output, IGT_PLANE_CURSOR); igt_plane_set_position(cursor, x, y); igt_display_commit(display); igt_wait_for_vblank(data->drm_fd, test_data->pipe); + igt_pipe_crc_collect_crc(pipe_crc, &crc); cursor_disable(test_data); - igt_pipe_crc_collect_crc(pipe_crc, &crc); - if (test_data->crc_must_match) - igt_assert(igt_crc_equal(&crc, &test_data->ref_crc)); - else - igt_assert(!igt_crc_equal(&crc, &test_data->ref_crc)); + /* Now render the same in software and collect crc */ + draw_cursor(cr, x, y, test_data->curw); + igt_display_commit(display); + igt_wait_for_vblank(data->drm_fd, test_data->pipe); + igt_pipe_crc_collect_crc(pipe_crc, &ref_crc); + /* Clear screen afterwards */ + igt_paint_color(cr, 0, 0, test_data->screenw, test_data->screenh, + 0.0, 0.0, 0.0); + + igt_assert(igt_crc_equal(&crc, &ref_crc)); } static void do_test(test_data_t *test_data, @@ -232,6 +243,8 @@ static bool prepare_crtc(test_data_t *test_data, igt_output_t *output, test_data->right = mode->hdisplay - cursor_w; test_data->top = 0; test_data->bottom = mode->vdisplay - cursor_h; + test_data->screenw = mode->hdisplay; + test_data->screenh = mode->vdisplay; test_data->curw = cursor_w; test_data->curh = cursor_h;