Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/drivers/gpu/drm/drm_draw_internal.h
26428 views
1
/* SPDX-License-Identifier: GPL-2.0 or MIT */
2
/*
3
* Copyright (c) 2023 Red Hat.
4
* Author: Jocelyn Falempe <[email protected]>
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
13
struct iosys_map;
14
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)
17
{
18
return (sbuf8[(y * spitch) + x / 8] & (0x80 >> (x % 8))) != 0;
19
}
20
21
static 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
27
u32 drm_draw_color_from_xrgb8888(u32 color, u32 format);
28
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);
33
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);
38
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);
43
44
void drm_draw_fill16(struct iosys_map *dmap, unsigned int dpitch,
45
unsigned int height, unsigned int width,
46
u16 color);
47
48
void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
49
unsigned int height, unsigned int width,
50
u16 color);
51
52
void drm_draw_fill32(struct iosys_map *dmap, unsigned int dpitch,
53
unsigned int height, unsigned int width,
54
u32 color);
55
56
#endif /* __DRM_DRAW_INTERNAL_H__ */
57
58