aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_gem_ttm_helper.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-11-13 14:16:16 +1000
committerDave Airlie <airlied@redhat.com>2020-11-13 14:52:32 +1000
commit14346c08fac465332f229fbfb0adb1d1a75de96c (patch)
tree56875e6e322d9f6f1d99f258f80cfa5d51720021 /drivers/gpu/drm/drm_gem_ttm_helper.c
parent512bce50a41c528fa15c4c014293e7bebf018658 (diff)
parent05481f072787e96d08cc304cda0c10e0d02cdadc (diff)
Merge tag 'drm-misc-next-2020-11-12' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 5.11: UAPI Changes: Cross-subsystem Changes: Core Changes: - Remove pgprot_decrypt() before calling io_remap_pfn_range() - Revert "drm/dp_mst: Retrieve extended DPCD caps for topology manager" - ttm: Add multihop infrastructure - doc: Update dma-buf Driver Changes: - amdgpu: Use TTM multihop - kmb: select DRM_MIPI_DSI and depend on ARCH_KEEMBAY; Fix build warning; Fix typos - nouveau: Use TTM multihop; Fix out-of-bounds access - radeon: Use TTM multihop - ingenic: Search for scaling coefficients to to 102% of screen size Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20201112080115.GA7954@linux-uq9g
Diffstat (limited to 'drivers/gpu/drm/drm_gem_ttm_helper.c')
-rw-r--r--drivers/gpu/drm/drm_gem_ttm_helper.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_gem_ttm_helper.c b/drivers/gpu/drm/drm_gem_ttm_helper.c
index 0e4fb9ba43ad..de28720757af 100644
--- a/drivers/gpu/drm/drm_gem_ttm_helper.c
+++ b/drivers/gpu/drm/drm_gem_ttm_helper.c
@@ -50,6 +50,43 @@ void drm_gem_ttm_print_info(struct drm_printer *p, unsigned int indent,
EXPORT_SYMBOL(drm_gem_ttm_print_info);
/**
+ * drm_gem_ttm_vmap() - vmap &ttm_buffer_object
+ * @gem: GEM object.
+ * @map: [out] returns the dma-buf mapping.
+ *
+ * Maps a GEM object with ttm_bo_vmap(). This function can be used as
+ * &drm_gem_object_funcs.vmap callback.
+ *
+ * Returns:
+ * 0 on success, or a negative errno code otherwise.
+ */
+int drm_gem_ttm_vmap(struct drm_gem_object *gem,
+ struct dma_buf_map *map)
+{
+ struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem);
+
+ return ttm_bo_vmap(bo, map);
+}
+EXPORT_SYMBOL(drm_gem_ttm_vmap);
+
+/**
+ * drm_gem_ttm_vunmap() - vunmap &ttm_buffer_object
+ * @gem: GEM object.
+ * @map: dma-buf mapping.
+ *
+ * Unmaps a GEM object with ttm_bo_vunmap(). This function can be used as
+ * &drm_gem_object_funcs.vmap callback.
+ */
+void drm_gem_ttm_vunmap(struct drm_gem_object *gem,
+ struct dma_buf_map *map)
+{
+ struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gem);
+
+ ttm_bo_vunmap(bo, map);
+}
+EXPORT_SYMBOL(drm_gem_ttm_vunmap);
+
+/**
* drm_gem_ttm_mmap() - mmap &ttm_buffer_object
* @gem: GEM object.
* @vma: vm area.