From patchwork Tue Jan 26 13:29:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zanoni, Paulo R" X-Patchwork-Id: 8121901 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 238E4BEEE5 for ; Tue, 26 Jan 2016 13:29:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49FBB201F2 for ; Tue, 26 Jan 2016 13:29:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 616B920253 for ; Tue, 26 Jan 2016 13:29:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C76D36E5BB; Tue, 26 Jan 2016 05:29:19 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 02F8A6E5BB for ; Tue, 26 Jan 2016 05:29:18 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 26 Jan 2016 05:29:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,350,1449561600"; d="scan'208";a="889472087" Received: from svosulli-mobl3.amr.corp.intel.com (HELO panetone.amr.corp.intel.com) ([10.252.193.19]) by fmsmga001.fm.intel.com with ESMTP; 26 Jan 2016 05:29:17 -0800 From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Tue, 26 Jan 2016 11:29:01 -0200 Message-Id: <1453814944-15373-3-git-send-email-paulo.r.zanoni@intel.com> X-Mailer: git-send-email 2.7.0.rc3 In-Reply-To: <1453814944-15373-1-git-send-email-paulo.r.zanoni@intel.com> References: <1453814944-15373-1-git-send-email-paulo.r.zanoni@intel.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [PATCH igt 3/6] kms_frontbuffer_tracking: standardize the used FB sizes 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, 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 We want to make sure that both tiled and untiled buffers have the same size for the same width/height/format. This will allow better control over the failure paths exercised by our tests: when we try to flip from tiled to untiled, we'll be sure that we won't execute the error path that checks for buffer sizes. v2: Use the new igt_calc_fb_size() instead of implementing our own size calculation (Daniel). v3: We can now use igt_drm_format_to_bpp() (Daniel). Signed-off-by: Paulo Zanoni --- tests/kms_frontbuffer_tracking.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c index c819019..64f880c 100644 --- a/tests/kms_frontbuffer_tracking.c +++ b/tests/kms_frontbuffer_tracking.c @@ -483,6 +483,9 @@ static void create_fb(enum pixel_format pformat, int width, int height, uint64_t tiling, int plane, struct igt_fb *fb) { uint32_t format; + unsigned int size, stride; + int bpp; + uint64_t tiling_for_size; switch (pformat) { case FORMAT_RGB888: @@ -512,7 +515,21 @@ static void create_fb(enum pixel_format pformat, int width, int height, igt_assert(false); } - igt_create_fb(drm.fd, width, height, format, tiling, fb); + /* We want all frontbuffers with the same width/height/format to have + * the same size regardless of tiling since we want to properly exercise + * the Kernel's specific tiling-checking code paths without accidentally + * hitting size-checking ones first. */ + bpp = igt_drm_format_to_bpp(format); + if (plane == PLANE_CUR) + tiling_for_size = LOCAL_DRM_FORMAT_MOD_NONE; + else + tiling_for_size = LOCAL_I915_FORMAT_MOD_X_TILED; + + igt_calc_fb_size(drm.fd, width, height, bpp, tiling_for_size, &size, + &stride); + + igt_create_fb_with_bo_size(drm.fd, width, height, format, tiling, fb, + size, stride); } static uint32_t pick_color(struct igt_fb *fb, enum color ecolor)