From: Jani Nikula <jani.nikula@linux.intel.com>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
David Herrmann <dh.herrmann@gmail.com>
Subject: Re: [PATCH] drm/i915: Document that mmap forwarding is discouraged
Date: Thu, 16 Oct 2014 13:48:20 +0300 [thread overview]
Message-ID: <87zjcwcmtn.fsf@intel.com> (raw)
In-Reply-To: <1413455298-1120-1-git-send-email-daniel.vetter@ffwll.ch>
On Thu, 16 Oct 2014, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Too many new drm driver writers seem to look at i915 for inspiration.
> But we have two ways to do mmap, so discourage readers from the old,
> ugly version. In a new driver we'd just expose two mmap offsets per
> object, one for the gtt map and the other for the cpu map.
>
> Cc: "Cheng, Yao" <yao.cheng@intel.com>
> Cc: David Herrmann <dh.herrmann@gmail.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index e9c783d55612..09d859b89aac 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1466,6 +1466,15 @@ unlock:
> *
> * While the mapping holds a reference on the contents of the object, it doesn't
> * imply a ref on the object itself.
> + *
> + * IMPORTANT:
> + *
> + * DRM driver writers who look a this function as an example for how to do GEM
> + * mmap support, please don't implement mmap support like here. The modern way
> + * to implement DRM mmap support is with an mmap offset ioctl (like
> + * i915_gem_mmap_gtt) and then using the mmap syscall on the DRM fd directly.
> + * That way debug tooling like valgrind will understand what's going on, hiding
> + * the mmap call in a driver private ioctl will break that.
Maybe a sentence here about why we're doing things differently, instead
of merely "do as I say, don't do as I do"? It smells like hysterical
raisins, but no harm in spelling it out, right?
BR,
Jani.
> */
> int
> i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
> --
> 1.9.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Jani Nikula, Intel Open Source Technology Center
next prev parent reply other threads:[~2014-10-16 10:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 10:28 [PATCH] drm/i915: Document that mmap forwarding is discouraged Daniel Vetter
2014-10-16 10:48 ` Jani Nikula [this message]
2014-10-19 14:52 ` Daniel Vetter
2014-10-16 12:02 ` David Herrmann
2014-10-16 14:02 ` Cheng, Yao
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=87zjcwcmtn.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dh.herrmann@gmail.com \
--cc=intel-gfx@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