Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2016 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: AMD
0023  *
0024  */
0025 
0026 #ifndef __DAL_DCN10_CM_COMMON_H__
0027 #define __DAL_DCN10_CM_COMMON_H__
0028 
0029 #define TF_HELPER_REG_FIELD_LIST(type) \
0030     type exp_region0_lut_offset; \
0031     type exp_region0_num_segments; \
0032     type exp_region1_lut_offset; \
0033     type exp_region1_num_segments;\
0034     type field_region_end;\
0035     type field_region_end_slope;\
0036     type field_region_end_base;\
0037     type exp_region_start;\
0038     type exp_resion_start_segment;\
0039     type field_region_linear_slope
0040 
0041 #define TF_HELPER_REG_LIST \
0042     uint32_t start_cntl_b; \
0043     uint32_t start_cntl_g; \
0044     uint32_t start_cntl_r; \
0045     uint32_t start_slope_cntl_b; \
0046     uint32_t start_slope_cntl_g; \
0047     uint32_t start_slope_cntl_r; \
0048     uint32_t start_end_cntl1_b; \
0049     uint32_t start_end_cntl2_b; \
0050     uint32_t start_end_cntl1_g; \
0051     uint32_t start_end_cntl2_g; \
0052     uint32_t start_end_cntl1_r; \
0053     uint32_t start_end_cntl2_r; \
0054     uint32_t region_start; \
0055     uint32_t region_end
0056 
0057 #define TF_CM_REG_FIELD_LIST(type) \
0058     type csc_c11; \
0059     type csc_c12
0060 
0061 struct xfer_func_shift {
0062     TF_HELPER_REG_FIELD_LIST(uint8_t);
0063 };
0064 
0065 struct xfer_func_mask {
0066     TF_HELPER_REG_FIELD_LIST(uint32_t);
0067 };
0068 
0069 struct xfer_func_reg {
0070     struct xfer_func_shift shifts;
0071     struct xfer_func_mask masks;
0072 
0073     TF_HELPER_REG_LIST;
0074 };
0075 
0076 struct cm_color_matrix_shift {
0077     TF_CM_REG_FIELD_LIST(uint8_t);
0078 };
0079 
0080 struct cm_color_matrix_mask {
0081     TF_CM_REG_FIELD_LIST(uint32_t);
0082 };
0083 
0084 struct color_matrices_reg{
0085     struct cm_color_matrix_shift shifts;
0086     struct cm_color_matrix_mask masks;
0087 
0088     uint32_t csc_c11_c12;
0089     uint32_t csc_c33_c34;
0090 };
0091 
0092 void cm_helper_program_color_matrices(
0093         struct dc_context *ctx,
0094         const uint16_t *regval,
0095         const struct color_matrices_reg *reg);
0096 
0097 void cm_helper_program_xfer_func(
0098         struct dc_context *ctx,
0099         const struct pwl_params *params,
0100         const struct xfer_func_reg *reg);
0101 
0102 bool cm_helper_convert_to_custom_float(
0103         struct pwl_result_data *rgb_resulted,
0104         struct curve_points3 *corner_points,
0105         uint32_t hw_points_num,
0106         bool fixpoint);
0107 
0108 bool cm_helper_translate_curve_to_hw_format(
0109         const struct dc_transfer_func *output_tf,
0110         struct pwl_params *lut_params, bool fixpoint);
0111 
0112 bool cm_helper_translate_curve_to_degamma_hw_format(
0113                 const struct dc_transfer_func *output_tf,
0114                 struct pwl_params *lut_params);
0115 
0116 
0117 #endif