aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_atomic.c
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2014-12-18 16:01:46 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-12-18 16:22:39 -0500
commit40ecc694e114a06b9ed77e3e94641b0f5490693c (patch)
tree3eeded62ed019c2b68d87e24faa448426380b705 /drivers/gpu/drm/drm_atomic.c
parent72a3697097b8dc92f5b8362598f5730a9986eb83 (diff)
drm: add atomic_set_property wrappers
As we add properties for all the standard plane/crtc/connector attributes (in preperation for the atomic ioctl), we are going to want to handle core state in core (rather than per driver). Intercepting the core properties will be easier if the atomic_set_property vfuncs are not called directly, but instead have a mandatory wrapper function (which will later serve as the point to intercept core properties). v2: more verbose comments and copypasta comment fix Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/drm_atomic.c')
-rw-r--r--drivers/gpu/drm/drm_atomic.c90
1 files changed, 90 insertions, 0 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,
217EXPORT_SYMBOL(drm_atomic_get_crtc_state); 217EXPORT_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 */
235int 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}
243EXPORT_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,
272EXPORT_SYMBOL(drm_atomic_get_plane_state); 298EXPORT_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 */
316int 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}
324EXPORT_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,
343EXPORT_SYMBOL(drm_atomic_get_connector_state); 395EXPORT_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 */
413int 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}
433EXPORT_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