This fixes a failure to determine any seam if the output size is
exactly 1024 multiplied by the number of tiles in a given direction.
In that case an empty interval out_start == out_end is being passed
to find_best_seam, which looks for a seam out_start <= x < out_end.

Also reduce the interval all but the left column / top row, to
avoid returning position 0 as best fit.

Signed-off-by: Philipp Zabel <p.za...@pengutronix.de>
---
 drivers/gpu/ipu-v3/ipu-image-convert.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c 
b/drivers/gpu/ipu-v3/ipu-image-convert.c
index 9d25db6924b3..c9909f1c9ffb 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -723,9 +723,9 @@ static void find_seams(struct ipu_image_convert_ctx *ctx,
                 */
 
                /* Start within 1024 pixels of the right edge */
-               out_start = max_t(int, 0, out_right - 1024);
+               out_start = max_t(int, col * out_left_align, out_right - 1024);
                /* End before having to add more columns to the left */
-               out_end = min_t(unsigned int, out_right, col * 1024);
+               out_end = min_t(unsigned int, out_right, col * 1024 + 1);
 
                find_best_seam(ctx, out_start, out_end,
                               in_right, out_right,
@@ -768,9 +768,9 @@ static void find_seams(struct ipu_image_convert_ctx *ctx,
                unsigned int out_top;
 
                /* Start within 1024 lines of the bottom edge */
-               out_start = max_t(int, 0, out_bottom - 1024);
+               out_start = max_t(int, row * out_top_align, out_bottom - 1024);
                /* End before having to add more rows above */
-               out_end = min_t(unsigned int, out_bottom, row * 1024);
+               out_end = min_t(unsigned int, out_bottom, row * 1024 + 1);
 
                find_best_seam(ctx, out_start, out_end,
                               in_bottom, out_bottom,
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to