diff mbox series

[RFC,4/6] drm/i915: Get right max plane stride

Message ID 20200123132659.725-5-anshuman.gupta@intel.com (mailing list archive)
State New, archived
Headers show
Series 3 display pipes combination system support | expand

Commit Message

Gupta, Anshuman Jan. 23, 2020, 1:26 p.m. UTC
intel_plane_fb_max_stride should return the max stride of
primary plane for first available pipe in intel device info
pipe_mask.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Ville Syrjälä Jan. 23, 2020, 1:50 p.m. UTC | #1
On Thu, Jan 23, 2020 at 06:56:57PM +0530, Anshuman Gupta wrote:
> intel_plane_fb_max_stride should return the max stride of
> primary plane for first available pipe in intel device info
> pipe_mask.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index b250b31f6000..b9209b7e71d7 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -2703,12 +2703,15 @@ u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
>  {
>  	struct intel_crtc *crtc;
>  	struct intel_plane *plane;
> +	enum pipe pipe;
>  
>  	/*
>  	 * We assume the primary plane for pipe A has
> -	 * the highest stride limits of them all.
> +	 * the highest stride limits of them all,
> +	 * if in case pipe A is disabled, use the first pipe from pipe_mask.
>  	 */
> -	crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
> +	pipe = ffs(INTEL_INFO(dev_priv)->pipe_mask) - 1;
> +	crtc = intel_get_crtc_for_pipe(dev_priv, pipe);

I'd probably just add a small helper for this. Eg.:

intel_get_first_crtc()
{
	return to_intel_crtc(drm_crtc_from_index(0))
}

>  	if (!crtc)
>  		return 0;
>  
> -- 
> 2.24.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index b250b31f6000..b9209b7e71d7 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -2703,12 +2703,15 @@  u32 intel_plane_fb_max_stride(struct drm_i915_private *dev_priv,
 {
 	struct intel_crtc *crtc;
 	struct intel_plane *plane;
+	enum pipe pipe;
 
 	/*
 	 * We assume the primary plane for pipe A has
-	 * the highest stride limits of them all.
+	 * the highest stride limits of them all,
+	 * if in case pipe A is disabled, use the first pipe from pipe_mask.
 	 */
-	crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
+	pipe = ffs(INTEL_INFO(dev_priv)->pipe_mask) - 1;
+	crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
 	if (!crtc)
 		return 0;