All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 01/20] drm/atomic: add connectors_changed to separate it from mode_changed
Date: Tue, 07 Jul 2015 12:05:40 +0200	[thread overview]
Message-ID: <559BA474.6040805@linux.intel.com> (raw)
In-Reply-To: <20150707085943.GU7568@phenom.ffwll.local>

Op 07-07-15 om 10:59 schreef Daniel Vetter:
> On Tue, Jul 07, 2015 at 09:08:12AM +0200, Maarten Lankhorst wrote:
>> 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.
>>
>> Cc: dri-devel@lists.freedesktop.org
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>>  drivers/gpu/drm/drm_atomic_helper.c  | 25 +++++++++++++++++++------
>>  drivers/gpu/drm/i915/intel_display.c |  2 +-
>>  include/drm/drm_atomic.h             |  3 ++-
>>  include/drm/drm_crtc.h               |  8 +++++---
>>  4 files changed, 27 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
>> index 66e76f4f43be..b818e3111380 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,
>>  	if (IS_ERR(crtc_state))
>>  		return PTR_ERR(crtc_state);
>>  
>> -	crtc_state->mode_changed = true;
>> +	crtc_state->connectors_changed = true;
>>  
>>  	list_for_each_entry(connector, &config->connector_list, head) {
>>  		if (connector->state->best_encoder != encoder)
>> @@ -174,14 +174,14 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx)
>>  			idx = drm_crtc_index(connector->state->crtc);
>>  
>>  			crtc_state = state->crtc_states[idx];
>> -			crtc_state->mode_changed = true;
>> +			crtc_state->connectors_changed = true;
>>  		}
>>  
>>  		if (connector_state->crtc) {
>>  			idx = drm_crtc_index(connector_state->crtc);
>>  
>>  			crtc_state = state->crtc_states[idx];
>> -			crtc_state->mode_changed = true;
>> +			crtc_state->connectors_changed = true;
>>  		}
>>  	}
>>  
>> @@ -233,7 +233,7 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx)
>>  	idx = drm_crtc_index(connector_state->crtc);
>>  
>>  	crtc_state = state->crtc_states[idx];
>> -	crtc_state->mode_changed = true;
>> +	crtc_state->connectors_changed = true;
>>  
>>  	DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] using [ENCODER:%d:%s] on [CRTC:%d]\n",
>>  			 connector->base.id,
>> @@ -256,7 +256,8 @@ mode_fixup(struct drm_atomic_state *state)
>>  	bool ret;
>>  
>>  	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>> -		if (!crtc_state->mode_changed)
>> +		if (!crtc_state->mode_changed &&
>> +		    !crtc_state->connectors_changed)
>>  			continue;
>>  
>>  		drm_mode_copy(&crtc_state->adjusted_mode, &crtc_state->mode);
>> @@ -312,7 +313,8 @@ mode_fixup(struct drm_atomic_state *state)
>>  	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>>  		const struct drm_crtc_helper_funcs *funcs;
>>  
>> -		if (!crtc_state->mode_changed)
>> +		if (!crtc_state->mode_changed &&
>> +		    !crtc_state->connectors_changed)
>>  			continue;
>>  
>>  		funcs = crtc->helper_private;
>> @@ -373,7 +375,17 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
>>  		if (crtc->state->enable != crtc_state->enable) {
>>  			DRM_DEBUG_ATOMIC("[CRTC:%d] enable changed\n",
>>  					 crtc->base.id);
>> +
>> +			/*
>> +			 * For clarity this assignment is done here, but
>> +			 * enable == 0 is only true when there are no
>> +			 * connectors and a NULL mode.
>> +			 *
>> +			 * The other way around is true as well. enable != 0
>> +			 * iff connectors are attached and a mode is set.
>> +			 */
>>  			crtc_state->mode_changed = true;
> I'd drop this one so that connectors_changed and mode_changed are truly
> orthogonal. Also ->enable implies connectors changed since we do check
> that there's only connected connectors if the crtc is on. Needs kerneldoc
> update too ofc.

They are orthogonal, think of this case:

1. crtc previously enabled, connector removed, mode stays same ->
	connector_changed = true, mode_changed = false

2. crtc previously enabled, connectors stay the same, different mode -> 
	connectors_changed = false, mode_changed = true

The following is enforced by the checks:
crtc disabled, implies 0 connectors, no mode.
crtc enabled implies > 0 connectors, and a mode.

Hence the connectors_changed and mode_changed here are for documentation purposes only. :)

So if someone wonders what happens when enable is changed they don't have to dig through
the entire drm_atomic_helper_check_modeset function and still not be sure if it's coincidence
or not. 

You're right about the kerneldoc, I'll fix it.

>> +			crtc_state->connectors_changed = true;
>>  		}
>>  	}
>>  
>> @@ -2072,6 +2084,7 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,
>>  	state->mode_changed = false;
>>  	state->active_changed = false;
>>  	state->planes_changed = false;
>> +	state->connectors_changed = false;
>>  	state->event = NULL;
>>  }
>>  EXPORT_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 e91613b1c871..6ddb462b4124 100644
>> --- a/drivers/gpu/drm/i915/intel_display.c
>> +++ b/drivers/gpu/drm/i915/intel_display.c
>> @@ -421,7 +421,7 @@ static const intel_limit_t intel_limits_bxt = {
>>  static bool
>>  needs_modeset(struct drm_crtc_state *state)
>>  {
>> -	return state->mode_changed || state->active_changed;
>> +	return drm_atomic_crtc_needs_modeset(state);
>>  }
>>  
>>  /**
>> 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);
>>  static inline bool
>>  drm_atomic_crtc_needs_modeset(struct drm_crtc_state *state)
>>  {
>> -	return state->mode_changed || state->active_changed;
>> +	return state->mode_changed || state->active_changed ||
>> +	       state->connectors_changed;
>>  }
>>  
>>  
>> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
>> index 57ca8cc383a6..e39d6f1de5f7 100644
>> --- a/include/drm/drm_crtc.h
>> +++ b/include/drm/drm_crtc.h
>> @@ -255,12 +255,13 @@ struct drm_atomic_state;
>>   * @crtc: backpointer to the CRTC
>>   * @enable: whether the CRTC should be enabled, gates all other state
>>   * @active: whether the CRTC is actively displaying (used for DPMS)
>> - * @mode_changed: for use by helpers and drivers when computing state updates
>> - * @active_changed: for use by helpers and drivers when computing state updates
>> + * @planes_changed: planes on this crtc are updated
>> + * @mode_changed: crtc_state->mode or crtc_state->enable has been changed
>> + * @active_changed: crtc_state->active
> missing a "has changed".
Oops, indeed!

~Maarten
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-07-07 10:05 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07  7:08 [PATCH v2 00/20] Convert to atomic, part 4 Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 01/20] drm/atomic: add connectors_changed to separate it from mode_changed Maarten Lankhorst
2015-07-07  8:59   ` Daniel Vetter
2015-07-07 10:05     ` Maarten Lankhorst [this message]
2015-07-07 12:03       ` Daniel Vetter
2015-07-07  7:08 ` [PATCH v2 02/20] drm: Don't update plane properties for atomic planes if it stays the same Maarten Lankhorst
2015-07-07  9:18   ` [Intel-gfx] " Daniel Vetter
2015-07-07 10:20     ` Maarten Lankhorst
2015-07-07 12:10       ` [Intel-gfx] " Daniel Vetter
2015-07-07 14:32         ` Maarten Lankhorst
2015-07-07 16:40           ` Daniel Vetter
2015-07-07 15:08         ` Maarten Lankhorst
2015-07-07 16:43           ` Daniel Vetter
2015-07-08  8:00             ` [Intel-gfx] " Maarten Lankhorst
2015-07-08  8:55               ` Daniel Vetter
2015-07-08 16:35                 ` Maarten Lankhorst
2015-07-08 17:52                   ` [Intel-gfx] " Daniel Vetter
2015-07-08 18:25                     ` Maarten Lankhorst
2015-07-08 20:12                       ` Daniel Vetter
2015-07-13  8:59                         ` Maarten Lankhorst
2015-07-13  9:13                           ` [Intel-gfx] " Daniel Vetter
2015-07-13  9:23                             ` Maarten Lankhorst
2015-07-13  9:45                               ` Daniel Vetter
2015-07-13  9:49                                 ` Maarten Lankhorst
2015-07-13 10:06                                   ` [Intel-gfx] " Daniel Vetter
2015-07-07  7:08 ` [PATCH v2 03/20] drm/i915: Fix noatomic crtc disabling Maarten Lankhorst
2015-07-07  9:18   ` Daniel Vetter
2015-07-07 10:22     ` Maarten Lankhorst
2015-07-07 12:39       ` Patrik Jakobsson
2015-07-07 14:14         ` Maarten Lankhorst
2015-07-08  8:12           ` Patrik Jakobsson
2015-07-08  8:50             ` Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 04/20] drm/i915: Do not update pfit state when toggling crtc enabled Maarten Lankhorst
2015-07-07  9:26   ` Daniel Vetter
2015-07-07 10:46     ` Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 05/20] drm/i915: Do not use plane_config in intel_fbdev.c Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 06/20] drm/i915: Allow fuzzy matching in pipe_config_compare Maarten Lankhorst
2015-07-07 10:11   ` Daniel Vetter
2015-07-08  8:38     ` Maarten Lankhorst
2015-07-08  9:09       ` Daniel Vetter
2015-07-08  9:18         ` Maarten Lankhorst
2015-07-08  9:33           ` Daniel Vetter
2015-07-07  7:08 ` [PATCH v2 07/20] drm/i915: Rework primary plane stuff slightly Maarten Lankhorst
2015-07-07 11:16   ` Daniel Vetter
2015-07-07 14:02     ` Maarten Lankhorst
2015-07-08  9:27       ` Daniel Vetter
2015-07-08 12:36         ` Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 08/20] drm/i915: fill in more mode members Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 09/20] drm/i915: Fill in more crtc state, v2 Maarten Lankhorst
2015-07-07 10:28   ` Daniel Vetter
2015-07-13  9:32     ` Maarten Lankhorst
2015-07-13  9:48       ` Daniel Vetter
2015-07-07  7:08 ` [PATCH v2 10/20] drm/i915: Convert suspend/resume to atomic Maarten Lankhorst
2015-07-07  9:57   ` Daniel Vetter
2015-07-07 10:33     ` Maarten Lankhorst
2015-07-07 13:14       ` Daniel Vetter
2015-07-07 13:20         ` Daniel Vetter
2015-07-07  7:08 ` [PATCH v2 11/20] drm/i915: Update power domains on readout Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 12/20] drm/i915: skip modeset if compatible, and enable fastboot for everyone, v2 Maarten Lankhorst
2015-07-07 10:14   ` Daniel Vetter
2015-07-07 10:34     ` Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 13/20] drm/i915: Always reset in intel_crtc_restore_mode Maarten Lankhorst
2015-07-07 10:17   ` Daniel Vetter
2015-07-07 10:48     ` Maarten Lankhorst
2015-07-07 13:16       ` Daniel Vetter
2015-07-07  7:08 ` [PATCH v2 14/20] drm/i915: Make intel_display_suspend atomic, try 2 Maarten Lankhorst
2015-07-07  9:48   ` Daniel Vetter
2015-07-07 10:50     ` Maarten Lankhorst
2015-07-07 13:21       ` Daniel Vetter
2015-07-07  7:08 ` [PATCH v2 15/20] drm/i915: Use full atomic modeset Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 16/20] drm/i915: Call plane update functions directly from intel_atomic_commit Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 17/20] drm/i915: always disable irqs in intel_pipe_update_start Maarten Lankhorst
2015-07-07  7:08 ` [PATCH v2 18/20] drm/i915: Only commit planes on crtc's that have changed planes Maarten Lankhorst
2015-07-07  9:33   ` Daniel Vetter
2015-07-07 10:51     ` Maarten Lankhorst
2015-07-07 13:22       ` Daniel Vetter
2015-07-07  7:08 ` [PATCH v2 19/20] drm/i915: Remove use of runtime pm in atomic commit functions Maarten Lankhorst
2015-07-07 10:19   ` Daniel Vetter
2015-07-07  7:08 ` [PATCH v2 20/20] drm/i915: Skip modeset checks when modeset is prevented Maarten Lankhorst
2015-07-07 13:42 ` [PATCH v2 00/20] Convert to atomic, part 4 Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=559BA474.6040805@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.