From patchwork Mon Feb 24 15:37:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sagar.a.kamble@intel.com X-Patchwork-Id: 3709911 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 30ADEBF13A for ; Mon, 24 Feb 2014 15:36:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 41391200F2 for ; Mon, 24 Feb 2014 15:36:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 45FF7200E7 for ; Mon, 24 Feb 2014 15:36:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 178DFFA578; Mon, 24 Feb 2014 07:36:12 -0800 (PST) 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 79C2AFA578 for ; Mon, 24 Feb 2014 07:36:10 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by azsmga101.ch.intel.com with ESMTP; 24 Feb 2014 07:36:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,535,1389772800"; d="scan'208";a="480844471" Received: from sagar-desktop.iind.intel.com ([10.223.82.31]) by fmsmga001.fm.intel.com with ESMTP; 24 Feb 2014 07:36:07 -0800 From: sagar.a.kamble@intel.com To: intel-gfx@lists.freedesktop.org Date: Mon, 24 Feb 2014 21:07:05 +0530 Message-Id: <1393256225-31904-1-git-send-email-sagar.a.kamble@intel.com> X-Mailer: git-send-email 1.8.5 Cc: Sagar Kamble Subject: [Intel-gfx] [PATCH 1/1] kms_cursor_crc/Enabling this test for variable cursor width and heights X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.2 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 From: Sagar Kamble Signed-off-by: Sagar Kamble --- tests/kms_cursor_crc.c | 51 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c index 38aa1ab..4458248 100644 --- a/tests/kms_cursor_crc.c +++ b/tests/kms_cursor_crc.c @@ -34,6 +34,8 @@ #include "igt_debugfs.h" #include "igt_kms.h" +int w = 0, h = 0; + enum cursor_type { WHITE_VISIBLE, WHITE_INVISIBLE, @@ -170,7 +172,7 @@ static void test_crc(test_data_t *test_data, enum cursor_type cursor_type, /* enable cursor */ igt_assert(drmModeSetCursor(data->drm_fd, test_data->crtc_id, - data->fb[cursor_type].gem_handle, 64, 64) == 0); + data->fb[cursor_type].gem_handle, w, h) == 0); if (onscreen) { /* cursor onscreen, crc should match, except when white visible cursor is used */ @@ -180,32 +182,32 @@ static void test_crc(test_data_t *test_data, enum cursor_type cursor_type, do_test(test_data, left, right, top, bottom); /* 2 pixels inside */ - do_test(test_data, left - 62, right + 62, top , bottom ); - do_test(test_data, left , right , top - 62, bottom + 62); - do_test(test_data, left - 62, right + 62, top - 62, bottom + 62); + do_test(test_data, left - (w - 2), right + (w - 2), top , bottom ); + do_test(test_data, left , right , top - (w - 2), bottom + (w - 2)); + do_test(test_data, left - (w - 2), right + (w - 2), top - (w - 2), bottom + (w - 2)); /* 1 pixel inside */ - do_test(test_data, left - 63, right + 63, top , bottom ); - do_test(test_data, left , right , top - 63, bottom + 63); - do_test(test_data, left - 63, right + 63, top - 63, bottom + 63); + do_test(test_data, left - (w - 1), right + (w - 1), top , bottom ); + do_test(test_data, left , right , top - (w - 1), bottom + (w - 1)); + do_test(test_data, left - (w - 1), right + (w - 1), top - (w - 1), bottom + (w - 1)); } else { /* cursor offscreen, crc should always match */ test_data->crc_must_match = true; /* fully outside */ - do_test(test_data, left - 64, right + 64, top , bottom ); - do_test(test_data, left , right , top - 64, bottom + 64); - do_test(test_data, left - 64, right + 64, top - 64, bottom + 64); + do_test(test_data, left - w, right + w, top , bottom ); + do_test(test_data, left , right , top - w, bottom + w); + do_test(test_data, left - w, right + w, top - w, bottom + w); /* fully outside by 1 extra pixels */ - do_test(test_data, left - 65, right + 65, top , bottom ); - do_test(test_data, left , right , top - 65, bottom + 65); - do_test(test_data, left - 65, right + 65, top - 65, bottom + 65); + do_test(test_data, left - (w + 1), right + (w + 1), top , bottom ); + do_test(test_data, left , right , top - (w + 1), bottom + (w + 1)); + do_test(test_data, left - (w + 1), right + (w + 1), top - (w + 1), bottom + (w + 1)); /* fully outside by 2 extra pixels */ - do_test(test_data, left - 66, right + 66, top , bottom ); - do_test(test_data, left , right , top - 66, bottom + 66); - do_test(test_data, left - 66, right + 66, top - 66, bottom + 66); + do_test(test_data, left - (w + 2), right + (w + 2), top , bottom ); + do_test(test_data, left , right , top - (w + 2), bottom + (w + 2)); + do_test(test_data, left - (w + 2), right + (w + 2), top - (w + 2), bottom + (w + 2)); /* fully outside by a lot of extra pixels */ do_test(test_data, left - 512, right + 512, top , bottom ); @@ -251,9 +253,9 @@ static bool prepare_crtc(test_data_t *test_data, uint32_t connector_id) /* x/y position where the cursor is still fully visible */ test_data->left = 0; - test_data->right = connector.config.default_mode.hdisplay - 64; + test_data->right = connector.config.default_mode.hdisplay - w; test_data->top = 0; - test_data->bottom = connector.config.default_mode.vdisplay - 64; + test_data->bottom = connector.config.default_mode.vdisplay - h; /* make sure cursor is disabled */ igt_assert(drmModeSetCursor(data->drm_fd, test_data->crtc_id, 0, 0, 0) == 0); @@ -314,20 +316,29 @@ static void create_cursor_fb(data_t *data, { cairo_t *cr; - data->fb_id[cursor_type] = kmstest_create_fb2(data->drm_fd, 64, 64, + data->fb_id[cursor_type] = kmstest_create_fb2(data->drm_fd, w, h, DRM_FORMAT_ARGB8888, false, &data->fb[cursor_type]); igt_assert(data->fb_id[cursor_type]); cr = kmstest_get_cairo_ctx(data->drm_fd, &data->fb[cursor_type]); - kmstest_paint_color_alpha(cr, 0, 0, 64, 64, r, g, b, a); + kmstest_paint_color_alpha(cr, 0, 0, w, h, r, g, b, a); igt_assert(cairo_status(cr) == 0); } igt_main { data_t data = {}; + int c; + char args[10]; + + printf("\nEnter Width and Height of Cursor Plane (64x64, 128x128):"); + scanf("%s", args); + if (sscanf(args, "%dx%d", &w, &h) != 2) { + printf("\nInvalid arguments"); + return -1; + } igt_skip_on_simulation();