1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (C) 2016 Noralf Trønnes
4  */
5 
6 #ifndef __LINUX_DRM_FORMAT_HELPER_H
7 #define __LINUX_DRM_FORMAT_HELPER_H
8 
9 struct iosys_map;
10 struct drm_format_info;
11 struct drm_framebuffer;
12 struct drm_rect;
13 
14 unsigned int drm_fb_clip_offset(unsigned int pitch, const struct drm_format_info *format,
15 				const struct drm_rect *clip);
16 
17 void drm_fb_memcpy(struct iosys_map *dst, const unsigned int *dst_pitch,
18 		   const struct iosys_map *vmap, const struct drm_framebuffer *fb,
19 		   const struct drm_rect *clip);
20 void drm_fb_swab(struct iosys_map *dst, const unsigned int *dst_pitch,
21 		 const struct iosys_map *vmap, const struct drm_framebuffer *fb,
22 		 const struct drm_rect *clip, bool cached);
23 void drm_fb_xrgb8888_to_rgb332(struct iosys_map *dst, const unsigned int *dst_pitch,
24 			       const struct iosys_map *vmap, const struct drm_framebuffer *fb,
25 			       const struct drm_rect *clip);
26 void drm_fb_xrgb8888_to_rgb565(void *dst, unsigned int dst_pitch, const void *vaddr,
27 			       const struct drm_framebuffer *fb, const struct drm_rect *clip,
28 			       bool swab);
29 void drm_fb_xrgb8888_to_rgb565_toio(void __iomem *dst, unsigned int dst_pitch,
30 				    const void *vaddr, const struct drm_framebuffer *fb,
31 				    const struct drm_rect *clip, bool swab);
32 void drm_fb_xrgb8888_to_rgb888(void *dst, unsigned int dst_pitch, const void *src,
33 			       const struct drm_framebuffer *fb, const struct drm_rect *clip);
34 void drm_fb_xrgb8888_to_rgb888_toio(void __iomem *dst, unsigned int dst_pitch,
35 				    const void *vaddr, const struct drm_framebuffer *fb,
36 				    const struct drm_rect *clip);
37 void drm_fb_xrgb8888_to_xrgb2101010_toio(void __iomem *dst, unsigned int dst_pitch,
38 					 const void *vaddr, const struct drm_framebuffer *fb,
39 					 const struct drm_rect *clip);
40 void drm_fb_xrgb8888_to_gray8(void *dst, unsigned int dst_pitch, const void *vaddr,
41 			      const struct drm_framebuffer *fb, const struct drm_rect *clip);
42 
43 int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t dst_format,
44 		const struct iosys_map *vmap, const struct drm_framebuffer *fb,
45 		const struct drm_rect *rect);
46 
47 void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void *src,
48 			     const struct drm_framebuffer *fb, const struct drm_rect *clip);
49 
50 #endif /* __LINUX_DRM_FORMAT_HELPER_H */
51