From: Thierry Reding <thierry.reding@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
dri-devel@lists.freedesktop.org,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Archit Taneja <archit@ti.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Russell King <rmk+kernel@arm.linux.org.uk>,
Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH 3/7] drm/doc: Add GEM/CMA helpers to kerneldoc
Date: Wed, 5 Nov 2014 16:01:26 +0100 [thread overview]
Message-ID: <20141105150124.GC24353@ulmo> (raw)
In-Reply-To: <20141105143440.GO26941@phenom.ffwll.local>
[-- Attachment #1.1: Type: text/plain, Size: 5653 bytes --]
On Wed, Nov 05, 2014 at 03:34:40PM +0100, Daniel Vetter wrote:
> On Wed, Nov 05, 2014 at 02:25:15PM +0100, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> >
> > Most of the functions already have the beginnings of kerneldoc comments
> > but are using the wrong opening marker. Use the correct opening marker
> > and flesh out the comments so that they can be integrated with the DRM
> > DocBook document.
> >
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
>
> Bunch of comments inline below.
> -Daniel
>
> > ---
> > Documentation/DocBook/drm.tmpl | 6 ++
> > drivers/gpu/drm/drm_gem_cma_helper.c | 155 ++++++++++++++++++++++++++---------
> > include/drm/drm_gem_cma_helper.h | 25 ++++--
> > 3 files changed, 139 insertions(+), 47 deletions(-)
> >
> > diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
> > index 18025496a736..666a210af121 100644
> > --- a/Documentation/DocBook/drm.tmpl
> > +++ b/Documentation/DocBook/drm.tmpl
> > @@ -963,6 +963,12 @@ struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
> > !Edrivers/gpu/drm/drm_mm.c
> > !Iinclude/drm/drm_mm.h
> > </sect2>
> > + <sect2>
> > + <title>CMA Helper Functions Reference</title>
> > +!Pdrivers/gpu/drm/drm_gem_cma_helper.c cma helpers
> > +!Edrivers/gpu/drm/drm_gem_cma_helper.c
> > +!Iinclude/drm/drm_gem_cma_helper.h
> > + </sect2>
> > </sect1>
> >
> > <!-- Internals: mode setting -->
> > diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
> > index 0316310e2cc4..55306be1f8f7 100644
> > --- a/drivers/gpu/drm/drm_gem_cma_helper.c
> > +++ b/drivers/gpu/drm/drm_gem_cma_helper.c
> > @@ -29,18 +29,30 @@
> > #include <drm/drm_gem_cma_helper.h>
> > #include <drm/drm_vma_manager.h>
> >
> > -/*
> > +/**
> > + * DOC: cma helpers
> > + *
> > + * The Contiguous Memory Allocator reserves a pool of memory at early boot
> > + * that is used to service requests for large blocks of contiguous memory.
> > + *
> > + * The DRM GEM/CMA helpers use this allocator as a means to provide buffer
> > + * objects that are physically contiguous in memory. This is useful for
> > + * display drivers that are unable to map scattered buffers via an IOMMU.
> > + */
> > +
> > +/**
> > * __drm_gem_cma_create - Create a GEM CMA object without allocating memory
> > - * @drm: The drm device
> > - * @size: The GEM object size
> > + * @drm: DRM device
> > + * @size: size of the object to allocate
> > *
> > - * This function creates and initializes a GEM CMA object of the given size, but
> > - * doesn't allocate any memory to back the object.
> > + * This function creates and initializes a GEM CMA object of the given size,
> > + * but doesn't allocate any memory to back the object.
> > *
> > - * Return a struct drm_gem_cma_object* on success or ERR_PTR values on failure.
> > + * Return: A struct drm_gem_cma_object * on success or an ERR_PTR()-encoded
>
> Same bikeshed about "Returns:\n" as with the panel kerneldoc patch.
I've been following the style described in the kernel-doc nano-HOWTO,
which says that:
The return value, if any, should be described in a dedicated
section named "Return".
There are other things in that document that we don't follow in DRM, so
I wonder if we should just consider it as guidelines rather than actual
rules (they aren't enforced anyway) or perhaps make a pass over existing
kerneldoc and convert it to the rules described in that document.
That document is the only reference for the kerneldoc syntax (that I
know of), so I had always thought that we should be following it.
> > -/*
> > - * drm_gem_cma_dumb_create - (struct drm_driver)->dumb_create callback
> > - * function
> > +/**
> > + * drm_gem_cma_dumb_create - create a dumb buffer object
> > + * @file_priv: DRM file-private structure to create the dumb buffer for
> > + * @drm: DRM device
> > + * @args: IOCTL data
> > *
> > - * This aligns the pitch and size arguments to the minimum required. wrap
> > + * This aligns the pitch and size arguments to the minimum required. Wrap
> > * this into your own function if you need bigger alignment.
>
> I think we should augment this slightly with something like
>
> "Drivers without special needs can directly use this as their
> ->dumb_create callback."
Good idea.
> Similar for dumb_mmap_offset below.
I don't see any way how drm_gem_cma_dumb_map_offset() could be
parameterized. It certainly looks generic enough not to need any
device-specific quirks.
> > -/*
> > - * drm_gem_cma_mmap - (struct file_operation)->mmap callback function
> > +/**
> > + * drm_gem_cma_mmap - memory-map a CMA GEM object
> > + * @filp: file object
> > + * @vma: VMA for the area to be mapped
>
> Imo the real value of kerneldoc is the blabla here that describes what
> this should be used for and when. E.g. here
>
> "This function implements an augmented version of the gem DRM file mmap
> operation for cma objects: In addition to the usual gem vma setup it
> immediately faults in the entire object instead of using on-demand
> faulting. Drivers which employ the cma helpers should use this function as
> their ->mmap handler for the DRM device file's file_operation structure."
I've taken the easy route and simply copied your example.
> So requires grepping each function and hunting for the usual pattern (and
> noticing tons of crazy stuff, usually).
>
> Same for all the functions below.
Okay, I'll see what I can come up with.
Thierry
[-- Attachment #1.2: Type: application/pgp-signature, Size: 819 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-11-05 15:01 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 13:25 [PATCH 0/7] drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input Thierry Reding
2014-11-05 13:25 ` [PATCH 1/7] drm/gem: Fix a few kerneldoc typos Thierry Reding
2014-11-05 14:18 ` Daniel Vetter
2014-11-05 13:25 ` [PATCH 2/7] drm/doc: mm: Fix indentation Thierry Reding
2014-11-05 14:19 ` Daniel Vetter
2014-11-05 13:25 ` [PATCH 3/7] drm/doc: Add GEM/CMA helpers to kerneldoc Thierry Reding
2014-11-05 14:34 ` Daniel Vetter
2014-11-05 15:01 ` Thierry Reding [this message]
2014-11-05 15:04 ` Daniel Vetter
2014-11-05 15:16 ` Thierry Reding
2014-11-05 13:25 ` [PATCH 4/7] drm/cma: Introduce drm_gem_cma_dumb_create_internal() Thierry Reding
2014-11-05 14:36 ` Daniel Vetter
2014-11-05 13:25 ` [PATCH 5/7] drm/omap: gem: dumb: pitch is an output Thierry Reding
2014-11-05 14:38 ` Daniel Vetter
2014-11-05 13:25 ` [PATCH 6/7] drm/rcar: " Thierry Reding
2014-11-05 14:39 ` Daniel Vetter
2014-11-05 18:47 ` Laurent Pinchart
2014-11-06 0:54 ` Russell King - ARM Linux
2014-11-06 18:17 ` Laurent Pinchart
2014-11-05 13:25 ` [PATCH 7/7] drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input Thierry Reding
2014-11-05 14:42 ` Daniel Vetter
2014-11-05 14:24 ` [PATCH 0/7] " Russell King - ARM Linux
2014-11-05 14:45 ` Thierry Reding
2014-11-05 15:01 ` Daniel Vetter
2014-11-06 15:49 ` [PATCH v2 0/8] " Thierry Reding
2014-11-06 15:49 ` [PATCH v2 1/8] drm/gem: Fix a few kerneldoc typos Thierry Reding
2014-11-06 15:49 ` [PATCH v2 2/8] drm/doc: mm: Fix indentation Thierry Reding
2014-11-06 15:49 ` [PATCH v2 3/8] drm/doc: Add GEM/CMA helpers to kerneldoc Thierry Reding
2014-11-06 20:05 ` Daniel Vetter
2014-11-06 15:49 ` [PATCH v2 4/8] drm/cma: Introduce drm_gem_cma_dumb_create_internal() Thierry Reding
2014-11-06 15:49 ` [PATCH v2 5/8] drm/omap: gem: dumb: pitch is an output Thierry Reding
2014-11-06 22:23 ` Rob Clark
2014-11-07 8:02 ` Tomi Valkeinen
2014-11-06 15:49 ` [PATCH v2 6/8] drm/rcar: " Thierry Reding
2014-11-06 15:49 ` [PATCH v2 7/8] drm: Sanitize DRM_IOCTL_MODE_CREATE_DUMB input Thierry Reding
2014-11-06 15:49 ` [PATCH v2 8/8] drm/cma: Remove call to drm_gem_free_mmap_offset() Thierry Reding
2014-11-06 20:06 ` Daniel Vetter
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=20141105150124.GC24353@ulmo \
--to=thierry.reding@gmail.com \
--cc=airlied@redhat.com \
--cc=archit@ti.com \
--cc=benjamin.gaignard@linaro.org \
--cc=daniel.vetter@ffwll.ch \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=tomi.valkeinen@ti.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 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.