1 | /* |
2 | * Copyright 2020 Advanced Micro Devices, Inc. |
3 | * |
4 | * Permission is hereby granted, free of charge, to any person obtaining a |
5 | * copy of this software and associated documentation files (the "Software"), |
6 | * to deal in the Software without restriction, including without limitation |
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
8 | * and/or sell copies of the Software, and to permit persons to whom the |
9 | * Software is furnished to do so, subject to the following conditions: |
10 | * |
11 | * The above copyright notice and this permission notice shall be included in |
12 | * all copies or substantial portions of the Software. |
13 | * |
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
20 | * OTHER DEALINGS IN THE SOFTWARE. |
21 | * |
22 | * Authors: AMD |
23 | * |
24 | */ |
25 | |
26 | #include "dcn10/dcn10_cm_common.h" |
27 | |
28 | #ifndef __DAL_DCN30_CM_COMMON_H__ |
29 | #define __DAL_DCN30_CM_COMMON_H__ |
30 | |
31 | #define TF_HELPER_REG_FIELD_LIST_DCN3(type) \ |
32 | TF_HELPER_REG_FIELD_LIST(type);\ |
33 | type field_region_start_base;\ |
34 | type field_offset |
35 | |
36 | struct DCN3_xfer_func_shift { |
37 | TF_HELPER_REG_FIELD_LIST_DCN3(uint8_t); |
38 | }; |
39 | |
40 | struct DCN3_xfer_func_mask { |
41 | TF_HELPER_REG_FIELD_LIST_DCN3(uint32_t); |
42 | }; |
43 | |
44 | struct dcn3_xfer_func_reg { |
45 | struct DCN3_xfer_func_shift shifts; |
46 | struct DCN3_xfer_func_mask masks; |
47 | |
48 | TF_HELPER_REG_LIST; |
49 | uint32_t offset_b; |
50 | uint32_t offset_g; |
51 | uint32_t offset_r; |
52 | uint32_t start_base_cntl_b; |
53 | uint32_t start_base_cntl_g; |
54 | uint32_t start_base_cntl_r; |
55 | }; |
56 | |
57 | void cm_helper_program_gamcor_xfer_func( |
58 | struct dc_context *ctx, |
59 | const struct pwl_params *params, |
60 | const struct dcn3_xfer_func_reg *reg); |
61 | |
62 | bool cm3_helper_translate_curve_to_hw_format( |
63 | const struct dc_transfer_func *output_tf, |
64 | struct pwl_params *lut_params, bool fixpoint); |
65 | |
66 | bool cm3_helper_translate_curve_to_degamma_hw_format( |
67 | const struct dc_transfer_func *output_tf, |
68 | struct pwl_params *lut_params); |
69 | |
70 | bool cm3_helper_convert_to_custom_float( |
71 | struct pwl_result_data *rgb_resulted, |
72 | struct curve_points3 *corner_points, |
73 | uint32_t hw_points_num, |
74 | bool fixpoint); |
75 | |
76 | bool is_rgb_equal(const struct pwl_result_data *rgb, uint32_t num); |
77 | |
78 | #endif |
79 | |