public inbox for intel-gfx@lists.freedesktop.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 01/13] drm/atomic: Only update crtc->x/y if it's part of the state.
Date: Thu, 16 Jul 2015 15:44:42 +0200	[thread overview]
Message-ID: <55A7B54A.7080006@linux.intel.com> (raw)
In-Reply-To: <20150716123450.GJ6223@phenom.ffwll.local>

Op 16-07-15 om 14:34 schreef Daniel Vetter:
> On Thu, Jul 16, 2015 at 11:38:18AM +0200, Maarten Lankhorst wrote:
>> Op 16-07-15 om 11:29 schreef Daniel Vetter:
>>> On Thu, Jul 16, 2015 at 11:17:29AM +0200, Maarten Lankhorst wrote:
>>>> Op 16-07-15 om 11:19 schreef Daniel Vetter:
>>>>> On Thu, Jul 16, 2015 at 10:59:14AM +0200, Maarten Lankhorst wrote:
>>>>>> Cc: dri-devel@lists.freedesktop.org
>>>>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>>>>>> ---
>>>>>>  drivers/gpu/drm/drm_atomic_helper.c | 7 +++++--
>>>>>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
>>>>>> index 0898afbc9e23..70e69904291d 100644
>>>>>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>>>>>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>>>>>> @@ -667,8 +667,11 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
>>>>>>  	for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) {
>>>>>>  		crtc->mode = crtc->state->mode;
>>>>>>  		crtc->enabled = crtc->state->enable;
>>>>>> -		crtc->x = crtc->primary->state->src_x >> 16;
>>>>>> -		crtc->y = crtc->primary->state->src_y >> 16;
>>>>>> +
>>>>>> +		if (drm_atomic_get_existing_plane_state(old_state, crtc->primary)) {
>>>>>> +			crtc->x = crtc->primary->state->src_x >> 16;
>>>>>> +			crtc->y = crtc->primary->state->src_y >> 16;
>>>>>> +		}
>>>>> What's the benefit here of only updating when something changed? The
>>>>> atomic state should be the master source so copying a few too many times
>>>>> shouldn't matter really.
>>>> Because you might not be holding plane lock, so primary->state may be garbage.
>>> Anyone who wants to touch primary plane must grab the crtc lock, so crtc
>>> lock would give you an implicit read lock. At least that's been my
>>> thinking, but it could be that the primary plane is used on some other
>>> crtc, and then this is indeed garbage.
>> This is only true if the plane is active. If there is none you can still update properties and
>> swap the plane state without locking the crtc.
> Ah right, so still possible to chase a being-freed primary->state pointer.
>
>>> So maybe we need even more checks than what you propose:
>>>
>>>       if (drm_atomic_get_existing_plane_state(old_state, crtc->primary) &&
>>>           crtc->primary->state->crtc == crtc) {
>>>       	crtc->x = crtc->primary->state->src_x >> 16;
>>>       	crtc->y = crtc->primary->state->src_y >> 16;
>>>       }
>>>
>>> I think a comment explaining this would help (or at least in the commit
>>> message!).
>> But the primary and cursor planes are not allowed to move between crtc's?
> They are allowed to do that actually. crtc->primary and crtc->cursor is
> only really a hint to implement backwards compatibility. If you have
> generic plane hw with 2 crtc and planes can be freely assigned it would be
> silly to artificially restrict the backwards compat planes to 1 crtc.
> Otherwise we'd force 2 planes to be unusable when there's no external
> screen plugged in, defeating a lot of the value of making planes freely
> assignable.
Ok, in that case your change looks reasonable. I'll respin.

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-07-16 13:44 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-16  8:59 [PATCH 00/13] Make i915 dpms atomic Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 01/13] drm/atomic: Only update crtc->x/y if it's part of the state Maarten Lankhorst
2015-07-16  9:19   ` Daniel Vetter
2015-07-16  9:17     ` Maarten Lankhorst
2015-07-16  9:29       ` Daniel Vetter
2015-07-16  9:38         ` Maarten Lankhorst
2015-07-16 12:34           ` Daniel Vetter
2015-07-16 13:44             ` Maarten Lankhorst [this message]
2015-07-16 13:51   ` [PATCH v1.1 01/13] drm/atomic: Only update crtc->x/y if it's part of the state, v2 Maarten Lankhorst
2015-07-16 14:58     ` Daniel Vetter
2015-07-16  8:59 ` [PATCH 02/13] drm/atomic: Update legacy DPMS state during modesets Maarten Lankhorst
2015-07-16  9:19   ` Daniel Vetter
2015-07-16  9:24     ` Maarten Lankhorst
2015-07-16  9:31       ` Daniel Vetter
2015-07-27 11:04         ` [PATCH v1.1 02/13] drm/atomic: Update legacy DPMS state during modesets, v2 Maarten Lankhorst
2015-07-27 11:16           ` Daniel Vetter
2015-07-27 11:15             ` Maarten Lankhorst
2015-07-27 11:24             ` [PATCH v1.2 02/13] drm/atomic: Update legacy DPMS state during modesets, v3 Maarten Lankhorst
2015-07-27 13:56               ` Daniel Vetter
2015-07-16  8:59 ` [PATCH 03/13] drm/i915: Make the force_thru workaround atomic Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 04/13] drm/i915: Remove special dpms handling from intel_crt.c Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 05/13] drm/i915: Remove special dpms handling from intel_crtc.c Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 06/13] drm/i915: Remove special dpms handling from intel_sdvo.c Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 07/13] drm/i915: Get rid of dpms handling Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 08/13] drm/i915: Use proper locking for intel_dp_check_link_status Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 09/13] drm/i915: Remove some unneeded checks from check_crtc_state Maarten Lankhorst
2015-07-16  9:24   ` Daniel Vetter
2015-07-16  9:38     ` Maarten Lankhorst
2015-07-16 15:01       ` Daniel Vetter
2015-07-16 14:59         ` Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 10/13] drm/i915: Remove connectors_active from state checking Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 11/13] drm/i915: Remove connectors_active from sanitization Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 12/13] drm/i915: Remove connectors_active from intel_dp.c Maarten Lankhorst
2015-07-16  8:59 ` [PATCH 13/13] drm/i915: Remove connectors_active Maarten Lankhorst
2015-07-16  9:52 ` [PATCH 14/13] drm/i915: Only update mode related state if a modeset happened Maarten Lankhorst

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=55A7B54A.7080006@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox