aboutsummaryrefslogtreecommitdiffstats
path: root/drminfo.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2017-04-23 20:14:07 +0200
committerGerd Hoffmann <kraxel@redhat.com>2017-04-23 20:14:07 +0200
commit23e311b6f0f881f4030b075b02558a836b08230e (patch)
tree818edc666cf77bfbd9af18c46da62af856df4dbe /drminfo.c
parentb50a220f5ffe90b0b2cff3c3ec3002e9f942cff4 (diff)
downloaddrminfo-23e311b6f0f881f4030b075b02558a836b08230e.tar.gz
revamp formats
Diffstat (limited to 'drminfo.c')
-rw-r--r--drminfo.c64
1 files changed, 22 insertions, 42 deletions
diff --git a/drminfo.c b/drminfo.c
index 2020ddb..e0ee008 100644
--- a/drminfo.c
+++ b/drminfo.c
@@ -14,6 +14,8 @@
#include <xf86drm.h>
#include <xf86drmMode.h>
+#include <cairo.h>
+
#include "drmtools.h"
/* ------------------------------------------------------------------ */
@@ -102,49 +104,23 @@ static void drm_info(int devnr)
fprintf(stdout, "\n");
}
- fprintf(stdout, "legacy formats\n");
- drm_probe_format(fd, 32, 24, 0, true);
- drm_probe_format(fd, 32, 30, 0, true);
- drm_probe_format(fd, 24, 24, 0, true);
- drm_probe_format(fd, 16, 16, 0, true);
- drm_probe_format(fd, 16, 15, 0, true);
+ fprintf(stdout, "framebuffer formats\n");
+ for (i = 0; i < fmtcnt; i++) {
+ if (!drm_probe_format(fd, &fmts[i]))
+ continue;
+ drm_print_format(stdout, &fmts[i]);
+ }
fprintf(stdout, "\n");
+}
- fprintf(stdout, "fourcc formats\n");
- drm_probe_format(fd, 32, 0, DRM_FORMAT_XRGB8888, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_XBGR8888, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_RGBX8888, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_BGRX8888, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_ARGB8888, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_ABGR8888, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_RGBA8888, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_BGRA8888, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_XRGB2101010, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_XBGR2101010, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_RGBX1010102, true);
- drm_probe_format(fd, 32, 0, DRM_FORMAT_BGRX1010102, true);
-
- drm_probe_format(fd, 24, 0, DRM_FORMAT_RGB888, true);
- drm_probe_format(fd, 24, 0, DRM_FORMAT_BGR888, true);
-
- drm_probe_format(fd, 16, 0, DRM_FORMAT_XRGB4444, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_XBGR4444, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_RGBX4444, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_BGRX4444, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_ARGB4444, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_ABGR4444, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_RGBA4444, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_BGRA4444, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_XRGB1555, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_XBGR1555, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_RGBX5551, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_BGRX5551, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_ARGB1555, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_ABGR1555, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_RGBA5551, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_BGRA5551, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_RGB565, true);
- drm_probe_format(fd, 16, 0, DRM_FORMAT_BGR565, true);
+static void list_formats(FILE *fp)
+{
+ int i;
+
+ fprintf(stdout, "all known framebuffer formats (rgb + packed yuv)\n");
+ for (i = 0; i < fmtcnt; i++) {
+ drm_print_format(stdout, &fmts[i]);
+ }
fprintf(stdout, "\n");
}
@@ -159,6 +135,7 @@ static void usage(FILE *fp)
"options:\n"
" -h print this\n"
" -c <nr> pick card\n"
+ " -l print all known formats\n"
"\n");
}
@@ -168,13 +145,16 @@ int main(int argc, char **argv)
int c;
for (;;) {
- c = getopt(argc, argv, "hc:");
+ c = getopt(argc, argv, "hlc:");
if (c == -1)
break;
switch (c) {
case 'c':
card = atoi(optarg);
break;
+ case 'l':
+ list_formats(stdout);
+ exit(0);
case 'h':
usage(stdout);
exit(0);