aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_atomic.c
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2015-05-26 09:36:48 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-05-26 09:50:34 -0400
commit819364da20fd914aba2fd03e95ee0467286752f5 (patch)
tree4e3cf5c56d47401a57e30389ae88cc82777770b1 /drivers/gpu/drm/drm_atomic.c
parentbbe16a40e23a65626904aa22fbfc3240a65d21d1 (diff)
drm: Add drm_atomic_set_mode_for_crtc
Add a new helper, to be used later for blob property management, that sets the mode for a CRTC state, as well as updating the CRTC enable/active state at the same time. v2: Do not touch active/mode_changed in CRTC state. Document return value. Remove stray drm_atomic_set_mode_prop_for_crtc declaration. v3: Remove i915 changes, and leave it directly bashing crtc_state->mode for the meantime. Signed-off-by: Daniel Stone <daniels@collabora.com> Tested-by: Sean Paul <seanpaul@chromium.org> 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.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 3134f506b762..e749287390a3 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -290,6 +290,42 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state,
290EXPORT_SYMBOL(drm_atomic_get_crtc_state); 290EXPORT_SYMBOL(drm_atomic_get_crtc_state);
291 291
292/** 292/**
293 * drm_atomic_set_mode_for_crtc - set mode for CRTC
294 * @state: the CRTC whose incoming state to update
295 * @mode: kernel-internal mode to use for the CRTC, or NULL to disable
296 *
297 * Set a mode (originating from the kernel) on the desired CRTC state. Does
298 * not change any other state properties, including enable, active, or
299 * mode_changed.
300 *
301 * RETURNS:
302 * Zero on success, error code on failure. Cannot return -EDEADLK.
303 */
304int drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
305 struct drm_display_mode *mode)
306{
307 /* Early return for no change. */
308 if (mode && memcmp(&state->mode, mode, sizeof(*mode)) == 0)
309 return 0;
310
311 if (mode) {
312 drm_mode_copy(&state->mode, mode);
313 state->enable = true;
314 DRM_DEBUG_ATOMIC("Set [MODE:%s] for CRTC state %p\n",
315 mode->name, state);
316 } else {
317 memset(&state->mode, 0, sizeof(state->mode));
318 state->enable = false;
319 DRM_DEBUG_ATOMIC("Set [NOMODE] for CRTC state %p\n",
320 state);
321 }
322
323 return 0;
324}
325EXPORT_SYMBOL(drm_atomic_set_mode_for_crtc);
326
327
328/**
293 * drm_atomic_crtc_set_property - set property on CRTC 329 * drm_atomic_crtc_set_property - set property on CRTC
294 * @crtc: the drm CRTC to set a property on 330 * @crtc: the drm CRTC to set a property on
295 * @state: the state object to update with the new property value 331 * @state: the state object to update with the new property value