From: Tony Cheng <[email protected]>

[Why]
With DC2 selected, Core2 rejects an immediate flip. The flip falls
back to DC1, although DC1 programs it in the same order as the vsync
flip.

[How]
Let the flip on the kept context run when the plane flips
immediately. The order stays lock, GSL, triple buffer, the address,
unlock and the manual trigger. GSL now takes flip_immediate from the
plane, as the address already did.

After the flip, Core2 sets the current address of an immediate flip,
as dcn20_prepare_plane_addr_update does.

Reject an immediate flip of a DCC surface. For it, DC1 waits for the
DCC meta data to propagate, and the flip does not emit that wait.

Cc: Jun Lei <[email protected]>
Signed-off-by: Tony Cheng <[email protected]>
Signed-off-by: Chenyu Chen <[email protected]>
---
 .../dc/bls_builder/dcn401_seamless_builder.c  | 22 ++++++++++++++++++-
 .../gpu/drm/amd/display/dc/core2/dc_core2.c   |  2 ++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git 
a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c 
b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
index 850b5d8c96d4..bc7dd933e35e 100644
--- a/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
+++ b/drivers/gpu/drm/amd/display/dc/bls_builder/dcn401_seamless_builder.c
@@ -824,6 +824,24 @@ static bool check_no_immediate_flip(const struct dc *dc,
                        DC_TRAIT_MATCH(DC_PLANE_TRAIT_FLIP_IMMEDIATE, 0));
 }
 
+/*
+ * DC1 waits for the DCC meta data to propagate before an immediate flip of
+ * a DCC surface. The flip does not emit that wait.
+ */
+static bool check_no_immediate_dcc_flip(const struct dc *dc,
+               const struct dc_state *current_state,
+               const struct dc_state *new_state, unsigned int i)
+{
+       struct dc_state_facts facts;
+
+       (void)current_state;
+       (void)dc;
+       dc_state_facts_derive(new_state, &facts);
+       return !dc_state_facts_any_plane(&facts, (uint8_t)i,
+                       DC_TRAIT_MATCH(DC_PLANE_TRAIT_FLIP_IMMEDIATE |
+                       DC_PLANE_TRAIT_DCC, 0));
+}
+
 /*
  * DC1 translates a distributed-points curve into a LUT while it programs
  * the plane. The update programs only the predefined and bypass curves.
@@ -1081,7 +1099,7 @@ static enum bls_builder_result dcn401_check_flip(const 
struct dc *dc,
        CHECK_UPDATE(one_address_only_plane,
                        "stream has odm, or not one plane with an address-only 
update");
        CHECK_CONDITION(triple_buffer, "triple buffer is disabled");
-       CHECK_UPDATE(no_immediate_flip, "flip is immediate");
+       CHECK_UPDATE(no_immediate_dcc_flip, "immediate flip of a dcc surface");
        CHECK_UPDATE(no_mcm_luts, "an mcm lut is enabled");
        return BLS_BUILD_SUCCESS;
 }
@@ -2318,6 +2336,8 @@ static void dcn401_add_step(struct block_sequence_state 
*sequence,
                break;
        case HUBP_SET_FLIP_CONTROL_GSL:
                p->set_flip_control_gsl_params.hubp = pipe->plane_res.hubp;
+               p->set_flip_control_gsl_params.flip_immediate =
+                               plane->flip_immediate;
                break;
        case HUBP_CLK_CNTL:
                p->hubp_clk_cntl_params.hubp = pipe->plane_res.hubp;
diff --git a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c 
b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
index 245ebd8e01d0..ce2d4f0c89d6 100644
--- a/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
+++ b/drivers/gpu/drm/amd/display/dc/core2/dc_core2.c
@@ -417,6 +417,8 @@ static void core2_update_done(struct dc *dc, struct 
dc_state *context,
                vm_helper_mark_vmid_used(dc->vm_helper, plane->address.vmid,
                                (uint8_t)hubp->inst);
                plane->status.requested_address = plane->address;
+               if (plane->flip_immediate)
+                       plane->status.current_address = plane->address;
                hubp->opp_id = pipe->stream_res.opp->inst;
                hubp->mpcc_id = hubp->inst;
                hubp->power_gated = false;
-- 
2.43.0

Reply via email to