diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2021-07-16 17:07:55 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2021-07-23 21:17:13 +0300 |
commit | 37408cd825a47b89c2302b88ad3c071f796a2ec0 (patch) | |
tree | 923fda1cb2afdbb0a3a1b118a0db24dd56aa307d /include/drm/drm_gem_framebuffer_helper.h | |
parent | a791cde6d2720944a50122b2039aac26b4c196c2 (diff) | |
download | linux-37408cd825a47b89c2302b88ad3c071f796a2ec0.tar.xz |
drm/gem: Provide drm_gem_fb_{begin,end}_cpu_access() helpers
Implement helpers drm_gem_fb_begin_cpu_access() and _end_cpu_access(),
which call the rsp dma-buf functions for all GEM BOs of the given
framebuffer.
Calls to dma_buf_end_cpu_access() can return an error code on failure,
while drm_gem_fb_end_cpu_access() does not. The latter runs during DRM's
atomic commit or during cleanup. Both cases don't allow for errors, so
leave out the return value.
v2:
* fix typo in docs (Daniel)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210716140801.1215-2-tzimmermann@suse.de
Diffstat (limited to 'include/drm/drm_gem_framebuffer_helper.h')
-rw-r--r-- | include/drm/drm_gem_framebuffer_helper.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/drm/drm_gem_framebuffer_helper.h b/include/drm/drm_gem_framebuffer_helper.h index 6bdffc7aa124..5705722f0855 100644 --- a/include/drm/drm_gem_framebuffer_helper.h +++ b/include/drm/drm_gem_framebuffer_helper.h @@ -1,6 +1,9 @@ #ifndef __DRM_GEM_FB_HELPER_H__ #define __DRM_GEM_FB_HELPER_H__ +#include <linux/dma-buf.h> +#include <linux/dma-buf-map.h> + struct drm_afbc_framebuffer; struct drm_device; struct drm_fb_helper_surface_size; @@ -34,6 +37,9 @@ struct drm_framebuffer * drm_gem_fb_create_with_dirty(struct drm_device *dev, struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd); +int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir); +void drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir); + #define drm_is_afbc(modifier) \ (((modifier) & AFBC_VENDOR_AND_TYPE_MASK) == DRM_FORMAT_MOD_ARM_AFBC(0)) |