2 #include <drm_fourcc.h>
6 #include "pixel_format.h"
12 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
20 static const struct ds_tbm_format formats[] =
23 .drm_format = DRM_FORMAT_ARGB8888,
24 .tbm_format = TBM_FORMAT_ARGB8888,
27 .drm_format = DRM_FORMAT_XRGB8888,
28 .tbm_format = TBM_FORMAT_XRGB8888,
30 /* TODO more format */
34 convert_drm_format_to_tbm(uint32_t fmt)
38 for (i = 0; i < ARRAY_LENGTH(formats); i++) {
39 if (formats[i].drm_format == fmt)
40 return formats[i].tbm_format;
43 ds_err("DRM format 0x%"PRIX32" has no TBM equivalent", fmt);
49 convert_tbm_format_to_drm(uint32_t fmt)
53 for (i = 0; i < ARRAY_LENGTH(formats); i++) {
54 if (formats[i].tbm_format == fmt)
55 return formats[i].drm_format;
58 ds_err("TBM format 0x%"PRIX32" has no DRM equivalent", fmt);