drm/vram-helpers: Set plane fence for display update
Subsystems (2)
Thomas Zimmermann
maintainerPATCH 1/1 drm/vram-helpers: Set plane fence for display update
Calling the VRAM helper's prepare_fb() helper now sets the plane's fence object. The helper still has to synchronize with other users of the GEM object. Leave a related TODO comment in the code.
This will be useful for PRIME support. VRAM helpers don't support buffer sharing ATM, so there are no drivers requiring this change.
--- drivers/gpu/drm/drm_gem_vram_helper.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_gem_vram_helper.c +15 -3
@@ -5,6 +5,7 @@#include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_framebuffer.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_ttm_helper.h> #include <drm/drm_gem_vram_helper.h> #include <drm/drm_mode.h>
@@ -670,9 +671,9 @@ EXPORT_SYMBOL(drm_gem_vram_driver_dumb_mmap_offset);* @plane: a DRM plane * @new_state: the plane's new state * -* During plane updates, this function pins the GEM VRAM -* objects of the plane's new framebuffer to VRAM. Call -* drm_gem_vram_plane_helper_cleanup_fb() to unpin them. +* During plane updates, this function sets the plane's fence and +* pins the GEM VRAM objects of the plane's new framebuffer to VRAM. +* Call drm_gem_vram_plane_helper_cleanup_fb() to unpin them. * * Returns: * 0 on success, or
@@ -689,6 +690,13 @@ drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane,if (!new_state->fb)return 0 ; +/* +* TODO: Synchronize with other users of the buffer. Buffers +* cannot be pinned to VRAM while they are in use by other +* drivers for DMA. We should probably wait for each GEM +* object's fence before attempting to pin the buffer. +* There are currently no users of this functionality. +*/ for (i =0 ; i <ARRAY_SIZE (new_state->fb->obj); ++i) {if (!new_state->fb->obj[i])continue ;
@@ -698,6 +706,10 @@ drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, goto err_drm_gem_vram_unpin; } + ret =drm_gem_fb_prepare_fb (plane, new_state); +if (ret) + goto err_drm_gem_vram_unpin; +return 0 ; err_drm_gem_vram_unpin:
Signature · 6 lines
2.26.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi,
drivers/gpu/drm/drm_gem_vram_helper.c drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, · line 697
Quoted 4 lines
drivers/gpu/drm/drm_gem_vram_helper.c +4
-0+* TODO: Synchronize with other users of the buffer. Buffers +* cannot be pinned to VRAM while they are in use by other +* drivers for DMA. We should probably wait for each GEM +* object's fence before attempting to pin the buffer.
The other option is p2p (Documentation/driver-api/pci/p2pdma.rst).
cheers,
Gerd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 38 lines · Thomas Zimmermann
Calling the VRAM helper's
prepare_fb()helper now sets the plane's fence object. The helper still has to synchronize with other users of the GEM object. Leave a related TODO comment in the code.This will be useful for PRIME support. VRAM helpers don't support buffer sharing ATM, so there are no drivers requiring this change.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/drm_gem_vram_helper.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_vram_helper.c +4
-3@@ -5,6 +5,7 @@#include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_framebuffer.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_ttm_helper.h> #include <drm/drm_gem_vram_helper.h> #include <drm/drm_mode.h> @@ -670,9 +671,9 @@ EXPORT_SYMBOL(drm_gem_vram_driver_dumb_mmap_offset);* @plane: a DRM plane * @new_state: the plane's new state * -* During plane updates, this function pins the GEM VRAM -* objects of the plane's new framebuffer to VRAM. Call -* drm_gem_vram_plane_helper_cleanup_fb() to unpin them. +* During plane updates, this function sets the plane's fence and +* pins the GEM VRAM objects of the plane's new framebuffer to VRAM. +* Call drm_gem_vram_plane_helper_cleanup_fb() to unpin them. * * Returns: * 0 on success, or
drivers/gpu/drm/drm_gem_vram_helper.c drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, · line 699
Quoted 10 lines
drivers/gpu/drm/drm_gem_vram_helper.c +7
-0@@ -689,6 +690,13 @@ drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane,if (!new_state->fb)return 0 ; +/* +* TODO: Synchronize with other users of the buffer. Buffers +* cannot be pinned to VRAM while they are in use by other +* drivers for DMA. We should probably wait for each GEM +* object's fence before attempting to pin the buffer. +* There are currently no users of this functionality. +*/
Not sure this is warranted, we have lots of drivers with these kind of restrictions ... It's a big can of worms, I'd just leave this all out.
drivers/gpu/drm/drm_gem_vram_helper.c drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, · line 711
Quoted 10 lines
drivers/gpu/drm/drm_gem_vram_helper.c +3
-0for (i =0 ; i <ARRAY_SIZE (new_state->fb->obj); ++i) {if (!new_state->fb->obj[i])continue ;@@ -698,6 +706,10 @@ drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, goto err_drm_gem_vram_unpin; } + ret =drm_gem_fb_prepare_fb (plane, new_state); +if (ret) + goto err_drm_gem_vram_unpin;
Quoted 7 lines
drivers/gpu/drm/drm_gem_vram_helper.c +1
-0+return 0 ; err_drm_gem_vram_unpin:Signature · 1 line
2.26.0
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thomas Zimmermann
maintainerHi
Am 31.03.20 um 10:50 schrieb Daniel Vetter:
Quoted 42 lines · Thomas Zimmermann
Quoted 41 lines
Calling the VRAM helper's
prepare_fb()helper now sets the plane's fence object. The helper still has to synchronize with other users of the GEM object. Leave a related TODO comment in the code.This will be useful for PRIME support. VRAM helpers don't support buffer sharing ATM, so there are no drivers requiring this change.
Signed-off-by Thomas Zimmermann <[email protected]>--- drivers/gpu/drm/drm_gem_vram_helper.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_gem_vram_helper.c +4
-3@@ -5,6 +5,7 @@#include <drm/drm_drv.h> #include <drm/drm_file.h> #include <drm/drm_framebuffer.h> +#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_ttm_helper.h> #include <drm/drm_gem_vram_helper.h> #include <drm/drm_mode.h> @@ -670,9 +671,9 @@ EXPORT_SYMBOL(drm_gem_vram_driver_dumb_mmap_offset);* @plane: a DRM plane * @new_state: the plane's new state * -* During plane updates, this function pins the GEM VRAM -* objects of the plane's new framebuffer to VRAM. Call -* drm_gem_vram_plane_helper_cleanup_fb() to unpin them. +* During plane updates, this function sets the plane's fence and +* pins the GEM VRAM objects of the plane's new framebuffer to VRAM. +* Call drm_gem_vram_plane_helper_cleanup_fb() to unpin them. * * Returns: * 0 on success, or @@ -689,6 +690,13 @@ drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane,if (!new_state->fb)return 0 ;
Quoted 10 lines
drivers/gpu/drm/drm_gem_vram_helper.c drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, · line 699
Quoted 7 lines
drivers/gpu/drm/drm_gem_vram_helper.c +7
-0+/* +* TODO: Synchronize with other users of the buffer. Buffers +* cannot be pinned to VRAM while they are in use by other +* drivers for DMA. We should probably wait for each GEM +* object's fence before attempting to pin the buffer. +* There are currently no users of this functionality. +*/ Not sure this is warranted, we have lots of drivers with these kind of restrictions ... It's a big can of worms, I'd just leave this all out.
Well, OK. Adding PRIME support would require a rework of these helpers anyway.
Best regards
Thomas
Quoted 22 lines
drivers/gpu/drm/drm_gem_vram_helper.c drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, · line 711
Quoted 11 lines
drivers/gpu/drm/drm_gem_vram_helper.c +3
-0for (i =0 ; i <ARRAY_SIZE (new_state->fb->obj); ++i) {if (!new_state->fb->obj[i])continue ;@@ -698,6 +706,10 @@ drm_gem_vram_plane_helper_prepare_fb(struct drm_plane *plane, goto err_drm_gem_vram_unpin; } + ret =drm_gem_fb_prepare_fb (plane, new_state); +if (ret) + goto err_drm_gem_vram_unpin;Reviewed-by Daniel Vetter <[email protected]>Quoted 7 lines
drivers/gpu/drm/drm_gem_vram_helper.c +1
-0+return 0 ; err_drm_gem_vram_unpin:Signature · 1 line
2.26.0
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Felix Imendörffer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel