From: Thierry Reding <thierry.reding@gmail.com>
To: "Stéphane Marchesin" <marcheu@chromium.org>
Cc: linux-tegra@vger.kernel.org, linux-api@vger.kernel.org,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 3/4] drm/tegra: Add SET/GET_FLAGS IOCTLs
Date: Thu, 12 Jun 2014 09:18:40 +0200 [thread overview]
Message-ID: <20140612071840.GB17027@ulmo> (raw)
In-Reply-To: <CADMs+9Y+i7H9GGpMKJNs2kkxzyruOjiXEv2O1_SipudPGZW-8g@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 2509 bytes --]
On Wed, Jun 11, 2014 at 09:21:21AM -0700, Stéphane Marchesin wrote:
> On Tue, Jun 10, 2014 at 4:04 AM, Thierry Reding
> <thierry.reding@gmail.com> wrote:
> > From: Thierry Reding <treding@nvidia.com>
> >
> > The DRM_TEGRA_GEM_SET_FLAGS IOCTL can be used to set the flags of a
> > buffer object after it has been allocated or imported. Flags associated
> > with a buffer object can be queried using the DRM_TEGRA_GEM_GET_FLAGS
> > IOCTL.
> >
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> > drivers/gpu/drm/tegra/drm.c | 48 ++++++++++++++++++++++++++++++++++++++++++++
> > include/uapi/drm/tegra_drm.h | 21 +++++++++++++++++++
> > 2 files changed, 69 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> > index 5dca20982f3b..f292c29ef62f 100644
> > --- a/drivers/gpu/drm/tegra/drm.c
> > +++ b/drivers/gpu/drm/tegra/drm.c
> > @@ -548,6 +548,52 @@ static int tegra_gem_get_tiling(struct drm_device *drm, void *data,
> >
> > return err;
> > }
> > +
> > +static int tegra_gem_set_flags(struct drm_device *drm, void *data,
> > + struct drm_file *file)
> > +{
> > + struct drm_tegra_gem_set_flags *args = data;
> > + struct drm_tegra_bo *bo;
> > + unsigned long flags = 0;
> > +
> > + if (args->flags & ~DRM_TEGRA_GEM_FLAGS)
> > + return -EINVAL;
> > +
> > + gem = drm_gem_object_lookup(drm, file, args->handle);
> > + if (!gem)
> > + return -EINVAL;
>
> Usually -ENOENT is returned for unknown objects I think?
We've had that discussion on IRC a little while back. I came across a
few places where this was returned to userspace, and since I remember
a particular email[0] about this error code so well I thought it should
be discussed, but I can't remember the outcome (if any). Quoting from
that email:
ENOENT is not a valid error return from an ioctl. Never has been,
never will be. ENOENT means "No such file and directory", and is
for path operations. ioctl's are done on files that have already
been opened, there's no way in hell that ENOENT would ever be
valid.
Given that -ENOENT is used *a lot* in DRM (many, if not most, of the
instances returning the error from an IOCTL), I wonder how this can be
resolved. Given that userspace may rely on this error code and that we
can't break userspace I don't see a way out.
Thierry
[0]: https://lkml.org/lkml/2012/12/23/75
[-- Attachment #1.2: Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2014-06-12 7:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 11:04 [PATCH 1/4] drm/tegra: Implement more tiling modes Thierry Reding
[not found] ` <1402398294-10252-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-10 11:04 ` [PATCH 2/4] drm/tegra: Add SET/GET_TILING IOCTLs Thierry Reding
[not found] ` <1402398294-10252-2-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-11 17:43 ` Stéphane Marchesin
2014-06-12 7:01 ` Thierry Reding
2014-06-10 11:04 ` [PATCH 3/4] drm/tegra: Add SET/GET_FLAGS IOCTLs Thierry Reding
[not found] ` <1402398294-10252-3-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-11 16:21 ` Stéphane Marchesin
2014-06-12 7:18 ` Thierry Reding [this message]
2014-06-12 9:28 ` Daniel Vetter
2014-06-12 11:02 ` Thierry Reding
2014-06-10 11:04 ` [PATCH 4/4] drm/tegra: Allow non-authenticated processes to create buffer objects Thierry Reding
[not found] ` <1402398294-10252-4-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-11 16:17 ` Stéphane Marchesin
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=20140612071840.GB17027@ulmo \
--to=thierry.reding@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=marcheu@chromium.org \
/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).