From c2f9a4886c3597a6e15a67323313555bc9752a58 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Sun, 3 Feb 2019 13:31:59 +0100 Subject: format fixups --- gfx.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ gfx.h | 4 ++-- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 gfx.c diff --git a/gfx.c b/gfx.c new file mode 100644 index 0000000..dee4eae --- /dev/null +++ b/gfx.c @@ -0,0 +1,51 @@ +#include +#include +#include + +#include + +#include "gfx.h" + +gfxfmt fmt_list[] = { + { +#if __BYTE_ORDER == __LITTLE_ENDIAN + .fourcc = DRM_FORMAT_XRGB8888, +#else + .fourcc = DRM_FORMAT_BGRX8888, +#endif + .cairo = CAIRO_FORMAT_RGB24, + .pixman = PIXMAN_x8r8g8b8, + .depth = 24, + .bpp = 32, + }, + { +#if __BYTE_ORDER == __LITTLE_ENDIAN + .fourcc = DRM_FORMAT_ARGB8888, +#else + .fourcc = DRM_FORMAT_BGRA8888, +#endif + .cairo = CAIRO_FORMAT_ARGB32, + .pixman = PIXMAN_a8r8g8b8, + .depth = 24, + .bpp = 32, + }, +#if __BYTE_ORDER == __LITTLE_ENDIAN + { + .fourcc = DRM_FORMAT_RGB565, + .cairo = CAIRO_FORMAT_RGB16_565, + .pixman = PIXMAN_r5g6b5, + .depth = 16, + .bpp = 16, + + }, + { + .fourcc = DRM_FORMAT_XRGB2101010, + .cairo = CAIRO_FORMAT_RGB30, + .pixman = PIXMAN_x2r10g10b10, + .depth = 30, + .bpp = 32, + }, +#endif +}; + +uint32_t fmt_count = ARRAY_SIZE(fmt_list); diff --git a/gfx.h b/gfx.h index 840d0df..3b1885c 100644 --- a/gfx.h +++ b/gfx.h @@ -21,8 +21,8 @@ struct gfxfmt { uint32_t fourcc; /* little endian (drm) */ cairo_format_t cairo; /* native endian */ pixman_format_code_t pixman; /* native endian */ - uint32_t bits_pp; - uint32_t bytes_pp; + uint32_t depth; + uint32_t bpp; }; extern gfxfmt fmt_list[]; -- cgit