[igt-dev] [PATCH i-g-t 05/25] tests/gem_render_copy: Fix clipped height

Ville Syrjala ville.syrjala at linux.intel.com
Thu Jul 19 15:03:55 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Assign the clipped height to 'h', not 'w'. This didn't cause any
problems so far because we use square buffers.

Also get rid of the gcc variable shadowing warnings by not nesting the
min()/max().

Fixes: aaa23eff21a1 ("tests/gem_render_copy: Use a more elaborate pattern of pixels")
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 tests/gem_render_copy.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/gem_render_copy.c b/tests/gem_render_copy.c
index 238e70e97b5d..135375a90ec2 100644
--- a/tests/gem_render_copy.c
+++ b/tests/gem_render_copy.c
@@ -254,8 +254,11 @@ scratch_buf_copy(data_t *data,
 	linear_src = gem_mmap__gtt(data->drm_fd, src->bo->handle,
 				   src->bo->size, PROT_READ);
 
-	w = min(w, min(width - sx, width - dx));
-	w = min(h, min(height - sy, height - dy));
+	w = min(w, width - sx);
+	w = min(w, width - dx);
+
+	h = min(h, height - sy);
+	h = min(h, height - dy);
 
 	for (int y = 0; y < h; y++) {
 		igt_memcpy_from_wc(&linear_dst[(dy+y) * width + dx],
-- 
2.16.4



More information about the igt-dev mailing list