xref: /linux/include/drm/drm_format_helper.h (revision 8a922b7728a93d837954315c98b84f6b78de0c4f)
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 #include <linux/types.h>
10 
11 struct drm_device;
12 struct drm_format_info;
13 struct drm_framebuffer;
14 struct drm_rect;
15 
16 struct iosys_map;
17 
18 unsigned int drm_fb_clip_offset(unsigned int pitch, const struct drm_format_info *format,
19 				const struct drm_rect *clip);
20 
21 void drm_fb_memcpy(struct iosys_map *dst, const unsigned int *dst_pitch,
22 		   const struct iosys_map *src, const struct drm_framebuffer *fb,
23 		   const struct drm_rect *clip);
24 void drm_fb_swab(struct iosys_map *dst, const unsigned int *dst_pitch,
25 		 const struct iosys_map *src, const struct drm_framebuffer *fb,
26 		 const struct drm_rect *clip, bool cached);
27 void drm_fb_xrgb8888_to_rgb332(struct iosys_map *dst, const unsigned int *dst_pitch,
28 			       const struct iosys_map *src, const struct drm_framebuffer *fb,
29 			       const struct drm_rect *clip);
30 void drm_fb_xrgb8888_to_rgb565(struct iosys_map *dst, const unsigned int *dst_pitch,
31 			       const struct iosys_map *src, const struct drm_framebuffer *fb,
32 			       const struct drm_rect *clip, bool swab);
33 void drm_fb_xrgb8888_to_xrgb1555(struct iosys_map *dst, const unsigned int *dst_pitch,
34 				 const struct iosys_map *src, const struct drm_framebuffer *fb,
35 				 const struct drm_rect *clip);
36 void drm_fb_xrgb8888_to_argb1555(struct iosys_map *dst, const unsigned int *dst_pitch,
37 				 const struct iosys_map *src, const struct drm_framebuffer *fb,
38 				 const struct drm_rect *clip);
39 void drm_fb_xrgb8888_to_rgba5551(struct iosys_map *dst, const unsigned int *dst_pitch,
40 				 const struct iosys_map *src, const struct drm_framebuffer *fb,
41 				 const struct drm_rect *clip);
42 void drm_fb_xrgb8888_to_rgb888(struct iosys_map *dst, const unsigned int *dst_pitch,
43 			       const struct iosys_map *src, const struct drm_framebuffer *fb,
44 			       const struct drm_rect *clip);
45 void drm_fb_xrgb8888_to_argb8888(struct iosys_map *dst, const unsigned int *dst_pitch,
46 				 const struct iosys_map *src, const struct drm_framebuffer *fb,
47 				 const struct drm_rect *clip);
48 void drm_fb_xrgb8888_to_xrgb2101010(struct iosys_map *dst, const unsigned int *dst_pitch,
49 				    const struct iosys_map *src, const struct drm_framebuffer *fb,
50 				    const struct drm_rect *clip);
51 void drm_fb_xrgb8888_to_argb2101010(struct iosys_map *dst, const unsigned int *dst_pitch,
52 				    const struct iosys_map *src, const struct drm_framebuffer *fb,
53 				    const struct drm_rect *clip);
54 void drm_fb_xrgb8888_to_gray8(struct iosys_map *dst, const unsigned int *dst_pitch,
55 			      const struct iosys_map *src, const struct drm_framebuffer *fb,
56 			      const struct drm_rect *clip);
57 
58 int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t dst_format,
59 		const struct iosys_map *src, const struct drm_framebuffer *fb,
60 		const struct drm_rect *rect);
61 
62 void drm_fb_xrgb8888_to_mono(struct iosys_map *dst, const unsigned int *dst_pitch,
63 			     const struct iosys_map *src, const struct drm_framebuffer *fb,
64 			     const struct drm_rect *clip);
65 
66 size_t drm_fb_build_fourcc_list(struct drm_device *dev,
67 				const u32 *native_fourccs, size_t native_nfourccs,
68 				u32 *fourccs_out, size_t nfourccs_out);
69 
70 #endif /* __LINUX_DRM_FORMAT_HELPER_H */
71