From patchwork Thu Apr 10 12:08:05 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: 3962331 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 EA4C3BFF02 for ; Thu, 10 Apr 2014 12:08:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F17D320616 for ; Thu, 10 Apr 2014 12:08:36 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CF781204FB for ; Thu, 10 Apr 2014 12:08:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0DCED6E1FF; 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 08F4B6E1FF for ; Thu, 10 Apr 2014 05:08:33 -0700 (PDT) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 10 Apr 2014 05:08:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,834,1389772800"; d="scan'208";a="417335567" Received: from sahapukki.fi.intel.com ([10.237.72.180]) by azsmga001.ch.intel.com with ESMTP; 10 Apr 2014 05:08:07 -0700 From: Antti Koskipaa To: intel-gfx@lists.freedesktop.org Date: Thu, 10 Apr 2014 15:08:05 +0300 Message-Id: <1397131692-2857-2-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 1/8] kms_cursor_crc: Remove some test cases and change cursor to color 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 Currently this test is quite useless, since it only checks for valid CRCs when the correct output from a test is a completely black screen (invisible or visible but black cursor, or cursor is offscreen) and disables the check when anything visible is onscreen. This patch changes the cursor to a colorful one and removes the test cases that become redundant because of this change. The cursor is designed to be asymmetrical such that future tests involving rotation, mirroring, etc. produce different CRCs and failures can be detected. This (temporarily) disables CRC testing until the next patch which will add software rendering of the cursor and the CRC generation. Signed-off-by: Antti Koskipaa --- tests/kms_cursor_crc.c | 75 +++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index fbb5d88..52281d0 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -39,19 +39,11 @@ #define DRM_CAP_CURSOR_HEIGHT 0x9 #endif -enum cursor_type { - WHITE_VISIBLE, - WHITE_INVISIBLE, - BLACK_VISIBLE, - BLACK_INVISIBLE, - NUM_CURSOR_TYPES, -}; - typedef struct { int drm_fd; igt_display_t display; struct igt_fb primary_fb; - struct igt_fb fb[NUM_CURSOR_TYPES]; + struct igt_fb fb; igt_pipe_crc_t **pipe_crc; } data_t; @@ -64,6 +56,16 @@ typedef struct { int left, right, top, bottom; } test_data_t; +static void draw_cursor(cairo_t *cr, int x, int y, int w) +{ + w /= 2; + 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); + igt_paint_color_alpha(cr, x + w, y, w, w, 0.0, 1.0, 0.0, 1.0); + igt_paint_color_alpha(cr, x, y + w, w, w, 0.0, 0.0, 1.0, 1.0); + igt_paint_color_alpha(cr, x + w, y + w, w, w, 0.5, 0.5, 0.5, 1.0); +} static igt_pipe_crc_t *create_crc(data_t *data, enum pipe pipe) { @@ -104,7 +106,7 @@ static void do_test(test_data_t *test_data, do_single_test(test_data, left, bottom); } -static void cursor_enable(test_data_t *test_data, enum cursor_type cursor_type) +static void cursor_enable(test_data_t *test_data) { data_t *data = test_data->data; igt_display_t *display = &data->display; @@ -112,7 +114,7 @@ static void cursor_enable(test_data_t *test_data, enum cursor_type cursor_type) igt_plane_t *cursor; cursor = igt_output_get_plane(output, IGT_PLANE_CURSOR); - igt_plane_set_fb(cursor, &data->fb[cursor_type]); + igt_plane_set_fb(cursor, &data->fb); igt_display_commit(display); } @@ -128,7 +130,7 @@ static void cursor_disable(test_data_t *test_data) igt_display_commit(display); } -static void test_crc(test_data_t *test_data, enum cursor_type cursor_type, +static void test_crc(test_data_t *test_data, bool onscreen, int cursor_w, int cursor_h) { int left = test_data->left; @@ -136,11 +138,11 @@ static void test_crc(test_data_t *test_data, enum cursor_type cursor_type, int top = test_data->top; int bottom = test_data->bottom; - cursor_enable(test_data, cursor_type); + cursor_enable(test_data); if (onscreen) { /* cursor onscreen, crc should match, except when white visible cursor is used */ - test_data->crc_must_match = (cursor_type != WHITE_VISIBLE); + test_data->crc_must_match = false; /* fully inside */ do_test(test_data, left, right, top, bottom); @@ -156,7 +158,7 @@ static void test_crc(test_data_t *test_data, enum cursor_type cursor_type, do_test(test_data, left - (cursor_w-1), right + (cursor_w-1), top - (cursor_h-1), bottom + (cursor_h-1)); } else { /* cursor offscreen, crc should always match */ - test_data->crc_must_match = true; + test_data->crc_must_match = false; /* fully outside */ do_test(test_data, left - (cursor_w), right + (cursor_w), top , bottom ); @@ -255,8 +257,7 @@ static void cleanup_crtc(test_data_t *test_data, igt_output_t *output) igt_output_set_pipe(output, PIPE_ANY); } -static void run_test(data_t *data, enum cursor_type cursor_type, bool onscreen, - int cursor_w, int cursor_h) +static void run_test(data_t *data, bool onscreen, int cursor_w, int cursor_h) { igt_display_t *display = &data->display; igt_output_t *output; @@ -280,7 +281,7 @@ static void run_test(data_t *data, enum cursor_type cursor_type, bool onscreen, igt_subtest_name(), pipe_name(test_data.pipe), igt_output_name(output)); - test_crc(&test_data, cursor_type, onscreen, cursor_w, cursor_h); + test_crc(&test_data, onscreen, cursor_w, cursor_h); fprintf(stdout, "\n%s on pipe %c, connector %s: PASSED\n\n", igt_subtest_name(), pipe_name(test_data.pipe), @@ -294,22 +295,18 @@ static void run_test(data_t *data, enum cursor_type cursor_type, bool onscreen, igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); } -static void create_cursor_fb(data_t *data, - enum cursor_type cursor_type, - double r, double g, double b, double a, - int cur_w, int cur_h) +static void create_cursor_fb(data_t *data, int cur_w, int cur_h) { cairo_t *cr; - uint32_t fb_id[NUM_CURSOR_TYPES]; + uint32_t fb_id; - fb_id[cursor_type] = igt_create_fb(data->drm_fd, cur_w, cur_h, - DRM_FORMAT_ARGB8888, false, - &data->fb[cursor_type]); - igt_assert(fb_id[cursor_type]); + fb_id = igt_create_fb(data->drm_fd, cur_w, cur_h, + DRM_FORMAT_ARGB8888, false, + &data->fb); + igt_assert(fb_id); - cr = igt_get_cairo_ctx(data->drm_fd, - &data->fb[cursor_type]); - igt_paint_color_alpha(cr, 0, 0, cur_w, cur_h, r, g, b, a); + cr = igt_get_cairo_ctx(data->drm_fd, &data->fb); + draw_cursor(cr, 0, 0, cur_w); igt_assert(cairo_status(cr) == 0); } @@ -322,21 +319,13 @@ static void run_test_generic(data_t *data, int cursor_max_size) igt_require(cursor_max_size >= cursor_size); sprintf(c_size, "%d", cursor_size); - /* Creating cursor framebuffers */ - create_cursor_fb(data, WHITE_VISIBLE, 1.0, 1.0, 1.0, 1.0, cursor_size, cursor_size); - create_cursor_fb(data, WHITE_INVISIBLE, 1.0, 1.0, 1.0, 0.0, cursor_size, cursor_size); - create_cursor_fb(data, BLACK_VISIBLE, 0.0, 0.0, 0.0, 1.0, cursor_size, cursor_size); - create_cursor_fb(data, BLACK_INVISIBLE, 0.0, 0.0, 0.0, 0.0, cursor_size, cursor_size); + create_cursor_fb(data, cursor_size, cursor_size); /* Using created cursor FBs to test cursor support */ - igt_subtest_f("white-visible-cursor-%s-onscreen", c_size) - run_test(data, WHITE_VISIBLE, true, cursor_size, cursor_size); - igt_subtest_f("white-invisible-cursor-%s-offscreen", c_size) - run_test(data, WHITE_INVISIBLE, false, cursor_size, cursor_size); - igt_subtest_f("black-visible-cursor-%s-onscreen", c_size) - run_test(data, BLACK_VISIBLE, true, cursor_size, cursor_size); - igt_subtest_f("black-invisible-cursor-%s-offscreen", c_size) - run_test(data, BLACK_INVISIBLE, false, cursor_size, cursor_size); + igt_subtest_f("cursor-%s-onscreen", c_size) + run_test(data, true, cursor_size, cursor_size); + igt_subtest_f("cursor-%s-offscreen", c_size) + run_test(data, false, cursor_size, cursor_size); } }