diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2017-04-24 10:34:57 +0200 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2017-04-24 10:34:57 +0200 |
commit | 7e510e53fe4c715d1a3630910136bfded41fbfbd (patch) | |
tree | b4748a55aa4ba7514c185301c8bfc019ff9d499d | |
parent | 34cd7ded2cf9ffe5ce90f1c15b804bf3bf53dcd5 (diff) | |
download | drminfo-7e510e53fe4c715d1a3630910136bfded41fbfbd.tar.gz |
list format tweaks
-rw-r--r-- | drminfo.c | 7 | ||||
-rw-r--r-- | drmtest.c | 2 | ||||
-rw-r--r-- | drmtools.c | 15 | ||||
-rw-r--r-- | drmtools.h | 3 |
4 files changed, 17 insertions, 10 deletions
@@ -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"); } @@ -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); } @@ -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); } @@ -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); |