drm/amd/display: Refactor eDP PSR codes
authorjsg <jsg@openbsd.org>
Tue, 13 Jun 2023 03:46:07 +0000 (03:46 +0000)
committerjsg <jsg@openbsd.org>
Tue, 13 Jun 2023 03:46:07 +0000 (03:46 +0000)
From Ian Chen
83468820168a470a489e6ad6f7759d19687d1623 in linux-6.1.y/6.1.29
bd829d5707730072fecc3267016a675a4789905b in mainline linux

sys/dev/pci/drm/amd/display/dc/dc.h
sys/dev/pci/drm/amd/display/dc/dc_link.h
sys/dev/pci/drm/amd/display/dc/dcn21/dcn21_resource.c
sys/dev/pci/drm/amd/display/dc/dcn30/dcn30_resource.c
sys/dev/pci/drm/amd/display/dc/dcn302/dcn302_resource.c
sys/dev/pci/drm/amd/display/dc/dcn303/dcn303_resource.c
sys/dev/pci/drm/amd/display/dc/dcn31/dcn31_resource.c
sys/dev/pci/drm/amd/display/dc/dcn314/dcn314_resource.c
sys/dev/pci/drm/amd/display/dc/dcn315/dcn315_resource.c
sys/dev/pci/drm/amd/display/dc/dcn316/dcn316_resource.c
sys/dev/pci/drm/amd/display/dc/dml/dcn20/dcn20_fpu.c

index 018c1da..98bfba0 100644 (file)
@@ -764,7 +764,6 @@ struct dc_debug_options {
        bool disable_mem_low_power;
        bool pstate_enabled;
        bool disable_dmcu;
-       bool disable_psr;
        bool force_abm_enable;
        bool disable_stereo_support;
        bool vsr_support;
index c0816e6..ddd9f86 100644 (file)
@@ -117,7 +117,7 @@ struct psr_settings {
  * Add a struct dc_panel_config under dc_link
  */
 struct dc_panel_config {
-       // extra panel power sequence parameters
+       /* extra panel power sequence parameters */
        struct pps {
                unsigned int extra_t3_ms;
                unsigned int extra_t7_ms;
@@ -127,13 +127,21 @@ struct dc_panel_config {
                unsigned int extra_t12_ms;
                unsigned int extra_post_OUI_ms;
        } pps;
-       // ABM
+       /* PSR */
+       struct psr {
+               bool disable_psr;
+               bool disallow_psrsu;
+               bool rc_disable;
+               bool rc_allow_static_screen;
+               bool rc_allow_fullscreen_VPB;
+       } psr;
+       /* ABM */
        struct varib {
                unsigned int varibright_feature_enable;
                unsigned int def_varibright_level;
                unsigned int abm_config_setting;
        } varib;
-       // edp DSC
+       /* edp DSC */
        struct dsc {
                bool disable_dsc_edp;
                unsigned int force_dsc_edp_policy;
index 8870814..ce6c70e 100644 (file)
@@ -671,12 +671,15 @@ static const struct dc_debug_options debug_defaults_diags = {
                .disable_pplib_wm_range = true,
                .disable_stutter = true,
                .disable_48mhz_pwrdwn = true,
-               .disable_psr = true,
                .enable_tri_buf = true,
                .use_max_lb = true
 };
 
 static const struct dc_panel_config panel_config_defaults = {
+               .psr = {
+                       .disable_psr = false,
+                       .disallow_psrsu = false,
+               },
                .ilr = {
                        .optimize_edp_link_rate = true,
                },
index e958f83..5a8d1a0 100644 (file)
@@ -723,7 +723,6 @@ static const struct dc_debug_options debug_defaults_drv = {
        .underflow_assert_delay_us = 0xFFFFFFFF,
        .dwb_fi_phase = -1, // -1 = disable,
        .dmub_command_table = true,
-       .disable_psr = false,
        .use_max_lb = true,
        .exit_idle_opt_for_cursor_updates = true
 };
@@ -742,11 +741,17 @@ static const struct dc_debug_options debug_defaults_diags = {
        .scl_reset_length10 = true,
        .dwb_fi_phase = -1, // -1 = disable
        .dmub_command_table = true,
-       .disable_psr = true,
        .enable_tri_buf = true,
        .use_max_lb = true
 };
 
+static const struct dc_panel_config panel_config_defaults = {
+       .psr = {
+               .disable_psr = false,
+               .disallow_psrsu = false,
+       },
+};
+
 static void dcn30_dpp_destroy(struct dpp **dpp)
 {
        kfree(TO_DCN20_DPP(*dpp));
@@ -2214,6 +2219,11 @@ void dcn30_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params
        }
 }
 
+static void dcn30_get_panel_config_defaults(struct dc_panel_config *panel_config)
+{
+       *panel_config = panel_config_defaults;
+}
+
 static const struct resource_funcs dcn30_res_pool_funcs = {
        .destroy = dcn30_destroy_resource_pool,
        .link_enc_create = dcn30_link_encoder_create,
@@ -2233,6 +2243,7 @@ static const struct resource_funcs dcn30_res_pool_funcs = {
        .release_post_bldn_3dlut = dcn30_release_post_bldn_3dlut,
        .update_bw_bounding_box = dcn30_update_bw_bounding_box,
        .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
+       .get_panel_config_defaults = dcn30_get_panel_config_defaults,
 };
 
 #define CTX ctx
index b925b6d..d394587 100644 (file)
@@ -112,10 +112,16 @@ static const struct dc_debug_options debug_defaults_diags = {
                .dwb_fi_phase = -1, // -1 = disable
                .dmub_command_table = true,
                .enable_tri_buf = true,
-               .disable_psr = true,
                .use_max_lb = true
 };
 
+static const struct dc_panel_config panel_config_defaults = {
+               .psr = {
+                       .disable_psr = false,
+                       .disallow_psrsu = false,
+               },
+};
+
 enum dcn302_clk_src_array_id {
        DCN302_CLK_SRC_PLL0,
        DCN302_CLK_SRC_PLL1,
@@ -1132,6 +1138,11 @@ void dcn302_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param
        DC_FP_END();
 }
 
+static void dcn302_get_panel_config_defaults(struct dc_panel_config *panel_config)
+{
+       *panel_config = panel_config_defaults;
+}
+
 static struct resource_funcs dcn302_res_pool_funcs = {
                .destroy = dcn302_destroy_resource_pool,
                .link_enc_create = dcn302_link_encoder_create,
@@ -1151,6 +1162,7 @@ static struct resource_funcs dcn302_res_pool_funcs = {
                .release_post_bldn_3dlut = dcn30_release_post_bldn_3dlut,
                .update_bw_bounding_box = dcn302_update_bw_bounding_box,
                .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
+               .get_panel_config_defaults = dcn302_get_panel_config_defaults,
 };
 
 static struct dc_cap_funcs cap_funcs = {
index 527d5c9..7e7f18b 100644 (file)
@@ -96,7 +96,13 @@ static const struct dc_debug_options debug_defaults_diags = {
                .dwb_fi_phase = -1, // -1 = disable
                .dmub_command_table = true,
                .enable_tri_buf = true,
-               .disable_psr = true,
+};
+
+static const struct dc_panel_config panel_config_defaults = {
+               .psr = {
+                       .disable_psr = false,
+                       .disallow_psrsu = false,
+               },
 };
 
 enum dcn303_clk_src_array_id {
@@ -1055,6 +1061,10 @@ static void dcn303_destroy_resource_pool(struct resource_pool **pool)
        *pool = NULL;
 }
 
+static void dcn303_get_panel_config_defaults(struct dc_panel_config *panel_config)
+{
+       *panel_config = panel_config_defaults;
+}
 
 void dcn303_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params)
 {
@@ -1082,6 +1092,7 @@ static struct resource_funcs dcn303_res_pool_funcs = {
                .release_post_bldn_3dlut = dcn30_release_post_bldn_3dlut,
                .update_bw_bounding_box = dcn303_update_bw_bounding_box,
                .patch_unknown_plane_state = dcn20_patch_unknown_plane_state,
+               .get_panel_config_defaults = dcn303_get_panel_config_defaults,
 };
 
 static struct dc_cap_funcs cap_funcs = {
index d825f11..d3f7651 100644 (file)
@@ -911,6 +911,10 @@ static const struct dc_debug_options debug_defaults_diags = {
 };
 
 static const struct dc_panel_config panel_config_defaults = {
+       .psr = {
+               .disable_psr = false,
+               .disallow_psrsu = false,
+       },
        .ilr = {
                .optimize_edp_link_rate = true,
        },
index ffaa4e5..94a90c8 100644 (file)
@@ -940,6 +940,10 @@ static const struct dc_debug_options debug_defaults_diags = {
 };
 
 static const struct dc_panel_config panel_config_defaults = {
+       .psr = {
+               .disable_psr = false,
+               .disallow_psrsu = false,
+       },
        .ilr = {
                .optimize_edp_link_rate = true,
        },
index 58746c4..31cbc57 100644 (file)
@@ -907,6 +907,10 @@ static const struct dc_debug_options debug_defaults_diags = {
 };
 
 static const struct dc_panel_config panel_config_defaults = {
+       .psr = {
+               .disable_psr = false,
+               .disallow_psrsu = false,
+       },
        .ilr = {
                .optimize_edp_link_rate = true,
        },
index 6b40a11..af3eddc 100644 (file)
@@ -906,6 +906,10 @@ static const struct dc_debug_options debug_defaults_diags = {
 };
 
 static const struct dc_panel_config panel_config_defaults = {
+       .psr = {
+               .disable_psr = false,
+               .disallow_psrsu = false,
+       },
        .ilr = {
                .optimize_edp_link_rate = true,
        },
index 45db40c..602e885 100644 (file)
@@ -989,7 +989,7 @@ static enum dcn_zstate_support_state  decide_zstate_support(struct dc *dc, struc
 
                if (context->bw_ctx.dml.vba.StutterPeriod > 5000.0 || optimized_min_dst_y_next_start_us > 5000)
                        return DCN_ZSTATE_SUPPORT_ALLOW;
-               else if (link->psr_settings.psr_version == DC_PSR_VERSION_1 && !dc->debug.disable_psr)
+               else if (link->psr_settings.psr_version == DC_PSR_VERSION_1 && !link->panel_config.psr.disable_psr)
                        return DCN_ZSTATE_SUPPORT_ALLOW_Z10_ONLY;
                else
                        return DCN_ZSTATE_SUPPORT_DISALLOW;