Skip to contentSkip to conversation

drm: Fix rounding errors and use scaling in i915.

PATCH New Maarten Lankhorst 2 participants 10 messages Apr 30, 2018

Subsystems (3)
lore
Share & tools
lore

Maarten Lankhorst

author maintainer
#0 lore raw

cover drm: Fix rounding errors and use scaling in i915.

There were some small rounding errors in when clamping with 1.0001 and 0.9999 scaling, solve these and add a testcase for drm helpers, which can be used to prevent more of these errors in the future.

The testcases helped me find an error in v1, which wouldn't have been found in another way.

Maarten Lankhorst (5):
drm/rect: Round above 1 << 16 upwards to correct scale calculation functions. drm/rect: Handle rounding errors in drm_rect_clip_scaled, v2. drm/i915: Do not adjust scale when out of bounds, v2. drm/selftests: Rename the Kconfig option to CONFIG_DRM_DEBUG_SELFTEST drm/selftests: Add drm helper selftest

 drivers/gpu/drm/Kconfig                       |   9 +-
 drivers/gpu/drm/Makefile                      |   2 +-
 drivers/gpu/drm/drm_rect.c                    |  80 ++++--
 drivers/gpu/drm/i915/intel_sprite.c           | 144 +++-------
 drivers/gpu/drm/selftests/Makefile            |   2 +-
 .../gpu/drm/selftests/drm_helper_selftests.h  |   9 +
 drivers/gpu/drm/selftests/test-drm-helper.c   | 247 ++++++++++++++++++
 7 files changed, 362 insertions(+), 131 deletions(-)
 create mode 100644 drivers/gpu/drm/selftests/drm_helper_selftests.h
 create mode 100644 drivers/gpu/drm/selftests/test-drm-helper.c
Signature · 6 lines
2.17.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#1 lore raw

PATCH 1/5 drm/rect: Round above 1 << 16 upwards to correct scale calculation functions.

When calculating limits we want to be as pessimistic as possible, so we have to explicitly say whether we want to round up or down to accurately calculate whether we are below min_scale or above max_scale.

---
 drivers/gpu/drm/drm_rect.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_rect.c +16 -1
index 9817c1445ba9..b179c7c73cc5 100644
@@ -106,7 +106,10 @@ static int drm_calc_scale(int src, int dst)
 	if (dst == 0)
 		return 0;
 
-	scale = src / dst;
+	if (src > (dst << 16))
+		return DIV_ROUND_UP(src, dst);
+	else
+		scale = src / dst;
 
 	return scale;
 }
@@ -121,6 +124,9 @@ static int drm_calc_scale(int src, int dst)
  * Calculate the horizontal scaling factor as
  * (@src width) / (@dst width).
  *
+ * If the scale is below 1 << 16, round down, if above up. This will
+ * calculate the scale with the most pessimistic limit calculation.
+ *
  * RETURNS:
  * The horizontal scaling factor, or errno of out of limits.
  */
@@ -152,6 +158,9 @@ EXPORT_SYMBOL(drm_rect_calc_hscale);
  * Calculate the vertical scaling factor as
  * (@src height) / (@dst height).
  *
+ * If the scale is below 1 << 16, round down, if above up. This will
+ * calculate the scale with the most pessimistic limit calculation.
+ *
  * RETURNS:
  * The vertical scaling factor, or errno of out of limits.
  */
@@ -189,6 +198,9 @@ EXPORT_SYMBOL(drm_rect_calc_vscale);
  * If the calculated scaling factor is above @max_vscale,
  * decrease the height of rectangle @src to compensate.
  *
+ * If the scale is below 1 << 16, round down, if above up. This will
+ * calculate the scale with the most pessimistic limit calculation.
+ *
  * RETURNS:
  * The horizontal scaling factor.
  */
@@ -239,6 +251,9 @@ EXPORT_SYMBOL(drm_rect_calc_hscale_relaxed);
  * If the calculated scaling factor is above @max_vscale,
  * decrease the height of rectangle @src to compensate.
  *
+ * If the scale is below 1 << 16, round down, if above up. This will
+ * calculate the scale with the most pessimistic limit calculation.
+ *
  * RETURNS:
  * The vertical scaling factor.
  */
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#2 lore raw

PATCH 2/5 drm/rect: Handle rounding errors in drm_rect_clip_scaled, v2.

In reply to Maarten Lankhorst

No matter how you perform the clip adjustments, a small error may push the scaling factor to the other side of 0x10000. Solve this with a macro that will fixup the scale to 0x10000 if we accidentally wrap to the other side.

Changes since v1:
- Adjust dst immediately, else drm_rect_width/height on dst gives bogus results.

---
 drivers/gpu/drm/drm_rect.c | 71 ++++++++++++++++++++++++++++----------
 1 file changed, 52 insertions(+), 19 deletions(-)
drivers/gpu/drm/drm_rect.c +52 -19
index b179c7c73cc5..9d6194780a74 100644
@@ -50,6 +50,24 @@ bool drm_rect_intersect(struct drm_rect *r1, const struct drm_rect *r2)
 }
 EXPORT_SYMBOL(drm_rect_intersect);
 
+static int drm_calc_scale(int src, int dst)
+{
+	int scale = 0;
+
+	if (WARN_ON(src < 0 || dst < 0))
+		return -EINVAL;
+
+	if (dst == 0)
+		return 0;
+
+	if (src > (dst << 16))
+		return DIV_ROUND_UP(src, dst);
+	else
+		scale = src / dst;
+
+	return scale;
+}
+
 /**
  * drm_rect_clip_scaled - perform a scaled clip operation
  * @src: source window rectangle
@@ -71,49 +89,64 @@ bool drm_rect_clip_scaled(struct drm_rect *src, struct drm_rect *dst,
 {
 	int diff;
 
+	/*
+	 * When scale is near 1.0 rounding errors may cause the scaling
+	 * factor to the other side. Some hardware may support
+	 * upsampling, but not downsampling, and that would break when
+	 * rounding.
+	 */
+#define FIXUP(oldscale, fn, m, second) do { \
+	if (oldscale != 1 << 16) { \
+		int newscale = drm_calc_scale(fn(src), fn(dst)); \
+ \
+		if (newscale < 0) \
+			return false; \
+ \
+		if ((oldscale < 0x10000) != (newscale < 0x10000)) { \
+			if (!second) \
+				src->m##1 = src->m##2 - (fn(dst) << 16); \
+			else \
+				src->m##2 = src->m##1 + (fn(dst) << 16); \
+		} \
+	} \
+ } while (0)
+
 	diff = clip->x1 - dst->x1;
 	if (diff > 0) {
 		int64_t tmp = src->x1 + (int64_t) diff * hscale;
 		src->x1 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
+		dst->x1 = clip->x1;
+		FIXUP(hscale, drm_rect_width, x, 0);
 	}
+
 	diff = clip->y1 - dst->y1;
 	if (diff > 0) {
 		int64_t tmp = src->y1 + (int64_t) diff * vscale;
 		src->y1 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
+		dst->y1 = clip->y1;
+		FIXUP(vscale, drm_rect_height, y, 0);
 	}
+
 	diff = dst->x2 - clip->x2;
 	if (diff > 0) {
 		int64_t tmp = src->x2 - (int64_t) diff * hscale;
 		src->x2 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
+		dst->x2 = clip->x2;
+		FIXUP(hscale, drm_rect_width, x, 1);
 	}
 	diff = dst->y2 - clip->y2;
 	if (diff > 0) {
 		int64_t tmp = src->y2 - (int64_t) diff * vscale;
 		src->y2 = clamp_t(int64_t, tmp, INT_MIN, INT_MAX);
+		dst->y2 = clip->y2;
+		FIXUP(vscale, drm_rect_height, y, 1);
 	}
+#undef FIXUP
 
-	return drm_rect_intersect(dst, clip);
+	return drm_rect_visible(dst);
 }
 EXPORT_SYMBOL(drm_rect_clip_scaled);
 
-static int drm_calc_scale(int src, int dst)
-{
-	int scale = 0;
-
-	if (WARN_ON(src < 0 || dst < 0))
-		return -EINVAL;
-
-	if (dst == 0)
-		return 0;
-
-	if (src > (dst << 16))
-		return DIV_ROUND_UP(src, dst);
-	else
-		scale = src / dst;
-
-	return scale;
-}
-
 /**
  * drm_rect_calc_hscale - calculate the horizontal scaling factor
  * @src: source window rectangle
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#3 lore raw

PATCH 3/5 drm/i915: Do not adjust scale when out of bounds, v2.

In reply to Maarten Lankhorst

With the previous patch drm_atomic_helper_check_plane_state correctly calculates clipping and the xf86-video-intel ddx is fixed to fall back to GPU correctly when SetPlane fails, we can remove the hack where we try to pan/zoom when out of min/max scaling range. This was already poor behavior where the screen didn't show what was requested, and now instead we reject it outright. This simplifies check_sprite_plane a lot.

Changes since v1:
- Set crtc_h to the height correctly.
- Reject < 3x3 rectangles instead of making them invisible for <gen9. For gen9+ skl_update_scaler_plane will reject them.

---
 drivers/gpu/drm/i915/intel_sprite.c | 144 +++++++---------------------
 1 file changed, 35 insertions(+), 109 deletions(-)
drivers/gpu/drm/i915/intel_sprite.c +35 -109
index aa1dfaa692b9..970015dcc6f1 100644
@@ -936,22 +936,12 @@ intel_check_sprite_plane(struct intel_plane *plane,
 	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
 	struct drm_framebuffer *fb = state->base.fb;
-	int crtc_x, crtc_y;
-	unsigned int crtc_w, crtc_h;
-	uint32_t src_x, src_y, src_w, src_h;
-	struct drm_rect *src = &state->base.src;
-	struct drm_rect *dst = &state->base.dst;
-	struct drm_rect clip = {};
 	int max_stride = INTEL_GEN(dev_priv) >= 9 ? 32768 : 16384;
-	int hscale, vscale;
 	int max_scale, min_scale;
 	bool can_scale;
 	int ret;
 	uint32_t pixel_format = 0;
 
-	*src = drm_plane_state_src(&state->base);
-	*dst = drm_plane_state_dest(&state->base);
-
 	if (!fb) {
 		state->base.visible = false;
 		return 0;
@@ -990,64 +980,19 @@ intel_check_sprite_plane(struct intel_plane *plane,
 		min_scale = 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.
-	 */
-	drm_rect_rotate(src, fb->width << 16, fb->height << 16,
-			state->base.rotation);
-
-	hscale = drm_rect_calc_hscale_relaxed(src, dst, min_scale, max_scale);
-	BUG_ON(hscale < 0);
-
-	vscale = drm_rect_calc_vscale_relaxed(src, dst, min_scale, max_scale);
-	BUG_ON(vscale < 0);
-
-	if (crtc_state->base.enable)
-		drm_mode_get_hv_timing(&crtc_state->base.mode,
-				       &clip.x2, &clip.y2);
-
-	state->base.visible = drm_rect_clip_scaled(src, dst, &clip, hscale, vscale);
-
-	crtc_x = dst->x1;
-	crtc_y = dst->y1;
-	crtc_w = drm_rect_width(dst);
-	crtc_h = drm_rect_height(dst);
+	ret = drm_atomic_helper_check_plane_state(&state->base,
+						  &crtc_state->base,
+						  min_scale, max_scale,
+						  true, true);
+	if (ret)
+		return ret;
 
 	if (state->base.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);
-
-			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);
-
-		/* sanity check to make sure the src viewport wasn't enlarged */
-		WARN_ON(src->x1 < (int) state->base.src_x ||
-			src->y1 < (int) state->base.src_y ||
-			src->x2 > (int) state->base.src_x + state->base.src_w ||
-			src->y2 > (int) state->base.src_y + state->base.src_h);
+		struct drm_rect *src = &state->base.src;
+		struct drm_rect *dst = &state->base.dst;
+		unsigned int crtc_w = drm_rect_width(dst);
+		unsigned int crtc_h = drm_rect_height(dst);
+		uint32_t src_x, src_y, src_w, src_h;
 
 		/*
 		 * Hardware doesn't handle subpixel coordinates.
@@ -1060,58 +1005,39 @@ intel_check_sprite_plane(struct intel_plane *plane,
 		src_y = src->y1 >> 16;
 		src_h = drm_rect_height(src) >> 16;
 
-		if (intel_format_is_yuv(fb->format->format)) {
-			src_x &= ~1;
-			src_w &= ~1;
-
-			/*
-			 * Must keep src and dst the
-			 * same if we can't scale.
-			 */
-			if (!can_scale)
-				crtc_w &= ~1;
+		src->x1 = src_x << 16;
+		src->x2 = (src_x + src_w) << 16;
+		src->y1 = src_y << 16;
+		src->y2 = (src_y + src_h) << 16;
 
-			if (crtc_w == 0)
-				state->base.visible = false;
+		if (intel_format_is_yuv(fb->format->format) &&
+		    (src_x % 2 || src_w % 2)) {
+			DRM_DEBUG_KMS("src x/w (%u, %u) must be a multiple of 2 for YUV planes\n",
+				      src_x, src_w);
+			return -EINVAL;
 		}
-	}
 
-	/* Check size restrictions when scaling */
-	if (state->base.visible && (src_w != crtc_w || src_h != crtc_h)) {
-		unsigned int width_bytes;
-		int cpp = fb->format->cpp[0];
+		/* Check size restrictions when scaling */
+		if (src_w != crtc_w || src_h != crtc_h) {
+			unsigned int width_bytes;
+			int cpp = fb->format->cpp[0];
 
-		WARN_ON(!can_scale);
+			WARN_ON(!can_scale);
 
-		/* FIXME interlacing min height is 6 */
+			width_bytes = ((src_x * cpp) & 63) + src_w * cpp;
 
-		if (crtc_w < 3 || crtc_h < 3)
-			state->base.visible = false;
-
-		if (src_w < 3 || src_h < 3)
-			state->base.visible = false;
-
-		width_bytes = ((src_x * cpp) & 63) + src_w * cpp;
-
-		if (INTEL_GEN(dev_priv) < 9 && (src_w > 2048 || src_h > 2048 ||
-		    width_bytes > 4096 || fb->pitches[0] > 4096)) {
-			DRM_DEBUG_KMS("Source dimensions exceed hardware limits\n");
-			return -EINVAL;
+			/* FIXME interlacing min height is 6 */
+			if (INTEL_GEN(dev_priv) < 9 && (
+			     src_w < 3 || src_h < 3 ||
+			     src_w > 2048 || src_h > 2048 ||
+			     crtc_w < 3 || crtc_h < 3 ||
+			     width_bytes > 4096 || fb->pitches[0] > 4096)) {
+				DRM_DEBUG_KMS("Source dimensions exceed hardware limits\n");
+				return -EINVAL;
+			}
 		}
 	}
 
-	if (state->base.visible) {
-		src->x1 = src_x << 16;
-		src->x2 = (src_x + src_w) << 16;
-		src->y1 = src_y << 16;
-		src->y2 = (src_y + src_h) << 16;
-	}
-
-	dst->x1 = crtc_x;
-	dst->x2 = crtc_x + crtc_w;
-	dst->y1 = crtc_y;
-	dst->y2 = crtc_y + crtc_h;
-
 	if (INTEL_GEN(dev_priv) >= 9) {
 		ret = skl_check_plane_surface(crtc_state, state);
 		if (ret)
Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author maintainer
#4 lore raw

PATCH 4/5 drm/selftests: Rename the Kconfig option to CONFIG_DRM_DEBUG_SELFTEST

In reply to Maarten Lankhorst

We want to add more DRM selftests, and there's not much point in having a Kconfig option for every single one of them, so make a generic one.

---
 drivers/gpu/drm/Kconfig            | 8 ++++----
 drivers/gpu/drm/Makefile           | 2 +-
 drivers/gpu/drm/selftests/Makefile | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/Kconfig +4 -4
index 757825ac60df..d684855b95c2 100644
@@ -49,16 +49,16 @@ config DRM_DEBUG_MM
 
 	  If in doubt, say "N".
 
-config DRM_DEBUG_MM_SELFTEST
-	tristate "kselftests for DRM range manager (struct drm_mm)"
+config DRM_DEBUG_SELFTEST
+	tristate "kselftests for DRM"
 	depends on DRM
 	depends on DEBUG_KERNEL
 	select PRIME_NUMBERS
 	select DRM_LIB_RANDOM
 	default n
 	help
-	  This option provides a kernel module that can be used to test
-	  the DRM range manager (drm_mm) and its API. This option is not
+	  This option provides kernel modules that can be used to run
+	  various selftests on parts of the DRM api. This option is not
 	  useful for distributions or general kernels, but only for kernel
 	  developers working on DRM and associated drivers.
 
drivers/gpu/drm/Makefile +1 -1
index 9d66657ea117..4becc245e359 100644
@@ -43,7 +43,7 @@ drm_kms_helper-$(CONFIG_DRM_KMS_CMA_HELPER) += drm_fb_cma_helper.o
 drm_kms_helper-$(CONFIG_DRM_DP_AUX_CHARDEV) += drm_dp_aux_dev.o
 
 obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
-obj-$(CONFIG_DRM_DEBUG_MM_SELFTEST) += selftests/
+obj-$(CONFIG_DRM_DEBUG_SELFTEST) += selftests/
 
 obj-$(CONFIG_DRM)	+= drm.o
 obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o
drivers/gpu/drm/selftests/Makefile +1 -1
index 4aebfc7f27d4..f7dd66e859a9 100644
@@ -1 +1 @@
-obj-$(CONFIG_DRM_DEBUG_MM_SELFTEST) += test-drm_mm.o
+obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o
Signature · 6 lines
2.17.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author maintainer
#5 lore raw

PATCH 5/5 drm/selftests: Add drm helper selftest

In reply to Maarten Lankhorst
---
 drivers/gpu/drm/Kconfig                       |   1 +
 drivers/gpu/drm/selftests/Makefile            |   2 +-
 .../gpu/drm/selftests/drm_helper_selftests.h  |   9 +
 drivers/gpu/drm/selftests/test-drm-helper.c   | 247 ++++++++++++++++++
 4 files changed, 258 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/selftests/drm_helper_selftests.h
 create mode 100644 drivers/gpu/drm/selftests/test-drm-helper.c
drivers/gpu/drm/Kconfig +1 -0
index d684855b95c2..28d059007ac2 100644
@@ -55,6 +55,7 @@ config DRM_DEBUG_SELFTEST
 	depends on DEBUG_KERNEL
 	select PRIME_NUMBERS
 	select DRM_LIB_RANDOM
+	select DRM_KMS_HELPER
 	default n
 	help
 	  This option provides kernel modules that can be used to run
drivers/gpu/drm/selftests/Makefile +1 -1
index f7dd66e859a9..9fc349fa18e9 100644
@@ -1 +1 @@
-obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o
+obj-$(CONFIG_DRM_DEBUG_SELFTEST) += test-drm_mm.o test-drm-helper.o
drivers/gpu/drm/selftests/drm_helper_selftests.h new file +9 -0
new file mode 100644
index 000000000000..9771290ed228
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* List each unit test as selftest(name, function)
+ *
+ * The name is used as both an enum and expanded as igt__name to create
+ * a module parameter. It must be unique and legal for a C identifier.
+ *
+ * Tests are executed in order by igt/drm_selftests_helper
+ */
+selftest(check_plane_state, igt_check_plane_state)
drivers/gpu/drm/selftests/test-drm-helper.c new file +247 -0

247 lines not on this page · raw message

Signature · 6 lines
2.17.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

✗ Fi.CI.CHECKPATCH: warning for drm: Fix rounding errors and use scaling in i915.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: drm: Fix rounding errors and use scaling in i915.
URL : https://patchwork.freedesktop.org/series/42476/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
febeff5693c0 drm/rect: Round above 1 << 16 upwards to correct scale calculation functions.
-:25: WARNING:UNNECESSARY_ELSE: else is not generally useful after a break or return
#25: FILE: drivers/gpu/drm/drm_rect.c:111:
+		return DIV_ROUND_UP(src, dst);
+	else

total: 0 errors, 1 warnings, 0 checks, 47 lines checked
339983c9bb65 drm/rect: Handle rounding errors in drm_rect_clip_scaled, v2. -:37: WARNING:UNNECESSARY_ELSE: else is not generally useful after a break or return #37: FILE: drivers/gpu/drm/drm_rect.c:65:
+ return DIV_ROUND_UP(src, dst);
+ else

-:56: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'oldscale' - possible side-effects? #56: FILE: drivers/gpu/drm/drm_rect.c:98:
+#define FIXUP(oldscale, fn, m, second) do { \
+ if (oldscale != 1 << 16) { \
+ int newscale = drm_calc_scale(fn(src), fn(dst)); \
+ \
+ if (newscale < 0) \
+ return false; \
+ \
+ if ((oldscale < 0x10000) != (newscale < 0x10000)) { \
+ if (!second) \
+ src->m##1 = src->m##2 - (fn(dst) << 16); \
+ else \
+ src->m##2 = src->m##1 + (fn(dst) << 16); \
+ } \
+ } \
+ } while (0)

-:56: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'fn' - possible side-effects? #56: FILE: drivers/gpu/drm/drm_rect.c:98:
+#define FIXUP(oldscale, fn, m, second) do { \
+ if (oldscale != 1 << 16) { \
+ int newscale = drm_calc_scale(fn(src), fn(dst)); \
+ \
+ if (newscale < 0) \
+ return false; \
+ \
+ if ((oldscale < 0x10000) != (newscale < 0x10000)) { \
+ if (!second) \
+ src->m##1 = src->m##2 - (fn(dst) << 16); \
+ else \
+ src->m##2 = src->m##1 + (fn(dst) << 16); \
+ } \
+ } \
+ } while (0)

-:59: WARNING:LEADING_SPACE: please, no spaces at the start of a line #59: FILE: drivers/gpu/drm/drm_rect.c:101:
+ \$

-:62: WARNING:LEADING_SPACE: please, no spaces at the start of a line #62: FILE: drivers/gpu/drm/drm_rect.c:104:
+ \$

-:63: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'oldscale < 0x10000' #63: FILE: drivers/gpu/drm/drm_rect.c:105:
+ if ((oldscale < 0x10000) != (newscale < 0x10000)) { \

-:63: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'newscale < 0x10000' #63: FILE: drivers/gpu/drm/drm_rect.c:105:
+ if ((oldscale < 0x10000) != (newscale < 0x10000)) { \

-:70: WARNING:LEADING_SPACE: please, no spaces at the start of a line #70: FILE: drivers/gpu/drm/drm_rect.c:112:
+ } while (0)$

total: 0 errors, 4 warnings, 4 checks, 107 lines checked 035d2ea322b2 drm/i915: Do not adjust scale when out of bounds, v2. -:180: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #180: FILE: drivers/gpu/drm/i915/intel_sprite.c:1030:
+ if (INTEL_GEN(dev_priv) < 9 && (

total: 0 errors, 0 warnings, 1 checks, 179 lines checked
882b62db73fa drm/selftests: Rename the Kconfig option to CONFIG_DRM_DEBUG_SELFTEST 59b43359b5d7 drm/selftests: Add drm helper selftest
-:28: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #28:
new file mode 100644

-:48: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #48: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:1:
+/*

-:63: WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided #63: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:16:
+#define FAIL(test, msg, ...) \
+ do { \
+ if (test) { \
+ pr_err("%s/%u: " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \
+ return -EINVAL; \
+ } \
+ } while (0)

-:66: WARNING:USE_FUNC: __func__ should be used instead of gcc specific __FUNCTION__ #66: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:19:
+ pr_err("%s/%u: " msg, __FUNCTION__, __LINE__, ##__VA_ARGS__); \

-:71: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'x' - possible side-effects? #71: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:24:
+#define FAIL_ON(x) FAIL((x), "%s", "FAIL_ON(" __stringify(x) ")\n")

-:74: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #74: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:27:
+ unsigned src_x, unsigned src_y,

-:74: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #74: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:27:
+ unsigned src_x, unsigned src_y,

-:75: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #75: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:28:
+ unsigned src_w, unsigned src_h)

-:75: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #75: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:28:
+ unsigned src_w, unsigned src_h)

-:84: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #84: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:37:
+ unsigned src_x, unsigned src_y,

-:84: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #84: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:37:
+ unsigned src_x, unsigned src_y,

-:85: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #85: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:38:
+ unsigned src_w, unsigned src_h)

-:85: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #85: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:38:
+ unsigned src_w, unsigned src_h)

-:111: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #111: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:64:
+ unsigned crtc_w, unsigned crtc_h)

-:111: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #111: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:64:
+ unsigned crtc_w, unsigned crtc_h)

-:121: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #121: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:74:
+ unsigned crtc_w, unsigned crtc_h)

-:121: WARNING:UNSPECIFIED_INT: Prefer 'unsigned int' to bare use of 'unsigned' #121: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:74:
+ unsigned crtc_w, unsigned crtc_h)

-:145: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #145: FILE: drivers/gpu/drm/selftests/test-drm-helper.c:98:
+ DRM_MODE("1024x768", 0, 65000, 1024, 1048,
+ 1184, 1344, 0, 768, 771, 777, 806, 0,

total: 0 errors, 16 warnings, 2 checks, 265 lines checked

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

#7 lore raw

✗ Fi.CI.SPARSE: warning for drm: Fix rounding errors and use scaling in i915.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: drm: Fix rounding errors and use scaling in i915.
URL : https://patchwork.freedesktop.org/series/42476/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Commit: drm/rect: Round above 1 << 16 upwards to correct scale calculation functions.
Okay!

Commit: drm/rect: Handle rounding errors in drm_rect_clip_scaled, v2. +drivers/gpu/drm/drm_rect.c:117:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:117:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:117:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:117:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:117:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:117:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:117:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:125:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:125:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:125:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:125:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:125:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:125:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:125:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:133:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:133:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:133:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:133:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:133:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:133:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:133:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:140:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:140:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:140:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:140:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:140:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:140:27: warning: expression using sizeof(void) +drivers/gpu/drm/drm_rect.c:140:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:77:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:77:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:77:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:77:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:77:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:77:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:77:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:82:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:82:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:82:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:82:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:82:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:82:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:82:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:87:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:87:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:87:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:87:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:87:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:87:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:87:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:92:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:92:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:92:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:92:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:92:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:92:27: warning: expression using sizeof(void) -O:drivers/gpu/drm/drm_rect.c:92:27: warning: expression using sizeof(void)

Commit: drm/i915: Do not adjust scale when out of bounds, v2. Okay!

Commit: drm/selftests: Rename the Kconfig option to CONFIG_DRM_DEBUG_SELFTEST +Error in reading or end of file.

Commit: drm/selftests: Add drm helper selftest
Okay!

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

#8 lore raw

✓ Fi.CI.BAT: success for drm: Fix rounding errors and use scaling in i915.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: drm: Fix rounding errors and use scaling in i915.
URL : https://patchwork.freedesktop.org/series/42476/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4113 -> Patchwork_8845 =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_8845 need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8845, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/42476/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_8845:

=== IGT changes ===

    ==== Warnings ====

    igt@gem_exec_gttfill@basic:
      fi-pnv-d510:        PASS -> SKIP

== Participating hosts (38 -> 35) ==

Missing (3): fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4113 -> Patchwork_8845

CI_DRM_4113: 1d2a421b1f9b47883b9d0eeb28dc4069e462dbe3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4452: 29ae12bd764e3b1876356e7628a32192b4ec9066 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8845: 59b43359b5d7da1bd373faae2193b11dc64c7b9d @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4452: 04a2952c5b3782eb03cb136bb16d89daaf243f14 @ git://anongit.freedesktop.org/piglit

== Linux commits ==

59b43359b5d7 drm/selftests: Add drm helper selftest
882b62db73fa drm/selftests: Rename the Kconfig option to CONFIG_DRM_DEBUG_SELFTEST 035d2ea322b2 drm/i915: Do not adjust scale when out of bounds, v2. 339983c9bb65 drm/rect: Handle rounding errors in drm_rect_clip_scaled, v2. febeff5693c0 drm/rect: Round above 1 << 16 upwards to correct scale calculation functions.

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8845/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#9 lore raw

✓ Fi.CI.IGT: success for drm: Fix rounding errors and use scaling in i915.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: drm: Fix rounding errors and use scaling in i915.
URL : https://patchwork.freedesktop.org/series/42476/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4113_full -> Patchwork_8845_full =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_8845_full need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8845_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://patchwork.freedesktop.org/api/1.0/series/42476/revisions/1/mbox/

== Possible new issues ==

Here are the unknown changes that may have been introduced in Patchwork_8845_full:

=== IGT changes ===

    ==== Possible regressions ====

    {igt@gem_close_race@gem-close-race}:
      shard-glk:          NOTRUN -> INCOMPLETE

    
    ==== Warnings ====

    igt@core_getstats:
      shard-glk:          PASS -> ( 2 PASS ) +86

    igt@core_prop_blob@blob-prop-core:
      shard-apl:          PASS -> ( 2 PASS ) +86

    igt@drm_import_export@flink:
      shard-hsw:          PASS -> ( 2 PASS ) +89

    igt@drm_vma_limiter_gtt:
      shard-kbl:          PASS -> ( 2 PASS ) +90

    igt@drv_hangman@error-state-capture-bsd1:
      shard-glk:          SKIP -> ( 2 SKIP ) +17

    igt@drv_module_reload@basic-no-display:
      shard-snb:          PASS -> ( 2 PASS ) +69

    igt@gem_busy@busy-bsd1:
      shard-apl:          SKIP -> ( 2 SKIP ) +17

    igt@gem_busy@extended-parallel-bsd1:
      shard-hsw:          SKIP -> ( 2 SKIP ) +14

    igt@gem_busy@extended-semaphore-blt:
      shard-snb:          SKIP -> ( 2 SKIP ) +32
      shard-kbl:          SKIP -> ( 2 SKIP ) +8

    igt@kms_busy@extended-modeset-hang-oldfb-render-a:
      shard-snb:          PASS -> SKIP

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          SKIP -> PASS +1

== Known issues ==

Here are the changes found in Patchwork_8845_full that come from known issues:

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_suspend@fence-restore-tiled2untiled-hibernate:
      shard-kbl:          NOTRUN -> DMESG-FAIL (fdo#103375) +4
      shard-snb:          NOTRUN -> FAIL (fdo#103375) +4
      shard-hsw:          NOTRUN -> FAIL (fdo#103375) +4

    igt@drv_suspend@forcewake:
      shard-kbl:          PASS -> ( 1 DMESG-WARN, 1 PASS ) (fdo#104238) +3

    igt@drv_suspend@forcewake-hibernate:
      shard-glk:          NOTRUN -> FAIL (fdo#103375) +4

    igt@drv_suspend@sysfs-reader-hibernate:
      shard-apl:          NOTRUN -> FAIL (fdo#103375) +4

    {igt@gem_close_race@gem-close-race}:
      shard-kbl:          NOTRUN -> INCOMPLETE (fdo#103665)
      shard-apl:          NOTRUN -> INCOMPLETE (fdo#103927)

    {igt@gem_concurrent_blit@4kib-tiny-prw-render-overwrite-source-rev}:
      shard-snb:          NOTRUN -> INCOMPLETE (fdo#105411)

    {igt@gem_concurrent_blit@4kib-tiny-prw-render-write-read-bcs}:
      shard-hsw:          NOTRUN -> INCOMPLETE (fdo#103540)

    igt@gem_exec_parallel@contexts:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          PASS -> INCOMPLETE (fdo#106023, fdo#103665)

    igt@kms_flip@flip-vs-expired-vblank:
      shard-apl:          PASS -> FAIL (fdo#105363, fdo#102887)
      shard-glk:          PASS -> FAIL (fdo#105707)

    igt@kms_flip@plain-flip-ts-check-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368) +1

    igt@perf@polling:
      shard-hsw:          PASS -> FAIL (fdo#102252)

    
    ==== Possible fixes ====

    igt@kms_flip@modeset-vs-vblank-race-interruptible:
      shard-glk:          FAIL (fdo#103060) -> PASS

    igt@kms_flip@wf_vblank-ts-check-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS +1

    igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-indfb-draw-render:
      shard-apl:          FAIL (fdo#103167) -> PASS

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104238 https://bugs.freedesktop.org/show_bug.cgi?id=104238
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105707 https://bugs.freedesktop.org/show_bug.cgi?id=105707
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023

== Participating hosts (9 -> 8) ==

Missing (1): shard-glkb

== Build changes ==

* Linux: CI_DRM_4113 -> Patchwork_8845

CI_DRM_4113: 1d2a421b1f9b47883b9d0eeb28dc4069e462dbe3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4452: 29ae12bd764e3b1876356e7628a32192b4ec9066 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8845: 59b43359b5d7da1bd373faae2193b11dc64c7b9d @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4452: 04a2952c5b3782eb03cb136bb16d89daaf243f14 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8845/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx