Re: [Linaro-mm-sig] [PATCH] gpu: drm: Add helpers to allow export gem cma objects

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

 



I realize that this patch (done for 3.10) is deprecated because there
is something similar that has been push on 3.12.

Anyway the question about how/where set O_RDWR dma_buf_export is valid.
Your advice are welcome.

Benjamin


2013/10/19 Daniel Vetter <daniel@xxxxxxxx>:
> On Fri, Oct 18, 2013 at 11:00:57AM +0200, benjamin.gaignard@xxxxxxxxxx wrote:
>> From: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxx>
>>
>> DRM already offer helpers to use CMA for dumb buffers.
>> This patch add helpers to export/import gem_cam objects and allow them to be mmap from userland.
>> The goal is to make working this kind of sequence: create_dumb, get fd from
>> buffer handle and then use fd (maybe in another process which may ignore it
>> is comming from DRM) to mmap the buffer.
>>
>> drm_gem_cma_prime_export() add O_RDWR to flags to be sure that memory
>> could be mmapped later with PROT_WRITE flag.
>>
>> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@xxxxxxxxxx>
>
> [snip]
>
>> +struct dma_buf *drm_gem_cma_prime_export(struct drm_device *drm_dev,
>> +                             struct drm_gem_object *obj, int flags)
>> +{
>> +     struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(obj);
>> +
>> +     flags |= O_RDWR;
>
> This here looks funny ... I think either we need to add more flags to the
> prime dma-buf exporting to also pass this flag through. Or we should just
> generally set this in dma_buf_export. Doing this as an exporter-specific
> hack feels wrong.
> -Daniel
>
>> +     return dma_buf_export(cma_obj, &drm_gem_cma_dmabuf_ops,
>> +                     cma_obj->base.size, flags);
>> +}
>> +EXPORT_SYMBOL_GPL(drm_gem_cma_prime_export);
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch



-- 
Benjamin Gaignard

Graphic Working Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux