Enable S/G for Picasso
Subsystems (3)
v4 cover Enable S/G for Picasso
First patches fixes a hard hang introduced by placing the display BO in GTT memory because of HW issues with cached mappings. Second patch does some minor reafactoring to resue code in thrid patch. Third patch adds check for USWC support as condition to placing APUs scanout BO in GTT. Last patch enables S/G.
Andrey Grodzovsky (3):
drm/amdgpu: Fix hard hang for S/G display BOs.
drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC drm/amdgpu: Add check for USWC support for amdgpu_display_supported_domains
Shirish S (1):
drm/amd/display: enable S/G for RAVEN chip
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 11 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 7 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 61 +++++++++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 6 files changed, 52 insertions(+), 34 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1563982066-21793-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
PATCH v4 1/4 drm/amdgpu: Fix hard hang for S/G display BOs.
HW requires for caching to be unset for scanout BO mappings when the BO placement is in GTT memory. Usually the flag to unset is passed from user mode but for FB mode this was missing.
v2:
Keep all BO placement logic in amdgpu_display_supported_domains
--- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 7 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +3 -4
@@ -137,14 +137,14 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev, mode_cmd->pitches[0 ] =amdgpu_align_pitch (adev, mode_cmd->width, cpp, fb_tiled); domain =amdgpu_display_supported_domains (adev); - height =ALIGN (mode_cmd->height,8 ); size = mode_cmd->pitches[0 ] * height; aligned_size =ALIGN (size,PAGE_SIZE ); ret =amdgpu_gem_object_create (adev, aligned_size,0 , domain,AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | -AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | -AMDGPU_GEM_CREATE_VRAM_CLEARED , +AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS | +AMDGPU_GEM_CREATE_VRAM_CLEARED | +AMDGPU_GEM_CREATE_CPU_GTT_USWC , ttm_bo_type_kernel,NULL , &gobj);if (ret) {pr_err ("failed to allocate framebuffer (%d)\n" , aligned_size);
@@ -166,7 +166,6 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,dev_err (adev->dev,"FB failed to set tiling flags\n" ); } - ret =amdgpu_bo_pin (abo, domain);if (ret) {amdgpu_bo_unreserve (abo);
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +2 -1
@@ -743,7 +743,8 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,struct amdgpu_device *adev = dev->dev_private;struct drm_gem_object *gobj;uint32_t handle; -u64 flags =AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED ; +u64 flags =AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED | +AMDGPU_GEM_CREATE_CPU_GTT_USWC ;u32 domain;int r;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v4 2/4 drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC
In reply to a message not in the archiveMove the logic to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC in amdgpu_bo_do_create into standalone helper so it can be reused in other functions.
v4:
Switch to return bool.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 61 +++++++++++++++++------------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 + 2 files changed, 37 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +35 -26
@@ -413,6 +413,40 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,return false; } +bool amdgpu_bo_support_uswc (u64 bo_flags) +{ + +#ifdef CONFIG_X86_32 +/* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit +* See https://bugs.freedesktop.org/show_bug.cgi?id=84627 +*/ + return false +#elif defined(CONFIG_X86 ) && !defined(CONFIG_X86_PAT ) +/* Don't try to enable write-combining when it can't work, or things +* may be slow +* See https://bugs.freedesktop.org/show_bug.cgi?id=88758 +*/ + +#ifndef CONFIG_COMPILE_TEST +#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \ + thanks to write-combining +#endif + +if (bo_flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) +DRM_INFO_ONCE ("Please enable CONFIG_MTRR and CONFIG_X86_PAT for " +"better performance thanks to write-combining\n" ); +return false; +#else +/* For architectures that don't support WC memory, +* mask out the WC flag from the BO +*/ +if (!drm_arch_can_wc_memory ()) +return false; + +return true; +#endif +} +static int amdgpu_bo_do_create (struct amdgpu_device *adev,struct amdgpu_bo_param *bp,struct amdgpu_bo **bo_ptr)
@@ -466,33 +500,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, bo->flags = bp->flags; -#ifdef CONFIG_X86_32 -/* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit -* See https://bugs.freedesktop.org/show_bug.cgi?id=84627 -*/ - bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC ; -#elif defined(CONFIG_X86 ) && !defined(CONFIG_X86_PAT ) -/* Don't try to enable write-combining when it can't work, or things -* may be slow -* See https://bugs.freedesktop.org/show_bug.cgi?id=88758 -*/ - -#ifndef CONFIG_COMPILE_TEST -#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \ - thanks to write-combining -#endif - -if (bo->flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) -DRM_INFO_ONCE ("Please enable CONFIG_MTRR and CONFIG_X86_PAT for " -"better performance thanks to write-combining\n" ); - bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC ; -#else -/* For architectures that don't support WC memory, -* mask out the WC flag from the BO -*/ -if (!drm_arch_can_wc_memory ()) +if (amdgpu_bo_support_uswc (bo->flags)) bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC ; -#endif bo->tbo.bdev = &adev->mman.bdev; if (bp->domain & (AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA |
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +2 -0
@@ -308,5 +308,7 @@ void amdgpu_sa_bo_dump_debug_info(struct amdgpu_sa_manager *sa_manager, struct seq_file *m);#endif +bool amdgpu_bo_support_uswc (u64 bo_flags); +#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1563982066-21793-3-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
Re: [PATCH v4 2/4] drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC
Quoted 19 lines · Andrey Grodzovsky
Move the logic to clear
AMDGPU_GEM_CREATE_CPU_GTT_USWCinamdgpu_bo_do_createinto standalone helper so it can be reused in other functions.v4:
Switch to return bool.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 61 +++++++++++++++++------------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 + 2 files changed, 37 insertions(+), 26 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0@@ -413,6 +413,40 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,return false;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static bool amdgpu_bo_validate_size(struct amdgpu_device *adev, · line 423
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +8
-0} +bool amdgpu_bo_support_uswc (u64 bo_flags) +{ + +#ifdef CONFIG_X86_32 +/* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit +* See https://bugs.freedesktop.org/show_bug.cgi?id=84627 +*/ +return false
Missing semicolon.
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4
-0+#elif defined(CONFIG_X86 ) && !defined(CONFIG_X86_PAT ) +/* Don't try to enable write-combining when it can't work, or things +* may be slow +* See https://bugs.freedesktop.org/show_bug.cgi?id=88758
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static bool amdgpu_bo_validate_size(struct amdgpu_device *adev, · line 437
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +10
-0+*/ + +#ifndef CONFIG_COMPILE_TEST +#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \ + thanks to write-combining +#endif + +if (bo_flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) +DRM_INFO_ONCE ("Please enable CONFIG_MTRR and CONFIG_X86_PAT for " +"better performance thanks to write-combining\n" );
The AMDGPU_GEM_CREATE_CPU_GTT_USWC check will always pass at some point due to patch 1, so passing in the flags is kind of pointless. Just do the DRM_INFO_ONCE unconditionally here.
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static int amdgpu_bo_do_create(struct amdgpu_device *adev, · line 504
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-0@@ -466,33 +500,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, +if (amdgpu_bo_support_uswc (bo->flags)) bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC ;
Missing "!".
Signature · 6 lines
Earthling Michel Dänzer | https://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 8de768fe-5089-f7a9-da25-31c96926953a-otUistvHUpPR7s880joybQ@public.gmane.org
Re: [PATCH v4 2/4] drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC
Quoted 42 lines · Michel Dänzer
Quoted 19 lines · Andrey Grodzovsky
Move the logic to clear
AMDGPU_GEM_CREATE_CPU_GTT_USWCinamdgpu_bo_do_createinto standalone helper so it can be reused in other functions.v4:
Switch to return bool.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 61 +++++++++++++++++------------- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 2 + 2 files changed, 37 insertions(+), 26 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0@@ -413,6 +413,40 @@ static bool amdgpu_bo_validate_size(struct amdgpu_device *adev,return false;drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static bool amdgpu_bo_validate_size(struct amdgpu_device *adev, · line 423
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +8
-0} +bool amdgpu_bo_support_uswc (u64 bo_flags) +{ + +#ifdef CONFIG_X86_32 +/* XXX: Write-combined CPU mappings of GTT seem broken on 32-bit +* See https://bugs.freedesktop.org/show_bug.cgi?id=84627 +*/ +return falseMissing semicolon.
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +9
-0+#elif defined(CONFIG_X86 ) && !defined(CONFIG_X86_PAT ) +/* Don't try to enable write-combining when it can't work, or things +* may be slow +* See https://bugs.freedesktop.org/show_bug.cgi?id=88758 +*/ + +#ifndef CONFIG_COMPILE_TEST +#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \ + thanks to write-combining
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static bool amdgpu_bo_validate_size(struct amdgpu_device *adev, · line 437
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5
-0+#endif + +if (bo_flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) +DRM_INFO_ONCE ("Please enable CONFIG_MTRR and CONFIG_X86_PAT for " +"better performance thanks to write-combining\n" );The
AMDGPU_GEM_CREATE_CPU_GTT_USWCcheck will always pass at some point due to patch 1, so passing in the flags is kind of pointless. Just do theDRM_INFO_ONCEunconditionally here.
AMDGPU_GEM_CREATE_CPU_GTT_USWC is set unconditionally only for FB console BOs in patch 1, for user mode BOs this flag might not be set in user mode and so this warning shouldn't pop in this case.
Andrey
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static int amdgpu_bo_do_create(struct amdgpu_device *adev, · line 504
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-0@@ -466,33 +500,8 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, +if (amdgpu_bo_support_uswc (bo->flags)) bo->flags &= ~AMDGPU_GEM_CREATE_CPU_GTT_USWC ;Missing "!".
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): fc62b097-c85c-4d87-92db-96167403d26c-5C7GfCeVMHo@public.gmane.org
Re: [PATCH v4 2/4] drm/amdgpu: Create helper to clear AMDGPU_GEM_CREATE_CPU_GTT_USWC
Quoted 31 lines · Andrey
Quoted 21 lines · Michel Dänzer
Quoted 20 lines · Andrey Grodzovsky
Move the logic to clear
AMDGPU_GEM_CREATE_CPU_GTT_USWCinamdgpu_bo_do_createinto standalone helper so it can be reused in other functions.v4:
Switch to return bool.Signed-off-by Andrey Grodzovsky <[email protected]>---
[...]drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +9
-0+#elif defined(CONFIG_X86 ) && !defined(CONFIG_X86_PAT ) +/* Don't try to enable write-combining when it can't work, or things +* may be slow +* See https://bugs.freedesktop.org/show_bug.cgi?id=88758 +*/ + +#ifndef CONFIG_COMPILE_TEST +#warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \ + thanks to write-combiningQuoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c static bool amdgpu_bo_validate_size(struct amdgpu_device *adev, · line 437
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +5
-0+#endif + +if (bo_flags &AMDGPU_GEM_CREATE_CPU_GTT_USWC ) +DRM_INFO_ONCE ("Please enable CONFIG_MTRR and CONFIG_X86_PAT for " +"better performance thanks to write-combining\n" );The
AMDGPU_GEM_CREATE_CPU_GTT_USWCcheck will always pass at some point due to patch 1, so passing in the flags is kind of pointless. Just do theDRM_INFO_ONCEunconditionally here.
Quoted 2 lines
AMDGPU_GEM_CREATE_CPU_GTT_USWCis set unconditionally only for FB console BOs in patch 1, for user mode BOs this flag might not be set in user mode and so this warning shouldn't pop in this case.
You're right in theory, but in practice this is pretty unlikely at this point, other than maybe a headless machine which only runs compute workloads (in which case PAT might be desirable anyway for other reasons?).
Anyway, it's just my opinion that no flags need to be passed in, not a blocker.
Signature · 6 lines
Earthling Michel Dänzer | https://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v4 3/4 drm/amdgpu: Add check for USWC support for amdgpu_display_supported_domains
In reply to a message not in the archiveThis verifies we don't add GTT as allowed domnain for APUs when USWC is disabled.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +8 -1
@@ -498,8 +498,15 @@ uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev)uint32_t domain =AMDGPU_GEM_DOMAIN_VRAM ;#if defined(CONFIG_DRM_AMD_DC ) +/* +* if amdgpu_bo_validate_uswc returns false it means that USWC mappings +* is not supported for this board. But this mapping is required +* to avoid hang caused by placement of scanout BO in GTT on certain +* APUs. So force the BO placement to VRAM in case this architecture +* will not allow USWC mappings. +*/ if (adev->asic_type >=CHIP_CARRIZO && adev->asic_type <CHIP_RAVEN && - adev->flags &AMD_IS_APU && + adev->flags &AMD_IS_APU &&amdgpu_bo_support_uswc (0 ) &&amdgpu_device_asic_has_dc_support (adev->asic_type)) domain |=AMDGPU_GEM_DOMAIN_GTT ;#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH v4 4/4 drm/amd/display: enable S/G for RAVEN chip
In reply to a message not in the archiveFrom: Shirish S <[email protected]>
enables gpu_vm_support in dm and adds AMDGPU_GEM_DOMAIN_GTT as supported domain
v2:
Move BO placement logic into amdgpu_display_supported_domains
v3:
Use amdgpu_bo_validate_uswc in amdgpu_display_supported_domains.
v4: v2+v3 moved to standalone patch.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 2 +- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +1 -1
@@ -505,7 +505,7 @@ uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev)* APUs. So force the BO placement to VRAM in case this architecture * will not allow USWC mappings. */ -if (adev->asic_type >=CHIP_CARRIZO && adev->asic_type <CHIP_RAVEN && +if (adev->asic_type >=CHIP_CARRIZO && adev->asic_type <=CHIP_RAVEN && adev->flags &AMD_IS_APU &&amdgpu_bo_support_uswc (0 ) &&amdgpu_device_asic_has_dc_support (adev->asic_type)) domain |=AMDGPU_GEM_DOMAIN_GTT ;
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -1
@@ -686,7 +686,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)*/ if (adev->flags &AMD_IS_APU && adev->asic_type >=CHIP_CARRIZO && - adev->asic_type <CHIP_RAVEN ) + adev->asic_type <=CHIP_RAVEN ) init_data.flags.gpu_vm_support = true;if (amdgpu_dc_feature_mask &DC_FBC_MASK )
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx