From patchwork Fri Nov 13 17:12:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zanoni, Paulo R" X-Patchwork-Id: 7613021 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 49E719FDD4 for ; Fri, 13 Nov 2015 17:13:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 741CE2065D for ; Fri, 13 Nov 2015 17:13:15 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 94A0B20653 for ; Fri, 13 Nov 2015 17:13:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 21E286E632; Fri, 13 Nov 2015 09:13:14 -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 CEDC76E62F for ; Fri, 13 Nov 2015 09:13:11 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 13 Nov 2015 09:13:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,288,1444719600"; d="scan'208";a="837185210" Received: from jh1011-mobl1.gar.corp.intel.com (HELO panetone.amr.corp.intel.com) ([10.252.192.177]) by fmsmga001.fm.intel.com with ESMTP; 13 Nov 2015 09:13:10 -0800 From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Fri, 13 Nov 2015 15:12:46 -0200 Message-Id: <1447434771-19337-6-git-send-email-paulo.r.zanoni@intel.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1447434771-19337-1-git-send-email-paulo.r.zanoni@intel.com> References: <1447434771-19337-1-git-send-email-paulo.r.zanoni@intel.com> Subject: [Intel-gfx] [PATCH igt 05/10] kms_frontbuffer_tracking: set our own size for the FBs we create 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.5 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 If we just call igt_create_fb(), the automatic size calculated by create_bo_for_fb() may be way too big for the FBC CFB, and this will result in SKIPs due to not enough stolen memroy. So in order to avoid that, let's compute our own sizes. Besides this, I want to make sure that both the untiled and X tiled - and, in the future, Y tiled - 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 the change in buffer size does not cause the wrong error path to be executed. Signed-off-by: Paulo Zanoni --- tests/kms_frontbuffer_tracking.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/kms_frontbuffer_tracking.c b/tests/kms_frontbuffer_tracking.c index ee72532..74acc73 100644 --- a/tests/kms_frontbuffer_tracking.c +++ b/tests/kms_frontbuffer_tracking.c @@ -479,6 +479,7 @@ 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 buf_size, pixel_size, stride; switch (pformat) { case FORMAT_RGB888: @@ -508,7 +509,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/weight/format to have + * the same size regardless of tiling. Besides, the automatic size from + * intel_create_fb() is too big and may lead to many SKIPs due to not + * enough stolen memory. */ + pixel_size = igt_drm_format_to_bpp(format) / 8; + if (plane == PLANE_CUR) { + stride = ALIGN(width * pixel_size, 64); + buf_size = stride * height; + } else { + stride = ALIGN(width * pixel_size, 512); + buf_size = stride * ALIGN(height, 32); + } + + igt_create_fb_with_bo_size(drm.fd, width, height, format, tiling, fb, + buf_size, stride); } static uint32_t pick_color(struct igt_fb *fb, enum color ecolor)