1 /* SPDX-License-Identifier: GPL-2.0 or MIT */
3 * Copyright (c) 2023 Red Hat.
7 #ifndef __DRM_DRAW_INTERNAL_H__
8 #define __DRM_DRAW_INTERNAL_H__
10 #include <linux/font.h>
11 #include <linux/types.h>
15 /* check if the pixel at coord x,y is 1 (foreground) or 0 (background) */
16 static inline bool drm_draw_is_pixel_fg(const u8 *sbuf8, unsigned int spitch, int x, int y)
18 return (sbuf8[(y * spitch) + x / 8] & (0x80 >> (x % 8))) != 0;
21 static inline const u8 *drm_draw_get_char_bitmap(const struct font_desc *font,
22 char c, size_t font_pitch)
24 return font->data + (c * font->height) * font_pitch;
27 u32 drm_draw_color_from_xrgb8888(u32 color, u32 format);
29 void drm_draw_blit16(struct iosys_map *dmap, unsigned int dpitch,
30 const u8 *sbuf8, unsigned int spitch,
31 unsigned int height, unsigned int width,
32 unsigned int scale, u16 fg16);
34 void drm_draw_blit24(struct iosys_map *dmap, unsigned int dpitch,
35 const u8 *sbuf8, unsigned int spitch,
36 unsigned int height, unsigned int width,
37 unsigned int scale, u32 fg32);
39 void drm_draw_blit32(struct iosys_map *dmap, unsigned int dpitch,
40 const u8 *sbuf8, unsigned int spitch,
41 unsigned int height, unsigned int width,
42 unsigned int scale, u32 fg32);
44 void drm_draw_fill16(struct iosys_map *dmap, unsigned int dpitch,
45 unsigned int height, unsigned int width,
48 void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
49 unsigned int height, unsigned int width,
52 void drm_draw_fill32(struct iosys_map *dmap, unsigned int dpitch,
53 unsigned int height, unsigned int width,
56 #endif /* __DRM_DRAW_INTERNAL_H__ */