amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Siqueira <Rodrigo.Siqueira-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Dmytro Laktyushkin
	<Dmytro.Laktyushkin-5C7GfCeVMHo@public.gmane.org>,
	Nikola Cornij <nikola.cornij-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 28/30] drm/amd/display: Use a temporary copy of the current state when updating DSC config
Date: Mon, 11 Nov 2019 19:33:22 -0500	[thread overview]
Message-ID: <20191112003324.8419-29-Rodrigo.Siqueira@amd.com> (raw)
In-Reply-To: <20191112003324.8419-1-Rodrigo.Siqueira-5C7GfCeVMHo@public.gmane.org>

From: Nikola Cornij <nikola.cornij@amd.com>

[why]
When updating DSC config, a new config has to be validated before proceeding
with applying the update. Validation, however, modifies the current state.
This means DSC config validation would affect pipe re-assignment, causing
intermittent screen corruption issues when ODM is required for DSC.

[how]
- Use a copy of the current state for modified DSC config validation
- Set the update type to FULL_UPDATE to correctly validate and set the
  actual state used for committing the streams

Signed-off-by: Nikola Cornij <nikola.cornij@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 31 ++++++++++++++++++------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 60bc4c3a518e..ed3fd41c0879 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1678,6 +1678,9 @@ static enum surface_update_type check_update_surfaces_for_stream(
 
 		if (stream_update->output_csc_transform || stream_update->output_color_space)
 			su_flags->bits.out_csc = 1;
+
+		if (stream_update->dsc_config)
+			overall_type = UPDATE_TYPE_FULL;
 	}
 
 	for (i = 0 ; i < surface_count; i++) {
@@ -1869,8 +1872,10 @@ static void copy_surface_update_to_plane(
 static void copy_stream_update_to_stream(struct dc *dc,
 					 struct dc_state *context,
 					 struct dc_stream_state *stream,
-					 const struct dc_stream_update *update)
+					 struct dc_stream_update *update)
 {
+	struct dc_context *dc_ctx = dc->ctx;
+
 	if (update == NULL || stream == NULL)
 		return;
 
@@ -1947,12 +1952,24 @@ static void copy_stream_update_to_stream(struct dc *dc,
 		uint32_t enable_dsc = (update->dsc_config->num_slices_h != 0 &&
 				       update->dsc_config->num_slices_v != 0);
 
-		stream->timing.dsc_cfg = *update->dsc_config;
-		stream->timing.flags.DSC = enable_dsc;
-		if (!dc->res_pool->funcs->validate_bandwidth(dc, context,
-							     true)) {
-			stream->timing.dsc_cfg = old_dsc_cfg;
-			stream->timing.flags.DSC = old_dsc_enabled;
+		/* Use temporarry context for validating new DSC config */
+		struct dc_state *dsc_validate_context = dc_create_state(dc);
+
+		if (dsc_validate_context) {
+			dc_resource_state_copy_construct(dc->current_state, dsc_validate_context);
+
+			stream->timing.dsc_cfg = *update->dsc_config;
+			stream->timing.flags.DSC = enable_dsc;
+			if (!dc->res_pool->funcs->validate_bandwidth(dc, dsc_validate_context, true)) {
+				stream->timing.dsc_cfg = old_dsc_cfg;
+				stream->timing.flags.DSC = old_dsc_enabled;
+				update->dsc_config = false;
+			}
+
+			dc_release_state(dsc_validate_context);
+		} else {
+			DC_ERROR("Failed to allocate new validate context for DSC change\n");
+			update->dsc_config = false;
 		}
 	}
 }
-- 
2.24.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
To: amd-gfx@lists.freedesktop.org
Cc: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>,
	Nikola Cornij <nikola.cornij@amd.com>
Subject: [PATCH 28/30] drm/amd/display: Use a temporary copy of the current state when updating DSC config
Date: Mon, 11 Nov 2019 19:33:22 -0500	[thread overview]
Message-ID: <20191112003324.8419-29-Rodrigo.Siqueira@amd.com> (raw)
Message-ID: <20191112003322.IREttufJK6WdGvCjYm_T3VqpEM0WzLIamhrJQjNrCfQ@z> (raw)
In-Reply-To: <20191112003324.8419-1-Rodrigo.Siqueira@amd.com>

From: Nikola Cornij <nikola.cornij@amd.com>

[why]
When updating DSC config, a new config has to be validated before proceeding
with applying the update. Validation, however, modifies the current state.
This means DSC config validation would affect pipe re-assignment, causing
intermittent screen corruption issues when ODM is required for DSC.

[how]
- Use a copy of the current state for modified DSC config validation
- Set the update type to FULL_UPDATE to correctly validate and set the
  actual state used for committing the streams

Signed-off-by: Nikola Cornij <nikola.cornij@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 31 ++++++++++++++++++------
 1 file changed, 24 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 60bc4c3a518e..ed3fd41c0879 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1678,6 +1678,9 @@ static enum surface_update_type check_update_surfaces_for_stream(
 
 		if (stream_update->output_csc_transform || stream_update->output_color_space)
 			su_flags->bits.out_csc = 1;
+
+		if (stream_update->dsc_config)
+			overall_type = UPDATE_TYPE_FULL;
 	}
 
 	for (i = 0 ; i < surface_count; i++) {
@@ -1869,8 +1872,10 @@ static void copy_surface_update_to_plane(
 static void copy_stream_update_to_stream(struct dc *dc,
 					 struct dc_state *context,
 					 struct dc_stream_state *stream,
-					 const struct dc_stream_update *update)
+					 struct dc_stream_update *update)
 {
+	struct dc_context *dc_ctx = dc->ctx;
+
 	if (update == NULL || stream == NULL)
 		return;
 
@@ -1947,12 +1952,24 @@ static void copy_stream_update_to_stream(struct dc *dc,
 		uint32_t enable_dsc = (update->dsc_config->num_slices_h != 0 &&
 				       update->dsc_config->num_slices_v != 0);
 
-		stream->timing.dsc_cfg = *update->dsc_config;
-		stream->timing.flags.DSC = enable_dsc;
-		if (!dc->res_pool->funcs->validate_bandwidth(dc, context,
-							     true)) {
-			stream->timing.dsc_cfg = old_dsc_cfg;
-			stream->timing.flags.DSC = old_dsc_enabled;
+		/* Use temporarry context for validating new DSC config */
+		struct dc_state *dsc_validate_context = dc_create_state(dc);
+
+		if (dsc_validate_context) {
+			dc_resource_state_copy_construct(dc->current_state, dsc_validate_context);
+
+			stream->timing.dsc_cfg = *update->dsc_config;
+			stream->timing.flags.DSC = enable_dsc;
+			if (!dc->res_pool->funcs->validate_bandwidth(dc, dsc_validate_context, true)) {
+				stream->timing.dsc_cfg = old_dsc_cfg;
+				stream->timing.flags.DSC = old_dsc_enabled;
+				update->dsc_config = false;
+			}
+
+			dc_release_state(dsc_validate_context);
+		} else {
+			DC_ERROR("Failed to allocate new validate context for DSC change\n");
+			update->dsc_config = false;
 		}
 	}
 }
-- 
2.24.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2019-11-12  0:33 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-12  0:32 [PATCH 00/30] DC Patches 11 Nov 2019 Rodrigo Siqueira
2019-11-12  0:32 ` Rodrigo Siqueira
     [not found] ` <20191112003324.8419-1-Rodrigo.Siqueira-5C7GfCeVMHo@public.gmane.org>
2019-11-12  0:32   ` [PATCH 01/30] drm/amd/display: add automated audio test support Rodrigo Siqueira
2019-11-12  0:32     ` Rodrigo Siqueira
2019-11-12  0:32   ` [PATCH 02/30] drm/amd/display: Renoir chroma viewport WA change formula Rodrigo Siqueira
2019-11-12  0:32     ` Rodrigo Siqueira
2019-11-12  0:32   ` [PATCH 03/30] drm/amd/display: Renoir chroma viewport WA Read the correct register Rodrigo Siqueira
2019-11-12  0:32     ` Rodrigo Siqueira
2019-11-12  0:32   ` [PATCH 04/30] drm/amd/display: Add hubp clock status in DTN log for Navi Rodrigo Siqueira
2019-11-12  0:32     ` Rodrigo Siqueira
2019-11-12  0:32   ` [PATCH 05/30] drm/amd/display: Update background color in bottommost mpcc Rodrigo Siqueira
2019-11-12  0:32     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 06/30] drm/amd/display: Fix incorrect deep color setting in YCBCR420 modes Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 07/30] drm/amd/display: 3.2.59 Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 08/30] drm/amd/display: Fix stereo with DCC enabled Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 09/30] drm/amd/display: Changes in dc to allow full update in some cases Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 10/30] drm/amd/display: Add DMUB service function check if hw initialized Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 11/30] drm/amd/display: Add DMUB param to load inst const from driver Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 12/30] drm/amd/display: Add debugfs initalization on mst connectors Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 13/30] drm/amd/display: Connect DIG FE to its BE before link training starts Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 14/30] drm/amd/display: Clean up some code with unused registers Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 15/30] drm/amd/display: revert change causing DTN hang for RV Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 16/30] drm/amd/display: Fix debugfs on MST connectors Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 17/30] drm/amd/display: cleanup of construct and destruct funcs Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 18/30] drm/amd/display: add color space option when sending link test pattern Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 19/30] drm/amd/display: Adjust DML workaround threshold Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 20/30] drm/amd/display: Add debug trace for dmcub FW autoload Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 21/30] drm/amd/display: 3.2.60 Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 22/30] drm/amd/display: add debugfs sdp hook up function for Navi Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 23/30] drm/amd/display: Avoid conflict between HDR multiplier and 3dlut Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 24/30] drm/amd/display: Don't spin forever waiting for DMCUB phy/auto init Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 25/30] drm/amd/display: cleanup of function pointer tables Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 26/30] drm/amd/display: DML Validation Dump/Check with Logging Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 27/30] drm/amd/display: Spin for DMCUB PHY init in DC Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` Rodrigo Siqueira [this message]
2019-11-12  0:33     ` [PATCH 28/30] drm/amd/display: Use a temporary copy of the current state when updating DSC config Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 29/30] drm/amd/display: Add DSC 422Native debug option Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira
2019-11-12  0:33   ` [PATCH 30/30] drm/amd/display: Add Navi10 DMUB VBIOS code Rodrigo Siqueira
2019-11-12  0:33     ` Rodrigo Siqueira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191112003324.8419-29-Rodrigo.Siqueira@amd.com \
    --to=rodrigo.siqueira-5c7gfcevmho@public.gmane.org \
    --cc=Dmytro.Laktyushkin-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=nikola.cornij-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).