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>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: [PATCH 01/34] drm/doc: Clarify the dumb object interfaces
Date: Tue, 11 Mar 2014 11:29:57 +0100	[thread overview]
Message-ID: <1394533830-30150-2-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1394533830-30150-1-git-send-email-daniel.vetter@ffwll.ch>

- This is _not_ a generic interface to create gem objects, but just an
  interface to make early boot services (like boot splash) with a
  generic KMS userspace driver possible. Hence it's better to move
  the documentation for this from the GEM section to the KMS section,
  next to the creation of framebuffer objects.

- Make it really clear that the returned handle isn't necessarily a
  GEM object (it can also be e.g. a TTM handle when running on top of
  vmwgfx).

- Add a paragraph to make it clear that this is just for unaccelarated
  userspace - gpu drivers need to have their own buffer object
  creation ioctl which is hardware specific.

v2: Clarify that the documentation doesn't just apply to GEM-based
drivers only but is now generally valid, as suggested by David.

v3: Polish the intro sentence a bit and one s/objects/handles/ for
clarification, both suggested by Laurent.

v4: More text polish from Laurent's review.

v5: More typo fixes from Dieter.

Cc: Dieter Nützel <Dieter@nuetzel-hh.de>
Cc: David Herrmann <dh.herrmann@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 Documentation/DocBook/drm.tmpl | 133 ++++++++++++++++++++++-------------------
 1 file changed, 72 insertions(+), 61 deletions(-)

diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index ed1d6d289022..f2d0f5b89194 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -830,62 +830,6 @@ char *date;</synopsis>
         </para>
       </sect3>
       <sect3>
-        <title>Dumb GEM Objects</title>
-        <para>
-          The GEM API doesn't standardize GEM objects creation and leaves it to
-          driver-specific ioctls. While not an issue for full-fledged graphics
-          stacks that include device-specific userspace components (in libdrm for
-          instance), this limit makes DRM-based early boot graphics unnecessarily
-          complex.
-        </para>
-        <para>
-          Dumb GEM objects partly alleviate the problem by providing a standard
-          API to create dumb buffers suitable for scanout, which can then be used
-          to create KMS frame buffers.
-        </para>
-        <para>
-          To support dumb GEM objects drivers must implement the
-          <methodname>dumb_create</methodname>,
-          <methodname>dumb_destroy</methodname> and
-          <methodname>dumb_map_offset</methodname> operations.
-        </para>
-        <itemizedlist>
-          <listitem>
-            <synopsis>int (*dumb_create)(struct drm_file *file_priv, struct drm_device *dev,
-                     struct drm_mode_create_dumb *args);</synopsis>
-            <para>
-              The <methodname>dumb_create</methodname> operation creates a GEM
-              object suitable for scanout based on the width, height and depth
-              from the struct <structname>drm_mode_create_dumb</structname>
-              argument. It fills the argument's <structfield>handle</structfield>,
-              <structfield>pitch</structfield> and <structfield>size</structfield>
-              fields with a handle for the newly created GEM object and its line
-              pitch and size in bytes.
-            </para>
-          </listitem>
-          <listitem>
-            <synopsis>int (*dumb_destroy)(struct drm_file *file_priv, struct drm_device *dev,
-                      uint32_t handle);</synopsis>
-            <para>
-              The <methodname>dumb_destroy</methodname> operation destroys a dumb
-              GEM object created by <methodname>dumb_create</methodname>.
-            </para>
-          </listitem>
-          <listitem>
-            <synopsis>int (*dumb_map_offset)(struct drm_file *file_priv, struct drm_device *dev,
-                         uint32_t handle, uint64_t *offset);</synopsis>
-            <para>
-              The <methodname>dumb_map_offset</methodname> operation associates an
-              mmap fake offset with the GEM object given by the handle and returns
-              it. Drivers must use the
-              <function>drm_gem_create_mmap_offset</function> function to
-              associate the fake offset as described in
-              <xref linkend="drm-gem-objects-mapping"/>.
-            </para>
-          </listitem>
-        </itemizedlist>
-      </sect3>
-      <sect3>
         <title>Memory Coherency</title>
         <para>
           When mapped to the device or used in a command buffer, backing pages
@@ -968,9 +912,11 @@ int max_width, max_height;</synopsis>
         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 <parameter>drm_mode_fb_cmd2</parameter> argument. This document
-        assumes that the driver uses GEM, those handles thus reference GEM
-        objects.
+	the <parameter>drm_mode_fb_cmd2</parameter> 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.
       </para>
       <para>
         Drivers must first validate the requested frame buffer parameters passed
@@ -992,7 +938,7 @@ int max_width, max_height;</synopsis>
       </para>
 
       <para>
-	The initailization of the new framebuffer instance is finalized with a
+	The initialization of the new framebuffer instance is finalized with a
 	call to <function>drm_framebuffer_init</function> which takes a pointer
 	to DRM frame buffer operations (struct
 	<structname>drm_framebuffer_funcs</structname>). Note that this function
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 	<function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb Buffer Objects</title>
+      <para>
+	The KMS API doesn't standardize backing storage object creation and
+	leaves it to driver-specific ioctls. Furthermore actually creating a
+	buffer object even for GEM-based drivers is done through a
+	driver-specific ioctl - GEM only has a common userspace interface for
+	sharing and destroying objects. While not an issue for full-fledged
+	graphics stacks that include device-specific userspace components (in
+	libdrm for instance), this limit makes DRM-based early boot graphics
+	unnecessarily complex.
+      </para>
+      <para>
+        Dumb objects partly alleviate the problem by providing a standard
+        API to create dumb buffers suitable for scanout, which can then be used
+        to create KMS frame buffers.
+      </para>
+      <para>
+        To support dumb objects drivers must implement the
+        <methodname>dumb_create</methodname>,
+        <methodname>dumb_destroy</methodname> and
+        <methodname>dumb_map_offset</methodname> operations.
+      </para>
+      <itemizedlist>
+        <listitem>
+          <synopsis>int (*dumb_create)(struct drm_file *file_priv, struct drm_device *dev,
+                   struct drm_mode_create_dumb *args);</synopsis>
+          <para>
+            The <methodname>dumb_create</methodname> operation creates a driver
+	    object (GEM or TTM handle) suitable for scanout based on the
+	    width, height and depth from the struct
+	    <structname>drm_mode_create_dumb</structname> argument. It fills the
+	    argument's <structfield>handle</structfield>,
+	    <structfield>pitch</structfield> and <structfield>size</structfield>
+	    fields with a handle for the newly created object and its line
+            pitch and size in bytes.
+          </para>
+        </listitem>
+        <listitem>
+          <synopsis>int (*dumb_destroy)(struct drm_file *file_priv, struct drm_device *dev,
+                    uint32_t handle);</synopsis>
+          <para>
+            The <methodname>dumb_destroy</methodname> operation destroys a dumb
+            object created by <methodname>dumb_create</methodname>.
+          </para>
+        </listitem>
+        <listitem>
+          <synopsis>int (*dumb_map_offset)(struct drm_file *file_priv, struct drm_device *dev,
+                       uint32_t handle, uint64_t *offset);</synopsis>
+          <para>
+            The <methodname>dumb_map_offset</methodname> operation associates an
+            mmap fake offset with the object given by the handle and returns
+            it. Drivers must use the
+            <function>drm_gem_create_mmap_offset</function> function to
+            associate the fake offset as described in
+            <xref linkend="drm-gem-objects-mapping"/>.
+          </para>
+        </listitem>
+      </itemizedlist>
+      <para>
+        Note that dumb objects may not be used for gpu acceleration, as has been
+	attempted on some ARM embedded platforms. Such drivers really must have
+	a hardware-specific ioctl to allocate suitable buffer objects.
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device *dev);</synopsis>
       <para>
@@ -2134,7 +2145,7 @@ void intel_crt_init(struct drm_device *dev)
             set the <structfield>display_info</structfield>
             <structfield>width_mm</structfield> and
             <structfield>height_mm</structfield> fields if they haven't been set
-            already (for instance at initilization time when a fixed-size panel is
+            already (for instance at initialization time when a fixed-size panel is
             attached to the connector). The mode <structfield>width_mm</structfield>
             and <structfield>height_mm</structfield> fields are only used internally
             during EDID parsing and should not be set when creating modes manually.
-- 
1.8.5.2

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

  reply	other threads:[~2014-03-11 10:30 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-11 10:29 [PATCH 00/34] drm: moar kerneldoc and cleanups Daniel Vetter
2014-03-11 10:29 ` Daniel Vetter [this message]
2014-03-11 10:29 ` [PATCH 02/34] drm/doc: Fix up kerneldoc in drm_edid.c Daniel Vetter
2014-03-11 10:29 ` [PATCH 03/34] drm/doc: Clean up and integrate kerneldoc for drm_gem.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 04/34] drm/doc: Remove <term> from rendernode docs Daniel Vetter
2014-03-11 10:30 ` [PATCH 05/34] drm/doc: Reorganize driver documentation Daniel Vetter
2014-03-11 10:30 ` [PATCH 06/34] drm/doc: Move the vma offset manager to the right spot Daniel Vetter
2014-03-11 10:30 ` [PATCH 07/34] drm/doc: Remove the "command submissin and fencing" section Daniel Vetter
2014-03-11 10:30 ` [PATCH 08/34] drm/doc: No more drm perf counters Daniel Vetter
2014-03-11 10:30 ` [PATCH 09/34] drm/doc: Document drm_helper_resume_force_mode Daniel Vetter
2014-03-11 10:30 ` [PATCH 10/34] drm/doc: Hide legacy horrors better Daniel Vetter
2014-03-11 10:30 ` [PATCH 11/34] drm/docs: Include hdmi infoframe helper reference Daniel Vetter
2014-03-11 10:30 ` [PATCH 12/34] drm/doc: Clarify PRIME documentation Daniel Vetter
2014-03-11 10:30 ` [PATCH 13/34] drm/doc: Add PRIME function references Daniel Vetter
2014-03-11 10:30 ` [PATCH 14/34] drm/doc: Update copyright Daniel Vetter
2014-03-11 10:30 ` [PATCH 15/34] drm/mm: Remove MM_UNUSED_TARGET Daniel Vetter
2014-03-11 10:30 ` [PATCH 16/34] drm/doc: Overview documentation for drm_mm.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 17/34] drm/doc: Add fucntion reference " Daniel Vetter
2014-03-11 10:30 ` [PATCH 18/34] drm/kms: rip out drm_mode_connector_detach_encoder Daniel Vetter
2014-03-11 10:30 ` [PATCH 19/34] drm/doc: Integrate drm_modes.c kerneldoc Daniel Vetter
2014-03-11 10:30 ` [PATCH 20/34] drm/doc: Repleace LOCKING kerneldoc sections in drm_modes.c Daniel Vetter
2014-03-20  1:31   ` Dave Airlie
2014-03-22  6:45     ` Ben Widawsky
2014-03-23  8:19       ` Daniel Vetter
2014-03-11 10:30 ` [PATCH 21/34] drm: move drm_mode related functions into drm_modes.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 22/34] drm: extract drm_modes.h for drm_modes.c functions Daniel Vetter
2014-03-11 10:30 ` [PATCH 23/34] drm/modes: remove drm_mode_height/width Daniel Vetter
2014-03-11 10:30 ` [PATCH 24/34] drm/modes: drop return value from drm_display_mode_from_videomode Daniel Vetter
2014-03-11 10:30 ` [PATCH 25/34] drm/modes: drop maxPitch from drm_mode_validate_size Daniel Vetter
2014-03-11 10:30 ` [PATCH 26/34] drm: polish function kerneldoc for drm_modes.[hc] Daniel Vetter
2014-03-11 10:30 ` [PATCH 27/34] drm: remove drm_display_mode->private_size Daniel Vetter
2014-03-11 10:30 ` [PATCH 28/34] drm/doc: Fix misplaced </para> Daniel Vetter
2014-03-11 10:30 ` [PATCH 29/34] drm: remove return value from drm_helper_mode_fill_fb_struct Daniel Vetter
2014-03-11 10:30 ` [PATCH 30/34] drm/crtc-helper: remove LOCKING from kerneldoc Daniel Vetter
2014-03-11 10:30 ` [PATCH 31/34] drm: drop error code for drm_helper_resume_force_mode Daniel Vetter
2014-03-11 10:30 ` [PATCH 32/34] drm: kerneldoc polish for drm_crtc_helper.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 33/34] drm: kerneldoc polish for drm_crtc.c Daniel Vetter
2014-03-11 10:30 ` [PATCH 34/34] drm/kms: don't export drm_mode_group_init_legacy_group Daniel Vetter
2014-03-11 14:16 ` [PATCH 00/34] drm: moar kerneldoc and cleanups Alex Deucher
2014-03-15 11:15 ` [PATCH] drm/imx: remove drm_mode_connector_detach_encoder harder Daniel Vetter
2014-03-15 11:23   ` Russell King - ARM Linux
2014-03-15 11:35     ` Daniel Vetter
2014-03-17 21:48   ` Greg Kroah-Hartman

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=1394533830-30150-2-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.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.