aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2015-07-21 07:28:57 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-07-27 04:06:38 -0400
commitfc596660dd4e83f7f84e3cd7b25dc5e8e83000ef (patch)
treed2a4fcc7a095071396f4708ead9beb4977a8c46d
parent90a21700ed9635070fb04fe92fb50c5e3bc16605 (diff)
drm/atomic: add connectors_changed to separate it from mode_changed, v2
This can be a separate case from mode_changed, when connectors stay the same but only the mode is different. Drivers may choose to implement specific optimizations to prevent a full modeset for this case. Changes since v1: - Update kerneldocs slightly. Cc: dri-devel@lists.freedesktop.org Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ander Conselvan de Oliveira <conselvan2@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c39
-rw-r--r--drivers/gpu/drm/i915/intel_display.c2
-rw-r--r--include/drm/drm_atomic.h3
-rw-r--r--include/drm/drm_crtc.h8
4 files changed, 38 insertions, 14 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 99656815641d..10bcdd554501 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -124,7 +124,7 @@ steal_encoder(struct drm_atomic_state *state,
124 if (IS_ERR(crtc_state)) 124 if (IS_ERR(crtc_state))
125 return PTR_ERR(crtc_state); 125 return PTR_ERR(crtc_state);
126 126
127 crtc_state->mode_changed = true; 127 crtc_state->connectors_changed = true;
128 128
129 list_for_each_entry(connector, &config->connector_list, head) { 129 list_for_each_entry(connector, &config->connector_list, head) {
130 if (connector->state->best_encoder != encoder) 130 if (connector->state->best_encoder != encoder)
@@ -174,14 +174,14 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx)
174 idx = drm_crtc_index(connector->state->crtc); 174 idx = drm_crtc_index(connector->state->crtc);
175 175
176 crtc_state = state->crtc_states[idx]; 176 crtc_state = state->crtc_states[idx];
177 crtc_state->mode_changed = true; 177 crtc_state->connectors_changed = true;
178 } 178 }
179 179
180 if (connector_state->crtc) { 180 if (connector_state->crtc) {
181 idx = drm_crtc_index(connector_state->crtc); 181 idx = drm_crtc_index(connector_state->crtc);
182 182
183 crtc_state = state->crtc_states[idx]; 183 crtc_state = state->crtc_states[idx];
184 crtc_state->mode_changed = true; 184 crtc_state->connectors_changed = true;
185 } 185 }
186 } 186 }
187 187
@@ -233,7 +233,7 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx)
233 idx = drm_crtc_index(connector_state->crtc); 233 idx = drm_crtc_index(connector_state->crtc);
234 234
235 crtc_state = state->crtc_states[idx]; 235 crtc_state = state->crtc_states[idx];
236 crtc_state->mode_changed = true; 236 crtc_state->connectors_changed = true;
237 237
238 DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d]\n", 238 DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d]\n",
239 connector->base.id, 239 connector->base.id,
@@ -256,7 +256,8 @@ mode_fixup(struct drm_atomic_state *state)
256 bool ret; 256 bool ret;
257 257
258 for_each_crtc_in_state(state, crtc, crtc_state, i) { 258 for_each_crtc_in_state(state, crtc, crtc_state, i) {
259 if (!crtc_state->mode_changed) 259 if (!crtc_state->mode_changed &&
260 !crtc_state->connectors_changed)
260 continue; 261 continue;
261 262
262 drm_mode_copy(&crtc_state->adjusted_mode, &crtc_state->mode); 263 drm_mode_copy(&crtc_state->adjusted_mode, &crtc_state->mode);
@@ -312,7 +313,8 @@ mode_fixup(struct drm_atomic_state *state)
312 for_each_crtc_in_state(state, crtc, crtc_state, i) { 313 for_each_crtc_in_state(state, crtc, crtc_state, i) {
313 const struct drm_crtc_helper_funcs *funcs; 314 const struct drm_crtc_helper_funcs *funcs;
314 315
315 if (!crtc_state->mode_changed) 316 if (!crtc_state->mode_changed &&
317 !crtc_state->connectors_changed)
316 continue; 318 continue;
317 319
318 funcs = crtc->helper_private; 320 funcs = crtc->helper_private;
@@ -338,9 +340,14 @@ mode_fixup(struct drm_atomic_state *state)
338 * 340 *
339 * Check the state object to see if the requested state is physically possible. 341 * Check the state object to see if the requested state is physically possible.
340 * This does all the crtc and connector related computations for an atomic 342 * This does all the crtc and connector related computations for an atomic
341 * update. It computes and updates crtc_state->mode_changed, adds any additional 343 * update and adds any additional connectors needed for full modesets and calls
342 * connectors needed for full modesets and calls down into ->mode_fixup 344 * down into ->mode_fixup functions of the driver backend.
343 * functions of the driver backend. 345 *
346 * crtc_state->mode_changed is set when the input mode is changed.
347 * crtc_state->connectors_changed is set when a connector is added or
348 * removed from the crtc.
349 * crtc_state->active_changed is set when crtc_state->active changes,
350 * which is used for dpms.
344 * 351 *
345 * IMPORTANT: 352 * IMPORTANT:
346 * 353 *
@@ -373,7 +380,17 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
373 if (crtc->state->enable != crtc_state->enable) { 380 if (crtc->state->enable != crtc_state->enable) {
374 DRM_DEBUG_ATOMIC("[CRTC:%d] enable changed\n", 381 DRM_DEBUG_ATOMIC("[CRTC:%d] enable changed\n",
375 crtc->base.id); 382 crtc->base.id);
383
384 /*
385 * For clarity this assignment is done here, but
386 * enable == 0 is only true when there are no
387 * connectors and a NULL mode.
388 *
389 * The other way around is true as well. enable != 0
390 * iff connectors are attached and a mode is set.
391 */
376 crtc_state->mode_changed = true; 392 crtc_state->mode_changed = true;
393 crtc_state->connectors_changed = true;
377 } 394 }
378 } 395 }
379 396
@@ -448,6 +465,9 @@ EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
448 * This does all the plane update related checks using by calling into the 465 * This does all the plane update related checks using by calling into the
449 * ->atomic_check hooks provided by the driver. 466 * ->atomic_check hooks provided by the driver.
450 * 467 *
468 * It also sets crtc_state->planes_changed to indicate that a crtc has
469 * updated planes.
470 *
451 * RETURNS 471 * RETURNS
452 * Zero for success or -errno 472 * Zero for success or -errno
453 */ 473 */
@@ -2074,6 +2094,7 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,
2074 state->mode_changed = false; 2094 state->mode_changed = false;
2075 state->active_changed = false; 2095 state->active_changed = false;
2076 state->planes_changed = false; 2096 state->planes_changed = false;
2097 state->connectors_changed = false;
2077 state->event = NULL; 2098 state->event = NULL;
2078} 2099}
2079EXPORT_SYMBOL(__drm_atomic_helper_crtc_duplicate_state); 2100EXPORT_SYMBOL(__drm_atomic_helper_crtc_duplicate_state);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index af0bcfee4771..07cee59edece 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -413,7 +413,7 @@ static const intel_limit_t intel_limits_bxt = {
413static bool 413static bool
414needs_modeset(struct drm_crtc_state *state) 414needs_modeset(struct drm_crtc_state *state)
415{ 415{
416 return state->mode_changed || state->active_changed; 416 return drm_atomic_crtc_needs_modeset(state);
417} 417}
418 418
419/** 419/**
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 8a3a913320eb..e67aeac2aee0 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -166,7 +166,8 @@ int __must_check drm_atomic_async_commit(struct drm_atomic_state *state);
166static inline bool 166static inline bool
167drm_atomic_crtc_needs_modeset(struct drm_crtc_state *state) 167drm_atomic_crtc_needs_modeset(struct drm_crtc_state *state)
168{ 168{
169 return state->mode_changed || state->active_changed; 169 return state->mode_changed || state->active_changed ||
170 state->connectors_changed;
170} 171}
171 172
172 173
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3071319ea194..90a0ff70384a 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -255,12 +255,13 @@ struct drm_atomic_state;
255 * @crtc: backpointer to the CRTC 255 * @crtc: backpointer to the CRTC
256 * @enable: whether the CRTC should be enabled, gates all other state 256 * @enable: whether the CRTC should be enabled, gates all other state
257 * @active: whether the CRTC is actively displaying (used for DPMS) 257 * @active: whether the CRTC is actively displaying (used for DPMS)
258 * @mode_changed: for use by helpers and drivers when computing state updates 258 * @planes_changed: planes on this crtc are updated
259 * @active_changed: for use by helpers and drivers when computing state updates 259 * @mode_changed: crtc_state->mode or crtc_state->enable has been changed
260 * @active_changed: crtc_state->active has been toggled.
261 * @connectors_changed: connectors to this crtc have been updated
260 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes 262 * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
261 * @last_vblank_count: for helpers and drivers to capture the vblank of the 263 * @last_vblank_count: for helpers and drivers to capture the vblank of the
262 * update to ensure framebuffer cleanup isn't done too early 264 * update to ensure framebuffer cleanup isn't done too early
263 * @planes_changed: for use by helpers and drivers when computing state updates
264 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings 265 * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings
265 * @mode: current mode timings 266 * @mode: current mode timings
266 * @event: optional pointer to a DRM event to signal upon completion of the 267 * @event: optional pointer to a DRM event to signal upon completion of the
@@ -283,6 +284,7 @@ struct drm_crtc_state {
283 bool planes_changed : 1; 284 bool planes_changed : 1;
284 bool mode_changed : 1; 285 bool mode_changed : 1;
285 bool active_changed : 1; 286 bool active_changed : 1;
287 bool connectors_changed : 1;
286 288
287 /* attached planes bitmask: 289 /* attached planes bitmask:
288 * WARNING: transitional helpers do not maintain plane_mask so 290 * WARNING: transitional helpers do not maintain plane_mask so