intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/9] drm/i915: Add per-pipe plane identifier
Date: Thu, 17 Nov 2016 17:09:38 -0200	[thread overview]
Message-ID: <1479409778.2382.32.camel@intel.com> (raw)
In-Reply-To: <1478616439-10150-3-git-send-email-ville.syrjala@linux.intel.com>

Em Ter, 2016-11-08 às 16:47 +0200, ville.syrjala@linux.intel.com
escreveu:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> As I told people in [1] we really should not be confusing enum plane
> as a per-pipe plane identifier. Looks like that happened nonetheless,
> so
> let's fix it up by splitting the two into two enums.
> 
> We'll also want something we just directly pass to various register
> offset macros and whatnot on SKL+. So let's make this new thing work
> for that.
> Currently we pass intel_plane->plane for the "sprites" and just a
> hardcoded zero for the "primary" planes. We want to get rid of that
> hardocoding so that we can share the same code for all planes (apart
> from the legacy cursor of course).
> 
> [1] https://lists.freedesktop.org/archives/intel-gfx/2015-September/0
> 76082.html
> 
> Cc: Matt Roper <matthew.d.roper@intel.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h      | 28 +++++++++++++++++++++-----
> --
>  drivers/gpu/drm/i915/intel_display.c |  2 ++
>  drivers/gpu/drm/i915/intel_drv.h     |  3 ++-
>  drivers/gpu/drm/i915/intel_sprite.c  |  1 +
>  4 files changed, 26 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h
> b/drivers/gpu/drm/i915/i915_drv.h
> index 30777dee3f9c..2451b88b1e82 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -171,22 +171,36 @@ static inline bool transcoder_is_dsi(enum
> transcoder transcoder)
>  }
>  
>  /*
> - * I915_MAX_PLANES in the enum below is the maximum (across all
> platforms)
> - * number of planes per CRTC.  Not all platforms really have this
> many planes,
> - * which means some arrays of size I915_MAX_PLANES may have unused
> entries
> - * between the topmost sprite plane and the cursor plane.
> + * Global legacy plane identifier. Valid only for primary/sprite
> + * planes on pre-g4x, and only for primary planes on g4x+.
>   */
>  enum plane {
> -	PLANE_A = 0,
> +	PLANE_A,
>  	PLANE_B,
>  	PLANE_C,
> -	PLANE_CURSOR,
> -	I915_MAX_PLANES,
>  };
>  #define plane_name(p) ((p) + 'A')
>  
>  #define sprite_name(p, s) ((p) * INTEL_INFO(dev_priv)-
> >num_sprites[(p)] + (s) + 'A')
>  
> +/*
> + * Per-pipe plane identifier.
> + * I915_MAX_PLANES in the enum below is the maximum (across all
> platforms)
> + * number of planes per CRTC.  Not all platforms really have this
> many planes,
> + * which means some arrays of size I915_MAX_PLANES may have unused
> entries
> + * between the topmost sprite plane and the cursor plane.
> + *
> + * This is expected to be passed to various register macros
> + * (eg. PLANE_CTL(), PS_PLANE_SEL(), etc.) so adjust with care.
> + */
> +enum plane_id {
> +	PLANE_PRIMARY,
> +	PLANE_SPRITE0,
> +	PLANE_SPRITE1,
> +	PLANE_CURSOR,
> +	I915_MAX_PLANES,
> +};

We now have two different enums defining PLANE_SOMETHING, and we even
moved some stuff from one to the other. I think this adds more
confusion to the code, so we would probably be saner with:

enum plane_id {
	PLANE_ID_PRIMARY,
	PLANE_ID_SPRITE0,
	PLANE_ID_SPRITE1,
	PLANE_ID_CURSOR,
	PLANE_ID_{MAX,NUM,TOTAL,SOMETHINGELSE},
};

Otherwise, the patch does what it says, so:
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

But please get Matt's ack before merging the series since he's been
touching this area of the code for his work on changing how we treat
the plane cursor.

Also, please consider the renames :).

> +
>  enum port {
>  	PORT_NONE = -1,
>  	PORT_A = 0,
> diff --git a/drivers/gpu/drm/i915/intel_display.c
> b/drivers/gpu/drm/i915/intel_display.c
> index 10869360cfdc..b318119330e8 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -15008,6 +15008,7 @@ intel_primary_plane_create(struct
> drm_i915_private *dev_priv, enum pipe pipe)
>  		primary->plane = (enum plane) !pipe;
>  	else
>  		primary->plane = (enum plane) pipe;
> +	primary->id = PLANE_PRIMARY;
>  	primary->frontbuffer_bit = INTEL_FRONTBUFFER_PRIMARY(pipe);
>  	primary->check_plane = intel_check_primary_plane;
>  
> @@ -15203,6 +15204,7 @@ intel_cursor_plane_create(struct
> drm_i915_private *dev_priv, enum pipe pipe)
>  	cursor->max_downscale = 1;
>  	cursor->pipe = pipe;
>  	cursor->plane = pipe;
> +	cursor->id = PLANE_CURSOR;
>  	cursor->frontbuffer_bit = INTEL_FRONTBUFFER_CURSOR(pipe);
>  	cursor->check_plane = intel_check_cursor_plane;
>  	cursor->update_plane = intel_update_cursor_plane;
> diff --git a/drivers/gpu/drm/i915/intel_drv.h
> b/drivers/gpu/drm/i915/intel_drv.h
> index 398195bf6dd1..58fc8e1d2aa8 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -767,7 +767,8 @@ struct intel_plane_wm_parameters {
>  
>  struct intel_plane {
>  	struct drm_plane base;
> -	int plane;
> +	u8 plane;
> +	enum plane_id id;
>  	enum pipe pipe;
>  	bool can_scale;
>  	int max_downscale;
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c
> b/drivers/gpu/drm/i915/intel_sprite.c
> index 5e4eb7cafef0..4b44863a07c2 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -1126,6 +1126,7 @@ intel_sprite_plane_create(struct
> drm_i915_private *dev_priv,
>  
>  	intel_plane->pipe = pipe;
>  	intel_plane->plane = plane;
> +	intel_plane->id = PLANE_SPRITE0 + plane;
>  	intel_plane->frontbuffer_bit =
> INTEL_FRONTBUFFER_SPRITE(pipe, plane);
>  	intel_plane->check_plane = intel_check_sprite_plane;
>  
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-11-17 19:09 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08 14:47 [PATCH 0/9] drm/i915: Add a per-pipe plane identifier enum ville.syrjala
2016-11-08 14:47 ` [PATCH 1/9] drm/i915: Remove some duplicated plane swapping logic ville.syrjala
2016-11-08 15:23   ` Chris Wilson
2016-11-08 15:42     ` Ville Syrjälä
2016-11-14 18:32     ` Ville Syrjälä
2016-11-08 14:47 ` [PATCH 2/9] drm/i915: Add per-pipe plane identifier ville.syrjala
2016-11-08 15:26   ` Chris Wilson
2016-11-08 15:38     ` Ville Syrjälä
2016-11-09  0:53   ` Matt Roper
2016-11-09 13:23     ` Ville Syrjälä
2016-11-17 19:09   ` Paulo Zanoni [this message]
2016-11-17 19:43     ` Ville Syrjälä
2016-11-18 14:17       ` Paulo Zanoni
2016-11-18 14:32         ` Ville Syrjälä
2016-11-18 20:40           ` Paulo Zanoni
2016-11-18 19:16     ` Matt Roper
2016-11-08 14:47 ` [PATCH 3/9] drm/i915: Add crtc->plane_ids_mask ville.syrjala
2016-11-17 19:11   ` Paulo Zanoni
2016-11-08 14:47 ` [PATCH 4/9] drm/i915: Use enum plane_id in SKL wm code ville.syrjala
2016-11-08 17:08   ` [PATCH v2 " ville.syrjala
2016-11-09 15:03   ` [PATCH v3 " ville.syrjala
2016-11-17 19:12     ` Paulo Zanoni
2016-11-17 20:04       ` Ville Syrjälä
2016-11-08 14:47 ` [PATCH 5/9] drm/i915: Use enum plane_id in SKL plane code ville.syrjala
2016-11-17 19:32   ` Paulo Zanoni
2016-11-08 14:47 ` [PATCH 6/9] drm/i915: Use enum plane_id in VLV/CHV sprite code ville.syrjala
2016-11-08 16:04   ` Chris Wilson
2016-11-08 16:56     ` Ville Syrjälä
2016-11-08 17:09   ` [PATCH v2 " ville.syrjala
2016-11-17 20:07     ` Paulo Zanoni
2016-11-17 20:19       ` Ville Syrjälä
2016-11-08 14:47 ` [PATCH 7/9] drm/i915: Use enum plane_id in VLV/CHV wm code ville.syrjala
2016-11-17 20:17   ` Paulo Zanoni
2016-11-17 20:29   ` Paulo Zanoni
2016-11-17 20:39     ` Ville Syrjälä
2016-11-08 14:47 ` [PATCH 8/9] drm/i915: Rename the local 'plane' variable to 'plane_id' in primary plane code ville.syrjala
2016-11-18 14:25   ` Paulo Zanoni
2016-11-18 14:34     ` Ville Syrjälä
2016-11-18 20:41       ` Paulo Zanoni
2016-11-18 21:39         ` Ville Syrjälä
2016-11-08 14:47 ` [PATCH 9/9] drm/i915: Don't populate plane->plane for cursors and sprites ville.syrjala
2016-11-08 15:30   ` Chris Wilson
2016-11-08 15:40     ` Ville Syrjälä
2016-11-08 15:45 ` ✗ Fi.CI.BAT: warning for drm/i915: Add a per-pipe plane identifier enum Patchwork
2016-11-08 17:45 ` ✗ Fi.CI.BAT: warning for drm/i915: Add a per-pipe plane identifier enum (rev3) Patchwork
2016-11-09 16:24 ` ✗ Fi.CI.BAT: warning for drm/i915: Add a per-pipe plane identifier enum (rev4) Patchwork
2016-11-14 18:11   ` Ville Syrjälä
2016-11-15 10:47     ` Imre Deak

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=1479409778.2382.32.camel@intel.com \
    --to=paulo.r.zanoni@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@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 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).