File Index
Files and directories
Sign in
FILE

drm_draw_internal.h

File preview with syntax highlighting.

linux-6.19.14/drivers/gpu/drm/drm_draw_internal.h C
 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
27u32 drm_draw_color_from_xrgb8888(u32 color, u32 format);
28
29void 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
34void 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
39void 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
44void drm_draw_fill16(struct iosys_map *dmap, unsigned int dpitch,
45		     unsigned int height, unsigned int width,
46		     u16 color);
47
48void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
49		     unsigned int height, unsigned int width,
50		     u32 color);
51
52void 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__ */
~/ Read-only file preview.