drm/amd/display: Include scaling factor for SubVP command
[Description] For SubVP scaling cases, we must include the scaling info as part of the cmd. This is required when converting OTG line to HUBP line for the MALL_START_LINE programming. Reviewed-by: Jun Lei <Jun.Lei@amd.com> Acked-by: Brian Chang <Brian.Chang@amd.com> Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
385bf5a856
commit
fbe43dcd1a
@ -100,3 +100,24 @@ void convert_float_matrix(
|
||||
matrix[i] = (uint16_t)reg_value;
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t find_gcd(uint32_t a, uint32_t b)
|
||||
{
|
||||
uint32_t remainder = 0;
|
||||
while (b != 0) {
|
||||
remainder = a % b;
|
||||
a = b;
|
||||
b = remainder;
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
void reduce_fraction(uint32_t num, uint32_t den,
|
||||
uint32_t *out_num, uint32_t *out_den)
|
||||
{
|
||||
uint32_t gcd = 0;
|
||||
|
||||
gcd = find_gcd(num, den);
|
||||
*out_num = num / gcd;
|
||||
*out_den = den / gcd;
|
||||
}
|
||||
|
@ -38,6 +38,9 @@ void convert_float_matrix(
|
||||
struct fixed31_32 *flt,
|
||||
uint32_t buffer_size);
|
||||
|
||||
void reduce_fraction(uint32_t num, uint32_t den,
|
||||
uint32_t *out_num, uint32_t *out_den);
|
||||
|
||||
static inline unsigned int log_2(unsigned int num)
|
||||
{
|
||||
return ilog2(num);
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "dm_helpers.h"
|
||||
#include "dc_hw_types.h"
|
||||
#include "core_types.h"
|
||||
#include "../basics/conversion.h"
|
||||
|
||||
#define CTX dc_dmub_srv->ctx
|
||||
#define DC_LOGGER CTX->logger
|
||||
@ -600,6 +601,7 @@ static void populate_subvp_cmd_pipe_info(struct dc *dc,
|
||||
&cmd->fw_assisted_mclk_switch_v2.config_data.pipe_data[cmd_pipe_index];
|
||||
struct dc_crtc_timing *main_timing = &subvp_pipe->stream->timing;
|
||||
struct dc_crtc_timing *phantom_timing = &subvp_pipe->stream->mall_stream_config.paired_stream->timing;
|
||||
uint32_t out_num, out_den;
|
||||
|
||||
pipe_data->mode = SUBVP;
|
||||
pipe_data->pipe_config.subvp_data.pix_clk_100hz = subvp_pipe->stream->timing.pix_clk_100hz;
|
||||
@ -613,6 +615,15 @@ static void populate_subvp_cmd_pipe_info(struct dc *dc,
|
||||
pipe_data->pipe_config.subvp_data.main_pipe_index = subvp_pipe->pipe_idx;
|
||||
pipe_data->pipe_config.subvp_data.is_drr = subvp_pipe->stream->ignore_msa_timing_param;
|
||||
|
||||
/* Calculate the scaling factor from the src and dst height.
|
||||
* e.g. If 3840x2160 being downscaled to 1920x1080, the scaling factor is 1/2.
|
||||
* Reduce the fraction 1080/2160 = 1/2 for the "scaling factor"
|
||||
*/
|
||||
reduce_fraction(subvp_pipe->stream->src.height, subvp_pipe->stream->dst.height, &out_num, &out_den);
|
||||
// TODO: Uncomment below lines once DMCUB include headers are promoted
|
||||
//pipe_data->pipe_config.subvp_data.scale_factor_numerator = out_num;
|
||||
//pipe_data->pipe_config.subvp_data.scale_factor_denominator = out_den;
|
||||
|
||||
// Prefetch lines is equal to VACTIVE + BP + VSYNC
|
||||
pipe_data->pipe_config.subvp_data.prefetch_lines =
|
||||
phantom_timing->v_total - phantom_timing->v_front_porch;
|
||||
|
@ -1664,7 +1664,7 @@ static bool dcn321_resource_construct(
|
||||
dc->caps.subvp_prefetch_end_to_mall_start_us = 15;
|
||||
dc->caps.subvp_swath_height_margin_lines = 16;
|
||||
dc->caps.subvp_pstate_allow_width_us = 20;
|
||||
|
||||
dc->caps.subvp_vertical_int_margin_us = 30;
|
||||
dc->caps.max_slave_planes = 1;
|
||||
dc->caps.max_slave_yuv_planes = 1;
|
||||
dc->caps.max_slave_rgb_planes = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user