public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Jindal, Sonika" <sonika.jindal@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 1/2] drm: Adding rotation to drm_plane_helper_check_update
Date: Wed, 14 Jan 2015 13:43:38 +0200	[thread overview]
Message-ID: <20150114114338.GO10649@intel.com> (raw)
In-Reply-To: <000C66961D35964B9714611E548C10AD0C15B153@BGSMSX104.gar.corp.intel.com>

On Wed, Jan 14, 2015 at 09:49:36AM +0000, Jindal, Sonika wrote:
> Since we do drm_rect_rotate with 90 rotation, the src->w changes to src->h.
> Now, when we call drm_rect_calc_hscale, the hscale calculated is lesser than the min_hscale (which is no_scaling by default), so it returns -ERANGE.

If you want no scaling then with 90/270 rotation then your src->w should
be equal to dst->h. Then the calculated vscale will be 1.0. If it's not,
then your test is passing in bad coordinates.

> So, I think we _relaxed is the function which should be called to update the destination size appropriately.
> Please correct me if I am wrong.
> 
> -----Original Message-----
> From: Jindal, Sonika 
> Sent: Wednesday, January 14, 2015 3:06 PM
> To: 'Ville Syrjälä'
> Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
> Subject: RE: [Intel-gfx] [PATCH 1/2] drm: Adding rotation to drm_plane_helper_check_update
> 
> We do exactly like this for sprite plane (ie, rotate the rect, then check scaling and adjust the size accordingly from drm_rect_calc_hscale_relaxed) That's why I saw the need of this for primary plane as well. 
> For sprite plane 90 rotation, intel_check_sprite_plane does the adjustments and the rotated sizes are fine. But since we don't do any of those stuff for primary the destination size doesn't come right, and I get a little corrupted output after rotation.
> With this change, the rotated plane is properly adjusted in the viewport.
> So, I don't think it is a bug in test.
> 
> -----Original Message-----
> From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
> Sent: Wednesday, January 14, 2015 2:58 PM
> To: Jindal, Sonika
> Cc: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH 1/2] drm: Adding rotation to drm_plane_helper_check_update
> 
> On Wed, Jan 14, 2015 at 10:05:53AM +0530, sonika wrote:
> > 
> > On Tuesday 13 January 2015 07:02 PM, Ville Syrjälä wrote:
> > > On Tue, Jan 13, 2015 at 06:03:39PM +0530, Sonika Jindal wrote:
> > >> Taking rotation into account while checking the plane and adjusting 
> > >> the sizes accordingly.
> > >>
> > >> Signed-off-by: Sonika Jindal <sonika.jindal@intel.com>
> > >> ---
> > >>   drivers/gpu/drm/drm_plane_helper.c |   79 ++++++++++++++++++++++++++++++++++--
> > >>   include/drm/drm_plane_helper.h     |    3 +-
> > >>   2 files changed, 77 insertions(+), 5 deletions(-)
> > >>
> > >> diff --git a/drivers/gpu/drm/drm_plane_helper.c
> > >> b/drivers/gpu/drm/drm_plane_helper.c
> > >> index f24c4cf..4badd69 100644
> > >> --- a/drivers/gpu/drm/drm_plane_helper.c
> > >> +++ b/drivers/gpu/drm/drm_plane_helper.c
> > >> @@ -138,9 +138,13 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
> > >>   				    int max_scale,
> > >>   				    bool can_position,
> > >>   				    bool can_update_disabled,
> > >> -				    bool *visible)
> > >> +				    bool *visible,
> > >> +				    unsigned int rotation)
> > >>   {
> > >>   	int hscale, vscale;
> > >> +	int crtc_x, crtc_y;
> > >> +	unsigned int crtc_w, crtc_h;
> > >> +	uint32_t src_x, src_y, src_w, src_h;
> > >>   
> > >>   	if (!fb) {
> > >>   		*visible = false;
> > >> @@ -158,9 +162,13 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
> > >>   		return -EINVAL;
> > >>   	}
> > >>   
> > >> +	if (fb)
> > >> +		drm_rect_rotate(src, fb->width << 16, fb->height << 16,
> > >> +				rotation);
> > >> +
> > >>   	/* Check scaling */
> > >> -	hscale = drm_rect_calc_hscale(src, dest, min_scale, max_scale);
> > >> -	vscale = drm_rect_calc_vscale(src, dest, min_scale, max_scale);
> > >> +	hscale = drm_rect_calc_hscale_relaxed(src, dest, min_scale, max_scale);
> > >> +	vscale = drm_rect_calc_vscale_relaxed(src, dest, min_scale, 
> > >> +max_scale);
> > > This is an unrelated change. Relaxed scaling allows the the src/dest 
> > > rectangles to be reduced in size in order to keep the scaling ration 
> > > within the min/max range. I suppose we should switch to using it to 
> > > make the behaviour uniform across drivers, but definitely should be 
> > > done with a separate patch.
> > Since, I added drm_rect_rotate before this, it changes the src sizes 
> > and it was giving me Invalid scaling if we don't let the sizes to be 
> > changed using _relaxed functions. I am trying this for 90/270 
> > rotation.
> 
> That would indicate a bug somewhere. Pontetially the bug could be in whatever test you're using as well.
> 
> > I can move it to a separate patch if required.
> 
> We nee to figure out why you got the error first.
> 
> --
> Ville Syrjälä
> Intel OTC

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

  reply	other threads:[~2015-01-14 11:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 12:33 [PATCH 0/2] Adding rotattion to drm_plane_helper_check_update Sonika Jindal
2015-01-13 12:33 ` [PATCH 1/2] drm: Adding rotation " Sonika Jindal
2015-01-13 13:32   ` [Intel-gfx] " Ville Syrjälä
2015-01-14  4:35     ` sonika
2015-01-14  9:27       ` Ville Syrjälä
2015-01-14  9:35         ` [Intel-gfx] " Jindal, Sonika
2015-01-14  9:49         ` Jindal, Sonika
2015-01-14 11:43           ` Ville Syrjälä [this message]
2015-01-14 13:54             ` Jindal, Sonika
2015-01-14 18:08               ` Ville Syrjälä
2015-01-15  2:04                 ` [Intel-gfx] " Jindal, Sonika
2015-01-15  9:28                   ` Ville Syrjälä
2015-01-14  5:40     ` [PATCH] " Sonika Jindal
2015-01-14 16:32       ` Matt Roper
2015-01-15 10:39       ` shuang.he
2015-01-13 12:33 ` [PATCH 2/2] drm/i915: Passing " Sonika Jindal
2015-01-13 19:36   ` shuang.he
2015-01-13 18:12 ` [PATCH 0/2] Adding rotattion " Matt Roper
2015-01-14  4:24   ` sonika

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=20150114114338.GO10649@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=sonika.jindal@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