From patchwork Fri Mar 10 10:18:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ander Conselvan de Oliveira X-Patchwork-Id: 9615815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7910E60417 for ; Fri, 10 Mar 2017 10:18:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73EAA28705 for ; Fri, 10 Mar 2017 10:18:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68BE92870E; Fri, 10 Mar 2017 10:18:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A544328705 for ; Fri, 10 Mar 2017 10:18:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1030A6EE0B; Fri, 10 Mar 2017 10:18:47 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3DDE66EE0B for ; Fri, 10 Mar 2017 10:18:46 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Mar 2017 02:18:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,140,1486454400"; d="scan'208";a="74541540" Received: from linux.intel.com ([10.54.29.200]) by fmsmga005.fm.intel.com with ESMTP; 10 Mar 2017 02:18:41 -0800 Received: from localhost (aconselv-mobl3.fi.intel.com [10.237.66.54]) by linux.intel.com (Postfix) with ESMTP id 73A116A4080; Fri, 10 Mar 2017 02:18:37 -0800 (PST) From: Ander Conselvan de Oliveira To: intel-gfx@lists.freedesktop.org Date: Fri, 10 Mar 2017 12:18:35 +0200 Message-Id: <20170310101835.29845-2-ander.conselvan.de.oliveira@intel.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170310101835.29845-1-ander.conselvan.de.oliveira@intel.com> References: <20170310101835.29845-1-ander.conselvan.de.oliveira@intel.com> Cc: Ander Conselvan de Oliveira Subject: [Intel-gfx] [PATCH i-g-t] kms_cursor_crc: Add a subtest with a 256x256 gradient cursor 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-Virus-Scanned: ClamAV using ClamSMTP Some of the kms_cursor_crc subtests where failing on Geminilake. The root cause was an error on programming the pre-CSC gamma tables, which led to small rounding errors that, although not sufficient to change the image as captured at 8bpc with the Chamelium, were enough to generate a different CRC. It is not clear why the rounding is different when the cursor is enabled, but this was caught by chance, since the cursor would only be exercised with limited color combinations. To improve coverage, add a test that uses a gradient covering all possible 8bit values for a channel. Signed-off-by: Ander Conselvan de Oliveira --- tests/kms_cursor_crc.c | 42 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index 4851e18..0b232bf 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -87,6 +87,8 @@ static void draw_cursor(cairo_t *cr, int x, int y, int cw, int ch) igt_paint_color_alpha(cr, x + wl, y + ht, wr, hb, 0.5, 0.5, 0.5, 1.0); } +typedef void(*draw_cursor_cb)(cairo_t *cr, int x, int y, int cw, int ch); + static void cursor_enable(data_t *data) { igt_output_t *output = data->output; @@ -107,7 +109,8 @@ static void cursor_disable(data_t *data) } -static void do_single_test(data_t *data, int x, int y) +static void do_single_test_with_cursor_cb(data_t *data, int x, int y, + draw_cursor_cb cursor_cb) { igt_display_t *display = &data->display; igt_pipe_crc_t *pipe_crc = data->pipe_crc; @@ -151,7 +154,7 @@ static void do_single_test(data_t *data, int x, int y) igt_display_commit(display); /* Now render the same in software and collect crc */ - draw_cursor(cr, x, y, data->curw, data->curh); + cursor_cb(cr, x, y, data->curw, data->curh); igt_display_commit(display); igt_wait_for_vblank(data->drm_fd, data->pipe); @@ -162,6 +165,11 @@ static void do_single_test(data_t *data, int x, int y) igt_paint_color(cr, 0, 0, data->screenw, data->screenh, 0.0, 0.0, 0.0); } +static void do_single_test(data_t *data, int x, int y) +{ + do_single_test_with_cursor_cb(data, x, y, draw_cursor); +} + static void do_fail_test(data_t *data, int x, int y, int expect) { igt_display_t *display = &data->display; @@ -386,7 +394,8 @@ static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); } -static void create_cursor_fb(data_t *data, int cur_w, int cur_h) +static void create_cursor_fb_with_cb(data_t *data, int cur_w, int cur_h, + draw_cursor_cb cursor_cb) { cairo_t *cr; uint32_t fb_id; @@ -406,10 +415,15 @@ static void create_cursor_fb(data_t *data, int cur_w, int cur_h) igt_assert(fb_id); cr = igt_get_cairo_ctx(data->drm_fd, &data->fb); - draw_cursor(cr, 0, 0, cur_w, cur_h); + cursor_cb(cr, 0, 0, cur_w, cur_h); igt_assert(cairo_status(cr) == 0); } +static void create_cursor_fb(data_t *data, int cur_w, int cur_h) +{ + create_cursor_fb_with_cb(data, cur_w, cur_h, draw_cursor); +} + static bool has_nonsquare_cursors(uint32_t devid) { /* @@ -506,6 +520,23 @@ static void test_rapid_movement(data_t *data) } +static void draw_cursor_gradient(cairo_t *cr, int x, int y, int cw, int ch) +{ + cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE); + igt_paint_color_gradient(cr, x, y, cw, ch, 1.0, 1.0, 1.0); +} + +static void test_cursor_colors(data_t *data) +{ + int cursor_w = data->curw; + int cursor_h = data->curh; + + create_cursor_fb_with_cb(data, cursor_w, cursor_h, + draw_cursor_gradient); + do_single_test_with_cursor_cb(data, 0, 0, draw_cursor_gradient); + igt_remove_fb(data->drm_fd, &data->fb); +} + static void run_test_generic(data_t *data) { int cursor_size; @@ -613,6 +644,9 @@ igt_main igt_subtest_f("cursor-size-change") run_test(&data, test_cursor_size, cursor_width, cursor_height); + igt_subtest_f("gradient-cursor") + run_test(&data, test_cursor_colors, 256, 256); + run_test_generic(&data); igt_fixture {