Skip to content

Commit e017958

Browse files
Samson Tamalexdeucher
authored andcommitted
drm/amd/display: add public taps API in SPL
[Why] Add public API to obtain number of taps in SPL. [How] Isolate function to calculate recout, ratios and viewport before calculating taps. Call function in both public taps API call and private scaling call. Reviewed-by: Jun Lei <[email protected]> Signed-off-by: Samson Tam <[email protected]> Signed-off-by: Hamza Mahfooz <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 89713ce commit e017958

File tree

2 files changed

+48
-17
lines changed

2 files changed

+48
-17
lines changed

drivers/gpu/drm/amd/display/dc/spl/dc_spl.c

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static struct spl_rect calculate_plane_rec_in_timing_active(
9999
*
100100
* recout_x = 128 + round(plane_x * 2304 / 1920)
101101
* recout_w = 128 + round((plane_x + plane_w) * 2304 / 1920) - recout_x
102-
* recout_y = 0 + round(plane_y * 1440 / 1280)
102+
* recout_y = 0 + round(plane_y * 1440 / 1200)
103103
* recout_h = 0 + round((plane_y + plane_h) * 1440 / 1200) - recout_y
104104
*
105105
* NOTE: fixed point division is not error free. To reduce errors
@@ -1746,6 +1746,32 @@ static void spl_set_isharp_data(struct dscl_prog_data *dscl_prog_data,
17461746
spl_set_blur_scale_data(dscl_prog_data, data);
17471747
}
17481748

1749+
/* Calculate recout, scaling ratio, and viewport, then get optimal number of taps */
1750+
static bool spl_calculate_number_of_taps(struct spl_in *spl_in, struct spl_scratch *spl_scratch, struct spl_out *spl_out,
1751+
bool *enable_easf_v, bool *enable_easf_h, bool *enable_isharp)
1752+
{
1753+
bool res = false;
1754+
1755+
memset(spl_scratch, 0, sizeof(struct spl_scratch));
1756+
spl_scratch->scl_data.h_active = spl_in->h_active;
1757+
spl_scratch->scl_data.v_active = spl_in->v_active;
1758+
1759+
// All SPL calls
1760+
/* recout calculation */
1761+
/* depends on h_active */
1762+
spl_calculate_recout(spl_in, spl_scratch, spl_out);
1763+
/* depends on pixel format */
1764+
spl_calculate_scaling_ratios(spl_in, spl_scratch, spl_out);
1765+
/* depends on scaling ratios and recout, does not calculate offset yet */
1766+
spl_calculate_viewport_size(spl_in, spl_scratch);
1767+
1768+
res = spl_get_optimal_number_of_taps(
1769+
spl_in->basic_out.max_downscale_src_width, spl_in,
1770+
spl_scratch, &spl_in->scaling_quality, enable_easf_v,
1771+
enable_easf_h, enable_isharp);
1772+
return res;
1773+
}
1774+
17491775
/* Calculate scaler parameters */
17501776
bool spl_calculate_scaler_params(struct spl_in *spl_in, struct spl_out *spl_out)
17511777
{
@@ -1760,23 +1786,9 @@ bool spl_calculate_scaler_params(struct spl_in *spl_in, struct spl_out *spl_out)
17601786
bool enable_isharp = false;
17611787
const struct spl_scaler_data *data = &spl_scratch.scl_data;
17621788

1763-
memset(&spl_scratch, 0, sizeof(struct spl_scratch));
1764-
spl_scratch.scl_data.h_active = spl_in->h_active;
1765-
spl_scratch.scl_data.v_active = spl_in->v_active;
1766-
1767-
// All SPL calls
1768-
/* recout calculation */
1769-
/* depends on h_active */
1770-
spl_calculate_recout(spl_in, &spl_scratch, spl_out);
1771-
/* depends on pixel format */
1772-
spl_calculate_scaling_ratios(spl_in, &spl_scratch, spl_out);
1773-
/* depends on scaling ratios and recout, does not calculate offset yet */
1774-
spl_calculate_viewport_size(spl_in, &spl_scratch);
1789+
res = spl_calculate_number_of_taps(spl_in, &spl_scratch, spl_out,
1790+
&enable_easf_v, &enable_easf_h, &enable_isharp);
17751791

1776-
res = spl_get_optimal_number_of_taps(
1777-
spl_in->basic_out.max_downscale_src_width, spl_in,
1778-
&spl_scratch, &spl_in->scaling_quality, &enable_easf_v,
1779-
&enable_easf_h, &enable_isharp);
17801792
/*
17811793
* Depends on recout, scaling ratios, h_active and taps
17821794
* May need to re-check lb size after this in some obscure scenario
@@ -1824,3 +1836,20 @@ bool spl_calculate_scaler_params(struct spl_in *spl_in, struct spl_out *spl_out)
18241836

18251837
return res;
18261838
}
1839+
1840+
/* External interface to get number of taps only */
1841+
bool spl_get_number_of_taps(struct spl_in *spl_in, struct spl_out *spl_out)
1842+
{
1843+
bool res = false;
1844+
bool enable_easf_v = false;
1845+
bool enable_easf_h = false;
1846+
bool enable_isharp = false;
1847+
struct spl_scratch spl_scratch;
1848+
struct dscl_prog_data *dscl_prog_data = spl_out->dscl_prog_data;
1849+
const struct spl_scaler_data *data = &spl_scratch.scl_data;
1850+
1851+
res = spl_calculate_number_of_taps(spl_in, &spl_scratch, spl_out,
1852+
&enable_easf_v, &enable_easf_h, &enable_isharp);
1853+
spl_set_taps_data(dscl_prog_data, data);
1854+
return res;
1855+
}

drivers/gpu/drm/amd/display/dc/spl/dc_spl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@
1313

1414
bool spl_calculate_scaler_params(struct spl_in *spl_in, struct spl_out *spl_out);
1515

16+
bool spl_get_number_of_taps(struct spl_in *spl_in, struct spl_out *spl_out);
17+
1618
#endif /* __DC_SPL_H__ */

0 commit comments

Comments
 (0)