1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __HIFB_VOU_GRAPHICS_H__ 20 #define __HIFB_VOU_GRAPHICS_H__ 21 22 #include "hi_type.h" 23 #include "hifb.h" 24 #include "hifb_vou_drv.h" 25 #include "hifb_graphic_drv.h" 26 27 #define MDDRC_ZONE_MAX_NUM 32 28 #define HIFB_LINE_BUF 1920 29 #define HIFB_MAX_LAYER_NUM 1 30 #define VO1_IRQ_NR 91 31 32 typedef enum { 33 FB_VOU_BITEXT_LOW_ZERO = 0x0, 34 FB_VOU_BITEXT_LOW_HIGHBIT = 0x2, 35 FB_VOU_BITEXT_LOW_HIGHBITS = 0x3, 36 FB_VOU_BITEXT_BUTT 37 } vou_bitext_mode; 38 39 typedef enum { 40 FB_VOU_COLORKEY_IN = 0x0, 41 FB_VOU_COLORKEY_OUT = 0x1, 42 FB_VOU_COLORKEY_BUTT 43 } vou_colorkey_mode; 44 45 typedef struct { 46 hi_u8 key_max_r; 47 hi_u8 key_max_g; 48 hi_u8 key_max_b; 49 } fb_vo_gfx_key_max; 50 51 typedef struct { 52 hi_u8 key_min_r; 53 hi_u8 key_min_g; 54 hi_u8 key_min_b; 55 } fb_vo_gfx_key_min; 56 57 typedef struct { 58 hi_u8 mask_r; 59 hi_u8 mask_g; 60 hi_u8 mask_b; 61 } fb_vo_gfx_mask; 62 63 typedef enum { 64 FB_VOU_SCAN_MODE_INTERLACE = 0x0, 65 FB_VOU_SCAN_MODE_PROGRESSIVE = 0x1, 66 FB_VOU_SCAN_MODE_BUTT 67 } fb_vou_scan_mode; 68 69 typedef enum { 70 FB_VO_GFX_BITEXTEND_1ST = 0, 71 FB_VO_GFX_BITEXTEND_2ND = 0x2, 72 FB_VO_GFX_BITEXTEND_3RD = 0x3, 73 74 FB_VO_GFX_BITEXTEND_BUTT 75 } fb_vo_gfx_bitextend; 76 typedef hi_s32 (*vo_fb_intcallback)(const hi_void *, const hi_void *); 77 78 vo_gfxlayer_context *get_gfx_layer_ctx(hi_void); 79 hi_bool vou_graphics_enable_dcmp(GRAPHIC_LAYER gfx_layer, hi_bool enable); 80 hi_bool vou_graphics_get_dcmp_enable_state(GRAPHIC_LAYER gfx_layer, hi_bool *enable); 81 hi_void vou_graphics_enable_wbc(hal_disp_layer gfx_layer, hi_bool enable); 82 hi_void vou_graphics_set_mddr_detect_zone(hi_u32 start_id, hi_u32 cnt, fb_vo_mddrc_zone_addr *zone_addr); 83 hi_void vou_graphics_get_mddr_status(hi_u32 start_id, hi_u32 cnt, hi_u32 *status); 84 hi_void vou_graphics_clear_ddr_dectect_zone(hi_u32 start_id, hi_u32 cnt); 85 hi_s32 vou_graphics_check_ddr_dectect_zone(GRAPHIC_LAYER gfx_layer, hi_u32 new_start_id, hi_u32 new_cnt, 86 hi_u32 pre_start_id, hi_u32 pre_cnt); 87 hi_void vou_graphics_get_ddr_zone_cfg(GRAPHIC_LAYER gfx_layer, hi_u32 *start_id, hi_u32 *cnt); 88 hi_void vou_graphics_init_mddr_detect(hi_void); 89 90 hi_bool vou_graphics_set_gfx_ext(GRAPHIC_LAYER gfx_layer, fb_vo_gfx_bitextend mode); 91 hi_bool vou_graphics_set_gfx_palpha(GRAPHIC_LAYER gfx_layer, hi_u32 alpha_en, hi_u32 arange, hi_u8 alpha0, 92 hi_u8 alpha1); 93 hi_bool vou_graphics_set_layer_galpha(GRAPHIC_LAYER gfx_layer, hi_u8 alpha0); 94 hi_bool vou_graphics_set_csc_en(GRAPHIC_LAYER gfx_layer, hi_bool csc_en); 95 hi_bool vou_graphics_set_gfx_addr(GRAPHIC_LAYER gfx_layer, hi_u64 laddr); 96 hi_bool vou_graphics_set_gfx_stride(GRAPHIC_LAYER gfx_layer, hi_u16 pitch); 97 98 hi_bool vou_graphics_get_gfx_pre_mult(GRAPHIC_LAYER gfx_layer, hi_u32 *enable); 99 hi_bool vou_graphics_set_gfx_pre_mult(GRAPHIC_LAYER gfx_layer, hi_u32 enable); 100 hi_bool vou_graphics_set_layer_data_fmt(GRAPHIC_LAYER gfx_layer, fb_vo_disp_pixel_format data_fmt); 101 hi_bool vou_graphics_set_layer_in_rect(GRAPHIC_LAYER gfx_layer, HIFB_RECT *rect); 102 hi_bool vou_graphics_set_layer_src_image_reso(GRAPHIC_LAYER gfx_layer, HIFB_RECT *rect); 103 hi_bool vou_graphics_set_layer_out_rect(GRAPHIC_LAYER gfx_layer, HIFB_RECT *rect); 104 hi_bool vou_graphics_set_color_key_value(GRAPHIC_LAYER gfx_layer, fb_vo_gfx_key_max key_max, 105 fb_vo_gfx_key_min key_min); 106 hi_bool vou_graphics_set_color_key_mask(GRAPHIC_LAYER gfx_layer, fb_vo_gfx_mask vo_msk); 107 hi_bool vou_graphics_set_gfx_key_en(GRAPHIC_LAYER gfx_layer, hi_u32 key_enable); 108 hi_bool vou_graphics_set_gfx_key_mode(GRAPHIC_LAYER gfx_layer, hi_u32 key_out); 109 110 hi_bool vou_graphics_set_reg_up(GRAPHIC_LAYER gfx_layer); 111 hi_bool vou_graphics_get_layer_galpha(GRAPHIC_LAYER gfx_layer, hi_u8 *alpha0); 112 hi_bool vou_graphics_get_layer_data_fmt(GRAPHIC_LAYER gfx_layer, hi_u32 *fmt); 113 hi_bool vou_graphics_get_gfx_stride(GRAPHIC_LAYER gfx_layer, hi_u32 *gfx_stride); 114 hi_bool vou_graphics_get_gfx_addr(GRAPHIC_LAYER gfx_layer, hi_u64 *gfx_addr); 115 116 hi_s32 vou_graphics_get_dev_mode(hal_disp_layer layer, fb_vou_scan_mode *scan_mode, hi_bool *feild_update); 117 118 hi_void vo_graphics_vtth_int_process(hifb_vo_dev vo_dev); 119 hi_void vo_graphics_wbc_int_process(hi_u32 int_status); 120 121 hi_s32 vou_graphics_bind_dev(GRAPHIC_LAYER gfx_layer, hifb_vo_dev vo_dev); 122 hi_s32 vou_graphic_sun_bind_dev(GRAPHIC_LAYER gfx_layer, hifb_vo_dev vo_dev); 123 124 hi_s32 vou_graphics_set_csc(hi_u32 layer, fb_vo_csc *csc); 125 hi_s32 vou_graphics_get_csc(hi_u32 layer, fb_vo_csc *csc); 126 hi_s32 fb_vo_graphics_init(hi_void); 127 hi_s32 vo_graphics_deinit(hi_void); 128 hi_s32 vou_graphics_resource_init(hi_void); 129 hi_s32 vou_graphics_resource_deinit(hi_void); 130 131 hi_s32 vou_graphics_open_layer(GRAPHIC_LAYER gfx_layer); 132 hi_s32 vou_graphics_close_layer(GRAPHIC_LAYER gfx_layer); 133 hi_s32 vou_graphics_enable_layer(GRAPHIC_LAYER gfx_layer, hi_bool enable); 134 hi_s32 vou_graphics_set_callback(GRAPHIC_LAYER gfx_layer, fb_vo_int_type int_type, vo_fb_intcallback callback, 135 hi_void *arg); 136 hi_s32 vou_graphics_get_intf_size(GRAPHIC_LAYER gfx_layer, hi_u32 *width, hi_u32 *height); 137 hi_s32 vou_graphics_get_intf_type(GRAPHIC_LAYER gfx_layer, VO_INTF_TYPE_E *intf_type); 138 139 hi_s32 vou_graphics_set_csc_coef(GRAPHIC_LAYER gfx_layer); 140 141 hi_s32 fb_vou_graphics_show_proc(osal_proc_entry_t *s); 142 hi_s32 vou_graphics_enable_int(hi_u32 layer_index, hi_bool enable); 143 hi_bool vou_graphics_clear_int(hi_u32 int_clear, hi_s32 irq); 144 hi_bool vou_graphics_get_int(hi_u32 *int_staus); 145 hi_bool vou_graphics_clear_int_status(hi_u32 int_status); 146 hi_s32 vou_graphics_get_interrupt_dev(hi_u32 int_status, hifb_vo_dev *pvo_dev); 147 /* for GHDR */ 148 hi_bool vou_graphics_enable_ghdr(GRAPHIC_LAYER gfx_layer, hi_bool enable); 149 150 /* for ZME */ 151 hi_bool vou_graphics_enable_zme(GRAPHIC_LAYER gfx_layer, RECT_S *in_rect, RECT_S *out_rect, hi_bool enable); 152 153 hi_s32 vou_graphics_init(hi_void); 154 hi_s32 vou_graphics_deinit(hi_void); 155 #endif /* __HIFB_VOU_GRAPHICS_H__ */ 156