/* * Copyright 2016 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 *
*/
/* Autocal calculate the scaling ratio and initial phase and the * DSCL_MODE_SEL must be set to 1
*/
AUTOCAL_MODE_AUTOSCALE = 1, /* Autocal perform auto centering without replication and the * DSCL_MODE_SEL must be set to 0
*/
AUTOCAL_MODE_AUTOCENTER = 2, /* Autocal perform auto centering and auto replication and the * DSCL_MODE_SEL must be set to 0
*/
AUTOCAL_MODE_AUTOREPLICATE = 3
};
if (dpp_base->caps->dscl_data_proc_format == DSCL_DATA_PRCESSING_FIXED_FORMAT) { /* DSCL is processing data in fixed format */ if (data->format == PIXEL_FORMAT_FP16) return DSCL_MODE_DSCL_BYPASS;
}
if (data->ratios.horz.value == one
&& data->ratios.vert.value == one
&& data->ratios.horz_c.value == one
&& data->ratios.vert_c.value == one
&& !dbg_always_scale) return DSCL_MODE_SCALING_444_BYPASS;
if (!dpp1_dscl_is_420_format(data->format)) { if (dpp1_dscl_is_video_format(data->format)) return DSCL_MODE_SCALING_444_YCBCR_ENABLE; else return DSCL_MODE_SCALING_444_RGB_ENABLE;
} if (data->ratios.horz.value == one && data->ratios.vert.value == one) return DSCL_MODE_SCALING_420_LUMA_BYPASS; if (data->ratios.horz_c.value == one && data->ratios.vert_c.value == one) return DSCL_MODE_SCALING_420_CHROMA_BYPASS;
REG_SET_4(SCL_COEF_RAM_TAP_DATA, 0, /* Even tap coefficient (bits 1:0 fixed to 0) */
SCL_COEF_RAM_EVEN_TAP_COEF, even_coef, /* Write/read control for even coefficient */
SCL_COEF_RAM_EVEN_TAP_COEF_EN, 1, /* Odd tap coefficient (bits 1:0 fixed to 0) */
SCL_COEF_RAM_ODD_TAP_COEF, odd_coef, /* Write/read control for odd coefficient */
SCL_COEF_RAM_ODD_TAP_COEF_EN, 1);
}
}
if (scl_data->lb_params.alpha_en
&& (num_partitions_a < *num_part_y))
*num_part_y = num_partitions_a;
if (*num_part_y > 64)
*num_part_y = 64; if (*num_part_c > 64)
*num_part_c = 64;
}
bool dpp1_dscl_is_lb_conf_valid(int ceil_vratio, int num_partitions, int vtaps)
{ if (ceil_vratio > 2) return vtaps <= (num_partitions - ceil_vratio + 2); else return vtaps <= num_partitions;
}
/*find first match configuration which meets the min required lb size*/ staticenum lb_memory_config dpp1_dscl_find_lb_memory_config(struct dcn10_dpp *dpp, conststruct scaler_data *scl_data)
{ int num_part_y, num_part_c; int vtaps = scl_data->taps.v_taps; int vtaps_c = scl_data->taps.v_taps_c; int ceil_vratio = dc_fixpt_ceil(scl_data->ratios.vert); int ceil_vratio_c = dc_fixpt_ceil(scl_data->ratios.vert_c);
if (dpp->base.ctx->dc->debug.use_max_lb) { if (scl_data->format == PIXEL_FORMAT_420BPP8
|| scl_data->format == PIXEL_FORMAT_420BPP10) return LB_MEMORY_CONFIG_3; return LB_MEMORY_CONFIG_0;
}
/*Ensure we can support the requested number of vtaps*/
ASSERT(dpp1_dscl_is_lb_conf_valid(ceil_vratio, num_part_y, vtaps)
&& dpp1_dscl_is_lb_conf_valid(ceil_vratio_c, num_part_c, vtaps_c));
/** * dpp1_dscl_set_recout - Set the first pixel of RECOUT in the OTG active area * * @dpp: DPP data struct * @recout: Rectangle information * * This function sets the MPC RECOUT_START and RECOUT_SIZE registers based on * the values specified in the recount parameter. * * Note: This function only have effect if AutoCal is disabled.
*/ staticvoid dpp1_dscl_set_recout(struct dcn10_dpp *dpp, conststruct rect *recout)
{
REG_SET_2(RECOUT_START, 0, /* First pixel of RECOUT in the active OTG area */
RECOUT_START_X, recout->x, /* First line of RECOUT in the active OTG area */
RECOUT_START_Y, recout->y);
REG_SET_2(RECOUT_SIZE, 0, /* Number of RECOUT horizontal pixels */
RECOUT_WIDTH, recout->width, /* Number of RECOUT vertical lines */
RECOUT_HEIGHT, recout->height);
}
/** * dpp1_dscl_set_scaler_manual_scale - Manually program scaler and line buffer * * @dpp_base: High level DPP struct * @scl_data: scalaer_data info * * This is the primary function to program scaler and line buffer in manual * scaling mode. To execute the required operations for manual scale, we need * to disable AutoCal first.
*/ void dpp1_dscl_set_scaler_manual_scale(struct dpp *dpp_base, conststruct scaler_data *scl_data)
{ enum lb_memory_config lb_config; struct dcn10_dpp *dpp = TO_DCN10_DPP(dpp_base); enum dscl_mode_sel dscl_mode = dpp1_dscl_get_dscl_mode(
dpp_base, scl_data, dpp_base->ctx->dc->debug.always_scale); bool ycbcr = scl_data->format >= PIXEL_FORMAT_VIDEO_BEGIN
&& scl_data->format <= PIXEL_FORMAT_VIDEO_END;
if (memcmp(&dpp->scl_data, scl_data, sizeof(*scl_data)) == 0) return;
PERF_TRACE();
dpp->scl_data = *scl_data;
if (dpp_base->ctx->dc->debug.enable_mem_low_power.bits.dscl) { if (dscl_mode != DSCL_MODE_DSCL_BYPASS)
dpp1_power_on_dscl(dpp_base, true);
}
/* MPC Size */
REG_SET_2(MPC_SIZE, 0, /* Number of horizontal pixels of MPC */
MPC_WIDTH, scl_data->h_active, /* Number of vertical lines of MPC */
MPC_HEIGHT, scl_data->v_active);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.