From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42A5B3E49C3 for ; Mon, 17 Aug 2026 11:20:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786965612; cv=none; b=pibA4gu8K4owMiYyq/WPzcAViIRqz4n86xq07fB6+FEOSnsgE9F6SQIILc17C4x2a5ONMU5Ho/dUmyAsX3n8z9HDBe1R1vOpY6tvGCgH+/oEMX+0kprkjRlQou0xRS0dF6tCjIRqntXJM0D1VS09Nj+7umHpnz5M3a+H3rhrGKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786965612; c=relaxed/simple; bh=osvzgBpz8nZCp3XOFawKsT/v4+qU7q5DC/cLetwjTdE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=e+YRpKb6P2iZS+rcFYL93djv/uyeECHISlA77KuPecoY5eCj8vXXJ9RjTGdSAS1RzCnP/KUopNr9yyS2SJkidt8Uod9gS+Tlfd/86shIfjcZxV9LxAg8RV6QFoZaKrtZNWa1wuCrZKUJ7gMA1VbfNKvXo14mcQrCd4QkNNovT+c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=AfFUcCSM; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=GpVGRkB5; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="AfFUcCSM"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="GpVGRkB5" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67H9defB1962498 for ; Mon, 17 Aug 2026 11:20:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= PXEgfb+ycUmKnB3Ohf7t8gp0XPQqN7ee9k+HPlfSajU=; b=AfFUcCSM6621VzT2 QfQHIxlKZvh7rWeJ2j70iw4ATxZDgl3OVYopFw1PtSS8SrhVnVJ6r5SNtxj7BurQ cPWYyZG+XWxlhI/duPnoAZ+IXrQL8EQd6OKnowgLRHxUDHxXX0VpkbHqlTULPryu VAO3kc4o3j5g8C/M+8s/njcGZA61bnf9rGxtsWuRhIN7fgilxRx28LqwuwE4Njw8 dJbyQJt193/EGpNL6kRabdoKjCRaKHB7slJbsgOIDtN2S3TbfgCIx6UvWYm6+hF6 /6+oxEpaGtIFzvOxGThLZ20cznylaJ9h+Mfp5RNs1ZYATr2iHD7ZTHq7Mp5iLOHq bLLtNw== Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4g3wregx6g-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 17 Aug 2026 11:20:10 +0000 (GMT) Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-51c1e777a15so9103351cf.2 for ; Mon, 17 Aug 2026 04:20:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1786965609; x=1787570409; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=PXEgfb+ycUmKnB3Ohf7t8gp0XPQqN7ee9k+HPlfSajU=; b=GpVGRkB5+i5LNH2IYIWyqGTA/wPvpuKm7lQG0DfpRYLpO1y4W6/NeJiQqAzM7KoUpG BPC0nC7JsjHMZ/kJc+R/nkOTsHBNZLuG2mOHiRB+9ULwsL7ikiXqCQHHDO8utxpBpS5c YF7MDQ5QJd4bH2AhQ+ymwC1IcgWKtMZMVzepAqOGkuSI7rivSxHNVYjmjga9DisiIabQ d7ay8ucdM8zs7w/U/kcBD4h0jViL71IJxn+EK0BHmowULUdjqWLiIsKv76GQmH587XL5 Jo/zsGhIDi5nhQ/dTXO430iL3FYmzHZsUV/05iajTp8ZrsTT9NkHib8xcAoi9hWTtatM Hejg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786965609; x=1787570409; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=PXEgfb+ycUmKnB3Ohf7t8gp0XPQqN7ee9k+HPlfSajU=; b=sk6zS7RQAj9KlDJeQkz7obHW8LIZ5RSpdKX44oh6QBm9oTiqvWMf5VXeuT0nKdmYEC E5Un8QExF7bhjDPw9csfuACE88G97aw4KUeeB5Fw5lEfwvXtoBe9DQI86LUdq9jp1HMI 53xadW3Lh8HWd4+u0l+t6tpWvM9f5jwoBMxGVIYVdARvYVM47W695ejTQyFLEZDlEHzH GDvctwD5OlJHUY1P65BVikFde33WQQnPk5Xl6KrUJxOnGiH8RAY6Eg0fOmSEifjf4laV Bc8AyFWwMmZ1P/2wuWLnDUyYB+bIh7TDA4ztuZGwWhDUETjut4Bk6/E75VR1MielelI1 NE9g== X-Forwarded-Encrypted: i=1; AHgh+RoQ1z9ZkoeswiK+Hn5+55b5ruBCtC9c7z3SksK7n4DFFXDCgojfdohC9MM1GtpAi9nbX+dgHlTiSW4cpdM=@vger.kernel.org X-Gm-Message-State: AOJu0YwL1tkg4fFssx1wo8/EuV7DCgY7mZVq4roqaoFEZfBshsO/DaVr 0MHO1xt5k3DcobrjZTlT0abm6tch3Sd3cmR8ZBPKshkg5XRsZ5Tr5rGRsLipcjUm3jK+7qOg95b upL0lFj5esPLqkBw7YSdpKcvFhVGNrYWa5yVbPlFhdvxkZeb9WbjjeLE9nGCpnHIQOV4= X-Gm-Gg: AR+sD12YEbIkg2zOig6DS5ALKD66gCmm0kXCaE9M1Bb9OyJSptnxu4Y9C8Ctm8/kLbw W3DXSeQmRRierejqZfz8h0NPIrlc5np1eniDeel98pz6E6YtBDHEK6OzpIdtzmnZsWEZE4/Z08W Zy2qf1ar1iAPM/EfQ/zZLjHFqoWAzgpPnI+sdWC1ro4p4aSJrgCs/Rt3W0/PFsGYROrkrQ5n6Jk 2ImZO7NI2YHeiqssmeafhMcL9At0w4zcYjMiija4CUOVgWOPEmZptH+5l6uuyhVJL2Z0OWKJ7gU KwdvjJ5XA4hnLXe0WJQMIE9kjkMy0OAVnNu3Dw+HFmH7MPF7pVrP3QHze5aQ4W2Mj15zne/2iWQ IHDKWjRvRoG1XlSBkxkD/nT3C X-Received: by 2002:ac8:58d3:0:b0:517:5d21:9899 with SMTP id d75a77b69052e-52d854c89bdmr195887331cf.5.1786965609287; Mon, 17 Aug 2026 04:20:09 -0700 (PDT) X-Received: by 2002:ac8:58d3:0:b0:517:5d21:9899 with SMTP id d75a77b69052e-52d854c89bdmr195886821cf.5.1786965608835; Mon, 17 Aug 2026 04:20:08 -0700 (PDT) Received: from [192.168.120.193] ([178.235.128.140]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2185b977a3sm8480566b.45.2026.08.17.04.20.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Aug 2026 04:20:08 -0700 (PDT) Message-ID: <02cc6973-3e69-4c53-99b1-7aed7cf953e2@oss.qualcomm.com> Date: Mon, 17 Aug 2026 13:20:05 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/3] media: venus: hfi_parser: size a raw format property by its own entries To: Dmitry Baryshkov , Vikash Garodia , Dikshita Agarwal , Bryan O'Donoghue , Mauro Carvalho Chehab , Stanimir Varbanov , Hans Verkuil , Tomasz Figa Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Mauro Carvalho Chehab References: <20260812-venus-8996-v1-0-6615f82a63b8@oss.qualcomm.com> <20260812-venus-8996-v1-2-6615f82a63b8@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <20260812-venus-8996-v1-2-6615f82a63b8@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Authority-Analysis: v=2.4 cv=FqI1OWrq c=1 sm=1 tr=0 ts=6a82ee6a cx=c_pps a=JbAStetqSzwMeJznSMzCyw==:117 a=PRfkaYvzSr8QmIIGAkY2Sg==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=eYyzU6XjkX6kC7LtGWoA:9 a=QEXdDO2ut3YA:10 a=uxP6HrT_eTzRwkO_Te1X:22 X-Proofpoint-ORIG-GUID: QAmVlZh09ld_-xZe-l69yUnCc_j4C6me X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODE3MDA4NSBTYWx0ZWRfX9zgphx930w48 8alDvZJANTtmgRAg0Pn7s4tgDUAC2zRxufRaLs7GrCIxogceIFCN6Dtxev6CVxo5y8tKWqm6ip3 +oSDNr3b+YKu9nGVV7mYLSREc2Os50gONelm2cm5tGl5tecEqN6iAqStT1BbTyinAzEgo89BrOo FrksOF1ErTzvrPeDiMTbUqxlzeCTb3aO9r595pQdh9fPMwbTs1yqaydBiqQWVrcCl80EnMaGNkC h9erLrjg2oHIL+ELEJSuxmLjxkMlbUGu2YGBCGmBqO+sjAqUFwI+lD3HfWx8YM8QJqpISWlXAnd iOd9Ngylp1iJ93oRswbEKwxO03EXhsHzr8a0wtb+H73RSbjXaSeGa2GeofBvVziGCtjDsoz5jUK aLLpCShAGjrehtyObXP+QnCe1BVi1tGyOfMyJOmAi0aReztFRh+jTF+nrV/YrUnGhmG0RpaHa3J 9aFYyc1nuJSkVFaJJdA== X-Proofpoint-GUID: QAmVlZh09ld_-xZe-l69yUnCc_j4C6me X-Proofpoint-Spam-Info: AW1haW4tMjYwODE3MDA4NSBTYWx0ZWRfX+AWjO+UGj3Mm qCERtYHj2x3/sgZA8WsMu5bzlj9yLrnOEoXhAxQS/hDhP+1gArGIASVMTpTJ6UGVRasALNtaT1F eOVgzLyRl7LfpniQ8aVSzskqZ0gvEus= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-16_06,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 adultscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608170085 On 8/12/26 10:01 PM, Dmitry Baryshkov wrote: > parse_raw_formats() walks the format entries one at a time, each of > which is as long as its own plane count makes it, but then computes the > length of the whole property as if every entry had as many planes as the > last one it looked at. The result is only correct when all the entries > agree, and there is nothing in the interface that says they must. > > On MSM8996 they do not, and the parser walks off into the middle of the > message as a result. The raw format property of the HEVC decoder is 120 > bytes long and the walk claims 152, so hfi_parser() resumes 28 bytes > past the end of it, skipping the codec mask that follows and landing > inside the property after that. It resynchronises eventually, because > an unrecognized word is skipped one at a time, but everything it jumped > over is lost. > > What is lost matters: the property skipped that way is the capability > set of the codec mask 0x7002, which is to say the frame size, macroblock > and frame rate limits of H.264, VP8, VP9 and HEVC decoding, all four of > them described in one block. Those decoders end up holding a bitrate > and nothing else, so frame_width_min() and friends return zero and > VIDIOC_ENUM_FRAMESIZES advertises a stepwise range of 0x0 to 0x0 with a > step of 0. > > Userspace cannot negotiate against that. GStreamer builds the sink caps > of its V4L2 decoders from the enumerated frame sizes, an empty integer > range collapses them to EMPTY, and no pad is found to be compatible with > the parser feeding the decoder, so a pipeline as simple as > > filesrc ! parsebin ! v4l2vp9dec ! videoconvert ! fakesink > > fails to link and the stream stops with "not-linked" before a single > buffer is queued. Hardware decoding is unavailable on the board for > every codec in that block. > > An earlier overshoot loses a raw format property too, leaving the > decoders with two of the five formats the firmware describes and HEVC > with four of seven. > > Accumulate the length of the entries as they are walked, the way the > downstream driver does, rather than extrapolating from the last one. > > Fixes: 1a73374a04e5 ("media: venus: hfi_parser: add common capability parser") > Assisted-by: Claude:claude-opus-5 > Signed-off-by: Dmitry Baryshkov > --- > drivers/media/platform/qcom/venus/hfi_parser.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c b/drivers/media/platform/qcom/venus/hfi_parser.c > index 3413b91b0b7e..f79c368647d7 100644 > --- a/drivers/media/platform/qcom/venus/hfi_parser.c > +++ b/drivers/media/platform/qcom/venus/hfi_parser.c > @@ -171,7 +171,7 @@ parse_raw_formats(struct venus_core *core, u32 codecs, u32 domain, void *data) > u32 entries = fmt->format_entries; > unsigned int i = 0; > u32 num_planes = 0; > - u32 size; > + u32 size = 2 * sizeof(u32); > > while (entries) { > num_planes = pinfo->num_planes; > @@ -183,9 +183,10 @@ parse_raw_formats(struct venus_core *core, u32 codecs, u32 domain, void *data) > if (i >= MAX_FMT_ENTRIES) > return -EINVAL; > > - if (pinfo->num_planes > MAX_PLANES) > + if (num_planes > MAX_PLANES) Most of this patch (minus the line above) is in next as: bd595b745eb7 ("media: venus: fix payload size calculation in parse_raw_formats()") Konrad