• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2022 Advanced Micro Devices, Inc.
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a
4  * copy of this software and associated documentation files (the "Software"),
5  * to deal in the Software without restriction, including without limitation
6  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7  * and/or sell copies of the Software, and to permit persons to whom the
8  * Software is furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
16  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
17  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
18  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
19  * OTHER DEALINGS IN THE SOFTWARE.
20  *
21  * Authors: AMD
22  *
23  */
24 
25 #pragma once
26 
27 #include "vpe_types.h"
28 #include "hw_shared.h"
29 #include "color.h"
30 #include "transform.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 struct dpp;
37 struct vpe_priv;
38 struct vpe_csc_matrix;
39 
40 struct cnv_alpha_2bit_lut {
41     int lut0;
42     int lut1;
43     int lut2;
44     int lut3;
45 };
46 
47 struct cnv_keyer_params {
48     uint8_t             keyer_en;
49     uint8_t             is_color_key;
50     enum vpe_keyer_mode keyer_mode;
51     union {
52         struct {
53             uint16_t color_keyer_green_low;
54             uint16_t color_keyer_green_high;
55             uint16_t color_keyer_alpha_low;
56             uint16_t color_keyer_alpha_high;
57             uint16_t color_keyer_red_low;
58             uint16_t color_keyer_red_high;
59             uint16_t color_keyer_blue_low;
60             uint16_t color_keyer_blue_high;
61         } color_keyer;
62 
63         struct {
64             uint16_t lower_luma_bound;
65             uint16_t upper_luma_bound;
66         } luma_keyer;
67     };
68 };
69 
70 enum input_csc_select {
71     INPUT_CSC_SELECT_BYPASS = 0,
72     INPUT_CSC_SELECT_ICSC   = 1,
73 };
74 
75 struct dpp_funcs {
76 
77     bool (*get_optimal_number_of_taps)(
78         struct vpe_rect *src_rect, struct vpe_rect *dst_rect, struct vpe_scaling_taps *taps);
79 
80     void (*dscl_calc_lb_num_partitions)(const struct scaler_data *scl_data,
81         enum lb_memory_config lb_config, uint32_t *num_part_y, uint32_t *num_part_c);
82 
83     /** non segment specific */
84     void (*program_cnv)(
85         struct dpp *dpp, enum vpe_surface_pixel_format format, enum vpe_expansion_mode mode);
86 
87     void (*program_pre_dgam)(struct dpp *dpp, enum color_transfer_func tr);
88 
89     void (*program_cnv_bias_scale)(struct dpp *dpp, struct bias_and_scale *bias_and_scale);
90 
91     void (*build_keyer_params)(struct dpp *dpp, const struct stream_ctx *stream_ctx,
92         struct cnv_keyer_params *keyer_params);
93 
94     void (*program_alpha_keyer)(struct dpp *dpp, const struct cnv_keyer_params *keyer_params);
95 
96     void (*program_input_transfer_func)(struct dpp *dpp, struct transfer_func *input_tf);
97 
98     void (*program_gamut_remap)(struct dpp *dpp, struct colorspace_transform *gamut_remap);
99 
100     /*program post scaler scs block in dpp CM*/
101     void (*program_post_csc)(struct dpp *dpp, enum color_space color_space,
102         enum input_csc_select input_select, struct vpe_csc_matrix *input_cs);
103 
104     void (*set_hdr_multiplier)(struct dpp *dpp, uint32_t multiplier);
105 
106     /** scaler */
107     void (*set_segment_scaler)(struct dpp *dpp, const struct scaler_data *scl_data);
108 
109     void (*set_frame_scaler)(struct dpp *dpp, const struct scaler_data *scl_data);
110 
111     uint32_t (*get_line_buffer_size)(void);
112 
113     bool (*validate_number_of_taps)(struct dpp *dpp, struct scaler_data *scl_data);
114 
115     void (*program_crc)(struct dpp *opp, bool enable);
116 };
117 
118 struct dpp {
119     struct vpe_priv  *vpe_priv;
120     struct dpp_funcs *funcs;
121     unsigned int      inst;
122 
123     struct pwl_params degamma_params;
124 };
125 
126 #ifdef __cplusplus
127 }
128 #endif
129