Skip to content

Commit 9626890

Browse files
Samson Tamalexdeucher
authored andcommitted
drm/amd/display: fix asserts in SPL during bootup
[Why] During mode validation, there maybe modes that fail max_downscale_src_width check and scaling_quality taps are 0. This will cause an assert to trigger in spl_set_filters_data() because taps are 0. [How] Move taps calculation for non-adaptive scaling mode to separate function and call it if max_downscale_src_width fails. This will populate taps if scaling_quality taps are 0. Reviewed-by: Alvin Lee <alvin.lee2@amd.com> Signed-off-by: Samson Tam <Samson.Tam@amd.com> Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 69603bf commit 9626890

File tree

1 file changed

+48
-38
lines changed
  • drivers/gpu/drm/amd/display/dc/spl

1 file changed

+48
-38
lines changed

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

Lines changed: 48 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,50 @@ static bool spl_get_isharp_en(struct spl_in *spl_in,
868868
return enable_isharp;
869869
}
870870

871+
/* Calculate number of tap with adaptive scaling off */
872+
static void spl_get_taps_non_adaptive_scaler(
873+
struct spl_scratch *spl_scratch, const struct spl_taps *in_taps)
874+
{
875+
if (in_taps->h_taps == 0) {
876+
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.horz) > 1)
877+
spl_scratch->scl_data.taps.h_taps = spl_min(2 * spl_fixpt_ceil(
878+
spl_scratch->scl_data.ratios.horz), 8);
879+
else
880+
spl_scratch->scl_data.taps.h_taps = 4;
881+
} else
882+
spl_scratch->scl_data.taps.h_taps = in_taps->h_taps;
883+
884+
if (in_taps->v_taps == 0) {
885+
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert) > 1)
886+
spl_scratch->scl_data.taps.v_taps = spl_min(spl_fixpt_ceil(spl_fixpt_mul_int(
887+
spl_scratch->scl_data.ratios.vert, 2)), 8);
888+
else
889+
spl_scratch->scl_data.taps.v_taps = 4;
890+
} else
891+
spl_scratch->scl_data.taps.v_taps = in_taps->v_taps;
892+
893+
if (in_taps->v_taps_c == 0) {
894+
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert_c) > 1)
895+
spl_scratch->scl_data.taps.v_taps_c = spl_min(spl_fixpt_ceil(spl_fixpt_mul_int(
896+
spl_scratch->scl_data.ratios.vert_c, 2)), 8);
897+
else
898+
spl_scratch->scl_data.taps.v_taps_c = 4;
899+
} else
900+
spl_scratch->scl_data.taps.v_taps_c = in_taps->v_taps_c;
901+
902+
if (in_taps->h_taps_c == 0) {
903+
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.horz_c) > 1)
904+
spl_scratch->scl_data.taps.h_taps_c = spl_min(2 * spl_fixpt_ceil(
905+
spl_scratch->scl_data.ratios.horz_c), 8);
906+
else
907+
spl_scratch->scl_data.taps.h_taps_c = 4;
908+
} else if ((in_taps->h_taps_c % 2) != 0 && in_taps->h_taps_c != 1)
909+
/* Only 1 and even h_taps_c are supported by hw */
910+
spl_scratch->scl_data.taps.h_taps_c = in_taps->h_taps_c - 1;
911+
else
912+
spl_scratch->scl_data.taps.h_taps_c = in_taps->h_taps_c;
913+
}
914+
871915
/* Calculate optimal number of taps */
872916
static bool spl_get_optimal_number_of_taps(
873917
int max_downscale_src_width, struct spl_in *spl_in, struct spl_scratch *spl_scratch,
@@ -883,7 +927,7 @@ static bool spl_get_optimal_number_of_taps(
883927
if (spl_scratch->scl_data.viewport.width > spl_scratch->scl_data.h_active &&
884928
max_downscale_src_width != 0 &&
885929
spl_scratch->scl_data.viewport.width > max_downscale_src_width) {
886-
memcpy(&spl_scratch->scl_data.taps, in_taps, sizeof(struct spl_taps));
930+
spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps);
887931
*enable_easf_v = false;
888932
*enable_easf_h = false;
889933
*enable_isharp = false;
@@ -910,43 +954,9 @@ static bool spl_get_optimal_number_of_taps(
910954
* From programming guide: taps = min{ ceil(2*H_RATIO,1), 8} for downscaling
911955
* taps = 4 for upscaling
912956
*/
913-
if (skip_easf) {
914-
if (in_taps->h_taps == 0) {
915-
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.horz) > 1)
916-
spl_scratch->scl_data.taps.h_taps = spl_min(2 * spl_fixpt_ceil(
917-
spl_scratch->scl_data.ratios.horz), 8);
918-
else
919-
spl_scratch->scl_data.taps.h_taps = 4;
920-
} else
921-
spl_scratch->scl_data.taps.h_taps = in_taps->h_taps;
922-
if (in_taps->v_taps == 0) {
923-
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert) > 1)
924-
spl_scratch->scl_data.taps.v_taps = spl_min(spl_fixpt_ceil(spl_fixpt_mul_int(
925-
spl_scratch->scl_data.ratios.vert, 2)), 8);
926-
else
927-
spl_scratch->scl_data.taps.v_taps = 4;
928-
} else
929-
spl_scratch->scl_data.taps.v_taps = in_taps->v_taps;
930-
if (in_taps->v_taps_c == 0) {
931-
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.vert_c) > 1)
932-
spl_scratch->scl_data.taps.v_taps_c = spl_min(spl_fixpt_ceil(spl_fixpt_mul_int(
933-
spl_scratch->scl_data.ratios.vert_c, 2)), 8);
934-
else
935-
spl_scratch->scl_data.taps.v_taps_c = 4;
936-
} else
937-
spl_scratch->scl_data.taps.v_taps_c = in_taps->v_taps_c;
938-
if (in_taps->h_taps_c == 0) {
939-
if (spl_fixpt_ceil(spl_scratch->scl_data.ratios.horz_c) > 1)
940-
spl_scratch->scl_data.taps.h_taps_c = spl_min(2 * spl_fixpt_ceil(
941-
spl_scratch->scl_data.ratios.horz_c), 8);
942-
else
943-
spl_scratch->scl_data.taps.h_taps_c = 4;
944-
} else if ((in_taps->h_taps_c % 2) != 0 && in_taps->h_taps_c != 1)
945-
/* Only 1 and even h_taps_c are supported by hw */
946-
spl_scratch->scl_data.taps.h_taps_c = in_taps->h_taps_c - 1;
947-
else
948-
spl_scratch->scl_data.taps.h_taps_c = in_taps->h_taps_c;
949-
} else {
957+
if (skip_easf)
958+
spl_get_taps_non_adaptive_scaler(spl_scratch, in_taps);
959+
else {
950960
if (spl_is_yuv420(spl_in->basic_in.format)) {
951961
spl_scratch->scl_data.taps.h_taps = 6;
952962
spl_scratch->scl_data.taps.v_taps = 6;

0 commit comments

Comments
 (0)