All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kristian H. Kristensen" <hoegsberg@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: ben@bwidawsk.net, "Kristian H. Kristensen" <hoegsberg@chromium.org>
Subject: [PATCH 2/2] modetest: Teach modetest about format info
Date: Tue, 20 Dec 2016 16:13:33 -0800	[thread overview]
Message-ID: <20161221001333.21941-2-hoegsberg@gmail.com> (raw)
In-Reply-To: <20161221001333.21941-1-hoegsberg@gmail.com>

From: "Kristian H. Kristensen" <hoegsberg@chromium.org>

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;
-- 
2.9.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-12-21  0:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-21  0:13 [PATCH 1/2] Add DRM_IOCTL_MODE_GETPLANE2 ioctl wrapper Kristian H. Kristensen
2016-12-21  0:13 ` Kristian H. Kristensen [this message]
2016-12-26 16:24   ` [PATCH 2/2] modetest: Teach modetest about format info Ben Widawsky
2016-12-26 16:21 ` [PATCH 1/2] Add DRM_IOCTL_MODE_GETPLANE2 ioctl wrapper Ben Widawsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161221001333.21941-2-hoegsberg@gmail.com \
    --to=hoegsberg@gmail.com \
    --cc=ben@bwidawsk.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hoegsberg@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.