xref: /dflybsd-src/sys/dev/drm/amd/display/dc/inc/hw/ipp.h (revision b843c749addef9340ee7d4e250b09fdd492602a1)
1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2017 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_IPP_H__
27*b843c749SSergey Zigachev #define __DAL_IPP_H__
28*b843c749SSergey Zigachev 
29*b843c749SSergey Zigachev #include "hw_shared.h"
30*b843c749SSergey Zigachev #include "dc_hw_types.h"
31*b843c749SSergey Zigachev 
32*b843c749SSergey Zigachev #define MAXTRIX_COEFFICIENTS_NUMBER 12
33*b843c749SSergey Zigachev #define MAXTRIX_COEFFICIENTS_WRAP_NUMBER (MAXTRIX_COEFFICIENTS_NUMBER + 4)
34*b843c749SSergey Zigachev #define MAX_OVL_MATRIX_COUNT 12
35*b843c749SSergey Zigachev 
36*b843c749SSergey Zigachev /* IPP RELATED */
37*b843c749SSergey Zigachev struct input_pixel_processor {
38*b843c749SSergey Zigachev 	struct  dc_context *ctx;
39*b843c749SSergey Zigachev 	unsigned int inst;
40*b843c749SSergey Zigachev 	const struct ipp_funcs *funcs;
41*b843c749SSergey Zigachev };
42*b843c749SSergey Zigachev 
43*b843c749SSergey Zigachev enum ipp_prescale_mode {
44*b843c749SSergey Zigachev 	IPP_PRESCALE_MODE_BYPASS,
45*b843c749SSergey Zigachev 	IPP_PRESCALE_MODE_FIXED_SIGNED,
46*b843c749SSergey Zigachev 	IPP_PRESCALE_MODE_FLOAT_SIGNED,
47*b843c749SSergey Zigachev 	IPP_PRESCALE_MODE_FIXED_UNSIGNED,
48*b843c749SSergey Zigachev 	IPP_PRESCALE_MODE_FLOAT_UNSIGNED
49*b843c749SSergey Zigachev };
50*b843c749SSergey Zigachev 
51*b843c749SSergey Zigachev struct ipp_prescale_params {
52*b843c749SSergey Zigachev 	enum ipp_prescale_mode mode;
53*b843c749SSergey Zigachev 	uint16_t bias;
54*b843c749SSergey Zigachev 	uint16_t scale;
55*b843c749SSergey Zigachev };
56*b843c749SSergey Zigachev 
57*b843c749SSergey Zigachev 
58*b843c749SSergey Zigachev 
59*b843c749SSergey Zigachev enum ovl_color_space {
60*b843c749SSergey Zigachev 	OVL_COLOR_SPACE_UNKNOWN = 0,
61*b843c749SSergey Zigachev 	OVL_COLOR_SPACE_RGB,
62*b843c749SSergey Zigachev 	OVL_COLOR_SPACE_YUV601,
63*b843c749SSergey Zigachev 	OVL_COLOR_SPACE_YUV709
64*b843c749SSergey Zigachev };
65*b843c749SSergey Zigachev 
66*b843c749SSergey Zigachev 
67*b843c749SSergey Zigachev struct ipp_funcs {
68*b843c749SSergey Zigachev 
69*b843c749SSergey Zigachev 	/*** cursor ***/
70*b843c749SSergey Zigachev 	void (*ipp_cursor_set_position)(
71*b843c749SSergey Zigachev 		struct input_pixel_processor *ipp,
72*b843c749SSergey Zigachev 		const struct dc_cursor_position *position,
73*b843c749SSergey Zigachev 		const struct dc_cursor_mi_param *param);
74*b843c749SSergey Zigachev 
75*b843c749SSergey Zigachev 	void (*ipp_cursor_set_attributes)(
76*b843c749SSergey Zigachev 		struct input_pixel_processor *ipp,
77*b843c749SSergey Zigachev 		const struct dc_cursor_attributes *attributes);
78*b843c749SSergey Zigachev 
79*b843c749SSergey Zigachev 	/*** setup input pixel processing ***/
80*b843c749SSergey Zigachev 
81*b843c749SSergey Zigachev 	/* put the entire pixel processor to bypass */
82*b843c749SSergey Zigachev 	void (*ipp_full_bypass)(
83*b843c749SSergey Zigachev 			struct input_pixel_processor *ipp);
84*b843c749SSergey Zigachev 
85*b843c749SSergey Zigachev 	/* setup ipp to expand/convert input to pixel processor internal format */
86*b843c749SSergey Zigachev 	void (*ipp_setup)(
87*b843c749SSergey Zigachev 		struct input_pixel_processor *ipp,
88*b843c749SSergey Zigachev 		enum surface_pixel_format format,
89*b843c749SSergey Zigachev 		enum expansion_mode mode,
90*b843c749SSergey Zigachev 		struct dc_csc_transform input_csc_color_matrix,
91*b843c749SSergey Zigachev 		enum dc_color_space input_color_space);
92*b843c749SSergey Zigachev 
93*b843c749SSergey Zigachev 	/* DCE function to setup IPP.  TODO: see if we can consolidate to setup */
94*b843c749SSergey Zigachev 	void (*ipp_program_prescale)(
95*b843c749SSergey Zigachev 			struct input_pixel_processor *ipp,
96*b843c749SSergey Zigachev 			struct ipp_prescale_params *params);
97*b843c749SSergey Zigachev 
98*b843c749SSergey Zigachev 	void (*ipp_program_input_lut)(
99*b843c749SSergey Zigachev 			struct input_pixel_processor *ipp,
100*b843c749SSergey Zigachev 			const struct dc_gamma *gamma);
101*b843c749SSergey Zigachev 
102*b843c749SSergey Zigachev 	/*** DEGAMMA RELATED ***/
103*b843c749SSergey Zigachev 	void (*ipp_set_degamma)(
104*b843c749SSergey Zigachev 		struct input_pixel_processor *ipp,
105*b843c749SSergey Zigachev 		enum ipp_degamma_mode mode);
106*b843c749SSergey Zigachev 
107*b843c749SSergey Zigachev 	void (*ipp_program_degamma_pwl)(
108*b843c749SSergey Zigachev 		struct input_pixel_processor *ipp,
109*b843c749SSergey Zigachev 		const struct pwl_params *params);
110*b843c749SSergey Zigachev 
111*b843c749SSergey Zigachev 	void (*ipp_destroy)(struct input_pixel_processor **ipp);
112*b843c749SSergey Zigachev };
113*b843c749SSergey Zigachev 
114*b843c749SSergey Zigachev #endif /* __DAL_IPP_H__ */
115