xref: /dragonfly/sys/dev/drm/amd/display/dc/inc/hw/hw_shared.h (revision b843c749)
1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2015 Advanced Micro Devices, Inc.
3*b843c749SSergey Zigachev  *
4*b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5*b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6*b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7*b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*b843c749SSergey Zigachev  * and/or sell copies of the Software, and to permit persons to whom the
9*b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10*b843c749SSergey Zigachev  *
11*b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12*b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13*b843c749SSergey Zigachev  *
14*b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21*b843c749SSergey Zigachev  *
22*b843c749SSergey Zigachev  * Authors: AMD
23*b843c749SSergey Zigachev  *
24*b843c749SSergey Zigachev  */
25*b843c749SSergey Zigachev 
26*b843c749SSergey Zigachev #ifndef __DAL_HW_SHARED_H__
27*b843c749SSergey Zigachev #define __DAL_HW_SHARED_H__
28*b843c749SSergey Zigachev 
29*b843c749SSergey Zigachev #include "os_types.h"
30*b843c749SSergey Zigachev #include "fixed31_32.h"
31*b843c749SSergey Zigachev #include "dc_hw_types.h"
32*b843c749SSergey Zigachev 
33*b843c749SSergey Zigachev /******************************************************************************
34*b843c749SSergey Zigachev  * Data types shared between different Virtual HW blocks
35*b843c749SSergey Zigachev  ******************************************************************************/
36*b843c749SSergey Zigachev 
37*b843c749SSergey Zigachev #define MAX_AUDIOS 7
38*b843c749SSergey Zigachev #define MAX_PIPES 6
39*b843c749SSergey Zigachev 
40*b843c749SSergey Zigachev struct gamma_curve {
41*b843c749SSergey Zigachev 	uint32_t offset;
42*b843c749SSergey Zigachev 	uint32_t segments_num;
43*b843c749SSergey Zigachev };
44*b843c749SSergey Zigachev 
45*b843c749SSergey Zigachev struct curve_points {
46*b843c749SSergey Zigachev 	struct fixed31_32 x;
47*b843c749SSergey Zigachev 	struct fixed31_32 y;
48*b843c749SSergey Zigachev 	struct fixed31_32 offset;
49*b843c749SSergey Zigachev 	struct fixed31_32 slope;
50*b843c749SSergey Zigachev 
51*b843c749SSergey Zigachev 	uint32_t custom_float_x;
52*b843c749SSergey Zigachev 	uint32_t custom_float_y;
53*b843c749SSergey Zigachev 	uint32_t custom_float_offset;
54*b843c749SSergey Zigachev 	uint32_t custom_float_slope;
55*b843c749SSergey Zigachev };
56*b843c749SSergey Zigachev 
57*b843c749SSergey Zigachev struct pwl_result_data {
58*b843c749SSergey Zigachev 	struct fixed31_32 red;
59*b843c749SSergey Zigachev 	struct fixed31_32 green;
60*b843c749SSergey Zigachev 	struct fixed31_32 blue;
61*b843c749SSergey Zigachev 
62*b843c749SSergey Zigachev 	struct fixed31_32 delta_red;
63*b843c749SSergey Zigachev 	struct fixed31_32 delta_green;
64*b843c749SSergey Zigachev 	struct fixed31_32 delta_blue;
65*b843c749SSergey Zigachev 
66*b843c749SSergey Zigachev 	uint32_t red_reg;
67*b843c749SSergey Zigachev 	uint32_t green_reg;
68*b843c749SSergey Zigachev 	uint32_t blue_reg;
69*b843c749SSergey Zigachev 
70*b843c749SSergey Zigachev 	uint32_t delta_red_reg;
71*b843c749SSergey Zigachev 	uint32_t delta_green_reg;
72*b843c749SSergey Zigachev 	uint32_t delta_blue_reg;
73*b843c749SSergey Zigachev };
74*b843c749SSergey Zigachev 
75*b843c749SSergey Zigachev struct pwl_params {
76*b843c749SSergey Zigachev 	struct gamma_curve arr_curve_points[34];
77*b843c749SSergey Zigachev 	struct curve_points arr_points[2];
78*b843c749SSergey Zigachev 	struct pwl_result_data rgb_resulted[256 + 3];
79*b843c749SSergey Zigachev 	uint32_t hw_points_num;
80*b843c749SSergey Zigachev };
81*b843c749SSergey Zigachev 
82*b843c749SSergey Zigachev /* move to dpp
83*b843c749SSergey Zigachev  * while we are moving functionality out of opp to dpp to align
84*b843c749SSergey Zigachev  * HW programming to HW IP, we define these struct in hw_shared
85*b843c749SSergey Zigachev  * so we can still compile while refactoring
86*b843c749SSergey Zigachev  */
87*b843c749SSergey Zigachev 
88*b843c749SSergey Zigachev enum lb_pixel_depth {
89*b843c749SSergey Zigachev 	/* do not change the values because it is used as bit vector */
90*b843c749SSergey Zigachev 	LB_PIXEL_DEPTH_18BPP = 1,
91*b843c749SSergey Zigachev 	LB_PIXEL_DEPTH_24BPP = 2,
92*b843c749SSergey Zigachev 	LB_PIXEL_DEPTH_30BPP = 4,
93*b843c749SSergey Zigachev 	LB_PIXEL_DEPTH_36BPP = 8
94*b843c749SSergey Zigachev };
95*b843c749SSergey Zigachev 
96*b843c749SSergey Zigachev enum graphics_csc_adjust_type {
97*b843c749SSergey Zigachev 	GRAPHICS_CSC_ADJUST_TYPE_BYPASS = 0,
98*b843c749SSergey Zigachev 	GRAPHICS_CSC_ADJUST_TYPE_HW, /* without adjustments */
99*b843c749SSergey Zigachev 	GRAPHICS_CSC_ADJUST_TYPE_SW  /*use adjustments */
100*b843c749SSergey Zigachev };
101*b843c749SSergey Zigachev 
102*b843c749SSergey Zigachev enum ipp_degamma_mode {
103*b843c749SSergey Zigachev 	IPP_DEGAMMA_MODE_BYPASS,
104*b843c749SSergey Zigachev 	IPP_DEGAMMA_MODE_HW_sRGB,
105*b843c749SSergey Zigachev 	IPP_DEGAMMA_MODE_HW_xvYCC,
106*b843c749SSergey Zigachev 	IPP_DEGAMMA_MODE_USER_PWL
107*b843c749SSergey Zigachev };
108*b843c749SSergey Zigachev 
109*b843c749SSergey Zigachev enum ipp_output_format {
110*b843c749SSergey Zigachev 	IPP_OUTPUT_FORMAT_12_BIT_FIX,
111*b843c749SSergey Zigachev 	IPP_OUTPUT_FORMAT_16_BIT_BYPASS,
112*b843c749SSergey Zigachev 	IPP_OUTPUT_FORMAT_FLOAT
113*b843c749SSergey Zigachev };
114*b843c749SSergey Zigachev 
115*b843c749SSergey Zigachev enum expansion_mode {
116*b843c749SSergey Zigachev 	EXPANSION_MODE_DYNAMIC,
117*b843c749SSergey Zigachev 	EXPANSION_MODE_ZERO
118*b843c749SSergey Zigachev };
119*b843c749SSergey Zigachev 
120*b843c749SSergey Zigachev struct default_adjustment {
121*b843c749SSergey Zigachev 	enum lb_pixel_depth lb_color_depth;
122*b843c749SSergey Zigachev 	enum dc_color_space out_color_space;
123*b843c749SSergey Zigachev 	enum dc_color_space in_color_space;
124*b843c749SSergey Zigachev 	enum dc_color_depth color_depth;
125*b843c749SSergey Zigachev 	enum pixel_format surface_pixel_format;
126*b843c749SSergey Zigachev 	enum graphics_csc_adjust_type csc_adjust_type;
127*b843c749SSergey Zigachev 	bool force_hw_default;
128*b843c749SSergey Zigachev };
129*b843c749SSergey Zigachev 
130*b843c749SSergey Zigachev 
131*b843c749SSergey Zigachev struct out_csc_color_matrix {
132*b843c749SSergey Zigachev 	enum dc_color_space color_space;
133*b843c749SSergey Zigachev 	uint16_t regval[12];
134*b843c749SSergey Zigachev };
135*b843c749SSergey Zigachev 
136*b843c749SSergey Zigachev 
137*b843c749SSergey Zigachev enum opp_regamma {
138*b843c749SSergey Zigachev 	OPP_REGAMMA_BYPASS = 0,
139*b843c749SSergey Zigachev 	OPP_REGAMMA_SRGB,
140*b843c749SSergey Zigachev 	OPP_REGAMMA_XVYCC,
141*b843c749SSergey Zigachev 	OPP_REGAMMA_USER
142*b843c749SSergey Zigachev };
143*b843c749SSergey Zigachev 
144*b843c749SSergey Zigachev struct dc_bias_and_scale {
145*b843c749SSergey Zigachev 	uint16_t scale_red;
146*b843c749SSergey Zigachev 	uint16_t bias_red;
147*b843c749SSergey Zigachev 	uint16_t scale_green;
148*b843c749SSergey Zigachev 	uint16_t bias_green;
149*b843c749SSergey Zigachev 	uint16_t scale_blue;
150*b843c749SSergey Zigachev 	uint16_t bias_blue;
151*b843c749SSergey Zigachev };
152*b843c749SSergey Zigachev 
153*b843c749SSergey Zigachev enum test_pattern_dyn_range {
154*b843c749SSergey Zigachev 	TEST_PATTERN_DYN_RANGE_VESA = 0,
155*b843c749SSergey Zigachev 	TEST_PATTERN_DYN_RANGE_CEA
156*b843c749SSergey Zigachev };
157*b843c749SSergey Zigachev 
158*b843c749SSergey Zigachev enum test_pattern_mode {
159*b843c749SSergey Zigachev 	TEST_PATTERN_MODE_COLORSQUARES_RGB = 0,
160*b843c749SSergey Zigachev 	TEST_PATTERN_MODE_COLORSQUARES_YCBCR601,
161*b843c749SSergey Zigachev 	TEST_PATTERN_MODE_COLORSQUARES_YCBCR709,
162*b843c749SSergey Zigachev 	TEST_PATTERN_MODE_VERTICALBARS,
163*b843c749SSergey Zigachev 	TEST_PATTERN_MODE_HORIZONTALBARS,
164*b843c749SSergey Zigachev 	TEST_PATTERN_MODE_SINGLERAMP_RGB,
165*b843c749SSergey Zigachev 	TEST_PATTERN_MODE_DUALRAMP_RGB
166*b843c749SSergey Zigachev };
167*b843c749SSergey Zigachev 
168*b843c749SSergey Zigachev enum test_pattern_color_format {
169*b843c749SSergey Zigachev 	TEST_PATTERN_COLOR_FORMAT_BPC_6 = 0,
170*b843c749SSergey Zigachev 	TEST_PATTERN_COLOR_FORMAT_BPC_8,
171*b843c749SSergey Zigachev 	TEST_PATTERN_COLOR_FORMAT_BPC_10,
172*b843c749SSergey Zigachev 	TEST_PATTERN_COLOR_FORMAT_BPC_12
173*b843c749SSergey Zigachev };
174*b843c749SSergey Zigachev 
175*b843c749SSergey Zigachev enum controller_dp_test_pattern {
176*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_D102 = 0,
177*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_SYMBOLERROR,
178*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_PRBS7,
179*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_COLORSQUARES,
180*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_VERTICALBARS,
181*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_HORIZONTALBARS,
182*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_COLORRAMP,
183*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_VIDEOMODE,
184*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_RESERVED_8,
185*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_RESERVED_9,
186*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_RESERVED_A,
187*b843c749SSergey Zigachev 	CONTROLLER_DP_TEST_PATTERN_COLORSQUARES_CEA
188*b843c749SSergey Zigachev };
189*b843c749SSergey Zigachev 
190*b843c749SSergey Zigachev enum dc_lut_mode {
191*b843c749SSergey Zigachev 	LUT_BYPASS,
192*b843c749SSergey Zigachev 	LUT_RAM_A,
193*b843c749SSergey Zigachev 	LUT_RAM_B
194*b843c749SSergey Zigachev };
195*b843c749SSergey Zigachev #endif /* __DAL_HW_SHARED_H__ */
196