From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Daniel Stone <daniels@collabora.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 3/4] drm: Reshuffle getfb error returns
Date: Fri, 23 Mar 2018 16:43:18 +0200 [thread overview]
Message-ID: <20180323144318.GX5453@intel.com> (raw)
In-Reply-To: <20180323134553.15993-3-daniels@collabora.com>
On Fri, Mar 23, 2018 at 01:45:51PM +0000, Daniel Stone wrote:
> Make it a little more clear what's going on inside of getfb, and also
> make it easier to add alternate paths to get a handle in future.
>
> Signed-off-by: Daniel Stone <daniels@collabora.com>
Much better.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/drm_framebuffer.c | 33 +++++++++++++++++----------------
> 1 file changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index ad67203de715..6d5ff541225a 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -468,29 +468,30 @@ int drm_mode_getfb(struct drm_device *dev,
> goto out;
> }
>
> + if (!fb->funcs->create_handle) {
> + ret = -ENODEV;
> + goto out;
> + }
> +
> r->height = fb->height;
> r->width = fb->width;
> r->depth = fb->format->depth;
> r->bpp = fb->format->cpp[0] * 8;
> r->pitch = fb->pitches[0];
> - if (fb->funcs->create_handle) {
> - if (drm_is_current_master(file_priv) || capable(CAP_SYS_ADMIN) ||
> - drm_is_control_client(file_priv)) {
> - ret = fb->funcs->create_handle(fb, file_priv,
> - &r->handle);
> - } else {
> - /* GET_FB() is an unprivileged ioctl so we must not
> - * return a buffer-handle to non-master processes! For
> - * backwards-compatibility reasons, we cannot make
> - * GET_FB() privileged, so just return an invalid handle
> - * for non-masters. */
> - r->handle = 0;
> - ret = 0;
> - }
> - } else {
> - ret = -ENODEV;
> +
> + /* GET_FB() is an unprivileged ioctl so we must not return a
> + * buffer-handle to non-master processes! For
> + * backwards-compatibility reasons, we cannot make GET_FB() privileged,
> + * so just return an invalid handle for non-masters. */
> + if (!drm_is_current_master(file_priv) && !capable(CAP_SYS_ADMIN) &&
> + !drm_is_control_client(file_priv)) {
> + r->handle = 0;
> + ret = 0;
> + goto out;
> }
>
> + ret = fb->funcs->create_handle(fb, file_priv, &r->handle);
> +
> out:
> drm_framebuffer_put(fb);
>
> --
> 2.16.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-03-23 14:43 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-23 13:42 [PATCH 0/8] Add GetFB2 ioctl Daniel Stone
2018-03-23 13:45 ` [PATCH 1/4] drm/i915: Use intel_fb_obj() everywhere Daniel Stone
2018-03-23 13:45 ` [PATCH 2/4] drm/i915: Move GEM BO inside drm_framebuffer Daniel Stone
2018-03-23 14:42 ` [Intel-gfx] " Ville Syrjälä
2018-03-23 14:49 ` Daniel Stone
2018-05-17 13:18 ` [Intel-gfx] " Daniel Stone
2018-03-23 13:45 ` [PATCH 3/4] drm: Reshuffle getfb error returns Daniel Stone
2018-03-23 14:43 ` Ville Syrjälä [this message]
2018-03-23 13:45 ` [PATCH 4/4] drm: Add getfb2 ioctl Daniel Stone
2018-03-23 14:49 ` Ville Syrjälä
2018-03-23 17:00 ` Daniel Stone
2018-03-23 17:31 ` Ville Syrjälä
2018-03-24 10:12 ` Daniel Stone
2018-03-23 13:45 ` [PATCH libdrm] NOMERGE: Add drmModeGetFB2 Daniel Stone
2018-03-23 13:46 ` [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Daniel Stone
2018-03-23 13:46 ` [PATCH i-g-t 2/3] NOMERGE: Update DRM UAPI to latest kernel version Daniel Stone
2018-03-23 13:46 ` [PATCH i-g-t 3/3] tests/kms_getfb: Add getfb2 tests Daniel Stone
2018-03-23 15:01 ` [igt-dev] " Ville Syrjälä
2018-03-23 14:53 ` [PATCH i-g-t 1/3] tests/kms_getfb: Split property-ID get into helper Ville Syrjälä
2018-03-23 14:55 ` [igt-dev] " Daniel Stone
2018-03-23 13:51 ` [PATCH 0/8] Add GetFB2 ioctl Daniel Stone
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=20180323144318.GX5453@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniels@collabora.com \
--cc=dri-devel@lists.freedesktop.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