From patchwork Wed Dec 21 00:13:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Kristian_H=C3=B8gsberg?= X-Patchwork-Id: 9482397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 01B3660237 for ; Wed, 21 Dec 2016 00:13:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6C8F28159 for ; Wed, 21 Dec 2016 00:13:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA14728306; Wed, 21 Dec 2016 00:13:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9C73E28159 for ; Wed, 21 Dec 2016 00:13:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 94D7E6EF5E; Wed, 21 Dec 2016 00:13:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 029326EF5D for ; Wed, 21 Dec 2016 00:13:42 +0000 (UTC) Received: by mail-pg0-x244.google.com with SMTP id i5so4389212pgh.2 for ; Tue, 20 Dec 2016 16:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rC65CXZm0AMDgtv9B0fzUoBYtI4w0Jo7mcuKq3KdcDQ=; b=uyiYEotB8oVfKn/Evp8lKtj83g5cHZ1DCIsenP3izYfy7//yi5+dsW/eTgqWaUe70y qjKrI9BCHlKoPLqxb5Pr75d2VSiF5t1qZMOjq3fai+tGxuW9ebklhwUXAEPGgo2KDK9P le3CFLfCNDoeJJysnA61ERbbJ5gtKgtEdbKvKAl7G0FG66wUTDGu14E/EuqXkhauotzA i1cIXBSpzmuDwjcew6T30R7jCi+o5GFaybp/H0i+hMlsMwvHlRMX2p2UMWgOsyhhJP6M NiioXd1tdphbiZLct8iWbiMDqvhiXTDgh9GM4Z/m6hwhBJooEoxxjOsXNvsHJ22euwD2 eGUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rC65CXZm0AMDgtv9B0fzUoBYtI4w0Jo7mcuKq3KdcDQ=; b=GLAfVa3KeDtF0wjBQKXNwDsNqVVIIYzUbZ5msbKR4qhcyGqX3G7wsFqWK3APqCrInn XLEE+d6js+CNmSpC2/+aTaKnqh0799ZYBKD4aEVTukg8AnkFqNi59fFMk3S4uHmB1zrH MSWNx1dq5GzDMcxi7UnDgLWa/9nk/IRm8yTdJH9BUr7nk/24Bbs4dGX9qY7ipYU0O7Rc 7aPa5vjOB1jxKq18rmzL2kcnfqSzmSO8P7UPkZpqbOx18UM+lNN33iT3OXbTrn8li/kK YulLRZeiGPlX7Pd5FELJfvxoj/vFd4tJZBmOrMWva/2ITLwKJTXwGvFmY5Csy/6Ijur7 eIug== X-Gm-Message-State: AIkVDXJRktAAJuQ5tW4G/y8eMEAEciIHKN+dgaL/ATzDql9/ISPuCrJLSBiXrllEjUUElA== X-Received: by 10.98.159.67 with SMTP id g64mr1581822pfe.93.1482279221401; Tue, 20 Dec 2016 16:13:41 -0800 (PST) Received: from owl.local ([2620:15c:f:fd00:196b:357f:d485:3c17]) by smtp.gmail.com with ESMTPSA id h185sm41612032pfg.90.2016.12.20.16.13.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2016 16:13:40 -0800 (PST) From: "Kristian H. Kristensen" To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] modetest: Teach modetest about format info Date: Tue, 20 Dec 2016 16:13:33 -0800 Message-Id: <20161221001333.21941-2-hoegsberg@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161221001333.21941-1-hoegsberg@gmail.com> References: <20161221001333.21941-1-hoegsberg@gmail.com> Cc: ben@bwidawsk.net, "Kristian H. Kristensen" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Kristian H. Kristensen" BUG=chrome-os-partner:56407 TEST=modetest on a KMS driver that exposes modifiers should print those Change-Id: I91b2a408b1c8f112d7ba5d0998119b3c800b199c --- tests/modetest/modetest.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c index dedd286..091bcba 100644 --- a/tests/modetest/modetest.c +++ b/tests/modetest/modetest.c @@ -417,9 +417,30 @@ static void dump_framebuffers(struct device *dev) printf("\n"); } +static const char * +mod_to_string(uint64_t mod, char *buf, int len) +{ + switch (mod) { + case DRM_FORMAT_MOD_NONE: + return "LINEAR"; + case I915_FORMAT_MOD_X_TILED: + return "X_TILED"; + case I915_FORMAT_MOD_Y_TILED: + return "Y_TILED"; + case I915_FORMAT_MOD_Yf_TILED: + return "Yf_TILED"; + case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE: + return "SAMSUNG_64_32_TILE"; + default: + snprintf(buf, len, "%016x", mod); + return buf; + } +} + static void dump_planes(struct device *dev) { - unsigned int i, j; + unsigned int i, j, k; + char buf[17]; printf("Planes:\n"); printf("id\tcrtc\tfb\tCRTC x,y\tx,y\tgamma size\tpossible crtcs\n"); @@ -442,8 +463,19 @@ static void dump_planes(struct device *dev) continue; printf(" formats:"); - for (j = 0; j < ovr->count_formats; j++) - printf(" %4.4s", (char *)&ovr->formats[j]); + for (j = 0; j < ovr->count_formats; j++) { + if (ovr->count_format_modifiers == 0) { + printf(" %4.4s", (char *)&ovr->formats[j]); + continue; + } + struct drm_format_modifier *fm; + for (k = 0; k < ovr->count_format_modifiers; k++) { + fm = &ovr->format_modifiers[k]; + if (fm->formats & (1 << j)) + printf(" %4.4s:%s", (char *)&ovr->formats[j], + mod_to_string(fm->modifier, buf, sizeof(buf))); + } + } printf("\n"); if (plane->props) { @@ -609,7 +641,7 @@ static struct resources *get_resources(struct device *dev) if (!res->planes) goto error; - get_resource(res, plane_res, plane, Plane); + get_resource(res, plane_res, plane, Plane2); get_properties(res, plane_res, plane, PLANE); return res;