aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook/drm.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/DocBook/drm.tmpl')
-rw-r--r--Documentation/DocBook/drm.tmpl59
1 files changed, 45 insertions, 14 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
index caab791b0a6c..6c11d77c8d02 100644
--- a/Documentation/DocBook/drm.tmpl
+++ b/Documentation/DocBook/drm.tmpl
@@ -978,10 +978,25 @@ int max_width, max_height;</synopsis>
978 If the parameters are deemed valid, drivers then create, initialize and 978 If the parameters are deemed valid, drivers then create, initialize and
979 return an instance of struct <structname>drm_framebuffer</structname>. 979 return an instance of struct <structname>drm_framebuffer</structname>.
980 If desired the instance can be embedded in a larger driver-specific 980 If desired the instance can be embedded in a larger driver-specific
981 structure. The new instance is initialized with a call to 981 structure. Drivers must fill its <structfield>width</structfield>,
982 <function>drm_framebuffer_init</function> which takes a pointer to DRM 982 <structfield>height</structfield>, <structfield>pitches</structfield>,
983 frame buffer operations (struct 983 <structfield>offsets</structfield>, <structfield>depth</structfield>,
984 <structname>drm_framebuffer_funcs</structname>). Frame buffer operations are 984 <structfield>bits_per_pixel</structfield> and
985 <structfield>pixel_format</structfield> fields from the values passed
986 through the <parameter>drm_mode_fb_cmd2</parameter> argument. They
987 should call the <function>drm_helper_mode_fill_fb_struct</function>
988 helper function to do so.
989 </para>
990
991 <para>
992 The initailization of the new framebuffer instance is finalized with a
993 call to <function>drm_framebuffer_init</function> which takes a pointer
994 to DRM frame buffer operations (struct
995 <structname>drm_framebuffer_funcs</structname>). Note that this function
996 publishes the framebuffer and so from this point on it can be accessed
997 concurrently from other threads. Hence it must be the last step in the
998 driver's framebuffer initialization sequence. Frame buffer operations
999 are
985 <itemizedlist> 1000 <itemizedlist>
986 <listitem> 1001 <listitem>
987 <synopsis>int (*create_handle)(struct drm_framebuffer *fb, 1002 <synopsis>int (*create_handle)(struct drm_framebuffer *fb,
@@ -1022,16 +1037,16 @@ int max_width, max_height;</synopsis>
1022 </itemizedlist> 1037 </itemizedlist>
1023 </para> 1038 </para>
1024 <para> 1039 <para>
1025 After initializing the <structname>drm_framebuffer</structname> 1040 The lifetime of a drm framebuffer is controlled with a reference count,
1026 instance drivers must fill its <structfield>width</structfield>, 1041 drivers can grab additional references with
1027 <structfield>height</structfield>, <structfield>pitches</structfield>, 1042 <function>drm_framebuffer_reference</function> </para> and drop them
1028 <structfield>offsets</structfield>, <structfield>depth</structfield>, 1043 again with <function>drm_framebuffer_unreference</function>. For
1029 <structfield>bits_per_pixel</structfield> and 1044 driver-private framebuffers for which the last reference is never
1030 <structfield>pixel_format</structfield> fields from the values passed 1045 dropped (e.g. for the fbdev framebuffer when the struct
1031 through the <parameter>drm_mode_fb_cmd2</parameter> argument. They 1046 <structname>drm_framebuffer</structname> is embedded into the fbdev
1032 should call the <function>drm_helper_mode_fill_fb_struct</function> 1047 helper struct) drivers can manually clean up a framebuffer at module
1033 helper function to do so. 1048 unload time with
1034 </para> 1049 <function>drm_framebuffer_unregister_private</function>.
1035 </sect2> 1050 </sect2>
1036 <sect2> 1051 <sect2>
1037 <title>Output Polling</title> 1052 <title>Output Polling</title>
@@ -1043,6 +1058,22 @@ int max_width, max_height;</synopsis>
1043 operation. 1058 operation.
1044 </para> 1059 </para>
1045 </sect2> 1060 </sect2>
1061 <sect2>
1062 <title>Locking</title>
1063 <para>
1064 Beside some lookup structures with their own locking (which is hidden
1065 behind the interface functions) most of the modeset state is protected
1066 by the <code>dev-&lt;mode_config.lock</code> mutex and additionally
1067 per-crtc locks to allow cursor updates, pageflips and similar operations
1068 to occur concurrently with background tasks like output detection.
1069 Operations which cross domains like a full modeset always grab all
1070 locks. Drivers there need to protect resources shared between crtcs with
1071 additional locking. They also need to be careful to always grab the
1072 relevant crtc locks if a modset functions touches crtc state, e.g. for
1073 load detection (which does only grab the <code>mode_config.lock</code>
1074 to allow concurrent screen updates on live crtcs).
1075 </para>
1076 </sect2>
1046 </sect1> 1077 </sect1>
1047 1078
1048 <!-- Internals: kms initialization and cleanup --> 1079 <!-- Internals: kms initialization and cleanup -->