aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2017-04-24 10:34:57 +0200
committerGerd Hoffmann <kraxel@redhat.com>2017-04-24 10:34:57 +0200
commit7e510e53fe4c715d1a3630910136bfded41fbfbd (patch)
treeb4748a55aa4ba7514c185301c8bfc019ff9d499d
parent34cd7ded2cf9ffe5ce90f1c15b804bf3bf53dcd5 (diff)
downloaddrminfo-7e510e53fe4c715d1a3630910136bfded41fbfbd.tar.gz
list format tweaks
-rw-r--r--drminfo.c7
-rw-r--r--drmtest.c2
-rw-r--r--drmtools.c15
-rw-r--r--drmtools.h3
4 files changed, 17 insertions, 10 deletions
diff --git a/drminfo.c b/drminfo.c
index 218baf9..c270be7 100644
--- a/drminfo.c
+++ b/drminfo.c
@@ -99,7 +99,7 @@ static void drm_info_fmts(int fd)
for (i = 0; i < fmtcnt; i++) {
if (!drm_probe_format(fd, &fmts[i]))
continue;
- drm_print_format(stdout, &fmts[i]);
+ drm_print_format(stdout, &fmts[i], " ", "");
}
fprintf(stdout, "\n");
}
@@ -164,11 +164,14 @@ static void drm_info(int devnr)
static void list_formats(FILE *fp)
{
+ char libs[64];
int i;
fprintf(stdout, "all known framebuffer formats (rgb + packed yuv)\n");
for (i = 0; i < fmtcnt; i++) {
- drm_print_format(stdout, &fmts[i]);
+ snprintf(libs, sizeof(libs), " %s",
+ (fmts[i].cairo == CAIRO_FORMAT_INVALID) ? "" : "cairo");
+ drm_print_format(stdout, &fmts[i], "", libs);
}
fprintf(stdout, "\n");
}
diff --git a/drmtest.c b/drmtest.c
index 1cf061a..bd0ac5f 100644
--- a/drmtest.c
+++ b/drmtest.c
@@ -516,7 +516,7 @@ int main(int argc, char **argv)
for (i = 0; i < fmtcnt; i++) {
if (fmts[i].cairo == CAIRO_FORMAT_INVALID)
continue;
- drm_print_format(stderr, &fmts[i]);
+ drm_print_format(stderr, &fmts[i], " ", "");
}
exit(1);
}
diff --git a/drmtools.c b/drmtools.c
index d676b63..b09bab8 100644
--- a/drmtools.c
+++ b/drmtools.c
@@ -27,9 +27,9 @@
0 }
#if __BYTE_ORDER == __LITTLE_ENDIAN
-# define LE_BE(_le, _be) (_le)
+# define LE_BE(_le, _be) _le
#elif __BYTE_ORDER == __BIG_ENDIAN
-# define LE_BE(_le, _be) (_be)
+# define LE_BE(_le, _be) _be
#endif
const struct fbformat fmts[] = {
@@ -512,11 +512,14 @@ done:
return result;
}
-void drm_print_format(FILE *fp, const struct fbformat *fmt)
+void drm_print_format(FILE *fp, const struct fbformat *fmt,
+ const char *pre, const char *post)
{
- fprintf(fp, " %-8s: [%2d:0] %-14s %-11s %s\n",
+ fprintf(fp, "%s%-8s: [%2d:0] %-14s %-11s %-24s%s\n",
+ pre,
fmt->name, fmt->bpp - 1, fmt->fields, fmt->bits,
fmt->fourcc
- ? "fourcc (addfb2), little endian"
- : "legacy (addfb), native endian");
+ ? "fourcc (addfb2), le"
+ : "legacy (addfb), cpu " LE_BE("(le)", "(be)"),
+ post);
}
diff --git a/drmtools.h b/drmtools.h
index 900e2cc..ed3073f 100644
--- a/drmtools.h
+++ b/drmtools.h
@@ -18,4 +18,5 @@ const char *drm_connector_mode_name(int nr);
const char *drm_encoder_type_name(int nr);
void drm_conn_name(drmModeConnector *conn, char *dest, int dlen);
bool drm_probe_format(int fd, const struct fbformat *fmt);
-void drm_print_format(FILE *fp, const struct fbformat *fmt);
+void drm_print_format(FILE *fp, const struct fbformat *fmt,
+ const char *pre, const char *post);