From patchwork Tue Mar 8 14:51:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 8535071 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 9F2F2C0553 for ; Tue, 8 Mar 2016 14:53:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B122B200D4 for ; Tue, 8 Mar 2016 14:53:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DC9B3200D0 for ; Tue, 8 Mar 2016 14:53:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DAFB06E706; Tue, 8 Mar 2016 14:53:56 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id D707D6E706 for ; Tue, 8 Mar 2016 14:53:52 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id l68so4543149wml.3 for ; Tue, 08 Mar 2016 06:53:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=M38P+gloFGZAEGVCYZN7YsA4nOi0gzW5+ip7vfKwMLg=; b=deWR76xB+aR+405KdL/zFI86hr9FBwYWtQ37qkomHGNXA5FkCLZmoGphXqU/J7c6Vh jKeU6bvhjI3izexmBAcnGJQQGXx/a+R81MjWpFVEfly/MN1LWTkAFyIHHdrArWI8i2S6 DpkEM/w8NAD7KzCo4MWMEiAWanHJvi1R5KoPITHVX8bBTs+cV2YbeQYF8MaanjDa4EX+ mhqLkIZlrzObMwq8yuaqRhc+Zj492XigECDhZwQmUH/G5LJgXoX3aKwtIdItlEaAzjzy Rp5lq8FQzI6rULnctgOlolRa8CLBYczytruqlD40+QnjWSXxLOtbxe9A3kdG2oAKENHf atKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=M38P+gloFGZAEGVCYZN7YsA4nOi0gzW5+ip7vfKwMLg=; b=mncYetdiVW6gLuaw49YkZWxl6g6cOv06LzzEqER/9tz4SSABCi1/WHnU6HjKB5G3hx SwJHe7S45x0ViRK2UXWzPFnGBzutPeBB8vnKEXcwaT8YbWkh6PbEhx7s+tRlajQQxoQR qHqb0yxtrTASJ9h+tIpr3xZfWsTVajKwYMUdUpT3WznzLbYcU3OoyQYrzIGr+pLKYQBV swPZzTk06UmgGqp2nhbo6Kna3ILy96y+JezgIQE+80+n28EARuTq/CzzyUBhrxqvwJ2p WPZ4ezeKkhIh/L0BM2I5+iw6KVaxUvQvB6HfeZ8F0IUx4cJM0vxuI2IHrcy5wg/7G+/Y Rp2g== X-Gm-Message-State: AD7BkJKyY8IViBQ82USIuDHbZ0d3X4A8Yy3GtaYBJ5+w591HcbeqLqXhj5eFDtOZPKH5vg== X-Received: by 10.28.147.72 with SMTP id v69mr18762667wmd.79.1457448830545; Tue, 08 Mar 2016 06:53:50 -0800 (PST) Received: from cizrna.lan ([109.72.12.208]) by smtp.gmail.com with ESMTPSA id 3sm3781979wmp.14.2016.03.08.06.53.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Mar 2016 06:53:49 -0800 (PST) From: Tomeu Vizoso To: Intel GFX discussion Date: Tue, 8 Mar 2016 15:51:39 +0100 Message-Id: <1457448699-9778-18-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457448699-9778-1-git-send-email-tomeu.vizoso@collabora.com> References: <1457448699-9778-1-git-send-email-tomeu.vizoso@collabora.com> Cc: Daniel Stone , Tomeu Vizoso , Micah Fedke , Gustavo Padovan , Emil Velikov Subject: [Intel-gfx] [i-g-t PATCH v2 17/17] kms_addfb_basic: Get intel gen from within subtest 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 Because determining the Intel GFX generation requires a call to DRM_IOCTL_I915_GETPARAM, move the code that requires it to a subtest that can be skipped on drivers other than i915. Signed-off-by: Tomeu Vizoso --- Changes in v2: None tests/kms_addfb_basic.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c index daba6b9aaeed..30f312291fe7 100644 --- a/tests/kms_addfb_basic.c +++ b/tests/kms_addfb_basic.c @@ -399,10 +399,21 @@ static void addfb25_tests(int fd) gem_close(fd, gem_bo); } -static void addfb25_ytile(int fd, int gen) +static int addfb_expected_ret(int fd) +{ + int gen; + + if (!is_i915_device(fd)) + return 0; + + gen = intel_gen(intel_get_drm_devid(fd)); + return gen >= 9 ? 0 : -1; +} + +static void addfb25_ytile(int fd) { struct local_drm_mode_fb_cmd2 f = {}; - int shouldret; + int gen; igt_fixture { gem_bo = igt_create_bo_with_dimensions(fd, 1024, 1024, @@ -412,8 +423,6 @@ static void addfb25_ytile(int fd, int gen) DRM_FORMAT_XRGB8888, 0, 0, NULL, NULL, NULL); igt_assert(gem_bo_small); - shouldret = gen >= 9 ? 0 : -1; - memset(&f, 0, sizeof(f)); f.width = 1024; @@ -430,8 +439,9 @@ static void addfb25_ytile(int fd, int gen) igt_require_fb_modifiers(fd); f.modifier[0] = LOCAL_I915_FORMAT_MOD_Y_TILED; - igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == shouldret); - if (!shouldret) + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == + addfb_expected_ret(fd)); + if (!addfb_expected_ret(fd)) igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0); f.fb_id = 0; } @@ -440,14 +450,17 @@ static void addfb25_ytile(int fd, int gen) igt_require_fb_modifiers(fd); f.modifier[0] = LOCAL_I915_FORMAT_MOD_Yf_TILED; - igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == shouldret); - if (!shouldret) + igt_assert(drmIoctl(fd, LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) == + addfb_expected_ret(fd)); + if (!addfb_expected_ret(fd)) igt_assert(drmIoctl(fd, DRM_IOCTL_MODE_RMFB, &f.fb_id) == 0); f.fb_id = 0; } igt_subtest("addfb25-Y-tiled-small") { igt_require_fb_modifiers(fd); + + gen = intel_gen(intel_get_drm_devid(fd)); igt_require(gen >= 9); f.modifier[0] = LOCAL_I915_FORMAT_MOD_Y_TILED; @@ -464,14 +477,11 @@ static void addfb25_ytile(int fd, int gen) } int fd; -int gen; igt_main { - igt_fixture { + igt_fixture fd = drm_open_driver_master(DRIVER_ANY); - gen = intel_gen(intel_get_drm_devid(fd)); - } invalid_tests(fd); @@ -481,7 +491,7 @@ igt_main addfb25_tests(fd); - addfb25_ytile(fd, gen); + addfb25_ytile(fd); tiling_tests(fd);