dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 3/9] drm/plane-helper: Add drm_plane_helper_check_state()
Date: Tue, 26 Jul 2016 19:42:16 +0300	[thread overview]
Message-ID: <20160726164216.GK4329@intel.com> (raw)
In-Reply-To: <20160726163329.GC31051@nuc-i3427.alporthouse.com>

On Tue, Jul 26, 2016 at 05:33:29PM +0100, Chris Wilson wrote:
> On Tue, Jul 26, 2016 at 07:06:58PM +0300, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Add a version of drm_plane_helper_check_update() which takes a plane
> > state instead of having the caller pass in everything.
> > 
> > And to reduce code duplication, let's reimplement
> > drm_plane_helper_check_update() in terms of the new function, by
> > having a tempororary plane state on the stack.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/drm_plane_helper.c | 136 ++++++++++++++++++++++++++++---------
> >  include/drm/drm_plane_helper.h     |   5 ++
> >  2 files changed, 110 insertions(+), 31 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> > index 16c4a7bd7465..1124eb827671 100644
> > --- a/drivers/gpu/drm/drm_plane_helper.c
> > +++ b/drivers/gpu/drm/drm_plane_helper.c
> > @@ -108,14 +108,9 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
> >  }
> >  
> >  /**
> > - * drm_plane_helper_check_update() - Check plane update for validity
> > - * @plane: plane object to update
> > - * @crtc: owning CRTC of owning plane
> > - * @fb: framebuffer to flip onto plane
> > - * @src: source coordinates in 16.16 fixed point
> > - * @dest: integer destination coordinates
> > + * drm_plane_helper_check_state() - Check plane state for validity
> > + * @state: plane state to check
> >   * @clip: integer clipping coordinates
> > - * @rotation: plane rotation
> >   * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point
> >   * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point
> >   * @can_position: is it legal to position the plane such that it
> > @@ -123,8 +118,6 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
> >   *                only be false for primary planes.
> >   * @can_update_disabled: can the plane be updated while the crtc
> >   *                       is disabled?
> > - * @visible: output parameter indicating whether plane is still visible after
> > - *           clipping
> >   *
> >   * Checks that a desired plane update is valid.  Drivers that provide
> >   * their own plane handling rather than helper-provided implementations may
> > @@ -134,29 +127,38 @@ static int get_connectors_for_crtc(struct drm_crtc *crtc,
> >   * RETURNS:
> >   * Zero if update appears valid, error code on failure
> >   */
> > -int drm_plane_helper_check_update(struct drm_plane *plane,
> > -				  struct drm_crtc *crtc,
> > -				  struct drm_framebuffer *fb,
> > -				  struct drm_rect *src,
> > -				  struct drm_rect *dest,
> > -				  const struct drm_rect *clip,
> > -				  unsigned int rotation,
> > -				  int min_scale,
> > -				  int max_scale,
> > -				  bool can_position,
> > -				  bool can_update_disabled,
> > -				  bool *visible)
> > +int drm_plane_helper_check_state(struct drm_plane_state *state,
> > +				 const struct drm_rect *clip,
> > +				 int min_scale,
> > +				 int max_scale,
> > +				 bool can_position,
> > +				 bool can_update_disabled)
> >  {
> > +	struct drm_crtc *crtc = state->crtc;
> > +	struct drm_framebuffer *fb = state->fb;
> > +	struct drm_rect *src = &state->src;
> > +	struct drm_rect *dst = &state->dst;
> > +	unsigned int rotation = state->rotation;
> >  	int hscale, vscale;
> >  
> > +	src->x1 = state->src_x;
> > +	src->y1 = state->src_y;
> > +	src->x2 = state->src_x + state->src_w;
> > +	src->y2 = state->src_y + state->src_h;
> > +
> > +	dst->x1 = state->crtc_x;
> > +	dst->y1 = state->crtc_y;
> > +	dst->x2 = state->crtc_x + state->crtc_w;
> > +	dst->y2 = state->crtc_y + state->crtc_h;
> 
> It's a little surprising to me that the check writes fields into the
> drm_plane_state. Care to at least mention the side-effects in the kernel
> doc?

That's a lot of what the atomic "check" functions do. A bit of a bad
naming convention that. Not sure who came up with it. Should probably
rename them all to "compute" or something.

But I can at leat expand the docs here a bit in the meantime.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2016-07-26 16:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26 16:06 [PATCH 0/9] drm: Store clipped coordinates in drm_plane_state ville.syrjala
2016-07-26 16:06 ` [PATCH 1/9] drm: Warn about negative sizes when calculating scale factor ville.syrjala
2016-07-26 16:24   ` Chris Wilson
2016-07-26 16:39     ` Ville Syrjälä
2016-07-29 20:41       ` [Intel-gfx] " Sean Paul
2016-07-26 16:06 ` [PATCH 2/9] drm: Store clipped src/dst coordinatee in drm_plane_state ville.syrjala
2016-08-01 15:10   ` Sean Paul
2016-07-26 16:06 ` [PATCH 3/9] drm/plane-helper: Add drm_plane_helper_check_state() ville.syrjala
2016-07-26 16:33   ` Chris Wilson
2016-07-26 16:42     ` Ville Syrjälä [this message]
2016-07-27  7:22       ` [Intel-gfx] " Daniel Vetter
2016-07-26 17:34   ` [PATCH v2 " ville.syrjala
2016-08-01 15:10     ` [Intel-gfx] " Sean Paul
2016-08-08  7:29     ` Daniel Kurtz
2016-08-08  7:44       ` [Intel-gfx] " Ville Syrjälä
2016-08-08  7:55   ` [PATCH v3 " ville.syrjala
2016-07-26 16:06 ` [PATCH 4/9] drm/i915: Use drm_plane_state.{src,dst,visible} ville.syrjala
2016-07-26 16:20   ` Chris Wilson
2016-08-01 15:10   ` [PATCH 4/9] drm/i915: Use drm_plane_state.{src, dst, visible} Sean Paul
2016-07-26 16:07 ` [PATCH 5/9] drm/i915: Use drm_plane_helper_check_state() ville.syrjala
2016-08-01 15:10   ` Sean Paul
     [not found] ` <1469549224-1860-1-git-send-email-ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-07-26 16:07   ` [PATCH 6/9] drm/rockchip: Use drm_plane_state.{src,dst} ville.syrjala-VuQAYsv1563Yd54FQh9/CA
2016-07-27  1:08     ` Mark yao
2016-08-01 15:10     ` [Intel-gfx] [PATCH 6/9] drm/rockchip: Use drm_plane_state.{src, dst} Sean Paul
2016-07-26 16:07 ` [PATCH 7/9] drm/rockchip: Use drm_plane_helper_check_state() ville.syrjala
2016-07-27  1:09   ` Mark yao
2016-08-01 15:10   ` [Intel-gfx] " Sean Paul
2016-07-26 16:07 ` [PATCH 8/9] drm/mediatek: " ville.syrjala
2016-08-01 15:10   ` Sean Paul
2016-08-02  5:31   ` Bibby Hsieh
2016-08-02  5:45   ` CK Hu
2016-07-26 16:07 ` [PATCH 9/9] drm/simple_kms_helper: " ville.syrjala
2016-08-01 15:10   ` Sean Paul
2016-08-01 15:12 ` [PATCH 0/9] drm: Store clipped coordinates in drm_plane_state Sean Paul
2016-08-01 15:19   ` Ville Syrjälä
2016-08-02 13:24     ` 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=20160726164216.GK4329@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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;
as well as URLs for NNTP newsgroup(s).