Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/doc: Document the KMS property API

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by

Laurent Pinchart and committed by
Dave Airlie
421cda3e 02c030a7

+143
+143
Documentation/DocBook/drm.tmpl
··· 1236 1236 <title>Miscellaneous</title> 1237 1237 <itemizedlist> 1238 1238 <listitem> 1239 + <synopsis>void (*set_property)(struct drm_crtc *crtc, 1240 + struct drm_property *property, uint64_t value);</synopsis> 1241 + <para> 1242 + Set the value of the given CRTC property to 1243 + <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/> 1244 + for more information about properties. 1245 + </para> 1246 + </listitem> 1247 + <listitem> 1239 1248 <synopsis>void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 1240 1249 uint32_t start, uint32_t size);</synopsis> 1241 1250 <para> ··· 1392 1383 <para> 1393 1384 Called to destroy the encoder when not needed anymore. See 1394 1385 <xref linkend="drm-kms-init"/>. 1386 + </para> 1387 + </listitem> 1388 + <listitem> 1389 + <synopsis>void (*set_property)(struct drm_plane *plane, 1390 + struct drm_property *property, uint64_t value);</synopsis> 1391 + <para> 1392 + Set the value of the given plane property to 1393 + <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/> 1394 + for more information about properties. 1395 1395 </para> 1396 1396 </listitem> 1397 1397 </itemizedlist> ··· 1611 1593 <sect4> 1612 1594 <title>Miscellaneous</title> 1613 1595 <itemizedlist> 1596 + <listitem> 1597 + <synopsis>void (*set_property)(struct drm_connector *connector, 1598 + struct drm_property *property, uint64_t value);</synopsis> 1599 + <para> 1600 + Set the value of the given connector property to 1601 + <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/> 1602 + for more information about properties. 1603 + </para> 1604 + </listitem> 1614 1605 <listitem> 1615 1606 <synopsis>void (*destroy)(struct drm_connector *connector);</synopsis> 1616 1607 <para> ··· 2212 2185 !Iinclude/drm/drm_rect.h 2213 2186 !Edrivers/gpu/drm/drm_rect.c 2214 2187 </sect2> 2188 + </sect1> 2189 + 2190 + <!-- Internals: kms properties --> 2191 + 2192 + <sect1 id="drm-kms-properties"> 2193 + <title>KMS Properties</title> 2194 + <para> 2195 + Drivers may need to expose additional parameters to applications than 2196 + those described in the previous sections. KMS supports attaching 2197 + properties to CRTCs, connectors and planes and offers a userspace API to 2198 + list, get and set the property values. 2199 + </para> 2200 + <para> 2201 + Properties are identified by a name that uniquely defines the property 2202 + purpose, and store an associated value. For all property types except blob 2203 + properties the value is a 64-bit unsigned integer. 2204 + </para> 2205 + <para> 2206 + KMS differentiates between properties and property instances. Drivers 2207 + first create properties and then create and associate individual instances 2208 + of those properties to objects. A property can be instantiated multiple 2209 + times and associated with different objects. Values are stored in property 2210 + instances, and all other property information are stored in the propery 2211 + and shared between all instances of the property. 2212 + </para> 2213 + <para> 2214 + Every property is created with a type that influences how the KMS core 2215 + handles the property. Supported property types are 2216 + <variablelist> 2217 + <varlistentry> 2218 + <term>DRM_MODE_PROP_RANGE</term> 2219 + <listitem><para>Range properties report their minimum and maximum 2220 + admissible values. The KMS core verifies that values set by 2221 + application fit in that range.</para></listitem> 2222 + </varlistentry> 2223 + <varlistentry> 2224 + <term>DRM_MODE_PROP_ENUM</term> 2225 + <listitem><para>Enumerated properties take a numerical value that 2226 + ranges from 0 to the number of enumerated values defined by the 2227 + property minus one, and associate a free-formed string name to each 2228 + value. Applications can retrieve the list of defined value-name pairs 2229 + and use the numerical value to get and set property instance values. 2230 + </para></listitem> 2231 + </varlistentry> 2232 + <varlistentry> 2233 + <term>DRM_MODE_PROP_BITMASK</term> 2234 + <listitem><para>Bitmask properties are enumeration properties that 2235 + additionally restrict all enumerated values to the 0..63 range. 2236 + Bitmask property instance values combine one or more of the 2237 + enumerated bits defined by the property.</para></listitem> 2238 + </varlistentry> 2239 + <varlistentry> 2240 + <term>DRM_MODE_PROP_BLOB</term> 2241 + <listitem><para>Blob properties store a binary blob without any format 2242 + restriction. The binary blobs are created as KMS standalone objects, 2243 + and blob property instance values store the ID of their associated 2244 + blob object.</para> 2245 + <para>Blob properties are only used for the connector EDID property 2246 + and cannot be created by drivers.</para></listitem> 2247 + </varlistentry> 2248 + </variablelist> 2249 + </para> 2250 + <para> 2251 + To create a property drivers call one of the following functions depending 2252 + on the property type. All property creation functions take property flags 2253 + and name, as well as type-specific arguments. 2254 + <itemizedlist> 2255 + <listitem> 2256 + <synopsis>struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, 2257 + const char *name, 2258 + uint64_t min, uint64_t max);</synopsis> 2259 + <para>Create a range property with the given minimum and maximum 2260 + values.</para> 2261 + </listitem> 2262 + <listitem> 2263 + <synopsis>struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, 2264 + const char *name, 2265 + const struct drm_prop_enum_list *props, 2266 + int num_values);</synopsis> 2267 + <para>Create an enumerated property. The <parameter>props</parameter> 2268 + argument points to an array of <parameter>num_values</parameter> 2269 + value-name pairs.</para> 2270 + </listitem> 2271 + <listitem> 2272 + <synopsis>struct drm_property *drm_property_create_bitmask(struct drm_device *dev, 2273 + int flags, const char *name, 2274 + const struct drm_prop_enum_list *props, 2275 + int num_values);</synopsis> 2276 + <para>Create a bitmask property. The <parameter>props</parameter> 2277 + argument points to an array of <parameter>num_values</parameter> 2278 + value-name pairs.</para> 2279 + </listitem> 2280 + </itemizedlist> 2281 + </para> 2282 + <para> 2283 + Properties can additionally be created as immutable, in which case they 2284 + will be read-only for applications but can be modified by the driver. To 2285 + create an immutable property drivers must set the DRM_MODE_PROP_IMMUTABLE 2286 + flag at property creation time. 2287 + </para> 2288 + <para> 2289 + When no array of value-name pairs is readily available at property 2290 + creation time for enumerated or range properties, drivers can create 2291 + the property using the <function>drm_property_create</function> function 2292 + and manually add enumeration value-name pairs by calling the 2293 + <function>drm_property_add_enum</function> function. Care must be taken to 2294 + properly specify the property type through the <parameter>flags</parameter> 2295 + argument. 2296 + </para> 2297 + <para> 2298 + After creating properties drivers can attach property instances to CRTC, 2299 + connector and plane objects by calling the 2300 + <function>drm_object_attach_property</function>. The function takes a 2301 + pointer to the target object, a pointer to the previously created property 2302 + and an initial instance value. 2303 + </para> 2215 2304 </sect1> 2216 2305 2217 2306 <!-- Internals: vertical blanking -->