-
Notifications
You must be signed in to change notification settings - Fork 12
/
gfx.c
64 lines (57 loc) · 1.35 KB
/
gfx.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <libdrm/drm_fourcc.h>
#include "gfx.h"
#include "byteorder.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);
gfxfmt *gfx_fmt_find_pixman(pixman_format_code_t pixman)
{
int i;
for (i = 0; i < fmt_count; i++) {
if (pixman != fmt_list[i].pixman)
continue;
return fmt_list + i;
}
return NULL;
}