diff options
| -rw-r--r-- | drivers/gpu/drm/drm_atomic.c | 90 | ||||
| -rw-r--r-- | drivers/gpu/drm/drm_atomic_helper.c | 12 | ||||
| -rw-r--r-- | include/drm/drm_atomic.h | 9 | ||||
| -rw-r--r-- | include/drm/drm_crtc.h | 3 |
4 files changed, 108 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index cbd5e7240b6b..6f729d1bdea2 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c | |||
| @@ -217,6 +217,32 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state, | |||
| 217 | EXPORT_SYMBOL(drm_atomic_get_crtc_state); | 217 | EXPORT_SYMBOL(drm_atomic_get_crtc_state); |
| 218 | 218 | ||
| 219 | /** | 219 | /** |
| 220 | * drm_atomic_crtc_set_property - set property on CRTC | ||
| 221 | * @crtc: the drm CRTC to set a property on | ||
| 222 | * @state: the state object to update with the new property value | ||
| 223 | * @property: the property to set | ||
| 224 | * @val: the new property value | ||
| 225 | * | ||
| 226 | * Use this instead of calling crtc->atomic_set_property directly. | ||
| 227 | * This function handles generic/core properties and calls out to | ||
| 228 | * driver's ->atomic_set_property() for driver properties. To ensure | ||
| 229 | * consistent behavior you must call this function rather than the | ||
| 230 | * driver hook directly. | ||
| 231 | * | ||
| 232 | * RETURNS: | ||
| 233 | * Zero on success, error code on failure | ||
| 234 | */ | ||
| 235 | int drm_atomic_crtc_set_property(struct drm_crtc *crtc, | ||
| 236 | struct drm_crtc_state *state, struct drm_property *property, | ||
| 237 | uint64_t val) | ||
| 238 | { | ||
| 239 | if (crtc->funcs->atomic_set_property) | ||
| 240 | return crtc->funcs->atomic_set_property(crtc, state, property, val); | ||
| 241 | return -EINVAL; | ||
| 242 | } | ||
| 243 | EXPORT_SYMBOL(drm_atomic_crtc_set_property); | ||
| 244 | |||
| 245 | /** | ||
| 220 | * drm_atomic_get_plane_state - get plane state | 246 | * drm_atomic_get_plane_state - get plane state |
| 221 | * @state: global atomic state object | 247 | * @state: global atomic state object |
| 222 | * @plane: plane to get state object for | 248 | * @plane: plane to get state object for |
| @@ -272,6 +298,32 @@ drm_atomic_get_plane_state(struct drm_atomic_state *state, | |||
| 272 | EXPORT_SYMBOL(drm_atomic_get_plane_state); | 298 | EXPORT_SYMBOL(drm_atomic_get_plane_state); |
| 273 | 299 | ||
| 274 | /** | 300 | /** |
| 301 | * drm_atomic_plane_set_property - set property on plane | ||
| 302 | * @plane: the drm plane to set a property on | ||
| 303 | * @state: the state object to update with the new property value | ||
| 304 | * @property: the property to set | ||
| 305 | * @val: the new property value | ||
| 306 | * | ||
| 307 | * Use this instead of calling plane->atomic_set_property directly. | ||
| 308 | * This function handles generic/core properties and calls out to | ||
| 309 | * driver's ->atomic_set_property() for driver properties. To ensure | ||
| 310 | * consistent behavior you must call this function rather than the | ||
| 311 | * driver hook directly. | ||
| 312 | * | ||
| 313 | * RETURNS: | ||
| 314 | * Zero on success, error code on failure | ||
| 315 | */ | ||
| 316 | int drm_atomic_plane_set_property(struct drm_plane *plane, | ||
| 317 | struct drm_plane_state *state, struct drm_property *property, | ||
| 318 | uint64_t val) | ||
| 319 | { | ||
| 320 | if (plane->funcs->atomic_set_property) | ||
| 321 | return plane->funcs->atomic_set_property(plane, state, property, val); | ||
| 322 | return -EINVAL; | ||
| 323 | } | ||
| 324 | EXPORT_SYMBOL(drm_atomic_plane_set_property); | ||
| 325 | |||
| 326 | /** | ||
| 275 | * drm_atomic_get_connector_state - get connector state | 327 | * drm_atomic_get_connector_state - get connector state |
| 276 | * @state: global atomic state object | 328 | * @state: global atomic state object |
| 277 | * @connector: connector to get state object for | 329 | * @connector: connector to get state object for |
| @@ -343,6 +395,44 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state, | |||
| 343 | EXPORT_SYMBOL(drm_atomic_get_connector_state); | 395 | EXPORT_SYMBOL(drm_atomic_get_connector_state); |
| 344 | 396 | ||
| 345 | /** | 397 | /** |
| 398 | * drm_atomic_connector_set_property - set property on connector. | ||
| 399 | * @connector: the drm connector to set a property on | ||
| 400 | * @state: the state object to update with the new property value | ||
| 401 | * @property: the property to set | ||
| 402 | * @val: the new property value | ||
| 403 | * | ||
| 404 | * Use this instead of calling connector->atomic_set_property directly. | ||
| 405 | * This function handles generic/core properties and calls out to | ||
| 406 | * driver's ->atomic_set_property() for driver properties. To ensure | ||
| 407 | * consistent behavior you must call this function rather than the | ||
| 408 | * driver hook directly. | ||
| 409 | * | ||
| 410 | * RETURNS: | ||
| 411 | * Zero on success, error code on failure | ||
| 412 | */ | ||
| 413 | int drm_atomic_connector_set_property(struct drm_connector *connector, | ||
| 414 | struct drm_connector_state *state, struct drm_property *property, | ||
| 415 | uint64_t val) | ||
| 416 | { | ||
| 417 | struct drm_device *dev = connector->dev; | ||
| 418 | struct drm_mode_config *config = &dev->mode_config; | ||
| 419 | |||
| 420 | if (property == config->dpms_property) { | ||
| 421 | /* setting DPMS property requires special handling, which | ||
| 422 | * is done in legacy setprop path for us. Disallow (for | ||
| 423 | * now?) atomic writes to DPMS property: | ||
| 424 | */ | ||
| 425 | return -EINVAL; | ||
| 426 | } else if (connector->funcs->atomic_set_property) { | ||
| 427 | return connector->funcs->atomic_set_property(connector, | ||
| 428 | state, property, val); | ||
| 429 | } else { | ||
| 430 | return -EINVAL; | ||
| 431 | } | ||
| 432 | } | ||
| 433 | EXPORT_SYMBOL(drm_atomic_connector_set_property); | ||
| 434 | |||
| 435 | /** | ||
| 346 | * drm_atomic_set_crtc_for_plane - set crtc for plane | 436 | * drm_atomic_set_crtc_for_plane - set crtc for plane |
| 347 | * @plane_state: the plane whose incoming state to update | 437 | * @plane_state: the plane whose incoming state to update |
| 348 | * @crtc: crtc to use for the plane | 438 | * @crtc: crtc to use for the plane |
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 379d37acd5b5..57e5540259cc 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
| @@ -1613,8 +1613,8 @@ retry: | |||
| 1613 | goto fail; | 1613 | goto fail; |
| 1614 | } | 1614 | } |
| 1615 | 1615 | ||
| 1616 | ret = crtc->funcs->atomic_set_property(crtc, crtc_state, | 1616 | ret = drm_atomic_crtc_set_property(crtc, crtc_state, |
| 1617 | property, val); | 1617 | property, val); |
| 1618 | if (ret) | 1618 | if (ret) |
| 1619 | goto fail; | 1619 | goto fail; |
| 1620 | 1620 | ||
| @@ -1672,8 +1672,8 @@ retry: | |||
| 1672 | goto fail; | 1672 | goto fail; |
| 1673 | } | 1673 | } |
| 1674 | 1674 | ||
| 1675 | ret = plane->funcs->atomic_set_property(plane, plane_state, | 1675 | ret = drm_atomic_plane_set_property(plane, plane_state, |
| 1676 | property, val); | 1676 | property, val); |
| 1677 | if (ret) | 1677 | if (ret) |
| 1678 | goto fail; | 1678 | goto fail; |
| 1679 | 1679 | ||
| @@ -1731,8 +1731,8 @@ retry: | |||
| 1731 | goto fail; | 1731 | goto fail; |
| 1732 | } | 1732 | } |
| 1733 | 1733 | ||
| 1734 | ret = connector->funcs->atomic_set_property(connector, connector_state, | 1734 | ret = drm_atomic_connector_set_property(connector, connector_state, |
| 1735 | property, val); | 1735 | property, val); |
| 1736 | if (ret) | 1736 | if (ret) |
| 1737 | goto fail; | 1737 | goto fail; |
| 1738 | 1738 | ||
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index e224ccfa11ca..51168a8b723a 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h | |||
| @@ -38,12 +38,21 @@ void drm_atomic_state_free(struct drm_atomic_state *state); | |||
| 38 | struct drm_crtc_state * __must_check | 38 | struct drm_crtc_state * __must_check |
| 39 | drm_atomic_get_crtc_state(struct drm_atomic_state *state, | 39 | drm_atomic_get_crtc_state(struct drm_atomic_state *state, |
| 40 | struct drm_crtc *crtc); | 40 | struct drm_crtc *crtc); |
| 41 | int drm_atomic_crtc_set_property(struct drm_crtc *crtc, | ||
| 42 | struct drm_crtc_state *state, struct drm_property *property, | ||
| 43 | uint64_t val); | ||
| 41 | struct drm_plane_state * __must_check | 44 | struct drm_plane_state * __must_check |
| 42 | drm_atomic_get_plane_state(struct drm_atomic_state *state, | 45 | drm_atomic_get_plane_state(struct drm_atomic_state *state, |
| 43 | struct drm_plane *plane); | 46 | struct drm_plane *plane); |
| 47 | int drm_atomic_plane_set_property(struct drm_plane *plane, | ||
| 48 | struct drm_plane_state *state, struct drm_property *property, | ||
| 49 | uint64_t val); | ||
| 44 | struct drm_connector_state * __must_check | 50 | struct drm_connector_state * __must_check |
| 45 | drm_atomic_get_connector_state(struct drm_atomic_state *state, | 51 | drm_atomic_get_connector_state(struct drm_atomic_state *state, |
| 46 | struct drm_connector *connector); | 52 | struct drm_connector *connector); |
| 53 | int drm_atomic_connector_set_property(struct drm_connector *connector, | ||
| 54 | struct drm_connector_state *state, struct drm_property *property, | ||
| 55 | uint64_t val); | ||
| 47 | 56 | ||
| 48 | int __must_check | 57 | int __must_check |
| 49 | drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, | 58 | drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state, |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index f7c0b7bb9d5f..7f158963ef87 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -311,6 +311,7 @@ struct drm_crtc_state { | |||
| 311 | * @atomic_duplicate_state: duplicate the atomic state for this CRTC | 311 | * @atomic_duplicate_state: duplicate the atomic state for this CRTC |
| 312 | * @atomic_destroy_state: destroy an atomic state for this CRTC | 312 | * @atomic_destroy_state: destroy an atomic state for this CRTC |
| 313 | * @atomic_set_property: set a property on an atomic state for this CRTC | 313 | * @atomic_set_property: set a property on an atomic state for this CRTC |
| 314 | * (do not call directly, use drm_atomic_crtc_set_property()) | ||
| 314 | * | 315 | * |
| 315 | * The drm_crtc_funcs structure is the central CRTC management structure | 316 | * The drm_crtc_funcs structure is the central CRTC management structure |
| 316 | * in the DRM. Each CRTC controls one or more connectors (note that the name | 317 | * in the DRM. Each CRTC controls one or more connectors (note that the name |
| @@ -497,6 +498,7 @@ struct drm_connector_state { | |||
| 497 | * @atomic_duplicate_state: duplicate the atomic state for this connector | 498 | * @atomic_duplicate_state: duplicate the atomic state for this connector |
| 498 | * @atomic_destroy_state: destroy an atomic state for this connector | 499 | * @atomic_destroy_state: destroy an atomic state for this connector |
| 499 | * @atomic_set_property: set a property on an atomic state for this connector | 500 | * @atomic_set_property: set a property on an atomic state for this connector |
| 501 | * (do not call directly, use drm_atomic_connector_set_property()) | ||
| 500 | * | 502 | * |
| 501 | * Each CRTC may have one or more connectors attached to it. The functions | 503 | * Each CRTC may have one or more connectors attached to it. The functions |
| 502 | * below allow the core DRM code to control connectors, enumerate available modes, | 504 | * below allow the core DRM code to control connectors, enumerate available modes, |
| @@ -760,6 +762,7 @@ struct drm_plane_state { | |||
| 760 | * @atomic_duplicate_state: duplicate the atomic state for this plane | 762 | * @atomic_duplicate_state: duplicate the atomic state for this plane |
| 761 | * @atomic_destroy_state: destroy an atomic state for this plane | 763 | * @atomic_destroy_state: destroy an atomic state for this plane |
| 762 | * @atomic_set_property: set a property on an atomic state for this plane | 764 | * @atomic_set_property: set a property on an atomic state for this plane |
| 765 | * (do not call directly, use drm_atomic_plane_set_property()) | ||
| 763 | */ | 766 | */ |
| 764 | struct drm_plane_funcs { | 767 | struct drm_plane_funcs { |
| 765 | int (*update_plane)(struct drm_plane *plane, | 768 | int (*update_plane)(struct drm_plane *plane, |
