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/types.h> 11 12 struct iosys_map; 13 14 /* check if the pixel at coord x,y is 1 (foreground) or 0 (background) */ 15 static inline bool drm_draw_is_pixel_fg(const u8 *sbuf8, unsigned int spitch, int x, int y) 16 { 17 return (sbuf8[(y * spitch) + x / 8] & (0x80 >> (x % 8))) != 0; 18 } 19 20 bool drm_draw_can_convert_from_xrgb8888(u32 format); 21 22 u32 drm_draw_color_from_xrgb8888(u32 color, u32 format); 23 24 void drm_draw_blit16(struct iosys_map *dmap, unsigned int dpitch, 25 const u8 *sbuf8, unsigned int spitch, 26 unsigned int height, unsigned int width, 27 unsigned int scale, u16 fg16); 28 29 void drm_draw_blit24(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, u32 fg32); 33 34 void drm_draw_blit32(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_fill16(struct iosys_map *dmap, unsigned int dpitch, 40 unsigned int height, unsigned int width, 41 u16 color); 42 43 void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch, 44 unsigned int height, unsigned int width, 45 u32 color); 46 47 void drm_draw_fill32(struct iosys_map *dmap, unsigned int dpitch, 48 unsigned int height, unsigned int width, 49 u32 color); 50 51 #endif /* __DRM_DRAW_INTERNAL_H__ */ 52