From: Dmytro Laktyushkin <Dmytro.Laktyushkin@xxxxxxx> Change-Id: Idc84756e1de765dd1588d845a93a95e9259a783b Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin at amd.com> Acked-by: Harry Wentland <harry.wentland at amd.com> --- drivers/gpu/drm/amd/dal/dc/basics/conversion.h | 2 + drivers/gpu/drm/amd/dal/dc/dc_hw_types.h | 2 + drivers/gpu/drm/amd/dal/dc/dce/Makefile | 2 +- .../dce110_transform.c => dce/dce_transform.c} | 411 +++++++++++++++++---- .../dce110_transform.h => dce/dce_transform.h} | 64 ++-- .../gpu/drm/amd/dal/dc/dce100/dce100_resource.c | 16 +- drivers/gpu/drm/amd/dal/dc/dce110/Makefile | 3 +- .../gpu/drm/amd/dal/dc/dce110/dce110_resource.c | 18 +- .../drm/amd/dal/dc/dce110/dce110_transform_scl.c | 313 ---------------- .../gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c | 111 +++--- .../gpu/drm/amd/dal/dc/dce110/dce110_transform_v.h | 5 +- .../gpu/drm/amd/dal/dc/dce112/dce112_resource.c | 16 +- drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c | 16 +- drivers/gpu/drm/amd/dal/dc/inc/core_types.h | 2 - drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h | 40 +- .../drm/amd/dal/include/display_clock_interface.h | 1 - drivers/gpu/drm/amd/dal/include/scaler_types.h | 61 --- 17 files changed, 493 insertions(+), 590 deletions(-) rename drivers/gpu/drm/amd/dal/dc/{dce110/dce110_transform.c => dce/dce_transform.c} (64%) rename drivers/gpu/drm/amd/dal/dc/{dce110/dce110_transform.h => dce/dce_transform.h} (87%) delete mode 100644 drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_scl.c delete mode 100644 drivers/gpu/drm/amd/dal/include/scaler_types.h diff --git a/drivers/gpu/drm/amd/dal/dc/basics/conversion.h b/drivers/gpu/drm/amd/dal/dc/basics/conversion.h index 24ff47352688..18cbe41e80ff 100644 --- a/drivers/gpu/drm/amd/dal/dc/basics/conversion.h +++ b/drivers/gpu/drm/amd/dal/dc/basics/conversion.h @@ -26,6 +26,8 @@ #ifndef __DAL_CONVERSION_H__ #define __DAL_CONVERSION_H__ +#include "include/fixed31_32.h" + uint16_t fixed_point_to_int_frac( struct fixed31_32 arg, uint8_t integer_bits, diff --git a/drivers/gpu/drm/amd/dal/dc/dc_hw_types.h b/drivers/gpu/drm/amd/dal/dc/dc_hw_types.h index 29e65a42930c..5605a5c96da7 100644 --- a/drivers/gpu/drm/amd/dal/dc/dc_hw_types.h +++ b/drivers/gpu/drm/amd/dal/dc/dc_hw_types.h @@ -26,6 +26,8 @@ #ifndef DC_HW_TYPES_H #define DC_HW_TYPES_H +#include "os_types.h" + /****************************************************************************** * Data types for Virtual HW Layer of DAL3. * (see DAL3 design documents for HW Layer definition) diff --git a/drivers/gpu/drm/amd/dal/dc/dce/Makefile b/drivers/gpu/drm/amd/dal/dc/dce/Makefile index 6feb1755a60f..87e5f11024ca 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce/Makefile +++ b/drivers/gpu/drm/amd/dal/dc/dce/Makefile @@ -6,7 +6,7 @@ # offset/shift/mask stored in dce_hw struct DCE = dce_audio.o dce_stream_encoder.o dce_link_encoder.o dce_hwseq.o \ -dce_mem_input.o dce_scl_filters.o +dce_mem_input.o dce_scl_filters.o dce_transform.o AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE)) diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform.c b/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.c similarity index 64% rename from drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform.c rename to drivers/gpu/drm/amd/dal/dc/dce/dce_transform.c index 676aaa14eae8..4659deadcc15 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform.c +++ b/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.c @@ -1,5 +1,5 @@ /* - * Copyright 2012-15 Advanced Micro Devices, Inc. + * Copyright 2012-16 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,33 +23,24 @@ * */ -#include "dm_services.h" - - -#include "dc_types.h" -#include "core_types.h" - -#include "include/grph_object_id.h" -#include "include/fixed31_32.h" -#include "include/logger_interface.h" -#include "basics/conversion.h" - -#include "dce110_transform.h" - +#include "dce_transform.h" #include "reg_helper.h" +#include "opp.h" +#include "basics/conversion.h" #define REG(reg) \ - (xfm110->regs->reg) + (xfm_dce->regs->reg) #undef FN #define FN(reg_name, field_name) \ - xfm110->xfm_shift->field_name, xfm110->xfm_mask->field_name + xfm_dce->xfm_shift->field_name, xfm_dce->xfm_mask->field_name #define CTX \ - xfm110->base.ctx + xfm_dce->base.ctx #define IDENTITY_RATIO(ratio) (dal_fixed31_32_u2d19(ratio) == (1 << 19)) #define GAMUT_MATRIX_SIZE 12 +#define SCL_PHASES 16 enum dcp_out_trunc_round_mode { DCP_OUT_TRUNC_ROUND_MODE_TRUNCATE, @@ -88,6 +79,278 @@ enum dcp_spatial_dither_depth { DCP_SPATIAL_DITHER_DEPTH_24BPP }; +static bool setup_scaling_configuration( + struct dce_transform *xfm_dce, + const struct scaler_data *data) +{ + struct dc_context *ctx = xfm_dce->base.ctx; + + if (data->taps.h_taps + data->taps.v_taps <= 2) { + /* Set bypass */ + REG_UPDATE_2(SCL_MODE, SCL_MODE, 0, SCL_PSCL_EN, 0); + return false; + } + + REG_SET_2(SCL_TAP_CONTROL, 0, + SCL_H_NUM_OF_TAPS, data->taps.h_taps - 1, + SCL_V_NUM_OF_TAPS, data->taps.v_taps - 1); + + if (data->format <= PIXEL_FORMAT_GRPH_END) + REG_UPDATE_2(SCL_MODE, SCL_MODE, 1, SCL_PSCL_EN, 1); + else + REG_UPDATE_2(SCL_MODE, SCL_MODE, 2, SCL_PSCL_EN, 1); + + /* 1 - Replace out of bound pixels with edge */ + REG_SET(SCL_CONTROL, 0, SCL_BOUNDARY_MODE, 1); + + return true; +} + +static void program_overscan( + struct dce_transform *xfm_dce, + const struct scaler_data *data) +{ + int overscan_right = data->h_active + - data->recout.x - data->recout.width; + int overscan_bottom = data->v_active + - data->recout.y - data->recout.height; + + if (overscan_right < 0) { + BREAK_TO_DEBUGGER(); + overscan_right = 0; + } + if (overscan_bottom < 0) { + BREAK_TO_DEBUGGER(); + overscan_bottom = 0; + } + + REG_SET_2(EXT_OVERSCAN_LEFT_RIGHT, 0, + EXT_OVERSCAN_LEFT, data->recout.x, + EXT_OVERSCAN_RIGHT, overscan_right); + REG_SET_2(EXT_OVERSCAN_TOP_BOTTOM, 0, + EXT_OVERSCAN_TOP, data->recout.y, + EXT_OVERSCAN_BOTTOM, overscan_bottom); +} + +static void program_multi_taps_filter( + struct dce_transform *xfm_dce, + int taps, + const uint16_t *coeffs, + enum ram_filter_type filter_type) +{ + int phase, pair; + int array_idx = 0; + int taps_pairs = (taps + 1) / 2; + int phases_to_program = SCL_PHASES / 2 + 1; + + uint32_t power_ctl = 0; + + if (!coeffs) + return; + + /*We need to disable power gating on coeff memory to do programming*/ + if (REG(DCFE_MEM_PWR_CTRL)) { + power_ctl = REG_READ(DCFE_MEM_PWR_CTRL); + REG_SET(DCFE_MEM_PWR_CTRL, power_ctl, SCL_COEFF_MEM_PWR_DIS, 1); + + REG_WAIT(DCFE_MEM_PWR_STATUS, SCL_COEFF_MEM_PWR_STATE, 0, 1, 10); + } + for (phase = 0; phase < phases_to_program; phase++) { + /*we always program N/2 + 1 phases, total phases N, but N/2-1 are just mirror + phase 0 is unique and phase N/2 is unique if N is even*/ + for (pair = 0; pair < taps_pairs; pair++) { + uint16_t odd_coeff = 0; + uint16_t even_coeff = coeffs[array_idx]; + + REG_SET_3(SCL_COEF_RAM_SELECT, 0, + SCL_C_RAM_FILTER_TYPE, filter_type, + SCL_C_RAM_PHASE, phase, + SCL_C_RAM_TAP_PAIR_IDX, pair); + + if (taps % 2 && pair == taps_pairs - 1) + array_idx++; + else { + odd_coeff = coeffs[array_idx + 1]; + array_idx += 2; + } + + REG_SET_4(SCL_COEF_RAM_TAP_DATA, 0, + SCL_C_RAM_EVEN_TAP_COEF_EN, 1, + SCL_C_RAM_EVEN_TAP_COEF, even_coeff, + SCL_C_RAM_ODD_TAP_COEF_EN, 1, + SCL_C_RAM_ODD_TAP_COEF, odd_coeff); + } + } + + /*We need to restore power gating on coeff memory to initial state*/ + if (REG(DCFE_MEM_PWR_CTRL)) + REG_WRITE(DCFE_MEM_PWR_CTRL, power_ctl); +} + +static void program_viewport( + struct dce_transform *xfm_dce, + const struct rect *view_port) +{ + REG_SET_2(VIEWPORT_START, 0, + VIEWPORT_X_START, view_port->x, + VIEWPORT_Y_START, view_port->y); + + REG_SET_2(VIEWPORT_SIZE, 0, + VIEWPORT_HEIGHT, view_port->height, + VIEWPORT_WIDTH, view_port->width); + + /* TODO: add stereo support */ +} + +static void calculate_inits( + struct dce_transform *xfm_dce, + const struct scaler_data *data, + struct scl_ratios_inits *inits) +{ + struct fixed31_32 h_init; + struct fixed31_32 v_init; + + inits->h_int_scale_ratio = + dal_fixed31_32_u2d19(data->ratios.horz) << 5; + inits->v_int_scale_ratio = + dal_fixed31_32_u2d19(data->ratios.vert) << 5; + + h_init = + dal_fixed31_32_div_int( + dal_fixed31_32_add( + data->ratios.horz, + dal_fixed31_32_from_int(data->taps.h_taps + 1)), + 2); + inits->h_init.integer = dal_fixed31_32_floor(h_init); + inits->h_init.fraction = dal_fixed31_32_u0d19(h_init) << 5; + + v_init = + dal_fixed31_32_div_int( + dal_fixed31_32_add( + data->ratios.vert, + dal_fixed31_32_from_int(data->taps.v_taps + 1)), + 2); + inits->v_init.integer = dal_fixed31_32_floor(v_init); + inits->v_init.fraction = dal_fixed31_32_u0d19(v_init) << 5; +} + +static void program_scl_ratios_inits( + struct dce_transform *xfm_dce, + struct scl_ratios_inits *inits) +{ + + REG_SET(SCL_HORZ_FILTER_SCALE_RATIO, 0, + SCL_H_SCALE_RATIO, inits->h_int_scale_ratio); + + REG_SET(SCL_VERT_FILTER_SCALE_RATIO, 0, + SCL_V_SCALE_RATIO, inits->v_int_scale_ratio); + + REG_SET_2(SCL_HORZ_FILTER_INIT, 0, + SCL_H_INIT_INT, inits->h_init.integer, + SCL_H_INIT_FRAC, inits->h_init.fraction); + + REG_SET_2(SCL_VERT_FILTER_INIT, 0, + SCL_V_INIT_INT, inits->v_init.integer, + SCL_V_INIT_FRAC, inits->v_init.fraction); + + REG_WRITE(SCL_AUTOMATIC_MODE_CONTROL, 0); +} + +static const uint16_t *get_filter_coeffs_16p(int taps, struct fixed31_32 ratio) +{ + if (taps == 4) + return get_filter_4tap_16p(ratio); + else if (taps == 3) + return get_filter_3tap_16p(ratio); + else if (taps == 2) + return filter_2tap_16p; + else if (taps == 1) + return NULL; + else { + /* should never happen, bug */ + BREAK_TO_DEBUGGER(); + return NULL; + } +} + +static void dce_transform_set_scaler( + struct transform *xfm, + const struct scaler_data *data) +{ + struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); + bool is_scaling_required; + bool filter_updated = false; + const uint16_t *coeffs_v, *coeffs_h; + + /*Use all three pieces of memory always*/ + REG_SET_2(LB_MEMORY_CTRL, 0, + LB_MEMORY_CONFIG, 0, + LB_MEMORY_SIZE, xfm_dce->base.lb_memory_size); + + /* 1. Program overscan */ + program_overscan(xfm_dce, data); + + /* 2. Program taps and configuration */ + is_scaling_required = setup_scaling_configuration(xfm_dce, data); + + if (is_scaling_required) { + /* 3. Calculate and program ratio, filter initialization */ + struct scl_ratios_inits inits = { 0 }; + + calculate_inits(xfm_dce, data, &inits); + + program_scl_ratios_inits(xfm_dce, &inits); + + coeffs_v = get_filter_coeffs_16p(data->taps.v_taps, data->ratios.vert); + coeffs_h = get_filter_coeffs_16p(data->taps.h_taps, data->ratios.horz); + + if (coeffs_v != xfm_dce->filter_v || coeffs_h != xfm_dce->filter_h) { + /* 4. Program vertical filters */ + if (xfm_dce->filter_v == NULL) + REG_SET(SCL_VERT_FILTER_CONTROL, 0, + SCL_V_2TAP_HARDCODE_COEF_EN, 0); + program_multi_taps_filter( + xfm_dce, + data->taps.v_taps, + coeffs_v, + FILTER_TYPE_RGB_Y_VERTICAL); + program_multi_taps_filter( + xfm_dce, + data->taps.v_taps, + coeffs_v, + FILTER_TYPE_ALPHA_VERTICAL); + + /* 5. Program horizontal filters */ + if (xfm_dce->filter_h == NULL) + REG_SET(SCL_HORZ_FILTER_CONTROL, 0, + SCL_H_2TAP_HARDCODE_COEF_EN, 0); + program_multi_taps_filter( + xfm_dce, + data->taps.h_taps, + coeffs_h, + FILTER_TYPE_RGB_Y_HORIZONTAL); + program_multi_taps_filter( + xfm_dce, + data->taps.h_taps, + coeffs_h, + FILTER_TYPE_ALPHA_HORIZONTAL); + + xfm_dce->filter_v = coeffs_v; + xfm_dce->filter_h = coeffs_h; + filter_updated = true; + } + } + + /* 6. Program the viewport */ + program_viewport(xfm_dce, &data->viewport); + + /* 7. Set bit to flip to new coefficient memory */ + if (filter_updated) + REG_UPDATE(SCL_UPDATE, SCL_COEF_UPDATE_COMPLETE, 1); + + REG_UPDATE(LB_DATA_FORMAT, ALPHA_EN, data->lb_params.alpha_en); +} + /***************************************************************************** * set_clamp * @@ -98,7 +361,7 @@ enum dcp_spatial_dither_depth { * *******************************************************************************/ static void set_clamp( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, enum dc_color_depth depth) { int clamp_max = 0; @@ -175,7 +438,7 @@ static void set_clamp( ******************************************************************************/ static void set_round( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, enum dcp_out_trunc_round_mode mode, enum dcp_out_trunc_round_depth depth) { @@ -243,7 +506,7 @@ static void set_round( ******************************************************************************/ static void set_dither( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, bool dither_enable, enum dcp_spatial_dither_mode dither_mode, enum dcp_spatial_dither_depth dither_depth, @@ -295,17 +558,17 @@ static void set_dither( } /***************************************************************************** - * dce110_transform_bit_depth_reduction_program + * dce_transform_bit_depth_reduction_program * * @brief * Programs the DCP bit depth reduction registers (Clamp, Round/Truncate, - * Dither) for dce110 + * Dither) for dce * * @param depth : bit depth to set the clamp to (should match denorm) * ******************************************************************************/ static void program_bit_depth_reduction( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, enum dc_color_depth depth, const struct bit_depth_reduction_params *bit_depth_params) { @@ -332,37 +595,37 @@ static void program_bit_depth_reduction( spatial_dither_mode = DCP_SPATIAL_DITHER_MODE_A_AA_A; - set_clamp(xfm110, depth); + set_clamp(xfm_dce, depth); switch (depth_reduction_mode) { case DCP_BIT_DEPTH_REDUCTION_MODE_DITHER: /* Spatial Dither: Set round/truncate to bypass (12bit), * enable Dither (30bpp) */ - set_round(xfm110, + set_round(xfm_dce, DCP_OUT_TRUNC_ROUND_MODE_TRUNCATE, DCP_OUT_TRUNC_ROUND_DEPTH_12BIT); - set_dither(xfm110, true, spatial_dither_mode, + set_dither(xfm_dce, true, spatial_dither_mode, DCP_SPATIAL_DITHER_DEPTH_30BPP, frame_random_enable, rgb_random_enable, highpass_random_enable); break; case DCP_BIT_DEPTH_REDUCTION_MODE_ROUND: /* Round: Enable round (10bit), disable Dither */ - set_round(xfm110, + set_round(xfm_dce, DCP_OUT_TRUNC_ROUND_MODE_ROUND, DCP_OUT_TRUNC_ROUND_DEPTH_10BIT); - set_dither(xfm110, false, spatial_dither_mode, + set_dither(xfm_dce, false, spatial_dither_mode, DCP_SPATIAL_DITHER_DEPTH_30BPP, frame_random_enable, rgb_random_enable, highpass_random_enable); break; case DCP_BIT_DEPTH_REDUCTION_MODE_TRUNCATE: /* Truncate */ /* Truncate: Enable truncate (10bit), disable Dither */ - set_round(xfm110, + set_round(xfm_dce, DCP_OUT_TRUNC_ROUND_MODE_TRUNCATE, DCP_OUT_TRUNC_ROUND_DEPTH_10BIT); - set_dither(xfm110, false, spatial_dither_mode, + set_dither(xfm_dce, false, spatial_dither_mode, DCP_SPATIAL_DITHER_DEPTH_30BPP, frame_random_enable, rgb_random_enable, highpass_random_enable); break; @@ -370,11 +633,11 @@ static void program_bit_depth_reduction( case DCP_BIT_DEPTH_REDUCTION_MODE_DISABLED: /* Disabled */ /* Truncate: Set round/truncate to bypass (12bit), * disable Dither */ - set_round(xfm110, + set_round(xfm_dce, DCP_OUT_TRUNC_ROUND_MODE_TRUNCATE, DCP_OUT_TRUNC_ROUND_DEPTH_12BIT); - set_dither(xfm110, false, spatial_dither_mode, + set_dither(xfm_dce, false, spatial_dither_mode, DCP_SPATIAL_DITHER_DEPTH_30BPP, frame_random_enable, rgb_random_enable, highpass_random_enable); break; @@ -385,7 +648,7 @@ static void program_bit_depth_reduction( } } -static int dce110_transform_get_max_num_of_supported_lines( +static int dce_transform_get_max_num_of_supported_lines( struct transform *xfm, enum lb_pixel_depth depth, int pixel_width) @@ -433,7 +696,7 @@ static int dce110_transform_get_max_num_of_supported_lines( } static void set_denormalization( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, enum dc_color_depth depth) { int denorm_mode = 0; @@ -466,12 +729,12 @@ static void set_denormalization( REG_SET(DENORM_CONTROL, 0, DENORM_MODE, denorm_mode); } -static void dce110_transform_set_pixel_storage_depth( +static void dce_transform_set_pixel_storage_depth( struct transform *xfm, enum lb_pixel_depth depth, const struct bit_depth_reduction_params *bit_depth_params) { - struct dce110_transform *xfm110 = TO_DCE110_TRANSFORM(xfm); + struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); int pixel_depth, expan_mode; enum dc_color_depth color_depth; @@ -504,14 +767,14 @@ static void dce110_transform_set_pixel_storage_depth( break; } - set_denormalization(xfm110, color_depth); - program_bit_depth_reduction(xfm110, color_depth, bit_depth_params); + set_denormalization(xfm_dce, color_depth); + program_bit_depth_reduction(xfm_dce, color_depth, bit_depth_params); REG_UPDATE_2(LB_DATA_FORMAT, PIXEL_DEPTH, pixel_depth, PIXEL_EXPAN_MODE, expan_mode); - if (!(xfm110->lb_pixel_depth_supported & depth)) { + if (!(xfm_dce->lb_pixel_depth_supported & depth)) { /*we should use unsupported capabilities * unless it is required by w/a*/ dm_logger_write(xfm->ctx->logger, LOG_WARNING, @@ -521,7 +784,7 @@ static void dce110_transform_set_pixel_storage_depth( } static void program_gamut_remap( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, const uint16_t *reg_val) { if (reg_val) { @@ -565,15 +828,15 @@ static void program_gamut_remap( * ***************************************************************************** */ -void dce110_transform_set_gamut_remap( +static void dce_transform_set_gamut_remap( struct transform *xfm, const struct xfm_grph_csc_adjustment *adjust) { - struct dce110_transform *xfm110 = TO_DCE110_TRANSFORM(xfm); + struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); if (adjust->gamut_adjust_type != GRAPHICS_GAMUT_ADJUST_TYPE_SW) /* Bypass if type is bypass or hw */ - program_gamut_remap(xfm110, NULL); + program_gamut_remap(xfm_dce, NULL); else { struct fixed31_32 arr_matrix[GAMUT_MATRIX_SIZE]; uint16_t arr_reg_val[GAMUT_MATRIX_SIZE]; @@ -596,7 +859,7 @@ void dce110_transform_set_gamut_remap( convert_float_matrix( arr_reg_val, arr_matrix, GAMUT_MATRIX_SIZE); - program_gamut_remap(xfm110, arr_reg_val); + program_gamut_remap(xfm_dce, arr_reg_val); } } @@ -622,20 +885,20 @@ static uint32_t decide_taps(struct fixed31_32 ratio, uint32_t in_taps, bool chro } -bool dce110_transform_get_optimal_number_of_taps( +bool dce_transform_get_optimal_number_of_taps( struct transform *xfm, struct scaler_data *scl_data, const struct scaling_taps *in_taps) { - struct dce110_transform *xfm110 = TO_DCE110_TRANSFORM(xfm); + struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); int pixel_width = scl_data->viewport.width; int max_num_of_lines; - if (xfm110->prescaler_on && + if (xfm_dce->prescaler_on && (scl_data->viewport.width > scl_data->recout.width)) pixel_width = scl_data->recout.width; - max_num_of_lines = dce110_transform_get_max_num_of_supported_lines( + max_num_of_lines = dce_transform_get_max_num_of_supported_lines( xfm, scl_data->lb_params.depth, pixel_width); @@ -684,58 +947,58 @@ bool dce110_transform_get_optimal_number_of_taps( return true; } -static void dce110_transform_reset(struct transform *xfm) +static void dce_transform_reset(struct transform *xfm) { - struct dce110_transform *xfm110 = TO_DCE110_TRANSFORM(xfm); + struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); - xfm110->filter_h = NULL; - xfm110->filter_v = NULL; + xfm_dce->filter_h = NULL; + xfm_dce->filter_v = NULL; } -static const struct transform_funcs dce110_transform_funcs = { - .transform_reset = dce110_transform_reset, +static const struct transform_funcs dce_transform_funcs = { + .transform_reset = dce_transform_reset, .transform_set_scaler = - dce110_transform_set_scaler, + dce_transform_set_scaler, .transform_set_gamut_remap = - dce110_transform_set_gamut_remap, + dce_transform_set_gamut_remap, .transform_set_pixel_storage_depth = - dce110_transform_set_pixel_storage_depth, + dce_transform_set_pixel_storage_depth, .transform_get_optimal_number_of_taps = - dce110_transform_get_optimal_number_of_taps + dce_transform_get_optimal_number_of_taps }; /*****************************************/ /* Constructor, Destructor */ /*****************************************/ -bool dce110_transform_construct( - struct dce110_transform *xfm110, +bool dce_transform_construct( + struct dce_transform *xfm_dce, struct dc_context *ctx, uint32_t inst, - const struct dce110_transform_registers *regs, - const struct dce110_transform_shift *xfm_shift, - const struct dce110_transform_mask *xfm_mask) + const struct dce_transform_registers *regs, + const struct dce_transform_shift *xfm_shift, + const struct dce_transform_mask *xfm_mask) { - xfm110->base.ctx = ctx; + xfm_dce->base.ctx = ctx; - xfm110->base.inst = inst; - xfm110->base.funcs = &dce110_transform_funcs; + xfm_dce->base.inst = inst; + xfm_dce->base.funcs = &dce_transform_funcs; - xfm110->regs = regs; - xfm110->xfm_shift = xfm_shift; - xfm110->xfm_mask = xfm_mask; + xfm_dce->regs = regs; + xfm_dce->xfm_shift = xfm_shift; + xfm_dce->xfm_mask = xfm_mask; - xfm110->prescaler_on = true; - xfm110->lb_pixel_depth_supported = + xfm_dce->prescaler_on = true; + xfm_dce->lb_pixel_depth_supported = LB_PIXEL_DEPTH_18BPP | LB_PIXEL_DEPTH_24BPP | LB_PIXEL_DEPTH_30BPP; - xfm110->base.lb_bits_per_entry = LB_BITS_PER_ENTRY; - xfm110->base.lb_total_entries_num = LB_TOTAL_NUMBER_OF_ENTRIES; + xfm_dce->base.lb_bits_per_entry = LB_BITS_PER_ENTRY; + xfm_dce->base.lb_total_entries_num = LB_TOTAL_NUMBER_OF_ENTRIES; - xfm110->base.lb_memory_size = 0x6B0; /*1712*/ + xfm_dce->base.lb_memory_size = 0x6B0; /*1712*/ return true; } diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform.h b/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.h similarity index 87% rename from drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform.h rename to drivers/gpu/drm/amd/dal/dc/dce/dce_transform.h index aa7104b70152..b793ddda4783 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform.h +++ b/drivers/gpu/drm/amd/dal/dc/dce/dce_transform.h @@ -1,4 +1,5 @@ -/* Copyright 2012-15 Advanced Micro Devices, Inc. +/* + * Copyright 2012-16 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -22,13 +23,14 @@ * */ -#ifndef __DAL_TRANSFORM_DCE110_H__ -#define __DAL_TRANSFORM_DCE110_H__ +#ifndef _DCE_DCE_TRANSFORM_H_ +#define _DCE_DCE_TRANSFORM_H_ + #include "transform.h" -#define TO_DCE110_TRANSFORM(transform)\ - container_of(transform, struct dce110_transform, base) +#define TO_DCE_TRANSFORM(transform)\ + container_of(transform, struct dce_transform, base) #define LB_TOTAL_NUMBER_OF_ENTRIES 1712 #define LB_BITS_PER_ENTRY 144 @@ -213,15 +215,15 @@ type SCL_COEF_UPDATE_COMPLETE; \ type ALPHA_EN -struct dce110_transform_shift { +struct dce_transform_shift { XFM_REG_FIELD_LIST(uint8_t); }; -struct dce110_transform_mask { +struct dce_transform_mask { XFM_REG_FIELD_LIST(uint32_t); }; -struct dce110_transform_registers { +struct dce_transform_registers { uint32_t LB_DATA_FORMAT; uint32_t GAMUT_REMAP_CONTROL; uint32_t GAMUT_REMAP_C11_C12; @@ -258,11 +260,32 @@ struct dce110_transform_registers { uint32_t SCL_UPDATE; }; -struct dce110_transform { +struct init_int_and_frac { + uint32_t integer; + uint32_t fraction; +}; + +struct scl_ratios_inits { + uint32_t h_int_scale_ratio; + uint32_t v_int_scale_ratio; + struct init_int_and_frac h_init; + struct init_int_and_frac v_init; +}; + +enum ram_filter_type { + FILTER_TYPE_RGB_Y_VERTICAL = 0, /* 0 - RGB/Y Vertical filter */ + FILTER_TYPE_CBCR_VERTICAL = 1, /* 1 - CbCr Vertical filter */ + FILTER_TYPE_RGB_Y_HORIZONTAL = 2, /* 1 - RGB/Y Horizontal filter */ + FILTER_TYPE_CBCR_HORIZONTAL = 3, /* 3 - CbCr Horizontal filter */ + FILTER_TYPE_ALPHA_VERTICAL = 4, /* 4 - Alpha Vertical filter. */ + FILTER_TYPE_ALPHA_HORIZONTAL = 5, /* 5 - Alpha Horizontal filter. */ +}; + +struct dce_transform { struct transform base; - const struct dce110_transform_registers *regs; - const struct dce110_transform_shift *xfm_shift; - const struct dce110_transform_mask *xfm_mask; + const struct dce_transform_registers *regs; + const struct dce_transform_shift *xfm_shift; + const struct dce_transform_mask *xfm_mask; const uint16_t *filter_v; const uint16_t *filter_h; @@ -272,20 +295,17 @@ struct dce110_transform { bool prescaler_on; }; -bool dce110_transform_construct(struct dce110_transform *xfm110, +bool dce_transform_construct(struct dce_transform *xfm110, struct dc_context *ctx, uint32_t inst, - const struct dce110_transform_registers *regs, - const struct dce110_transform_shift *xfm_shift, - const struct dce110_transform_mask *xfm_mask); + const struct dce_transform_registers *regs, + const struct dce_transform_shift *xfm_shift, + const struct dce_transform_mask *xfm_mask); -void dce110_transform_set_scaler( - struct transform *xfm, - const struct scaler_data *data); - -bool dce110_transform_get_optimal_number_of_taps( +bool dce_transform_get_optimal_number_of_taps( struct transform *xfm, struct scaler_data *scl_data, const struct scaling_taps *in_taps); -#endif + +#endif /* _DCE_DCE_TRANSFORM_H_ */ diff --git a/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c b/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c index 951d8fb31914..6c17a52df574 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c +++ b/drivers/gpu/drm/amd/dal/dc/dce100/dce100_resource.c @@ -39,7 +39,7 @@ #include "dce110/dce110_mem_input.h" #include "dce110/dce110_mem_input_v.h" #include "dce110/dce110_ipp.h" -#include "dce110/dce110_transform.h" +#include "dce/dce_transform.h" #include "dce110/dce110_opp.h" #include "dce110/dce110_clock_source.h" #include "dce/dce_audio.h" @@ -216,7 +216,7 @@ static const struct dce110_ipp_reg_offsets dce100_ipp_reg_offsets[] = { XFM_COMMON_REG_LIST_DCE100(id)\ } -static const struct dce110_transform_registers xfm_regs[] = { +static const struct dce_transform_registers xfm_regs[] = { transform_regs(0), transform_regs(1), transform_regs(2), @@ -225,11 +225,11 @@ static const struct dce110_transform_registers xfm_regs[] = { transform_regs(5) }; -static const struct dce110_transform_shift xfm_shift = { +static const struct dce_transform_shift xfm_shift = { XFM_COMMON_MASK_SH_LIST_DCE110(__SHIFT) }; -static const struct dce110_transform_mask xfm_mask = { +static const struct dce_transform_mask xfm_mask = { XFM_COMMON_MASK_SH_LIST_DCE110(_MASK) }; @@ -516,7 +516,7 @@ static struct mem_input *dce100_mem_input_create( static void dce100_transform_destroy(struct transform **xfm) { - dm_free(TO_DCE110_TRANSFORM(*xfm)); + dm_free(TO_DCE_TRANSFORM(*xfm)); *xfm = NULL; } @@ -524,13 +524,13 @@ static struct transform *dce100_transform_create( struct dc_context *ctx, uint32_t inst) { - struct dce110_transform *transform = - dm_alloc(sizeof(struct dce110_transform)); + struct dce_transform *transform = + dm_alloc(sizeof(struct dce_transform)); if (!transform) return NULL; - if (dce110_transform_construct(transform, ctx, inst, + if (dce_transform_construct(transform, ctx, inst, &xfm_regs[inst], &xfm_shift, &xfm_mask)) { transform->base.lb_memory_size = 0x6B0; /*1712*/ return &transform->base; diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/Makefile b/drivers/gpu/drm/amd/dal/dc/dce110/Makefile index 83d83df4e07b..cb6bb24e6298 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce110/Makefile +++ b/drivers/gpu/drm/amd/dal/dc/dce110/Makefile @@ -5,11 +5,10 @@ DCE110 = dce110_ipp.o dce110_ipp_cursor.o \ dce110_ipp_gamma.o dce110_opp.o dce110_opp_csc.o \ dce110_timing_generator.o dce110_opp_formatter.o dce110_opp_regamma.o \ -dce110_transform.o dce110_transform_scl.o dce110_transform_v.o \ dce110_compressor.o dce110_mem_input.o dce110_hw_sequencer.o \ dce110_resource.o dce110_clock_source.o \ dce110_opp_regamma_v.o dce110_opp_csc_v.o dce110_timing_generator_v.o \ -dce110_mem_input_v.o dce110_opp_v.o +dce110_mem_input_v.o dce110_opp_v.o dce110_transform_v.o AMD_DAL_DCE110 = $(addprefix $(AMDDALPATH)/dc/dce110/,$(DCE110)) diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c index 802e22f263b3..7731f80db2fb 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c +++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_resource.c @@ -41,7 +41,7 @@ #include "dce110/dce110_mem_input.h" #include "dce110/dce110_mem_input_v.h" #include "dce110/dce110_ipp.h" -#include "dce110/dce110_transform.h" +#include "dce/dce_transform.h" #include "dce110/dce110_transform_v.h" #include "dce110/dce110_opp.h" #include "dce110/dce110_opp_v.h" @@ -188,17 +188,17 @@ static const struct dce110_ipp_reg_offsets dce110_ipp_reg_offsets[] = { XFM_COMMON_REG_LIST_DCE110(id)\ } -static const struct dce110_transform_registers xfm_regs[] = { +static const struct dce_transform_registers xfm_regs[] = { transform_regs(0), transform_regs(1), transform_regs(2) }; -static const struct dce110_transform_shift xfm_shift = { +static const struct dce_transform_shift xfm_shift = { XFM_COMMON_MASK_SH_LIST_DCE110(__SHIFT) }; -static const struct dce110_transform_mask xfm_mask = { +static const struct dce_transform_mask xfm_mask = { XFM_COMMON_MASK_SH_LIST_DCE110(_MASK) }; @@ -506,7 +506,7 @@ static struct mem_input *dce110_mem_input_create( static void dce110_transform_destroy(struct transform **xfm) { - dm_free(TO_DCE110_TRANSFORM(*xfm)); + dm_free(TO_DCE_TRANSFORM(*xfm)); *xfm = NULL; } @@ -514,13 +514,13 @@ static struct transform *dce110_transform_create( struct dc_context *ctx, uint32_t inst) { - struct dce110_transform *transform = - dm_alloc(sizeof(struct dce110_transform)); + struct dce_transform *transform = + dm_alloc(sizeof(struct dce_transform)); if (!transform) return NULL; - if (dce110_transform_construct(transform, ctx, inst, + if (dce_transform_construct(transform, ctx, inst, &xfm_regs[inst], &xfm_shift, &xfm_mask)) return &transform->base; @@ -1094,7 +1094,7 @@ static const struct resource_funcs dce110_res_pool_funcs = { static void underlay_create(struct dc_context *ctx, struct resource_pool *pool) { struct dce110_timing_generator *dce110_tgv = dm_alloc(sizeof (*dce110_tgv)); - struct dce110_transform *dce110_xfmv = dm_alloc(sizeof (*dce110_xfmv)); + struct dce_transform *dce110_xfmv = dm_alloc(sizeof (*dce110_xfmv)); struct dce110_mem_input *dce110_miv = dm_alloc(sizeof (*dce110_miv)); struct dce110_opp *dce110_oppv = dm_alloc(sizeof (*dce110_oppv)); diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_scl.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_scl.c deleted file mode 100644 index 3a782e7a1b60..000000000000 --- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_scl.c +++ /dev/null @@ -1,313 +0,0 @@ -/* - * Copyright 2012-15 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: AMD - * - */ - -#include "dm_services.h" -#include "reg_helper.h" -#include "dce110_transform.h" - -#define SCL_PHASES 16 - -#define REG(reg) \ - (xfm110->regs->reg) - -#undef FN -#define FN(reg_name, field_name) \ - xfm110->xfm_shift->field_name, xfm110->xfm_mask->field_name - -#define CTX \ - xfm110->base.ctx - - -static bool setup_scaling_configuration( - struct dce110_transform *xfm110, - const struct scaler_data *data) -{ - struct dc_context *ctx = xfm110->base.ctx; - - if (data->taps.h_taps + data->taps.v_taps <= 2) { - /* Set bypass */ - REG_UPDATE_2(SCL_MODE, SCL_MODE, 0, SCL_PSCL_EN, 0); - return false; - } - - REG_SET_2(SCL_TAP_CONTROL, 0, - SCL_H_NUM_OF_TAPS, data->taps.h_taps - 1, - SCL_V_NUM_OF_TAPS, data->taps.v_taps - 1); - - if (data->format <= PIXEL_FORMAT_GRPH_END) - REG_UPDATE_2(SCL_MODE, SCL_MODE, 1, SCL_PSCL_EN, 1); - else - REG_UPDATE_2(SCL_MODE, SCL_MODE, 2, SCL_PSCL_EN, 1); - - /* 1 - Replace out of bound pixels with edge */ - REG_SET(SCL_CONTROL, 0, SCL_BOUNDARY_MODE, 1); - - return true; -} - -static void program_overscan( - struct dce110_transform *xfm110, - const struct scaler_data *data) -{ - int overscan_right = data->h_active - - data->recout.x - data->recout.width; - int overscan_bottom = data->v_active - - data->recout.y - data->recout.height; - - if (overscan_right < 0) { - BREAK_TO_DEBUGGER(); - overscan_right = 0; - } - if (overscan_bottom < 0) { - BREAK_TO_DEBUGGER(); - overscan_bottom = 0; - } - - REG_SET_2(EXT_OVERSCAN_LEFT_RIGHT, 0, - EXT_OVERSCAN_LEFT, data->recout.x, - EXT_OVERSCAN_RIGHT, overscan_right); - REG_SET_2(EXT_OVERSCAN_TOP_BOTTOM, 0, - EXT_OVERSCAN_TOP, data->recout.y, - EXT_OVERSCAN_BOTTOM, overscan_bottom); -} - -static void program_multi_taps_filter( - struct dce110_transform *xfm110, - int taps, - const uint16_t *coeffs, - enum ram_filter_type filter_type) -{ - int phase, pair; - int array_idx = 0; - int taps_pairs = (taps + 1) / 2; - int phases_to_program = SCL_PHASES / 2 + 1; - - uint32_t power_ctl = 0; - - if (!coeffs) - return; - - /*We need to disable power gating on coeff memory to do programming*/ - if (REG(DCFE_MEM_PWR_CTRL)) { - power_ctl = REG_READ(DCFE_MEM_PWR_CTRL); - REG_SET(DCFE_MEM_PWR_CTRL, power_ctl, SCL_COEFF_MEM_PWR_DIS, 1); - - REG_WAIT(DCFE_MEM_PWR_STATUS, SCL_COEFF_MEM_PWR_STATE, 0, 1, 10); - } - for (phase = 0; phase < phases_to_program; phase++) { - /*we always program N/2 + 1 phases, total phases N, but N/2-1 are just mirror - phase 0 is unique and phase N/2 is unique if N is even*/ - for (pair = 0; pair < taps_pairs; pair++) { - uint16_t odd_coeff = 0; - uint16_t even_coeff = coeffs[array_idx]; - - REG_SET_3(SCL_COEF_RAM_SELECT, 0, - SCL_C_RAM_FILTER_TYPE, filter_type, - SCL_C_RAM_PHASE, phase, - SCL_C_RAM_TAP_PAIR_IDX, pair); - - if (taps % 2 && pair == taps_pairs - 1) - array_idx++; - else { - odd_coeff = coeffs[array_idx + 1]; - array_idx += 2; - } - - REG_SET_4(SCL_COEF_RAM_TAP_DATA, 0, - SCL_C_RAM_EVEN_TAP_COEF_EN, 1, - SCL_C_RAM_EVEN_TAP_COEF, even_coeff, - SCL_C_RAM_ODD_TAP_COEF_EN, 1, - SCL_C_RAM_ODD_TAP_COEF, odd_coeff); - } - } - - /*We need to restore power gating on coeff memory to initial state*/ - if (REG(DCFE_MEM_PWR_CTRL)) - REG_WRITE(DCFE_MEM_PWR_CTRL, power_ctl); -} - -static void program_viewport( - struct dce110_transform *xfm110, - const struct rect *view_port) -{ - REG_SET_2(VIEWPORT_START, 0, - VIEWPORT_X_START, view_port->x, - VIEWPORT_Y_START, view_port->y); - - REG_SET_2(VIEWPORT_SIZE, 0, - VIEWPORT_HEIGHT, view_port->height, - VIEWPORT_WIDTH, view_port->width); - - /* TODO: add stereo support */ -} - -static void calculate_inits( - struct dce110_transform *xfm110, - const struct scaler_data *data, - struct scl_ratios_inits *inits) -{ - struct fixed31_32 h_init; - struct fixed31_32 v_init; - - inits->h_int_scale_ratio = - dal_fixed31_32_u2d19(data->ratios.horz) << 5; - inits->v_int_scale_ratio = - dal_fixed31_32_u2d19(data->ratios.vert) << 5; - - h_init = - dal_fixed31_32_div_int( - dal_fixed31_32_add( - data->ratios.horz, - dal_fixed31_32_from_int(data->taps.h_taps + 1)), - 2); - inits->h_init.integer = dal_fixed31_32_floor(h_init); - inits->h_init.fraction = dal_fixed31_32_u0d19(h_init) << 5; - - v_init = - dal_fixed31_32_div_int( - dal_fixed31_32_add( - data->ratios.vert, - dal_fixed31_32_from_int(data->taps.v_taps + 1)), - 2); - inits->v_init.integer = dal_fixed31_32_floor(v_init); - inits->v_init.fraction = dal_fixed31_32_u0d19(v_init) << 5; -} - -static void program_scl_ratios_inits( - struct dce110_transform *xfm110, - struct scl_ratios_inits *inits) -{ - - REG_SET(SCL_HORZ_FILTER_SCALE_RATIO, 0, - SCL_H_SCALE_RATIO, inits->h_int_scale_ratio); - - REG_SET(SCL_VERT_FILTER_SCALE_RATIO, 0, - SCL_V_SCALE_RATIO, inits->v_int_scale_ratio); - - REG_SET_2(SCL_HORZ_FILTER_INIT, 0, - SCL_H_INIT_INT, inits->h_init.integer, - SCL_H_INIT_FRAC, inits->h_init.fraction); - - REG_SET_2(SCL_VERT_FILTER_INIT, 0, - SCL_V_INIT_INT, inits->v_init.integer, - SCL_V_INIT_FRAC, inits->v_init.fraction); - - REG_WRITE(SCL_AUTOMATIC_MODE_CONTROL, 0); -} - -static const uint16_t *get_filter_coeffs_16p(int taps, struct fixed31_32 ratio) -{ - if (taps == 4) - return get_filter_4tap_16p(ratio); - else if (taps == 3) - return get_filter_3tap_16p(ratio); - else if (taps == 2) - return filter_2tap_16p; - else if (taps == 1) - return NULL; - else { - /* should never happen, bug */ - BREAK_TO_DEBUGGER(); - return NULL; - } -} - -void dce110_transform_set_scaler( - struct transform *xfm, - const struct scaler_data *data) -{ - struct dce110_transform *xfm110 = TO_DCE110_TRANSFORM(xfm); - bool is_scaling_required; - bool filter_updated = false; - const uint16_t *coeffs_v, *coeffs_h; - - /*Use all three pieces of memory always*/ - REG_SET_2(LB_MEMORY_CTRL, 0, - LB_MEMORY_CONFIG, 0, - LB_MEMORY_SIZE, xfm110->base.lb_memory_size); - - /* 1. Program overscan */ - program_overscan(xfm110, data); - - /* 2. Program taps and configuration */ - is_scaling_required = setup_scaling_configuration(xfm110, data); - - if (is_scaling_required) { - /* 3. Calculate and program ratio, filter initialization */ - struct scl_ratios_inits inits = { 0 }; - - calculate_inits(xfm110, data, &inits); - - program_scl_ratios_inits(xfm110, &inits); - - coeffs_v = get_filter_coeffs_16p(data->taps.v_taps, data->ratios.vert); - coeffs_h = get_filter_coeffs_16p(data->taps.h_taps, data->ratios.horz); - - if (coeffs_v != xfm110->filter_v || coeffs_h != xfm110->filter_h) { - /* 4. Program vertical filters */ - if (xfm110->filter_v == NULL) - REG_SET(SCL_VERT_FILTER_CONTROL, 0, - SCL_V_2TAP_HARDCODE_COEF_EN, 0); - program_multi_taps_filter( - xfm110, - data->taps.v_taps, - coeffs_v, - FILTER_TYPE_RGB_Y_VERTICAL); - program_multi_taps_filter( - xfm110, - data->taps.v_taps, - coeffs_v, - FILTER_TYPE_ALPHA_VERTICAL); - - /* 5. Program horizontal filters */ - if (xfm110->filter_h == NULL) - REG_SET(SCL_HORZ_FILTER_CONTROL, 0, - SCL_H_2TAP_HARDCODE_COEF_EN, 0); - program_multi_taps_filter( - xfm110, - data->taps.h_taps, - coeffs_h, - FILTER_TYPE_RGB_Y_HORIZONTAL); - program_multi_taps_filter( - xfm110, - data->taps.h_taps, - coeffs_h, - FILTER_TYPE_ALPHA_HORIZONTAL); - - xfm110->filter_v = coeffs_v; - xfm110->filter_h = coeffs_h; - filter_updated = true; - } - } - - /* 6. Program the viewport */ - program_viewport(xfm110, &data->viewport); - - /* 7. Set bit to flip to new coefficient memory */ - if (filter_updated) - REG_UPDATE(SCL_UPDATE, SCL_COEF_UPDATE_COMPLETE, 1); - - REG_UPDATE(LB_DATA_FORMAT, ALPHA_EN, data->lb_params.alpha_en); -} diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c index 497694721023..4f2aa7722961 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c +++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.c @@ -22,12 +22,9 @@ * Authors: AMD * */ -#include "dm_services.h" -#include "dc_types.h" -#include "core_types.h" #include "dce110_transform_v.h" - +#include "dm_services.h" #include "dce/dce_11_0_d.h" #include "dce/dce_11_0_sh_mask.h" @@ -75,11 +72,11 @@ static void calculate_viewport( } static void program_viewport( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, struct rect *luma_view_port, struct rect *chroma_view_port) { - struct dc_context *ctx = xfm110->base.ctx; + struct dc_context *ctx = xfm_dce->base.ctx; uint32_t value = 0; uint32_t addr = 0; @@ -155,11 +152,11 @@ static void program_viewport( * void */ static bool setup_scaling_configuration( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, const struct scaler_data *data) { bool is_scaling_needed = false; - struct dc_context *ctx = xfm110->base.ctx; + struct dc_context *ctx = xfm_dce->base.ctx; uint32_t value = 0; set_reg_field_value(value, data->taps.h_taps - 1, @@ -226,7 +223,7 @@ static bool setup_scaling_configuration( void */ static void program_overscan( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, const struct scaler_data *data) { uint32_t overscan_left_right = 0; @@ -256,32 +253,32 @@ static void program_overscan( set_reg_field_value(overscan_top_bottom, overscan_bottom, EXT_OVERSCAN_TOP_BOTTOM, EXT_OVERSCAN_BOTTOM); - dm_write_reg(xfm110->base.ctx, + dm_write_reg(xfm_dce->base.ctx, mmSCLV_EXT_OVERSCAN_LEFT_RIGHT, overscan_left_right); - dm_write_reg(xfm110->base.ctx, + dm_write_reg(xfm_dce->base.ctx, mmSCLV_EXT_OVERSCAN_TOP_BOTTOM, overscan_top_bottom); } static void set_coeff_update_complete( - struct dce110_transform *xfm110) + struct dce_transform *xfm_dce) { uint32_t value; - value = dm_read_reg(xfm110->base.ctx, mmSCLV_UPDATE); + value = dm_read_reg(xfm_dce->base.ctx, mmSCLV_UPDATE); set_reg_field_value(value, 1, SCLV_UPDATE, SCL_COEF_UPDATE_COMPLETE); - dm_write_reg(xfm110->base.ctx, mmSCLV_UPDATE, value); + dm_write_reg(xfm_dce->base.ctx, mmSCLV_UPDATE, value); } static void program_multi_taps_filter( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, int taps, const uint16_t *coeffs, enum ram_filter_type filter_type) { - struct dc_context *ctx = xfm110->base.ctx; + struct dc_context *ctx = xfm_dce->base.ctx; int i, phase, pair; int array_idx = 0; int taps_pairs = (taps + 1) / 2; @@ -361,7 +358,7 @@ static void program_multi_taps_filter( } static void calculate_inits( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, const struct scaler_data *data, struct sclv_ratios_inits *inits, struct rect *luma_viewport, @@ -383,10 +380,10 @@ static void calculate_inits( } static void program_scl_ratios_inits( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, struct sclv_ratios_inits *inits) { - struct dc_context *ctx = xfm110->base.ctx; + struct dc_context *ctx = xfm_dce->base.ctx; uint32_t addr = mmSCLV_HORZ_FILTER_SCALE_RATIO; uint32_t value = 0; @@ -498,18 +495,18 @@ static const uint16_t *get_filter_coeffs_64p(int taps, struct fixed31_32 ratio) static bool dce110_xfmv_power_up_line_buffer(struct transform *xfm) { - struct dce110_transform *xfm110 = TO_DCE110_TRANSFORM(xfm); + struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); uint32_t value; - value = dm_read_reg(xfm110->base.ctx, mmLBV_MEMORY_CTRL); + value = dm_read_reg(xfm_dce->base.ctx, mmLBV_MEMORY_CTRL); /*Use all three pieces of memory always*/ set_reg_field_value(value, 0, LBV_MEMORY_CTRL, LB_MEMORY_CONFIG); /*hard coded number DCE11 1712(0x6B0) Partitions: 720/960/1712*/ - set_reg_field_value(value, xfm110->base.lb_memory_size, LBV_MEMORY_CTRL, + set_reg_field_value(value, xfm_dce->base.lb_memory_size, LBV_MEMORY_CTRL, LB_MEMORY_SIZE); - dm_write_reg(xfm110->base.ctx, mmLBV_MEMORY_CTRL, value); + dm_write_reg(xfm_dce->base.ctx, mmLBV_MEMORY_CTRL, value); return true; } @@ -518,7 +515,7 @@ static void dce110_xfmv_set_scaler( struct transform *xfm, const struct scaler_data *data) { - struct dce110_transform *xfm110 = TO_DCE110_TRANSFORM(xfm); + struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); bool is_scaling_required = false; bool filter_updated = false; const uint16_t *coeffs_v, *coeffs_h, *coeffs_h_c, *coeffs_v_c; @@ -533,10 +530,10 @@ static void dce110_xfmv_set_scaler( calculate_viewport(data, &luma_viewport, &chroma_viewport); /* 2. Program overscan */ - program_overscan(xfm110, data); + program_overscan(xfm_dce, data); /* 3. Program taps and configuration */ - is_scaling_required = setup_scaling_configuration(xfm110, data); + is_scaling_required = setup_scaling_configuration(xfm_dce, data); if (is_scaling_required) { /* 4. Calculate and program ratio, filter initialization */ @@ -544,71 +541,71 @@ static void dce110_xfmv_set_scaler( struct sclv_ratios_inits inits = { 0 }; calculate_inits( - xfm110, + xfm_dce, data, &inits, &luma_viewport, &chroma_viewport); - program_scl_ratios_inits(xfm110, &inits); + program_scl_ratios_inits(xfm_dce, &inits); coeffs_v = get_filter_coeffs_64p(data->taps.v_taps, data->ratios.vert); coeffs_h = get_filter_coeffs_64p(data->taps.h_taps, data->ratios.horz); coeffs_v_c = get_filter_coeffs_64p(data->taps.v_taps_c, data->ratios.vert_c); coeffs_h_c = get_filter_coeffs_64p(data->taps.h_taps_c, data->ratios.horz_c); - if (coeffs_v != xfm110->filter_v - || coeffs_v_c != xfm110->filter_v_c - || coeffs_h != xfm110->filter_h - || coeffs_h_c != xfm110->filter_h_c) { + if (coeffs_v != xfm_dce->filter_v + || coeffs_v_c != xfm_dce->filter_v_c + || coeffs_h != xfm_dce->filter_h + || coeffs_h_c != xfm_dce->filter_h_c) { /* 5. Program vertical filters */ program_multi_taps_filter( - xfm110, + xfm_dce, data->taps.v_taps, coeffs_v, FILTER_TYPE_RGB_Y_VERTICAL); program_multi_taps_filter( - xfm110, + xfm_dce, data->taps.v_taps_c, coeffs_v_c, FILTER_TYPE_CBCR_VERTICAL); /* 6. Program horizontal filters */ program_multi_taps_filter( - xfm110, + xfm_dce, data->taps.h_taps, coeffs_h, FILTER_TYPE_RGB_Y_HORIZONTAL); program_multi_taps_filter( - xfm110, + xfm_dce, data->taps.h_taps_c, coeffs_h_c, FILTER_TYPE_CBCR_HORIZONTAL); - xfm110->filter_v = coeffs_v; - xfm110->filter_v_c = coeffs_v_c; - xfm110->filter_h = coeffs_h; - xfm110->filter_h_c = coeffs_h_c; + xfm_dce->filter_v = coeffs_v; + xfm_dce->filter_v_c = coeffs_v_c; + xfm_dce->filter_h = coeffs_h; + xfm_dce->filter_h_c = coeffs_h_c; filter_updated = true; } } /* 7. Program the viewport */ - program_viewport(xfm110, &luma_viewport, &chroma_viewport); + program_viewport(xfm_dce, &luma_viewport, &chroma_viewport); /* 8. Set bit to flip to new coefficient memory */ if (filter_updated) - set_coeff_update_complete(xfm110); + set_coeff_update_complete(xfm_dce); } static void dce110_xfmv_reset(struct transform *xfm) { - struct dce110_transform *xfm110 = TO_DCE110_TRANSFORM(xfm); + struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); - xfm110->filter_h = NULL; - xfm110->filter_v = NULL; - xfm110->filter_h_c = NULL; - xfm110->filter_v_c = NULL; + xfm_dce->filter_h = NULL; + xfm_dce->filter_v = NULL; + xfm_dce->filter_h_c = NULL; + xfm_dce->filter_v_c = NULL; } static void dce110_xfmv_set_gamut_remap( @@ -623,7 +620,7 @@ static void dce110_xfmv_set_pixel_storage_depth( enum lb_pixel_depth depth, const struct bit_depth_reduction_params *bit_depth_params) { - struct dce110_transform *xfm110 = TO_DCE110_TRANSFORM(xfm); + struct dce_transform *xfm_dce = TO_DCE_TRANSFORM(xfm); int pixel_depth, expan_mode; uint32_t reg_data = 0; @@ -663,7 +660,7 @@ static void dce110_xfmv_set_pixel_storage_depth( dm_write_reg(xfm->ctx, mmLBV_DATA_FORMAT, reg_data); - if (!(xfm110->lb_pixel_depth_supported & depth)) { + if (!(xfm_dce->lb_pixel_depth_supported & depth)) { /*we should use unsupported capabilities * unless it is required by w/a*/ dm_logger_write(xfm->ctx->logger, LOG_WARNING, @@ -680,28 +677,28 @@ static const struct transform_funcs dce110_xfmv_funcs = { .transform_set_pixel_storage_depth = dce110_xfmv_set_pixel_storage_depth, .transform_get_optimal_number_of_taps = - dce110_transform_get_optimal_number_of_taps + dce_transform_get_optimal_number_of_taps }; /*****************************************/ /* Constructor, Destructor */ /*****************************************/ bool dce110_transform_v_construct( - struct dce110_transform *xfm110, + struct dce_transform *xfm_dce, struct dc_context *ctx) { - xfm110->base.ctx = ctx; + xfm_dce->base.ctx = ctx; - xfm110->base.funcs = &dce110_xfmv_funcs; + xfm_dce->base.funcs = &dce110_xfmv_funcs; - xfm110->lb_pixel_depth_supported = + xfm_dce->lb_pixel_depth_supported = LB_PIXEL_DEPTH_18BPP | LB_PIXEL_DEPTH_24BPP | LB_PIXEL_DEPTH_30BPP; - xfm110->prescaler_on = true; - xfm110->base.lb_bits_per_entry = LB_BITS_PER_ENTRY; - xfm110->base.lb_total_entries_num = LB_TOTAL_NUMBER_OF_ENTRIES; + xfm_dce->prescaler_on = true; + xfm_dce->base.lb_bits_per_entry = LB_BITS_PER_ENTRY; + xfm_dce->base.lb_total_entries_num = LB_TOTAL_NUMBER_OF_ENTRIES; return true; } diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.h b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.h index c5dd2b1e8e1d..267af34db3e5 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.h +++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_transform_v.h @@ -25,14 +25,13 @@ #ifndef __DAL_TRANSFORM_V_DCE110_H__ #define __DAL_TRANSFORM_V_DCE110_H__ -#include "transform.h" -#include "dce110_transform.h" +#include "../dce/dce_transform.h" #define LB_TOTAL_NUMBER_OF_ENTRIES 1712 #define LB_BITS_PER_ENTRY 144 bool dce110_transform_v_construct( - struct dce110_transform *xfm110, + struct dce_transform *xfm110, struct dc_context *ctx); #endif diff --git a/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c b/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c index defc067d9236..5fbec7d3759f 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c +++ b/drivers/gpu/drm/amd/dal/dc/dce112/dce112_resource.c @@ -36,7 +36,7 @@ #include "dce112/dce112_mem_input.h" #include "irq/dce110/irq_service_dce110.h" -#include "dce110/dce110_transform.h" +#include "dce/dce_transform.h" #include "dce/dce_link_encoder.h" #include "dce/dce_stream_encoder.h" #include "dce/dce_audio.h" @@ -210,7 +210,7 @@ static const struct dce110_ipp_reg_offsets ipp_reg_offsets[] = { XFM_COMMON_REG_LIST_DCE110(id)\ } -static const struct dce110_transform_registers xfm_regs[] = { +static const struct dce_transform_registers xfm_regs[] = { transform_regs(0), transform_regs(1), transform_regs(2), @@ -219,11 +219,11 @@ static const struct dce110_transform_registers xfm_regs[] = { transform_regs(5) }; -static const struct dce110_transform_shift xfm_shift = { +static const struct dce_transform_shift xfm_shift = { XFM_COMMON_MASK_SH_LIST_DCE110(__SHIFT) }; -static const struct dce110_transform_mask xfm_mask = { +static const struct dce_transform_mask xfm_mask = { XFM_COMMON_MASK_SH_LIST_DCE110(_MASK) }; @@ -540,7 +540,7 @@ static struct mem_input *dce112_mem_input_create( static void dce112_transform_destroy(struct transform **xfm) { - dm_free(TO_DCE110_TRANSFORM(*xfm)); + dm_free(TO_DCE_TRANSFORM(*xfm)); *xfm = NULL; } @@ -548,13 +548,13 @@ static struct transform *dce112_transform_create( struct dc_context *ctx, uint32_t inst) { - struct dce110_transform *transform = - dm_alloc(sizeof(struct dce110_transform)); + struct dce_transform *transform = + dm_alloc(sizeof(struct dce_transform)); if (!transform) return NULL; - if (dce110_transform_construct(transform, ctx, inst, + if (dce_transform_construct(transform, ctx, inst, &xfm_regs[inst], &xfm_shift, &xfm_mask)) { transform->base.lb_memory_size = 0x1404; /*5124*/ return &transform->base; diff --git a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c index 735d4ad1c17d..d2fd25b97996 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c +++ b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_resource.c @@ -41,7 +41,7 @@ #include "dce/dce_stream_encoder.h" #include "dce80/dce80_mem_input.h" #include "dce80/dce80_ipp.h" -#include "dce110/dce110_transform.h" +#include "dce/dce_transform.h" #include "dce80/dce80_opp.h" #include "dce110/dce110_ipp.h" #include "dce110/dce110_clock_source.h" @@ -217,7 +217,7 @@ static const struct dce110_ipp_reg_offsets ipp_reg_offsets[] = { XFM_COMMON_REG_LIST_DCE_BASE(id)\ } -static const struct dce110_transform_registers xfm_regs[] = { +static const struct dce_transform_registers xfm_regs[] = { transform_regs(0), transform_regs(1), transform_regs(2), @@ -226,11 +226,11 @@ static const struct dce110_transform_registers xfm_regs[] = { transform_regs(5) }; -static const struct dce110_transform_shift xfm_shift = { +static const struct dce_transform_shift xfm_shift = { XFM_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT) }; -static const struct dce110_transform_mask xfm_mask = { +static const struct dce_transform_mask xfm_mask = { XFM_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK) }; @@ -498,7 +498,7 @@ static struct mem_input *dce80_mem_input_create( static void dce80_transform_destroy(struct transform **xfm) { - dm_free(TO_DCE110_TRANSFORM(*xfm)); + dm_free(TO_DCE_TRANSFORM(*xfm)); *xfm = NULL; } @@ -506,13 +506,13 @@ static struct transform *dce80_transform_create( struct dc_context *ctx, uint32_t inst) { - struct dce110_transform *transform = - dm_alloc(sizeof(struct dce110_transform)); + struct dce_transform *transform = + dm_alloc(sizeof(struct dce_transform)); if (!transform) return NULL; - if (dce110_transform_construct(transform, ctx, inst, + if (dce_transform_construct(transform, ctx, inst, &xfm_regs[inst], &xfm_shift, &xfm_mask)) { transform->prescaler_on = false; transform->base.lb_memory_size = 0x6B0; /*1712*/ diff --git a/drivers/gpu/drm/amd/dal/dc/inc/core_types.h b/drivers/gpu/drm/amd/dal/dc/inc/core_types.h index e7f510b7d88f..f2eb8945d5c4 100644 --- a/drivers/gpu/drm/amd/dal/dc/inc/core_types.h +++ b/drivers/gpu/drm/amd/dal/dc/inc/core_types.h @@ -29,7 +29,6 @@ #include "dc.h" #include "bandwidth_calcs.h" #include "ddc_service_types.h" -#include "scaler_types.h" #include "dc_bios_types.h" struct core_stream; @@ -76,7 +75,6 @@ void enable_surface_flip_reporting(struct dc_surface *dc_surface, #include "stream_encoder.h" #include "clock_source.h" #include "audio.h" -#include "scaler_types.h" #include "hw_sequencer_types.h" #include "opp.h" diff --git a/drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h b/drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h index c1a90ffbe304..7f88272f8290 100644 --- a/drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h +++ b/drivers/gpu/drm/amd/dal/dc/inc/hw/transform.h @@ -26,8 +26,8 @@ #ifndef __DAL_TRANSFORM_H__ #define __DAL_TRANSFORM_H__ -#include "include/scaler_types.h" #include "dc_hw_types.h" +#include "fixed31_32.h" #define CSC_TEMPERATURE_MATRIX_SIZE 9 @@ -36,22 +36,13 @@ struct bit_depth_reduction_params; struct transform { const struct transform_funcs *funcs; struct dc_context *ctx; - uint32_t inst; - struct scaler_filter *filter; + int inst; int lb_total_entries_num; int lb_bits_per_entry; unsigned int lb_memory_size; }; -enum lb_pixel_depth { - /* do not change the values because it is used as bit vector */ - LB_PIXEL_DEPTH_18BPP = 1, - LB_PIXEL_DEPTH_24BPP = 2, - LB_PIXEL_DEPTH_30BPP = 4, - LB_PIXEL_DEPTH_36BPP = 8 -}; - /* Colorimetry */ enum colorimetry { COLORIMETRY_NO_DATA = 0, @@ -114,12 +105,19 @@ struct xfm_grph_csc_adjustment { enum graphics_gamut_adjust_type gamut_adjust_type; }; -/*overscan or window*/ +enum lb_pixel_depth { + /* do not change the values because it is used as bit vector */ + LB_PIXEL_DEPTH_18BPP = 1, + LB_PIXEL_DEPTH_24BPP = 2, + LB_PIXEL_DEPTH_30BPP = 4, + LB_PIXEL_DEPTH_36BPP = 8 +}; + struct overscan_info { - uint32_t left; - uint32_t right; - uint32_t top; - uint32_t bottom; + int left; + int right; + int top; + int bottom; }; struct scaling_ratios { @@ -130,21 +128,21 @@ struct scaling_ratios { }; struct sharpness_adj { - uint32_t horz; - uint32_t vert; + int horz; + int vert; }; struct line_buffer_params { bool alpha_en; bool pixel_expan_mode; bool interleave_en; - uint32_t dynamic_pixel_depth; + int dynamic_pixel_depth; enum lb_pixel_depth depth; }; struct scaler_data { - uint32_t h_active; - uint32_t v_active; + int h_active; + int v_active; struct scaling_taps taps; struct rect viewport; struct rect recout; diff --git a/drivers/gpu/drm/amd/dal/include/display_clock_interface.h b/drivers/gpu/drm/amd/dal/include/display_clock_interface.h index 4556f4c8e388..2006fa21f54c 100644 --- a/drivers/gpu/drm/amd/dal/include/display_clock_interface.h +++ b/drivers/gpu/drm/amd/dal/include/display_clock_interface.h @@ -29,7 +29,6 @@ #include "hw_sequencer_types.h" #include "grph_object_defs.h" #include "signal_types.h" -#include "scaler_types.h" /* Timing related information*/ struct dc_timing_params { diff --git a/drivers/gpu/drm/amd/dal/include/scaler_types.h b/drivers/gpu/drm/amd/dal/include/scaler_types.h deleted file mode 100644 index 3ff2b7bc158e..000000000000 --- a/drivers/gpu/drm/amd/dal/include/scaler_types.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2012-15 Advanced Micro Devices, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Authors: AMD - * - */ - -#ifndef __DAL_SCALER_TYPES_H__ -#define __DAL_SCALER_TYPES_H__ - -#include "dc_types.h" - -struct init_int_and_frac { - uint32_t integer; - uint32_t fraction; -}; - -struct scl_ratios_inits { - uint32_t h_int_scale_ratio; - uint32_t v_int_scale_ratio; - struct init_int_and_frac h_init; - struct init_int_and_frac v_init; -}; - -/* same as Hw register */ -enum filter_type { - FILTER_TYPE_V_LOW_PASS = 0x0, - FILTER_TYPE_V_HIGH_PASS = 0x1, - FILTER_TYPE_H_LUMA = 0x2, - FILTER_TYPE_H_CHROMA = 0x3 -}; - -enum ram_filter_type { - FILTER_TYPE_RGB_Y_VERTICAL = 0, /* 0 - RGB/Y - Vertical filter */ - FILTER_TYPE_CBCR_VERTICAL = 1, /* 1 - CbCr Vertical filter */ - FILTER_TYPE_RGB_Y_HORIZONTAL = 2, /* 1 - RGB/Y Horizontal filter */ - FILTER_TYPE_CBCR_HORIZONTAL = 3, /* 3 - CbCr Horizontal filter */ - FILTER_TYPE_ALPHA_VERTICAL = 4, /* 4 - Alpha Vertical filter. */ - FILTER_TYPE_ALPHA_HORIZONTAL = 5, /* 5 - Alpha Horizontal filter. */ -}; - -#endif -- 2.10.1