From patchwork Wed Jan 24 12:50:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 10182469 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 44623602B7 for ; Wed, 24 Jan 2018 12:55:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36C22288BB for ; Wed, 24 Jan 2018 12:55:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B235288D2; Wed, 24 Jan 2018 12:55:10 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 A8B61288BB for ; Wed, 24 Jan 2018 12:55:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 03DE56E5D3; Wed, 24 Jan 2018 12:55:09 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 308FC6E5D3; Wed, 24 Jan 2018 12:55:08 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2018 04:55:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,407,1511856000"; d="scan'208";a="198408643" Received: from ankit-desktop.iind.intel.com ([10.223.161.14]) by fmsmga006.fm.intel.com with ESMTP; 24 Jan 2018 04:55:05 -0800 From: "Nautiyal, Ankit K" To: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Date: Wed, 24 Jan 2018 18:20:59 +0530 Message-Id: <1516798260-11685-2-git-send-email-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516798260-11685-1-git-send-email-ankit.k.nautiyal@intel.com> References: <1516798260-11685-1-git-send-email-ankit.k.nautiyal@intel.com> Subject: [Intel-gfx] [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms.c: modify kmstest_dump_mode to print aspect ratio of a mode X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ankit Nautiyal MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Ankit Nautiyal This patch adds the support to print the aspect ratio of the modes (if provided) along with other mode information. Signed-off-by: Ankit Nautiyal Acked-by: Mika Kahola --- lib/igt_kms.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index eb57f4a..585f94d 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -56,6 +56,14 @@ #include "igt_sysfs.h" #include "sw_sync.h" +#ifndef DRM_MODE_FLAG_PIC_AR_64_27 +#define DRM_MODE_FLAG_PIC_AR_64_27 (3<<19) +#endif + +#ifndef DRM_MODE_FLAG_PIC_AR_256_135 +#define DRM_MODE_FLAG_PIC_AR_256_135 (4<<19) +#endif + /** * SECTION:igt_kms * @short_description: Kernel modesetting support library @@ -491,6 +499,22 @@ static const char *mode_stereo_name(const drmModeModeInfo *mode) } } +static const char *mode_aspect_name(const drmModeModeInfo *mode) +{ + switch (mode->flags & DRM_MODE_FLAG_PIC_AR_MASK) { + case DRM_MODE_FLAG_PIC_AR_4_3: + return "4:3"; + case DRM_MODE_FLAG_PIC_AR_16_9: + return "16:9"; + case DRM_MODE_FLAG_PIC_AR_64_27: + return "64:27"; + case DRM_MODE_FLAG_PIC_AR_256_135: + return "256:135"; + default: + return NULL; + } +} + /** * kmstest_dump_mode: * @mode: libdrm mode structure @@ -500,8 +524,9 @@ static const char *mode_stereo_name(const drmModeModeInfo *mode) void kmstest_dump_mode(drmModeModeInfo *mode) { const char *stereo = mode_stereo_name(mode); + const char *aspect_ratio = mode_aspect_name(mode); - igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s\n", + igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s %s%s%s\n", mode->name, mode->vrefresh, mode->hdisplay, mode->hsync_start, mode->hsync_end, mode->htotal, @@ -509,7 +534,9 @@ void kmstest_dump_mode(drmModeModeInfo *mode) mode->vsync_end, mode->vtotal, mode->flags, mode->type, mode->clock, stereo ? " (3D:" : "", - stereo ? stereo : "", stereo ? ")" : ""); + stereo ? stereo : "", stereo ? ")" : "", + aspect_ratio ? " (Pixel Aspect Ratio:" : "", + aspect_ratio ? aspect_ratio : "", aspect_ratio ? ")" : ""); } /**