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_rgb888(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_xrgb2101010(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_gray8(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 43 int drm_fb_blit(struct iosys_map *dst, const unsigned int *dst_pitch, uint32_t dst_format, 44 const struct iosys_map *src, const struct drm_framebuffer *fb, 45 const struct drm_rect *rect); 46 47 void drm_fb_xrgb8888_to_mono(struct iosys_map *dst, const unsigned int *dst_pitch, 48 const struct iosys_map *src, const struct drm_framebuffer *fb, 49 const struct drm_rect *clip); 50 51 size_t drm_fb_build_fourcc_list(struct drm_device *dev, 52 const u32 *native_fourccs, size_t native_nfourccs, 53 const u32 *extra_fourccs, size_t extra_nfourccs, 54 u32 *fourccs_out, size_t nfourccs_out); 55 56 #endif /* __LINUX_DRM_FORMAT_HELPER_H */ 57