All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kristian Høgsberg" <krh@bitplanet.net>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	stable@vger.kernel.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Deny wrapping an userptr into a framebuffer
Date: Thu, 22 Oct 2015 16:23:09 -0700	[thread overview]
Message-ID: <CAOeoa-eQOzhZKHeCYi55MKyuberuupWvPt2PGAxbP6nDqH-_Ew@mail.gmail.com> (raw)
In-Reply-To: <1444742546-27401-1-git-send-email-chris@chris-wilson.co.uk>

On Tue, Oct 13, 2015 at 6:22 AM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Pinning a userptr onto the hardware raises interesting questions about
> the lifetime of such a surface as the framebuffer extends that life
> beyond the client's address space. That is the hardware will need to
> keep scanning out from the backing storage even after the client wants
> to remap its address space. As the hardware pins the backing storage,
> the userptr becomes invalid and this raises a WARN when the clients
> tries to unmap its address space. The situation can be even more
> complicated when the buffer is passed between processes, between a
> client and display server, where the lifetime and hardware access is
> even more confusing. Deny it.

Can we allow this for unsynchronized userptrs?

Kristian

> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Michał Winiarski <michal.winiarski@intel.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/gpu/drm/i915/i915_gem_userptr.c | 5 ++++-
>  drivers/gpu/drm/i915/intel_display.c    | 5 +++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
> index 2dd911ab3019..3ce1b557f7c4 100644
> --- a/drivers/gpu/drm/i915/i915_gem_userptr.c
> +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
> @@ -974,7 +974,10 @@ out:
>   * Also note, that the object created here is not currently a "first class"
>   * object, in that several ioctls are banned. These are the CPU access
>   * ioctls: mmap(), pwrite and pread. In practice, you are expected to use
> - * direct access via your pointer rather than use those ioctls.
> + * direct access via your pointer rather than use those ioctls. Another
> + * restriction is that we do not allow userptr surfaces to be pinned to the
> + * hardware and so we reject any attempt to create a framebuffer out of a
> + * userptr.
>   *
>   * If you think this is a good interface to use to pass GPU memory between
>   * drivers, please use dma-buf instead. In fact, wherever possible use
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b89131654a0e..d1deaedcc4ce 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14116,6 +14116,11 @@ static int intel_user_framebuffer_create_handle(struct drm_framebuffer *fb,
>         struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
>         struct drm_i915_gem_object *obj = intel_fb->obj;
>
> +       if (obj->userptr.mm) {
> +               DRM_DEBUG("attempting to use a userptr for a framebuffer, denied\n");
> +               return -EINVAL;
> +       }
> +
>         return drm_gem_handle_create(file, &obj->base, handle);
>  }
>
> --
> 2.6.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2015-10-22 23:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 13:22 [PATCH] drm/i915: Deny wrapping an userptr into a framebuffer Chris Wilson
2015-10-13 14:00 ` [Intel-gfx] " Tvrtko Ursulin
2015-10-13 14:04   ` Tvrtko Ursulin
2015-10-13 14:04     ` Tvrtko Ursulin
2015-10-13 14:08   ` [Intel-gfx] " Jani Nikula
2015-10-13 15:29   ` Daniel Vetter
2015-10-13 15:29     ` Daniel Vetter
2015-10-22 23:23 ` Kristian Høgsberg [this message]
2015-10-23  8:04   ` [Intel-gfx] " Daniel Vetter
2015-10-23  8:04     ` Daniel Vetter
2015-10-23  9:28     ` [Intel-gfx] " Chris Wilson
2015-10-23  9:28       ` Chris Wilson
2015-10-23 19:20       ` Kristian Høgsberg

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=CAOeoa-eQOzhZKHeCYi55MKyuberuupWvPt2PGAxbP6nDqH-_Ew@mail.gmail.com \
    --to=krh@bitplanet.net \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=stable@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.