public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Maiti, Nabendu Bikash" <nabendu.bikash.maiti@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Add BXT Sprite plane fractional scalings
Date: Wed, 18 Nov 2015 15:19:17 +0200	[thread overview]
Message-ID: <20151118131917.GH4437@intel.com> (raw)
In-Reply-To: <564C7805.9060407@intel.com>

On Wed, Nov 18, 2015 at 06:37:17PM +0530, Maiti, Nabendu Bikash wrote:
> 
> 
> On 11/18/2015 5:41 PM, Ville Syrjälä wrote:
> > On Wed, Nov 18, 2015 at 05:13:01PM +0530, Nabendu Maiti wrote:
> >> On older platforms scalers/cliping used to provide destination size an
> >> exact multiple of src size.
> >> Gen-9 and above support fractional ratio of dst/src so that source is
> >> not manipulated to meet the exact multiple factor.
> >>
> >> Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
> >> ---
> >>   drivers/gpu/drm/i915/intel_sprite.c | 48 +++++++++++++++++++++----------------
> >>   1 file changed, 28 insertions(+), 20 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> >> index 2b96f33..e8c17ae 100644
> >> --- a/drivers/gpu/drm/i915/intel_sprite.c
> >> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> >> @@ -813,29 +813,37 @@ intel_check_sprite_plane(struct drm_plane *plane,
> >>   	crtc_h = drm_rect_height(dst);
> >>   
> >>   	if (state->visible) {
> >> -		/* check again in case clipping clamped the results */
> >> -		hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
> >> -		if (hscale < 0) {
> >> -			DRM_DEBUG_KMS("Horizontal scaling factor out of limits\n");
> >> -			drm_rect_debug_print("src: ", src, true);
> >> -			drm_rect_debug_print("dst: ", dst, false);
> >> -
> >> -			return hscale;
> >> -		}
> >>   
> >> -		vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
> >> -		if (vscale < 0) {
> >> -			DRM_DEBUG_KMS("Vertical scaling factor out of limits\n");
> >> -			drm_rect_debug_print("src: ", src, true);
> >> -			drm_rect_debug_print("dst: ", dst, false);
> >> +		/* Gen 9 and above has fractional scaling support */
> >> +		if (INTEL_INFO(plane->dev)->gen < 9) {
> >>   
> >> -			return vscale;
> >> -		}
> >> +			/* check again in case clipping clamped the results */
> >> +			hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
> >> +			if (hscale < 0) {
> >> +				DRM_DEBUG_KMS("Horizontal scaling factor out of limits\n");
> >> +				drm_rect_debug_print("src: ", src, true);
> >> +				drm_rect_debug_print("dst: ", dst, false);
> >> +
> >> +				return hscale;
> >> +			}
> >> +
> >> +			vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
> >> +			if (vscale < 0) {
> >> +				DRM_DEBUG_KMS("Vertical scaling factor out of limits\n");
> >> +				drm_rect_debug_print("src: ", src, true);
> >> +				drm_rect_debug_print("dst: ", dst, false);
> >>   
> >> -		/* Make the source viewport size an exact multiple of the scaling factors. */
> >> -		drm_rect_adjust_size(src,
> >> -				     drm_rect_width(dst) * hscale - drm_rect_width(src),
> >> -				     drm_rect_height(dst) * vscale - drm_rect_height(src));
> >> +				return vscale;
> >> +			}
> >> +
> >> +			/*
> >> +			 * Make the source viewport size an exact
> >> +			 * multiple of the scaling factors.
> >> +			 */
> >> +			drm_rect_adjust_size(src,
> >> +					     drm_rect_width(dst) * hscale - drm_rect_width(src),
> >> +					     drm_rect_height(dst) * vscale - drm_rect_height(src));
> >> +		}
> > NAK. This code just makes sure the actual scaling ratio matches what we
> > calculated. As in there may have been some amount of rounding involved
> > etc.
> >
> > The part you actually want to change is what comes after this where we
> > throw away the fractional part of the coordinates. And then you need to
> > change the actual hw programming so that we actually feed the sub-pixel
> > coordinates to the hardware.
> 
> In line
> 
> drm_rect_adjust_size(src,
> +					     drm_rect_width(dst) * hscale - drm_rect_width(src),
> +					     drm_rect_height(dst) * vscale - drm_rect_height(src));
> 
> I think we throw away the fractional part,

No, we don't.

> which modifies the src,rectangle. In commit we use the modified state->src size.
> 
> >>   
> >>   		drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16,
> >>   				    state->base.rotation);
> >> -- 
> >> 1.9.1
> >>
> >> _______________________________________________
> >> Intel-gfx mailing list
> >> Intel-gfx@lists.freedesktop.org
> >> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
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-11-18 13:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-18 11:43 [PATCH] drm/i915: Add BXT Sprite plane fractional scalings Nabendu Maiti
2015-11-18 12:11 ` Ville Syrjälä
2015-11-18 13:07   ` Maiti, Nabendu Bikash
2015-11-18 13:19     ` Ville Syrjälä [this message]
2015-11-26 18:19       ` Nabendu Maiti
2015-11-26 18:33         ` Ville Syrjälä
2015-11-26 19:30           ` Ville Syrjälä
2015-12-07 18:15             ` Nabendu Maiti

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=20151118131917.GH4437@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=nabendu.bikash.maiti@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