From 970a68f63bf77fe173006ecc8bfdd7eef676f00e Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Tue, 19 May 2026 13:35:00 +0100
Subject: [PATCH] media/hevc_d: Fix height rounding for old sand formats

Round old sand format heights to 16 rather than 8 as Pi4 ISP
input requires this (gives EFAULT otherwise). As ISP cannot
take new sand formats do not change them.

Signed-off-by: John Cox <jc@kynesim.co.uk>
---
 drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
+++ b/drivers/media/platform/raspberrypi/hevc_dec/hevc_d_video.c
@@ -144,7 +144,7 @@ static void hevc_d_prepare_dst_format(st
 	case V4L2_PIX_FMT_NV12_COL128:
 		/* Width rounds up to columns */
 		width = ALIGN(width, 128);
-		height = ALIGN(height, 8);
+		height = ALIGN(height, 16);
 
 		/* column height
 		 * Accept suggested shape if at least min & < 2 * min
@@ -158,7 +158,7 @@ static void hevc_d_prepare_dst_format(st
 		 * columns
 		 */
 		width = ALIGN(((width + 2) / 3), 32) * 3;
-		height = ALIGN(height, 8);
+		height = ALIGN(height, 16);
 
 		/* column height
 		 * Accept suggested shape if at least min & < 2 * min
