[PATCH 2/2] modetest: Teach modetest about format info
Kristian H. Kristensen
hoegsberg at gmail.com
Wed Dec 21 00:13:33 UTC 2016
From: "Kristian H. Kristensen" <hoegsberg at 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
More information about the dri-devel
mailing list