diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-03-28 09:19:49 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-03-28 09:19:49 +0100 |
commit | a0c9d2e5b1fbff99ce1281b322a31c718245ceba (patch) | |
tree | 67979e8dc6ad05d172201046c914d9b3c761cf9f | |
parent | fca17ca477aad828e62e13622262497a982e7584 (diff) | |
download | drminfo-a0c9d2e5b1fbff99ce1281b322a31c718245ceba.tar.gz |
virtiotest fixes
-rw-r--r-- | drminfo.c | 8 | ||||
-rw-r--r-- | drmtest.c | 2 | ||||
-rw-r--r-- | drmtools.c | 11 | ||||
-rw-r--r-- | drmtools.h | 5 | ||||
-rw-r--r-- | virtiotest.c | 34 |
5 files changed, 48 insertions, 12 deletions
@@ -327,11 +327,11 @@ static void drm_info_fmts(int fd, bool listonly) fprintf(stdout, "\n"); } else { fprintf(stdout, "framebuffer formats\n"); - drm_print_format_hdr(stdout, 4, true); + drm_print_format_hdr(stdout, 4, true, false); for (i = 0; i < fmtcnt; i++) { if (!drm_probe_format_fb(fd, &fmts[i])) continue; - drm_print_format(stdout, &fmts[i], 4, true); + drm_print_format(stdout, &fmts[i], 4, true, false); } fprintf(stdout, "\n"); } @@ -376,9 +376,9 @@ static void list_formats(FILE *fp) int i; fprintf(stdout, "all known framebuffer formats (rgb + packed yuv)\n"); - drm_print_format_hdr(stdout, 0, true); + drm_print_format_hdr(stdout, 0, true, false); for (i = 0; i < fmtcnt; i++) { - drm_print_format(stdout, &fmts[i], 0, true); + drm_print_format(stdout, &fmts[i], 0, true, false); } fprintf(stdout, "\n"); } @@ -259,7 +259,7 @@ int main(int argc, char **argv) if (fmts[i].cairo == CAIRO_FORMAT_INVALID) continue; } - drm_print_format(stderr, &fmts[i], 4, false); + drm_print_format(stderr, &fmts[i], 4, false, false); } exit(1); } @@ -658,7 +658,7 @@ done: } void drm_print_format(FILE *fp, const struct fbformat *fmt, - int indent, bool libs) + int indent, bool libs, bool virtio) { fprintf(fp, "%*s%-8s: [%2d:0] %-14s %-11s %c %c %c %-16s", indent, "", @@ -674,10 +674,14 @@ void drm_print_format(FILE *fp, const struct fbformat *fmt, fmt->pixman ? "pixman" : "", (fmt->cairo != CAIRO_FORMAT_INVALID) ? "cairo" : ""); } + if (virtio) { + if (fmt->virtio) + fprintf(fp, " %-6d", fmt->virtio); + } fprintf(fp, "\n"); } -void drm_print_format_hdr(FILE *fp, int indent, bool libs) +void drm_print_format_hdr(FILE *fp, int indent, bool libs, bool virtio) { fprintf(fp, "%*s%-8s: %-6s %-14s %-11s %-6s %-16s", indent, "", @@ -686,6 +690,9 @@ void drm_print_format_hdr(FILE *fp, int indent, bool libs) if (libs) { fprintf(fp, " lib support"); } + if (virtio) { + fprintf(fp, " virtio"); + } fprintf(fp, "\n"); } @@ -28,8 +28,9 @@ void drm_plane_init(int fd); bool drm_probe_format_fb(int fd, const struct fbformat *fmt); void drm_print_format(FILE *fp, const struct fbformat *fmt, - int indent, bool libs); -void drm_print_format_hdr(FILE *fp, int indent, bool libs); + int indent, bool libs, bool virtio); +void drm_print_format_hdr(FILE *fp, int indent, + bool libs, bool virtio); /* ------------------------------------------------------------------ */ diff --git a/virtiotest.c b/virtiotest.c index 90e2134..635fcbc 100644 --- a/virtiotest.c +++ b/virtiotest.c @@ -77,6 +77,18 @@ static void virtio_print_caps(void) } } +static void virtio_list_format(void) +{ + int i; + + drm_print_format_hdr(stdout, 0, false, true); + for (i = 0; i < fmtcnt; i++) { + if (!fmts[i].virtio) + continue; + drm_print_format(stdout, fmts + i, 0, false, true); + } +} + static void virtio_check(int cardno) { char syspath[128]; @@ -219,6 +231,7 @@ static void usage(FILE *fp) " -h print this\n" " -c <nr> pick card\n" " -i print device info\n" + " -l list formats\n" "\n"); } @@ -229,11 +242,13 @@ int main(int argc, char **argv) char *output = NULL; char *modename = NULL; bool printinfo = false; + bool listformat = false; + bool autotest = false; char buf[32]; int c, i; for (;;) { - c = getopt(argc, argv, "hic:s:"); + c = getopt(argc, argv, "hailc:s:"); if (c == -1) break; switch (c) { @@ -243,9 +258,15 @@ int main(int argc, char **argv) case 's': secs = atoi(optarg); break; + case 'a': + autotest = true; + break; case 'i': printinfo = true; break; + case 'l': + listformat = true; + break; case 'h': usage(stdout); exit(0); @@ -258,12 +279,12 @@ int main(int argc, char **argv) virtio_check(card); for (i = 0; i < fmtcnt; i++) { - if (fmts[i].cairo == CAIRO_FORMAT_RGB24) { + if (fmts[i].cairo == CAIRO_FORMAT_RGB24 && + fmts[i].virtio != 0) { fmt = &fmts[i]; } } assert(fmt != NULL); - assert(fmt->virtio != 0); drm_init_dev(card, output, modename, false); @@ -272,11 +293,18 @@ int main(int argc, char **argv) goto done; } + if (listformat) { + virtio_list_format(); + goto done; + } + virtio_init_fb(); virtio_draw(); virtio_transfer(); drm_show_fb(); + if (autotest) + fprintf(stdout, "---ok---\n"); tty_raw(); kbd_wait(secs); read(0, buf, sizeof(buf)); |