dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Sasha Levin <sashal@kernel.org>, Eric Yang <Eric.Yang2@amd.com>,
	Tony Cheng <Tony.Cheng@amd.com>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Alex Deucher <alexander.deucher@amd.com>,
	Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Subject: [PATCH AUTOSEL 5.5 138/542] drm/amd/display: Renoir chroma viewport WA
Date: Fri, 14 Feb 2020 10:42:10 -0500	[thread overview]
Message-ID: <20200214154854.6746-138-sashal@kernel.org> (raw)
In-Reply-To: <20200214154854.6746-1-sashal@kernel.org>

From: Eric Yang <Eric.Yang2@amd.com>

[ Upstream commit 1cad8ff7ecc6b70a062b8e8b74a0cd08c928341d ]

[Why]
For unknown reason, immediate flip with host VM translation on NV12
surface will underflow on last row of PTE.

[How]
Hack chroma viewport height to make fetch one more row of PTE.
Note that this will cause hubp underflow on all video underlay
cases, but the underflow is not user visible since it is in
blank region.

Signed-off-by: Eric Yang <Eric.Yang2@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/display/dc/dc.h           |  2 +
 .../gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c | 65 ++++++++++++++++++-
 .../drm/amd/display/dc/dcn21/dcn21_resource.c |  1 +
 3 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 0416a17b0897c..320f4eeebf84c 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -417,6 +417,8 @@ struct dc_debug_options {
 	bool cm_in_bypass;
 #endif
 	int force_clock_mode;/*every mode change.*/
+
+	bool nv12_iflip_vm_wa;
 };
 
 struct dc_debug_data {
diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c
index 2f5a5867e6749..1ddd6ae221558 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_hubp.c
@@ -164,6 +164,69 @@ static void hubp21_setup(
 
 }
 
+void hubp21_set_viewport(
+	struct hubp *hubp,
+	const struct rect *viewport,
+	const struct rect *viewport_c)
+{
+	struct dcn21_hubp *hubp21 = TO_DCN21_HUBP(hubp);
+	int patched_viewport_height = 0;
+	struct dc_debug_options *debug = &hubp->ctx->dc->debug;
+
+	REG_SET_2(DCSURF_PRI_VIEWPORT_DIMENSION, 0,
+		  PRI_VIEWPORT_WIDTH, viewport->width,
+		  PRI_VIEWPORT_HEIGHT, viewport->height);
+
+	REG_SET_2(DCSURF_PRI_VIEWPORT_START, 0,
+		  PRI_VIEWPORT_X_START, viewport->x,
+		  PRI_VIEWPORT_Y_START, viewport->y);
+
+	/*for stereo*/
+	REG_SET_2(DCSURF_SEC_VIEWPORT_DIMENSION, 0,
+		  SEC_VIEWPORT_WIDTH, viewport->width,
+		  SEC_VIEWPORT_HEIGHT, viewport->height);
+
+	REG_SET_2(DCSURF_SEC_VIEWPORT_START, 0,
+		  SEC_VIEWPORT_X_START, viewport->x,
+		  SEC_VIEWPORT_Y_START, viewport->y);
+
+	/*
+	 *	Work around for underflow issue with NV12 + rIOMMU translation
+	 *	+ immediate flip. This will cause hubp underflow, but will not
+	 *	be user visible since underflow is in blank region
+	 */
+	patched_viewport_height = viewport_c->height;
+	if (viewport_c->height != 0 && debug->nv12_iflip_vm_wa) {
+		int pte_row_height = 0;
+		int pte_rows = 0;
+
+		REG_GET(DCHUBP_REQ_SIZE_CONFIG,
+			PTE_ROW_HEIGHT_LINEAR, &pte_row_height);
+
+		pte_row_height = 1 << (pte_row_height + 3);
+		pte_rows = (viewport_c->height + pte_row_height - 1) / pte_row_height;
+		patched_viewport_height = pte_rows * pte_row_height + 3;
+	}
+
+
+	/* DC supports NV12 only at the moment */
+	REG_SET_2(DCSURF_PRI_VIEWPORT_DIMENSION_C, 0,
+		  PRI_VIEWPORT_WIDTH_C, viewport_c->width,
+		  PRI_VIEWPORT_HEIGHT_C, patched_viewport_height);
+
+	REG_SET_2(DCSURF_PRI_VIEWPORT_START_C, 0,
+		  PRI_VIEWPORT_X_START_C, viewport_c->x,
+		  PRI_VIEWPORT_Y_START_C, viewport_c->y);
+
+	REG_SET_2(DCSURF_SEC_VIEWPORT_DIMENSION_C, 0,
+		  SEC_VIEWPORT_WIDTH_C, viewport_c->width,
+		  SEC_VIEWPORT_HEIGHT_C, patched_viewport_height);
+
+	REG_SET_2(DCSURF_SEC_VIEWPORT_START_C, 0,
+		  SEC_VIEWPORT_X_START_C, viewport_c->x,
+		  SEC_VIEWPORT_Y_START_C, viewport_c->y);
+}
+
 void hubp21_set_vm_system_aperture_settings(struct hubp *hubp,
 		struct vm_system_aperture_param *apt)
 {
@@ -211,7 +274,7 @@ static struct hubp_funcs dcn21_hubp_funcs = {
 	.hubp_set_vm_system_aperture_settings = hubp21_set_vm_system_aperture_settings,
 	.set_blank = hubp1_set_blank,
 	.dcc_control = hubp1_dcc_control,
-	.mem_program_viewport = min_set_viewport,
+	.mem_program_viewport = hubp21_set_viewport,
 	.set_cursor_attributes	= hubp2_cursor_set_attributes,
 	.set_cursor_position	= hubp1_cursor_set_position,
 	.hubp_clk_cntl = hubp1_clk_cntl,
diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
index b29b2c99a564e..fe0ed4c09ad0a 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/dcn21_resource.c
@@ -847,6 +847,7 @@ static const struct dc_debug_options debug_defaults_drv = {
 		.scl_reset_length10 = true,
 		.sanity_checks = true,
 		.disable_48mhz_pwrdwn = false,
+		.nv12_iflip_vm_wa = true
 };
 
 static const struct dc_debug_options debug_defaults_diags = {
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-02-14 15:51 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 15:39 [PATCH AUTOSEL 5.5 001/542] drm/amdgpu: remove set but not used variable 'mc_shared_chmap' from 'gfx_v6_0.c' and 'gfx_v7_0.c' Sasha Levin
2020-02-14 15:39 ` [PATCH AUTOSEL 5.5 002/542] drm/gma500: Fixup fbdev stolen size usage evaluation Sasha Levin
2020-02-14 15:39 ` [PATCH AUTOSEL 5.5 003/542] drm/dp_mst: fix multiple frees of tx->bytes Sasha Levin
2020-02-14 15:39 ` [PATCH AUTOSEL 5.5 006/542] drm/virtio: fix byteorder handling in virtio_gpu_cmd_transfer_{from, to}_host_3d functions Sasha Levin
2020-02-14 15:39 ` [PATCH AUTOSEL 5.5 007/542] drm/qxl: Complete exception handling in qxl_device_init() Sasha Levin
2020-02-14 15:40 ` [PATCH AUTOSEL 5.5 024/542] drm: rcar-du: Recognize "renesas, vsps" in addition to "vsps" Sasha Levin
2020-02-14 15:40 ` [PATCH AUTOSEL 5.5 029/542] drm/amd/display: Map ODM memory correctly when doing ODM combine Sasha Levin
2020-02-14 15:40 ` [PATCH AUTOSEL 5.5 037/542] drm/mipi_dbi: Fix off-by-one bugs in mipi_dbi_blank() Sasha Levin
2020-02-14 15:40 ` [PATCH AUTOSEL 5.5 038/542] drm/msm/adreno: fix zap vs no-zap handling Sasha Levin
2020-02-14 15:40 ` [PATCH AUTOSEL 5.5 039/542] pxa168fb: Fix the function used to release some memory in an error handling path Sasha Levin
2020-02-14 15:41 ` [PATCH AUTOSEL 5.5 070/542] drm/amdgpu/sriov: workaround on rev_id for Navi12 under sriov Sasha Levin
2020-02-14 15:41 ` [PATCH AUTOSEL 5.5 074/542] drm/nouveau/nouveau: fix incorrect sizeof on args.src an args.dst Sasha Levin
2020-02-14 15:41 ` [PATCH AUTOSEL 5.5 080/542] drm/amd/display: Clear state after exiting fixed active VRR state Sasha Levin
2020-02-14 15:41 ` [PATCH AUTOSEL 5.5 095/542] backlight: qcom-wled: Fix unsigned comparison to zero Sasha Levin
2020-02-14 15:41 ` [PATCH AUTOSEL 5.5 117/542] drm/amd/display: Retrain dongles when SINK_COUNT becomes non-zero Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 131/542] drm/amdkfd: Fix a bug in SDMA RLC queue counting under HWS mode Sasha Levin
2020-02-14 15:42 ` Sasha Levin [this message]
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 139/542] drm/amdgpu: remove 4 set but not used variable in amdgpu_atombios_get_connector_info_from_object_table Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 140/542] drm/amdgpu: remove set but not used variable 'dig_connector' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 141/542] drm/amdgpu: remove set but not used variable 'dig' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 142/542] drm/amdgpu: remove always false comparison in 'amdgpu_atombios_i2c_process_i2c_ch' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 143/542] drm/amdgpu: remove set but not used variable 'mc_shared_chmap' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 144/542] drm/amd/powerplay: remove set but not used variable 'vbios_version', 'data' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 145/542] drm/amd/powerplay: remove set but not used variable 'data' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 146/542] drm/amd/powerplay: remove set but not used variable 'threshold', 'state' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 147/542] drm/amdgpu: remove set but not used variable 'amdgpu_connector' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 148/542] drm/amdgpu: remove set but not used variable 'count' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 149/542] drm/amdgpu: remove set but not used variable 'invalid' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 150/542] drm/amd/powerplay: remove set but not used variable 'us_mvdd' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 151/542] drm/gma500: remove set but not used variable 'htotal' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 152/542] drm/gma500: remove set but not used variable 'error' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 153/542] drm/gma500: remove set but not used variable 'is_hdmi', 'is_crt' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 154/542] drm/gma500: remove set but not used variable 'channel_eq' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 155/542] drm/amdkfd: remove set but not used variable 'top_dev' Sasha Levin
2020-02-14 21:44   ` Greg KH
2020-02-14 23:59     ` Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 156/542] drm/amd/display: remove set but not used variable 'old_plane_crtc' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 157/542] drm/amd/display: remove set but not used variable 'bp' in bios_parser2.c Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 158/542] drm/amd/display: remove set but not used variable 'bp' in bios_parser.c Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 159/542] drm/amd/display: remove set but not used variable 'min_content' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 160/542] drm/amdgpu/dm: Do not throw an error for a display with no audio Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 161/542] drm/radeon: remove set but not used variable 'size', 'relocs_chunk' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 162/542] drm/radeon: remove set but not used variable 'backbias_response_time' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 163/542] drm/radeon: remove set but not used variable 'dig_connector' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 164/542] drm/radeon: remove set but not used variable 'radeon_connector' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 165/542] drm/radeon: remove set but not used variable 'blocks' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 166/542] drm/radeon: remove set but not used variable 'tv_pll_cntl1' Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 168/542] drm/amdgpu: Ensure ret is always initialized when using SOC15_WAIT_ON_RREG Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 169/542] drm/panel: simple: Add Logic PD Type 28 display support Sasha Levin
2020-02-14 15:42 ` [PATCH AUTOSEL 5.5 179/542] Revert "drm/amdgpu: enable VCN DPG on Raven and Raven2" Sasha Levin
2020-02-14 15:43 ` [PATCH AUTOSEL 5.5 208/542] gpu/drm: ingenic: Avoid null pointer deference in plane atomic update Sasha Levin
2020-02-14 15:43 ` [PATCH AUTOSEL 5.5 232/542] drm/amd/display: Fix update_bw_bounding_box Calcs Sasha Levin
2020-02-14 15:43 ` [PATCH AUTOSEL 5.5 233/542] drm/amd/display: Lower DPP DTO only when safe Sasha Levin
2020-02-14 15:43 ` [PATCH AUTOSEL 5.5 234/542] drm/amdgpu: fix double gpu_recovery for NV of SRIOV Sasha Levin
2020-02-14 15:43 ` [PATCH AUTOSEL 5.5 235/542] drm/amdgpu: fix KIQ ring test fail in TDR " Sasha Levin
2020-02-14 15:43 ` [PATCH AUTOSEL 5.5 244/542] drm/mediatek: handle events when enabling/disabling crtc Sasha Levin
2020-02-14 15:44 ` [PATCH AUTOSEL 5.5 271/542] drm/fbdev: Fallback to non tiled mode if all tiles not present Sasha Levin
2020-02-14 15:44 ` [PATCH AUTOSEL 5.5 276/542] fbdev: fix numbering of fbcon options Sasha Levin
2020-02-14 15:44 ` [PATCH AUTOSEL 5.5 293/542] drm/amdkfd: Fix permissions of hang_hws Sasha Levin
2020-02-14 15:44 ` [PATCH AUTOSEL 5.5 296/542] drm: remove the newline for CRC source name Sasha Levin
2020-02-14 15:44 ` [PATCH AUTOSEL 5.5 299/542] drm/gma500: remove set but not used variables 'hist_reg' Sasha Levin
2020-02-14 15:45 ` [PATCH AUTOSEL 5.5 311/542] drm/mediatek: Add gamma property according to hardware capability Sasha Levin
2020-02-14 15:45 ` [PATCH AUTOSEL 5.5 355/542] drm/nouveau/secboot/gm20b: initialize pointer in gm20b_secboot_new() Sasha Levin
2020-02-14 15:45 ` [PATCH AUTOSEL 5.5 356/542] drm/nouveau/gr/gk20a, gm200-: add terminators to method lists read from fw Sasha Levin
2020-02-14 15:45 ` [PATCH AUTOSEL 5.5 357/542] drm/nouveau: Fix copy-paste error in nouveau_fence_wait_uevent_handler Sasha Levin
2020-02-14 15:45 ` [PATCH AUTOSEL 5.5 358/542] drm/nouveau/drm/ttm: Remove set but not used variable 'mem' Sasha Levin
2020-02-14 15:45 ` [PATCH AUTOSEL 5.5 359/542] drm/nouveau/fault/gv100-: fix memory leak on module unload Sasha Levin
2020-02-14 15:45 ` [PATCH AUTOSEL 5.5 362/542] drm/vmwgfx: prevent memory leak in vmw_cmdbuf_res_add Sasha Levin
2020-02-14 15:46 ` [PATCH AUTOSEL 5.5 390/542] drm/amd/display: fixup DML dependencies Sasha Levin
2020-02-14 15:46 ` [PATCH AUTOSEL 5.5 408/542] drm/amdgpu: add the lost mutex_init back Sasha Levin
2020-02-14 16:22   ` Alex Deucher
2020-02-20 17:36     ` Sasha Levin
2020-02-14 15:47 ` [PATCH AUTOSEL 5.5 441/542] drm/nouveau/mmu: fix comptag memory leak Sasha Levin
2020-02-14 15:47 ` [PATCH AUTOSEL 5.5 442/542] drm/nouveau/kms/nv50: remove set but not unused variable 'nv_connector' Sasha Levin
2020-02-14 15:47 ` [PATCH AUTOSEL 5.5 481/542] video: hyperv: hyperv_fb: Use physical memory for fb on HyperV Gen 1 VMs Sasha Levin
2020-02-14 15:48 ` [PATCH AUTOSEL 5.5 491/542] drm/amd/display: do not allocate display_mode_lib unnecessarily Sasha Levin
2020-02-14 15:48 ` [PATCH AUTOSEL 5.5 494/542] drm/nouveau/disp/nv50-: prevent oops when no channel method map provided Sasha Levin
2020-02-14 15:48 ` [PATCH AUTOSEL 5.5 499/542] radeon: insert 10ms sleep in dce5_crtc_load_lut Sasha Levin
2020-02-14 15:48 ` [PATCH AUTOSEL 5.5 529/542] drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_latency Sasha Levin
2020-02-14 15:48 ` [PATCH AUTOSEL 5.5 530/542] drm/amdgpu/smu10: fix smu10_get_clock_by_type_with_voltage Sasha Levin
2020-02-14 16:31   ` Alex Deucher
2020-02-20 19:26     ` Sasha Levin
2020-02-20 20:08       ` Alex Deucher
2020-02-14 16:08 ` [PATCH AUTOSEL 5.5 001/542] drm/amdgpu: remove set but not used variable 'mc_shared_chmap' from 'gfx_v6_0.c' and 'gfx_v7_0.c' Alex Deucher

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=20200214154854.6746-138-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=Bhawanpreet.Lakha@amd.com \
    --cc=Eric.Yang2@amd.com \
    --cc=Tony.Cheng@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.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).