*/
#include "qemu/osdep.h"
-#include "qemu-common.h"
#include "ui/console.h"
#include "standard-headers/drm/drm_fourcc.h"
+#include "trace.h"
PixelFormat qemu_pixelformat_from_pixman(pixman_format_code_t format)
{
pf.rshift = 0;
break;
case PIXMAN_TYPE_BGRA:
- pf.bshift = bpp - pf.bbits;
+ pf.bshift = bpp - pf.bbits;
pf.gshift = bpp - (pf.bbits + pf.gbits);
pf.rshift = bpp - (pf.bbits + pf.gbits + pf.rbits);
pf.ashift = 0;
}
/* Note: drm is little endian, pixman is native endian */
+static const struct {
+ uint32_t drm_format;
+ pixman_format_code_t pixman_format;
+} drm_format_pixman_map[] = {
+ { DRM_FORMAT_RGB888, PIXMAN_LE_r8g8b8 },
+ { DRM_FORMAT_ARGB8888, PIXMAN_LE_a8r8g8b8 },
+ { DRM_FORMAT_XRGB8888, PIXMAN_LE_x8r8g8b8 },
+ { DRM_FORMAT_XBGR8888, PIXMAN_LE_x8b8g8r8 },
+ { DRM_FORMAT_ABGR8888, PIXMAN_LE_a8b8g8r8 },
+};
+
pixman_format_code_t qemu_drm_format_to_pixman(uint32_t drm_format)
{
- static const struct {
- uint32_t drm_format;
- pixman_format_code_t pixman;
- } map[] = {
- { DRM_FORMAT_RGB888, PIXMAN_LE_r8g8b8 },
- { DRM_FORMAT_ARGB8888, PIXMAN_LE_a8r8g8b8 },
- { DRM_FORMAT_XRGB8888, PIXMAN_LE_x8r8g8b8 }
- };
int i;
- for (i = 0; i < ARRAY_SIZE(map); i++) {
- if (drm_format == map[i].drm_format) {
- return map[i].pixman;
+ for (i = 0; i < ARRAY_SIZE(drm_format_pixman_map); i++) {
+ if (drm_format == drm_format_pixman_map[i].drm_format) {
+ return drm_format_pixman_map[i].pixman_format;
+ }
+ }
+ return 0;
+}
+
+uint32_t qemu_pixman_to_drm_format(pixman_format_code_t pixman_format)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(drm_format_pixman_map); i++) {
+ if (pixman_format == drm_format_pixman_map[i].pixman_format) {
+ return drm_format_pixman_map[i].drm_format;
}
}
return 0;
return type;
}
+#ifdef CONFIG_PIXMAN
pixman_format_code_t qemu_pixman_get_format(PixelFormat *pf)
{
pixman_format_code_t format;
}
return format;
}
+#endif
/*
* Return true for known-good pixman conversions.
}
}
+#ifdef CONFIG_PIXMAN
pixman_image_t *qemu_pixman_linebuf_create(pixman_format_code_t format,
int width)
{
x, y, 0, 0, 0, 0, width, 1);
}
-/* copy linebuf to framebuffer */
-void qemu_pixman_linebuf_copy(pixman_image_t *fb, int width, int x, int y,
- pixman_image_t *linebuf)
-{
- pixman_image_composite(PIXMAN_OP_SRC, linebuf, NULL, fb,
- 0, 0, 0, 0, x, y, width, 1);
-}
-
pixman_image_t *qemu_pixman_mirror_create(pixman_format_code_t format,
pixman_image_t *image)
{
NULL,
pixman_image_get_stride(image));
}
+#endif
void qemu_pixman_image_unref(pixman_image_t *image)
{
pixman_image_unref(image);
}
-pixman_color_t qemu_pixman_color(PixelFormat *pf, uint32_t color)
-{
- pixman_color_t c;
-
- c.red = ((color & pf->rmask) >> pf->rshift) << (16 - pf->rbits);
- c.green = ((color & pf->gmask) >> pf->gshift) << (16 - pf->gbits);
- c.blue = ((color & pf->bmask) >> pf->bshift) << (16 - pf->bbits);
- c.alpha = ((color & pf->amask) >> pf->ashift) << (16 - pf->abits);
- return c;
-}
-
+#ifdef CONFIG_PIXMAN
pixman_image_t *qemu_pixman_glyph_from_vgafont(int height, const uint8_t *font,
unsigned int ch)
{
pixman_image_unref(ifg);
pixman_image_unref(ibg);
}
+#endif /* CONFIG_PIXMAN */