drm/radeon: clear WC flag when moving bo from vram to gtt
Subsystems (2)
RFC PATCH 1/1 drm/radeon: clear WC flag when moving bo from vram to gtt
But re-add the flag is the bo is moved back to vram.
This fixes "ring 0/3 stalled" issue which happens when the driver evicts bo from vram to gtt, at least on TAHITI and CAPVERDE.
I do not know the exact reason among the following:
- si_copy_dma from vram to gtt is slow if WC
(only for the non-visible part ? specific cases ?)
- Allow snooping (SNOOPED flag from radeon_vm_bo_update).
- WC should not be set at all for bo in the GTT
(same reason why WC is only set for vram domain,
see mesa::r600_init_resource_fields since mesa commit 5b6a0b7
"gallium/radeon: set GTT WC on tiled textures")
- Bug in WC
- Same reason as why radeon_sa_bo_manager_init is not passing WC flags if older than CHIP_BONAIRE (see 810b73d1 drm/radeon: Use write-combined CPU mappings of IBs on >= CIK)
- Same as b738ca5d
Revert "drm/radeon: Use write-combined CPU mappings of ring ..."
- Same as 96ea47c0
drm/radeon: Disable uncacheable CPU mappings of GTT with RV6xx see https://bugs.freedesktop.org/show_bug.cgi?id=91268#c2
https://bugs.freedesktop.org/show_bug.cgi?id=100712
--- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_object.c | 1 + drivers/gpu/drm/radeon/radeon_ttm.c | 13 +++++++++++++ 3 files changed, 15 insertions(+)
drivers/gpu/drm/radeon/radeon.h +1 -0
@@ -518,6 +518,7 @@ struct radeon_bo {struct radeon_mn *mn;struct list_head mn_list; +u32 vram_flags; };#define gem_to_radeon_bo (gobj) container_of((gobj), struct radeon_bo, gem_base)
drivers/gpu/drm/radeon/radeon_object.c +1 -0
@@ -228,6 +228,7 @@ int radeon_bo_create(struct radeon_device *rdev, RADEON_GEM_DOMAIN_CPU); bo->flags = flags; + bo->vram_flags =0 ;/* PCI GART is always snooped */ if (!(rdev->flags &RADEON_IS_PCIE )) bo->flags &= ~(RADEON_GEM_GTT_WC |RADEON_GEM_GTT_UC );
drivers/gpu/drm/radeon/radeon_ttm.c +13 -0
@@ -440,6 +440,19 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, r =radeon_move_ram_vram (bo, evict, interruptible, no_wait_gpu, new_mem); }else { +/* Clear WC flag when moving bo from vram to gtt. */ +if (old_mem->mem_type ==TTM_PL_VRAM && new_mem->mem_type ==TTM_PL_TT ) { +if (rbo->flags &RADEON_GEM_GTT_WC ) { + rbo->vram_flags |=RADEON_GEM_GTT_WC ; + rbo->flags &= ~RADEON_GEM_GTT_WC ; + } +/* Re-add WC flag when moving back from gtt to vram. */ + }else if (old_mem->mem_type ==TTM_PL_TT && new_mem->mem_type ==TTM_PL_VRAM ) { +if (rbo->vram_flags &RADEON_GEM_GTT_WC ) { + rbo->flags |=RADEON_GEM_GTT_WC ; + rbo->vram_flags &= ~RADEON_GEM_GTT_WC ; + } + } r =radeon_move_blit (bo, evict, no_wait_gpu, new_mem, old_mem); }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
A message that is not in the archive (sent off-list or not yet received): 1493026928-30134-1-git-send-email-jisorce-bXq66PvbRDbQT0dZR+AlfA@public.gmane.org
Am 24.04.2017 um 11:42 schrieb Julien Isorce:
Quoted 4 lines
But re-add the flag is the bo is moved back to vram.
This fixes "ring 0/3 stalled" issue which happens when the driver evicts bo from vram to gtt, at least on TAHITI and CAPVERDE.
Interesting find, but NAK on the approach for fixing it.
If WC mappings don't work for TAHITI and CAPVERDE we need to figure out why or at least disable them for those hardware generations in general.
Disabling WC for BOs swapped out from VRAM won't buy us much if the BO was initially created in GTT anyway.
Christian.
Quoted 64 lines
I do not know the exact reason among the following:
-si_copy_dmafrom vram to gtt is slow if WC
(only for the non-visible part ? specific cases ?)
- Allow snooping (SNOOPED flag fromradeon_vm_bo_update).
- WC should not be set at all for bo in the GTT
(same reason why WC is only set for vram domain,
seemesa::r600_init_resource_fieldssince mesa commit 5b6a0b7
"gallium/radeon: set GTT WC on tiled textures")
- Bug in WC
- Same reason as whyradeon_sa_bo_manager_initis not passing WC flags if older thanCHIP_BONAIRE(see810b73d1drm/radeon: Use write-combined CPU mappings of IBs on >= CIK)
- Same asb738ca5d
Revert "drm/radeon: Use write-combined CPU mappings of ring ..."
- Same as96ea47c0
drm/radeon: Disable uncacheable CPU mappings of GTT with RV6xx see https://bugs.freedesktop.org/show_bug.cgi?id=91268#c2https://bugs.freedesktop.org/show_bug.cgi?id=100712
--- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_object.c | 1 + drivers/gpu/drm/radeon/radeon_ttm.c | 13 +++++++++++++ 3 files changed, 15 insertions(+)drivers/gpu/drm/radeon/radeon.h +1
-0@@ -518,6 +518,7 @@ struct radeon_bo {struct radeon_mn *mn;struct list_head mn_list; +u32 vram_flags; };#define gem_to_radeon_bo (gobj) container_of((gobj), struct radeon_bo, gem_base)drivers/gpu/drm/radeon/radeon_object.c +1
-0@@ -228,6 +228,7 @@ int radeon_bo_create(struct radeon_device *rdev, RADEON_GEM_DOMAIN_CPU); bo->flags = flags; + bo->vram_flags =0 ;/* PCI GART is always snooped */ if (!(rdev->flags &RADEON_IS_PCIE )) bo->flags &= ~(RADEON_GEM_GTT_WC |RADEON_GEM_GTT_UC );drivers/gpu/drm/radeon/radeon_ttm.c +6
-0@@ -440,6 +440,19 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, r =radeon_move_ram_vram (bo, evict, interruptible, no_wait_gpu, new_mem); }else { +/* Clear WC flag when moving bo from vram to gtt. */ +if (old_mem->mem_type ==TTM_PL_VRAM && new_mem->mem_type ==TTM_PL_TT ) { +if (rbo->flags &RADEON_GEM_GTT_WC ) { + rbo->vram_flags |=RADEON_GEM_GTT_WC ; + rbo->flags &= ~RADEON_GEM_GTT_WC ; + }
drivers/gpu/drm/radeon/radeon_ttm.c static int radeon_bo_move(struct ttm_buffer_object *bo, · line 458
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_ttm.c +7
-0+/* Re-add WC flag when moving back from gtt to vram. */ + }else if (old_mem->mem_type ==TTM_PL_TT && new_mem->mem_type ==TTM_PL_VRAM ) { +if (rbo->vram_flags &RADEON_GEM_GTT_WC ) { + rbo->flags |=RADEON_GEM_GTT_WC ; + rbo->vram_flags &= ~RADEON_GEM_GTT_WC ; + } + } r =radeon_move_blit (bo, evict, no_wait_gpu, new_mem, old_mem); }
_______________________________________________
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): e602b898-ee7d-e744-5a08-0ab7d0f63d83-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
Quoted 10 lines · Christian König
Am 24.04.2017 um 11:42 schrieb Julien Isorce:
Quoted 5 lines
But re-add the flag is the bo is moved back to vram.
This fixes "ring 0/3 stalled" issue which happens when the driver evicts bo from vram to gtt, at least on TAHITI and CAPVERDE.
Interesting find, but NAK on the approach for fixing it.
Thx for the comments.
Quoted 4 lines
If WC mappings don't work for TAHITI and CAPVERDE we need to figure out why or at least disable them for those hardware generations in general.
Should I extend
https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/radeon/radeon_object.c?h=amd-staging-4.9#n228
to BONAIRE (which will include VERDE and TAHITI) ? (to match
https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/radeon/radeon_ib.c?h=amd-staging-4.9#n199
)
Quoted 3 lines
Disabling WC for BOs swapped out from VRAM won't buy us much if the BO was initially created in GTT anyway.
Initially created in VRAM:
https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/radeon/r600_buffer_common.c#n164
Quoted 77 lines
Christian.
Quoted 71 lines
I do not know the exact reason among the following:
-si_copy_dmafrom vram to gtt is slow if WC
(only for the non-visible part ? specific cases ?)
- Allow snooping (SNOOPED flag fromradeon_vm_bo_update).
- WC should not be set at all for bo in the GTT
(same reason why WC is only set for vram domain,
seemesa::r600_init_resource_fieldssince mesa commit 5b6a0b7
"gallium/radeon: set GTT WC on tiled textures")
- Bug in WC
- Same reason as whyradeon_sa_bo_manager_initis not passing WC flags if older thanCHIP_BONAIRE(see810b73d1drm/radeon: Use write-combined CPU mappings of IBs on >= CIK)
- Same asb738ca5d
Revert "drm/radeon: Use write-combined CPU mappings of ring ..."
- Same as96ea47c0
drm/radeon: Disable uncacheable CPU mappings of GTT with RV6xx see https://bugs.freedesktop.org/show_bug.cgi?id=91268#c2https://bugs.freedesktop.org/show_bug.cgi?id=100712
--- drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_object.c | 1 + drivers/gpu/drm/radeon/radeon_ttm.c | 13 +++++++++++++ 3 files changed, 15 insertions(+)drivers/gpu/drm/radeon/radeon.h +1
-0@@ -518,6 +518,7 @@ struct radeon_bo {struct radeon_mn *mn;struct list_head mn_list; +u32 vram_flags; };#define gem_to_radeon_bo (gobj) container_of((gobj), struct radeon_bo, gem_base) diff --git a/drivers/gpu/drm/radeon/radeon_object.c
b/drivers/gpu/drm/radeon/radeon_object.c
index a557869..870f6b0 100644drivers/gpu/drm/radeon/radeon_object.c +1
-0@@ -228,6 +228,7 @@ int radeon_bo_create(struct radeon_device *rdev, RADEON_GEM_DOMAIN_CPU); bo->flags = flags; + bo->vram_flags =0 ;/* PCI GART is always snooped */ if (!(rdev->flags &RADEON_IS_PCIE )) bo->flags &= ~(RADEON_GEM_GTT_WC |RADEON_GEM_GTT_UC );drivers/gpu/drm/radeon/radeon_ttm.c +10
-0@@ -440,6 +440,19 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, r =radeon_move_ram_vram (bo, evict, interruptible, no_wait_gpu, new_mem); }else { +/* Clear WC flag when moving bo from vram to gtt. */ +if (old_mem->mem_type ==TTM_PL_VRAM && new_mem->mem_type ==TTM_PL_TT ) { +if (rbo->flags &RADEON_GEM_GTT_WC ) { + rbo->vram_flags |=RADEON_GEM_GTT_WC ; + rbo->flags &= ~RADEON_GEM_GTT_WC ; + } +/* Re-add WC flag when moving back from gtt to vram. */ + }else if (old_mem->mem_type ==TTM_PL_TT && new_mem->mem_type ==TTM_PL_VRAM ) { +if (rbo->vram_flags &RADEON_GEM_GTT_WC ) { + rbo->flags |=RADEON_GEM_GTT_WC ;
Quoted 11 lines
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_ttm.c +3
-0+ rbo->vram_flags &= ~RADEON_GEM_GTT_WC ; + } + }r = radeon_move_blit(bo, evict,
no_wait_gpu,new_mem,old_mem); }
_______________________________________________
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): CAHWPjbVvs70ucs69zC+6j-NyET1AWNFQ=JndKOqZRZA8v6m9+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 24 lines · Julien Isorce
On 24 April 2017 at 10:51, Christian König <[email protected] <mailto:[email protected]>> wrote:
Am 24.04.2017 um 11:42 schrieb Julien Isorce:
But re-add the flag is the bo is moved back to vram.
This fixes "ring 0/3 stalled" issue which happens when the driver evicts bo from vram to gtt, at least on TAHITI and CAPVERDE.
Interesting find, but NAK on the approach for fixing it.
Thx for the comments.
If WC mappings don't work for TAHITI and CAPVERDE we need to figure out why or at least disable them for those hardware generations in general.
Quoted 4 lines
Should I extend
https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/radeon/radeon_object.c?h=amd-staging-4.9#n228
to BONAIRE (which will include VERDE and TAHITI) ? (to match
https://cgit.freedesktop.org/~agd5f/linux/tree/drivers/gpu/drm/radeon/radeon_ib.c?h=amd-staging-4.9#n199 )
Not sure the issue is widespread / systemic enough to justify that upstream. You can do whatever you deem appropriate in your project, of course.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 6 lines · Christian König
Am 24.04.2017 um 11:42 schrieb Julien Isorce:
Quoted 4 lines
But re-add the flag is the bo is moved back to vram.
This fixes "ring 0/3 stalled" issue which happens when the driver evicts bo from vram to gtt, at least on TAHITI and CAPVERDE.
Quoted 7 lines
Interesting find, but NAK on the approach for fixing it.
If WC mappings don't work for TAHITI and CAPVERDE we need to figure out why or at least disable them for those hardware generations in general.
Disabling WC for BOs swapped out from VRAM won't buy us much if the BO was initially created in GTT anyway.
Moreover, RADEON_GEM_GTT_WC shouldn't have any effect at all for a BO which is currently in VRAM, so it's not clear how the patch makes any difference. I suspect it might accidentally cause RADEON_GEM_GTT_WC to be ignored altogether in radeon_vm_bo_update and/or radeon_ttm_placement_from_domain.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx