diff options
| author | Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> | 2013-06-22 10:10:30 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2013-06-28 00:43:07 -0400 |
| commit | 421cda3e324fce40e3f7abdf3d31cae1d0deddcd (patch) | |
| tree | 98f65b2371c17bb0cc800818d79b1ac67faf5428 | |
| parent | 02c030a718e7fc6e066c6169c195f53b461df408 (diff) | |
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>
| -rw-r--r-- | Documentation/DocBook/drm.tmpl | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index cea420dc712d..4d54ac8b2032 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
| @@ -1236,6 +1236,15 @@ int max_width, max_height;</synopsis> | |||
| 1236 | <title>Miscellaneous</title> | 1236 | <title>Miscellaneous</title> |
| 1237 | <itemizedlist> | 1237 | <itemizedlist> |
| 1238 | <listitem> | 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 | <synopsis>void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, | 1248 | <synopsis>void (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, |
| 1240 | uint32_t start, uint32_t size);</synopsis> | 1249 | uint32_t start, uint32_t size);</synopsis> |
| 1241 | <para> | 1250 | <para> |
| @@ -1385,6 +1394,15 @@ int max_width, max_height;</synopsis> | |||
| 1385 | <xref linkend="drm-kms-init"/>. | 1394 | <xref linkend="drm-kms-init"/>. |
| 1386 | </para> | 1395 | </para> |
| 1387 | </listitem> | 1396 | </listitem> |
| 1397 | <listitem> | ||
| 1398 | <synopsis>void (*set_property)(struct drm_plane *plane, | ||
| 1399 | struct drm_property *property, uint64_t value);</synopsis> | ||
| 1400 | <para> | ||
| 1401 | Set the value of the given plane property to | ||
| 1402 | <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/> | ||
| 1403 | for more information about properties. | ||
| 1404 | </para> | ||
| 1405 | </listitem> | ||
| 1388 | </itemizedlist> | 1406 | </itemizedlist> |
| 1389 | </sect3> | 1407 | </sect3> |
| 1390 | </sect2> | 1408 | </sect2> |
| @@ -1594,6 +1612,15 @@ int max_width, max_height;</synopsis> | |||
| 1594 | <title>Miscellaneous</title> | 1612 | <title>Miscellaneous</title> |
| 1595 | <itemizedlist> | 1613 | <itemizedlist> |
| 1596 | <listitem> | 1614 | <listitem> |
| 1615 | <synopsis>void (*set_property)(struct drm_connector *connector, | ||
| 1616 | struct drm_property *property, uint64_t value);</synopsis> | ||
| 1617 | <para> | ||
| 1618 | Set the value of the given connector property to | ||
| 1619 | <parameter>value</parameter>. See <xref linkend="drm-kms-properties"/> | ||
| 1620 | for more information about properties. | ||
| 1621 | </para> | ||
| 1622 | </listitem> | ||
| 1623 | <listitem> | ||
| 1597 | <synopsis>void (*destroy)(struct drm_connector *connector);</synopsis> | 1624 | <synopsis>void (*destroy)(struct drm_connector *connector);</synopsis> |
| 1598 | <para> | 1625 | <para> |
| 1599 | Destroy the connector when not needed anymore. See | 1626 | Destroy the connector when not needed anymore. See |
| @@ -2187,6 +2214,122 @@ void intel_crt_init(struct drm_device *dev) | |||
| 2187 | </sect2> | 2214 | </sect2> |
| 2188 | </sect1> | 2215 | </sect1> |
| 2189 | 2216 | ||
| 2217 | <!-- Internals: kms properties --> | ||
| 2218 | |||
| 2219 | <sect1 id="drm-kms-properties"> | ||
| 2220 | <title>KMS Properties</title> | ||
| 2221 | <para> | ||
| 2222 | Drivers may need to expose additional parameters to applications than | ||
| 2223 | those described in the previous sections. KMS supports attaching | ||
| 2224 | properties to CRTCs, connectors and planes and offers a userspace API to | ||
| 2225 | list, get and set the property values. | ||
| 2226 | </para> | ||
| 2227 | <para> | ||
| 2228 | Properties are identified by a name that uniquely defines the property | ||
| 2229 | purpose, and store an associated value. For all property types except blob | ||
| 2230 | properties the value is a 64-bit unsigned integer. | ||
| 2231 | </para> | ||
| 2232 | <para> | ||
| 2233 | KMS differentiates between properties and property instances. Drivers | ||
| 2234 | first create properties and then create and associate individual instances | ||
| 2235 | of those properties to objects. A property can be instantiated multiple | ||
| 2236 | times and associated with different objects. Values are stored in property | ||
| 2237 | instances, and all other property information are stored in the propery | ||
| 2238 | and shared between all instances of the property. | ||
| 2239 | </para> | ||
| 2240 | <para> | ||
| 2241 | Every property is created with a type that influences how the KMS core | ||
| 2242 | handles the property. Supported property types are | ||
| 2243 | <variablelist> | ||
| 2244 | <varlistentry> | ||
| 2245 | <term>DRM_MODE_PROP_RANGE</term> | ||
| 2246 | <listitem><para>Range properties report their minimum and maximum | ||
| 2247 | admissible values. The KMS core verifies that values set by | ||
| 2248 | application fit in that range.</para></listitem> | ||
| 2249 | </varlistentry> | ||
| 2250 | <varlistentry> | ||
| 2251 | <term>DRM_MODE_PROP_ENUM</term> | ||
| 2252 | <listitem><para>Enumerated properties take a numerical value that | ||
| 2253 | ranges from 0 to the number of enumerated values defined by the | ||
| 2254 | property minus one, and associate a free-formed string name to each | ||
| 2255 | value. Applications can retrieve the list of defined value-name pairs | ||
| 2256 | and use the numerical value to get and set property instance values. | ||
| 2257 | </para></listitem> | ||
| 2258 | </varlistentry> | ||
| 2259 | <varlistentry> | ||
| 2260 | <term>DRM_MODE_PROP_BITMASK</term> | ||
| 2261 | <listitem><para>Bitmask properties are enumeration properties that | ||
| 2262 | additionally restrict all enumerated values to the 0..63 range. | ||
| 2263 | Bitmask property instance values combine one or more of the | ||
| 2264 | enumerated bits defined by the property.</para></listitem> | ||
| 2265 | </varlistentry> | ||
| 2266 | <varlistentry> | ||
| 2267 | <term>DRM_MODE_PROP_BLOB</term> | ||
| 2268 | <listitem><para>Blob properties store a binary blob without any format | ||
| 2269 | restriction. The binary blobs are created as KMS standalone objects, | ||
| 2270 | and blob property instance values store the ID of their associated | ||
| 2271 | blob object.</para> | ||
| 2272 | <para>Blob properties are only used for the connector EDID property | ||
| 2273 | and cannot be created by drivers.</para></listitem> | ||
| 2274 | </varlistentry> | ||
| 2275 | </variablelist> | ||
| 2276 | </para> | ||
| 2277 | <para> | ||
| 2278 | To create a property drivers call one of the following functions depending | ||
| 2279 | on the property type. All property creation functions take property flags | ||
| 2280 | and name, as well as type-specific arguments. | ||
| 2281 | <itemizedlist> | ||
| 2282 | <listitem> | ||
| 2283 | <synopsis>struct drm_property *drm_property_create_range(struct drm_device *dev, int flags, | ||
| 2284 | const char *name, | ||
| 2285 | uint64_t min, uint64_t max);</synopsis> | ||
| 2286 | <para>Create a range property with the given minimum and maximum | ||
| 2287 | values.</para> | ||
| 2288 | </listitem> | ||
| 2289 | <listitem> | ||
| 2290 | <synopsis>struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags, | ||
| 2291 | const char *name, | ||
| 2292 | const struct drm_prop_enum_list *props, | ||
| 2293 | int num_values);</synopsis> | ||
| 2294 | <para>Create an enumerated property. The <parameter>props</parameter> | ||
| 2295 | argument points to an array of <parameter>num_values</parameter> | ||
| 2296 | value-name pairs.</para> | ||
| 2297 | </listitem> | ||
| 2298 | <listitem> | ||
| 2299 | <synopsis>struct drm_property *drm_property_create_bitmask(struct drm_device *dev, | ||
| 2300 | int flags, const char *name, | ||
| 2301 | const struct drm_prop_enum_list *props, | ||
| 2302 | int num_values);</synopsis> | ||
| 2303 | <para>Create a bitmask property. The <parameter>props</parameter> | ||
| 2304 | argument points to an array of <parameter>num_values</parameter> | ||
| 2305 | value-name pairs.</para> | ||
| 2306 | </listitem> | ||
| 2307 | </itemizedlist> | ||
| 2308 | </para> | ||
| 2309 | <para> | ||
| 2310 | Properties can additionally be created as immutable, in which case they | ||
| 2311 | will be read-only for applications but can be modified by the driver. To | ||
| 2312 | create an immutable property drivers must set the DRM_MODE_PROP_IMMUTABLE | ||
| 2313 | flag at property creation time. | ||
| 2314 | </para> | ||
| 2315 | <para> | ||
| 2316 | When no array of value-name pairs is readily available at property | ||
| 2317 | creation time for enumerated or range properties, drivers can create | ||
| 2318 | the property using the <function>drm_property_create</function> function | ||
| 2319 | and manually add enumeration value-name pairs by calling the | ||
| 2320 | <function>drm_property_add_enum</function> function. Care must be taken to | ||
| 2321 | properly specify the property type through the <parameter>flags</parameter> | ||
| 2322 | argument. | ||
| 2323 | </para> | ||
| 2324 | <para> | ||
| 2325 | After creating properties drivers can attach property instances to CRTC, | ||
| 2326 | connector and plane objects by calling the | ||
| 2327 | <function>drm_object_attach_property</function>. The function takes a | ||
| 2328 | pointer to the target object, a pointer to the previously created property | ||
| 2329 | and an initial instance value. | ||
| 2330 | </para> | ||
| 2331 | </sect1> | ||
| 2332 | |||
| 2190 | <!-- Internals: vertical blanking --> | 2333 | <!-- Internals: vertical blanking --> |
| 2191 | 2334 | ||
| 2192 | <sect1 id="drm-vertical-blank"> | 2335 | <sect1 id="drm-vertical-blank"> |
