From patchwork Sun Nov 19 09:49:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wladimir J. van der Laan" X-Patchwork-Id: 10065105 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 E7D0D602B8 for ; Sun, 19 Nov 2017 09:49:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD99429346 for ; Sun, 19 Nov 2017 09:49:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1B1B29352; Sun, 19 Nov 2017 09:49:46 +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 8706429346 for ; Sun, 19 Nov 2017 09:49:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8AD136E534; Sun, 19 Nov 2017 09:49:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5696D6E520 for ; Sun, 19 Nov 2017 09:49:42 +0000 (UTC) Received: by mail-wm0-x241.google.com with SMTP id v186so13365534wma.2 for ; Sun, 19 Nov 2017 01:49: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=aRUF26aJ8OsRVfRn9QqDN3O+fVGDZ4whqoO8HJ64rvo=; b=BCAYTz1GsUtytzmQxnN5gpj7R1EaEGIB007cKjMXU7RRZaN7HhADWOlUYeVDrae0EQ JSgfx5DIZ1pF6KVCIEagyUjWz2jT2sJQvCO8b2X4uaMygLN7bBQ4EoPXMOVNXUhzAxqE /JelxLGXc9c8mnP+zCyJj7+9YjZU+RoT/pVQ11nhIOJv+n4GokorXBC4LeEokpTfy0RL jh0xWjOwQyljWhO8IOLm6jM9ZJGQya2CNHqbrhtyi8T3kmL8jioaDybKwgC8aWME0shM FjHIv98iPgOlk7ZfE1giV035p1lCslEMQwnnR9jiBhM0e8vHECEgq8m4eNRLPGOzdhkB hAOA== 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=aRUF26aJ8OsRVfRn9QqDN3O+fVGDZ4whqoO8HJ64rvo=; b=NdwnHTXTuHvFmvMyetPmII98KJjTHKejboRU/KhVAJCh3jQogNWPqOChzYF99mGzD0 7TNBWtVQjWF7k0ZPGIw6n5ny9jaIeFpGQ/IiP+q5Ftcalk54NQfHCORUTUSgRgCZOuJD jpQ/YVwFEKOv0CqfgBBcVT624azF7Oq8rPrPhiVwzKfDj+hNh7wZgFuzxBws1NPeSMMJ /gFhU+hTkdffFpq1BHXROEU/cvpPEzMdkEQiTi/Cif9k36nnFl6uHHvkXAOggCYHnnR/ SOHZ+MJypqTjtIdrJ/dBbqTmrQdeOOJ5KGEGGdiIM3ixApTcBUxxmojNzfz4L5WSZZDs EOkg== X-Gm-Message-State: AJaThX52HxXET/G0yP+bmgt3lQAVVyZwcUuaS61bHg9x78vR4Au1HD8Y i80ULAnqpZQPxJPyij++ez0RIZQTgFs= X-Google-Smtp-Source: AGs4zMYcyycTIpEO3rZPCKe/c7s6JIPHTRnjDsZmIdtG0ctN14AZUEhS0ZOGlKDKFsOl5mZ2gsG1Bw== X-Received: by 10.80.155.84 with SMTP id a20mr14985472edj.21.1511084980794; Sun, 19 Nov 2017 01:49:40 -0800 (PST) Received: from amethyst.lan (92-110-144-95.cable.dynamic.v4.ziggo.nl. [92.110.144.95]) by smtp.gmail.com with ESMTPSA id 33sm98327edt.57.2017.11.19.01.49.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Nov 2017 01:49:40 -0800 (PST) From: "Wladimir J. van der Laan" To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm 2/2] tests/modeprint: Print details for IN_FORMATS blob Date: Sun, 19 Nov 2017 10:49:31 +0100 Message-Id: <1511084971-7638-3-git-send-email-laanwj@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511084971-7638-1-git-send-email-laanwj@gmail.com> References: <1511084971-7638-1-git-send-email-laanwj@gmail.com> Cc: Alex Deucher , "Wladimir J. van der Laan" , Emil Velikov 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 Pretty-print formats and modifiers in IN_FORMATS blob. Signed-off-by: Wladimir J. van der Laan --- tests/modeprint/modeprint.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/modeprint/modeprint.c b/tests/modeprint/modeprint.c index 42c0a1b..ce84279 100644 --- a/tests/modeprint/modeprint.c +++ b/tests/modeprint/modeprint.c @@ -93,6 +93,28 @@ static int printMode(struct drm_mode_modeinfo *mode) return 0; } +static int printBlob(const char *name, void *data, uint32_t length) +{ + if (!strcmp(name, "IN_FORMATS")) { + struct drm_format_modifier_blob *m = data; + uint32_t *fmts = (uint32_t *)(((char *)data) + m->formats_offset); + struct drm_format_modifier *mod = (struct drm_format_modifier *)(((char *)data) + m->modifiers_offset); + int i,j,k; + printf("\tmodifiers :\n"); + for (j = 0; j < (int)m->count_modifiers; j++) { + printf("\t\t0x%016" PRIx64, mod[j].modifier); + for (i = 0; i < 64 && (i + mod[j].offset) < (int)m->count_formats; i++) { + if (mod[j].formats & (1<> 24, fmts[k] >> 16, fmts[k] >> 8, fmts[k] >> 0); + } + } + printf("\n"); + } + } + return 0; +} + static int printProperty(int fd, drmModePropertyPtr props, uint64_t value) { const char *name = NULL; @@ -120,6 +142,7 @@ static int printProperty(int fd, drmModePropertyPtr props, uint64_t value) blob = drmModeGetPropertyBlob(fd, value); if (blob) { printf("blob is %d length, %08X\n", blob->length, *(uint32_t *)blob->data); + printBlob(props->name, blob->data, blob->length); drmModeFreePropertyBlob(blob); } else { printf("error getting blob %" PRIu64 "\n", value);