Re: [PATCH 1/3] drm/i915/gen9: Initialize intel_state->active_crtcs during WM sanitization

Maarten Lankhorst
2016-06-13T09:02:46Z

Op 13-06-16 om 10:59 schreef Maarten Lankhorst:
> Op 10-06-16 om 00:14 schreef Matt Roper:
>> intel_state->active_crtcs is usually only initialized when doing a
>> modeset. During our first atomic commit after boot, we're effectively
>> faking a modeset to sanitize the DDB/wm setup, so ensure that this field
>> gets initialized before use.
>>
>> Reported-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
>> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
>> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
>> ---
>> drivers/gpu/drm/i915/intel_pm.c | 11 ++++++++++-
>> 1 file changed, 10 insertions(+), 1 deletion(-)
> Ah right. Code assumes that it's valid.
>
> However this still leaves open a hole in case a modeset changes active_crtcs during the first commit.
>
> intel_state->active_crtcs is set at the same time intel_state->modeset is, so
> resend with if (!intel_state->modeset) intel_state->active_crtcs = dev_priv->active_crtcs; ?
Hm you need connection_mutex lock for that one, so need to lock that first before assigning active_crtcs.
You can grab that lock unconditionally, since we already hold it in case of modeset..

~Maarten