Skip to contentSkip to conversation

DRM developer's guide polish, part 1

PATCH Applied Daniel Vetter 6 participants 46 messages Jan 23, 2014 – Jan 26, 2014

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover DRM developer's guide polish, part 1

Hi all,

So I've finally gotten around to honor my promise for some nice drm_mm.c documentation and got slightly sidetracked. I have more cleanups in my queue (mostly to better document the modesetting functions and polish the kerneldoc reference sections a bit) but David Herrmann suggested that reviewing smaller doc patch piles is easier. So here we go.

The meat of this is documenting drm_mm.c and added kerneldoc for drm_prime.c, with a few adjacent things I've stumbled over. I'm also trying to clarify the overall DocBook a bit by emphasising more what's core code, which parts are just helper functions and how it precisely ties together (e.g. both prime and dumb buffers only assume that the buffer managers has uint32_t handles, nothing else really).

Comments, flames and review highly welcome.

Cheers, Daniel

Daniel Vetter (19):
drm/doc: Clarify the dumb object interfaces drm/doc: Fix up kerneldoc in drm_edid.c
drm/doc: Clean up and integrate kerneldoc for drm_gem.c drm/doc: Remove <term> from rendernode docs drm/doc: Reorganize driver documentation
drm/doc: Move the vma offset manager to the right spot drm/doc: Remove the "command submissin and fencing" section drm/doc: No more drm perf counters
drm/doc: Document drm_helper_resume_force_mode drm/doc: Hide legacy horrors better
drm/docs: Include hdmi infoframe helper reference drm/doc: Clarify PRIME documentation
drm/doc: Add PRIME function references
drm/doc: Update copyright
drm/mm: Remove MM_UNUSED_TARGET
drm/doc: Overview documentation for drm_mm.c drm/doc: Add fucntion reference documentation for drm_mm.c drm/kms: rip out drm_mode_connector_detach_encoder drm/kms: don't export drm_mode_group_init_legacy_group

 Documentation/DocBook/drm.tmpl             | 484 +++++++++++++++++++----------
 drivers/gpu/drm/drm_crtc.c                 |  16 -
 drivers/gpu/drm/drm_crtc_helper.c          |   9 +
 drivers/gpu/drm/drm_edid.c                 |  26 +-
 drivers/gpu/drm/drm_gem.c                  |  63 +++-
 drivers/gpu/drm/drm_mm.c                   | 211 +++++++++++--
 drivers/gpu/drm/drm_prime.c                | 110 +++++--
 drivers/staging/imx-drm/imx-ldb.c          |   2 -
 drivers/staging/imx-drm/parallel-display.c |   2 -
 include/drm/drm_crtc.h                     |   2 -
 include/drm/drm_mm.h                       | 154 +++++++--
 include/linux/hdmi.h                       |  12 +
 12 files changed, 815 insertions(+), 276 deletions(-)
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH 1/19 drm/doc: Clarify the dumb object interfaces

- 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.

Cc Laurent Pinchart [email protected]>
---
 Documentation/DocBook/drm.tmpl | 125 ++++++++++++++++++++++-------------------
 1 file changed, 68 insertions(+), 57 deletions(-)
Documentation/DocBook/drm.tmpl +68 -57
index ed1d6d289022..9c3fdd59c995 100644
@@ -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
@@ -970,7 +914,9 @@ int max_width, max_height;</synopsis>
         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.
+        objects. But drivers are 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 objects.
       </para>
       <para>
         Drivers must first validate the requested frame buffer parameters passed
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 	<function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb GEM 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) 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 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 accelaration, as has been
+	attempted on some ARM embedded platforms. Such drivers really must have
+	a hardware-specific ioctl to allocate suitable objects.
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device *dev);</synopsis>
       <para>
Signature · 1 line
1.8.5.2
#2 lore raw

Re: [PATCH 01/19] drm/doc: Clarify the dumb object interfaces

Hi

Quoted 88 lines · Daniel Vetter

- 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.

Cc Laurent Pinchart [email protected]>
---
 Documentation/DocBook/drm.tmpl | 125 ++++++++++++++++++++++-------------------
 1 file changed, 68 insertions(+), 57 deletions(-)
Documentation/DocBook/drm.tmpl +0 -56
index ed1d6d289022..9c3fdd59c995 100644
@@ -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

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 919

Quoted 7 lines
Documentation/DocBook/drm.tmpl +3 -1
@@ -970,7 +914,9 @@ int max_width, max_height;</synopsis>
         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.
+        objects. But drivers are 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 objects.

Maybe remove the sentence saying "this document assumes that the driver uses GEM". I don't see where we explicitly do that. Otherwise the patch looks fine.

Thanks
David

Quoted 82 lines
Documentation/DocBook/drm.tmpl +65 -1
       </para>
       <para>
         Drivers must first validate the requested frame buffer parameters passed
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
        <function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb GEM 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) 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 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 accelaration, as has been
+       attempted on some ARM embedded platforms. Such drivers really must have
+       a hardware-specific ioctl to allocate suitable objects.
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device *dev);</synopsis>
       <para>
--

1.8.5.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Re: [PATCH 01/19] drm/doc: Clarify the dumb object interfaces

Hi David,

Quoted 26 lines · On Thursday 23 January 2014 10:14:35 David Herrmann wrote:
Quoted 25 lines · Daniel Vetter

- 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.

Cc Laurent Pinchart [email protected]>

---

 Documentation/DocBook/drm.tmpl | 125 +++++++++++++++++++-----------------
1 file changed, 68 insertions(+), 57 deletions(-)
(quoted diff) +0 -0

b/Documentation/DocBook/drm.tmpl index ed1d6d289022..9c3fdd59c995 100644

Documentation/DocBook/drm.tmpl +0 -0

[snip]

Quoted 16 lines
Quoted 8 lines
Documentation/DocBook/drm.tmpl +1 -1
@@ -970,7 +914,9 @@ int max_width, max_height;</synopsis>
 
         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.
+        objects. But drivers are free to use their own backing storage
Quoted 5 lines

object
+ handles, e.g. vmwgfx directly exposes special TTM handles to
userspace
+ and so expects TTM handles in the create ioctl and not GEM
objects.

Maybe remove the sentence saying "this document assumes that the driver uses GEM". I don't see where we explicitly do that.

We do in one place, in the documentation of the create_handle operation. We could apply the following change and replace the above sentence with

"For drivers using GEM those handles reference GEM objects. 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, not GEM object handles."

@@ -1010,8 +1010,8 @@ int max_width, max_height;</synopsis>

               reference the memory object associated with the first plane.
             </para>
             <para>
-              Drivers call <function>drm_gem_handle_create</function> to create
-              the handle.
+              GEM-aware drivers call <function>drm_gem_handle_create</function> to
+              create the handle.
             </para>
           </listitem>
           <listitem>
Quoted 1 line

Otherwise the patch looks fine.

Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

PATCH 1/1 drm/doc: Clarify the dumb object interfaces

In reply to David Herrmann

- 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.

Cc David Herrmann <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 Documentation/DocBook/drm.tmpl | 129 ++++++++++++++++++++++-------------------
 1 file changed, 70 insertions(+), 59 deletions(-)
Documentation/DocBook/drm.tmpl +70 -59
index ed1d6d289022..809bf5f7e1c6 100644
@@ -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.  But drivers are 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 objects.
       </para>
       <para>
         Drivers must first validate the requested frame buffer parameters passed
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 	<function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb GEM 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) 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 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 accelaration, as has been
+	attempted on some ARM embedded platforms. Such drivers really must have
+	a hardware-specific ioctl to allocate suitable objects.
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device *dev);</synopsis>
       <para>
Signature · 1 line
1.8.5.2
#5 lore raw

Re: [PATCH] drm/doc: Clarify the dumb object interfaces

Hi Daniel,

Thank you for the patch.

Quoted 28 lines · On Thursday 23 January 2014 13:48:17 Daniel Vetter wrote:

- 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.

Cc David Herrmann <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 Documentation/DocBook/drm.tmpl | 129 ++++++++++++++++++++------------------
1 file changed, 70 insertions(+), 59 deletions(-)
Documentation/DocBook/drm.tmpl +0 -0
index ed1d6d289022..809bf5f7e1c6 100644

[snip]

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 919

Quoted 12 lines
Documentation/DocBook/drm.tmpl +0 -0
@@ -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.

Documentation/DocBook/drm.tmpl +5 -0
+	the <parameter>drm_mode_fb_cmd2</parameter> argument. For drivers using
+	GEM as their userspace buffer management interface this would be a GEM
+	handle.  But drivers are 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 objects.

I'm not sure if the rule also applies to English, but I've always been thought not to start a sentence by "but" in French, so what about the following wording (as proposed in a previous mail that was sent too late for your v2 - you're too fast ;-)) ?

"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, not GEM handles."

(I've also replaced "GEM objects" by "GEM handles" in the last sentence)

Quoted 8 lines
       </para>
       <para>
         Drivers must first validate the requested frame buffer parameters

passed @@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>

Documentation/DocBook/drm.tmpl +1 -0
 	<function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb GEM Objects</title>

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1011

Quoted 10 lines
Documentation/DocBook/drm.tmpl +10 -0
+      <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>

Regarding the location of this section, let's continue the discussion in the mail thread of your first patch.

Quoted 57 lines
Documentation/DocBook/drm.tmpl +3 -0
+      <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.

Documentation/DocBook/drm.tmpl +10 -0
+      </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) object suitable for scanout based
on the +	    width, height and depth from the struct
Documentation/DocBook/drm.tmpl +9 -0
+	    <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>

Documentation/DocBook/drm.tmpl +2 -0
+          <para>
+            The <methodname>dumb_destroy</methodname> operation destroys a

dumb + object created by <methodname>dumb_create</methodname>. +

         </para>
Documentation/DocBook/drm.tmpl +3 -0
+        </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

Documentation/DocBook/drm.tmpl +8 -0
+            <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 accelaration, as has

been + attempted on some ARM embedded platforms. Such drivers really must
have + a hardware-specific ioctl to allocate suitable objects.

Documentation/DocBook/drm.tmpl +3 -0
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device

*dev);</synopsis> <para>

Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw

PATCH 1/1 drm/doc: Clarify the dumb object interfaces

- 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.

Cc David Herrmann <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 Documentation/DocBook/drm.tmpl | 129 ++++++++++++++++++++++-------------------
 1 file changed, 70 insertions(+), 59 deletions(-)
Documentation/DocBook/drm.tmpl +70 -59
index ed1d6d289022..767318d5ddb6 100644
@@ -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
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 	<function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb GEM 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) 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 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 accelaration, as has been
+	attempted on some ARM embedded platforms. Such drivers really must have
+	a hardware-specific ioctl to allocate suitable objects.
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device *dev);</synopsis>
       <para>
Signature · 1 line
1.8.5.2
#7 lore raw

Re: [PATCH] drm/doc: Clarify the dumb object interfaces

Hi Daniel,

Thank you for the patch.

One last round of nitpicking (including a typo fix, which gives me an excuse for a couple more comments :-)).

Quoted 31 lines · On Thursday 23 January 2014 14:50:25 Daniel Vetter wrote:

- 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.

Cc David Herrmann <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 Documentation/DocBook/drm.tmpl | 129 ++++++++++++++++++++------------------
1 file changed, 70 insertions(+), 59 deletions(-)
Documentation/DocBook/drm.tmpl +0 -0
index ed1d6d289022..767318d5ddb6 100644

[snip]

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1001

Quoted 5 lines
Documentation/DocBook/drm.tmpl +1 -0
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 	<function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb GEM Objects</title>

What about calling this "Dumb Memory Objects" (or something similar), as they're not specific to GEM ?

Quoted 30 lines
Documentation/DocBook/drm.tmpl +13 -0
+      <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

Documentation/DocBook/drm.tmpl +11 -0
+        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,

Documentation/DocBook/drm.tmpl +3 -0
+                   struct drm_mode_create_dumb *args);</synopsis>
+          <para>
+            The <methodname>dumb_create</methodname> operation creates a

driver

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1029

Quoted 1 line
Documentation/DocBook/drm.tmpl +1 -0
+	    object (GEM or TTM handle) object suitable for scanout based on the

s/object suitable/suitable/ ?

Quoted 37 lines
Documentation/DocBook/drm.tmpl +10 -0
+	    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,

Documentation/DocBook/drm.tmpl +3 -0
+                    uint32_t handle);</synopsis>
+          <para>
+            The <methodname>dumb_destroy</methodname> operation destroys a

dumb

Documentation/DocBook/drm.tmpl +5 -0
+            object created by <methodname>dumb_create</methodname>.
+          </para>
+        </listitem>
+        <listitem>
+          <synopsis>int (*dumb_map_offset)(struct drm_file *file_priv,

struct drm_device *dev,

Documentation/DocBook/drm.tmpl +3 -0
+                       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

Documentation/DocBook/drm.tmpl +9 -0
+            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 accelaration, as has

been

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1062

Quoted 2 lines
Documentation/DocBook/drm.tmpl +2 -0
+	attempted on some ARM embedded platforms. Such drivers really must have
+	a hardware-specific ioctl to allocate suitable objects.

What about s/objects/memory objects/ ? "object" alone is rather vague for people not too familiar with DRM/KMS.

Quoted 6 lines
Documentation/DocBook/drm.tmpl +3 -0
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device

*dev);</synopsis> <para>

Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

Re: [PATCH] drm/doc: Clarify the dumb object interfaces

Quoted 42 lines · Laurent Pinchart

Hi Daniel,

Thank you for the patch.

One last round of nitpicking (including a typo fix, which gives me an excuse for a couple more comments :-)).

Quoted 31 lines · On Thursday 23 January 2014 14:50:25 Daniel Vetter wrote:

- 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.

Cc David Herrmann <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 Documentation/DocBook/drm.tmpl | 129 ++++++++++++++++++++------------------
1 file changed, 70 insertions(+), 59 deletions(-)
Documentation/DocBook/drm.tmpl +0 -0
index ed1d6d289022..767318d5ddb6 100644

[snip]

Quoted 8 lines

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1001

Quoted 5 lines
Documentation/DocBook/drm.tmpl +1 -0
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 	<function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb GEM Objects</title>

What about calling this "Dumb Memory Objects" (or something similar), as they're not specific to GEM ?

I've gone through the entire section to remove all GEM-specific language and missed the title. That's some good fail right there ;-) I'm going with buffer objects, which I think is the most established language for gfx memory management - GL also uses it in specs.

[snip]

Quoted 5 lines

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1062

Quoted 2 lines
Documentation/DocBook/drm.tmpl +2 -0
+	attempted on some ARM embedded platforms. Such drivers really must have
+	a hardware-specific ioctl to allocate suitable objects.

What about s/objects/memory objects/ ? "object" alone is rather vague for people not too familiar with DRM/KMS.

Also opted for buffer object here. Other suggestions applies unchaged.

Thanks, Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#9 lore raw

PATCH 1/1 drm/doc: Clarify the dumb object interfaces

In reply to Laurent Pinchart

- 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.

Cc David Herrmann <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 Documentation/DocBook/drm.tmpl | 131 ++++++++++++++++++++++-------------------
 1 file changed, 71 insertions(+), 60 deletions(-)
Documentation/DocBook/drm.tmpl +71 -60
index ed1d6d289022..67cfe184749c 100644
@@ -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 initilization 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 accelaration, 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>
Signature · 1 line
1.8.5.2
#10 lore raw

Re: [PATCH] drm/doc: Clarify the dumb object interfaces

Am 24.01.2014 17:58, schrieb Daniel Vetter:

Just two typos ('said' my spellchecker...;-)

Regards,
Dieter

Quoted 150 lines

- 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.

Cc David Herrmann <[email protected]>
Cc Laurent Pinchart <[email protected]>
---
 Documentation/DocBook/drm.tmpl | 131 
++++++++++++++++++++++-------------------
 1 file changed, 71 insertions(+), 60 deletions(-)
Documentation/DocBook/drm.tmpl +0 -3
index ed1d6d289022..67cfe184749c 100644
@@ -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

Documentation/DocBook/drm.tmpl +0 -4
-          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

Documentation/DocBook/drm.tmpl +0 -11
-          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,

Documentation/DocBook/drm.tmpl +0 -3
-                     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

Documentation/DocBook/drm.tmpl +0 -5
-              pitch and size in bytes.
-            </para>
-          </listitem>
-          <listitem>
-            <synopsis>int (*dumb_destroy)(struct drm_file *file_priv,

struct drm_device *dev,

Documentation/DocBook/drm.tmpl +0 -3
-                      uint32_t handle);</synopsis>
-            <para>
-              The <methodname>dumb_destroy</methodname> operation

destroys a dumb
- GEM object created by
<methodname>dumb_create</methodname>.

Documentation/DocBook/drm.tmpl +0 -4
-            </para>
-          </listitem>
-          <listitem>
-            <synopsis>int (*dumb_map_offset)(struct drm_file

*file_priv, struct drm_device *dev,
- uint32_t handle, uint64_t
*offset);</synopsis>

Documentation/DocBook/drm.tmpl +0 -2
-            <para>
-              The <methodname>dumb_map_offset</methodname> operation

associates an
- mmap fake offset with the GEM object given by the
handle and returns

Documentation/DocBook/drm.tmpl +0 -2
-              it. Drivers must use the
-              <function>drm_gem_create_mmap_offset</function> function 

to

Documentation/DocBook/drm.tmpl +0 -7
-              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

Documentation/DocBook/drm.tmpl +0 -0
@@ -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

Documentation/DocBook/drm.tmpl +1 -1
-        objects.
+	the <parameter>drm_mode_fb_cmd2</parameter> argument. For drivers 

using

Documentation/DocBook/drm.tmpl +1 -0
+	GEM as their userspace buffer management interface this would be a 

GEM

Documentation/DocBook/drm.tmpl +1 -0
+	handle.  Drivers are however free to use their own backing storage 

object

Documentation/DocBook/drm.tmpl +1 -0
+	handles, e.g. vmwgfx directly exposes special TTM handles to 

userspace

Documentation/DocBook/drm.tmpl +1 -0
+	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

Documentation/DocBook/drm.tmpl +0 -1
@@ -992,7 +938,7 @@ int max_width, max_height;</synopsis>
       </para>
 
       <para>
-	The initailization of the new framebuffer instance is finalized with 

a

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 941

Quoted 1 line
Documentation/DocBook/drm.tmpl +1 -0
+	The initilization of the new framebuffer instance is finalized with a

=> initialization ;-)

Quoted 74 lines

call to <function>drm_framebuffer_init</function> which takes a
pointer

Documentation/DocBook/drm.tmpl +0 -0
 	to DRM frame buffer operations (struct
 	<structname>drm_framebuffer_funcs</structname>). Note that this 

function

Documentation/DocBook/drm.tmpl +13 -0
@@ -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

Documentation/DocBook/drm.tmpl +11 -0
+        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,

Documentation/DocBook/drm.tmpl +3 -0
+                   struct drm_mode_create_dumb *args);</synopsis>
+          <para>
+            The <methodname>dumb_create</methodname> operation creates 

a driver

Documentation/DocBook/drm.tmpl +3 -0
+	    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

Documentation/DocBook/drm.tmpl +2 -0
+	    argument's <structfield>handle</structfield>,
+	    <structfield>pitch</structfield> and 

<structfield>size</structfield>

Documentation/DocBook/drm.tmpl +6 -0
+	    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,

Documentation/DocBook/drm.tmpl +3 -0
+                    uint32_t handle);</synopsis>
+          <para>
+            The <methodname>dumb_destroy</methodname> operation 

destroys a dumb

Documentation/DocBook/drm.tmpl +5 -0
+            object created by <methodname>dumb_create</methodname>.
+          </para>
+        </listitem>
+        <listitem>
+          <synopsis>int (*dumb_map_offset)(struct drm_file

*file_priv, struct drm_device *dev,

Documentation/DocBook/drm.tmpl +3 -0
+                       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

Documentation/DocBook/drm.tmpl +2 -0
+            it. Drivers must use the
+            <function>drm_gem_create_mmap_offset</function> function 

to

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis>

Quoted 7 lines
Documentation/DocBook/drm.tmpl +7 -0
+            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 accelaration,

=> acceleration

Quoted 11 lines

as has been

Documentation/DocBook/drm.tmpl +1 -0
+	attempted on some ARM embedded platforms. Such drivers really must 

have

Documentation/DocBook/drm.tmpl +4 -0
+	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>
Acked-by on v1 1/1
#11 lore raw

Re: [PATCH] drm/doc: Clarify the dumb object interfaces

In reply to Daniel Vetter

Hi Daniel,

Thank you for the patch.

Quoted 17 lines · On Friday 24 January 2014 17:58:40 Daniel Vetter wrote:

- 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.

Quoted 8 lines

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.

Cc David Herrmann <[email protected]>
Cc Laurent Pinchart <[email protected]>
Quoted 168 lines
---
 Documentation/DocBook/drm.tmpl | 131 ++++++++++++++++++++------------------
1 file changed, 71 insertions(+), 60 deletions(-)
Documentation/DocBook/drm.tmpl +0 -3
index ed1d6d289022..67cfe184749c 100644
@@ -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.

Documentation/DocBook/drm.tmpl +0 -3
-        </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.

Documentation/DocBook/drm.tmpl +0 -10
-        </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

Documentation/DocBook/drm.tmpl +0 -5
-              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>

Documentation/DocBook/drm.tmpl +0 -2
-            <para>
-              The <methodname>dumb_destroy</methodname> operation destroys

a dumb - GEM object created by
<methodname>dumb_create</methodname>. - </para>

Documentation/DocBook/drm.tmpl +0 -3
-          </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

Documentation/DocBook/drm.tmpl +0 -8
-              <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.

Documentation/DocBook/drm.tmpl +5 -0
+	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>
Documentation/DocBook/drm.tmpl +15 -1
-	The initailization of the new framebuffer instance is finalized with a
+	The initilization 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.

Documentation/DocBook/drm.tmpl +10 -0
+      </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

Documentation/DocBook/drm.tmpl +10 -0
+	    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>

Documentation/DocBook/drm.tmpl +2 -0
+          <para>
+            The <methodname>dumb_destroy</methodname> operation destroys a

dumb + object created by <methodname>dumb_create</methodname>. +

         </para>
Documentation/DocBook/drm.tmpl +3 -0
+        </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

Documentation/DocBook/drm.tmpl +8 -0
+            <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 accelaration, as has

been + attempted on some ARM embedded platforms. Such drivers really must
have + a hardware-specific ioctl to allocate suitable buffer objects.

Documentation/DocBook/drm.tmpl +3 -0
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device

*dev);</synopsis> <para>

Signature · 3 lines
Regards,

Laurent Pinchart
#12 lore raw

Re: [PATCH 01/19] drm/doc: Clarify the dumb object interfaces

In reply to Daniel Vetter

Hi Daniel,

Thank you for the patch.

Quoted 95 lines · On Thursday 23 January 2014 09:52:26 Daniel Vetter wrote:

- 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.

Cc Laurent Pinchart [email protected]>
---
 Documentation/DocBook/drm.tmpl | 125 ++++++++++++++++++++------------------
1 file changed, 68 insertions(+), 57 deletions(-)
Documentation/DocBook/drm.tmpl +0 -3
index ed1d6d289022..9c3fdd59c995 100644
@@ -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.

Documentation/DocBook/drm.tmpl +0 -3
-        </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.

Documentation/DocBook/drm.tmpl +0 -10
-        </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

Documentation/DocBook/drm.tmpl +0 -5
-              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>

Documentation/DocBook/drm.tmpl +0 -2
-            <para>
-              The <methodname>dumb_destroy</methodname> operation destroys

a dumb - GEM object created by
<methodname>dumb_create</methodname>. - </para>

Documentation/DocBook/drm.tmpl +0 -3
-          </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

Documentation/DocBook/drm.tmpl +0 -8
-              <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 @@ -970,7 +914,9 @@ int max_width, max_height;</synopsis>
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.
+ objects. But drivers are free to use their own backing storage
object

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 919

Quoted 2 lines
Documentation/DocBook/drm.tmpl +2 -0
+	handles, e.g. vmwgfx directly exposes special TTM handles to userspace
+	and so expects TTM handles in the create ioctl and not GEM objects.

Nitpicking, I would say

"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, not GEM objects."

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1003

Quoted 9 lines

<para>
Drivers must first validate the requested frame buffer parameters
passed @@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>

Documentation/DocBook/drm.tmpl +3 -0
 	<function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb GEM Objects</title>
+      <para>
+	The KMS API doesn't standardize backing storage object creation and

Strictly speaking isn't it the DRM API that's responsible for memory management, not the KMS API ?

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1011

Quoted 8 lines
Documentation/DocBook/drm.tmpl +8 -0
+	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>

This feels a bit out of place, can't we leave the section where it was ?

Quoted 57 lines
Documentation/DocBook/drm.tmpl +3 -0
+      <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.

Documentation/DocBook/drm.tmpl +10 -0
+      </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) object suitable for scanout based
on the +	    width, height and depth from the struct
Documentation/DocBook/drm.tmpl +9 -0
+	    <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>

Documentation/DocBook/drm.tmpl +2 -0
+          <para>
+            The <methodname>dumb_destroy</methodname> operation destroys a

dumb + object created by <methodname>dumb_create</methodname>. +

         </para>
Documentation/DocBook/drm.tmpl +3 -0
+        </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

Documentation/DocBook/drm.tmpl +8 -0
+            <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 accelaration, as has

been + attempted on some ARM embedded platforms. Such drivers really must
have + a hardware-specific ioctl to allocate suitable objects.

Documentation/DocBook/drm.tmpl +3 -0
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device

*dev);</synopsis> <para>

Signature · 3 lines
Regards,

Laurent Pinchart
#13 lore raw

Re: [PATCH 01/19] drm/doc: Clarify the dumb object interfaces

Quoted 105 lines · Laurent Pinchart

Hi Daniel,

Thank you for the patch.

Quoted 95 lines · On Thursday 23 January 2014 09:52:26 Daniel Vetter wrote:

- 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.

Cc Laurent Pinchart [email protected]>
---
 Documentation/DocBook/drm.tmpl | 125 ++++++++++++++++++++------------------
1 file changed, 68 insertions(+), 57 deletions(-)
Documentation/DocBook/drm.tmpl +0 -3
index ed1d6d289022..9c3fdd59c995 100644
@@ -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.

Documentation/DocBook/drm.tmpl +0 -3
-        </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.

Documentation/DocBook/drm.tmpl +0 -10
-        </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

Documentation/DocBook/drm.tmpl +0 -5
-              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>

Documentation/DocBook/drm.tmpl +0 -2
-            <para>
-              The <methodname>dumb_destroy</methodname> operation destroys

a dumb - GEM object created by
<methodname>dumb_create</methodname>. - </para>

Documentation/DocBook/drm.tmpl +0 -3
-          </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

Documentation/DocBook/drm.tmpl +0 -8
-              <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 @@ -970,7 +914,9 @@ int max_width, max_height;</synopsis>
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.
+ objects. But drivers are free to use their own backing storage
object

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 919

Quoted 2 lines
Documentation/DocBook/drm.tmpl +2 -0
+	handles, e.g. vmwgfx directly exposes special TTM handles to userspace
+	and so expects TTM handles in the create ioctl and not GEM objects.

Nitpicking, I would say

Quoted 3 lines

"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, not GEM objects."

I've already adjusted this a bit but haven't yet sent out the new version of the patch. Slightly different wording now.

Quoted 4 lines
Quoted 4 lines

<para>
Drivers must first validate the requested frame buffer parameters
passed @@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
<function>drm_framebuffer_unregister_private</function>.

Quoted 8 lines

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1003

Quoted 5 lines
     </sect2>
     <sect2>
Documentation/DocBook/drm.tmpl +3 -0
+      <title>Dumb GEM Objects</title>
+      <para>
+	The KMS API doesn't standardize backing storage object creation and

Strictly speaking isn't it the DRM API that's responsible for memory management, not the KMS API ?

The driver's private api is responsible for memory management, but the crucial thing here is that the KMS ioctls don't mandate anything specific (beyong that it needs to use uint32_t for handles).

Quoted 10 lines

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1011

Quoted 8 lines
Documentation/DocBook/drm.tmpl +8 -0
+	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>

This feels a bit out of place, can't we leave the section where it was ?

Imo the justification for why we have the dumb ioctls should be here. And I wanted to mention both that KMS doesn't mandate a particular bo interface like GEM and that on top GEM wouldn't even provide a common allocation function anyway.

But besides that I think there's some room for improvement in the GEM section to clarify what is the actual core interfaces, what is more helper library in nature and what in GEM is more just a common design pattern for driver ioctls but not specified in a mandatory way anywhere. E.g. atm all drivers which implement a GEM interface (radeon, i915, ...) have a mostly implicitly synchronizing buffer access interface, but there's nothing in GEM mandating this. Or the usual confusing between TTM directly exposed to userspace and TTM hidden behind a GEM-based ioctl interface. -Daniel

Quoted 64 lines
Quoted 58 lines
Documentation/DocBook/drm.tmpl +3 -0
+      <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.

Documentation/DocBook/drm.tmpl +10 -0
+      </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) object suitable for scanout based
on the +	    width, height and depth from the struct
Documentation/DocBook/drm.tmpl +9 -0
+	    <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>

Documentation/DocBook/drm.tmpl +2 -0
+          <para>
+            The <methodname>dumb_destroy</methodname> operation destroys a

dumb + object created by <methodname>dumb_create</methodname>. +

         </para>
Documentation/DocBook/drm.tmpl +3 -0
+        </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

Documentation/DocBook/drm.tmpl +8 -0
+            <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 accelaration, as has

been + attempted on some ARM embedded platforms. Such drivers really must
have + a hardware-specific ioctl to allocate suitable objects.

Documentation/DocBook/drm.tmpl +3 -0
+      </para>
+    </sect2>
+    <sect2>
       <title>Output Polling</title>
       <synopsis>void (*output_poll_changed)(struct drm_device

*dev);</synopsis> <para>

Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#14 lore raw

Re: [PATCH 01/19] drm/doc: Clarify the dumb object interfaces

Hi Daniel,

Quoted 28 lines · On Thursday 23 January 2014 13:47:31 Daniel Vetter wrote:
Quoted 27 lines · Laurent Pinchart
Quoted 26 lines · On Thursday 23 January 2014 09:52:26 Daniel Vetter wrote:

- 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.

Cc Laurent Pinchart [email protected]>

---

 Documentation/DocBook/drm.tmpl | 125 ++++++++++++++++++----------------
 1 file changed, 68 insertions(+), 57 deletions(-)
(quoted diff) +0 -0

b/Documentation/DocBook/drm.tmpl index ed1d6d289022..9c3fdd59c995 100644

Documentation/DocBook/drm.tmpl +0 -0

[snip]

Quoted 14 lines
Quoted 14 lines

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 919

Quoted 11 lines

pages @@ -970,7 +914,9 @@ int max_width, max_height;</synopsis>
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

Documentation/DocBook/drm.tmpl +1 -1
-        objects.
+        objects. But drivers are free to use their own backing storage

object

Documentation/DocBook/drm.tmpl +1 -0
+	handles, e.g. vmwgfx directly exposes special TTM handles to

userspace

Documentation/DocBook/drm.tmpl +1 -0
+	and so expects TTM handles in the create ioctl and not GEM objects.

Nitpicking, I would say

Quoted 6 lines
Quoted 3 lines

"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, not GEM objects."

I've already adjusted this a bit but haven't yet sent out the new version of the patch. Slightly different wording now.

OK. Please also see my reply to David.

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines

<para>
Drivers must first validate the requested frame buffer parameters passed

Documentation/DocBook/drm.tmpl +0 -0
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 	<function>drm_framebuffer_unregister_private</function>.
Quoted 8 lines

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1003

Quoted 5 lines
Documentation/DocBook/drm.tmpl +3 -0
     </sect2>
     <sect2>
+      <title>Dumb GEM Objects</title>
+      <para>
+	The KMS API doesn't standardize backing storage object creation and

Strictly speaking isn't it the DRM API that's responsible for memory management, not the KMS API ?

Quoted 3 lines

The driver's private api is responsible for memory management, but the crucial thing here is that the KMS ioctls don't mandate anything specific (beyong that it needs to use uint32_t for handles).

Sure, but my point was that I believe memory management is the responsibility of DRM, not KMS. It of course needs to be driver-specific.

Quoted 11 lines
Quoted 10 lines

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1011

Quoted 8 lines
Documentation/DocBook/drm.tmpl +8 -0
+	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>

This feels a bit out of place, can't we leave the section where it was ?

Quoted 4 lines

Imo the justification for why we have the dumb ioctls should be here. And I wanted to mention both that KMS doesn't mandate a particular bo interface like GEM and that on top GEM wouldn't even provide a common allocation function anyway.

I agree that a justification here is a good idea, but I would just add one paragraph that references the dumb GEM objects section instead of scattering GEM documentation around.

Quoted 8 lines

But besides that I think there's some room for improvement in the GEM section to clarify what is the actual core interfaces, what is more helper library in nature and what in GEM is more just a common design pattern for driver ioctls but not specified in a mandatory way anywhere. E.g. atm all drivers which implement a GEM interface (radeon, i915, ...) have a mostly implicitly synchronizing buffer access interface, but there's nothing in GEM mandating this. Or the usual confusing between TTM directly exposed to userspace and TTM hidden behind a GEM-based ioctl interface.

I agree, the GEM section should be improved, and TTM documentation would be nice as well. I'm lacking time though (as well as knowledge about TTM).

Signature · 3 lines
Regards,

Laurent Pinchart
#15 lore raw

Re: [PATCH 01/19] drm/doc: Clarify the dumb object interfaces

Quoted 14 lines · Laurent Pinchart
Quoted 14 lines
Quoted 13 lines

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1003

Quoted 10 lines

<para>
Drivers must first validate the requested frame buffer parameters passed

Documentation/DocBook/drm.tmpl +3 -0
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 	<function>drm_framebuffer_unregister_private</function>.
     </sect2>
     <sect2>
+      <title>Dumb GEM Objects</title>
+      <para>
+	The KMS API doesn't standardize backing storage object creation and

Strictly speaking isn't it the DRM API that's responsible for memory management, not the KMS API ?

Quoted 6 lines
Quoted 3 lines

The driver's private api is responsible for memory management, but the crucial thing here is that the KMS ioctls don't mandate anything specific (beyong that it needs to use uint32_t for handles).

Sure, but my point was that I believe memory management is the responsibility of DRM, not KMS. It of course needs to be driver-specific.

Well imo the dumb ioctls are part of kms. DRM itself doesn't have any memory management interfaces (at least if you ignore all the horror stories around legacy ums/dri1 drivers). My reasons are:
- If you implement a kms driver you really should implement the dumb interfaces. Even when you have almost no memory management like the simpledrm driver.
- If you have a driver with memory management and command submission but no KMS, there's no reason at all to implement the dumb interfaces.
- ARM people abused dumb buffers for accelaration "because it worked", so imo moving it's documentation as far away as possible from the memory management section is a feature.

So the dumb stuff is a KMS interface to abstract away the lowest common denominator between all kms drivers. Actually memory manament needs a real interface, and is obviously separate.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

Documentation/DocBook/drm.tmpl int max_width, max_height;</synopsis> · line 1011

Quoted 8 lines
Documentation/DocBook/drm.tmpl +8 -0
+	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>

This feels a bit out of place, can't we leave the section where it was ?

Quoted 8 lines
Quoted 4 lines

Imo the justification for why we have the dumb ioctls should be here. And I wanted to mention both that KMS doesn't mandate a particular bo interface like GEM and that on top GEM wouldn't even provide a common allocation function anyway.

I agree that a justification here is a good idea, but I would just add one paragraph that references the dumb GEM objects section instead of scattering GEM documentation around.

I've pretty much removed all mention of dumb gem objects ;-) There's one mention of dumb_create left in the GEM/memory management section, but that one is just an example for the lifetime and reference counting rules. So not relevant.

Quoted 10 lines
Quoted 9 lines

But besides that I think there's some room for improvement in the GEM section to clarify what is the actual core interfaces, what is more helper library in nature and what in GEM is more just a common design pattern for driver ioctls but not specified in a mandatory way anywhere. E.g. atm all drivers which implement a GEM interface (radeon, i915, ...) have a mostly implicitly synchronizing buffer access interface, but there's nothing in GEM mandating this. Or the usual confusing between TTM directly exposed to userspace and TTM hidden behind a GEM-based ioctl interface.

Quoted 2 lines

I agree, the GEM section should be improved, and TTM documentation would be nice as well. I'm lacking time though (as well as knowledge about TTM).

I have a few ideas, but I think I'll postpone this until I get around to documenting the i915 GEM code a bit. Having a concrete driver to talk about should help greatly to separate common concepts from artifacts of the i915 implementation. I guess that review will also lead to some abi cleanups to remove i915-ism from core gem.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#16 lore raw

Re: [PATCH 01/19] drm/doc: Clarify the dumb object interfaces

Hi Daniel,

Quoted 40 lines · On Thursday 23 January 2014 14:46:40 Daniel Vetter wrote:
Quoted 20 lines · Laurent Pinchart
Quoted 20 lines
Quoted 19 lines
Quoted 15 lines

<para>

Drivers must first validate the requested frame buffer parameters passed

(quoted diff) +3 -0
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 
 	<function>drm_framebuffer_unregister_private</function>.
 
     </sect2>
     <sect2>
 
+      <title>Dumb GEM Objects</title>
+      <para>
+	The KMS API doesn't standardize backing storage object creation
Quoted 1 line

and

Strictly speaking isn't it the DRM API that's responsible for memory management, not the KMS API ?

Quoted 6 lines
Quoted 3 lines

The driver's private api is responsible for memory management, but the crucial thing here is that the KMS ioctls don't mandate anything specific (beyong that it needs to use uint32_t for handles).

Sure, but my point was that I believe memory management is the responsibility of DRM, not KMS. It of course needs to be driver-specific.

Well imo the dumb ioctls are part of kms. DRM itself doesn't have any memory management interfaces (at least if you ignore all the horror stories around legacy ums/dri1 drivers). My reasons are:
- If you implement a kms driver you really should implement the dumb interfaces. Even when you have almost no memory management like the simpledrm driver.
- If you have a driver with memory management and command submission but no KMS, there's no reason at all to implement the dumb interfaces.
- ARM people abused dumb buffers for accelaration "because it worked", so imo moving it's documentation as far away as possible from the memory management section is a feature.

Quoted 3 lines

So the dumb stuff is a KMS interface to abstract away the lowest common denominator between all kms drivers. Actually memory manament needs a real interface, and is obviously separate.

OK. Those ioctls are not available on render nodes, which I suppose is another sign that they're KMS ioctls.

What about the device-specific memory allocation ioctls though ? Are they considered part of DRM or KMS ?

Quoted 22 lines
Quoted 22 lines
Quoted 21 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +1 -0
+	leaves it to driver-specific ioctls. Furthermore actually

creating a

(quoted diff) +2 -0
+	buffer object even for GEM-based drivers is done through a
+	driver-specific ioctl - GEM only has a common userspace

interface for

(quoted diff) +1 -0
+	sharing and destroying objects. While not an issue for

full-fledged

(quoted diff) +1 -0
+	graphics stacks that include device-specific userspace
Quoted 8 lines

Review

Quoted 5 lines

components (in

(quoted diff) +1 -0
+	libdrm for instance), this limit makes DRM-based early boot

graphics

(quoted diff) +2 -0
+	unnecessarily complex.
+      </para>

This feels a bit out of place, can't we leave the section where it was ?

Imo the justification for why we have the dumb ioctls should be here. And I wanted to mention both that KMS doesn't mandate a particular bo interface like GEM and that on top GEM wouldn't even provide a common allocation function anyway.

Quoted 8 lines
Quoted 3 lines

I agree that a justification here is a good idea, but I would just add one paragraph that references the dumb GEM objects section instead of scattering GEM documentation around.

I've pretty much removed all mention of dumb gem objects ;-) There's one mention of dumb_create left in the GEM/memory management section, but that one is just an example for the lifetime and reference counting rules. So not relevant.

Fair enough. I'm fine with that.

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines

But besides that I think there's some room for improvement in the GEM section to clarify what is the actual core interfaces, what is more helper library in nature and what in GEM is more just a common design pattern for driver ioctls but not specified in a mandatory way anywhere. E.g. atm all drivers which implement a GEM interface (radeon, i915, ...) have a mostly implicitly synchronizing buffer access interface, but there's nothing in GEM mandating this. Or the usual confusing between TTM directly exposed to userspace and TTM hidden behind a GEM-based ioctl interface.

Quoted 8 lines
Quoted 2 lines

I agree, the GEM section should be improved, and TTM documentation would be nice as well. I'm lacking time though (as well as knowledge about TTM).

I have a few ideas, but I think I'll postpone this until I get around to documenting the i915 GEM code a bit. Having a concrete driver to talk about should help greatly to separate common concepts from artifacts of the i915 implementation. I guess that review will also lead to some abi cleanups to remove i915-ism from core gem.

Soudns good to me.

BTW, while you're at it, could you squash this typo fix in ?

Documentation/DocBook/drm.tmpl +1 -1
index ed1d6d2..1e6579f 100644
@@ -992,7 +992,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

Signature · 3 lines
Regards,

Laurent Pinchart
#17 lore raw

Re: [PATCH 01/19] drm/doc: Clarify the dumb object interfaces

Quoted 47 lines · Laurent Pinchart

Hi Daniel,

Quoted 40 lines · On Thursday 23 January 2014 14:46:40 Daniel Vetter wrote:
Quoted 20 lines · Laurent Pinchart
Quoted 20 lines
Quoted 19 lines
Quoted 15 lines

<para>

Drivers must first validate the requested frame buffer parameters passed

(quoted diff) +3 -0
@@ -1052,6 +998,71 @@ int max_width, max_height;</synopsis>
 
 	<function>drm_framebuffer_unregister_private</function>.
 
     </sect2>
     <sect2>
 
+      <title>Dumb GEM Objects</title>
+      <para>
+	The KMS API doesn't standardize backing storage object creation
Quoted 1 line

and

Strictly speaking isn't it the DRM API that's responsible for memory management, not the KMS API ?

Quoted 6 lines
Quoted 3 lines

The driver's private api is responsible for memory management, but the crucial thing here is that the KMS ioctls don't mandate anything specific (beyong that it needs to use uint32_t for handles).

Sure, but my point was that I believe memory management is the responsibility of DRM, not KMS. It of course needs to be driver-specific.

Well imo the dumb ioctls are part of kms. DRM itself doesn't have any memory management interfaces (at least if you ignore all the horror stories around legacy ums/dri1 drivers). My reasons are:
- If you implement a kms driver you really should implement the dumb interfaces. Even when you have almost no memory management like the simpledrm driver.
- If you have a driver with memory management and command submission but no KMS, there's no reason at all to implement the dumb interfaces.
- ARM people abused dumb buffers for accelaration "because it worked", so imo moving it's documentation as far away as possible from the memory management section is a feature.

Quoted 3 lines

So the dumb stuff is a KMS interface to abstract away the lowest common denominator between all kms drivers. Actually memory manament needs a real interface, and is obviously separate.

Quoted 5 lines

OK. Those ioctls are not available on render nodes, which I suppose is another sign that they're KMS ioctls.

What about the device-specific memory allocation ioctls though ? Are they considered part of DRM or KMS ?

DRM is everything, so I'd add it to the driver-specific GEM section of the documentation. Like I've said in another mail in this thread, there's some room in the GEM docs to untangle core interfaces from driver-specific interfaces (but often done in a similar way as established best practice). But right now I'm mostly going through the modesetting stuff, also since that's the part I want to start with for i915.

[snip]

Quoted 1 line

BTW, while you're at it, could you squash this typo fix in ?

Applied, thanks for spotting this typo.
-Daniel

Quoted 22 lines
Documentation/DocBook/drm.tmpl +1 -1
index ed1d6d2..1e6579f 100644
@@ -992,7 +992,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

Signature · 3 lines
Regards,

Laurent Pinchart
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#18 lore raw

PATCH 2/19 drm/doc: Fix up kerneldoc in drm_edid.c

In reply to Daniel Vetter

v2: Also do s/RETURNS/Returns/, less yelling in docs is always good.

---
 drivers/gpu/drm/drm_edid.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_edid.c +19 -7
index b924306b8477..2d54e460c95b 100644
@@ -1098,10 +1098,14 @@ EXPORT_SYMBOL(drm_edid_is_valid);
 /**
  * Get EDID information via I2C.
  *
- * \param adapter : i2c device adaptor
- * \param buf     : EDID data buffer to be filled
- * \param len     : EDID data buffer length
- * \return 0 on success or -1 on failure.
+ * @adapter : i2c device adaptor
+ * @buf: EDID data buffer to be filled
+ * @block: 128 byte EDID block to start fetching from
+ * @len: EDID data buffer length to fetch
+ *
+ * Returns:
+ *
+ * 0 on success or -1 on failure.
  *
  * Try to fetch EDID information by calling i2c driver function.
  */
@@ -1243,9 +1247,11 @@ out:
 
 /**
  * Probe DDC presence.
+ * @adapter: i2c adapter to probe
+ *
+ * Returns:
  *
- * \param adapter : i2c device adaptor
- * \return 1 on success
+ * 1 on success
  */
 bool
 drm_probe_ddc(struct i2c_adapter *adapter)
@@ -1586,8 +1592,10 @@ bad_std_timing(u8 a, u8 b)
 
 /**
  * drm_mode_std - convert standard mode info (width, height, refresh) into mode
+ * @connector: connector of for the EDID block
+ * @edid: EDID block to scan
  * @t: standard timing params
- * @timing_level: standard timing level
+ * @revision: standard timing level
  *
  * Take the standard timing params (in this case width, aspect, and refresh)
  * and convert them into a real mode using CVT/GTF/DMT.
@@ -2132,6 +2140,7 @@ do_established_modes(struct detailed_timing *timing, void *c)
 
 /**
  * add_established_modes - get est. modes from EDID and add them
+ * @connector: connector of for the EDID block
  * @edid: EDID block to scan
  *
  * Each EDID block contains a bitmap of the supported "established modes" list
@@ -2194,6 +2203,7 @@ do_standard_modes(struct detailed_timing *timing, void *c)
 
 /**
  * add_standard_modes - get std. modes from EDID and add them
+ * @connector: connector of for the EDID block
  * @edid: EDID block to scan
  *
  * Standard modes can be calculated using the appropriate standard (DMT,
@@ -3300,6 +3310,7 @@ EXPORT_SYMBOL(drm_detect_hdmi_monitor);
 
 /**
  * drm_detect_monitor_audio - check monitor audio capability
+ * @edid: EDID block to scan
  *
  * Monitor should have CEA extension block.
  * If monitor has 'basic audio', but no CEA audio blocks, it's 'basic
@@ -3345,6 +3356,7 @@ EXPORT_SYMBOL(drm_detect_monitor_audio);
 
 /**
  * drm_rgb_quant_range_selectable - is RGB quantization range selectable?
+ * @edid: EDID block to scan
  *
  * Check whether the monitor reports the RGB quantization range selection
  * as supported. The AVI infoframe can then be used to inform the monitor
Signature · 1 line
1.8.5.2
#19 lore raw

PATCH 3/19 drm/doc: Clean up and integrate kerneldoc for drm_gem.c

In reply to Daniel Vetter

Fairly incomplete, but at least a start.

---
 Documentation/DocBook/drm.tmpl |  6 +++-
 drivers/gpu/drm/drm_gem.c      | 63 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 64 insertions(+), 5 deletions(-)
Documentation/DocBook/drm.tmpl +5 -1
index 9c3fdd59c995..0660bae6928f 100644
@@ -868,7 +868,11 @@ char *date;</synopsis>
           abstracted from the client in libdrm.
         </para>
       </sect3>
-    </sect2>
+      <sect2>
+        <title>GEM Function Reference</title>
+!Edrivers/gpu/drm/drm_gem.c
+      </sect2>
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_gem.c +59 -4

154 lines not on this page · raw message

Signature · 1 line
1.8.5.2
#20 lore raw

Re: [PATCH 03/19] drm/doc: Clean up and integrate kerneldoc for drm_gem.c

Hi

Quoted 189 lines · Daniel Vetter

Fairly incomplete, but at least a start.

---
 Documentation/DocBook/drm.tmpl |  6 +++-
 drivers/gpu/drm/drm_gem.c      | 63 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 64 insertions(+), 5 deletions(-)
Documentation/DocBook/drm.tmpl +5 -1
index 9c3fdd59c995..0660bae6928f 100644
@@ -868,7 +868,11 @@ char *date;</synopsis>
           abstracted from the client in libdrm.
         </para>
       </sect3>
-    </sect2>
+      <sect2>
+        <title>GEM Function Reference</title>
+!Edrivers/gpu/drm/drm_gem.c
+      </sect2>
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_gem.c +56 -4
index 5bbad873c798..2136052ccee1 100644
@@ -85,9 +85,9 @@
 #endif
 
 /**
- * Initialize the GEM device fields
+ * drm_gem_init - Initialize the GEM device fields
+ * @dev: drm_devic structure to initialize
  */
-
 int
 drm_gem_init(struct drm_device *dev)
 {
@@ -120,6 +120,11 @@ drm_gem_destroy(struct drm_device *dev)
 }
 
 /**
+ * drm_gem_object_init - initialize an allocated shmem-backed GEM object
+ * @dev: drm_device the object should be initialized for
+ * @obj: drm_gem_object to initialize
+ * @size: object size
+ *
  * Initialize an already allocated GEM object of the specified size with
  * shmfs backing store.
  */
@@ -141,6 +146,11 @@ int drm_gem_object_init(struct drm_device *dev,
 EXPORT_SYMBOL(drm_gem_object_init);
 
 /**
+ * drm_gem_object_init - initialize an allocated private GEM object
+ * @dev: drm_device the object should be initialized for
+ * @obj: drm_gem_object to initialize
+ * @size: object size
+ *
  * Initialize an already allocated GEM object of the specified size with
  * no GEM provided backing store. Instead the caller is responsible for
  * backing the object and handling it.
@@ -176,6 +186,9 @@ drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp)
 }
 
 /**
+ * drm_gem_object_free - release resources bound to userspace handles
+ * @obj: GEM object to clean up.
+ *
  * Called after the last handle to the object has been closed
  *
  * Removes any name for the object. Note that this must be
@@ -225,7 +238,12 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
 }
 
 /**
- * Removes the mapping from handle to filp for this object.
+ * drm_gem_handle_delete - deletes the given file-private handle
+ * @filp: drm file-private structure to use for the handle look up
+ * @handle: userspace handle to delete
+ *
+ * Removes the GEM handle from the @filp lookup table and if this is the last
+ * handle also cleans up linked resources like GEM names.
  */
 int
 drm_gem_handle_delete(struct drm_file *filp, u32 handle)
@@ -270,6 +288,9 @@ EXPORT_SYMBOL(drm_gem_handle_delete);
 
 /**
  * drm_gem_dumb_destroy - dumb fb callback helper for gem based drivers
+ * @file: drm file-private structure to remove the dumb handle from
+ * @dev: corresponding drm_device
+ * @handle: the dumb handle to remove
  *
  * This implements the ->dumb_destroy kms driver callback for drivers which use
  * gem to manage their backing storage.
@@ -284,6 +305,9 @@ EXPORT_SYMBOL(drm_gem_dumb_destroy);
 
 /**
  * drm_gem_handle_create_tail - internal functions to create a handle
+ * @file_priv: drm file-private structure to register the handle for
+ * @obj: object to register
+ * @handlep: pionter to return the created handle to the caller
  *
  * This expects the dev->object_name_lock to be held already and will drop it
  * before returning. Used to avoid races in establishing new handles when
@@ -336,6 +360,11 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,
 }
 
 /**
+ * gem_handle_create - create a gem handle for an object
+ * @file_priv: drm file-private structure to register the handle for
+ * @obj: object to register
+ * @handlep: pionter to return the created handle to the caller
+ *
  * Create a handle for this object. This adds a handle reference
  * to the object, which includes a regular reference count. Callers
  * will likely want to dereference the object afterwards.
@@ -536,6 +565,11 @@ drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp,
 EXPORT_SYMBOL(drm_gem_object_lookup);
 
 /**
+ * drm_gem_close_ioctl - implementation of the GEM_CLOSE ioctl
+ * @dev: drm_device
+ * @data: ioctl data
+ * @file_priv: drm file-private structure
+ *
  * Releases the handle to an mm object.
  */
 int
@@ -554,6 +588,11 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,
 }
 
 /**
+ * drm_gem_flink_ioctl - implementation of the GEM_FLINK ioctl
+ * @dev: drm_device
+ * @data: ioctl data
+ * @file_priv: drm file-private structure
+ *
  * Create a global name for an object, returning the name.
  *
  * Note that the name does not hold a reference; when the object
@@ -601,6 +640,11 @@ err:
 }
 
 /**
+ * drm_gem_open - implementation of the GEM_OPEN ioctl
+ * @dev: drm_device
+ * @data: ioctl data
+ * @file_priv: drm file-private structure
+ *
  * Open an object using the global name, returning a handle and the size.
  *
  * This handle (of course) holds a reference to the object, so the object
@@ -640,6 +684,10 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
 }
 
 /**
+ * gem_gem_open - initalizes GEM file-private structures at devnode open time
+ * @dev: drm_device which is being opened by userspace
+ * @file_private: drm file-private structure to set up
+ *
  * Called at device open time, sets up the structure for handling refcounting
  * of mm objects.
  */
@@ -650,7 +698,7 @@ drm_gem_open(struct drm_device *dev, struct drm_file *file_private)
        spin_lock_init(&file_private->table_lock);
 }
 
-/**
+/*
  * Called at device close to release the file's
  * handle references on objects.
  */
@@ -674,6 +722,10 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
 }
 
 /**
+ * drm_gem_release - release file-private GEM resources
+ * @dev: drm_device which is being closed by userspace
+ * @file_private: drm file-private structure to clean up
+ *
  * Called at close time when the filp is going away.
  *
  * Releases any remaining references on objects by this filp.

drivers/gpu/drm/drm_gem.c drm_gem_object_release(struct drm_gem_object *obj) · line 749

Quoted 1 line
drivers/gpu/drm/drm_gem.c +0 -0
@@ -697,6 +749,9 @@ drm_gem_object_release(struct drm_gem_object *obj)
 EXPORT_SYMBOL(drm_gem_object_release);

drm_gem_object_release() is still missing. Lets at least add a kernel-doc entry ala:

/**
* drm_gem_object_release() - destroy GEM object
* @obj: drm-object to release
*
* This is the counter-part to drm_gem_object_init() and
drm_gem_private_object_init() and
* must be called by a driver in its gem_free_object() callback to
release any gem-internal
* resources of the GEM-bo.
*/

drivers/gpu/drm/drm_gem.c drm_gem_object_release(struct drm_gem_object *obj) · line 757

Quoted 8 lines
drivers/gpu/drm/drm_gem.c +3 -0
 /**
+ * drm_gem_object_free - free a GEM object
+ * @kref: kref of the object to free
+ *
  * Called after the last reference to the object has been lost.
  * Must be called holding struct_ mutex
  *

drm_gem_object_free() is internal to drm_gem.c. We only export it because our object_unreference() helper is "static inline" in the header. I don't think we should include this in the kernel-doc. No-one should call this directly (same drm_gem_object_release_handle()).

Thanks
David

Quoted 7 lines
drivers/gpu/drm/drm_gem.c +0 -1
--

1.8.5.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#21 lore raw

Re: [PATCH 03/19] drm/doc: Clean up and integrate kerneldoc for drm_gem.c

Quoted 217 lines · David Herrmann

Hi

Quoted 189 lines · Daniel Vetter

Fairly incomplete, but at least a start.

---
 Documentation/DocBook/drm.tmpl |  6 +++-
 drivers/gpu/drm/drm_gem.c      | 63 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 64 insertions(+), 5 deletions(-)
Documentation/DocBook/drm.tmpl +5 -1
index 9c3fdd59c995..0660bae6928f 100644
@@ -868,7 +868,11 @@ char *date;</synopsis>
           abstracted from the client in libdrm.
         </para>
       </sect3>
-    </sect2>
+      <sect2>
+        <title>GEM Function Reference</title>
+!Edrivers/gpu/drm/drm_gem.c
+      </sect2>
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_gem.c +56 -4
index 5bbad873c798..2136052ccee1 100644
@@ -85,9 +85,9 @@
 #endif
 
 /**
- * Initialize the GEM device fields
+ * drm_gem_init - Initialize the GEM device fields
+ * @dev: drm_devic structure to initialize
  */
-
 int
 drm_gem_init(struct drm_device *dev)
 {
@@ -120,6 +120,11 @@ drm_gem_destroy(struct drm_device *dev)
 }
 
 /**
+ * drm_gem_object_init - initialize an allocated shmem-backed GEM object
+ * @dev: drm_device the object should be initialized for
+ * @obj: drm_gem_object to initialize
+ * @size: object size
+ *
  * Initialize an already allocated GEM object of the specified size with
  * shmfs backing store.
  */
@@ -141,6 +146,11 @@ int drm_gem_object_init(struct drm_device *dev,
 EXPORT_SYMBOL(drm_gem_object_init);
 
 /**
+ * drm_gem_object_init - initialize an allocated private GEM object
+ * @dev: drm_device the object should be initialized for
+ * @obj: drm_gem_object to initialize
+ * @size: object size
+ *
  * Initialize an already allocated GEM object of the specified size with
  * no GEM provided backing store. Instead the caller is responsible for
  * backing the object and handling it.
@@ -176,6 +186,9 @@ drm_gem_remove_prime_handles(struct drm_gem_object *obj, struct drm_file *filp)
 }
 
 /**
+ * drm_gem_object_free - release resources bound to userspace handles
+ * @obj: GEM object to clean up.
+ *
  * Called after the last handle to the object has been closed
  *
  * Removes any name for the object. Note that this must be
@@ -225,7 +238,12 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
 }
 
 /**
- * Removes the mapping from handle to filp for this object.
+ * drm_gem_handle_delete - deletes the given file-private handle
+ * @filp: drm file-private structure to use for the handle look up
+ * @handle: userspace handle to delete
+ *
+ * Removes the GEM handle from the @filp lookup table and if this is the last
+ * handle also cleans up linked resources like GEM names.
  */
 int
 drm_gem_handle_delete(struct drm_file *filp, u32 handle)
@@ -270,6 +288,9 @@ EXPORT_SYMBOL(drm_gem_handle_delete);
 
 /**
  * drm_gem_dumb_destroy - dumb fb callback helper for gem based drivers
+ * @file: drm file-private structure to remove the dumb handle from
+ * @dev: corresponding drm_device
+ * @handle: the dumb handle to remove
  *
  * This implements the ->dumb_destroy kms driver callback for drivers which use
  * gem to manage their backing storage.
@@ -284,6 +305,9 @@ EXPORT_SYMBOL(drm_gem_dumb_destroy);
 
 /**
  * drm_gem_handle_create_tail - internal functions to create a handle
+ * @file_priv: drm file-private structure to register the handle for
+ * @obj: object to register
+ * @handlep: pionter to return the created handle to the caller
  *
  * This expects the dev->object_name_lock to be held already and will drop it
  * before returning. Used to avoid races in establishing new handles when
@@ -336,6 +360,11 @@ drm_gem_handle_create_tail(struct drm_file *file_priv,
 }
 
 /**
+ * gem_handle_create - create a gem handle for an object
+ * @file_priv: drm file-private structure to register the handle for
+ * @obj: object to register
+ * @handlep: pionter to return the created handle to the caller
+ *
  * Create a handle for this object. This adds a handle reference
  * to the object, which includes a regular reference count. Callers
  * will likely want to dereference the object afterwards.
@@ -536,6 +565,11 @@ drm_gem_object_lookup(struct drm_device *dev, struct drm_file *filp,
 EXPORT_SYMBOL(drm_gem_object_lookup);
 
 /**
+ * drm_gem_close_ioctl - implementation of the GEM_CLOSE ioctl
+ * @dev: drm_device
+ * @data: ioctl data
+ * @file_priv: drm file-private structure
+ *
  * Releases the handle to an mm object.
  */
 int
@@ -554,6 +588,11 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,
 }
 
 /**
+ * drm_gem_flink_ioctl - implementation of the GEM_FLINK ioctl
+ * @dev: drm_device
+ * @data: ioctl data
+ * @file_priv: drm file-private structure
+ *
  * Create a global name for an object, returning the name.
  *
  * Note that the name does not hold a reference; when the object
@@ -601,6 +640,11 @@ err:
 }
 
 /**
+ * drm_gem_open - implementation of the GEM_OPEN ioctl
+ * @dev: drm_device
+ * @data: ioctl data
+ * @file_priv: drm file-private structure
+ *
  * Open an object using the global name, returning a handle and the size.
  *
  * This handle (of course) holds a reference to the object, so the object
@@ -640,6 +684,10 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
 }
 
 /**
+ * gem_gem_open - initalizes GEM file-private structures at devnode open time
+ * @dev: drm_device which is being opened by userspace
+ * @file_private: drm file-private structure to set up
+ *
  * Called at device open time, sets up the structure for handling refcounting
  * of mm objects.
  */
@@ -650,7 +698,7 @@ drm_gem_open(struct drm_device *dev, struct drm_file *file_private)
        spin_lock_init(&file_private->table_lock);
 }
 
-/**
+/*
  * Called at device close to release the file's
  * handle references on objects.
  */
@@ -674,6 +722,10 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
 }
 
 /**
+ * drm_gem_release - release file-private GEM resources
+ * @dev: drm_device which is being closed by userspace
+ * @file_private: drm file-private structure to clean up
+ *
  * Called at close time when the filp is going away.
  *
  * Releases any remaining references on objects by this filp.

drivers/gpu/drm/drm_gem.c drm_gem_object_release(struct drm_gem_object *obj) · line 749

Quoted 1 line
drivers/gpu/drm/drm_gem.c +0 -0
@@ -697,6 +749,9 @@ drm_gem_object_release(struct drm_gem_object *obj)
 EXPORT_SYMBOL(drm_gem_object_release);

drm_gem_object_release() is still missing. Lets at least add a kernel-doc entry ala:

/**
* drm_gem_object_release() - destroy GEM object
* @obj: drm-object to release
*
* This is the counter-part to drm_gem_object_init() and
drm_gem_private_object_init() and
* must be called by a driver in its gem_free_object() callback to
release any gem-internal
* resources of the GEM-bo.
*/

drivers/gpu/drm/drm_gem.c drm_gem_object_release(struct drm_gem_object *obj) · line 757

Quoted 8 lines
drivers/gpu/drm/drm_gem.c +3 -0
 /**
+ * drm_gem_object_free - free a GEM object
+ * @kref: kref of the object to free
+ *
  * Called after the last reference to the object has been lost.
  * Must be called holding struct_ mutex
  *
Quoted 4 lines

drm_gem_object_free() is internal to drm_gem.c. We only export it because our object_unreference() helper is "static inline" in the header. I don't think we should include this in the kernel-doc. No-one should call this directly (same drm_gem_object_release_handle()).

I think I'll postpone this to a real patch to clean up drm_gem kerneldoc. Essentially this patch here just shuts up kerneldoc warnings about mismatched kerneldoc compared to the actual function definition. But I'll keep your suggestions in mind.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#22 lore raw

PATCH 4/19 drm/doc: Remove <term> from rendernode docs

In reply to Daniel Vetter

The stylesheet doesn't allow this in normal paragraphs.

---
 Documentation/DocBook/drm.tmpl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Documentation/DocBook/drm.tmpl +6 -6
index 0660bae6928f..3dc7ad7ff405 100644
@@ -2673,8 +2673,8 @@ int (*resume) (struct drm_device *);</synopsis>
         DRM core provides multiple character-devices for user-space to use.
         Depending on which device is opened, user-space can perform a different
         set of operations (mainly ioctls). The primary node is always created
-        and called <term>card&lt;num&gt;</term>. Additionally, a currently
-        unused control node, called <term>controlD&lt;num&gt;</term> is also
+        and called card&lt;num&gt;. Additionally, a currently
+        unused control node, called controlD&lt;num&gt; is also
         created. The primary node provides all legacy operations and
         historically was the only interface used by userspace. With KMS, the
         control node was introduced. However, the planned KMS control interface
@@ -2689,21 +2689,21 @@ int (*resume) (struct drm_device *);</synopsis>
         nodes were introduced. Render nodes solely serve render clients, that
         is, no modesetting or privileged ioctls can be issued on render nodes.
         Only non-global rendering commands are allowed. If a driver supports
-        render nodes, it must advertise it via the <term>DRIVER_RENDER</term>
+        render nodes, it must advertise it via the DRIVER_RENDER
         DRM driver capability. If not supported, the primary node must be used
         for render clients together with the legacy drmAuth authentication
         procedure.
       </para>
       <para>
         If a driver advertises render node support, DRM core will create a
-        separate render node called <term>renderD&lt;num&gt;</term>. There will
+        separate render node called renderD&lt;num&gt;. There will
         be one render node per device. No ioctls except  PRIME-related ioctls
-        will be allowed on this node. Especially <term>GEM_OPEN</term> will be
+        will be allowed on this node. Especially GEM_OPEN will be
         explicitly prohibited. Render nodes are designed to avoid the
         buffer-leaks, which occur if clients guess the flink names or mmap
         offsets on the legacy interface. Additionally to this basic interface,
         drivers must mark their driver-dependent render-only ioctls as
-        <term>DRM_RENDER_ALLOW</term> so render clients can use them. Driver
+        DRM_RENDER_ALLOW so render clients can use them. Driver
         authors must be careful not to allow any privileged ioctls on render
         nodes.
       </para>
Signature · 1 line
1.8.5.2
#23 lore raw

PATCH 5/19 drm/doc: Reorganize driver documentation

In reply to Daniel Vetter

Split up the DocBook into the core drm part and a 2nd part for driver documentation. As an example add a very (very!) basic skeleton for i915.

---
 Documentation/DocBook/drm.tmpl | 80 ++++++++++++++++++++++++++++++++++++++----
 1 file changed, 73 insertions(+), 7 deletions(-)
Documentation/DocBook/drm.tmpl +73 -7
index 3dc7ad7ff405..13330e236a9f 100644
@@ -60,7 +60,15 @@
 
 <toc></toc>
 
-  <!-- Introduction -->
+<part id="drmCore">
+  <title>DRM Core</title>
+  <partintro>
+    <para>
+      This first part of the DRM Developer's Guide documents core DRM code,
+      helper libraries for writting drivers and generic userspace interfaces
+      exposed by DRM drivers.
+    </para>
+  </partintro>
 
   <chapter id="drmIntroduction">
     <title>Introduction</title>
@@ -2764,15 +2772,73 @@ int (*resume) (struct drm_device *);</synopsis>
     </sect1>
 
   </chapter>
+</part>
+<part id="drmDrivers">
+  <title>DRM Drivers</title>
 
-  <!-- API reference -->
+  <partintro>
+    <para>
+      This second part of the DRM Developer's Guide documents driver code,
+      implementation details and also all the driver-specific userspace
+      interfaces. Especially since all hardware-accelaration interfaces to
+      userspace are driver specific for efficiency and other reasons these
+      interfaces can be rather substantial. Hence every driver has its own
+      chapter.
+    </para>
+  </partintro>
 
-  <appendix id="drmDriverApi">
-    <title>DRM Driver API</title>
+  <chapter id="drmI915">
+    <title>drm/i915 Intel GFX Driver</title>
     <para>
-      Include auto-generated API reference here (need to reference it
-      from paragraphs above too).
+      The drm/i915 driver supports all (with the exception of some very early
+      models) integrated GFX chipsets with both Intel display and rendering
+      blocks. This excludes a set of SoC platforms with an SGX rendering unit,
+      those have basic support through the gma500 drm driver.
     </para>
-  </appendix>
+    <sect1>
+      <title>Display Hardware Handling</title>
+      <para>
+        This section covers everything related to the display hardware including
+        the mode setting infrastructure, plane, sprite and cursor handling and
+        display, output probing and related topics.
+      </para>
+      <sect2>
+        <title>Mode Setting Infrastructure</title>
+        <para>
+          The i915 driver is thus far the only DRM driver which doesn't use the
+          common DRM helper code to implement mode setting sequences. Thus it
+          has its own tailor-made infrastructure for executing a display
+          configuration change.
+        </para>
+      </sect2>
+      <sect2>
+        <title>Plane Configuration</title>
+        <para>
+	  This section covers plane configuration and composition with the
+	  primary plane, sprites, cursors and overlays. This includes the
+	  infrastructure to do atomic vsync'ed updates of all this state and
+	  also tightly coupled topics like watermark setup and computation,
+	  framebuffer compression and panel self refresh.
+        </para>
+      </sect2>
+      <sect2>
+        <title>Output Probing</title>
+        <para>
+	  This section covers output probing and related infrastructure like the
+	  hotplug interrupt storm detection and mitigation code. Note that the
+	  i915 driver still uses most of the common DRM helper code for output
+	  probing, so those sections fully apply.
+        </para>
+      </sect2>
+    </sect1>
 
+    <sect1>
+      <title>Memory Management and Command Submission</title>
+      <para>
+	This sections covers all things related to the GEM implementation in the
+	i915 driver.
+      </para>
+    </sect1>
+  </chapter>
+</part>
 </book>
Signature · 1 line
1.8.5.2
#24 lore raw

PATCH 6/19 drm/doc: Move the vma offset manager to the right spot

In reply to Daniel Vetter

Currently it's sitting in the mode setting helper section, which isn't quite right. Looks much better in the memory management section next to TTM and GEM.

---
 Documentation/DocBook/drm.tmpl | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Documentation/DocBook/drm.tmpl +6 -6
index 13330e236a9f..d5b087dee14d 100644
@@ -881,6 +881,12 @@ char *date;</synopsis>
 !Edrivers/gpu/drm/drm_gem.c
       </sect2>
       </sect2>
+      <sect2>
+	<title>VMA Offset Manager</title>
+!Pdrivers/gpu/drm/drm_vma_manager.c vma offset manager
+!Edrivers/gpu/drm/drm_vma_manager.c
+!Iinclude/drm/drm_vma_manager.h
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
@@ -2218,12 +2224,6 @@ void intel_crt_init(struct drm_device *dev)
 !Iinclude/drm/drm_flip_work.h
 !Edrivers/gpu/drm/drm_flip_work.c
     </sect2>
-    <sect2>
-      <title>VMA Offset Manager</title>
-!Pdrivers/gpu/drm/drm_vma_manager.c vma offset manager
-!Edrivers/gpu/drm/drm_vma_manager.c
-!Iinclude/drm/drm_vma_manager.h
-    </sect2>
   </sect1>
 
   <!-- Internals: kms properties -->
Signature · 1 line
1.8.5.2
#25 lore raw

PATCH 7/19 drm/doc: Remove the "command submissin and fencing" section

In reply to Daniel Vetter

This should be done in the driver chapter instead.

---
 Documentation/DocBook/drm.tmpl | 10 ----------
 1 file changed, 10 deletions(-)
Documentation/DocBook/drm.tmpl +0 -10
index d5b087dee14d..9625cf7aa96a 100644
@@ -2586,16 +2586,6 @@ int num_ioctls;</synopsis>
   </sect1>
 
   <sect1>
-    <title>Command submission &amp; fencing</title>
-    <para>
-      This should cover a few device-specific command submission
-      implementations.
-    </para>
-  </sect1>
-
-  <!-- Internals: suspend/resume -->
-
-  <sect1>
     <title>Suspend/Resume</title>
     <para>
       The DRM core provides some suspend/resume code, but drivers wanting full
Signature · 1 line
1.8.5.2
#26 lore raw

PATCH 8/19 drm/doc: No more drm perf counters

In reply to Daniel Vetter

Those all died with

commit 0111be42186fc5461b9e9d579014c70869ab3152

Author: Ville Syrjälä <[email protected]>
Date:   Fri Oct 4 14:53:41 2013 +0300

drm: Kill drm perf counter leftovers

---
 Documentation/DocBook/drm.tmpl | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
Documentation/DocBook/drm.tmpl +3 -11
index 9625cf7aa96a..975a4d0a1d3f 100644
@@ -272,8 +272,8 @@ char *date;</synopsis>
       <para>
         The <methodname>load</methodname> method is the driver and device
         initialization entry point. The method is responsible for allocating and
-        initializing driver private data, specifying supported performance
-        counters, performing resource allocation and mapping (e.g. acquiring
+	initializing driver private data, performing resource allocation and
+	mapping (e.g. acquiring
         clocks, mapping registers or allocating command buffers), initializing
         the memory manager (<xref linkend="drm-memory-management"/>), installing
         the IRQ handler (<xref linkend="drm-irq-registration"/>), setting up
@@ -303,7 +303,7 @@ char *date;</synopsis>
 	their <methodname>load</methodname> method called with flags to 0.
       </para>
       <sect3>
-        <title>Driver Private &amp; Performance Counters</title>
+        <title>Driver Private Data</title>
         <para>
           The driver private hangs off the main
           <structname>drm_device</structname> structure and can be used for
@@ -315,14 +315,6 @@ char *date;</synopsis>
           <structname>drm_device</structname>.<structfield>dev_priv</structfield>
           set to NULL when the driver is unloaded.
         </para>
-        <para>
-          DRM supports several counters which were used for rough performance
-          characterization. This stat counter system is deprecated and should not
-          be used. If performance monitoring is desired, the developer should
-          investigate and potentially enhance the kernel perf and tracing
-          infrastructure to export GPU related performance information for
-          consumption by performance monitoring tools and applications.
-        </para>
       </sect3>
       <sect3 id="drm-irq-registration">
         <title>IRQ Registration</title>
Signature · 6 lines
1.8.5.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#27 lore raw

PATCH 9/19 drm/doc: Document drm_helper_resume_force_mode

In reply to Daniel Vetter

Stumbled over while reviewing all occurences in the DRM doc talking about suspend/resume.

---
 Documentation/DocBook/drm.tmpl    | 7 +++++--
 drivers/gpu/drm/drm_crtc_helper.c | 9 +++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)
Documentation/DocBook/drm.tmpl +5 -2
index 975a4d0a1d3f..e63a3aae3f14 100644
@@ -1151,8 +1151,11 @@ int max_width, max_height;</synopsis>
             This operation is called with the mode config lock held.
           </para>
           <note><para>
-            FIXME: How should set_config interact with DPMS? If the CRTC is
-            suspended, should it be resumed?
+	    Note that the drm core has no notion of restoring the mode setting
+	    state after resume, since all resume handling is in the full
+	    responsibility of the driver. The common mode setting helper library
+	    though provides a helper which can be used for this:
+	    <function>drm_helper_resume_force_mode</function>.
           </para></note>
         </sect4>
         <sect4>
drivers/gpu/drm/drm_crtc_helper.c +9 -0
index 01361aba033b..121ebeaa4cfd 100644
@@ -972,6 +972,15 @@ int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
 }
 EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
 
+/**
+ * drm_helper_resume_force_mode - force-restore mode setting configuration
+ * @dev: drm_device which should be restored
+ *
+ * Drivers which use the mode setting helpers can use this function to
+ * force-restore the mode setting configuration e.g. on resume or when something
+ * else might have trampled over the hw state (like some overzealous old BIOSen
+ * tended to do).
+ */
 int drm_helper_resume_force_mode(struct drm_device *dev)
 {
 	struct drm_crtc *crtc;
Signature · 1 line
1.8.5.2
#28 lore raw

PATCH 10/19 drm/doc: Hide legacy horrors better

In reply to Daniel Vetter

By consolidating them all into one section at the very end. And to make double-sure that no one gets confused start with a stern warning against any use of them. And prefix all subsections with "Legacy".

---
 Documentation/DocBook/drm.tmpl | 56 +++++++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 22 deletions(-)
Documentation/DocBook/drm.tmpl +34 -22
index e63a3aae3f14..251b87cfad8c 100644
@@ -2579,32 +2579,44 @@ int num_ioctls;</synopsis>
       </para>
     </sect2>
   </sect1>
-
   <sect1>
-    <title>Suspend/Resume</title>
-    <para>
-      The DRM core provides some suspend/resume code, but drivers wanting full
-      suspend/resume support should provide save() and restore() functions.
-      These are called at suspend, hibernate, or resume time, and should perform
-      any state save or restore required by your device across suspend or
-      hibernate states.
-    </para>
-    <synopsis>int (*suspend) (struct drm_device *, pm_message_t state);
-int (*resume) (struct drm_device *);</synopsis>
+    <title>Legacy Support Code</title>
     <para>
-      Those are legacy suspend and resume methods. New driver should use the
-      power management interface provided by their bus type (usually through
-      the struct <structname>device_driver</structname> dev_pm_ops) and set
-      these methods to NULL.
+      The section very brievely covers some of the old legacy support code which
+      is only used by old DRM drivers which have done a so-called shadow-attach
+      to the underlying device instead of registering as a real driver. This
+      also includes some of the old generic buffer mangement and command
+      submission code. Do not use any of this in new and modern drivers.
     </para>
-  </sect1>
 
-  <sect1>
-    <title>DMA services</title>
-    <para>
-      This should cover how DMA mapping etc. is supported by the core.
-      These functions are deprecated and should not be used.
-    </para>
+    <sect2>
+      <title>Legacy Suspend/Resume</title>
+      <para>
+	The DRM core provides some suspend/resume code, but drivers wanting full
+	suspend/resume support should provide save() and restore() functions.
+	These are called at suspend, hibernate, or resume time, and should perform
+	any state save or restore required by your device across suspend or
+	hibernate states.
+      </para>
+      <synopsis>int (*suspend) (struct drm_device *, pm_message_t state);
+  int (*resume) (struct drm_device *);</synopsis>
+      <para>
+	Those are legacy suspend and resume methods which
+	<emphasis>only</emphasis> work with the legacy shadow-attach driver
+	registration functions. New driver should use the power management
+	interface provided by their bus type (usually through
+	the struct <structname>device_driver</structname> dev_pm_ops) and set
+	these methods to NULL.
+      </para>
+    </sect2>
+
+    <sect2>
+      <title>Legacy DMA Services</title>
+      <para>
+	This should cover how DMA mapping etc. is supported by the core.
+	These functions are deprecated and should not be used.
+      </para>
+    </sect2>
   </sect1>
   </chapter>
 
Signature · 1 line
1.8.5.2
#29 lore raw

PATCH 11/19 drm/docs: Include hdmi infoframe helper reference

In reply to Daniel Vetter

Thierry created such nice kerneldocs, it's a shame we've left them lingering!

For the fun of it also add a bit of kerneldoc to the header so that we can also include that. Just in case someone adds kerneldoc in there.

---
 Documentation/DocBook/drm.tmpl | 11 +++++++++++
 include/linux/hdmi.h           | 12 ++++++++++++
 2 files changed, 23 insertions(+)
Documentation/DocBook/drm.tmpl +11 -0
index 251b87cfad8c..af4d05b0c4fd 100644
@@ -2219,6 +2219,17 @@ void intel_crt_init(struct drm_device *dev)
 !Iinclude/drm/drm_flip_work.h
 !Edrivers/gpu/drm/drm_flip_work.c
     </sect2>
+    <sect2>
+      <title>HDMI Infoframes Helper Reference</title>
+      <para>
+	Strictly speaking this is not a DRM helper library but generally useable
+	by any driver interfacing with HDMI outputs like v4l or alsa drivers.
+	But it nicely fits into the overall topic of mode setting helper
+	libraries and hence is also included here.
+      </para>
+!Iinclude/linux/hdmi.h
+!Edrivers/video/hdmi.c
+    </sect2>
   </sect1>
 
   <!-- Internals: kms properties -->
include/linux/hdmi.h +12 -0
index 9231be9e90a2..11c0182a153b 100644
@@ -262,6 +262,18 @@ union hdmi_vendor_any_infoframe {
 	struct hdmi_vendor_infoframe hdmi;
 };
 
+/**
+ * union hdmi_infoframe - overall union of all abstract infoframe representations
+ * @any: generic infoframe
+ * @avi: avi infoframe
+ * @spd: spd infoframe
+ * @vendor: union of all vendor infoframes
+ * @audio: audio infoframe
+ *
+ * This is used by the generic pack function. This works since all infoframes
+ * have the same header which also indicates which type of infoframe should be
+ * packed.
+ */
 union hdmi_infoframe {
 	struct hdmi_any_infoframe any;
 	struct hdmi_avi_infoframe avi;
Signature · 1 line
1.8.5.2
#30 lore raw

PATCH 12/19 drm/doc: Clarify PRIME documentation

In reply to Daniel Vetter

PRIME fds aren't actually GEM fds but are (like the modeset API) independent of the underlying buffer manager, as long as that one uses uint32_t as handles. So move that entire section out of the GEM section and reword it a bit to clarify which parts of PRIME are generic, and which are the mandatory pieces for GEM drivers to correctly implement the GEM lifetime rules. The rewording mostly consists of not mixing up GEM, PRIME and DRM.

I've considered adding some blurbs to the GEM object lifetime section about interactions with dma-bufs, but then dropped that. As long as drivers use the right helpers they should have this all implemented correctly and hence can be regarded as an implementation detail of the PRIME/GEM helpers. So no need to confuse driver writers with those tricky interactions.

---
 Documentation/DocBook/drm.tmpl | 125 ++++++++++++++++++++++++-----------------
 1 file changed, 74 insertions(+), 51 deletions(-)
Documentation/DocBook/drm.tmpl +74 -51
index af4d05b0c4fd..0cc1d85d04de 100644
@@ -697,55 +697,16 @@ char *date;</synopsis>
           respectively. The conversion is handled by the DRM core without any
           driver-specific support.
         </para>
-        <para>
-          Similar to global names, GEM file descriptors are also used to share GEM
-          objects across processes. They offer additional security: as file
-          descriptors must be explicitly sent over UNIX domain sockets to be shared
-          between applications, they can't be guessed like the globally unique GEM
-          names.
-        </para>
-        <para>
-          Drivers that support GEM file descriptors, also known as the DRM PRIME
-          API, must set the DRIVER_PRIME bit in the struct
-          <structname>drm_driver</structname>
-          <structfield>driver_features</structfield> field, and implement the
-          <methodname>prime_handle_to_fd</methodname> and
-          <methodname>prime_fd_to_handle</methodname> operations.
-        </para>
-        <para>
-          <synopsis>int (*prime_handle_to_fd)(struct drm_device *dev,
-                            struct drm_file *file_priv, uint32_t handle,
-                            uint32_t flags, int *prime_fd);
-  int (*prime_fd_to_handle)(struct drm_device *dev,
-                            struct drm_file *file_priv, int prime_fd,
-                            uint32_t *handle);</synopsis>
-          Those two operations convert a handle to a PRIME file descriptor and
-          vice versa. Drivers must use the kernel dma-buf buffer sharing framework
-          to manage the PRIME file descriptors.
-        </para>
-        <para>
-          While non-GEM drivers must implement the operations themselves, GEM
-          drivers must use the <function>drm_gem_prime_handle_to_fd</function>
-          and <function>drm_gem_prime_fd_to_handle</function> helper functions.
-          Those helpers rely on the driver
-          <methodname>gem_prime_export</methodname> and
-          <methodname>gem_prime_import</methodname> operations to create a dma-buf
-          instance from a GEM object (dma-buf exporter role) and to create a GEM
-          object from a dma-buf instance (dma-buf importer role).
-        </para>
-        <para>
-          <synopsis>struct dma_buf * (*gem_prime_export)(struct drm_device *dev,
-                                       struct drm_gem_object *obj,
-                                       int flags);
-  struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
-                                              struct dma_buf *dma_buf);</synopsis>
-          These two operations are mandatory for GEM drivers that support DRM
-          PRIME.
-        </para>
-        <sect4>
-          <title>DRM PRIME Helper Functions Reference</title>
-!Pdrivers/gpu/drm/drm_prime.c PRIME Helpers
-        </sect4>
+	<para>
+	  GEM also supports buffer sharing with dma-buf file descriptors through
+	  PRIME. GEM-based drivers must use the provided helpers functions to
+	  implement the exporting and importing correctly. See <xref linkend="drm-prime-support" />.
+	  Since sharing file descriptors is inherently more secure than the
+	  easily guessable and global GEM names it is the preferred buffer
+	  sharing mechanism. Sharing buffers through GEM names is only supported
+	  for legacy userspace. Furthermore PRIME also allows cross-device
+	  buffer sharing since it is based on dma-bufs.
+	</para>
       </sect3>
       <sect3 id="drm-gem-objects-mapping">
         <title>GEM Objects Mapping</title>
@@ -868,10 +829,10 @@ char *date;</synopsis>
           abstracted from the client in libdrm.
         </para>
       </sect3>
-      <sect2>
+      <sect3>
         <title>GEM Function Reference</title>
 !Edrivers/gpu/drm/drm_gem.c
-      </sect2>
+      </sect3>
       </sect2>
       <sect2>
 	<title>VMA Offset Manager</title>
@@ -879,6 +840,68 @@ char *date;</synopsis>
 !Edrivers/gpu/drm/drm_vma_manager.c
 !Iinclude/drm/drm_vma_manager.h
       </sect2>
+      <sect2 id="drm-prime-support">
+	<title>PRIME Buffer Sharing</title>
+	<para>
+	  PRIME is the cross device buffer sharing framework in drm, originally
+	  created for the OPTIMUS range of multi-gpu platforms. To userspace
+	  PRIME buffers are dma-buf based file descriptors.
+	</para>
+	<sect3>
+	  <title>Overview and Driver Interface</title>
+	  <para>
+	    Similar to GEM global names, PRIME file descriptors are
+	    also used to share buffer objects across processes. They offer
+	    additional security: as file descriptors must be explicitly sent over
+	    UNIX domain sockets to be shared between applications, they can't be
+	    guessed like the globally unique GEM names.
+	  </para>
+	  <para>
+	    Drivers that support the PRIME
+	    API must set the DRIVER_PRIME bit in the struct
+	    <structname>drm_driver</structname>
+	    <structfield>driver_features</structfield> field, and implement the
+	    <methodname>prime_handle_to_fd</methodname> and
+	    <methodname>prime_fd_to_handle</methodname> operations.
+	  </para>
+	  <para>
+	    <synopsis>int (*prime_handle_to_fd)(struct drm_device *dev,
+			  struct drm_file *file_priv, uint32_t handle,
+			  uint32_t flags, int *prime_fd);
+int (*prime_fd_to_handle)(struct drm_device *dev,
+			  struct drm_file *file_priv, int prime_fd,
+			  uint32_t *handle);</synopsis>
+	    Those two operations convert a handle to a PRIME file descriptor and
+	    vice versa. Drivers must use the kernel dma-buf buffer sharing framework
+	    to manage the PRIME file descriptors. Similar to the mode setting
+	    API PRIME is agnostic to the underlying buffer object manager, as
+	    long as handles are 32bit unsinged integers.
+	  </para>
+	  <para>
+	    While non-GEM drivers must implement the operations themselves, GEM
+	    drivers must use the <function>drm_gem_prime_handle_to_fd</function>
+	    and <function>drm_gem_prime_fd_to_handle</function> helper functions.
+	    Those helpers rely on the driver
+	    <methodname>gem_prime_export</methodname> and
+	    <methodname>gem_prime_import</methodname> operations to create a dma-buf
+	    instance from a GEM object (dma-buf exporter role) and to create a GEM
+	    object from a dma-buf instance (dma-buf importer role).
+	  </para>
+	  <para>
+	    <synopsis>struct dma_buf * (*gem_prime_export)(struct drm_device *dev,
+				     struct drm_gem_object *obj,
+				     int flags);
+struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
+					    struct dma_buf *dma_buf);</synopsis>
+	    These two operations are mandatory for GEM drivers that support
+	    PRIME.
+	  </para>
+	</sect3>
+        <sect3>
+          <title>PRIME Helper Functions Reference</title>
+!Pdrivers/gpu/drm/drm_prime.c PRIME Helpers
+        </sect3>
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
Signature · 1 line
1.8.5.2
#31 lore raw

PATCH 13/19 drm/doc: Add PRIME function references

In reply to Daniel Vetter

For giant hilarity the DocBook reference overview is only generated when in a level 2 section, not in a level 3 section. So we need to move this up a bit as a side-by-side section to the main PRIME documentation.

Whatever.

To have a complete set of references add the missing kerneldoc for all functions exported to modules with the exception of the file private init/destry functions - drivers have no business calling those, so let's just drop the EXPORT_SYMBOL instead.

Also reflow the function parameters to align correctly and break at 80 chars - my OCD couldn't stand them while writing the kerneldoc ;-)

---
 Documentation/DocBook/drm.tmpl |   6 ++-
 drivers/gpu/drm/drm_prime.c    | 110 +++++++++++++++++++++++++++++++++--------
 2 files changed, 94 insertions(+), 22 deletions(-)
Documentation/DocBook/drm.tmpl +5 -1
index 0cc1d85d04de..07abe52b1176 100644
@@ -898,10 +898,14 @@ struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
 	  </para>
 	</sect3>
         <sect3>
-          <title>PRIME Helper Functions Reference</title>
+          <title>PRIME Helper Functions</title>
 !Pdrivers/gpu/drm/drm_prime.c PRIME Helpers
         </sect3>
       </sect2>
+      <sect2>
+	<title>PRIME Function References</title>
+!Edrivers/gpu/drm/drm_prime.c
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_prime.c +89 -21

212 lines not on this page · raw message

Signature · 1 line
1.8.5.2
#32 lore raw

Re: [PATCH 13/19] drm/doc: Add PRIME function references

Hi

Quoted 6 lines · Daniel Vetter

For giant hilarity the DocBook reference overview is only generated when in a level 2 section, not in a level 3 section. So we need to move this up a bit as a side-by-side section to the main PRIME documentation.

Whatever.

I tried digging through scripts/kernel-doc but.. ugh.. it's perl! No idea how to fix that. But sect2 seems fine as the whole section is PRIME-related.

Thanks
David

Quoted 270 lines

To have a complete set of references add the missing kerneldoc for all functions exported to modules with the exception of the file private init/destry functions - drivers have no business calling those, so let's just drop the EXPORT_SYMBOL instead.

Also reflow the function parameters to align correctly and break at 80 chars - my OCD couldn't stand them while writing the kerneldoc ;-)

---
 Documentation/DocBook/drm.tmpl |   6 ++-
 drivers/gpu/drm/drm_prime.c    | 110 +++++++++++++++++++++++++++++++++--------
 2 files changed, 94 insertions(+), 22 deletions(-)
Documentation/DocBook/drm.tmpl +5 -1
index 0cc1d85d04de..07abe52b1176 100644
@@ -898,10 +898,14 @@ struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
          </para>
        </sect3>
         <sect3>
-          <title>PRIME Helper Functions Reference</title>
+          <title>PRIME Helper Functions</title>
 !Pdrivers/gpu/drm/drm_prime.c PRIME Helpers
         </sect3>
       </sect2>
+      <sect2>
+       <title>PRIME Function References</title>
+!Edrivers/gpu/drm/drm_prime.c
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_prime.c +89 -22
index 56805c39c906..f1437b6c8dbf 100644
@@ -68,7 +68,8 @@ struct drm_prime_attachment {
        enum dma_data_direction dir;
 };
 
-static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle)
+static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv,
+                                   struct dma_buf *dma_buf, uint32_t handle)
 {
        struct drm_prime_member *member;
 
@@ -174,7 +175,7 @@ void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpr
 }
 
 static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
-               enum dma_data_direction dir)
+                                           enum dma_data_direction dir)
 {
        struct drm_prime_attachment *prime_attach = attach->priv;
        struct drm_gem_object *obj = attach->dmabuf->priv;
@@ -211,11 +212,19 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
 }
 
 static void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
-               struct sg_table *sgt, enum dma_data_direction dir)
+                                 struct sg_table *sgt,
+                                 enum dma_data_direction dir)
 {
        /* nothing to be done here */
 }
 
+/**
+ * drm_gem_dmabuf_release - dma_buf release implementation for GEM
+ * @dma_buf: buffer to be released
+ *
+ * Generic release function for dma_bufs exported as PRIME buffers. GEM drivers
+ * must use this in their dma_buf ops structure as the release callback.
+ */
 void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
 {
        struct drm_gem_object *obj = dma_buf->priv;
@@ -242,30 +251,30 @@ static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
 }
 
 static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
-               unsigned long page_num)
+                                       unsigned long page_num)
 {
        return NULL;
 }
 
 static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
-               unsigned long page_num, void *addr)
+                                        unsigned long page_num, void *addr)
 {
 
 }
 static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
-               unsigned long page_num)
+                                unsigned long page_num)
 {
        return NULL;
 }
 
 static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
-               unsigned long page_num, void *addr)
+                                 unsigned long page_num, void *addr)
 {
 
 }
 
 static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
-               struct vm_area_struct *vma)
+                              struct vm_area_struct *vma)
 {
        struct drm_gem_object *obj = dma_buf->priv;
        struct drm_device *dev = obj->dev;
@@ -315,6 +324,15 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
  *    driver's scatter/gather table
  */
 
+/**
+ * drm_gem_prime_export - helper library implemention of the export callback
+ * @dev: drm_device to export from
+ * @obj: GEM object to export
+ * @flags: flags like DRM_CLOEXEC
+ *
+ * This is the implementation of the gem_prime_export functions for GEM drivers
+ * using the PRIME helpers.
+ */
 struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
                                     struct drm_gem_object *obj, int flags)
 {
@@ -355,9 +373,23 @@ static struct dma_buf *export_and_register_object(struct drm_device *dev,
        return dmabuf;
 }
 
+/**
+ * drm_gem_prime_handle_to_fd - PRIME export function for GEM drivers
+ * @dev: dev to export the buffer from
+ * @file_priv: drm file-private structure
+ * @handle: buffer handle to export
+ * @flags: flags like DRM_CLOEXEC
+ * @prime_fd: pointer to storage for the fd id of the create dma-buf
+ *
+ * This is the PRIME export function which must be used mandatorily by GEM
+ * drivers to ensure correct lifetime management of the underlying GEM object.
+ * The actual exporting from GEM object to a dma-buf is done through the
+ * gem_prime_export driver callback.
+ */
 int drm_gem_prime_handle_to_fd(struct drm_device *dev,
-               struct drm_file *file_priv, uint32_t handle, uint32_t flags,
-               int *prime_fd)
+                              struct drm_file *file_priv, uint32_t handle,
+                              uint32_t flags,
+                              int *prime_fd)
 {
        struct drm_gem_object *obj;
        int ret = 0;
@@ -441,6 +473,14 @@ out_unlock:
 }
 EXPORT_SYMBOL(drm_gem_prime_handle_to_fd);
 
+/**
+ * drm_gem_prime_import - helper library implemention of the import callback
+ * @dev: drm_device to import into
+ * @dma_buf: dma-buf object to import
+ *
+ * This is the implementation of the gem_prime_import functions for GEM drivers
+ * using the PRIME helpers.
+ */
 struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
                                            struct dma_buf *dma_buf)
 {
@@ -496,8 +536,21 @@ fail_detach:
 }
 EXPORT_SYMBOL(drm_gem_prime_import);
 
+/**
+ * drm_gem_prime_fd_to_handle - PRIME import function for GEM drivers
+ * @dev: dev to export the buffer from
+ * @file_priv: drm file-private structure
+ * @prime_fd: fd id of the dma-buf which should be imported
+ * @handle: pointer to storage for the handle of the imported buffer object
+ *
+ * This is the PRIME import function which must be used mandatorily by GEM
+ * drivers to ensure correct lifetime management of the underlying GEM object.
+ * The actual importing of GEM object from the dma-buf is done through the
+ * gem_import_export driver callback.
+ */
 int drm_gem_prime_fd_to_handle(struct drm_device *dev,
-               struct drm_file *file_priv, int prime_fd, uint32_t *handle)
+                              struct drm_file *file_priv, int prime_fd,
+                              uint32_t *handle)
 {
        struct dma_buf *dma_buf;
        struct drm_gem_object *obj;
@@ -598,12 +651,14 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
                        args->fd, &args->handle);
 }
 
-/*
- * drm_prime_pages_to_sg
+/**
+ * drm_prime_pages_to_sg - converts a page array into an sg list
+ * @pages: pointer to the array of page pointers to convert
+ * @nr_pages: length of the page vector
  *
- * this helper creates an sg table object from a set of pages
+ * This helper creates an sg table object from a set of pages
  * the driver is responsible for mapping the pages into the
- * importers address space
+ * importers address space for use with dma_buf itself.
  */
 struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages)
 {
@@ -628,9 +683,16 @@ out:
 }
 EXPORT_SYMBOL(drm_prime_pages_to_sg);
 
-/* export an sg table into an array of pages and addresses
-   this is currently required by the TTM driver in order to do correct fault
-   handling */
+/**
+ * drm_prime_sg_to_page_addr_arrays - convert an sg table into a page array
+ * @sgt: scatter-gather table to convert
+ * @pages: array of page pointers to store the page array in
+ * @addrs: optional array to store the dma bus address of each page
+ * @max_pages: size of both the passed-in arrays
+ *
+ * Exports an sg table into an array of pages and addresses. This is currently
+ * required by the TTM driver in order to do correct fault handling.
+ */
 int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
                                     dma_addr_t *addrs, int max_pages)
 {
@@ -663,7 +725,15 @@ int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
        return 0;
 }
 EXPORT_SYMBOL(drm_prime_sg_to_page_addr_arrays);
-/* helper function to cleanup a GEM/prime object */
+
+/**
+ * drm_prime_gem_destroy - helper to clean up a PRIME-imported GEM object
+ * @obj: GEM object which was created from a dma-buf
+ * @sg: the sg-table which was pinned at import time
+ *
+ * This is the cleanup functions which GEM drivers need to call when they use
+ * @drm_gem_prime_import to import dma-bufs.
+ */
 void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg)
 {
        struct dma_buf_attachment *attach;
@@ -683,11 +753,9 @@ void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv)
        INIT_LIST_HEAD(&prime_fpriv->head);
        mutex_init(&prime_fpriv->lock);
 }
-EXPORT_SYMBOL(drm_prime_init_file_private);
 
 void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv)
 {
        /* by now drm_gem_release should've made sure the list is empty */
        WARN_ON(!list_empty(&prime_fpriv->head));
 }
-EXPORT_SYMBOL(drm_prime_destroy_file_private);
--

1.8.5.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#33 lore raw

Re: [PATCH 13/19] drm/doc: Add PRIME function references

Quoted 8 lines · David Herrmann

Hi

Quoted 5 lines · Daniel Vetter

For giant hilarity the DocBook reference overview is only generated when in a level 2 section, not in a level 3 section. So we need to move this up a bit as a side-by-side section to the main PRIME documentation.

Quoted 5 lines
Quoted 1 line

Whatever.

I tried digging through scripts/kernel-doc but.. ugh.. it's perl! No idea how to fix that. But sect2 seems fine as the whole section is PRIME-related.

Well we have two sect2 now: One for the PRIME overview, the other for the reference documenation. I've done the same split for drm_mm btw. If we want to fix this I think this is actually in the DocBook stylesheet, not in the kerneldoc thing. I've checked the intermediate xml and all the function references are there, they even get generated as html files and you can xref them from within the docbook. There's just no section topic for sect3 levels, so you never see a link to that separate page without an explicit reference.
-Daniel

Quoted 274 lines

Thanks
David

Quoted 270 lines

To have a complete set of references add the missing kerneldoc for all functions exported to modules with the exception of the file private init/destry functions - drivers have no business calling those, so let's just drop the EXPORT_SYMBOL instead.

Also reflow the function parameters to align correctly and break at 80 chars - my OCD couldn't stand them while writing the kerneldoc ;-)

---
 Documentation/DocBook/drm.tmpl |   6 ++-
 drivers/gpu/drm/drm_prime.c    | 110 +++++++++++++++++++++++++++++++++--------
 2 files changed, 94 insertions(+), 22 deletions(-)
Documentation/DocBook/drm.tmpl +5 -1
index 0cc1d85d04de..07abe52b1176 100644
@@ -898,10 +898,14 @@ struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
          </para>
        </sect3>
         <sect3>
-          <title>PRIME Helper Functions Reference</title>
+          <title>PRIME Helper Functions</title>
 !Pdrivers/gpu/drm/drm_prime.c PRIME Helpers
         </sect3>
       </sect2>
+      <sect2>
+       <title>PRIME Function References</title>
+!Edrivers/gpu/drm/drm_prime.c
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_prime.c +89 -22
index 56805c39c906..f1437b6c8dbf 100644
@@ -68,7 +68,8 @@ struct drm_prime_attachment {
        enum dma_data_direction dir;
 };
 
-static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle)
+static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv,
+                                   struct dma_buf *dma_buf, uint32_t handle)
 {
        struct drm_prime_member *member;
 
@@ -174,7 +175,7 @@ void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpr
 }
 
 static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
-               enum dma_data_direction dir)
+                                           enum dma_data_direction dir)
 {
        struct drm_prime_attachment *prime_attach = attach->priv;
        struct drm_gem_object *obj = attach->dmabuf->priv;
@@ -211,11 +212,19 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
 }
 
 static void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
-               struct sg_table *sgt, enum dma_data_direction dir)
+                                 struct sg_table *sgt,
+                                 enum dma_data_direction dir)
 {
        /* nothing to be done here */
 }
 
+/**
+ * drm_gem_dmabuf_release - dma_buf release implementation for GEM
+ * @dma_buf: buffer to be released
+ *
+ * Generic release function for dma_bufs exported as PRIME buffers. GEM drivers
+ * must use this in their dma_buf ops structure as the release callback.
+ */
 void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
 {
        struct drm_gem_object *obj = dma_buf->priv;
@@ -242,30 +251,30 @@ static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
 }
 
 static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
-               unsigned long page_num)
+                                       unsigned long page_num)
 {
        return NULL;
 }
 
 static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
-               unsigned long page_num, void *addr)
+                                        unsigned long page_num, void *addr)
 {
 
 }
 static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
-               unsigned long page_num)
+                                unsigned long page_num)
 {
        return NULL;
 }
 
 static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
-               unsigned long page_num, void *addr)
+                                 unsigned long page_num, void *addr)
 {
 
 }
 
 static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
-               struct vm_area_struct *vma)
+                              struct vm_area_struct *vma)
 {
        struct drm_gem_object *obj = dma_buf->priv;
        struct drm_device *dev = obj->dev;
@@ -315,6 +324,15 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
  *    driver's scatter/gather table
  */
 
+/**
+ * drm_gem_prime_export - helper library implemention of the export callback
+ * @dev: drm_device to export from
+ * @obj: GEM object to export
+ * @flags: flags like DRM_CLOEXEC
+ *
+ * This is the implementation of the gem_prime_export functions for GEM drivers
+ * using the PRIME helpers.
+ */
 struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
                                     struct drm_gem_object *obj, int flags)
 {
@@ -355,9 +373,23 @@ static struct dma_buf *export_and_register_object(struct drm_device *dev,
        return dmabuf;
 }
 
+/**
+ * drm_gem_prime_handle_to_fd - PRIME export function for GEM drivers
+ * @dev: dev to export the buffer from
+ * @file_priv: drm file-private structure
+ * @handle: buffer handle to export
+ * @flags: flags like DRM_CLOEXEC
+ * @prime_fd: pointer to storage for the fd id of the create dma-buf
+ *
+ * This is the PRIME export function which must be used mandatorily by GEM
+ * drivers to ensure correct lifetime management of the underlying GEM object.
+ * The actual exporting from GEM object to a dma-buf is done through the
+ * gem_prime_export driver callback.
+ */
 int drm_gem_prime_handle_to_fd(struct drm_device *dev,
-               struct drm_file *file_priv, uint32_t handle, uint32_t flags,
-               int *prime_fd)
+                              struct drm_file *file_priv, uint32_t handle,
+                              uint32_t flags,
+                              int *prime_fd)
 {
        struct drm_gem_object *obj;
        int ret = 0;
@@ -441,6 +473,14 @@ out_unlock:
 }
 EXPORT_SYMBOL(drm_gem_prime_handle_to_fd);
 
+/**
+ * drm_gem_prime_import - helper library implemention of the import callback
+ * @dev: drm_device to import into
+ * @dma_buf: dma-buf object to import
+ *
+ * This is the implementation of the gem_prime_import functions for GEM drivers
+ * using the PRIME helpers.
+ */
 struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
                                            struct dma_buf *dma_buf)
 {
@@ -496,8 +536,21 @@ fail_detach:
 }
 EXPORT_SYMBOL(drm_gem_prime_import);
 
+/**
+ * drm_gem_prime_fd_to_handle - PRIME import function for GEM drivers
+ * @dev: dev to export the buffer from
+ * @file_priv: drm file-private structure
+ * @prime_fd: fd id of the dma-buf which should be imported
+ * @handle: pointer to storage for the handle of the imported buffer object
+ *
+ * This is the PRIME import function which must be used mandatorily by GEM
+ * drivers to ensure correct lifetime management of the underlying GEM object.
+ * The actual importing of GEM object from the dma-buf is done through the
+ * gem_import_export driver callback.
+ */
 int drm_gem_prime_fd_to_handle(struct drm_device *dev,
-               struct drm_file *file_priv, int prime_fd, uint32_t *handle)
+                              struct drm_file *file_priv, int prime_fd,
+                              uint32_t *handle)
 {
        struct dma_buf *dma_buf;
        struct drm_gem_object *obj;
@@ -598,12 +651,14 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
                        args->fd, &args->handle);
 }
 
-/*
- * drm_prime_pages_to_sg
+/**
+ * drm_prime_pages_to_sg - converts a page array into an sg list
+ * @pages: pointer to the array of page pointers to convert
+ * @nr_pages: length of the page vector
  *
- * this helper creates an sg table object from a set of pages
+ * This helper creates an sg table object from a set of pages
  * the driver is responsible for mapping the pages into the
- * importers address space
+ * importers address space for use with dma_buf itself.
  */
 struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages)
 {
@@ -628,9 +683,16 @@ out:
 }
 EXPORT_SYMBOL(drm_prime_pages_to_sg);
 
-/* export an sg table into an array of pages and addresses
-   this is currently required by the TTM driver in order to do correct fault
-   handling */
+/**
+ * drm_prime_sg_to_page_addr_arrays - convert an sg table into a page array
+ * @sgt: scatter-gather table to convert
+ * @pages: array of page pointers to store the page array in
+ * @addrs: optional array to store the dma bus address of each page
+ * @max_pages: size of both the passed-in arrays
+ *
+ * Exports an sg table into an array of pages and addresses. This is currently
+ * required by the TTM driver in order to do correct fault handling.
+ */
 int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
                                     dma_addr_t *addrs, int max_pages)
 {
@@ -663,7 +725,15 @@ int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
        return 0;
 }
 EXPORT_SYMBOL(drm_prime_sg_to_page_addr_arrays);
-/* helper function to cleanup a GEM/prime object */
+
+/**
+ * drm_prime_gem_destroy - helper to clean up a PRIME-imported GEM object
+ * @obj: GEM object which was created from a dma-buf
+ * @sg: the sg-table which was pinned at import time
+ *
+ * This is the cleanup functions which GEM drivers need to call when they use
+ * @drm_gem_prime_import to import dma-bufs.
+ */
 void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg)
 {
        struct dma_buf_attachment *attach;
@@ -683,11 +753,9 @@ void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv)
        INIT_LIST_HEAD(&prime_fpriv->head);
        mutex_init(&prime_fpriv->lock);
 }
-EXPORT_SYMBOL(drm_prime_init_file_private);
 
 void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv)
 {
        /* by now drm_gem_release should've made sure the list is empty */
        WARN_ON(!list_empty(&prime_fpriv->head));
 }
-EXPORT_SYMBOL(drm_prime_destroy_file_private);
--

1.8.5.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#34 lore raw

Re: [PATCH 13/19] drm/doc: Add PRIME function references

Hi

Quoted 15 lines · Daniel Vetter
Quoted 8 lines · David Herrmann

Hi

Quoted 5 lines · Daniel Vetter

For giant hilarity the DocBook reference overview is only generated when in a level 2 section, not in a level 3 section. So we need to move this up a bit as a side-by-side section to the main PRIME documentation.

Quoted 5 lines
Quoted 1 line

Whatever.

I tried digging through scripts/kernel-doc but.. ugh.. it's perl! No idea how to fix that. But sect2 seems fine as the whole section is PRIME-related.

Quoted 8 lines

Well we have two sect2 now: One for the PRIME overview, the other for the reference documenation. I've done the same split for drm_mm btw. If we want to fix this I think this is actually in the DocBook stylesheet, not in the kerneldoc thing. I've checked the intermediate xml and all the function references are there, they even get generated as html files and you can xref them from within the docbook. There's just no section topic for sect3 levels, so you never see a link to that separate page without an explicit reference.

Hm, why not this:

         </sect3>

+ <title>PRIME Function References</title>
+!Edrivers/gpu/drm/drm_prime.c
+ </sect2>

So you just put it at the end of the prime-sect2?

The kernel-doc script at least has "<sect2>" hardcoded, but yeah, no idea where to fix that. So I think this is fine.

Thanks
David

Quoted 280 lines
Quoted 271 lines

Thanks
David

Quoted 266 lines

To have a complete set of references add the missing kerneldoc for all functions exported to modules with the exception of the file private init/destry functions - drivers have no business calling those, so let's just drop the EXPORT_SYMBOL instead.

Also reflow the function parameters to align correctly and break at 80 chars - my OCD couldn't stand them while writing the kerneldoc ;-)

---
 Documentation/DocBook/drm.tmpl |   6 ++-
 drivers/gpu/drm/drm_prime.c    | 110 +++++++++++++++++++++++++++++++++--------
 2 files changed, 94 insertions(+), 22 deletions(-)
Documentation/DocBook/drm.tmpl +5 -1
index 0cc1d85d04de..07abe52b1176 100644
@@ -898,10 +898,14 @@ struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
          </para>
        </sect3>
         <sect3>
-          <title>PRIME Helper Functions Reference</title>
+          <title>PRIME Helper Functions</title>
 !Pdrivers/gpu/drm/drm_prime.c PRIME Helpers
         </sect3>
       </sect2>
+      <sect2>
+       <title>PRIME Function References</title>
+!Edrivers/gpu/drm/drm_prime.c
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_prime.c +89 -22
index 56805c39c906..f1437b6c8dbf 100644
@@ -68,7 +68,8 @@ struct drm_prime_attachment {
        enum dma_data_direction dir;
 };
 
-static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle)
+static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv,
+                                   struct dma_buf *dma_buf, uint32_t handle)
 {
        struct drm_prime_member *member;
 
@@ -174,7 +175,7 @@ void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpr
 }
 
 static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
-               enum dma_data_direction dir)
+                                           enum dma_data_direction dir)
 {
        struct drm_prime_attachment *prime_attach = attach->priv;
        struct drm_gem_object *obj = attach->dmabuf->priv;
@@ -211,11 +212,19 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
 }
 
 static void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
-               struct sg_table *sgt, enum dma_data_direction dir)
+                                 struct sg_table *sgt,
+                                 enum dma_data_direction dir)
 {
        /* nothing to be done here */
 }
 
+/**
+ * drm_gem_dmabuf_release - dma_buf release implementation for GEM
+ * @dma_buf: buffer to be released
+ *
+ * Generic release function for dma_bufs exported as PRIME buffers. GEM drivers
+ * must use this in their dma_buf ops structure as the release callback.
+ */
 void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
 {
        struct drm_gem_object *obj = dma_buf->priv;
@@ -242,30 +251,30 @@ static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
 }
 
 static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
-               unsigned long page_num)
+                                       unsigned long page_num)
 {
        return NULL;
 }
 
 static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
-               unsigned long page_num, void *addr)
+                                        unsigned long page_num, void *addr)
 {
 
 }
 static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
-               unsigned long page_num)
+                                unsigned long page_num)
 {
        return NULL;
 }
 
 static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
-               unsigned long page_num, void *addr)
+                                 unsigned long page_num, void *addr)
 {
 
 }
 
 static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
-               struct vm_area_struct *vma)
+                              struct vm_area_struct *vma)
 {
        struct drm_gem_object *obj = dma_buf->priv;
        struct drm_device *dev = obj->dev;
@@ -315,6 +324,15 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
  *    driver's scatter/gather table
  */
 
+/**
+ * drm_gem_prime_export - helper library implemention of the export callback
+ * @dev: drm_device to export from
+ * @obj: GEM object to export
+ * @flags: flags like DRM_CLOEXEC
+ *
+ * This is the implementation of the gem_prime_export functions for GEM drivers
+ * using the PRIME helpers.
+ */
 struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
                                     struct drm_gem_object *obj, int flags)
 {
@@ -355,9 +373,23 @@ static struct dma_buf *export_and_register_object(struct drm_device *dev,
        return dmabuf;
 }
 
+/**
+ * drm_gem_prime_handle_to_fd - PRIME export function for GEM drivers
+ * @dev: dev to export the buffer from
+ * @file_priv: drm file-private structure
+ * @handle: buffer handle to export
+ * @flags: flags like DRM_CLOEXEC
+ * @prime_fd: pointer to storage for the fd id of the create dma-buf
+ *
+ * This is the PRIME export function which must be used mandatorily by GEM
+ * drivers to ensure correct lifetime management of the underlying GEM object.
+ * The actual exporting from GEM object to a dma-buf is done through the
+ * gem_prime_export driver callback.
+ */
 int drm_gem_prime_handle_to_fd(struct drm_device *dev,
-               struct drm_file *file_priv, uint32_t handle, uint32_t flags,
-               int *prime_fd)
+                              struct drm_file *file_priv, uint32_t handle,
+                              uint32_t flags,
+                              int *prime_fd)
 {
        struct drm_gem_object *obj;
        int ret = 0;
@@ -441,6 +473,14 @@ out_unlock:
 }
 EXPORT_SYMBOL(drm_gem_prime_handle_to_fd);
 
+/**
+ * drm_gem_prime_import - helper library implemention of the import callback
+ * @dev: drm_device to import into
+ * @dma_buf: dma-buf object to import
+ *
+ * This is the implementation of the gem_prime_import functions for GEM drivers
+ * using the PRIME helpers.
+ */
 struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
                                            struct dma_buf *dma_buf)
 {
@@ -496,8 +536,21 @@ fail_detach:
 }
 EXPORT_SYMBOL(drm_gem_prime_import);
 
+/**
+ * drm_gem_prime_fd_to_handle - PRIME import function for GEM drivers
+ * @dev: dev to export the buffer from
+ * @file_priv: drm file-private structure
+ * @prime_fd: fd id of the dma-buf which should be imported
+ * @handle: pointer to storage for the handle of the imported buffer object
+ *
+ * This is the PRIME import function which must be used mandatorily by GEM
+ * drivers to ensure correct lifetime management of the underlying GEM object.
+ * The actual importing of GEM object from the dma-buf is done through the
+ * gem_import_export driver callback.
+ */
 int drm_gem_prime_fd_to_handle(struct drm_device *dev,
-               struct drm_file *file_priv, int prime_fd, uint32_t *handle)
+                              struct drm_file *file_priv, int prime_fd,
+                              uint32_t *handle)
 {
        struct dma_buf *dma_buf;
        struct drm_gem_object *obj;
@@ -598,12 +651,14 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
                        args->fd, &args->handle);
 }
 
-/*
- * drm_prime_pages_to_sg
+/**
+ * drm_prime_pages_to_sg - converts a page array into an sg list
+ * @pages: pointer to the array of page pointers to convert
+ * @nr_pages: length of the page vector
  *
- * this helper creates an sg table object from a set of pages
+ * This helper creates an sg table object from a set of pages
  * the driver is responsible for mapping the pages into the
- * importers address space
+ * importers address space for use with dma_buf itself.
  */
 struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages)
 {
@@ -628,9 +683,16 @@ out:
 }
 EXPORT_SYMBOL(drm_prime_pages_to_sg);
 
-/* export an sg table into an array of pages and addresses
-   this is currently required by the TTM driver in order to do correct fault
-   handling */
+/**
+ * drm_prime_sg_to_page_addr_arrays - convert an sg table into a page array
+ * @sgt: scatter-gather table to convert
+ * @pages: array of page pointers to store the page array in
+ * @addrs: optional array to store the dma bus address of each page
+ * @max_pages: size of both the passed-in arrays
+ *
+ * Exports an sg table into an array of pages and addresses. This is currently
+ * required by the TTM driver in order to do correct fault handling.
+ */
 int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
                                     dma_addr_t *addrs, int max_pages)
 {
@@ -663,7 +725,15 @@ int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
        return 0;
 }
 EXPORT_SYMBOL(drm_prime_sg_to_page_addr_arrays);
-/* helper function to cleanup a GEM/prime object */
+
+/**
+ * drm_prime_gem_destroy - helper to clean up a PRIME-imported GEM object
+ * @obj: GEM object which was created from a dma-buf
+ * @sg: the sg-table which was pinned at import time
+ *
+ * This is the cleanup functions which GEM drivers need to call when they use
+ * @drm_gem_prime_import to import dma-bufs.
+ */
 void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg)
 {
        struct dma_buf_attachment *attach;
@@ -683,11 +753,9 @@ void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv)
        INIT_LIST_HEAD(&prime_fpriv->head);
        mutex_init(&prime_fpriv->lock);
 }
-EXPORT_SYMBOL(drm_prime_init_file_private);
 
 void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv)
 {
        /* by now drm_gem_release should've made sure the list is empty */
        WARN_ON(!list_empty(&prime_fpriv->head));
 }
-EXPORT_SYMBOL(drm_prime_destroy_file_private);
--

1.8.5.2

Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

#35 lore raw

Re: [PATCH 13/19] drm/doc: Add PRIME function references

Quoted 34 lines · David Herrmann

Hi

Quoted 15 lines · Daniel Vetter
Quoted 8 lines · David Herrmann

Hi

Quoted 5 lines · Daniel Vetter

For giant hilarity the DocBook reference overview is only generated when in a level 2 section, not in a level 3 section. So we need to move this up a bit as a side-by-side section to the main PRIME documentation.

Quoted 5 lines
Quoted 1 line

Whatever.

I tried digging through scripts/kernel-doc but.. ugh.. it's perl! No idea how to fix that. But sect2 seems fine as the whole section is PRIME-related.

Quoted 8 lines

Well we have two sect2 now: One for the PRIME overview, the other for the reference documenation. I've done the same split for drm_mm btw. If we want to fix this I think this is actually in the DocBook stylesheet, not in the kerneldoc thing. I've checked the intermediate xml and all the function references are there, they even get generated as html files and you can xref them from within the docbook. There's just no section topic for sect3 levels, so you never see a link to that separate page without an explicit reference.

Hm, why not this:

         </sect3>
Documentation/DocBook/drm.tmpl +3 -0
+       <title>PRIME Function References</title>
+!Edrivers/gpu/drm/drm_prime.c
+      </sect2>
Quoted 4 lines

So you just put it at the end of the prime-sect2?

The kernel-doc script at least has "<sect2>" hardcoded, but yeah, no idea where to fix that. So I think this is fine.

The only links generated are for the section toc, which is always at the top of the section. So if we combine it you'll have a pile of function references + the overview links for the subsections. Loosk rather bad imo. -Daniel

Quoted 284 lines

Thanks
David

Quoted 280 lines
Quoted 271 lines

Thanks
David

Quoted 266 lines

To have a complete set of references add the missing kerneldoc for all functions exported to modules with the exception of the file private init/destry functions - drivers have no business calling those, so let's just drop the EXPORT_SYMBOL instead.

Also reflow the function parameters to align correctly and break at 80 chars - my OCD couldn't stand them while writing the kerneldoc ;-)

---
 Documentation/DocBook/drm.tmpl |   6 ++-
 drivers/gpu/drm/drm_prime.c    | 110 +++++++++++++++++++++++++++++++++--------
 2 files changed, 94 insertions(+), 22 deletions(-)
Documentation/DocBook/drm.tmpl +5 -1
index 0cc1d85d04de..07abe52b1176 100644
@@ -898,10 +898,14 @@ struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
          </para>
        </sect3>
         <sect3>
-          <title>PRIME Helper Functions Reference</title>
+          <title>PRIME Helper Functions</title>
 !Pdrivers/gpu/drm/drm_prime.c PRIME Helpers
         </sect3>
       </sect2>
+      <sect2>
+       <title>PRIME Function References</title>
+!Edrivers/gpu/drm/drm_prime.c
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_prime.c +89 -22
index 56805c39c906..f1437b6c8dbf 100644
@@ -68,7 +68,8 @@ struct drm_prime_attachment {
        enum dma_data_direction dir;
 };
 
-static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv, struct dma_buf *dma_buf, uint32_t handle)
+static int drm_prime_add_buf_handle(struct drm_prime_file_private *prime_fpriv,
+                                   struct dma_buf *dma_buf, uint32_t handle)
 {
        struct drm_prime_member *member;
 
@@ -174,7 +175,7 @@ void drm_prime_remove_buf_handle_locked(struct drm_prime_file_private *prime_fpr
 }
 
 static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
-               enum dma_data_direction dir)
+                                           enum dma_data_direction dir)
 {
        struct drm_prime_attachment *prime_attach = attach->priv;
        struct drm_gem_object *obj = attach->dmabuf->priv;
@@ -211,11 +212,19 @@ static struct sg_table *drm_gem_map_dma_buf(struct dma_buf_attachment *attach,
 }
 
 static void drm_gem_unmap_dma_buf(struct dma_buf_attachment *attach,
-               struct sg_table *sgt, enum dma_data_direction dir)
+                                 struct sg_table *sgt,
+                                 enum dma_data_direction dir)
 {
        /* nothing to be done here */
 }
 
+/**
+ * drm_gem_dmabuf_release - dma_buf release implementation for GEM
+ * @dma_buf: buffer to be released
+ *
+ * Generic release function for dma_bufs exported as PRIME buffers. GEM drivers
+ * must use this in their dma_buf ops structure as the release callback.
+ */
 void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
 {
        struct drm_gem_object *obj = dma_buf->priv;
@@ -242,30 +251,30 @@ static void drm_gem_dmabuf_vunmap(struct dma_buf *dma_buf, void *vaddr)
 }
 
 static void *drm_gem_dmabuf_kmap_atomic(struct dma_buf *dma_buf,
-               unsigned long page_num)
+                                       unsigned long page_num)
 {
        return NULL;
 }
 
 static void drm_gem_dmabuf_kunmap_atomic(struct dma_buf *dma_buf,
-               unsigned long page_num, void *addr)
+                                        unsigned long page_num, void *addr)
 {
 
 }
 static void *drm_gem_dmabuf_kmap(struct dma_buf *dma_buf,
-               unsigned long page_num)
+                                unsigned long page_num)
 {
        return NULL;
 }
 
 static void drm_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
-               unsigned long page_num, void *addr)
+                                 unsigned long page_num, void *addr)
 {
 
 }
 
 static int drm_gem_dmabuf_mmap(struct dma_buf *dma_buf,
-               struct vm_area_struct *vma)
+                              struct vm_area_struct *vma)
 {
        struct drm_gem_object *obj = dma_buf->priv;
        struct drm_device *dev = obj->dev;
@@ -315,6 +324,15 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops =  {
  *    driver's scatter/gather table
  */
 
+/**
+ * drm_gem_prime_export - helper library implemention of the export callback
+ * @dev: drm_device to export from
+ * @obj: GEM object to export
+ * @flags: flags like DRM_CLOEXEC
+ *
+ * This is the implementation of the gem_prime_export functions for GEM drivers
+ * using the PRIME helpers.
+ */
 struct dma_buf *drm_gem_prime_export(struct drm_device *dev,
                                     struct drm_gem_object *obj, int flags)
 {
@@ -355,9 +373,23 @@ static struct dma_buf *export_and_register_object(struct drm_device *dev,
        return dmabuf;
 }
 
+/**
+ * drm_gem_prime_handle_to_fd - PRIME export function for GEM drivers
+ * @dev: dev to export the buffer from
+ * @file_priv: drm file-private structure
+ * @handle: buffer handle to export
+ * @flags: flags like DRM_CLOEXEC
+ * @prime_fd: pointer to storage for the fd id of the create dma-buf
+ *
+ * This is the PRIME export function which must be used mandatorily by GEM
+ * drivers to ensure correct lifetime management of the underlying GEM object.
+ * The actual exporting from GEM object to a dma-buf is done through the
+ * gem_prime_export driver callback.
+ */
 int drm_gem_prime_handle_to_fd(struct drm_device *dev,
-               struct drm_file *file_priv, uint32_t handle, uint32_t flags,
-               int *prime_fd)
+                              struct drm_file *file_priv, uint32_t handle,
+                              uint32_t flags,
+                              int *prime_fd)
 {
        struct drm_gem_object *obj;
        int ret = 0;
@@ -441,6 +473,14 @@ out_unlock:
 }
 EXPORT_SYMBOL(drm_gem_prime_handle_to_fd);
 
+/**
+ * drm_gem_prime_import - helper library implemention of the import callback
+ * @dev: drm_device to import into
+ * @dma_buf: dma-buf object to import
+ *
+ * This is the implementation of the gem_prime_import functions for GEM drivers
+ * using the PRIME helpers.
+ */
 struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
                                            struct dma_buf *dma_buf)
 {
@@ -496,8 +536,21 @@ fail_detach:
 }
 EXPORT_SYMBOL(drm_gem_prime_import);
 
+/**
+ * drm_gem_prime_fd_to_handle - PRIME import function for GEM drivers
+ * @dev: dev to export the buffer from
+ * @file_priv: drm file-private structure
+ * @prime_fd: fd id of the dma-buf which should be imported
+ * @handle: pointer to storage for the handle of the imported buffer object
+ *
+ * This is the PRIME import function which must be used mandatorily by GEM
+ * drivers to ensure correct lifetime management of the underlying GEM object.
+ * The actual importing of GEM object from the dma-buf is done through the
+ * gem_import_export driver callback.
+ */
 int drm_gem_prime_fd_to_handle(struct drm_device *dev,
-               struct drm_file *file_priv, int prime_fd, uint32_t *handle)
+                              struct drm_file *file_priv, int prime_fd,
+                              uint32_t *handle)
 {
        struct dma_buf *dma_buf;
        struct drm_gem_object *obj;
@@ -598,12 +651,14 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
                        args->fd, &args->handle);
 }
 
-/*
- * drm_prime_pages_to_sg
+/**
+ * drm_prime_pages_to_sg - converts a page array into an sg list
+ * @pages: pointer to the array of page pointers to convert
+ * @nr_pages: length of the page vector
  *
- * this helper creates an sg table object from a set of pages
+ * This helper creates an sg table object from a set of pages
  * the driver is responsible for mapping the pages into the
- * importers address space
+ * importers address space for use with dma_buf itself.
  */
 struct sg_table *drm_prime_pages_to_sg(struct page **pages, int nr_pages)
 {
@@ -628,9 +683,16 @@ out:
 }
 EXPORT_SYMBOL(drm_prime_pages_to_sg);
 
-/* export an sg table into an array of pages and addresses
-   this is currently required by the TTM driver in order to do correct fault
-   handling */
+/**
+ * drm_prime_sg_to_page_addr_arrays - convert an sg table into a page array
+ * @sgt: scatter-gather table to convert
+ * @pages: array of page pointers to store the page array in
+ * @addrs: optional array to store the dma bus address of each page
+ * @max_pages: size of both the passed-in arrays
+ *
+ * Exports an sg table into an array of pages and addresses. This is currently
+ * required by the TTM driver in order to do correct fault handling.
+ */
 int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
                                     dma_addr_t *addrs, int max_pages)
 {
@@ -663,7 +725,15 @@ int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages,
        return 0;
 }
 EXPORT_SYMBOL(drm_prime_sg_to_page_addr_arrays);
-/* helper function to cleanup a GEM/prime object */
+
+/**
+ * drm_prime_gem_destroy - helper to clean up a PRIME-imported GEM object
+ * @obj: GEM object which was created from a dma-buf
+ * @sg: the sg-table which was pinned at import time
+ *
+ * This is the cleanup functions which GEM drivers need to call when they use
+ * @drm_gem_prime_import to import dma-bufs.
+ */
 void drm_prime_gem_destroy(struct drm_gem_object *obj, struct sg_table *sg)
 {
        struct dma_buf_attachment *attach;
@@ -683,11 +753,9 @@ void drm_prime_init_file_private(struct drm_prime_file_private *prime_fpriv)
        INIT_LIST_HEAD(&prime_fpriv->head);
        mutex_init(&prime_fpriv->lock);
 }
-EXPORT_SYMBOL(drm_prime_init_file_private);
 
 void drm_prime_destroy_file_private(struct drm_prime_file_private *prime_fpriv)
 {
        /* by now drm_gem_release should've made sure the list is empty */
        WARN_ON(!list_empty(&prime_fpriv->head));
 }
-EXPORT_SYMBOL(drm_prime_destroy_file_private);
--

1.8.5.2

Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#36 lore raw

PATCH 14/19 drm/doc: Update copyright

In reply to Daniel Vetter

I've done quite a bit of cleanups, clarifications and mostly integrating kerneldoc. So I guess I should add myself.

Also split up the copyright notices per holder to make it clear which year ranges are covered.

---
 Documentation/DocBook/drm.tmpl | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
Documentation/DocBook/drm.tmpl +15 -1
index 07abe52b1176..ede383af1868 100644
@@ -29,12 +29,26 @@
 	  </address>
 	</affiliation>
       </author>
+      <author>
+	<firstname>Daniel</firstname>
+	<surname>Vetter</surname>
+	<contrib>Contributions all over the place</contrib>
+	<affiliation>
+	  <orgname>Intel Corporation</orgname>
+	  <address>
+	    <email>[email protected]</email>
+	  </address>
+	</affiliation>
+      </author>
     </authorgroup>
 
     <copyright>
       <year>2008-2009</year>
-      <year>2012</year>
+      <year>2013-2014</year>
       <holder>Intel Corporation</holder>
+    </copyright>
+    <copyright>
+      <year>2012</year>
       <holder>Laurent Pinchart</holder>
     </copyright>
 
Signature · 1 line
1.8.5.2
#37 lore raw

PATCH 15/19 drm/mm: Remove MM_UNUSED_TARGET

In reply to Daniel Vetter

This was missed in

commit c700c67bae6698fbc6bd20e2ae5dc62ddd367b3b

Author: David Herrmann <[email protected]>
Date:   Sat Jul 27 13:39:28 2013 +0200

drm/mm: remove unused API

---
 drivers/gpu/drm/drm_mm.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/drm_mm.c +0 -2
index af93cc55259f..d0a8e8482fe0 100644
@@ -47,8 +47,6 @@
 #include <linux/seq_file.h>
 #include <linux/export.h>
 
-#define MM_UNUSED_TARGET 4
-
 static struct drm_mm_node *drm_mm_search_free_generic(const struct drm_mm *mm,
 						unsigned long size,
 						unsigned alignment,
Signature · 1 line
1.8.5.2
#38 lore raw

PATCH 16/19 drm/doc: Overview documentation for drm_mm.c

In reply to Daniel Vetter

kerneldoc polish will follow in the next patch.

Hopefully documenting the lru scan support a bit better spurse someone to give this a shot in the ttm eviction code. At least in i915 it helped quite a lot with memory thrashing on platforms where eviction was (we've fixed that too meanwhile) fairly expensive.

---
 Documentation/DocBook/drm.tmpl | 11 +++++++
 drivers/gpu/drm/drm_mm.c       | 67 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)
Documentation/DocBook/drm.tmpl +11 -0
index ede383af1868..c6f916989b92 100644
@@ -920,6 +920,17 @@ struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
 	<title>PRIME Function References</title>
 !Edrivers/gpu/drm/drm_prime.c
       </sect2>
+      <sect2>
+	<title>DRM MM Range Allocator</title>
+	<sect3>
+	  <title>Overview</title>
+!Pdrivers/gpu/drm/drm_mm.c Overview
+	</sect3>
+	<sect3>
+	  <title>LRU Scan/Eviction Support</title>
+!Pdrivers/gpu/drm/drm_mm.c lru scan roaster
+	</sect3>
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_mm.c +67 -0

79 lines not on this page · raw message

Signature · 1 line
1.8.5.2
#39 lore raw

PATCH 17/19 drm/doc: Add fucntion reference documentation for drm_mm.c

In reply to Daniel Vetter

While at it do a tiny bit of interface cleanup and convert boolean return values to bool. With this patch all exported functions and inline helpers which are part of the drm_mm public interface are documented.

Also drop superflous extern function modifiers since most of drm_mm.h doesn't use them - more consistent that way.

---
 Documentation/DocBook/drm.tmpl |   5 ++
 drivers/gpu/drm/drm_mm.c       | 144 ++++++++++++++++++++++++++++++++------
 include/drm/drm_mm.h           | 154 +++++++++++++++++++++++++++++++++--------
 3 files changed, 251 insertions(+), 52 deletions(-)
Documentation/DocBook/drm.tmpl +5 -0
index c6f916989b92..d36e97126f59 100644
@@ -931,6 +931,11 @@ struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev,
 !Pdrivers/gpu/drm/drm_mm.c lru scan roaster
 	</sect3>
       </sect2>
+      <sect2>
+	<title>DRM MM Range Allocator Function References</title>
+!Edrivers/gpu/drm/drm_mm.c
+!Iinclude/drm/drm_mm.h
+      </sect2>
   </sect1>
 
   <!-- Internals: mode setting -->
drivers/gpu/drm/drm_mm.c +121 -23

251 lines not on this page · raw message

include/drm/drm_mm.h +125 -29

211 lines not on this page · raw message

Signature · 1 line
1.8.5.2
#40 lore raw

PATCH 18/19 drm/kms: rip out drm_mode_connector_detach_encoder

In reply to Daniel Vetter

It's only used by imx, and that one gets it wrong - there's no need to deteach the encoder before removing it.

And really, neither current drm modesetting code nor all the userspace we have can handle dynamic changes in the set of possible encoders for a given connector. So let's just remove this before someone starts doing something really nasty with it.

As a plus, one less kerneldoc comment to write.

Cc Sascha Hauer <[email protected]>
Cc Russell King <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/gpu/drm/drm_crtc.c                 | 15 ---------------
 drivers/staging/imx-drm/imx-ldb.c          |  2 --
 drivers/staging/imx-drm/parallel-display.c |  2 --
 include/drm/drm_crtc.h                     |  2 --
 4 files changed, 21 deletions(-)
drivers/gpu/drm/drm_crtc.c +0 -15
index 266a01d7f635..cf134540b675 100644
@@ -3460,21 +3460,6 @@ int drm_mode_connector_attach_encoder(struct drm_connector *connector,
 }
 EXPORT_SYMBOL(drm_mode_connector_attach_encoder);
 
-void drm_mode_connector_detach_encoder(struct drm_connector *connector,
-				    struct drm_encoder *encoder)
-{
-	int i;
-	for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
-		if (connector->encoder_ids[i] == encoder->base.id) {
-			connector->encoder_ids[i] = 0;
-			if (connector->encoder == encoder)
-				connector->encoder = NULL;
-			break;
-		}
-	}
-}
-EXPORT_SYMBOL(drm_mode_connector_detach_encoder);
-
 int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
 				  int gamma_size)
 {
drivers/staging/imx-drm/imx-ldb.c +0 -2
index 654bf03e05ff..16946b7dde96 100644
@@ -596,8 +596,6 @@ static int imx_ldb_remove(struct platform_device *pdev)
 		struct drm_connector *connector = &channel->connector;
 		struct drm_encoder *encoder = &channel->encoder;
 
-		drm_mode_connector_detach_encoder(connector, encoder);
-
 		imx_drm_remove_connector(channel->imx_drm_connector);
 		imx_drm_remove_encoder(channel->imx_drm_encoder);
 	}
drivers/staging/imx-drm/parallel-display.c +0 -2
index 24aa9beedcfb..e36dd2b24c93 100644
@@ -243,8 +243,6 @@ static int imx_pd_remove(struct platform_device *pdev)
 	struct drm_connector *connector = &imxpd->connector;
 	struct drm_encoder *encoder = &imxpd->encoder;
 
-	drm_mode_connector_detach_encoder(connector, encoder);
-
 	imx_drm_remove_connector(imxpd->imx_drm_connector);
 	imx_drm_remove_encoder(imxpd->imx_drm_encoder);
 
include/drm/drm_crtc.h +0 -2
index e51e8975dd6f..68d23acc4ffa 100644
@@ -1052,8 +1052,6 @@ extern const char *drm_get_encoder_name(const struct drm_encoder *encoder);
 
 extern int drm_mode_connector_attach_encoder(struct drm_connector *connector,
 					     struct drm_encoder *encoder);
-extern void drm_mode_connector_detach_encoder(struct drm_connector *connector,
-					   struct drm_encoder *encoder);
 extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
 					 int gamma_size);
 extern struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
Signature · 1 line
1.8.5.2
#41 lore raw

PATCH 19/19 drm/kms: don't export drm_mode_group_init_legacy_group

In reply to Daniel Vetter

Driver modules really don't have much business frobbing around with
this: Splitting up modeset resources (if we ever get around to enable this for real) should be something purely controlled and managed by the drm core in a driver-agnostic fashion. As usual imx disagrees, but that's due to the convoluted setup sequence. Russell King is working on a proper fix for that, so this patch needs to wait for those to land to avoid breaking imx.

Cc Sascha Hauer <[email protected]>
Cc Russell King <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/gpu/drm/drm_crtc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_crtc.c +0 -1
index cf134540b675..98084413a842 100644
@@ -1264,7 +1264,6 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev,
 
 	return 0;
 }
-EXPORT_SYMBOL(drm_mode_group_init_legacy_group);
 
 /**
  * drm_crtc_convert_to_umode - convert a drm_display_mode into a modeinfo
Signature · 1 line
1.8.5.2
#42 lore raw

Re: [PATCH 19/19] drm/kms: don't export drm_mode_group_init_legacy_group

Hi

Quoted 7 lines · Daniel Vetter

Driver modules really don't have much business frobbing around with
this: Splitting up modeset resources (if we ever get around to enable this for real) should be something purely controlled and managed by the drm core in a driver-agnostic fashion. As usual imx disagrees, but that's due to the convoluted setup sequence. Russell King is working on a proper fix for that, so this patch needs to wait for those to land to avoid breaking imx.

I tried working on "modeset-object splitting" as part of the DRM-Master rework, but that's all really racy and we'd break current user-space. For instance the object-indices (compared to object-IDs) need to be constant, but with our current object-lists, removing an object will change indices (thus breaking possible_crtcs/encoders).

There are ways to make that work, but it'd require huge drm_crtc.c changes. And I also think our locking doesn't provide for that. Furthermore, resource-retrieval is not atomic (we need multiple
ioctls: GetResources, GetCrtc, ...) so if we change the objects in between, we may break running apps in a subtle way.

So I'm all for making object-lists immutable after drm_dev_register() was called. Imo, hardware should wait for all sub-devices to be present and then call drm_dev_register(). Once the first sub-device is removed, you call drm_dev_unregister(). And I think that's what Russel's compound-device infrastructure does by hiding the sub-devices in a compound device.

If there's ever hardware that truly supports sub-device hotplugging, we can support that by adding a DRM-ClientCap like 3D modes. But as I understand, the current hardware is still a single piece of hardware which just might get probed via different buses and thus is not an atomic entity. So the device is still hotplugged as a whole, we just don't get the events through a single path.

Thanks
David

Quoted 28 lines
Cc Sascha Hauer <[email protected]>
Cc Russell King <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/gpu/drm/drm_crtc.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_crtc.c +0 -2
index cf134540b675..98084413a842 100644
@@ -1264,7 +1264,6 @@ int drm_mode_group_init_legacy_group(struct drm_device *dev,
 
        return 0;
 }
-EXPORT_SYMBOL(drm_mode_group_init_legacy_group);
 
 /**
  * drm_crtc_convert_to_umode - convert a drm_display_mode into a modeinfo
--

1.8.5.2

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#43 lore raw

Re: [PATCH 19/19] drm/kms: don't export drm_mode_group_init_legacy_group

Quoted 30 lines · David Herrmann

Hi

Quoted 7 lines · Daniel Vetter

Driver modules really don't have much business frobbing around with
this: Splitting up modeset resources (if we ever get around to enable this for real) should be something purely controlled and managed by the drm core in a driver-agnostic fashion. As usual imx disagrees, but that's due to the convoluted setup sequence. Russell King is working on a proper fix for that, so this patch needs to wait for those to land to avoid breaking imx.

I tried working on "modeset-object splitting" as part of the DRM-Master rework, but that's all really racy and we'd break current user-space. For instance the object-indices (compared to object-IDs) need to be constant, but with our current object-lists, removing an object will change indices (thus breaking possible_crtcs/encoders).

There are ways to make that work, but it'd require huge drm_crtc.c changes. And I also think our locking doesn't provide for that. Furthermore, resource-retrieval is not atomic (we need multiple
ioctls: GetResources, GetCrtc, ...) so if we change the objects in between, we may break running apps in a subtle way.

So I'm all for making object-lists immutable after drm_dev_register() was called. Imo, hardware should wait for all sub-devices to be present and then call drm_dev_register(). Once the first sub-device is removed, you call drm_dev_unregister(). And I think that's what Russel's compound-device infrastructure does by hiding the sub-devices in a compound device.

Quoted 6 lines

If there's ever hardware that truly supports sub-device hotplugging, we can support that by adding a DRM-ClientCap like 3D modes. But as I understand, the current hardware is still a single piece of hardware which just might get probed via different buses and thus is not an atomic entity. So the device is still hotplugged as a whole, we just don't get the events through a single path.

Yeah, if we ever want to allow hotplugging after driver setup that's massive work to do it right. Which is why I want to plug this hole here before someone sneaks in for real ;-)
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#44 lore raw

Re: [PATCH 19/19] drm/kms: don't export drm_mode_group_init_legacy_group

Quoted 11 lines · Daniel Vetter
Quoted 6 lines · David Herrmann

If there's ever hardware that truly supports sub-device hotplugging, we can support that by adding a DRM-ClientCap like 3D modes. But as I understand, the current hardware is still a single piece of hardware which just might get probed via different buses and thus is not an atomic entity. So the device is still hotplugged as a whole, we just don't get the events through a single path.

Yeah, if we ever want to allow hotplugging after driver setup that's massive work to do it right. Which is why I want to plug this hole here before someone sneaks in for real ;-)

David did say at the kernel summit that he's not interested at all in hotplugging the components of a DRM system, and his statement appeared to be very clear in that regard that it was never going to happen.

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
#45 lore raw

Re: [PATCH 19/19] drm/kms: don't export drm_mode_group_init_legacy_group

Quoted 9 lines · Russell King - ARM Linux
Quoted 8 lines · Daniel Vetter
Quoted 6 lines · David Herrmann

If there's ever hardware that truly supports sub-device hotplugging, we can support that by adding a DRM-ClientCap like 3D modes. But as I understand, the current hardware is still a single piece of hardware which just might get probed via different buses and thus is not an atomic entity. So the device is still hotplugged as a whole, we just don't get the events through a single path.

Quoted 7 lines
Quoted 3 lines

Yeah, if we ever want to allow hotplugging after driver setup that's massive work to do it right. Which is why I want to plug this hole here before someone sneaks in for real ;-)

David did say at the kernel summit that he's not interested at all in hotplugging the components of a DRM system, and his statement appeared to be very clear in that regard that it was never going to happen.

I think we eventually need to be able to hot-plug connectors (and maybe encoders) to support fancy dp1.2 output routing and multiple streams over the same cable. But I agree that hotplugging crtcs is insane and better done by hotplugging an entire drm device with that crtc. In any case not something to worry about right now.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch