intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Move 90/270 rotation validity check into its own function
Date: Fri, 3 Nov 2017 17:52:05 +0200	[thread overview]
Message-ID: <20171103155205.GY10981@intel.com> (raw)
In-Reply-To: <20171103155017.GX10981@intel.com>

On Fri, Nov 03, 2017 at 05:50:17PM +0200, Ville Syrjälä wrote:
> On Fri, Nov 03, 2017 at 04:37:57PM +0200, Juha-Pekka Heikkila wrote:
> > This makes intel_plane_atomic_check_with_state() generally shorter.
> > 
> > Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
> > ---
> >  drivers/gpu/drm/i915/intel_atomic_plane.c | 53 +++++++++++++++++--------------
> >  1 file changed, 30 insertions(+), 23 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> > index 8e6dc15..6c4c82e2d 100644
> > --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> > +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> > @@ -107,6 +107,35 @@ intel_plane_destroy_state(struct drm_plane *plane,
> >  	drm_atomic_helper_plane_destroy_state(plane, state);
> >  }
> >  
> > +static bool intel_valid_rotation(const struct drm_plane_state *state)

Oh and please name this parameter 'plane_state'. We're trying to slowly
clean up the mess with inconsistent naming of things.

> > +{
> > +	struct drm_format_name_buf format_name;
> > +
> > +	if (state->fb->modifier != I915_FORMAT_MOD_Y_TILED &&
> > +	    state->fb->modifier != I915_FORMAT_MOD_Yf_TILED) {
> > +		DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n");
> > +		return false;
> > +	}
> > +
> > +	/*
> > +	 * 90/270 is not allowed with RGB64 16:16:16:16,
> > +	 * RGB 16-bit 5:6:5, and Indexed 8-bit.
> > +	 * TBD: Add RGB64 case once its added in supported format list.
> > +	 */
> > +	switch (state->fb->format->format) {
> > +	case DRM_FORMAT_C8:
> > +	case DRM_FORMAT_RGB565:
> > +		DRM_DEBUG_KMS("Unsupported pixel format %s for 90/270!\n",
> > +			      drm_get_format_name(state->fb->format->format,
> > +						  &format_name));
> > +		return false;
> > +
> > +	default:
> > +		break;
> > +	}
> 
> Usually there's an empty line after the final return.
> 
> > +	return true;
> > +}
> > +
> >  int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_state,
> >  					struct intel_crtc_state *crtc_state,
> >  					const struct intel_plane_state *old_plane_state,
> > @@ -138,30 +167,8 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
> >  		crtc_state->base.enable ? crtc_state->pipe_src_h : 0;
> >  
> >  	if (state->fb && drm_rotation_90_or_270(state->rotation)) {
> 
> I'd pull these checks into the new function as well (as an early
> return so that we don't have to needlessly indent the whole
> function body). Otherwise the function name doesn't really match
> the implementation.
> 
> > -		struct drm_format_name_buf format_name;
> > -
> > -		if (state->fb->modifier != I915_FORMAT_MOD_Y_TILED &&
> > -		    state->fb->modifier != I915_FORMAT_MOD_Yf_TILED) {
> > -			DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n");
> > +		if (!intel_valid_rotation(state))
> >  			return -EINVAL;
> > -		}
> > -
> > -		/*
> > -		 * 90/270 is not allowed with RGB64 16:16:16:16,
> > -		 * RGB 16-bit 5:6:5, and Indexed 8-bit.
> > -		 * TBD: Add RGB64 case once its added in supported format list.
> > -		 */
> > -		switch (state->fb->format->format) {
> > -		case DRM_FORMAT_C8:
> > -		case DRM_FORMAT_RGB565:
> > -			DRM_DEBUG_KMS("Unsupported pixel format %s for 90/270!\n",
> > -			              drm_get_format_name(state->fb->format->format,
> > -			                                  &format_name));
> > -			return -EINVAL;
> > -
> > -		default:
> > -			break;
> > -		}
> >  	}
> >  
> >  	/* CHV ignores the mirror bit when the rotate bit is set :( */
> > -- 
> > 2.7.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel OTC

-- 
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:[~2017-11-03 15:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 14:37 [PATCH 0/2] drm/i915: This set enables 90/270 degree rotation on 16bpp planes on gen10 Juha-Pekka Heikkila
2017-11-03 14:37 ` [PATCH 1/2] drm/i915: Move 90/270 rotation validity check into its own function Juha-Pekka Heikkila
2017-11-03 15:50   ` Ville Syrjälä
2017-11-03 15:52     ` Ville Syrjälä [this message]
2017-11-03 14:37 ` [PATCH 2/2] drm/i915: Enable 16bpp 90/270 plane rotation for gen10 onwards Juha-Pekka Heikkila
2017-11-03 16:03   ` Ville Syrjälä
2017-11-03 15:17 ` ✓ Fi.CI.BAT: success for drm/i915: This set enables 90/270 degree rotation on 16bpp planes on gen10 Patchwork
2017-11-03 18:10 ` ✗ Fi.CI.IGT: warning " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2017-11-21 14:15 [PATCH 0/2] " Juha-Pekka Heikkila
2017-11-21 14:15 ` [PATCH 1/2] drm/i915: Move 90/270 rotation validity check into its own function Juha-Pekka Heikkila
2018-08-27 12:37 [PATCH 0/2] Enable RGB565 rotation from gen11 onwards Juha-Pekka Heikkila
2018-08-27 12:37 ` [PATCH 1/2] drm/i915: Move 90/270 rotation validity check into its own function Juha-Pekka Heikkila

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=20171103155205.GY10981@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=juhapekka.heikkila@gmail.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).