aboutsummaryrefslogtreecommitdiffstats
path: root/fbinfo.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-02-25 09:00:49 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-02-25 09:00:49 +0100
commitce94df99dba97a671335d350d6bb617f068097cc (patch)
tree11f0ea5fd2065c3800663d1bcc069fdd2d0ef3f0 /fbinfo.c
parentd33dd8cd0355f60f07649d8c1b2750ddd98649b4 (diff)
downloaddrminfo-ce94df99dba97a671335d350d6bb617f068097cc.tar.gz
fbinfo, pixman mode, misc
Diffstat (limited to 'fbinfo.c')
-rw-r--r--fbinfo.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/fbinfo.c b/fbinfo.c
new file mode 100644
index 0000000..a2b4fb3
--- /dev/null
+++ b/fbinfo.c
@@ -0,0 +1,65 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <inttypes.h>
+#include <getopt.h>
+
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+
+#include <cairo.h>
+
+#include "fbtools.h"
+
+/* ------------------------------------------------------------------ */
+
+static void usage(FILE *fp)
+{
+ fprintf(fp,
+ "\n"
+ "usage: fbtest [ options ]\n"
+ "\n"
+ "options:\n"
+ " -h print this\n"
+ " -f <nr> pick framebuffer\n"
+ "\n");
+}
+
+int main(int argc, char **argv)
+{
+ int framebuffer = 0;
+ int c;
+
+ for (;;) {
+ c = getopt(argc, argv, "hf:");
+ if (c == -1)
+ break;
+ switch (c) {
+ case 'f':
+ framebuffer = atoi(optarg);
+ break;
+ case 'h':
+ usage(stdout);
+ exit(0);
+ default:
+ usage(stderr);
+ exit(1);
+ }
+ }
+
+ fb_query(framebuffer);
+
+ fprintf(stderr, "fb%d: %s, %dx%d, %d bpp, r/g/b/a %d/%d/%d/%d\n",
+ framebuffer,
+ fb_fix.id,
+ fb_var.xres, fb_var.yres,
+ fb_var.bits_per_pixel,
+ fb_var.red.length,
+ fb_var.green.length,
+ fb_var.blue.length,
+ fb_var.transp.length);
+ return 0;
+}