diff options
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4586-drm-amdgpu-Add-documentation-for-PRIME-related-code.patch')
-rw-r--r-- | common/recipes-kernel/linux/linux-yocto-4.14.71/4586-drm-amdgpu-Add-documentation-for-PRIME-related-code.patch | 231 |
1 files changed, 231 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4586-drm-amdgpu-Add-documentation-for-PRIME-related-code.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4586-drm-amdgpu-Add-documentation-for-PRIME-related-code.patch new file mode 100644 index 00000000..424039b1 --- /dev/null +++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4586-drm-amdgpu-Add-documentation-for-PRIME-related-code.patch @@ -0,0 +1,231 @@ +From 4bd7a3507a307848df7842f599c8295d45575948 Mon Sep 17 00:00:00 2001 +From: Michel Daenzer <michel.daenzer@amd.com> +Date: Tue, 29 May 2018 18:33:41 +0200 +Subject: [PATCH 4586/5725] drm/amdgpu: Add documentation for PRIME related + code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Reviewed-by: Alex Deucher <alexander.deucher@amd.com> +Signed-off-by: Michel Dänzer <michel.daenzer@amd.com> +Signed-off-by: Kalyan Alle <kalyan.alle@amd.com> + +Conflicts: + drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c + +Change-Id: I5bd9e7536250c9a1e9f914b87443c3b63aa2988f +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c | 119 ++++++++++++++++++++++++++++++ + 1 file changed, 119 insertions(+) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +index 63d5a01..5472366 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_prime.c +@@ -23,6 +23,14 @@ + * + * Authors: Alex Deucher + */ ++ ++/** ++ * DOC: PRIME Buffer Sharing ++ * ++ * The following callback implementations are used for :ref:`sharing GEM buffer ++ * objects between different devices via PRIME <prime_buffer_sharing>`. ++ */ ++ + #include <drm/drmP.h> + + #include "amdgpu.h" +@@ -30,6 +38,14 @@ + #include <drm/amdgpu_drm.h> + #include <linux/dma-buf.h> + ++/** ++ * amdgpu_gem_prime_get_sg_table - &drm_driver.gem_prime_get_sg_table ++ * implementation ++ * @obj: GEM buffer object ++ * ++ * Returns: ++ * A scatter/gather table for the pinned pages of the buffer object's memory. ++ */ + struct sg_table *amdgpu_gem_prime_get_sg_table(struct drm_gem_object *obj) + { + struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); +@@ -38,6 +54,15 @@ struct sg_table *amdgpu_gem_prime_get_sg_table(struct drm_gem_object *obj) + return drm_prime_pages_to_sg(bo->tbo.ttm->pages, npages); + } + ++/** ++ * amdgpu_gem_prime_vmap - &dma_buf_ops.vmap implementation ++ * @obj: GEM buffer object ++ * ++ * Sets up an in-kernel virtual mapping of the buffer object's memory. ++ * ++ * Returns: ++ * The virtual address of the mapping or an error pointer. ++ */ + void *amdgpu_gem_prime_vmap(struct drm_gem_object *obj) + { + struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); +@@ -51,6 +76,13 @@ void *amdgpu_gem_prime_vmap(struct drm_gem_object *obj) + return bo->dma_buf_vmap.virtual; + } + ++/** ++ * amdgpu_gem_prime_vunmap - &dma_buf_ops.vunmap implementation ++ * @obj: GEM buffer object ++ * @vaddr: virtual address (unused) ++ * ++ * Tears down the in-kernel virtual mapping of the buffer object's memory. ++ */ + void amdgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) + { + struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); +@@ -58,6 +90,17 @@ void amdgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) + ttm_bo_kunmap(&bo->dma_buf_vmap); + } + ++/** ++ * amdgpu_gem_prime_mmap - &drm_driver.gem_prime_mmap implementation ++ * @obj: GEM buffer object ++ * @vma: virtual memory area ++ * ++ * Sets up a userspace mapping of the buffer object's memory in the given ++ * virtual memory area. ++ * ++ * Returns: ++ * 0 on success or negative error code. ++ */ + int amdgpu_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) + { + struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); +@@ -92,6 +135,19 @@ int amdgpu_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma + return ret; + } + ++/** ++ * amdgpu_gem_prime_import_sg_table - &drm_driver.gem_prime_import_sg_table ++ * implementation ++ * @dev: DRM device ++ * @attach: DMA-buf attachment ++ * @sg: Scatter/gather table ++ * ++ * Import shared DMA buffer memory exported by another device. ++ * ++ * Returns: ++ * A new GEM buffer object of the given DRM device, representing the memory ++ * described by the given DMA-buf attachment and scatter/gather table. ++ */ + struct drm_gem_object * + amdgpu_gem_prime_import_sg_table(struct drm_device *dev, + struct dma_buf_attachment *attach, +@@ -135,6 +191,19 @@ amdgpu_gem_prime_import_sg_table(struct drm_device *dev, + } + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) || !defined(BUILD_AS_DKMS) ++/** ++ * amdgpu_gem_map_attach - &dma_buf_ops.attach implementation ++ * @dma_buf: shared DMA buffer ++ * @target_dev: target device ++ * @attach: DMA-buf attachment ++ * ++ * Makes sure that the shared DMA buffer can be accessed by the target device. ++ * For now, simply pins it to the GTT domain, where it should be accessible by ++ * all DMA devices. ++ * ++ * Returns: ++ * 0 on success or negative error code. ++ */ + static int amdgpu_gem_map_attach(struct dma_buf *dma_buf, + struct device *target_dev, + struct dma_buf_attachment *attach) +@@ -184,6 +253,14 @@ static int amdgpu_gem_map_attach(struct dma_buf *dma_buf, + return r; + } + ++/** ++ * amdgpu_gem_map_detach - &dma_buf_ops.detach implementation ++ * @dma_buf: shared DMA buffer ++ * @attach: DMA-buf attachment ++ * ++ * This is called when a shared DMA buffer no longer needs to be accessible by ++ * the other device. For now, simply unpins the buffer from GTT. ++ */ + static void amdgpu_gem_map_detach(struct dma_buf *dma_buf, + struct dma_buf_attachment *attach) + { +@@ -205,6 +282,13 @@ static void amdgpu_gem_map_detach(struct dma_buf *dma_buf, + } + #endif + ++/** ++ * amdgpu_gem_prime_res_obj - &drm_driver.gem_prime_res_obj implementation ++ * @obj: GEM buffer object ++ * ++ * Returns: ++ * The buffer object's reservation object. ++ */ + struct reservation_object *amdgpu_gem_prime_res_obj(struct drm_gem_object *obj) + { + struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); +@@ -213,6 +297,18 @@ struct reservation_object *amdgpu_gem_prime_res_obj(struct drm_gem_object *obj) + } + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) || !defined(BUILD_AS_DKMS) ++/** ++ * amdgpu_gem_begin_cpu_access - &dma_buf_ops.begin_cpu_access implementation ++ * @dma_buf: shared DMA buffer ++ * @direction: direction of DMA transfer ++ * ++ * This is called before CPU access to the shared DMA buffer's memory. If it's ++ * a read access, the buffer is moved to the GTT domain if possible, for optimal ++ * CPU read performance. ++ * ++ * Returns: ++ * 0 on success or negative error code. ++ */ + static int amdgpu_gem_begin_cpu_access(struct dma_buf *dma_buf, + enum dma_data_direction direction) + { +@@ -258,6 +354,18 @@ const struct dma_buf_ops amdgpu_dmabuf_ops = { + }; + #endif + ++/** ++ * amdgpu_gem_prime_export - &drm_driver.gem_prime_export implementation ++ * @dev: DRM device ++ * @gobj: GEM buffer object ++ * @flags: flags like DRM_CLOEXEC and DRM_RDWR ++ * ++ * The main work is done by the &drm_gem_prime_export helper, which in turn ++ * uses &amdgpu_gem_prime_res_obj. ++ * ++ * Returns: ++ * Shared DMA buffer representing the GEM buffer object from the given device. ++ */ + struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev, + struct drm_gem_object *gobj, + int flags) +@@ -280,6 +388,17 @@ struct dma_buf *amdgpu_gem_prime_export(struct drm_device *dev, + } + + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 17, 0) || !defined(BUILD_AS_DKMS) ++/** ++ * amdgpu_gem_prime_import - &drm_driver.gem_prime_import implementation ++ * @dev: DRM device ++ * @dma_buf: Shared DMA buffer ++ * ++ * The main work is done by the &drm_gem_prime_import helper, which in turn ++ * uses &amdgpu_gem_prime_import_sg_table. ++ * ++ * Returns: ++ * GEM buffer object representing the shared DMA buffer for the given device. ++ */ + struct drm_gem_object *amdgpu_gem_prime_import(struct drm_device *dev, + struct dma_buf *dma_buf) + { +-- +2.7.4 + |