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(struct iosys_map *dst, const unsigned int *dst_pitch,
27 			       const struct iosys_map *vmap, const struct drm_framebuffer *fb,
28 			       const struct drm_rect *clip, bool swab);
29 void drm_fb_xrgb8888_to_rgb888(void *dst, unsigned int dst_pitch, const void *src,
30 			       const struct drm_framebuffer *fb, const struct drm_rect *clip);
31 void drm_fb_xrgb8888_to_rgb888_toio(void __iomem *dst, unsigned int dst_pitch,
32 				    const void *vaddr, const struct drm_framebuffer *fb,
33 				    const struct drm_rect *clip);
34 void drm_fb_xrgb8888_to_xrgb2101010_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_gray8(void *dst, unsigned int dst_pitch, const void *vaddr,
38 			      const struct drm_framebuffer *fb, const struct drm_rect *clip);
39 
40 int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t dst_format,
41 		const struct iosys_map *vmap, const struct drm_framebuffer *fb,
42 		const struct drm_rect *rect);
43 
44 void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void *src,
45 			     const struct drm_framebuffer *fb, const struct drm_rect *clip);
46 
47 #endif /* __LINUX_DRM_FORMAT_HELPER_H */
48