drm_draw_internal.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. #ifndef __DRM_DRAW_INTERNAL_H__
  7. #define __DRM_DRAW_INTERNAL_H__
  8. #include <linux/font.h>
  9. #include <linux/types.h>
  10. struct iosys_map;
  11. /* check if the pixel at coord x,y is 1 (foreground) or 0 (background) */
  12. static inline bool drm_draw_is_pixel_fg(const u8 *sbuf8, unsigned int spitch, int x, int y)
  13. {
  14. return (sbuf8[(y * spitch) + x / 8] & (0x80 >> (x % 8))) != 0;
  15. }
  16. static inline const u8 *drm_draw_get_char_bitmap(const struct font_desc *font,
  17. char c, size_t font_pitch)
  18. {
  19. return font->data + (c * font->height) * font_pitch;
  20. }
  21. u32 drm_draw_color_from_xrgb8888(u32 color, u32 format);
  22. void drm_draw_blit16(struct iosys_map *dmap, unsigned int dpitch,
  23. const u8 *sbuf8, unsigned int spitch,
  24. unsigned int height, unsigned int width,
  25. unsigned int scale, u16 fg16);
  26. void drm_draw_blit24(struct iosys_map *dmap, unsigned int dpitch,
  27. const u8 *sbuf8, unsigned int spitch,
  28. unsigned int height, unsigned int width,
  29. unsigned int scale, u32 fg32);
  30. void drm_draw_blit32(struct iosys_map *dmap, unsigned int dpitch,
  31. const u8 *sbuf8, unsigned int spitch,
  32. unsigned int height, unsigned int width,
  33. unsigned int scale, u32 fg32);
  34. void drm_draw_fill16(struct iosys_map *dmap, unsigned int dpitch,
  35. unsigned int height, unsigned int width,
  36. u16 color);
  37. void drm_draw_fill24(struct iosys_map *dmap, unsigned int dpitch,
  38. unsigned int height, unsigned int width,
  39. u32 color);
  40. void drm_draw_fill32(struct iosys_map *dmap, unsigned int dpitch,
  41. unsigned int height, unsigned int width,
  42. u32 color);
  43. #endif /* __DRM_DRAW_INTERNAL_H__ */