Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 or MIT */
2/*
3 * Copyright (c) 2023 Red Hat.
4 * Author: Jocelyn Falempe <jfalempe@redhat.com>
5 */
6
7#ifndef __DRM_DRAW_INTERNAL_H__
8#define __DRM_DRAW_INTERNAL_H__
9
10#include <linux/font.h>
11#include <linux/types.h>
12
13struct iosys_map;
14
15/* check if the pixel at coord x,y is 1 (foreground) or 0 (background) */
16static inline bool drm_draw_is_pixel_fg(const u8 *sbuf8, unsigned int spitch, int x, int y)
17{
18 return (sbuf8[(y * spitch) + x / 8] & (0x80 >> (x % 8))) != 0;
19}
20
21static inline const u8 *drm_draw_get_char_bitmap(const struct font_desc *font,
22 char c, size_t font_pitch)
23{
24 return font->data + (c * font->height) * font_pitch;
25}
26
27bool drm_draw_can_convert_from_xrgb8888(u32 format);
28
29u32 drm_draw_color_from_xrgb8888(u32 color, u32 format);
30
31void drm_draw_blit16(struct iosys_map *dmap, unsigned int dpitch,
32 const u8 *sbuf8, unsigned int spitch,
33 unsigned int height, unsigned int width,
34 unsigned int scale, u16 fg16);
35
36void drm_draw_blit24(struct iosys_map *dmap, unsigned int dpitch,
37 const u8 *sbuf8, unsigned int spitch,
38 unsigned int height, unsigned int width,
39 unsigned int scale, u32 fg32);
40
41void drm_draw_blit32(struct iosys_map *dmap, unsigned int dpitch,
42 const u8 *sbuf8, unsigned int spitch,
43 unsigned int height, unsigned int width,
44 unsigned int scale, u32 fg32);
45
46void drm_draw_fill16(struct iosys_map *dmap, unsigned int dpitch,
47 unsigned int height, unsigned int width,
48 u16 color);
49
50void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
51 unsigned int height, unsigned int width,
52 u32 color);
53
54void drm_draw_fill32(struct iosys_map *dmap, unsigned int dpitch,
55 unsigned int height, unsigned int width,
56 u32 color);
57
58#endif /* __DRM_DRAW_INTERNAL_H__ */