linux/drivers/gpu/drm/drm_draw_internal.h
Francesco Valla c2b40b1a4f drm/draw: add drm_draw_can_convert_from_xrgb8888
Add drm_draw_can_convert_from_xrgb8888() function that can be used to
determine if a XRGB8888 color can be converted to the specified format.

Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Signed-off-by: Francesco Valla <francesco@valla.it>
Link: https://patch.msgid.link/20251217-drm_draw_conv_check-v3-1-15b6f8bc1cbc@valla.it
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
2025-12-19 23:06:41 +01:00

58 lines
1.8 KiB
C

/* SPDX-License-Identifier: GPL-2.0 or MIT */
/*
* Copyright (c) 2023 Red Hat.
* Author: Jocelyn Falempe <jfalempe@redhat.com>
*/
#ifndef __DRM_DRAW_INTERNAL_H__
#define __DRM_DRAW_INTERNAL_H__
#include <linux/font.h>
#include <linux/types.h>
struct iosys_map;
/* check if the pixel at coord x,y is 1 (foreground) or 0 (background) */
static inline bool drm_draw_is_pixel_fg(const u8 *sbuf8, unsigned int spitch, int x, int y)
{
return (sbuf8[(y * spitch) + x / 8] & (0x80 >> (x % 8))) != 0;
}
static inline const u8 *drm_draw_get_char_bitmap(const struct font_desc *font,
char c, size_t font_pitch)
{
return font->data + (c * font->height) * font_pitch;
}
bool drm_draw_can_convert_from_xrgb8888(u32 format);
u32 drm_draw_color_from_xrgb8888(u32 color, u32 format);
void drm_draw_blit16(struct iosys_map *dmap, unsigned int dpitch,
const u8 *sbuf8, unsigned int spitch,
unsigned int height, unsigned int width,
unsigned int scale, u16 fg16);
void drm_draw_blit24(struct iosys_map *dmap, unsigned int dpitch,
const u8 *sbuf8, unsigned int spitch,
unsigned int height, unsigned int width,
unsigned int scale, u32 fg32);
void drm_draw_blit32(struct iosys_map *dmap, unsigned int dpitch,
const u8 *sbuf8, unsigned int spitch,
unsigned int height, unsigned int width,
unsigned int scale, u32 fg32);
void drm_draw_fill16(struct iosys_map *dmap, unsigned int dpitch,
unsigned int height, unsigned int width,
u16 color);
void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
unsigned int height, unsigned int width,
u32 color);
void drm_draw_fill32(struct iosys_map *dmap, unsigned int dpitch,
unsigned int height, unsigned int width,
u32 color);
#endif /* __DRM_DRAW_INTERNAL_H__ */