2 #include <drm_fourcc.h>
5 #include <wayland-util.h>
7 #include "pixel_format.h"
13 #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
21 static const struct ds_tbm_format formats[] =
24 .drm_format = DRM_FORMAT_ARGB8888,
25 .tbm_format = TBM_FORMAT_ARGB8888,
28 .drm_format = DRM_FORMAT_XRGB8888,
29 .tbm_format = TBM_FORMAT_XRGB8888,
31 /* TODO more format */
35 convert_drm_format_to_tbm(uint32_t fmt)
39 for (i = 0; i < ARRAY_LENGTH(formats); i++) {
40 if (formats[i].drm_format == fmt)
41 return formats[i].tbm_format;
44 ds_err("DRM format 0x%"PRIX32" has no TBM equivalent", fmt);
50 convert_tbm_format_to_drm(uint32_t fmt)
54 for (i = 0; i < ARRAY_LENGTH(formats); i++) {
55 if (formats[i].tbm_format == fmt)
56 return formats[i].drm_format;
59 ds_err("TBM format 0x%"PRIX32" has no DRM equivalent", fmt);
65 ds_tizen_pixel_format_convert_tbm_to_drm(uint32_t tbm_format)
67 return convert_tbm_format_to_drm(tbm_format);