[Intel-gfx] [PATCH] drm/i915: Add BXT Sprite plane fractional scalings

Nabendu Maiti nabendu.bikash.maiti at intel.com
Wed Nov 18 03:43:01 PST 2015


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 at 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));
+		}
 
 		drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16,
 				    state->base.rotation);
-- 
1.9.1



More information about the Intel-gfx mailing list