From: Daniel Thompson <daniel.thompson@linaro.org>
To: Rob Clark <robdclark@gmail.com>
Cc: linaro-kernel@lists.linaro.org,
"patches@linaro.org" <patches@linaro.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
Benjamin Gaignard <benjamin.gaignard@linaro.org>
Subject: Re: [PATCH v3.18-rc3] drm: msm: Allow exported dma-bufs to be mapped
Date: Tue, 11 Nov 2014 14:28:49 +0000 [thread overview]
Message-ID: <54621D21.2000100@linaro.org> (raw)
In-Reply-To: <CAF6AEGspGE2EsS7zuVFXh1kT2Rq8Rt8Z1dpGNdVKPr4mBcTZuw@mail.gmail.com>
On 10/11/14 17:36, Rob Clark wrote:
> On Mon, Nov 10, 2014 at 12:16 PM, Daniel Thompson
> <daniel.thompson@linaro.org> wrote:
>> diff --git a/drivers/gpu/drm/msm/msm_gem_prime.c b/drivers/gpu/drm/msm/msm_gem_prime.c
>> index ad772fe36115..4e4fa5828d5d 100644
>> --- a/drivers/gpu/drm/msm/msm_gem_prime.c
>> +++ b/drivers/gpu/drm/msm/msm_gem_prime.c
>> @@ -20,6 +20,14 @@
>>
>> #include <linux/dma-buf.h>
>>
>> +struct dma_buf *msm_gem_prime_export(struct drm_device *dev,
>> + struct drm_gem_object *obj, int flags)
>> +{
>> + /* we want to be able to write in mmapped buffer */
>> + flags |= O_RDWR;
>> + return drm_gem_prime_export(dev, obj, flags);
>> +}
>> +
>
> seems like this probably should be done more centrally.. and in fact,
> might be better to have something like this in
> drm_prime_handle_to_fd_ioctl:
>
> /* check flags are valid */
> - if (args->flags & ~DRM_CLOEXEC)
> + if (args->flags & ~(DRM_CLOEXEC | O_RDWR))
> return -EINVAL;
>
> so exporter can specify whether to allow mmap or not.
That makes sense I'll try this.
Do we need to wrap O_RDWR in the same way we wrap O_CLOEXEC? (I don't
really understand why DRM_CLOEXEC exists; even the patch description
from when the symbol was introduced names it O_CLOEXEC).
Also the "flags |= O_RDWR" approach is copied from the sti driver. I'll
share a patch to remove it but that will definitely needs Benjamin's ack
because it will stop some userspaces working correctly (however I
suspect that Benjamin may be the only person currently with such a
userspace and that he can be persuaded not to call it a regression).
Daniel.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-11-11 14:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-10 17:16 [PATCH v3.18-rc3] drm: msm: Allow exported dma-bufs to be mapped Daniel Thompson
2014-11-10 17:36 ` Rob Clark
2014-11-11 14:28 ` Daniel Thompson [this message]
2014-11-11 16:26 ` Rob Clark
2014-11-12 9:41 ` Benjamin Gaignard
2014-11-12 9:44 ` Daniel Thompson
2014-11-12 11:38 ` [PATCH v2 v3.18-rc4 0/4] drm: prime: " Daniel Thompson
2014-11-12 11:38 ` [PATCH v2 v3.18-rc4 1/4] drm: prime: Honour O_RDWR during prime-handle-to-fd Daniel Thompson
2014-11-12 14:41 ` Rob Clark
2015-05-27 3:15 ` Damian Hobson-Garcia
2015-05-27 7:48 ` Daniel Thompson
2014-11-12 11:38 ` [PATCH v2 v3.18-rc4 2/4] drm: prime: Document gem_prime_mmap Daniel Thompson
2014-11-12 14:11 ` Daniel Vetter
2014-11-12 14:42 ` Rob Clark
2014-11-12 11:38 ` [PATCH v2 v3.18-rc4 3/4] drm: msm: Allow exported dma-bufs to be mapped Daniel Thompson
2014-11-12 14:26 ` Rob Clark
2014-11-12 11:38 ` [PATCH v2 v3.18-rc4 4/4] drm: sti: Honour O_RDWR during prime-handle-to-fd Daniel Thompson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54621D21.2000100@linaro.org \
--to=daniel.thompson@linaro.org \
--cc=benjamin.gaignard@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@linaro.org \
--cc=robdclark@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).