All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH 12/20] drm/doc: Update drm_framebuffer docs
Date: Tue,  9 Aug 2016 15:41:23 +0200	[thread overview]
Message-ID: <1470750091-16627-13-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1470750091-16627-1-git-send-email-daniel.vetter@ffwll.ch>

- Move the intro section into a DOC comment, and update it slightly.
- kernel-doc for struct drm_framebuffer!

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 Documentation/gpu/drm-kms.rst     | 26 +----------
 drivers/gpu/drm/drm_framebuffer.c | 35 +++++++++++++++
 include/drm/drm_framebuffer.h     | 94 +++++++++++++++++++++++++++++++++------
 3 files changed, 118 insertions(+), 37 deletions(-)

diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
index 8264a88a8695..d244e03658cc 100644
--- a/Documentation/gpu/drm-kms.rst
+++ b/Documentation/gpu/drm-kms.rst
@@ -39,30 +39,8 @@ Atomic Mode Setting Function Reference
 Frame Buffer Abstraction
 ========================
 
-Frame buffers are abstract memory objects that provide a source of
-pixels to scanout to a CRTC. Applications explicitly request the
-creation of frame buffers through the DRM_IOCTL_MODE_ADDFB(2) ioctls
-and receive an opaque handle that can be passed to the KMS CRTC control,
-plane configuration and page flip functions.
-
-Frame buffers rely on the underneath memory manager for low-level memory
-operations. When creating a frame buffer applications pass a memory
-handle (or a list of memory handles for multi-planar formats) through
-the ``drm_mode_fb_cmd2`` argument. For drivers using GEM as their
-userspace buffer management interface this would be a GEM handle.
-Drivers are however free to use their own backing storage object
-handles, e.g. vmwgfx directly exposes special TTM handles to userspace
-and so expects TTM handles in the create ioctl and not GEM handles.
-
-The lifetime of a drm framebuffer is controlled with a reference count,
-drivers can grab additional references with
-:c:func:`drm_framebuffer_reference()`and drop them again with
-:c:func:`drm_framebuffer_unreference()`. For driver-private
-framebuffers for which the last reference is never dropped (e.g. for the
-fbdev framebuffer when the struct :c:type:`struct drm_framebuffer
-<drm_framebuffer>` is embedded into the fbdev helper struct)
-drivers can manually clean up a framebuffer at module unload time with
-:c:func:`drm_framebuffer_unregister_private()`.
+.. kernel-doc:: drivers/gpu/drm/drm_framebuffer.c
+   :doc: overview
 
 Frame Buffer Functions Reference
 --------------------------------
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index c7a8a623b336..f2f4928c7262 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -28,6 +28,41 @@
 #include "drm_crtc_internal.h"
 
 /**
+ * DOC: overview
+ *
+ * Frame buffers are abstract memory objects that provide a source of pixels to
+ * scanout to a CRTC. Applications explicitly request the creation of frame
+ * buffers through the DRM_IOCTL_MODE_ADDFB(2) ioctls and receive an opaque
+ * handle that can be passed to the KMS CRTC control, plane configuration and
+ * page flip functions.
+ *
+ * Frame buffers rely on the underlying memory manager for allocating backing
+ * storage. When creating a frame buffer applications pass a memory handle
+ * (or a list of memory handles for multi-planar formats) through the
+ * struct &drm_mode_fb_cmd2 argument. For drivers using GEM as their userspace
+ * buffer management interface this would be a GEM handle.  Drivers are however
+ * free to use their own backing storage object handles, e.g. vmwgfx directly
+ * exposes special TTM handles to userspace and so expects TTM handles in the
+ * create ioctl and not GEM handles.
+ *
+ * Framebuffers are tracked with struct &drm_framebuffer. They are published
+ * using drm_framebuffer_init() - after calling that function userspace can use
+ * and access the framebuffer object. The helper function
+ * drm_helper_mode_fill_fb_struct() can be used to pre-fill the required
+ * metadata fields.
+ *
+ * The lifetime of a drm framebuffer is controlled with a reference count,
+ * drivers can grab additional references with drm_framebuffer_reference() and
+ * drop them again with drm_framebuffer_unreference(). For driver-private
+ * framebuffers for which the last reference is never dropped (e.g. for the
+ * fbdev framebuffer when the struct struct &drm_framebuffer is embedded into
+ * the fbdev helper struct) drivers can manually clean up a framebuffer at
+ * module unload time with drm_framebuffer_unregister_private(). But doing this
+ * is not recommended, and it's better to have a normal free-standing struct
+ * &drm_framebuffer.
+ */
+
+/**
  * drm_mode_addfb - add an FB to the graphics configuration
  * @dev: drm device for the ioctl
  * @data: data pointer for the ioctl
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h
index 46abdace8fa5..685e062e57d7 100644
--- a/include/drm/drm_framebuffer.h
+++ b/include/drm/drm_framebuffer.h
@@ -92,37 +92,105 @@ struct drm_framebuffer_funcs {
 		     unsigned num_clips);
 };
 
+/**
+ * struct drm_framebuffer - frame buffer object
+ *
+ * Note that the fb is refcounted for the benefit of driver internals,
+ * for example some hw, disabling a CRTC/plane is asynchronous, and
+ * scanout does not actually complete until the next vblank.  So some
+ * cleanup (like releasing the reference(s) on the backing GEM bo(s))
+ * should be deferred.  In cases like this, the driver would like to
+ * hold a ref to the fb even though it has already been removed from
+ * userspace perspective. See drm_framebuffer_reference() and
+ * drm_framebuffer_unreference().
+ *
+ * The refcount is stored inside the mode object @base.
+ */
 struct drm_framebuffer {
+	/**
+	 * @dev: DRM device this framebuffer belongs to
+	 */
 	struct drm_device *dev;
-	/*
-	 * Note that the fb is refcounted for the benefit of driver internals,
-	 * for example some hw, disabling a CRTC/plane is asynchronous, and
-	 * scanout does not actually complete until the next vblank.  So some
-	 * cleanup (like releasing the reference(s) on the backing GEM bo(s))
-	 * should be deferred.  In cases like this, the driver would like to
-	 * hold a ref to the fb even though it has already been removed from
-	 * userspace perspective.
-	 * The refcount is stored inside the mode object.
-	 */
-	/*
-	 * Place on the dev->mode_config.fb_list, access protected by
+	/**
+	 * @head: Place on the dev->mode_config.fb_list, access protected by
 	 * dev->mode_config.fb_lock.
 	 */
 	struct list_head head;
+
+	/**
+	 * @base: base modeset object structure, contains the reference count.
+	 */
 	struct drm_mode_object base;
+	/**
+	 * @funcs: framebuffer vfunc table
+	 */
 	const struct drm_framebuffer_funcs *funcs;
+	/**
+	 * @pitches: Line stride per buffer. For userspace created object this
+	 * is copied from drm_mode_fb_cmd2.
+	 */
 	unsigned int pitches[4];
+	/**
+	 * @offsets: Offset from buffer start to the actual pixel data in bytes,
+	 * per buffer. For userspace created object this is copied from
+	 * drm_mode_fb_cmd2.
+	 */
 	unsigned int offsets[4];
+	/**
+	 * @modifier: Data layout modifier, per buffer. This is used to describe
+	 * tiling, or also special layouts (like compression) of auxiliary
+	 * buffers. For userspace created object this is copied from
+	 * drm_mode_fb_cmd2.
+	 */
 	uint64_t modifier[4];
+	/**
+	 * @width: Logical width of the visible area of the framebuffer, in
+	 * pixels.
+	 */
 	unsigned int width;
+	/**
+	 * @height: Logical width of the visible area of the framebuffer, in
+	 * pixels.
+	 */
 	unsigned int height;
-	/* depth can be 15 or 16 */
+	/**
+	 * @depth: Depth in bits per pixel for RGB formats. 0 for everything
+	 * else. Legacy information derived from @pixel_format, it's suggested to use
+	 * the DRM FOURCC codes and helper functions directly instead.
+	 */
 	unsigned int depth;
+	/**
+	 * @bits_per_pixel: Storage used bits per pixel for RGB formats. 0 for
+	 * everything else. Legacy information derived from @pixel_format, it's
+	 * suggested to use the DRM FOURCC codes and helper functions directly
+	 * instead.
+	 */
 	int bits_per_pixel;
+	/**
+	 * @flags: Framebuffer flags like DRM_MODE_FB_INTERLACED or
+	 * DRM_MODE_FB_MODIFIERS.
+	 */
 	int flags;
+	/**
+	 * @pixel_format: DRM FOURCC code describing the pixel format.
+	 */
 	uint32_t pixel_format; /* fourcc format */
+	/**
+	 * @hot_x: X coordinate of the cursor hotspot. Used by the legacy cursor
+	 * IOCTL when the driver supports cursor through a DRM_PLANE_TYPE_CURSOR
+	 * universal plane.
+	 */
 	int hot_x;
+	/**
+	 * @hot_y: Y coordinate of the cursor hotspot. Used by the legacy cursor
+	 * IOCTL when the driver supports cursor through a DRM_PLANE_TYPE_CURSOR
+	 * universal plane.
+	 */
 	int hot_y;
+	/**
+	 * @filp_head: Placed on struct &drm_file fbs list_head, protected by
+	 * fbs_lock in the same structure.
+	 */
 	struct list_head filp_head;
 };
 
-- 
2.8.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-08-09 13:42 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 13:41 [PATCH 00/20] more drm doc work Daniel Vetter
2016-08-09 13:41 ` [PATCH 01/20] drm/doc: Fix more kerneldoc/sphinx warnings Daniel Vetter
2016-08-11  8:15   ` Jani Nikula
2016-08-11  8:23     ` Ville Syrjälä
2016-08-11  8:23     ` Jani Nikula
2016-08-11  9:29       ` Markus Heiser
2016-08-09 13:41 ` [PATCH 02/20] drm/doc: Light drm-kms-helper.rst cleanup Daniel Vetter
2016-08-09 16:19   ` Sean Paul
2016-08-09 13:41 ` [PATCH 03/20] drm/kms-helpers: Extract drm_modeset_helper.[hc] Daniel Vetter
2016-08-10 14:23   ` Sean Paul
2016-08-10 14:46     ` Daniel Vetter
2016-08-09 13:41 ` [PATCH 04/20] drm/doc: Reorg drm-mm.rst Daniel Vetter
2016-08-09 13:41 ` [PATCH 05/20] drm/doc: Reorg for drm-kms.rst Daniel Vetter
2016-08-09 13:41 ` [PATCH 06/20] drm/etnaviv: Don't set drm_device->platformdev Daniel Vetter
2016-08-09 13:41 ` [PATCH 07/20] drm/hisilicon: " Daniel Vetter
2016-08-09 13:41 ` [PATCH 08/20] drm/doc: Remove outdated FIXME for the page_flip callback Daniel Vetter
2016-08-09 13:41 ` [PATCH 09/20] drm/kms: Nuke dirty_info property Daniel Vetter
2016-08-09 13:59   ` Thomas Hellstrom
2016-08-09 14:08     ` Daniel Vetter
2016-08-10 12:07       ` Thomas Hellstrom
2016-08-09 13:41 ` [PATCH 10/20] drm/doc: Include drm_atomic.h Daniel Vetter
2016-08-09 13:41 ` [PATCH 11/20] drm: Extract drm_framebuffer.[hc] Daniel Vetter
2016-08-10 14:48   ` Sean Paul
2016-08-12 20:03     ` Daniel Vetter
2016-08-09 13:41 ` Daniel Vetter [this message]
2016-08-10 14:53   ` [PATCH 12/20] drm/doc: Update drm_framebuffer docs Sean Paul
2016-08-10 15:15   ` Ville Syrjälä
2016-08-12 20:09     ` Daniel Vetter
2016-08-09 13:41 ` [PATCH 13/20] drm: Export drm_property_replace_global_blob Daniel Vetter
2016-08-09 13:41 ` [PATCH 14/20] drm: Extract drm_connector.[hc] Daniel Vetter
2016-08-10 15:06   ` Sean Paul
2016-08-12 20:24     ` Daniel Vetter
2016-08-09 13:41 ` [PATCH 15/20] drm/doc: Include new drm_blend.c Daniel Vetter
2016-08-09 13:41 ` [PATCH 16/20] drm: Don't export dp-aux devnode functions Daniel Vetter
2016-08-10 15:09   ` [Intel-gfx] " Sean Paul
2016-08-09 13:41 ` [PATCH 17/20] drm: Update connector documentation Daniel Vetter
2016-08-10 15:14   ` Sean Paul
2016-08-09 13:41 ` [PATCH 18/20] drm: Remove display_info->min/max_(h|v)max Daniel Vetter
2016-08-09 13:41 ` [PATCH 19/20] drm: docume drm_display_info Daniel Vetter
2016-08-10 15:18   ` Sean Paul
2016-08-09 13:41 ` [PATCH 20/20] vgaarbiter: rst-ifiy and polish kerneldoc Daniel Vetter
2016-08-09 13:50   ` [PATCH] " Daniel Vetter
2016-08-10 15:27     ` Sean Paul
2016-08-09 13:50 ` ✗ Ro.CI.BAT: failure for more drm doc work Patchwork
2016-08-09 14:00 ` ✗ Ro.CI.BAT: failure for more drm doc work (rev2) Patchwork
2016-08-10  6:33 ` Patchwork
2016-08-10 15:04 ` ✗ Fi.CI.BAT: " Patchwork
2016-08-10 15:28 ` [PATCH 00/20] more drm doc work Sean Paul

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=1470750091-16627-13-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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 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.