aboutsummaryrefslogtreecommitdiffstats
path: root/drminfo.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-03-01 08:18:07 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-03-01 08:18:27 +0100
commitf5e87d01738b72630996adc102c64455af225950 (patch)
tree11053bd7f81d540adbe40fcc6fedf9c5e37a92d7 /drminfo.c
parentdb5ccee78a02ff0adb0779753c2a986a1107a073 (diff)
downloaddrminfo-f5e87d01738b72630996adc102c64455af225950.tar.gz
autotest tweaks
Diffstat (limited to 'drminfo.c')
-rw-r--r--drminfo.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/drminfo.c b/drminfo.c
index b295b64..e7d6979 100644
--- a/drminfo.c
+++ b/drminfo.c
@@ -307,19 +307,34 @@ static void drm_info_planes(int fd, bool print_modifiers, bool print_properties)
}
}
-static void drm_info_fmts(int fd)
+static void drm_info_fmts(int fd, bool listonly)
{
+ bool first = true;
int i;
drm_plane_init(fd);
- fprintf(stdout, "framebuffer formats\n");
- drm_print_format_hdr(stdout, 4, true);
- for (i = 0; i < fmtcnt; i++) {
- if (!drm_probe_format_fb(fd, &fmts[i]))
- continue;
- drm_print_format(stdout, &fmts[i], 4, true);
+ if (listonly) {
+ for (i = 0; i < fmtcnt; i++) {
+ if (!drm_probe_format_fb(fd, &fmts[i]))
+ continue;
+ if (!drm_probe_format_primary(&fmts[i]))
+ continue;
+ if (!fmts[i].pixman)
+ continue;
+ fprintf(stdout, "%s%s", first ? "" : " ", fmts[i].name);
+ first = false;
+ }
+ fprintf(stdout, "\n");
+ } else {
+ fprintf(stdout, "framebuffer formats\n");
+ drm_print_format_hdr(stdout, 4, true);
+ for (i = 0; i < fmtcnt; i++) {
+ if (!drm_probe_format_fb(fd, &fmts[i]))
+ continue;
+ drm_print_format(stdout, &fmts[i], 4, true);
+ }
+ fprintf(stdout, "\n");
}
- fprintf(stdout, "\n");
}
static int drm_open(int devnr)
@@ -386,6 +401,7 @@ static void usage(FILE *fp)
" -p print supported planes\n"
" -P print supported planes, with modifiers\n"
" -f print supported formats\n"
+ " -F print testable (drmtest) formats\n"
" -r list properties\n"
" -l list all known formats\n"
"\n");
@@ -401,10 +417,11 @@ int main(int argc, char **argv)
bool modifiers = false;
bool properties = false;
bool format = false;
+ bool listonly = false;
char *columns;
for (;;) {
- c = getopt(argc, argv, "hlaAmopPfrc:");
+ c = getopt(argc, argv, "hlaAmopPfFrc:");
if (c == -1)
break;
switch (c) {
@@ -438,6 +455,9 @@ int main(int argc, char **argv)
case 'r':
properties = true;
break;
+ case 'F':
+ /* fall through */
+ listonly = true;
case 'f':
format = true;
break;
@@ -469,6 +489,6 @@ int main(int argc, char **argv)
if (plane)
drm_info_planes(fd, modifiers, properties);
if (format)
- drm_info_fmts(fd);
+ drm_info_fmts(fd, listonly);
return 0;
}