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(struct iosys_map *dst, const unsigned int *dst_pitch,
30 			       const struct iosys_map *vmap, const struct drm_framebuffer *fb,
31 			       const struct drm_rect *clip);
32 void drm_fb_xrgb8888_to_xrgb2101010(struct iosys_map *dst, const unsigned int *dst_pitch,
33 				    const struct iosys_map *vmap, const struct drm_framebuffer *fb,
34 				    const struct drm_rect *clip);
35 void drm_fb_xrgb8888_to_gray8(struct iosys_map *dst, const unsigned int *dst_pitch,
36 			      const struct iosys_map *vmap, const struct drm_framebuffer *fb,
37 			      const struct drm_rect *clip);
38 
39 int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t dst_format,
40 		const struct iosys_map *vmap, const struct drm_framebuffer *fb,
41 		const struct drm_rect *rect);
42 
43 void drm_fb_xrgb8888_to_mono(void *dst, unsigned int dst_pitch, const void *src,
44 			     const struct drm_framebuffer *fb, const struct drm_rect *clip);
45 
46 #endif /* __LINUX_DRM_FORMAT_HELPER_H */
47