aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-03-28 09:19:49 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-03-28 09:19:49 +0100
commita0c9d2e5b1fbff99ce1281b322a31c718245ceba (patch)
tree67979e8dc6ad05d172201046c914d9b3c761cf9f
parentfca17ca477aad828e62e13622262497a982e7584 (diff)
downloaddrminfo-a0c9d2e5b1fbff99ce1281b322a31c718245ceba.tar.gz
virtiotest fixes
-rw-r--r--drminfo.c8
-rw-r--r--drmtest.c2
-rw-r--r--drmtools.c11
-rw-r--r--drmtools.h5
-rw-r--r--virtiotest.c34
5 files changed, 48 insertions, 12 deletions
diff --git a/drminfo.c b/drminfo.c
index 06de936..fbc97f1 100644
--- a/drminfo.c
+++ b/drminfo.c
@@ -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");
}
diff --git a/drmtest.c b/drmtest.c
index e9262b6..374ae72 100644
--- a/drmtest.c
+++ b/drmtest.c
@@ -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);
}
diff --git a/drmtools.c b/drmtools.c
index 6cb880d..71dca29 100644
--- a/drmtools.c
+++ b/drmtools.c
@@ -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");
}
diff --git a/drmtools.h b/drmtools.h
index f95b4fa..b8f3e0d 100644
--- a/drmtools.h
+++ b/drmtools.h
@@ -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));