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 drm_format_info;
10 struct drm_framebuffer;
11 struct drm_rect;
12 
13 unsigned int drm_fb_clip_offset(unsigned int pitch, const struct drm_format_info *format,
14 				const struct drm_rect *clip);
15 
16 void drm_fb_memcpy(void *dst, unsigned int dst_pitch, const void *vaddr,
17 		   const struct drm_framebuffer *fb, const struct drm_rect *clip);
18 void drm_fb_memcpy_toio(void __iomem *dst, unsigned int dst_pitch, const void *vaddr,
19 			const struct drm_framebuffer *fb, const struct drm_rect *clip);
20 void drm_fb_swab(void *dst, unsigned int dst_pitch, const void *src,
21 		 const struct drm_framebuffer *fb, const struct drm_rect *clip,
22 		 bool cached);
23 void drm_fb_xrgb8888_to_rgb332(void *dst, unsigned int dst_pitch, const void *vaddr,
24 			       const struct drm_framebuffer *fb, const struct drm_rect *clip);
25 void drm_fb_xrgb8888_to_rgb565(void *dst, unsigned int dst_pitch, const void *vaddr,
26 			       const struct drm_framebuffer *fb, const struct drm_rect *clip,
27 			       bool swab);
28 void drm_fb_xrgb8888_to_rgb565_toio(void __iomem *dst, unsigned int dst_pitch,
29 				    const void *vaddr, const struct drm_framebuffer *fb,
30 				    const struct drm_rect *clip, bool swab);
31 void drm_fb_xrgb8888_to_rgb888(void *dst, unsigned int dst_pitch, const void *src,
32 			       const struct drm_framebuffer *fb, const struct drm_rect *clip);
33 void drm_fb_xrgb8888_to_rgb888_toio(void __iomem *dst, unsigned int dst_pitch,
34 				    const void *vaddr, const struct drm_framebuffer *fb,
35 				    const struct drm_rect *clip);
36 void drm_fb_xrgb8888_to_xrgb2101010_toio(void __iomem *dst, unsigned int dst_pitch,
37 					 const void *vaddr, const struct drm_framebuffer *fb,
38 					 const struct drm_rect *clip);
39 void drm_fb_xrgb8888_to_gray8(void *dst, unsigned int dst_pitch, const void *vaddr,
40 			      const struct drm_framebuffer *fb, const struct drm_rect *clip);
41 
42 int drm_fb_blit_toio(void __iomem *dst, unsigned int dst_pitch, uint32_t dst_format,
43 		     const void *vmap, const struct drm_framebuffer *fb,
44 		     const struct drm_rect *rect);
45 
46 #endif /* __LINUX_DRM_FORMAT_HELPER_H */
47