drm/amd/display: Add margin on DRR vblank start for subvp
authorAlvin Lee <Alvin.Lee2@amd.com>
Mon, 7 Nov 2022 22:07:32 +0000 (17:07 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 23 Nov 2022 14:47:13 +0000 (09:47 -0500)
[Description]
- Add margin for HUBP "jitter" for SubVp + DRR case
- Also do a min transition even if MPO is added on a
  non SubVP pipe (i.e. added on DRR pipe for SubVP + DRR)

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>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
drivers/gpu/drm/amd/display/dc/dc_stream.h
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h

index 1c3de3a1671e6d16658b193802141a767963bc46..42840ce9bf4b11e7dde7e96453e7c8ac6a5cbd23 100644 (file)
@@ -3740,6 +3740,8 @@ static bool could_mpcc_tree_change_for_active_pipes(struct dc *dc,
 
        struct dc_stream_status *cur_stream_status = stream_get_status(dc->current_state, stream);
        bool force_minimal_pipe_splitting = false;
+       bool subvp_active = false;
+       uint32_t i;
 
        *is_plane_addition = false;
 
@@ -3771,11 +3773,25 @@ static bool could_mpcc_tree_change_for_active_pipes(struct dc *dc,
                }
        }
 
+       for (i = 0; i < dc->res_pool->pipe_count; i++) {
+               struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i];
+
+               if (pipe->stream && pipe->stream->mall_stream_config.type != SUBVP_NONE) {
+                       subvp_active = true;
+                       break;
+               }
+       }
+
        /* For SubVP when adding or removing planes we need to add a minimal transition
         * (even when disabling all planes). Whenever disabling a phantom pipe, we
         * must use the minimal transition path to disable the pipe correctly.
+        *
+        * We want to use the minimal transition whenever subvp is active, not only if
+        * a plane is being added / removed from a subvp stream (MPO plane can be added
+        * to a DRR pipe of SubVP + DRR config, in which case we still want to run through
+        * a min transition to disable subvp.
         */
-       if (cur_stream_status && stream->mall_stream_config.type == SUBVP_MAIN) {
+       if (cur_stream_status && subvp_active) {
                /* determine if minimal transition is required due to SubVP*/
                if (cur_stream_status->plane_count > surface_count) {
                        force_minimal_pipe_splitting = true;
index 57fc9193c7709ab3a1991068fb9fe375b6c85827..578ee5ec1ccc16a8091a85b6b5ed90563933f1f3 100644 (file)
@@ -267,6 +267,7 @@ struct dc_caps {
        uint16_t subvp_pstate_allow_width_us;
        uint16_t subvp_vertical_int_margin_us;
        bool seamless_odm;
+       uint8_t subvp_drr_vblank_start_margin_us;
 };
 
 struct dc_bug_wa {
index 097556f7b32cff2b518dc770f82f82b587ce738b..6ccf477d1c4dc315ed710bfa26c88e25c18c8086 100644 (file)
@@ -493,6 +493,7 @@ static void populate_subvp_cmd_drr_info(struct dc *dc,
 
        pipe_data->pipe_config.vblank_data.drr_info.min_vtotal_supported = min_vtotal_supported;
        pipe_data->pipe_config.vblank_data.drr_info.max_vtotal_supported = max_vtotal_supported;
+       pipe_data->pipe_config.vblank_data.drr_info.drr_vblank_start_margin = dc->caps.subvp_drr_vblank_start_margin_us;
 }
 
 /**
index f4dfd3a49b68ed163f04ba200234142ce846e7f6..e0cee9666c48a5e17f8ae734d00236fefc90aae5 100644 (file)
@@ -144,7 +144,7 @@ struct test_pattern {
        unsigned int cust_pattern_size;
 };
 
-#define SUBVP_DRR_MARGIN_US 500 // 500us for DRR margin (SubVP + DRR)
+#define SUBVP_DRR_MARGIN_US 600 // 600us for DRR margin (SubVP + DRR)
 
 enum mall_stream_type {
        SUBVP_NONE, // subvp not in use
index cdeff6de725d9991b9037c45c45db35fe0ce8eee..0c13fe0239d80e9bbf465713b32735c6b074eb6a 100644 (file)
@@ -2124,6 +2124,7 @@ static bool dcn32_resource_construct(
        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.subvp_drr_vblank_start_margin_us = 100; // 100us margin
 
        dc->caps.max_slave_planes = 2;
        dc->caps.max_slave_yuv_planes = 2;
index 6c79a47b6336de816bb1f9c1bd6b1c39c724a47c..d17d0f22be1f2dd523a9b2cf5b8ed3ba790eccbc 100644 (file)
@@ -1711,6 +1711,7 @@ static bool dcn321_resource_construct(
        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.subvp_drr_vblank_start_margin_us = 100; // 100us margin
        dc->caps.max_slave_planes = 1;
        dc->caps.max_slave_yuv_planes = 1;
        dc->caps.max_slave_rgb_planes = 1;
index 795d8811af9a757778cb9f7e8293271de347124a..33907feefebbdcc2ac145b160a5b7d8aafcd1e37 100644 (file)
@@ -1029,13 +1029,14 @@ struct dmub_cmd_fw_assisted_mclk_switch_pipe_data_v2 {
                        uint16_t vtotal;
                        uint16_t htotal;
                        uint8_t vblank_pipe_index;
-                       uint8_t padding[2];
+                       uint8_t padding[1];
                        struct {
                                uint8_t drr_in_use;
                                uint8_t drr_window_size_ms;     // Indicates largest VMIN/VMAX adjustment per frame
                                uint16_t min_vtotal_supported;  // Min VTOTAL that supports switching in VBLANK
                                uint16_t max_vtotal_supported;  // Max VTOTAL that can support SubVP static scheduling
                                uint8_t use_ramping;            // Use ramping or not
+                               uint8_t drr_vblank_start_margin;
                        } drr_info;                             // DRR considered as part of SubVP + VBLANK case
                } vblank_data;
        } pipe_config;