[PATCH 1/3] drm/prime: forward begin_cpu_access callback to drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 20, 2017 at 6:20 PM, Li, Samuel <Samuel.Li at amd.com> wrote:
> Ping... can someone please review this patch?

Might be simpler to implement your own dma-buf backend instead of
going through the drm_prime midlayer. That was mostly written to give
nvidia a set of non-EXPORT_GPL symbols to support dma-buf. Or
something like that.

Also don't expect people to look at patches when CI bots spot issues.
-Daniel

>
> Samuel Li
>
>
>
>> -----Original Message-----
>> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
>> Of Samuel Li
>> Sent: Friday, December 15, 2017 11:28 AM
>> To: dri-devel at lists.freedesktop.org; amd-gfx at lists.freedesktop.org
>> Cc: Koenig, Christian <Christian.Koenig at amd.com>
>> Subject: [PATCH 1/3] drm/prime: forward begin_cpu_access callback to
>> drivers
>>
>> From: Christian König <christian.koenig at amd.com>
>>
>> Allow drivers to implement their own begin_cpu_access callback.
>>
>> Change-Id: I97709b42b9351a04ee7e01106107a87bc56ea258
>> Signed-off-by: Christian König <christian.koenig at amd.com>
>> ---
>>  drivers/gpu/drm/drm_prime.c | 13 +++++++++++++
>>  include/drm/drm_drv.h       |  2 ++
>>  2 files changed, 15 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
>> index 8de93a2..b4b0e64 100644
>> --- a/drivers/gpu/drm/drm_prime.c
>> +++ b/drivers/gpu/drm/drm_prime.c
>> @@ -346,6 +346,18 @@ void drm_gem_dmabuf_release(struct dma_buf
>> *dma_buf)  }  EXPORT_SYMBOL(drm_gem_dmabuf_release);
>>
>> +static int drm_gem_dmabuf_begin_cpu_access(struct dma_buf *dma_buf,
>> +                                         enum dma_data_direction
>> direction) {
>> +     struct drm_gem_object *obj = dma_buf->priv;
>> +     struct drm_device *dev = obj->dev;
>> +
>> +     if (!dev->driver->gem_prime_begin_cpu_access)
>> +             return 0;
>> +
>> +     return dev->driver->gem_prime_begin_cpu_access(obj, direction); }
>> +
>>  static void *drm_gem_dmabuf_vmap(struct dma_buf *dma_buf)  {
>>       struct drm_gem_object *obj = dma_buf->priv; @@ -403,6 +415,7
>> @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
>>       .map_dma_buf = drm_gem_map_dma_buf,
>>       .unmap_dma_buf = drm_gem_unmap_dma_buf,
>>       .release = drm_gem_dmabuf_release,
>> +     .begin_cpu_access = drm_gem_dmabuf_begin_cpu_access,
>>       .map = drm_gem_dmabuf_kmap,
>>       .map_atomic = drm_gem_dmabuf_kmap_atomic,
>>       .unmap = drm_gem_dmabuf_kunmap,
>> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index
>> 412e83a..1fbf298 100644
>> --- a/include/drm/drm_drv.h
>> +++ b/include/drm/drm_drv.h
>> @@ -475,6 +475,8 @@ struct drm_driver {
>>                               struct drm_device *dev,
>>                               struct dma_buf_attachment *attach,
>>                               struct sg_table *sgt);
>> +     int (*gem_prime_begin_cpu_access)(struct drm_gem_object *obj,
>> +                                        enum dma_data_direction
>> direction);
>>       void *(*gem_prime_vmap)(struct drm_gem_object *obj);
>>       void (*gem_prime_vunmap)(struct drm_gem_object *obj, void
>> *vaddr);
>>       int (*gem_prime_mmap)(struct drm_gem_object *obj,
>> --
>> 2.7.4
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux