All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Deucher, Alexander" <Alexander.Deucher@amd.com>
To: "Wentland, Harry" <Harry.Wentland@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"Koenig, Christian" <Christian.Koenig@amd.com>,
	"Lee, Becle" <Becle.Lee@amd.com>,
	"Huang, Rex" <Rex.Huang@amd.com>,
	"Huang, Ray" <Ray.Huang@amd.com>
Cc: "Wentland, Harry" <Harry.Wentland@amd.com>
Subject: RE: [PATCH] drm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2
Date: Thu, 6 Jan 2022 15:30:43 +0000	[thread overview]
Message-ID: <BL1PR12MB51446FCF05C6914E1965D128F74C9@BL1PR12MB5144.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20220105203901.52175-1-harry.wentland@amd.com>

[Public]

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> Harry Wentland
> Sent: Wednesday, January 5, 2022 3:39 PM
> To: amd-gfx@lists.freedesktop.org; Koenig, Christian
> <Christian.Koenig@amd.com>; Lee, Becle <Becle.Lee@amd.com>; Huang,
> Rex <Rex.Huang@amd.com>; Huang, Ray <Ray.Huang@amd.com>
> Cc: Wentland, Harry <Harry.Wentland@amd.com>
> Subject: [PATCH] drm/amdgpu: Use correct VIEWPORT_DIMENSION for
> DCN2
> 
> For some reason this file isn't using the appropriate register headers for DCN
> headers, which means that on DCN2 we're getting the
> VIEWPORT_DIMENSION offset wrong.
> 
> This means that we're not correctly carving out the framebuffer memory
> correctly for a framebuffer allocated by EFI and therefore see corruption
> when loading amdgpu before the display driver takes over control of the
> framebuffer scanout.
> 
> Fix this by checking the DCE_HWIP and picking the correct offset accordingly.
> 
> Long-term we should expose this info from DC as GMC shouldn't need to
> know about DCN registers.
> 
> Signed-off-by: Harry Wentland <harry.wentland@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> index 57f2729a7bd0..8367ecf61af1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
> @@ -72,6 +72,9 @@
>  #define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0
> 0x049d
>  #define mmDCHUBBUB_SDPIF_MMIO_CNTRL_0_BASE_IDX
> 2
> 
> +#define DCN2_mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION
> 0x05ea
> +#define
> DCN2_mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION_BASE_IDX
> 2
> +

We normally append the _DCN2 to the end in these cases of the macro.  With that fixed,
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> 
>  static const char *gfxhub_client_ids[] = {
>  	"CB",
> @@ -1142,7 +1145,6 @@ static unsigned
> gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
>  		switch (adev->ip_versions[DCE_HWIP][0]) {
>  		case IP_VERSION(1, 0, 0):
>  		case IP_VERSION(1, 0, 1):
> -		case IP_VERSION(2, 1, 0):
>  			viewport = RREG32_SOC15(DCE, 0,
> mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION);
>  			size = (REG_GET_FIELD(viewport,
> 
> HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_HEIGHT) *
> @@ -1150,6 +1152,14 @@ static unsigned
> gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
> 
> HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH) *
>  				4);
>  			break;
> +		case IP_VERSION(2, 1, 0):
> +			viewport = RREG32_SOC15(DCE, 0,
> DCN2_mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION);
> +			size = (REG_GET_FIELD(viewport,
> +
> HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_HEIGHT) *
> +				REG_GET_FIELD(viewport,
> +
> HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH) *
> +				4);
> +			break;
>  		default:
>  			viewport = RREG32_SOC15(DCE, 0,
> mmSCL0_VIEWPORT_SIZE);
>  			size = (REG_GET_FIELD(viewport,
> SCL0_VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
> --
> 2.34.1

  parent reply	other threads:[~2022-01-06 15:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-05 20:39 [PATCH] drm/amdgpu: Use correct VIEWPORT_DIMENSION for DCN2 Harry Wentland
2022-01-06  0:39 ` Huang Rui
2022-01-06  9:17 ` Christian König
2022-01-06 15:30 ` Deucher, Alexander [this message]
2022-01-25 15:21 Mario Limonciello
2022-01-25 15:46 ` Limonciello, Mario
2022-01-25 15:50 ` Greg KH
2022-01-25 15:52   ` Limonciello, Mario
2022-01-27 15:47     ` Greg KH

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=BL1PR12MB51446FCF05C6914E1965D128F74C9@BL1PR12MB5144.namprd12.prod.outlook.com \
    --to=alexander.deucher@amd.com \
    --cc=Becle.Lee@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=Rex.Huang@amd.com \
    --cc=amd-gfx@lists.freedesktop.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.