1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) Rockchip Electronics Co., Ltd. 4 * 5 * Author: 6 * Cerf Yu <cerf.yu@rock-chips.com> 7 */ 8 9 #ifndef __LINUX_RKRGA_COMMON_H_ 10 #define __LINUX_RKRGA_COMMON_H_ 11 12 #include "rga_drv.h" 13 #include "rga_hw_config.h" 14 15 #define RGA_GET_PAGE_COUNT(size) (((size) >> PAGE_SHIFT) + (((size) & (~PAGE_MASK)) ? 1 : 0)) 16 17 bool rga_is_rgb_format(uint32_t format); 18 bool rga_is_yuv_format(uint32_t format); 19 bool rga_is_alpha_format(uint32_t format); 20 bool rga_is_yuv420_packed_format(uint32_t format); 21 bool rga_is_yuv420_planar_format(uint32_t format); 22 bool rga_is_yuv420_semi_planar_format(uint32_t format); 23 bool rga_is_yuv422_packed_format(uint32_t format); 24 bool rga_is_yuv422_planar_format(uint32_t format); 25 bool rga_is_yuv422_semi_planar_format(uint32_t format); 26 bool rga_is_yuv8bit_format(uint32_t format); 27 bool rga_is_yuv10bit_format(uint32_t format); 28 bool rga_is_yuv422p_format(uint32_t format); 29 bool rga_is_only_y_format(uint32_t format); 30 31 int rga_get_format_bits(uint32_t format); 32 int rga_get_pixel_stride_from_format(uint32_t format); 33 34 const char *rga_get_format_name(uint32_t format); 35 const char *rga_get_render_mode_str(uint8_t mode); 36 const char *rga_get_rotate_mode_str(uint8_t mode); 37 const char *rga_get_blend_mode_str(enum rga_alpha_blend_mode mode); 38 const char *rga_get_memory_type_str(uint8_t type); 39 const char *rga_get_mmu_type_str(enum rga_mmu mmu_type); 40 41 void rga_convert_addr(struct rga_img_info_t *img, bool before_vir_get_channel); 42 void rga_swap_pd_mode(struct rga_req *req_rga); 43 int rga_image_size_cal(int w, int h, int format, 44 int *yrgb_size, int *uv_size, int *v_size); 45 void rga_dump_memory_parm(struct rga_memory_parm *parm); 46 void rga_dump_external_buffer(struct rga_external_buffer *buffer); 47 48 #endif 49