From 395db97d043b97567a589cc937b3329ffc2b5cb1 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Mon, 23 Nov 2026 23:32:25 +1100 Subject: [PATCH] media: apple: scaler: keep CAPTURE at the OUTPUT size An odd RGB OUTPUT size and a 4:2:0 CAPTURE request round the CAPTURE dimensions up. The format ioctls succeed, but the job builder rejects the resulting unequal-size pair. Keep the active OUTPUT dimensions for CAPTURE and use the existing RGB fallback if the requested format cannot represent them. Preserve compatible format requests and existing OUTPUT negotiation. Signed-off-by: Ryan Murray --- .../platform/apple/scaler/apple-scaler-drv.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/apple/scaler/apple-scaler-drv.c b/drivers/media/platform/apple/scaler/apple-scaler-drv.c index d9707d2aec068..9273e2d54a245 100644 --- a/drivers/media/platform/apple/scaler/apple-scaler-drv.c +++ b/drivers/media/platform/apple/scaler/apple-scaler-drv.c @@ -353,13 +353,20 @@ static void asc_fill(struct v4l2_pix_format_mplane *pix, const struct v4l2_pix_f u32 default_fourcc) { const struct asc_format *f = asc_find_format(pix->pixelformat); - u32 w = ref ? ref->width : pix->width, h = ref ? ref->height : pix->height; struct v4l2_pix_format_mplane in = *pix; + u32 w, h; - if (!f) + /* Use a same-size RGB format when CAPTURE cannot subsample OUTPUT. */ + if (!f || (ref && (!IS_ALIGNED(ref->width, f->hsub) || + !IS_ALIGNED(ref->height, f->vsub)))) f = asc_find_format(default_fourcc); - w = clamp_t(u32, ALIGN(w, f->hsub), ASC_MIN_SIZE, ASC_MAX_SIZE); - h = clamp_t(u32, ALIGN(h, f->vsub), ASC_MIN_SIZE, ASC_MAX_SIZE); + if (ref) { + w = ref->width; + h = ref->height; + } else { + w = clamp_t(u32, ALIGN(pix->width, f->hsub), ASC_MIN_SIZE, ASC_MAX_SIZE); + h = clamp_t(u32, ALIGN(pix->height, f->vsub), ASC_MIN_SIZE, ASC_MAX_SIZE); + } memset(pix, 0, sizeof(*pix)); if (f->lossless) {