From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCB4B3D6CB4 for ; Wed, 8 Apr 2026 16:44:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775666649; cv=none; b=MWTpnQzCOURxYSFEKaVSkEFJrrPQgvPAS7Km08TGgdFkb3KlJZHMC7MzhpevXUEXgmV277PAnNjtMlPZRrGi0pOmkXcDbPaSmRHnTBt4xKA5TVjrdTJHuikrwiYCeLXqOZFp8AbzmaxZee64YgqSqqtpWFj6S0MDzGkPqdlHwic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775666649; c=relaxed/simple; bh=jw5HajDz3YEg2SFQeuiFYM+sWNKJy4d/wOy+1zDgBrg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tTxPdWkC/G1CNBdu1BDaIQzv6VaWXFVGzOfSY2rPcBjyWtkdRg6i+QsfvtNBWrFdHTBfUpVjNJ+J1qp8Q/S8qhqdX8XDsh/JCP3FWMXn7mrN9Pf4zSMWCU37RXpbbdoWcMffc8wAibple6xBbgJ00+Oi1CbCt5Ze0fgr87L3Jp8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=M4ZhVRee; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="M4ZhVRee" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-488a14c31eeso316255e9.0 for ; Wed, 08 Apr 2026 09:44:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1775666645; x=1776271445; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=OxT3LZZl8z0JUtBRxRhLlC7OhmjiZSeL9O80F6EgJiY=; b=M4ZhVReepXnZxHQJkCWMZKedUhQgUvpvLEi5X3uLfCSWbEu92dU5Bn7RxUresWY3VP Cktgze/yUcd/beDQCDX7Pzk/telle9j37H1R3gIMI9NZuijQIzj/yQCfU3mQ+VMQTg5/ Eg/ufBfrNNIs4OV+Rjyeg8lDLRY81aG18/EMchXxu6tlDFv+8mpkl1Wsk9y9oEGE8OkJ mcNrVeyRhrMP5HecxPlFcCrj6dbQ6EU+3a9rwBIGIthXGN3wh4aDnIuGSr4hIYMt+O4k YamaSLz9gtpKKCFpR8wBKajoVNcGReQSG1WPM9koxJVMMDwSZJ2J00LsxBPz/gnwW+// y6+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775666645; x=1776271445; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=OxT3LZZl8z0JUtBRxRhLlC7OhmjiZSeL9O80F6EgJiY=; b=g/qf6npvnVZtvRCnXefbY5nj6FvczgDHlZlt65M1WXRq7UsxuMmgUmsgmxBbVTao8+ EWRImRdljV99Zvqo8CxKCBjuYfy3NB/3i7ov0p3rhGbLMRD68FrHloNn0EqVEnmtXw3C LP9Hmvktcuq/J1WEoqD62qzgDrXUdx+9r7E4i1X+zuTu2C7XSQT0TQX7FN11HVQ0X6Yh ssBl+mKK/3FNQrD9baiuhGCGDNTvUbRl+Y0/i/Fv2VU02Ko0tiYZ07H2OOm5Fn/K9NcB WjBy2geWffcHzqd5HdxCAxgLPSeV2+JQguD7mXpNWqkyljTniO2Bfo5sOScaWCLhKm5X 2GPg== X-Forwarded-Encrypted: i=1; AJvYcCXokBW34gJUeVfoTRWiqEy6htcHSI9pKPZyPyvPTOE8yvGh8pfvuL8KGMOlGDBQ1ek5xp+ZETaycrExHZk=@vger.kernel.org X-Gm-Message-State: AOJu0YwOFC1vxuiEIwP2J2k8QOeP39vozDCDOmbAblF0Gk+pbLGdTBH1 hnhXplXlHcCmAHQr1uU2x41KR5DdzuDsPsb5NlMr6oEggJ94f18Q94Bwzv0Oj7y8k0o= X-Gm-Gg: AeBDies4TPo+EwCmpGo/dIHtwj6t74xLoq/qW4qg1nqlro/gGdFOCglDALXqZcDG7HN whG9aP0USmTFPDXgbDZEpyKPvDnSzcAsx/MYbVohYY73ZFfH2M3EywSe0IhPteYBUxGSQfdNxME 7+0HpBOeo6BBODouZjvOdiLrl8TmkTw4jOdF9/ur/Smr1ofUep9rYAqlUvJLd1paTB7f9VrAb3i lDA1teJUZpzBHGb/ONXrAQDp2cFPQVe7fAy/C7bw5tygWrS+VJPVFsNyid2RygpiQMzhV6AAhBD ILmWkNvOREKJFH3QOg3QajcdJdaSlUeuvo2OISduEvbGQpEyQyrJ08zrCq8yroACd7At009LSSX 7KcGLjrtS4W+zj+Kr9cdIvs/HfI78StRy3AOGpf6x/zhKU+wNULn0hpyaX1tEbw4Ly2HL1jbhR0 qI/Mylba+5CZ6sQBRP05QaZ8X3FHbMBRYFULCOMrBsx429rDJ7lyfNd4I= X-Received: by 2002:a05:600c:1396:b0:486:fb0b:ad79 with SMTP id 5b1f17b1804b1-488997d10ffmr303650735e9.20.1775666645049; Wed, 08 Apr 2026 09:44:05 -0700 (PDT) Received: from arrakeen.starnux.net ([2a01:e0a:106d:1080:52eb:f6ff:feb3:451a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488cd17be0csm1388065e9.18.2026.04.08.09.44.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Apr 2026 09:44:04 -0700 (PDT) From: Neil Armstrong Date: Wed, 08 Apr 2026 18:43:59 +0200 Subject: [PATCH RFC 6/7] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260408-topic-sm8x50-iris-10bit-decoding-v1-6-428c1ec2e3f3@linaro.org> References: <20260408-topic-sm8x50-iris-10bit-decoding-v1-0-428c1ec2e3f3@linaro.org> In-Reply-To: <20260408-topic-sm8x50-iris-10bit-decoding-v1-0-428c1ec2e3f3@linaro.org> To: Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Armstrong X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2960; i=neil.armstrong@linaro.org; h=from:subject:message-id; bh=jw5HajDz3YEg2SFQeuiFYM+sWNKJy4d/wOy+1zDgBrg=; b=owEBbQKS/ZANAwAKAXfc29rIyEnRAcsmYgBp1oXOX5pyFezRGumt1OnDVkkSs1lT7WJ6xd9W/pc4 KtrqGtCJAjMEAAEKAB0WIQQ9U8YmyFYF/h30LIt33NvayMhJ0QUCadaFzgAKCRB33NvayMhJ0XHCD/ 0W9vutsMJDgW5v0Ig6IfkKEsVPR4PKPYTAdyJz8QVApIp1Rdj7ObtJkTBAYZwa6ZA4Zmssu+mtofEH d9M8ByzeZ5cevGQ4zAaZArvi47DbJJJTT3rBgOgu9EB+wwx4AhNPrZpu6nGgZEnau/XpInqf7uXRn+ DlIusxEx0HwoYeNRJ8QEvR4L96WeuRDBu3yxO8z7iWDTQJMNW38GfL1SjL6TFcdzR3YpGUddXd0P/V xdXKbXokp7ABNKfeai0P0ITyd8ouopaxKiUhyxcKzQDg6SU1dhA5BkcEMFBH5w/w7SlA9sD3D5Dblt hj8se28fKEoFI9Ki6ync1QbC9kdjzyTh1cMs/JgvOAv0pjfnt5oMwNH3tH2kIr+zcq9OBVrTdUJGeN l4OwMuvrPQunfFo8IgkDTqSOEDVMH8DBbiN6coY1FHCIUbEjvN4vB7ROKHr1gr0TdiAmsDomQTuRpA 2AoQDZRa9Ns9JWORMY0VI18B1cujAGnVtc8E7p50qWYqtDNHCngjFYHHuzOnhv+i6nMOG1S/kRJrJM SOF6xJual1MS36kNKyI9lj42LGCue14ITAqOteQ3ujMLOqMjgi6LwN5zftnRRVI64BR6VZFXzVfzbC TAUcU0+6X8/OHwv32/LpF4nDCLcAXrjrIabbaRSzqjqhvPpilj+Y1BHPgs6w== X-Developer-Key: i=neil.armstrong@linaro.org; a=openpgp; fpr=89EC3D058446217450F22848169AB7B1A4CFF8AE The 10bit pixel format can be only used when the decoder identifies the stream as decoding into 10bit pixel format buffers, so update the find_format helpers to filter the formats. Signed-off-by: Neil Armstrong --- .../platform/qcom/iris/iris_platform_common.h | 1 + drivers/media/platform/qcom/iris/iris_vdec.c | 41 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h index 5a489917580e..cd3509da4b75 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -18,6 +18,7 @@ struct iris_inst; #define REGISTER_BIT_DEPTH(luma, chroma) ((luma) << 16 | (chroma)) #define BIT_DEPTH_8 REGISTER_BIT_DEPTH(8, 8) +#define BIT_DEPTH_10 REGISTER_BIT_DEPTH(10, 10) #define CODED_FRAMES_PROGRESSIVE 0x0 #define DEFAULT_MAX_HOST_BUF_COUNT 64 #define DEFAULT_MAX_HOST_BURST_BUF_COUNT 256 diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c index ca0518c27834..bfc13c1044c7 100644 --- a/drivers/media/platform/qcom/iris/iris_vdec.c +++ b/drivers/media/platform/qcom/iris/iris_vdec.c @@ -105,6 +105,16 @@ find_format(struct iris_inst *inst, u32 pixfmt, u32 type) if (i == size || fmt[i].type != type) return NULL; + if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) { + if (iris_fmt_is_8bit(fmt[i].pixfmt) && + inst->fw_caps[BIT_DEPTH].value == BIT_DEPTH_8) + return NULL; + + if (iris_fmt_is_10bit(fmt[i].pixfmt) && + inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10) + return NULL; + } + return &fmt[i]; } @@ -113,6 +123,7 @@ find_format_by_index(struct iris_inst *inst, u32 index, u32 type) { const struct iris_fmt *fmt = NULL; unsigned int size = 0; + unsigned int i, k = 0; switch (type) { case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: @@ -127,10 +138,36 @@ find_format_by_index(struct iris_inst *inst, u32 index, u32 type) return NULL; } - if (index >= size || fmt[index].type != type) + if (index >= size) return NULL; - return &fmt[index]; + if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { + if (fmt[index].type != type) + return NULL; + + return &fmt[index]; + } + + /* Loop over the valid capture formats and return the index */ + for (i = 0; i < size; i++) { + if (fmt[i].type != type) + continue; + + if (iris_fmt_is_8bit(fmt[i].pixfmt) && + inst->fw_caps[BIT_DEPTH].value == BIT_DEPTH_10) + continue; + + if (iris_fmt_is_10bit(fmt[i].pixfmt) && + inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10) + continue; + + if (k == index) + return &fmt[i]; + + k++; + } + + return NULL; } int iris_vdec_enum_fmt(struct iris_inst *inst, struct v4l2_fmtdesc *f) -- 2.34.1