1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) Rockchip Electronics Co., Ltd. 4 * 5 * Author: Huang Lee <Putin.li@rock-chips.com> 6 */ 7 8 #ifndef __LINUX_RGA_HW_CONFIG_H_ 9 #define __LINUX_RGA_HW_CONFIG_H_ 10 11 #include "rga_drv.h" 12 13 enum rga_mmu { 14 RGA_NONE_MMU = 0, 15 RGA_MMU = 1, 16 RGA_IOMMU = 2, 17 }; 18 19 struct rga_win_data { 20 const char *name; 21 const uint32_t *raster_formats; 22 const uint32_t *fbc_formats; 23 const uint32_t *tile_formats; 24 uint32_t num_of_raster_formats; 25 uint32_t num_of_fbc_formats; 26 uint32_t num_of_tile_formats; 27 28 const unsigned int supported_rotations; 29 const unsigned int scale_up_mode; 30 const unsigned int scale_down_mode; 31 const unsigned int rd_mode; 32 33 }; 34 35 struct rga_rect { 36 int width; 37 int height; 38 }; 39 40 struct rga_rect_range { 41 struct rga_rect min; 42 struct rga_rect max; 43 }; 44 45 struct rga_hw_data { 46 uint32_t version; 47 uint32_t feature; 48 49 uint32_t csc_r2y_mode; 50 uint32_t csc_y2r_mode; 51 52 struct rga_rect_range input_range; 53 struct rga_rect_range output_range; 54 55 unsigned int max_upscale_factor; 56 unsigned int max_downscale_factor; 57 58 uint32_t byte_stride_align; 59 uint32_t max_byte_stride; 60 61 const struct rga_win_data *win; 62 unsigned int win_size; 63 64 enum rga_mmu mmu; 65 }; 66 67 extern const struct rga_hw_data rga3_data; 68 extern const struct rga_hw_data rga2e_data; 69 extern const struct rga_hw_data rga2e_1106_data; 70 extern const struct rga_hw_data rga2e_iommu_data; 71 72 /* Returns false if in range, true otherwise */ rga_hw_out_of_range(const struct rga_rect_range * range,int width,int height)73static inline bool rga_hw_out_of_range(const struct rga_rect_range *range, int width, int height) 74 { 75 return (width > range->max.width || height > range->max.height || 76 width < range->min.width || height < range->min.height); 77 } 78 79 #endif /* __LINUX_RGA_HW_CONFIG_H_ */ 80