From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 9CEE736308D for ; Thu, 21 May 2026 07:18:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779347936; cv=none; b=KnjTYfCEX5zPdjn6UM5SE+xLCPF0uFpxF1dPJxRLVJKz/KhkwAlVdN4BhEN2IRWKNXuyEeP5y3OaOu2ZouoqWyZBohdr++aUBK5ruBTfRFEjhrXP0DBIfTvYVE0M8qFTDPTkIe9BsMCvmtT9UGqbXV6dU5VZ2lz8rcBkVhKJELM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779347936; c=relaxed/simple; bh=ENWaSHBZoZ9w5cKwcFrQT87wjVPfmFeBFdI2+RaeD74=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=KIpIHSmH0/1On3SUAoIqfudI2FuEaLDXXJxA5hZZOUGnk1BLc6xQp34/gjnWohQzTtIJM/2mGx6Ebd6nxyYuheCAS4or8WOZjW4/k0QBu5r2RYmQTzLR0GkwAxUSkV9Eoj+Lx0JJZI8gZDVd2IeR1Dq7Gkf6EC798fvD6T51CNw= 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=uXdzFnB/; arc=none smtp.client-ip=209.85.221.51 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="uXdzFnB/" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-44e5624c053so3526180f8f.2 for ; Thu, 21 May 2026 00:18:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1779347933; x=1779952733; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=bETVK/qL+P6n+cslnrRdLDkDC8prspZnCCpH5RkWKN0=; b=uXdzFnB/PEbkb08zbsX4PkC1McJfoogR2AIPeyu13Lqtw6VNGaoBPxZNt8i0YsvcK8 lXL7qLKimsNdS/NbS7RLsl4gQTCGRiEgbBOB/38Pc61ZXN7l8FEhZmmQZ1yZmlgakCMX 7szvRWgw9/k+ae+sVTtWnktCZSCjCS0kOrmvd0eIMyVkaJq9NIttQ6KhVUyX/otJcoE/ jm4fSywOuiIyCmlhtVN20bp2fzQXjSJhmgjd7QFl6L9WP83AIfciXZEMvohP28Z3ev+9 xvD403TZEliktzaNvy+2frLaP8me03DUhc9q0WzfuOeOw+oO4LyKZJT6PZEqDU/k/bJH jUMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779347933; x=1779952733; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:references:cc:to:subject:reply-to:from:user-agent :mime-version:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bETVK/qL+P6n+cslnrRdLDkDC8prspZnCCpH5RkWKN0=; b=i2NUk7RLt19Bh7knRmFOn2J029AMsXsa8AXekQg6dLERvhJ7gIEYG0fiX0kZaTbBrN JAZqY+PnsNIOsp2IZb7/66CAACsBF2ApbTeyArArfVS3FjNEfA7HhPV4acwOKPy8Vp0U 7h9MxIhkld6eMuElZnpO83bPdfKX0n+jXyDjZrQRXUTXsWflYZqMtiTmrfOoU0IXsmm2 sb8CFhWwM2TQsCEihKR8oMsyjJgloo/bCXpJtwMTd/1AOAOs/K2/1XLQAEruVW8/9a6/ xPrMrBvKmJ7r2w+FBbj9/G5YDGnO5EDYy5qsW/TZtWdaOUzdgEcDYZO+UyzJLRowEBS/ 7Ftg== X-Forwarded-Encrypted: i=1; AFNElJ/p6jxhfZ/h25dhSUP27gMsSluibYh4xEAAy2dPB6BJFuLsjjdh8n9XWv9seC9sDn7ezpZk+NVI4+tAli4=@vger.kernel.org X-Gm-Message-State: AOJu0Ywkx/BJGGJrD+wjOOijw6YNIHA8wRQxG4R8R409vpHMqTpaHSTn C8vVgAQei7hqJRmzkFhIqYm3KBbdGPVDohVa/K/8BgJYijBMmpFmWctcehUp/fLrZpc= X-Gm-Gg: Acq92OGk1yxnRMidcrVcTDUOV6eg9yey1ewNb+gyqYl24JoVohm77XNWTqalBbsXAbA mIK32EQl/TxB/g8YFssrpz9OsBVFuOkD8ow3QvPmawieWHxwMAOgYOM9P+yBMb9/8q9KPNM5Hsc MP1HojY9r8GVycR0qTl5YMnoQZlbww3YBv2HdmLwTfxli7zTZhP0fBTCQtUPPvUMIk0nIhSrGpe 16oSY1R60DxLhPJHEU5r37iIUS/FrG5jl76m+IGJZbC5bjtzurjRNkGSHYbWreoYz9GBidmazwq nZPh1KzxSEBxpbcKp1GFmnHsn1TGiNS4dO5YZMoNTrAPCFYfTycmyDteKFOLN/dTs7Zey6cJa/W t+vICvt8IasXAghYUJCYKkeeVeQDIYBkVO2Wo8SHPDtF2VCkTtooPaUpzQ+xVYpDD16LQt1UyoO c2lFYBCsN5nDfBwu4g9ov/Bn2O6XlnjuYlkcKhB9LnTPSUCfCyM4pXpTznK139MDxz+PBu5LZTL UdSuvhBRFZKexXa4w== X-Received: by 2002:a05:6000:240b:b0:43e:a69b:d810 with SMTP id ffacd0b85a97d-45ea3df3f69mr2462925f8f.38.1779347932779; Thu, 21 May 2026 00:18:52 -0700 (PDT) Received: from ?IPV6:2a01:e0a:106d:1080:e038:7e8a:7467:8c6c? ([2a01:e0a:106d:1080:e038:7e8a:7467:8c6c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45eaa7d0a36sm544322f8f.2.2026.05.21.00.18.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 May 2026 00:18:52 -0700 (PDT) Message-ID: Date: Thu, 21 May 2026 09:18:51 +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 From: Neil Armstrong Reply-To: Neil Armstrong Subject: Re: [PATCH v3 5/6] media: qcom: iris: vdec: update find_format to handle 8bit and 10bit formats To: Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , nicolas Dufresne , Hans Verkuil Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260511-topic-sm8x50-iris-10bit-decoding-v3-0-7fc049b93042@linaro.org> <20260511-topic-sm8x50-iris-10bit-decoding-v3-5-7fc049b93042@linaro.org> <5fc62574-fae1-4bf0-b6b9-fb6fb33041f8@oss.qualcomm.com> <08eff436-4221-4bc2-9fac-2ac1b6a091ae@linaro.org> <8f708b87-92d3-47ed-8cda-1f34b512816c@oss.qualcomm.com> <0534f746-c776-4688-94d3-85a7d7f2d25e@linaro.org> <209f8a94-957f-4362-9e17-40e74eed4d7c@oss.qualcomm.com> Content-Language: en-US, fr Autocrypt: addr=neil.armstrong@linaro.org; keydata= xsBNBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTC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XwQYAQIACQUCTVkGzwIbDAAKCRAWmrexpM/4rrXiB/sGbkQ6itMrAIfn M7IbRuiSZS1unlySUVYu3SD6YBYnNi3G5EpbwfBNuT3H8//rVvtOFK4OD8cRYkxXRQmTvqa3 3eDIHu/zr1HMKErm+2SD6PO9umRef8V82o2oaCLvf4WeIssFjwB0b6a12opuRP7yo3E3gTCS KmbUuLv1CtxKQF+fUV1cVaTPMyT25Od+RC1K+iOR0F54oUJvJeq7fUzbn/KdlhA8XPGzwGRy 4zcsPWvwnXgfe5tk680fEKZVwOZKIEuJC3v+/yZpQzDvGYJvbyix0lHnrCzq43WefRHI5XTT QbM0WUIBIcGmq38+OgUsMYu4NzLu7uZFAcmp6h8g Organization: Linaro In-Reply-To: <209f8a94-957f-4362-9e17-40e74eed4d7c@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 5/20/26 17:47, Vikash Garodia wrote: > > On 5/20/2026 9:09 PM, Neil Armstrong wrote: >> On 5/20/26 17:30, Vikash Garodia wrote: >>> >>> On 5/18/2026 1:06 PM, Neil Armstrong wrote: >>>> On 5/13/26 21:27, Vikash Garodia wrote: >>>>> >>>>> >>>>> On 5/11/2026 2:50 PM, Neil Armstrong wrote: >>>>>> 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 helper to filter the formats and only allow the proper >>>>>> formats when setting or trying a capture format. >>>>>> >>>>>> Signed-off-by: Neil Armstrong >>>>>> --- >>>>>>   drivers/media/platform/qcom/iris/iris_platform_common.h |  1 + >>>>>>   drivers/media/platform/qcom/iris/iris_vdec.c            | 10 ++++ ++ ++++ >>>>>>   2 files changed, 11 insertions(+) >>>>>> >>>>>> 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 eea69f937147..f4d9951ed04c 100644 >>>>>> --- a/drivers/media/platform/qcom/iris/iris_vdec.c >>>>>> +++ b/drivers/media/platform/qcom/iris/iris_vdec.c >>>>>> @@ -99,6 +99,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_10) >>>>>> +            return NULL; >>>>>> + >>>>>> +        if (iris_fmt_is_10bit(fmt[i].pixfmt) && >>>>>> +            inst->fw_caps[BIT_DEPTH].value != BIT_DEPTH_10) >>>>>> +            return NULL; >>>>>> +    } >>>>> >>>>> similar logic would be now needed while enumerating fmt. >>>>> >>>>> VIDIOC_ENUM_FMT will now enumerate all capture formats (NV12, QC08C, QC10C..) regardless of the stream's bit depth, while VIDIOC_S_FMT will reject the wrong-depth formats. >>>>> >>>>> userspace will see formats via ENUM_FMT that it cannot successfully set with S_FMT. >>>> >>>> So initially I did that, but I reverted since it broke decoding with gstreamer when trying >>>> to use QC10C since it requires negociating the src/sink before sending the fist buffer >>>> and then get the source format change to switch to 10bit. >>> >>> Does that mean that src is still producing the data in Q10c, while sink is configured to NV12 (8bit) ? >> >> No, it's early src/sink negociation capabilities with the special DRM DMABUF format to handle the QC10c, way before playback starts and starts the v4l2 dance. >> > > How will it know its Q10c, even before the playback starts ? So in the way upstream gstreamer wants to support QC8C/QC10C, the format must be specified like: gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB.h265 ! h265parse ! v4l2h265dec ! "video/x-raw(memory:DMABuf), format=DMA_DRM, drm-format=NV12:0x0500000000000001" ! kmssink or gst-launch-1.0 -v -m filesrc location=Big_Buck_Bunny_1080_10s_30MB_main10.h265 ! h265parse ! v4l2h265dec ! "video/x-raw(memory:DMABuf), format=DMA_DRM, drm-format=P010:0x0500000000000001" ! kmssink so this means the QC8C/QC10C format must be listed in the VIDIOC_ENUM_FMT so the v4l2h265dec element can enums them as supported (and translated as drm-format=NV12:0x0500000000000001/drm-format=P010:0x0500000000000001) Neil > >>> >>>> >>>> I checked and none of the other v4l2 drivers supporting 10bit does that, so it seems right >>>> to allow enumerating all possibly supported formats and only accept the session supported >>>> one with S_FMT. >>> >>> I was reading the documentation on this aspects, and it says to keep all the supported ones, instead of changing runtime and limit it to 10bit ones, in this case. >> >> Hmm, so my change is correct ? > > Yes, to me. > >> >>> >>> +ing Nico and Hans incase they would like to comment on this. >>> >>>> >>>>> >>>>>> + >>>>>>       return &fmt[i]; >>>>>>   } >>>>>> >>>>> >>>>> Regards, >>>>> Vikash >>>>> >>>> >>> >> >