drm/amd/display: Cleanup DML DSC input bpc validation
authorNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Fri, 26 Mar 2021 18:25:21 +0000 (14:25 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Apr 2021 20:53:32 +0000 (16:53 -0400)
[Why & How]
Pipe input DSC bpc has a type mismatch with maximum DSC
input bpc - align the maximum with the pipe input type,
unsigned integer.

When checking the type we shoudl also check for an
implicit value of 0 and align with what the spreadsheet
does - default to max.

Rename output_bpc to dsc_input_bpc to reflect what the
field is actually used for.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.c
drivers/gpu/drm/amd/display/dc/dml/display_mode_structs.h
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c

index 8fb29f7..f65a690 100644 (file)
@@ -2216,7 +2216,7 @@ int dcn20_populate_dml_pipes_from_context(
                        pipes[pipe_cnt].dout.output_bpp = res_ctx->pipe_ctx[i].stream->timing.dsc_cfg.bits_per_pixel / 16.0;
 
                /* todo: default max for now, until there is logic reflecting this in dc*/
-               pipes[pipe_cnt].dout.output_bpc = 12;
+               pipes[pipe_cnt].dout.dsc_input_bpc = 12;
                /*fill up the audio sample rate (unit in kHz)*/
                get_audio_check(&res_ctx->pipe_ctx[i].stream->audio_info, &aud_check);
                pipes[pipe_cnt].dout.max_audio_sample_rate = aud_check.max_audiosample_rate / 1000;
index 098d643..1f7b6dd 100644 (file)
@@ -226,7 +226,7 @@ void dml_log_pipe_params(
                dml_print("DML PARAMS: PIPE [%d] DISPLAY OUTPUT PARAMS:\n", i);
                dml_print("DML PARAMS:     output_type                = %d\n", dout->output_type);
                dml_print("DML PARAMS:     output_format              = %d\n", dout->output_format);
-               dml_print("DML PARAMS:     output_bpc                 = %d\n", dout->output_bpc);
+               dml_print("DML PARAMS:     dsc_input_bpc              = %d\n", dout->dsc_input_bpc);
                dml_print("DML PARAMS:     output_bpp                 = %3.4f\n", dout->output_bpp);
                dml_print("DML PARAMS:     dp_lanes                   = %d\n", dout->dp_lanes);
                dml_print("DML PARAMS:     dsc_enable                 = %d\n", dout->dsc_enable);
index 0c51281..2ece369 100644 (file)
@@ -164,7 +164,7 @@ struct _vcs_dpi_ip_params_st {
        double writeback_max_vscl_ratio;
        double writeback_min_hscl_ratio;
        double writeback_min_vscl_ratio;
-       double maximum_dsc_bits_per_component;
+       unsigned int maximum_dsc_bits_per_component;
        unsigned int writeback_max_hscl_taps;
        unsigned int writeback_max_vscl_taps;
        unsigned int writeback_line_buffer_luma_buffer_size;
@@ -292,10 +292,10 @@ struct writeback_st {
 struct _vcs_dpi_display_output_params_st {
        int dp_lanes;
        double output_bpp;
+       unsigned int dsc_input_bpc;
        int dsc_enable;
        int wb_enable;
        int num_active_wb;
-       int output_bpc;
        int output_type;
        int is_virtual;
        int output_format;
index 94036a9..2a96745 100644 (file)
@@ -471,7 +471,13 @@ static void fetch_pipe_params(struct display_mode_lib *mode_lib)
                mode_lib->vba.DSCEnable[mode_lib->vba.NumberOfActivePlanes] = dout->dsc_enable;
                mode_lib->vba.NumberOfDSCSlices[mode_lib->vba.NumberOfActivePlanes] =
                                dout->dsc_slices;
-               mode_lib->vba.DSCInputBitPerComponent[mode_lib->vba.NumberOfActivePlanes] = dout->output_bpc;
+               if (!dout->dsc_input_bpc) {
+                       mode_lib->vba.DSCInputBitPerComponent[mode_lib->vba.NumberOfActivePlanes] =
+                               ip->maximum_dsc_bits_per_component;
+               } else {
+                       mode_lib->vba.DSCInputBitPerComponent[mode_lib->vba.NumberOfActivePlanes] =
+                               dout->dsc_input_bpc;
+               }
                mode_lib->vba.WritebackEnable[mode_lib->vba.NumberOfActivePlanes] = dout->wb_enable;
                mode_lib->vba.ActiveWritebacksPerPlane[mode_lib->vba.NumberOfActivePlanes] =
                                dout->num_active_wb;