root/drivers/gpu/drm/amd/display/dc/inc/hw/transform.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * Copyright 2012-15 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 #ifndef __DAL_TRANSFORM_H__
  27 #define __DAL_TRANSFORM_H__
  28 
  29 #include "hw_shared.h"
  30 #include "dc_hw_types.h"
  31 #include "fixed31_32.h"
  32 
  33 #define CSC_TEMPERATURE_MATRIX_SIZE 12
  34 
  35 struct bit_depth_reduction_params;
  36 
  37 struct transform {
  38         const struct transform_funcs *funcs;
  39         struct dc_context *ctx;
  40         int inst;
  41         struct dpp_caps *caps;
  42         struct pwl_params regamma_params;
  43 };
  44 
  45 /* Colorimetry */
  46 enum colorimetry {
  47         COLORIMETRY_NO_DATA = 0,
  48         COLORIMETRY_ITU601 = 1,
  49         COLORIMETRY_ITU709 = 2,
  50         COLORIMETRY_EXTENDED = 3
  51 };
  52 
  53 enum colorimetry_ext {
  54         COLORIMETRYEX_XVYCC601 = 0,
  55         COLORIMETRYEX_XVYCC709 = 1,
  56         COLORIMETRYEX_SYCC601 = 2,
  57         COLORIMETRYEX_ADOBEYCC601 = 3,
  58         COLORIMETRYEX_ADOBERGB = 4,
  59         COLORIMETRYEX_BT2020YCC = 5,
  60         COLORIMETRYEX_BT2020RGBYCBCR = 6,
  61         COLORIMETRYEX_RESERVED = 7
  62 };
  63 
  64 enum active_format_info {
  65         ACTIVE_FORMAT_NO_DATA = 0,
  66         ACTIVE_FORMAT_VALID = 1
  67 };
  68 
  69 /* Active format aspect ratio */
  70 enum active_format_aspect_ratio {
  71         ACTIVE_FORMAT_ASPECT_RATIO_SAME_AS_PICTURE = 8,
  72         ACTIVE_FORMAT_ASPECT_RATIO_4_3 = 9,
  73         ACTIVE_FORMAT_ASPECT_RATIO_16_9 = 0XA,
  74         ACTIVE_FORMAT_ASPECT_RATIO_14_9 = 0XB
  75 };
  76 
  77 enum bar_info {
  78         BAR_INFO_NOT_VALID = 0,
  79         BAR_INFO_VERTICAL_VALID = 1,
  80         BAR_INFO_HORIZONTAL_VALID = 2,
  81         BAR_INFO_BOTH_VALID = 3
  82 };
  83 
  84 enum picture_scaling {
  85         PICTURE_SCALING_UNIFORM = 0,
  86         PICTURE_SCALING_HORIZONTAL = 1,
  87         PICTURE_SCALING_VERTICAL = 2,
  88         PICTURE_SCALING_BOTH = 3
  89 };
  90 
  91 /* RGB quantization range */
  92 enum rgb_quantization_range {
  93         RGB_QUANTIZATION_DEFAULT_RANGE = 0,
  94         RGB_QUANTIZATION_LIMITED_RANGE = 1,
  95         RGB_QUANTIZATION_FULL_RANGE = 2,
  96         RGB_QUANTIZATION_RESERVED = 3
  97 };
  98 
  99 /* YYC quantization range */
 100 enum yyc_quantization_range {
 101         YYC_QUANTIZATION_LIMITED_RANGE = 0,
 102         YYC_QUANTIZATION_FULL_RANGE = 1,
 103         YYC_QUANTIZATION_RESERVED2 = 2,
 104         YYC_QUANTIZATION_RESERVED3 = 3
 105 };
 106 
 107 enum graphics_gamut_adjust_type {
 108         GRAPHICS_GAMUT_ADJUST_TYPE_BYPASS = 0,
 109         GRAPHICS_GAMUT_ADJUST_TYPE_HW, /* without adjustments */
 110         GRAPHICS_GAMUT_ADJUST_TYPE_SW /* use adjustments */
 111 };
 112 
 113 enum lb_memory_config {
 114         /* Enable all 3 pieces of memory */
 115         LB_MEMORY_CONFIG_0 = 0,
 116 
 117         /* Enable only the first piece of memory */
 118         LB_MEMORY_CONFIG_1 = 1,
 119 
 120         /* Enable only the second piece of memory */
 121         LB_MEMORY_CONFIG_2 = 2,
 122 
 123         /* Only applicable in 4:2:0 mode, enable all 3 pieces of memory and the
 124          * last piece of chroma memory used for the luma storage
 125          */
 126         LB_MEMORY_CONFIG_3 = 3
 127 };
 128 
 129 struct xfm_grph_csc_adjustment {
 130         struct fixed31_32 temperature_matrix[CSC_TEMPERATURE_MATRIX_SIZE];
 131         enum graphics_gamut_adjust_type gamut_adjust_type;
 132 };
 133 
 134 struct overscan_info {
 135         int left;
 136         int right;
 137         int top;
 138         int bottom;
 139 };
 140 
 141 struct scaling_ratios {
 142         struct fixed31_32 horz;
 143         struct fixed31_32 vert;
 144         struct fixed31_32 horz_c;
 145         struct fixed31_32 vert_c;
 146 };
 147 
 148 struct sharpness_adj {
 149         int horz;
 150         int vert;
 151 };
 152 
 153 struct line_buffer_params {
 154         bool alpha_en;
 155         bool pixel_expan_mode;
 156         bool interleave_en;
 157         int dynamic_pixel_depth;
 158         enum lb_pixel_depth depth;
 159 };
 160 
 161 struct scl_inits {
 162         struct fixed31_32 h;
 163         struct fixed31_32 h_c;
 164         struct fixed31_32 v;
 165         struct fixed31_32 v_bot;
 166         struct fixed31_32 v_c;
 167         struct fixed31_32 v_c_bot;
 168 };
 169 
 170 struct scaler_data {
 171         int h_active;
 172         int v_active;
 173         struct scaling_taps taps;
 174         struct rect viewport;
 175         struct rect viewport_c;
 176         struct rect recout;
 177         struct scaling_ratios ratios;
 178         struct scl_inits inits;
 179         struct sharpness_adj sharpness;
 180         enum pixel_format format;
 181         struct line_buffer_params lb_params;
 182 };
 183 
 184 struct transform_funcs {
 185         void (*transform_reset)(struct transform *xfm);
 186 
 187         void (*transform_set_scaler)(struct transform *xfm,
 188                         const struct scaler_data *scl_data);
 189 
 190         void (*transform_set_pixel_storage_depth)(
 191                         struct transform *xfm,
 192                         enum lb_pixel_depth depth,
 193                         const struct bit_depth_reduction_params *bit_depth_params);
 194 
 195         bool (*transform_get_optimal_number_of_taps)(
 196                         struct transform *xfm,
 197                         struct scaler_data *scl_data,
 198                         const struct scaling_taps *in_taps);
 199 
 200         void (*transform_set_gamut_remap)(
 201                         struct transform *xfm,
 202                         const struct xfm_grph_csc_adjustment *adjust);
 203 
 204         void (*opp_set_csc_default)(
 205                 struct transform *xfm,
 206                 const struct default_adjustment *default_adjust);
 207 
 208         void (*opp_set_csc_adjustment)(
 209                 struct transform *xfm,
 210                 const struct out_csc_color_matrix *tbl_entry);
 211 
 212         void (*opp_power_on_regamma_lut)(
 213                 struct transform *xfm,
 214                 bool power_on);
 215 
 216         void (*opp_program_regamma_lut)(
 217                         struct transform *xfm,
 218                         const struct pwl_result_data *rgb,
 219                         uint32_t num);
 220 
 221         void (*opp_configure_regamma_lut)(
 222                         struct transform *xfm,
 223                         bool is_ram_a);
 224 
 225         void (*opp_program_regamma_lutb_settings)(
 226                         struct transform *xfm,
 227                         const struct pwl_params *params);
 228 
 229         void (*opp_program_regamma_luta_settings)(
 230                         struct transform *xfm,
 231                         const struct pwl_params *params);
 232 
 233         void (*opp_program_regamma_pwl)(
 234                 struct transform *xfm, const struct pwl_params *params);
 235 
 236         void (*opp_set_regamma_mode)(
 237                         struct transform *xfm_base,
 238                         enum opp_regamma mode);
 239 
 240         void (*ipp_set_degamma)(
 241                         struct transform *xfm_base,
 242                         enum ipp_degamma_mode mode);
 243 
 244         void (*ipp_program_input_lut)(
 245                         struct transform *xfm_base,
 246                         const struct dc_gamma *gamma);
 247 
 248         void (*ipp_program_degamma_pwl)(struct transform *xfm_base,
 249                                                                          const struct pwl_params *params);
 250 
 251         void (*ipp_setup)(
 252                         struct transform *xfm_base,
 253                         enum surface_pixel_format format,
 254                         enum expansion_mode mode,
 255                         struct dc_csc_transform input_csc_color_matrix,
 256                         enum dc_color_space input_color_space);
 257 
 258         void (*ipp_full_bypass)(struct transform *xfm_base);
 259 
 260         void (*set_cursor_attributes)(
 261                         struct transform *xfm_base,
 262                         const struct dc_cursor_attributes *attr);
 263 
 264 };
 265 
 266 const uint16_t *get_filter_2tap_16p(void);
 267 const uint16_t *get_filter_2tap_64p(void);
 268 const uint16_t *get_filter_3tap_16p(struct fixed31_32 ratio);
 269 const uint16_t *get_filter_3tap_64p(struct fixed31_32 ratio);
 270 const uint16_t *get_filter_4tap_16p(struct fixed31_32 ratio);
 271 const uint16_t *get_filter_4tap_64p(struct fixed31_32 ratio);
 272 const uint16_t *get_filter_5tap_64p(struct fixed31_32 ratio);
 273 const uint16_t *get_filter_6tap_64p(struct fixed31_32 ratio);
 274 const uint16_t *get_filter_7tap_64p(struct fixed31_32 ratio);
 275 const uint16_t *get_filter_8tap_64p(struct fixed31_32 ratio);
 276 
 277 
 278 /* Defines the pixel processing capability of the DSCL */
 279 enum dscl_data_processing_format {
 280         DSCL_DATA_PRCESSING_FIXED_FORMAT,       /* The DSCL processes pixel data in fixed format */
 281         DSCL_DATA_PRCESSING_FLOAT_FORMAT,       /* The DSCL processes pixel data in float format */
 282 };
 283 
 284 /*
 285  * The DPP capabilities structure contains enumerations to specify the
 286  * HW processing features and an associated function pointers to
 287  * provide the function interface that can be overloaded for implementations
 288  * based on different capabilities
 289  */
 290 struct dpp_caps {
 291         /* DSCL processing pixel data in fixed or float format */
 292         enum dscl_data_processing_format dscl_data_proc_format;
 293 
 294         /* Calculates the number of partitions in the line buffer.
 295          * The implementation of this function is overloaded for
 296          * different versions of DSCL LB.
 297          */
 298         void (*dscl_calc_lb_num_partitions)(
 299                         const struct scaler_data *scl_data,
 300                         enum lb_memory_config lb_config,
 301                         int *num_part_y,
 302                         int *num_part_c);
 303 };
 304 
 305 
 306 #endif

/* [<][>][^][v][top][bottom][index][help] */