drm/radeon: Only flush HDP cache from idle ioctl if BO is in VRAM
Subsystems (2)
PATCH 1/1 drm/radeon: Only flush HDP cache from idle ioctl if BO is in VRAM
From: Michel Dänzer <[email protected]>
The HDP cache only applies to CPU access to VRAM.
--- drivers/gpu/drm/radeon/radeon_gem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_gem.c +4 -2
@@ -359,15 +359,17 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,struct drm_gem_object *gobj;struct radeon_bo *robj;int r; +uint32_t cur_placement =0 ; gobj =drm_gem_object_lookup (dev, filp, args->handle);if (gobj ==NULL ) {return -ENOENT ; } robj =gem_to_radeon_bo (gobj); - r =radeon_bo_wait (robj,NULL , false); + r =radeon_bo_wait (robj, &cur_placement, false);/* Flush HDP cache via MMIO if necessary */ -if (rdev->asic->mmio_hdp_flush) +if (rdev->asic->mmio_hdp_flush && +radeon_mem_type_to_domain (cur_placement) ==RADEON_GEM_DOMAIN_VRAM ) robj->rdev->asic->mmio_hdp_flush (rdev);drm_gem_object_unreference_unlocked (gobj); r =radeon_gem_handle_lockup (rdev, r);
Signature · 6 lines
2.0.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Am 01.08.2014 um 10:22 schrieb Michel Dänzer:
Quoted 5 lines
From: Michel Dänzer <[email protected]>
The HDP cache only applies to CPU access to VRAM.
Signed-off-by Michel Dänzer <[email protected]>
Wanted to suggest the same thing already, looks like a valid optimization to me.
Patch is Reviewed-by: Christian König <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/radeon/radeon_gem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_gem.c +1
-0@@ -359,15 +359,17 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,struct drm_gem_object *gobj;struct radeon_bo *robj;int r; +uint32_t cur_placement =0 ; gobj =drm_gem_object_lookup (dev, filp, args->handle);if (gobj ==NULL ) {return -ENOENT ; }
drivers/gpu/drm/radeon/radeon_gem.c int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data, · line 375
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_gem.c +3
-2robj =gem_to_radeon_bo (gobj); - r =radeon_bo_wait (robj,NULL , false); + r =radeon_bo_wait (robj, &cur_placement, false);/* Flush HDP cache via MMIO if necessary */ -if (rdev->asic->mmio_hdp_flush) +if (rdev->asic->mmio_hdp_flush && +radeon_mem_type_to_domain (cur_placement) ==RADEON_GEM_DOMAIN_VRAM ) robj->rdev->asic->mmio_hdp_flush (rdev);drm_gem_object_unreference_unlocked (gobj); r =radeon_gem_handle_lockup (rdev, r);
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Alex Deucher
AppliedQuoted 5 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
The HDP cache only applies to CPU access to VRAM.
Signed-off-by Michel Dänzer <[email protected]>
Applied to my 3.17 branch.
Thanks!
Quoted 31 lines
--- drivers/gpu/drm/radeon/radeon_gem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_gem.c +4
-3@@ -359,15 +359,17 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,struct drm_gem_object *gobj;struct radeon_bo *robj;int r; +uint32_t cur_placement =0 ; gobj =drm_gem_object_lookup (dev, filp, args->handle);if (gobj ==NULL ) {return -ENOENT ; } robj =gem_to_radeon_bo (gobj); - r =radeon_bo_wait (robj,NULL , false); + r =radeon_bo_wait (robj, &cur_placement, false);/* Flush HDP cache via MMIO if necessary */ -if (rdev->asic->mmio_hdp_flush) +if (rdev->asic->mmio_hdp_flush && +radeon_mem_type_to_domain (cur_placement) ==RADEON_GEM_DOMAIN_VRAM ) robj->rdev->asic->mmio_hdp_flush (rdev);drm_gem_object_unreference_unlocked (gobj); r =radeon_gem_handle_lockup (rdev, r); --2.0.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
I'm afraid this won't always work and it can be a source of bugs.
Userspace doesn't have to call GEM_WAIT_IDLE before a CPU access to a VRAM buffer. For example, consider a wait-idle request with a non-zero timeout, which is implemented as a loop which calls GEM_BUSY. Also, userspace can use fences (alright they are backed by 1-page-sized VRAM buffers at the moment) and it may use real fences in the future which are not tied to a buffer object.
If the HDP flush isn't allowed in userspace IBs, I think we will have to expose it as an ioctl and call it explicitly from userspace.
Marek
Quoted 36 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
The HDP cache only applies to CPU access to VRAM.
Signed-off-by Michel Dänzer <[email protected]>--- drivers/gpu/drm/radeon/radeon_gem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/radeon/radeon_gem.c +4
-3@@ -359,15 +359,17 @@ int radeon_gem_wait_idle_ioctl(struct drm_device *dev, void *data,struct drm_gem_object *gobj;struct radeon_bo *robj;int r; +uint32_t cur_placement =0 ; gobj =drm_gem_object_lookup (dev, filp, args->handle);if (gobj ==NULL ) {return -ENOENT ; } robj =gem_to_radeon_bo (gobj); - r =radeon_bo_wait (robj,NULL , false); + r =radeon_bo_wait (robj, &cur_placement, false);/* Flush HDP cache via MMIO if necessary */ -if (rdev->asic->mmio_hdp_flush) +if (rdev->asic->mmio_hdp_flush && +radeon_mem_type_to_domain (cur_placement) ==RADEON_GEM_DOMAIN_VRAM ) robj->rdev->asic->mmio_hdp_flush (rdev);drm_gem_object_unreference_unlocked (gobj); r =radeon_gem_handle_lockup (rdev, r); --2.0.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Marek Olšák
I'm afraid this won't always work and it can be a source of bugs.
Userspace doesn't have to call
GEM_WAIT_IDLEbefore a CPU access to a VRAM buffer. For example, consider a wait-idle request with a non-zero timeout, which is implemented as a loop which callsGEM_BUSY. Also, userspace can use fences (alright they are backed by 1-page-sized VRAM buffers at the moment) and it may use real fences in the future which are not tied to a buffer object.If the HDP flush isn't allowed in userspace IBs, I think we will have to expose it as an ioctl and call it explicitly from userspace.
I understand your concerns, but my patch doesn't change anything wrt them, does it?
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
No, it doesn't.
Marek
Quoted 13 lines · Michel Dänzer
Quoted 11 lines · Marek Olšák
I'm afraid this won't always work and it can be a source of bugs.
Userspace doesn't have to call
GEM_WAIT_IDLEbefore a CPU access to a VRAM buffer. For example, consider a wait-idle request with a non-zero timeout, which is implemented as a loop which callsGEM_BUSY. Also, userspace can use fences (alright they are backed by 1-page-sized VRAM buffers at the moment) and it may use real fences in the future which are not tied to a buffer object.If the HDP flush isn't allowed in userspace IBs, I think we will have to expose it as an ioctl and call it explicitly from userspace.
Quoted 7 lines
I understand your concerns, but my patch doesn't change anything wrt them, does it?
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel