From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 01/10] drm: Add drm_plane_mask()
Date: Mon, 2 Jul 2018 18:55:02 +0300 [thread overview]
Message-ID: <20180702155502.GL5565@intel.com> (raw)
In-Reply-To: <20180626200953.GH9765@intel.com>
On Tue, Jun 26, 2018 at 01:09:53PM -0700, Rodrigo Vivi wrote:
> On Tue, Jun 26, 2018 at 10:47:07PM +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Add drm_plane_mask() which returns the 1<<index for the plane.
> > We already have an identical drm_crtc_mask() for crtcs.
> >
> > Mostly performed with coccinelle:
> > @@
> > @@
> > - (1<<drm_plane_index(
> > + drm_plane_mask(
> > ...)
> > - )
> >
> > @@
> > @@
> > - 1<<drm_plane_index(
> > + drm_plane_mask(
> > ...)
> >
> > @@
> > @@
> > - BIT(drm_plane_index(
> > + drm_plane_mask(
> > ...)
> > - )
> >
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Series pushed to drm-misc-next. Thanks for the reviews/acks.
>
> > ---
> > drivers/gpu/drm/drm_atomic.c | 4 ++--
> > drivers/gpu/drm/drm_framebuffer.c | 2 +-
> > drivers/gpu/drm/drm_simple_kms_helper.c | 2 +-
> > include/drm/drm_plane.h | 14 ++++++++++++--
> > 4 files changed, 16 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > index 178842380f75..684c9d3a1d6c 100644
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -1581,7 +1581,7 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
> > if (WARN_ON(IS_ERR(crtc_state)))
> > return PTR_ERR(crtc_state);
> >
> > - crtc_state->plane_mask &= ~(1 << drm_plane_index(plane));
> > + crtc_state->plane_mask &= ~drm_plane_mask(plane);
> > }
> >
> > plane_state->crtc = crtc;
> > @@ -1591,7 +1591,7 @@ drm_atomic_set_crtc_for_plane(struct drm_plane_state *plane_state,
> > crtc);
> > if (IS_ERR(crtc_state))
> > return PTR_ERR(crtc_state);
> > - crtc_state->plane_mask |= (1 << drm_plane_index(plane));
> > + crtc_state->plane_mask |= drm_plane_mask(plane);
> > }
> >
> > if (crtc)
> > diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> > index ed90974a452a..781af1d42d76 100644
> > --- a/drivers/gpu/drm/drm_framebuffer.c
> > +++ b/drivers/gpu/drm/drm_framebuffer.c
> > @@ -847,7 +847,7 @@ static int atomic_remove_fb(struct drm_framebuffer *fb)
> > if (ret)
> > goto unlock;
> >
> > - plane_mask |= BIT(drm_plane_index(plane));
> > + plane_mask |= drm_plane_mask(plane);
> > }
> >
> > /* This list is only filled when disable_crtcs is set. */
> > diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c
> > index 7a00455ca568..9d87961da1db 100644
> > --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> > +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> > @@ -52,7 +52,7 @@ static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
> > struct drm_crtc_state *state)
> > {
> > bool has_primary = state->plane_mask &
> > - BIT(drm_plane_index(crtc->primary));
> > + drm_plane_mask(crtc->primary);
> >
> > /* We always want to have an active plane with an active CRTC */
> > if (has_primary != state->enable)
> > diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
> > index 7d4d6c7f0afd..cee9dfaaa740 100644
> > --- a/include/drm/drm_plane.h
> > +++ b/include/drm/drm_plane.h
> > @@ -639,10 +639,20 @@ void drm_plane_cleanup(struct drm_plane *plane);
> > * Given a registered plane, return the index of that plane within a DRM
> > * device's list of planes.
> > */
> > -static inline unsigned int drm_plane_index(struct drm_plane *plane)
> > +static inline unsigned int drm_plane_index(const struct drm_plane *plane)
> > {
> > return plane->index;
> > }
> > +
> > +/**
> > + * drm_plane_mask - find the mask of a registered plane
> > + * @plane: plane to find mask for
> > + */
> > +static inline u32 drm_plane_mask(const struct drm_plane *plane)
> > +{
> > + return 1 << drm_plane_index(plane);
> > +}
> > +
> > struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx);
> > void drm_plane_force_disable(struct drm_plane *plane);
> >
> > @@ -678,7 +688,7 @@ static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
> > */
> > #define drm_for_each_plane_mask(plane, dev, plane_mask) \
> > list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
> > - for_each_if ((plane_mask) & (1 << drm_plane_index(plane)))
> > + for_each_if ((plane_mask) & drm_plane_mask(plane))
> >
> > /**
> > * drm_for_each_legacy_plane - iterate over all planes for legacy userspace
> > --
> > 2.16.4
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2018-07-02 15:55 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 19:47 [PATCH 01/10] drm: Add drm_plane_mask() Ville Syrjala
2018-06-26 19:47 ` [PATCH 02/10] drm: Use drm_crtc_mask() Ville Syrjala
2018-06-26 20:11 ` Rodrigo Vivi
2018-06-26 19:47 ` [PATCH 03/10] drm: Add drm_encoder_mask() Ville Syrjala
2018-06-26 20:11 ` Rodrigo Vivi
2018-06-26 19:47 ` [PATCH 04/10] drm: Add drm_connector_mask() Ville Syrjala
2018-06-26 20:12 ` Rodrigo Vivi
2018-06-26 19:47 ` [PATCH 05/10] drm/i915: Use drm_plane_mask() & co Ville Syrjala
2018-06-26 20:16 ` Rodrigo Vivi
2018-06-26 19:47 ` [PATCH 06/10] drm/imx: Use drm_plane_mask() Ville Syrjala
2018-06-26 20:16 ` Rodrigo Vivi
2018-06-27 8:01 ` Philipp Zabel
2018-06-26 19:47 ` [PATCH 07/10] drm/rockchip: Use drm_crtc_mask() Ville Syrjala
2018-06-26 20:16 ` [Intel-gfx] " Rodrigo Vivi
2018-06-27 13:09 ` Heiko Stuebner
2018-06-26 19:47 ` [PATCH 08/10] drm/sun4i: " Ville Syrjala
2018-06-26 20:17 ` Rodrigo Vivi
2018-06-27 7:34 ` Maxime Ripard
2018-06-26 19:47 ` [PATCH 09/10] drm/vc4: " Ville Syrjala
2018-06-26 20:17 ` Rodrigo Vivi
2018-06-26 23:08 ` Eric Anholt
2018-06-26 19:47 ` [PATCH 10/10] drm/vmwgfx: Use drm_plane_mask() & co Ville Syrjala
2018-06-26 20:17 ` Rodrigo Vivi
2018-07-02 17:00 ` Sinclair Yeh
2018-07-03 12:34 ` Ville Syrjälä
2018-06-26 20:09 ` [PATCH 01/10] drm: Add drm_plane_mask() Rodrigo Vivi
2018-07-02 15:55 ` Ville Syrjälä [this message]
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=20180702155502.GL5565@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=rodrigo.vivi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).