Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2012-15 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_TRANSFORM_H__
0027 #define __DAL_TRANSFORM_H__
0028 
0029 #include "hw_shared.h"
0030 #include "dc_hw_types.h"
0031 #include "fixed31_32.h"
0032 
0033 #define CSC_TEMPERATURE_MATRIX_SIZE 12
0034 
0035 struct bit_depth_reduction_params;
0036 
0037 struct transform {
0038     const struct transform_funcs *funcs;
0039     struct dc_context *ctx;
0040     int inst;
0041     struct dpp_caps *caps;
0042     struct pwl_params regamma_params;
0043 };
0044 
0045 /* Colorimetry */
0046 enum colorimetry {
0047     COLORIMETRY_NO_DATA = 0,
0048     COLORIMETRY_ITU601 = 1,
0049     COLORIMETRY_ITU709 = 2,
0050     COLORIMETRY_EXTENDED = 3
0051 };
0052 
0053 enum colorimetry_ext {
0054     COLORIMETRYEX_XVYCC601 = 0,
0055     COLORIMETRYEX_XVYCC709 = 1,
0056     COLORIMETRYEX_SYCC601 = 2,
0057     COLORIMETRYEX_ADOBEYCC601 = 3,
0058     COLORIMETRYEX_ADOBERGB = 4,
0059     COLORIMETRYEX_BT2020YCC = 5,
0060     COLORIMETRYEX_BT2020RGBYCBCR = 6,
0061     COLORIMETRYEX_RESERVED = 7
0062 };
0063 
0064 enum active_format_info {
0065     ACTIVE_FORMAT_NO_DATA = 0,
0066     ACTIVE_FORMAT_VALID = 1
0067 };
0068 
0069 /* Active format aspect ratio */
0070 enum active_format_aspect_ratio {
0071     ACTIVE_FORMAT_ASPECT_RATIO_SAME_AS_PICTURE = 8,
0072     ACTIVE_FORMAT_ASPECT_RATIO_4_3 = 9,
0073     ACTIVE_FORMAT_ASPECT_RATIO_16_9 = 0XA,
0074     ACTIVE_FORMAT_ASPECT_RATIO_14_9 = 0XB
0075 };
0076 
0077 enum bar_info {
0078     BAR_INFO_NOT_VALID = 0,
0079     BAR_INFO_VERTICAL_VALID = 1,
0080     BAR_INFO_HORIZONTAL_VALID = 2,
0081     BAR_INFO_BOTH_VALID = 3
0082 };
0083 
0084 enum picture_scaling {
0085     PICTURE_SCALING_UNIFORM = 0,
0086     PICTURE_SCALING_HORIZONTAL = 1,
0087     PICTURE_SCALING_VERTICAL = 2,
0088     PICTURE_SCALING_BOTH = 3
0089 };
0090 
0091 /* RGB quantization range */
0092 enum rgb_quantization_range {
0093     RGB_QUANTIZATION_DEFAULT_RANGE = 0,
0094     RGB_QUANTIZATION_LIMITED_RANGE = 1,
0095     RGB_QUANTIZATION_FULL_RANGE = 2,
0096     RGB_QUANTIZATION_RESERVED = 3
0097 };
0098 
0099 /* YYC quantization range */
0100 enum yyc_quantization_range {
0101     YYC_QUANTIZATION_LIMITED_RANGE = 0,
0102     YYC_QUANTIZATION_FULL_RANGE = 1,
0103     YYC_QUANTIZATION_RESERVED2 = 2,
0104     YYC_QUANTIZATION_RESERVED3 = 3
0105 };
0106 
0107 enum graphics_gamut_adjust_type {
0108     GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS = 0,
0109     GRAPHICS_GAMUT_ADJUST_TYPE_HW, /* without adjustments */
0110     GRAPHICS_GAMUT_ADJUST_TYPE_SW /* use adjustments */
0111 };
0112 
0113 enum lb_memory_config {
0114     /* Enable all 3 pieces of memory */
0115     LB_MEMORY_CONFIG_0 = 0,
0116 
0117     /* Enable only the first piece of memory */
0118     LB_MEMORY_CONFIG_1 = 1,
0119 
0120     /* Enable only the second piece of memory */
0121     LB_MEMORY_CONFIG_2 = 2,
0122 
0123     /* Only applicable in 4:2:0 mode, enable all 3 pieces of memory and the
0124      * last piece of chroma memory used for the luma storage
0125      */
0126     LB_MEMORY_CONFIG_3 = 3
0127 };
0128 
0129 struct xfm_grph_csc_adjustment {
0130     struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
0131     enum graphics_gamut_adjust_type gamut_adjust_type;
0132 };
0133 
0134 struct overscan_info {
0135     int left;
0136     int right;
0137     int top;
0138     int bottom;
0139 };
0140 
0141 struct scaling_ratios {
0142     struct fixed31_32 horz;
0143     struct fixed31_32 vert;
0144     struct fixed31_32 horz_c;
0145     struct fixed31_32 vert_c;
0146 };
0147 
0148 struct sharpness_adj {
0149     int horz;
0150     int vert;
0151 };
0152 
0153 struct line_buffer_params {
0154     bool alpha_en;
0155     bool pixel_expan_mode;
0156     bool interleave_en;
0157     int dynamic_pixel_depth;
0158     enum lb_pixel_depth depth;
0159 };
0160 
0161 struct scl_inits {
0162     struct fixed31_32 h;
0163     struct fixed31_32 h_c;
0164     struct fixed31_32 v;
0165     struct fixed31_32 v_c;
0166 };
0167 
0168 struct scaler_data {
0169     int h_active;
0170     int v_active;
0171     struct scaling_taps taps;
0172     struct rect viewport;
0173     struct rect viewport_c;
0174     struct rect recout;
0175     struct scaling_ratios ratios;
0176     struct scl_inits inits;
0177     struct sharpness_adj sharpness;
0178     enum pixel_format format;
0179     struct line_buffer_params lb_params;
0180 };
0181 
0182 struct transform_funcs {
0183     void (*transform_reset)(struct transform *xfm);
0184 
0185     void (*transform_set_scaler)(struct transform *xfm,
0186             const struct scaler_data *scl_data);
0187 
0188     void (*transform_set_pixel_storage_depth)(
0189             struct transform *xfm,
0190             enum lb_pixel_depth depth,
0191             const struct bit_depth_reduction_params *bit_depth_params);
0192 
0193     bool (*transform_get_optimal_number_of_taps)(
0194             struct transform *xfm,
0195             struct scaler_data *scl_data,
0196             const struct scaling_taps *in_taps);
0197 
0198     void (*transform_set_gamut_remap)(
0199             struct transform *xfm,
0200             const struct xfm_grph_csc_adjustment *adjust);
0201 
0202     void (*opp_set_csc_default)(
0203         struct transform *xfm,
0204         const struct default_adjustment *default_adjust);
0205 
0206     void (*opp_set_csc_adjustment)(
0207         struct transform *xfm,
0208         const struct out_csc_color_matrix *tbl_entry);
0209 
0210     void (*opp_power_on_regamma_lut)(
0211         struct transform *xfm,
0212         bool power_on);
0213 
0214     void (*opp_program_regamma_lut)(
0215             struct transform *xfm,
0216             const struct pwl_result_data *rgb,
0217             uint32_t num);
0218 
0219     void (*opp_configure_regamma_lut)(
0220             struct transform *xfm,
0221             bool is_ram_a);
0222 
0223     void (*opp_program_regamma_lutb_settings)(
0224             struct transform *xfm,
0225             const struct pwl_params *params);
0226 
0227     void (*opp_program_regamma_luta_settings)(
0228             struct transform *xfm,
0229             const struct pwl_params *params);
0230 
0231     void (*opp_program_regamma_pwl)(
0232         struct transform *xfm, const struct pwl_params *params);
0233 
0234     void (*opp_set_regamma_mode)(
0235             struct transform *xfm_base,
0236             enum opp_regamma mode);
0237 
0238     void (*ipp_set_degamma)(
0239             struct transform *xfm_base,
0240             enum ipp_degamma_mode mode);
0241 
0242     void (*ipp_program_input_lut)(
0243             struct transform *xfm_base,
0244             const struct dc_gamma *gamma);
0245 
0246     void (*ipp_program_degamma_pwl)(struct transform *xfm_base,
0247                                      const struct pwl_params *params);
0248 
0249     void (*ipp_setup)(
0250             struct transform *xfm_base,
0251             enum surface_pixel_format format,
0252             enum expansion_mode mode,
0253             struct dc_csc_transform input_csc_color_matrix,
0254             enum dc_color_space input_color_space);
0255 
0256     void (*ipp_full_bypass)(struct transform *xfm_base);
0257 
0258     void (*set_cursor_attributes)(
0259             struct transform *xfm_base,
0260             const struct dc_cursor_attributes *attr);
0261 
0262 };
0263 
0264 const uint16_t *get_filter_2tap_16p(void);
0265 const uint16_t *get_filter_2tap_64p(void);
0266 const uint16_t *get_filter_3tap_16p(struct fixed31_32 ratio);
0267 const uint16_t *get_filter_3tap_64p(struct fixed31_32 ratio);
0268 const uint16_t *get_filter_4tap_16p(struct fixed31_32 ratio);
0269 const uint16_t *get_filter_4tap_64p(struct fixed31_32 ratio);
0270 const uint16_t *get_filter_5tap_64p(struct fixed31_32 ratio);
0271 const uint16_t *get_filter_6tap_64p(struct fixed31_32 ratio);
0272 const uint16_t *get_filter_7tap_64p(struct fixed31_32 ratio);
0273 const uint16_t *get_filter_8tap_64p(struct fixed31_32 ratio);
0274 
0275 
0276 /* Defines the pixel processing capability of the DSCL */
0277 enum dscl_data_processing_format {
0278     DSCL_DATA_PRCESSING_FIXED_FORMAT,   /* The DSCL processes pixel data in fixed format */
0279     DSCL_DATA_PRCESSING_FLOAT_FORMAT,   /* The DSCL processes pixel data in float format */
0280 };
0281 
0282 /*
0283  * The DPP capabilities structure contains enumerations to specify the
0284  * HW processing features and an associated function pointers to
0285  * provide the function interface that can be overloaded for implementations
0286  * based on different capabilities
0287  */
0288 struct dpp_caps {
0289     /* DSCL processing pixel data in fixed or float format */
0290     enum dscl_data_processing_format dscl_data_proc_format;
0291 
0292     /* max LB partitions */
0293     unsigned int max_lb_partitions;
0294 
0295     /* Calculates the number of partitions in the line buffer.
0296      * The implementation of this function is overloaded for
0297      * different versions of DSCL LB.
0298      */
0299     void (*dscl_calc_lb_num_partitions)(
0300             const struct scaler_data *scl_data,
0301             enum lb_memory_config lb_config,
0302             int *num_part_y,
0303             int *num_part_c);
0304 };
0305 
0306 
0307 #endif