All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 4/7] drm/atomic: Fix atomic helpers to use the new iterator macros.
Date: Wed, 18 Jan 2017 20:03:41 +0200	[thread overview]
Message-ID: <5525216.MXDbAvR95R@avalon> (raw)
In-Reply-To: <0f5a2701-38c9-643f-c9bf-b7830b8b0111@linux.intel.com>

Hi Maarten,

On Wednesday 18 Jan 2017 15:49:56 Maarten Lankhorst wrote:
> Op 17-01-17 om 02:01 schreef Laurent Pinchart:
> > On Monday 16 Jan 2017 10:37:41 Maarten Lankhorst wrote:
> >> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >> ---
> >> 
> >>  drivers/gpu/drm/drm_atomic_helper.c | 293 +++++++++++++++---------------
> >>  1 file changed, 152 insertions(+), 141 deletions(-)
> >> 
> >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> >> b/drivers/gpu/drm/drm_atomic_helper.c index d153e8a72921..b26cf786ce12
> >> 100644
> >> --- a/drivers/gpu/drm/drm_atomic_helper.c
> >> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > 
> > [snip]
> > 
> >> @@ -245,22 +246,22 @@ steal_encoder(struct drm_atomic_state *state,
> >>  {
> >>  	struct drm_crtc_state *crtc_state;
> >>  	struct drm_connector *connector;
> >> -	struct drm_connector_state *connector_state;
> >> +	struct drm_connector_state *old_connector_state, *new_connector_state;
> > 
> > The kernel favours one variable declaration per line, and I think this
> > file does as well, at least mostly (this comment holds for the rest of
> > this patch and the other patches in the series).
> 
> This is the first I've heard of it..
> 
> ~/nfs/linux$ git grep 'int i,'  | wc -l
> 8490
> ~/nfs/linux$ git grep 'int i;'  | wc -l
> 23636
> 
> Based on this, I don't think it's uncommon to have multiple declarations per
> line.

It's not uncommon, no. I still think it hinders readability though, especially 
for long statements like here.

> >>  	int i;

[snip]

> >> @@ -974,18 +977,18 @@ void
> >> drm_atomic_helper_commit_modeset_enables(struct
> >> drm_device *dev,
> >> 		}
> >>  	}
> >> 
> >> -	for_each_connector_in_state(old_state, connector, old_conn_state, i) {
> >> +	for_each_new_connector_in_state(old_state, connector, conn_state, i) {
> > 
> > Not strictly related to this patch, but I've been wondering how this
> > works, given that we need to loop over connectors in the new state, not
> > the old state. After some investigation I've realized that both the old
> > and new states contain the same list of objects, as we don't keep a copy
> > of the old global atomic state. old_state was the new state before the
> > state swap, and the swap operation sets state->/objects/[*].state to the
> > old state for all objects, but doesn't modify the object pointers. This is
> > possibly more of a question for Daniel, should this be captured in the
> > documentation somewhere (and is my understanding correct) ?
> 
> Yes. But that will go away soon after this patch + all drivers converted.

Will it ? Even with the new helpers we will have code looping over objects 
from the old state, like here. As the code intends on looping over objects in 
the new state this is confusing until you realize that the old state always 
contains the same objects as the new state. As Ville mentioned, 
drm_atomic_state would be better named drm_atomic_transaction, this would 
remove the ambiguity.

> This is why get_state should not be called during atomic commit, and
> get_existing_state will be removed.

[snip]

-- 
Regards,

Laurent Pinchart

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

  reply	other threads:[~2017-01-18 18:03 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16  9:37 [PATCH v3 0/7] drm/atomic: Add accessor macros for all atomic state Maarten Lankhorst
2017-01-16  9:37 ` [PATCH v3 1/7] drm/atomic: Add new iterators over all state, v3 Maarten Lankhorst
2017-01-16 23:11   ` Laurent Pinchart
2017-01-17  7:41     ` Maarten Lankhorst
2017-01-18 22:56       ` Laurent Pinchart
2017-01-23  8:48         ` Daniel Vetter
2017-02-12 12:11           ` Laurent Pinchart
2017-02-12 12:13   ` Laurent Pinchart
2017-01-16  9:37 ` [PATCH v3 2/7] drm/atomic: Make add_affected_connectors look at crtc_state Maarten Lankhorst
2017-01-16 23:29   ` Laurent Pinchart
2017-01-16  9:37 ` [PATCH v3 3/7] drm/atomic: Use new atomic iterator macros Maarten Lankhorst
2017-01-16 23:55   ` Laurent Pinchart
2017-02-14 20:03     ` Daniel Vetter
2017-02-14 20:07       ` Laurent Pinchart
2017-01-16  9:37 ` [PATCH v3 4/7] drm/atomic: Fix atomic helpers to use the new " Maarten Lankhorst
2017-01-17  1:01   ` Laurent Pinchart
2017-01-18 14:49     ` Maarten Lankhorst
2017-01-18 18:03       ` Laurent Pinchart [this message]
2017-01-16  9:37 ` [PATCH v3 5/7] drm/atomic: Add macros to access existing old/new state Maarten Lankhorst
2017-01-17  1:05   ` Laurent Pinchart
2017-01-16  9:37 ` [PATCH v3 6/7] drm/atomic: Convert get_existing_state callers to get_old/new_state, v2 Maarten Lankhorst
2017-01-17  1:12   ` Laurent Pinchart
2017-02-16 14:37     ` Maarten Lankhorst
2017-01-17  1:27   ` Laurent Pinchart
2017-02-16 14:34     ` Maarten Lankhorst
2017-01-16  9:37 ` [PATCH v3 7/7] drm/blend: Use new atomic iterator macros Maarten Lankhorst
2017-01-17  1:14   ` Laurent Pinchart
2017-01-16 11:24 ` ✗ Fi.CI.BAT: warning for drm/atomic: Add accessor macros for all atomic state. (rev4) Patchwork
2017-01-17  0:45 ` [PATCH v3 0/7] drm/atomic: Add accessor macros for all atomic state Laurent Pinchart
2017-01-23  8:50   ` [Intel-gfx] " Daniel Vetter
2017-01-17  1:34 ` Laurent Pinchart
2017-02-12 12:35 ` Laurent Pinchart

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=5525216.MXDbAvR95R@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /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.