All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harry Wentland <harry.wentland-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Hersen Wu <hersenxs.wu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 05/28] drm/amd/display: Request to have DCN RV pipe Harvesting
Date: Mon, 11 Sep 2017 14:09:07 -0400	[thread overview]
Message-ID: <20170911180930.13561-6-harry.wentland@amd.com> (raw)
In-Reply-To: <20170911180930.13561-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>

From: Hersen Wu <hersenxs.wu@amd.com>

TODO: Current change only work for sucessive last fused pipe,
like p3, or p3,p2. It does not work for fused p1,p2.

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
---
 .../gpu/drm/amd/display/dc/dcn10/dcn10_resource.c  | 55 +++++++++++++++++-----
 1 file changed, 43 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
index fff86ad0c411..ac6d01ec0505 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
@@ -1207,13 +1207,23 @@ static struct resource_funcs dcn10_res_pool_funcs = {
 	.add_stream_to_ctx = dcn10_add_stream_to_ctx
 };
 
+static uint32_t read_pipe_fuses(struct dc_context *ctx)
+{
+	uint32_t value = dm_read_reg_soc15(ctx, mmCC_DC_PIPE_DIS, 0);
+	/* RV1 support max 4 pipes */
+	value = value & 0xf;
+	return value;
+}
+
 static bool construct(
 	uint8_t num_virtual_links,
 	struct dc *dc,
 	struct dcn10_resource_pool *pool)
 {
 	int i;
+	int j;
 	struct dc_context *ctx = dc->ctx;
+	uint32_t pipe_fuses = read_pipe_fuses(ctx);
 
 	ctx->dc_bios->regs = &bios_regs;
 
@@ -1230,8 +1240,9 @@ static bool construct(
 	 *************************************************/
 	pool->base.underlay_pipe_index = NO_UNDERLAY_PIPE;
 
-	/* TODO: Hardcode to correct number of functional controllers */
-	pool->base.pipe_count = 4;
+	/* max pipe num for ASIC before check pipe fuses */
+	pool->base.pipe_count = pool->base.res_cap->num_timing_generator;
+
 	dc->caps.max_downscale_ratio = 200;
 	dc->caps.i2c_speed_in_khz = 100;
 	dc->caps.max_cursor_size = 256;
@@ -1355,48 +1366,68 @@ static bool construct(
 	#endif
 	}
 
+	/* index to valid pipe resource  */
+	j = 0;
 	/* mem input -> ipp -> dpp -> opp -> TG */
 	for (i = 0; i < pool->base.pipe_count; i++) {
-		pool->base.mis[i] = dcn10_mem_input_create(ctx, i);
-		if (pool->base.mis[i] == NULL) {
+		/* if pipe is disabled, skip instance of HW pipe,
+		 * i.e, skip ASIC register instance
+		 */
+		if ((pipe_fuses & (1 << i)) != 0)
+			continue;
+
+		pool->base.mis[j] = dcn10_mem_input_create(ctx, i);
+		if (pool->base.mis[j] == NULL) {
 			BREAK_TO_DEBUGGER();
 			dm_error(
 				"DC: failed to create memory input!\n");
 			goto mi_create_fail;
 		}
 
-		pool->base.ipps[i] = dcn10_ipp_create(ctx, i);
-		if (pool->base.ipps[i] == NULL) {
+		pool->base.ipps[j] = dcn10_ipp_create(ctx, i);
+		if (pool->base.ipps[j] == NULL) {
 			BREAK_TO_DEBUGGER();
 			dm_error(
 				"DC: failed to create input pixel processor!\n");
 			goto ipp_create_fail;
 		}
 
-		pool->base.transforms[i] = dcn10_dpp_create(ctx, i);
-		if (pool->base.transforms[i] == NULL) {
+		pool->base.transforms[j] = dcn10_dpp_create(ctx, i);
+		if (pool->base.transforms[j] == NULL) {
 			BREAK_TO_DEBUGGER();
 			dm_error(
 				"DC: failed to create dpp!\n");
 			goto dpp_create_fail;
 		}
 
-		pool->base.opps[i] = dcn10_opp_create(ctx, i);
-		if (pool->base.opps[i] == NULL) {
+		pool->base.opps[j] = dcn10_opp_create(ctx, i);
+		if (pool->base.opps[j] == NULL) {
 			BREAK_TO_DEBUGGER();
 			dm_error(
 				"DC: failed to create output pixel processor!\n");
 			goto opp_create_fail;
 		}
 
-		pool->base.timing_generators[i] = dcn10_timing_generator_create(
+		pool->base.timing_generators[j] = dcn10_timing_generator_create(
 				ctx, i);
-		if (pool->base.timing_generators[i] == NULL) {
+		if (pool->base.timing_generators[j] == NULL) {
 			BREAK_TO_DEBUGGER();
 			dm_error("DC: failed to create tg!\n");
 			goto otg_create_fail;
 		}
+		/* check next valid pipe */
+		j++;
 	}
+
+	/* valid pipe num */
+	pool->base.pipe_count = j;
+
+	/* within dml lib, it is hard code to 4. If ASIC pipe is fused,
+	 * the value may be changed
+	 */
+	dc->dml.ip.max_num_dpp = pool->base.pipe_count;
+	dc->dcn_ip->max_num_dpp = pool->base.pipe_count;
+
 	pool->base.mpc = dcn10_mpc_create(ctx);
 	if (pool->base.mpc == NULL) {
 		BREAK_TO_DEBUGGER();
-- 
2.11.0

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

  parent reply	other threads:[~2017-09-11 18:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 18:09 [PATCH 00/28] DC Linux Patches Sep 11, 2017 Harry Wentland
     [not found] ` <20170911180930.13561-1-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2017-09-11 18:09   ` [PATCH 01/28] drm/amd/display: Get OTG info if OTG master enabled Harry Wentland
2017-09-11 18:09   ` [PATCH 02/28] drm/amd/display: Added negative check for vertical line start Harry Wentland
2017-09-11 18:09   ` [PATCH 03/28] drm/amd/display: Remove sanity check Harry Wentland
2017-09-11 18:09   ` [PATCH 04/28] drm/amd/display: Use TPS4 instead of CP2520_3 for phy pattern 7 Harry Wentland
2017-09-11 18:09   ` Harry Wentland [this message]
2017-09-11 18:09   ` [PATCH 06/28] drm/amd/display: dce110: fix plane validation Harry Wentland
2017-09-11 18:09   ` [PATCH 07/28] drm/amd/display: USB-C to HDMI dongle not light Harry Wentland
     [not found]     ` <20170911180930.13561-8-harry.wentland-5C7GfCeVMHo@public.gmane.org>
2017-09-11 20:20       ` Dave Airlie
2017-09-11 18:09   ` [PATCH 08/28] drm/amd/display: set CP2520 Test pattern to use DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE Harry Wentland
2017-09-11 18:09   ` [PATCH 09/28] drm/amd/display: fix crc_source_select use hardcoded color depth Harry Wentland
2017-09-11 18:09   ` [PATCH 10/28] drm/amd/display: Enable dcn10_power_on_fe log by default Harry Wentland
2017-09-11 18:09   ` [PATCH 11/28] drm/amd/display: fix default dithering Harry Wentland
2017-09-11 18:09   ` [PATCH 12/28] drm/amd/display: Fix context alloc failed logging Harry Wentland
2017-09-11 18:09   ` [PATCH 13/28] drm/amd/display: seperate dpp_cm_helper functions into new file Harry Wentland
2017-09-11 18:09   ` [PATCH 14/28] drm/amd/display: Don't reset clock source at unref Harry Wentland
2017-09-11 18:09   ` [PATCH 15/28] drm/amd/display: Power down clock source at commit Harry Wentland
2017-09-11 18:09   ` [PATCH 16/28] drm/amd/display: Remove switching of clk sources at end of commit Harry Wentland
2017-09-11 18:09   ` [PATCH 17/28] drm/amd/display: remove output_format from ipp_setup Harry Wentland
2017-09-11 18:09   ` [PATCH 18/28] drm/amd/display: move dwb registers to header file Harry Wentland
2017-09-11 18:09   ` [PATCH 19/28] drm/amd/display: No need to keep track of unreffed clk sources Harry Wentland

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=20170911180930.13561-6-harry.wentland@amd.com \
    --to=harry.wentland-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=hersenxs.wu-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.