Skip to contentSkip to conversation

drm/i915/skl: don't fail colorkey + scaler request

PATCH Applied Chandra Konduru 4 participants 6 messages May 18, 2015 – May 22, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/skl: don't fail colorkey + scaler request

There is a mplayer video failure reported with xv.
This is because there is a request to do both plane scaling and colorkey. Because skl hw doesn't support plane scaling and colorkey at the same time, request is failed which is expected behavior.

To make xv operate, this patch allows colorkey continue to work without using scaler. Then behavior would be similar to platforms without plane scaler support.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90449

---
 drivers/gpu/drm/i915/intel_display.c |   14 +++++++++-----
 drivers/gpu/drm/i915/intel_sprite.c  |   31 +++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_display.c +9 -5
index 7ab75c0..fc5cef0 100644
@@ -4505,9 +4505,10 @@ skl_update_scaler_users(
 	}
 
 	/* check colorkey */
-	if (intel_plane && intel_plane->ckey.flags != I915_SET_COLORKEY_NONE) {
-		DRM_DEBUG_KMS("PLANE:%d scaling with color key not allowed",
-			intel_plane->base.base.id);
+	if (WARN_ON(intel_plane &&
+		intel_plane->ckey.flags != I915_SET_COLORKEY_NONE)) {
+		DRM_DEBUG_KMS("PLANE:%d scaling %ux%u->%ux%u not allowed with colorkey",
+			intel_plane->base.base.id, src_w, src_h, dst_w, dst_h);
 		return -EINVAL;
 	}
 
@@ -13049,8 +13050,11 @@ intel_check_primary_plane(struct drm_plane *plane,
 		intel_atomic_get_crtc_state(state->base.state, intel_crtc) : NULL;
 
 	if (INTEL_INFO(dev)->gen >= 9) {
-		min_scale = 1;
-		max_scale = skl_max_scale(intel_crtc, crtc_state);
+		/* use scaler when colorkey is not required */
+		if (to_intel_plane(plane)->ckey.flags == I915_SET_COLORKEY_NONE) {
+			min_scale = 1;
+			max_scale = skl_max_scale(intel_crtc, crtc_state);
+		}
 		can_position = true;
 	}
 
drivers/gpu/drm/i915/intel_sprite.c +21 -10
index 16d0e48..9004e47 100644
@@ -775,7 +775,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	struct drm_rect *dst = &state->dst;
 	const struct drm_rect *clip = &state->clip;
 	int hscale, vscale;
-	int max_scale, min_scale;
+	int max_scale, min_scale, can_scale;
 	int pixel_size;
 	int ret;
 
@@ -800,18 +800,29 @@ intel_check_sprite_plane(struct drm_plane *plane,
 		return -EINVAL;
 	}
 
+	/* setup can_scale, min_scale, max_scale */
+	if (INTEL_INFO(dev)->gen >= 9) {
+		/* use scaler when colorkey is not required */
+		if (intel_plane->ckey.flags == I915_SET_COLORKEY_NONE) {
+			can_scale = 1;
+			min_scale = 1;
+			max_scale = skl_max_scale(intel_crtc, crtc_state);
+		} else {
+			can_scale = 0;
+			min_scale = DRM_PLANE_HELPER_NO_SCALING;
+			max_scale = DRM_PLANE_HELPER_NO_SCALING;
+		}
+	} else {
+		can_scale = intel_plane->can_scale;
+		max_scale = intel_plane->max_downscale << 16;
+		min_scale = intel_plane->can_scale ? 1 : (1 << 16);
+	}
+
 	/*
 	 * FIXME the following code does a bunch of fuzzy adjustments to the
 	 * coordinates and sizes. We probably need some way to decide whether
 	 * more strict checking should be done instead.
 	 */
-	max_scale = intel_plane->max_downscale << 16;
-	min_scale = intel_plane->can_scale ? 1 : (1 << 16);
-
-	if (INTEL_INFO(dev)->gen >= 9) {
-		min_scale = 1;
-		max_scale = skl_max_scale(intel_crtc, crtc_state);
-	}
 
 	drm_rect_rotate(src, fb->width << 16, fb->height << 16,
 			state->base.rotation);
@@ -882,7 +893,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 			 * Must keep src and dst the
 			 * same if we can't scale.
 			 */
-			if (!intel_plane->can_scale)
+			if (!can_scale)
 				crtc_w &= ~1;
 
 			if (crtc_w == 0)
@@ -894,7 +905,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {
 		unsigned int width_bytes;
 
-		WARN_ON(!intel_plane->can_scale);
+		WARN_ON(!can_scale);
 
 		/* FIXME interlacing min height is 6 */
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#1 lore raw

Task id: 6431 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

PNV                                  234/234              234/234
ILK                                  262/262              262/262
SNB                 -1              282/282              281/282
IVB                                  300/300              300/300
BYT                                  254/254              254/254

BDW -1 275/275 274/275
-------------------------------------Detailed-------------------------------------
Platform Test drm-intel-nightly Series Applied
SNB igt@pm_rpm@dpms-mode-unset-non-lpsp DMESG_WARN(7)PASS(1) DMESG_WARN(1)
(dmesg patch applied)WARNING:at_drivers/gpu/drm/i915/intel_uncore.c:#assert_device_not_suspended[i915]()@WARNING:.* at .* assert_device_not_suspended+0x
*BDW igt@gem_gtt_hog PASS(2) DMESG_WARN(1)
(dmesg patch applied)WARNING:at_drivers/gpu/drm/i915/intel_display.c:#assert_plane[i915]()@WARNING:.* at .* assert_plane assertion_failure@assertion failure
WARNING:at_drivers/gpu/drm/drm_irq.c:#drm_wait_one_vblank[drm]()@WARNING:.* at .* drm_wait_one_vblank+0x
Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Chandra Konduru

Bin confirmed that, with the patch ,the issue didn't exist now. Need a reviewer so the patch can be lined up for merge. Ville or anyone in cc list?
-Chandra

Quoted 134 lines

-----Original Message-----
From: Konduru, Chandra
Sent: Monday, May 18, 2015 4:19 PM
To: [email protected]
Cc: Konduru, Chandra; Roper, Matthew D; Syrjala, Ville; Vetter, Daniel; Xu, Bin A
Subject: [PATCH] drm/i915/skl: don't fail colorkey + scaler request

There is a mplayer video failure reported with xv.
This is because there is a request to do both plane scaling and colorkey. Because skl hw doesn't support plane scaling and colorkey at the same time, request is failed which is expected behavior.

To make xv operate, this patch allows colorkey continue to work without using scaler. Then behavior would be similar to platforms without plane scaler support.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90449

---
 drivers/gpu/drm/i915/intel_display.c |   14 +++++++++-----
 drivers/gpu/drm/i915/intel_sprite.c  |   31 +++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_display.c +4 -3
index 7ab75c0..fc5cef0 100644
@@ -4505,9 +4505,10 @@ skl_update_scaler_users(
 	}
 
 	/* check colorkey */
-	if (intel_plane && intel_plane->ckey.flags !=
 I915_SET_COLORKEY_NONE) {
-		DRM_DEBUG_KMS("PLANE:%d scaling with color key not
 allowed",
-			intel_plane->base.base.id);
+	if (WARN_ON(intel_plane &&
+		intel_plane->ckey.flags != I915_SET_COLORKEY_NONE)) {
+		DRM_DEBUG_KMS("PLANE:%d scaling %ux%u->%ux%u not
 allowed with colorkey",
+			intel_plane->base.base.id, src_w, src_h, dst_w, dst_h);
drivers/gpu/drm/i915/intel_display.c +5 -2
 		return -EINVAL;
 	}
@@ -13049,8 +13050,11 @@ intel_check_primary_plane(struct drm_plane
 *plane,
 		intel_atomic_get_crtc_state(state->base.state, intel_crtc) :
 NULL;
 
 	if (INTEL_INFO(dev)->gen >= 9) {
-		min_scale = 1;
-		max_scale = skl_max_scale(intel_crtc, crtc_state);
+		/* use scaler when colorkey is not required */
+		if (to_intel_plane(plane)->ckey.flags ==
 I915_SET_COLORKEY_NONE) {
+			min_scale = 1;
+			max_scale = skl_max_scale(intel_crtc, crtc_state);
+		}
drivers/gpu/drm/i915/intel_display.c +0 -0
 		can_position = true;
 	}
drivers/gpu/drm/i915/intel_sprite.c +19 -1
index 16d0e48..9004e47 100644
@@ -775,7 +775,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	struct drm_rect *dst = &state->dst;
 	const struct drm_rect *clip = &state->clip;
 	int hscale, vscale;
-	int max_scale, min_scale;
+	int max_scale, min_scale, can_scale;
 	int pixel_size;
 	int ret;
 
@@ -800,18 +800,29 @@ intel_check_sprite_plane(struct drm_plane *plane,
 		return -EINVAL;
 	}
 
+	/* setup can_scale, min_scale, max_scale */
+	if (INTEL_INFO(dev)->gen >= 9) {
+		/* use scaler when colorkey is not required */
+		if (intel_plane->ckey.flags == I915_SET_COLORKEY_NONE) {
+			can_scale = 1;
+			min_scale = 1;
+			max_scale = skl_max_scale(intel_crtc, crtc_state);
+		} else {
+			can_scale = 0;
+			min_scale = DRM_PLANE_HELPER_NO_SCALING;
+			max_scale = DRM_PLANE_HELPER_NO_SCALING;
+		}
+	} else {
+		can_scale = intel_plane->can_scale;
+		max_scale = intel_plane->max_downscale << 16;
+		min_scale = intel_plane->can_scale ? 1 : (1 << 16);
+	}
+
 	/*
 	 * FIXME the following code does a bunch of fuzzy adjustments to the
 	 * coordinates and sizes. We probably need some way to decide

whether

drivers/gpu/drm/i915/intel_sprite.c +2 -10
 	 * more strict checking should be done instead.
 	 */
-	max_scale = intel_plane->max_downscale << 16;
-	min_scale = intel_plane->can_scale ? 1 : (1 << 16);
-
-	if (INTEL_INFO(dev)->gen >= 9) {
-		min_scale = 1;
-		max_scale = skl_max_scale(intel_crtc, crtc_state);
-	}
 
 	drm_rect_rotate(src, fb->width << 16, fb->height << 16,
 			state->base.rotation);
@@ -882,7 +893,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 			 * Must keep src and dst the
 			 * same if we can't scale.
 			 */
-			if (!intel_plane->can_scale)
+			if (!can_scale)
 				crtc_w &= ~1;
 
 			if (crtc_w == 0)
@@ -894,7 +905,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {
 		unsigned int width_bytes;
 
-		WARN_ON(!intel_plane->can_scale);
+		WARN_ON(!can_scale);
 
 		/* FIXME interlacing min height is 6 */
 
--
Quoted 1 line

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#3 lore raw
In reply to Chandra Konduru
Quoted 54 lines · Chandra Konduru

There is a mplayer video failure reported with xv.
This is because there is a request to do both plane scaling and colorkey. Because skl hw doesn't support plane scaling and colorkey at the same time, request is failed which is expected behavior.

To make xv operate, this patch allows colorkey continue to work without using scaler. Then behavior would be similar to platforms without plane scaler support.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90449

---
 drivers/gpu/drm/i915/intel_display.c |   14 +++++++++-----
 drivers/gpu/drm/i915/intel_sprite.c  |   31 +++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_display.c +9 -5
index 7ab75c0..fc5cef0 100644
@@ -4505,9 +4505,10 @@ skl_update_scaler_users(
 	}
 
 	/* check colorkey */
-	if (intel_plane && intel_plane->ckey.flags != I915_SET_COLORKEY_NONE) {
-		DRM_DEBUG_KMS("PLANE:%d scaling with color key not allowed",
-			intel_plane->base.base.id);
+	if (WARN_ON(intel_plane &&
+		intel_plane->ckey.flags != I915_SET_COLORKEY_NONE)) {
+		DRM_DEBUG_KMS("PLANE:%d scaling %ux%u->%ux%u not allowed with colorkey",
+			intel_plane->base.base.id, src_w, src_h, dst_w, dst_h);
 		return -EINVAL;
 	}
 
@@ -13049,8 +13050,11 @@ intel_check_primary_plane(struct drm_plane *plane,
 		intel_atomic_get_crtc_state(state->base.state, intel_crtc) : NULL;
 
 	if (INTEL_INFO(dev)->gen >= 9) {
-		min_scale = 1;
-		max_scale = skl_max_scale(intel_crtc, crtc_state);
+		/* use scaler when colorkey is not required */
+		if (to_intel_plane(plane)->ckey.flags == I915_SET_COLORKEY_NONE) {
+			min_scale = 1;
+			max_scale = skl_max_scale(intel_crtc, crtc_state);
+		}
 		can_position = true;
 	}
 
drivers/gpu/drm/i915/intel_sprite.c +0 -0
index 16d0e48..9004e47 100644

drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct drm_plane *plane, · line 778

Quoted 5 lines
drivers/gpu/drm/i915/intel_sprite.c +1 -1
@@ -775,7 +775,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	struct drm_rect *dst = &state->dst;
 	const struct drm_rect *clip = &state->clip;
 	int hscale, vscale;
-	int max_scale, min_scale;
+	int max_scale, min_scale, can_scale;

can_scale ought to be bool. Otherwise this looks good. So with that bikeshed done this gets:

Ps. Please use my @linux.intel.com address when cc:ing me on patches. I try to shovel all patch traffic through that and use the @intel.com address for other stuff.

Quoted 65 lines
drivers/gpu/drm/i915/intel_sprite.c +20 -9
 	int pixel_size;
 	int ret;
 
@@ -800,18 +800,29 @@ intel_check_sprite_plane(struct drm_plane *plane,
 		return -EINVAL;
 	}
 
+	/* setup can_scale, min_scale, max_scale */
+	if (INTEL_INFO(dev)->gen >= 9) {
+		/* use scaler when colorkey is not required */
+		if (intel_plane->ckey.flags == I915_SET_COLORKEY_NONE) {
+			can_scale = 1;
+			min_scale = 1;
+			max_scale = skl_max_scale(intel_crtc, crtc_state);
+		} else {
+			can_scale = 0;
+			min_scale = DRM_PLANE_HELPER_NO_SCALING;
+			max_scale = DRM_PLANE_HELPER_NO_SCALING;
+		}
+	} else {
+		can_scale = intel_plane->can_scale;
+		max_scale = intel_plane->max_downscale << 16;
+		min_scale = intel_plane->can_scale ? 1 : (1 << 16);
+	}
+
 	/*
 	 * FIXME the following code does a bunch of fuzzy adjustments to the
 	 * coordinates and sizes. We probably need some way to decide whether
 	 * more strict checking should be done instead.
 	 */
-	max_scale = intel_plane->max_downscale << 16;
-	min_scale = intel_plane->can_scale ? 1 : (1 << 16);
-
-	if (INTEL_INFO(dev)->gen >= 9) {
-		min_scale = 1;
-		max_scale = skl_max_scale(intel_crtc, crtc_state);
-	}
 
 	drm_rect_rotate(src, fb->width << 16, fb->height << 16,
 			state->base.rotation);
@@ -882,7 +893,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 			 * Must keep src and dst the
 			 * same if we can't scale.
 			 */
-			if (!intel_plane->can_scale)
+			if (!can_scale)
 				crtc_w &= ~1;
 
 			if (crtc_w == 0)
@@ -894,7 +905,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {
 		unsigned int width_bytes;
 
-		WARN_ON(!intel_plane->can_scale);
+		WARN_ON(!can_scale);
 
 		/* FIXME interlacing min height is 6 */
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 50 lines · Ville Syrjälä
Quoted 49 lines · Chandra Konduru

There is a mplayer video failure reported with xv.
This is because there is a request to do both plane scaling and colorkey. Because skl hw doesn't support plane scaling and colorkey at the same time, request is failed which is expected behavior.

To make xv operate, this patch allows colorkey continue to work without using scaler. Then behavior would be similar to platforms without plane scaler support.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90449

---
 drivers/gpu/drm/i915/intel_display.c |   14 +++++++++-----
 drivers/gpu/drm/i915/intel_sprite.c  |   31 +++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_display.c +9 -5
index 7ab75c0..fc5cef0 100644
@@ -4505,9 +4505,10 @@ skl_update_scaler_users(
 	}
 
 	/* check colorkey */
-	if (intel_plane && intel_plane->ckey.flags != I915_SET_COLORKEY_NONE) {
-		DRM_DEBUG_KMS("PLANE:%d scaling with color key not allowed",
-			intel_plane->base.base.id);
+	if (WARN_ON(intel_plane &&
+		intel_plane->ckey.flags != I915_SET_COLORKEY_NONE)) {
+		DRM_DEBUG_KMS("PLANE:%d scaling %ux%u->%ux%u not allowed with colorkey",
+			intel_plane->base.base.id, src_w, src_h, dst_w, dst_h);
 		return -EINVAL;
 	}
 
@@ -13049,8 +13050,11 @@ intel_check_primary_plane(struct drm_plane *plane,
 		intel_atomic_get_crtc_state(state->base.state, intel_crtc) : NULL;
 
 	if (INTEL_INFO(dev)->gen >= 9) {
-		min_scale = 1;
-		max_scale = skl_max_scale(intel_crtc, crtc_state);
+		/* use scaler when colorkey is not required */
+		if (to_intel_plane(plane)->ckey.flags == I915_SET_COLORKEY_NONE) {
+			min_scale = 1;
+			max_scale = skl_max_scale(intel_crtc, crtc_state);
+		}
 		can_position = true;
 	}
 
Quoted 13 lines

drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct drm_plane *plane, · line 778

Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 16d0e48..9004e47 100644
@@ -775,7 +775,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	struct drm_rect *dst = &state->dst;
 	const struct drm_rect *clip = &state->clip;
 	int hscale, vscale;
-	int max_scale, min_scale;
+	int max_scale, min_scale, can_scale;

can_scale ought to be bool. Otherwise this looks good. So with that bikeshed done this gets:

Done. Aside, intel_check_sprite_plane is a giant function, some extraction of sub-parts and helpers (like computing can_scale and stuff) would be good. A lot of the big local variable list could e.g. be moved into intel_plane_state (like the dynamic can_scale) and then we just need to pass around the state pointer to the various subfunctions.

Quoted 1 line

Queued for -next, thanks for the patch.
-Daniel

Quoted 78 lines

Ps. Please use my @linux.intel.com address when cc:ing me on patches. I try to shovel all patch traffic through that and use the @intel.com address for other stuff.

Quoted 65 lines
drivers/gpu/drm/i915/intel_sprite.c +20 -9
 	int pixel_size;
 	int ret;
 
@@ -800,18 +800,29 @@ intel_check_sprite_plane(struct drm_plane *plane,
 		return -EINVAL;
 	}
 
+	/* setup can_scale, min_scale, max_scale */
+	if (INTEL_INFO(dev)->gen >= 9) {
+		/* use scaler when colorkey is not required */
+		if (intel_plane->ckey.flags == I915_SET_COLORKEY_NONE) {
+			can_scale = 1;
+			min_scale = 1;
+			max_scale = skl_max_scale(intel_crtc, crtc_state);
+		} else {
+			can_scale = 0;
+			min_scale = DRM_PLANE_HELPER_NO_SCALING;
+			max_scale = DRM_PLANE_HELPER_NO_SCALING;
+		}
+	} else {
+		can_scale = intel_plane->can_scale;
+		max_scale = intel_plane->max_downscale << 16;
+		min_scale = intel_plane->can_scale ? 1 : (1 << 16);
+	}
+
 	/*
 	 * FIXME the following code does a bunch of fuzzy adjustments to the
 	 * coordinates and sizes. We probably need some way to decide whether
 	 * more strict checking should be done instead.
 	 */
-	max_scale = intel_plane->max_downscale << 16;
-	min_scale = intel_plane->can_scale ? 1 : (1 << 16);
-
-	if (INTEL_INFO(dev)->gen >= 9) {
-		min_scale = 1;
-		max_scale = skl_max_scale(intel_crtc, crtc_state);
-	}
 
 	drm_rect_rotate(src, fb->width << 16, fb->height << 16,
 			state->base.rotation);
@@ -882,7 +893,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 			 * Must keep src and dst the
 			 * same if we can't scale.
 			 */
-			if (!intel_plane->can_scale)
+			if (!can_scale)
 				crtc_w &= ~1;
 
 			if (crtc_w == 0)
@@ -894,7 +905,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {
 		unsigned int width_bytes;
 
-		WARN_ON(!intel_plane->can_scale);
+		WARN_ON(!can_scale);
 
 		/* FIXME interlacing min height is 6 */
 
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw
Quoted 65 lines · Daniel Vetter
Quoted 50 lines · Ville Syrjälä
Quoted 49 lines · Chandra Konduru

There is a mplayer video failure reported with xv.
This is because there is a request to do both plane scaling and colorkey. Because skl hw doesn't support plane scaling and colorkey at the same time, request is failed which is expected behavior.

To make xv operate, this patch allows colorkey continue to work without using scaler. Then behavior would be similar to platforms without plane scaler support.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90449

---
 drivers/gpu/drm/i915/intel_display.c |   14 +++++++++-----
 drivers/gpu/drm/i915/intel_sprite.c  |   31 +++++++++++++++++++++----------
 2 files changed, 30 insertions(+), 15 deletions(-)
drivers/gpu/drm/i915/intel_display.c +9 -5
index 7ab75c0..fc5cef0 100644
@@ -4505,9 +4505,10 @@ skl_update_scaler_users(
 	}
 
 	/* check colorkey */
-	if (intel_plane && intel_plane->ckey.flags != I915_SET_COLORKEY_NONE) {
-		DRM_DEBUG_KMS("PLANE:%d scaling with color key not allowed",
-			intel_plane->base.base.id);
+	if (WARN_ON(intel_plane &&
+		intel_plane->ckey.flags != I915_SET_COLORKEY_NONE)) {
+		DRM_DEBUG_KMS("PLANE:%d scaling %ux%u->%ux%u not allowed with colorkey",
+			intel_plane->base.base.id, src_w, src_h, dst_w, dst_h);
 		return -EINVAL;
 	}
 
@@ -13049,8 +13050,11 @@ intel_check_primary_plane(struct drm_plane *plane,
 		intel_atomic_get_crtc_state(state->base.state, intel_crtc) : NULL;
 
 	if (INTEL_INFO(dev)->gen >= 9) {
-		min_scale = 1;
-		max_scale = skl_max_scale(intel_crtc, crtc_state);
+		/* use scaler when colorkey is not required */
+		if (to_intel_plane(plane)->ckey.flags == I915_SET_COLORKEY_NONE) {
+			min_scale = 1;
+			max_scale = skl_max_scale(intel_crtc, crtc_state);
+		}
 		can_position = true;
 	}
 
Quoted 13 lines

drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct drm_plane *plane, · line 778

Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +1 -1
index 16d0e48..9004e47 100644
@@ -775,7 +775,7 @@ intel_check_sprite_plane(struct drm_plane *plane,
 	struct drm_rect *dst = &state->dst;
 	const struct drm_rect *clip = &state->clip;
 	int hscale, vscale;
-	int max_scale, min_scale;
+	int max_scale, min_scale, can_scale;

can_scale ought to be bool. Otherwise this looks good. So with that bikeshed done this gets:

Quoted 3 lines

Done. Aside, intel_check_sprite_plane is a giant function, some extraction of sub-parts and helpers (like computing can_scale and stuff) would be good.

And some of it should be split up into platform specific checks since not all platforms have the same restrictions. I think what's there is generally valid for ILK-IVB but may not be really valid for others.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx