Message ID | 20230210081835.2054482-1-javierm@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp828764wrn; Fri, 10 Feb 2023 00:29:51 -0800 (PST) X-Google-Smtp-Source: AK7set+LsBGqVjON7+HaQmkgRFIF4V6xM8T1LdulpKDaA/Bpt/w61o1YCzj+7Giez+g0daDtIUQb X-Received: by 2002:a05:6a20:e189:b0:bf:58d1:ce97 with SMTP id ks9-20020a056a20e18900b000bf58d1ce97mr4862128pzb.22.1676017790782; Fri, 10 Feb 2023 00:29:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676017790; cv=none; d=google.com; s=arc-20160816; b=WNwt4V58NUYXKarQZXJJYZTgYGGqv3Maiki4V6Yx9NW0HqrictYRPGuE9ye+JYajly rwc5cwo/k6tkoA2McMcv4IEZl3kXStTg2G3V8vx83wQPip0m5di84hM2V5+KSH6Yn2Dk 3Ko+wrVTJu4AsnS9vf2OYOxArCsK2rVTGmEl1ncW15KnSXXccmqowXflCSdoixta5wWe UgCKj9floQ/c9ke4qHSnDZq2Ngo6JA192KHFfGJrTxrxMvP+gLpWy3fO3a8oPVooanFT egBSX++x/DHjVqa3krcZeUDIgJDgViEAkJD7WT1lKXzRYWueH0U92ROnGoNCHsh6YCiC FGXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iVtYqaaQ7dSvGBX/UdCn76+kv/o4oHmMd0gDTcWP1xU=; b=QX4TJeP078bbYAcqlhuhIteC9Nk/qbbqU6PATAkl8etWCasS+d5cnyfE2Xq2LV9pPx AtvSMjjsHAKK1IQcXuPQ/ZxPXwyXpnuKG7KQPGsxcLK4al2H5yqaHadzVrd639q1X110 Q/lHF3TSQ2OYZMiDT8xMabK8Ak5Ch3vmbyVk0GxgHEy0OviCP44hve+pdju7Ukhgdobj 3CimbTx2sClSlVE5BcR8V0qYYWFkDoLnKTFLVLn8mTCHXGFlGZ3B7g9v3N6t4f3KGvz7 IMFnTHCnKi+a11l2Rn/08y3X5TwCDapOUvY1fOyeLp3cbRrSE50sjrCMBjq7Y8p2NOs3 bf3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XBPhjvGP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d29-20020a63735d000000b004f1c1b3dce3si4238961pgn.635.2023.02.10.00.29.37; Fri, 10 Feb 2023 00:29:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XBPhjvGP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231434AbjBJITd (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Fri, 10 Feb 2023 03:19:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230522AbjBJITb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 10 Feb 2023 03:19:31 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FE6159E76 for <linux-kernel@vger.kernel.org>; Fri, 10 Feb 2023 00:18:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676017123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=iVtYqaaQ7dSvGBX/UdCn76+kv/o4oHmMd0gDTcWP1xU=; b=XBPhjvGPU062MqLRiT2rk64/V/rEkVY1o/LUi/67UQN9yHDkFWsfWPIui2h0z/31qLP3+0 bwyeQrne9iZS7BhvL+pnIQF3TBBYKTGb3Hu4T/cK1kmqmB1kr12mNHYB7JEBu6YjWWwmRm sUb2iQT198aPkBTQXopieBDQmDAMaK0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-189-GnGMlrIIPQO1GDiPGvEhSw-1; Fri, 10 Feb 2023 03:18:42 -0500 X-MC-Unique: GnGMlrIIPQO1GDiPGvEhSw-1 Received: by mail-wm1-f69.google.com with SMTP id l31-20020a05600c1d1f00b003deab30bb8bso2274354wms.2 for <linux-kernel@vger.kernel.org>; Fri, 10 Feb 2023 00:18:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iVtYqaaQ7dSvGBX/UdCn76+kv/o4oHmMd0gDTcWP1xU=; b=HverhQO7NLaV+zYArIkU+N9VzJbHQzZibu/1n3SXTXLF8mxsJ4oBysBtbxzIFsg3cl qOrtj4oa1InYw0MZzWDFGlnRok8WlaZbDWLRs7v+PfnHzrByV4HXje4Z60kFwYSaVFE5 Ov9P6Jxov9oiK6OqR34zmTy8a9QS+HP/j3aPuOjOcZzSJaLWl5cwB6fms4kbXSOwVFjb bkdqMpxcMicnz2cqhurde5VEFf8NP299XzienvXbGNA2nY9UhJO7b1mUQ2M31/f8g1SX mYouQ7sYoWsyT4iMyzyuvOzk+WrrDt994DdoqXiSirOIYzVF0EFYBn+cVCR3PG2pINqh JAQA== X-Gm-Message-State: AO0yUKWbJfqlWh+QPjN0qveZzlw1SKhHTplp/8m9pIQv9FVLS3ulMsMD 3uNte3PeNuyJgK1a9m8AFXhwQMQ8/ZbuEIMF85FRC09M6BeJjGXx3OBACzqCx8ZoVqhe/Y2ju2F 3SSd9fB5+Lg6K5+b4A5RZP8m+dnSh5ZSGR7rbUfd/7Q3HzUtTXwjzJo1GSdtk23NF7D9IzgjC6W AIhmfA X-Received: by 2002:a05:600c:2e95:b0:3dc:57e8:1d2f with SMTP id p21-20020a05600c2e9500b003dc57e81d2fmr12059806wmn.9.1676017120987; Fri, 10 Feb 2023 00:18:40 -0800 (PST) X-Received: by 2002:a05:600c:2e95:b0:3dc:57e8:1d2f with SMTP id p21-20020a05600c2e9500b003dc57e81d2fmr12059788wmn.9.1676017120804; Fri, 10 Feb 2023 00:18:40 -0800 (PST) Received: from minerva.home (205.pool92-176-231.dynamic.orange.es. [92.176.231.205]) by smtp.gmail.com with ESMTPSA id t8-20020a05600c2f8800b003ddf2865aeasm7624944wmn.41.2023.02.10.00.18.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 00:18:40 -0800 (PST) From: Javier Martinez Canillas <javierm@redhat.com> To: linux-kernel@vger.kernel.org Cc: Albert Esteve <aesteve@redhat.com>, Stanimir Varbanov <stanimir.varbanov@linaro.org>, Sergio Lopez <slp@redhat.com>, Enric Balletbo i Serra <eballetb@redhat.com>, Javier Martinez Canillas <javierm@redhat.com>, Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Mauro Carvalho Chehab <mchehab@kernel.org>, Stanimir Varbanov <stanimir.k.varbanov@gmail.com>, Vikash Garodia <quic_vgarodia@quicinc.com>, linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH] media: venus: dec: Fix capture formats enumeration order Date: Fri, 10 Feb 2023 09:18:35 +0100 Message-Id: <20230210081835.2054482-1-javierm@redhat.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757432030844829692?= X-GMAIL-MSGID: =?utf-8?q?1757432030844829692?= |
Series |
media: venus: dec: Fix capture formats enumeration order
|
|
Commit Message
Javier Martinez Canillas
Feb. 10, 2023, 8:18 a.m. UTC
Commit 9593126dae3e ("media: venus: Add a handling of QC08C compressed
format") and commit cef92b14e653 ("media: venus: Add a handling of QC10C
compressed format") added support for the QC08C and QC10C compressed
formats respectively.
But these also caused a regression, because the new formats where added
at the beginning of the vdec_formats[] array and the vdec_inst_init()
function sets the default format output and capture using fixed indexes
of that array:
static void vdec_inst_init(struct venus_inst *inst)
{
...
inst->fmt_out = &vdec_formats[8];
inst->fmt_cap = &vdec_formats[0];
...
}
Since now V4L2_PIX_FMT_NV12 is not the first entry in the array anymore,
the default capture format is not set to that as it was done before.
Both commits changed the first index to keep inst->fmt_out default format
set to V4L2_PIX_FMT_H264, but did not update the latter to keep .fmt_out
default format set to V4L2_PIX_FMT_NV12.
Rather than updating the index to the current V4L2_PIX_FMT_NV12 position,
let's reorder the entries so that this format is the first entry again.
This would also make VIDIOC_ENUM_FMT report the V4L2_PIX_FMT_NV12 format
with an index 0 as it did before the QC08C and QC10C formats were added.
Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format")
Fixes: cef92b14e653 ("media: venus: Add a handling of QC10C compressed format")
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
drivers/media/platform/qcom/venus/vdec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On Fri, Feb 10, 2023 at 09:18:35AM +0100, Javier Martinez Canillas wrote: > Commit 9593126dae3e ("media: venus: Add a handling of QC08C compressed > format") and commit cef92b14e653 ("media: venus: Add a handling of QC10C > compressed format") added support for the QC08C and QC10C compressed > formats respectively. > > But these also caused a regression, because the new formats where added > at the beginning of the vdec_formats[] array and the vdec_inst_init() > function sets the default format output and capture using fixed indexes > of that array: > > static void vdec_inst_init(struct venus_inst *inst) > { > ... > inst->fmt_out = &vdec_formats[8]; > inst->fmt_cap = &vdec_formats[0]; > ... > } > > Since now V4L2_PIX_FMT_NV12 is not the first entry in the array anymore, > the default capture format is not set to that as it was done before. > > Both commits changed the first index to keep inst->fmt_out default format > set to V4L2_PIX_FMT_H264, but did not update the latter to keep .fmt_out > default format set to V4L2_PIX_FMT_NV12. > > Rather than updating the index to the current V4L2_PIX_FMT_NV12 position, > let's reorder the entries so that this format is the first entry again. > > This would also make VIDIOC_ENUM_FMT report the V4L2_PIX_FMT_NV12 format > with an index 0 as it did before the QC08C and QC10C formats were added. > > Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format") > Fixes: cef92b14e653 ("media: venus: Add a handling of QC10C compressed format") > Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> I just came across this issue independently and can confirm this patch fixes the GStreamer V4L2 decoder on QRB5165. Tested-by: Jordan Crouse <jorcrous@amazon.com> > --- > > drivers/media/platform/qcom/venus/vdec.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c > index 4ceaba37e2e5..bb14bea9fe09 100644 > --- a/drivers/media/platform/qcom/venus/vdec.c > +++ b/drivers/media/platform/qcom/venus/vdec.c > @@ -31,15 +31,15 @@ > */ > static const struct venus_format vdec_formats[] = { > { > - .pixfmt = V4L2_PIX_FMT_QC08C, > + .pixfmt = V4L2_PIX_FMT_NV12, > .num_planes = 1, > .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, > }, { > - .pixfmt = V4L2_PIX_FMT_QC10C, > + .pixfmt = V4L2_PIX_FMT_QC08C, > .num_planes = 1, > .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, > - },{ > - .pixfmt = V4L2_PIX_FMT_NV12, > + }, { > + .pixfmt = V4L2_PIX_FMT_QC10C, > .num_planes = 1, > .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, > }, {
Jordan Crouse <jorcrous@amazon.com> writes: Hello Jordan, > On Fri, Feb 10, 2023 at 09:18:35AM +0100, Javier Martinez Canillas wrote: >> Commit 9593126dae3e ("media: venus: Add a handling of QC08C compressed >> format") and commit cef92b14e653 ("media: venus: Add a handling of QC10C >> compressed format") added support for the QC08C and QC10C compressed >> formats respectively. >> >> But these also caused a regression, because the new formats where added >> at the beginning of the vdec_formats[] array and the vdec_inst_init() >> function sets the default format output and capture using fixed indexes >> of that array: >> >> static void vdec_inst_init(struct venus_inst *inst) >> { >> ... >> inst->fmt_out = &vdec_formats[8]; >> inst->fmt_cap = &vdec_formats[0]; >> ... >> } >> >> Since now V4L2_PIX_FMT_NV12 is not the first entry in the array anymore, >> the default capture format is not set to that as it was done before. >> >> Both commits changed the first index to keep inst->fmt_out default format >> set to V4L2_PIX_FMT_H264, but did not update the latter to keep .fmt_out >> default format set to V4L2_PIX_FMT_NV12. >> >> Rather than updating the index to the current V4L2_PIX_FMT_NV12 position, >> let's reorder the entries so that this format is the first entry again. >> >> This would also make VIDIOC_ENUM_FMT report the V4L2_PIX_FMT_NV12 format >> with an index 0 as it did before the QC08C and QC10C formats were added. >> >> Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format") >> Fixes: cef92b14e653 ("media: venus: Add a handling of QC10C compressed format") >> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> > > I just came across this issue independently and can confirm this patch fixes > the GStreamer V4L2 decoder on QRB5165. > > Tested-by: Jordan Crouse <jorcrous@amazon.com> > Thanks for testing it! Stanimir, can we please get this for v6.3 as well?
On 3/6/2023 3:38 PM, Javier Martinez Canillas wrote: > Jordan Crouse <jorcrous@amazon.com> writes: > > Hello Jordan, > >> On Fri, Feb 10, 2023 at 09:18:35AM +0100, Javier Martinez Canillas wrote: >>> Commit 9593126dae3e ("media: venus: Add a handling of QC08C compressed >>> format") and commit cef92b14e653 ("media: venus: Add a handling of QC10C >>> compressed format") added support for the QC08C and QC10C compressed >>> formats respectively. >>> >>> But these also caused a regression, because the new formats where added >>> at the beginning of the vdec_formats[] array and the vdec_inst_init() >>> function sets the default format output and capture using fixed indexes >>> of that array: >>> >>> static void vdec_inst_init(struct venus_inst *inst) >>> { >>> ... >>> inst->fmt_out = &vdec_formats[8]; >>> inst->fmt_cap = &vdec_formats[0]; >>> ... >>> } >>> >>> Since now V4L2_PIX_FMT_NV12 is not the first entry in the array anymore, >>> the default capture format is not set to that as it was done before. >>> >>> Both commits changed the first index to keep inst->fmt_out default format >>> set to V4L2_PIX_FMT_H264, but did not update the latter to keep .fmt_out >>> default format set to V4L2_PIX_FMT_NV12. >>> >>> Rather than updating the index to the current V4L2_PIX_FMT_NV12 position, >>> let's reorder the entries so that this format is the first entry again. >>> >>> This would also make VIDIOC_ENUM_FMT report the V4L2_PIX_FMT_NV12 format >>> with an index 0 as it did before the QC08C and QC10C formats were added. >>> >>> Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format") >>> Fixes: cef92b14e653 ("media: venus: Add a handling of QC10C compressed format") >>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> >> I just came across this issue independently and can confirm this patch fixes >> the GStreamer V4L2 decoder on QRB5165. >> >> Tested-by: Jordan Crouse <jorcrous@amazon.com> >> > Thanks for testing it! > > Stanimir, can we please get this for v6.3 as well? Hi Javier, Jordan Could you please explain what regression/issue you see with patch? venus hardware supports QC08C which provides better performance hence driver is publishing it as preferred color format. if client doesn't support this or want to use any other format, they can set the desired format with s_fmt. Thanks, Dikshita
Dikshita Agarwal <quic_dikshita@quicinc.com> writes: Hello Dikshita, > On 3/6/2023 3:38 PM, Javier Martinez Canillas wrote: >> Jordan Crouse <jorcrous@amazon.com> writes: >> >> Hello Jordan, >> >>> On Fri, Feb 10, 2023 at 09:18:35AM +0100, Javier Martinez Canillas wrote: >>>> Commit 9593126dae3e ("media: venus: Add a handling of QC08C compressed >>>> format") and commit cef92b14e653 ("media: venus: Add a handling of QC10C >>>> compressed format") added support for the QC08C and QC10C compressed >>>> formats respectively. >>>> >>>> But these also caused a regression, because the new formats where added >>>> at the beginning of the vdec_formats[] array and the vdec_inst_init() >>>> function sets the default format output and capture using fixed indexes >>>> of that array: >>>> >>>> static void vdec_inst_init(struct venus_inst *inst) >>>> { >>>> ... >>>> inst->fmt_out = &vdec_formats[8]; >>>> inst->fmt_cap = &vdec_formats[0]; >>>> ... >>>> } >>>> >>>> Since now V4L2_PIX_FMT_NV12 is not the first entry in the array anymore, >>>> the default capture format is not set to that as it was done before. >>>> >>>> Both commits changed the first index to keep inst->fmt_out default format >>>> set to V4L2_PIX_FMT_H264, but did not update the latter to keep .fmt_out >>>> default format set to V4L2_PIX_FMT_NV12. >>>> >>>> Rather than updating the index to the current V4L2_PIX_FMT_NV12 position, >>>> let's reorder the entries so that this format is the first entry again. >>>> >>>> This would also make VIDIOC_ENUM_FMT report the V4L2_PIX_FMT_NV12 format >>>> with an index 0 as it did before the QC08C and QC10C formats were added. >>>> >>>> Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format") >>>> Fixes: cef92b14e653 ("media: venus: Add a handling of QC10C compressed format") >>>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> >>> I just came across this issue independently and can confirm this patch fixes >>> the GStreamer V4L2 decoder on QRB5165. >>> >>> Tested-by: Jordan Crouse <jorcrous@amazon.com> >>> >> Thanks for testing it! >> >> Stanimir, can we please get this for v6.3 as well? > > Hi Javier, Jordan > > Could you please explain what regression/issue you see with patch? > > venus hardware supports QC08C which provides better performance hence > driver is publishing it as preferred color format. > > if client doesn't support this or want to use any other format, they can > set the desired format with s_fmt. > VIDIOC_S_FMT is currently broken for venus, at least on the HP X2 Chromebook and only the default works. I'm still investigating why vdec_s_fmt() is not working. But basically, if VIDIOC_S_FMT is called for the capture queue, then later the VIDIOC_G_FMT ioctl fails with -EINVAL. This is due the following condition checked in vdec_check_src_change(): static int vdec_check_src_change(struct venus_inst *inst) { ... if (inst->subscriptions & V4L2_EVENT_SOURCE_CHANGE && inst->codec_state == VENUS_DEC_STATE_INIT && !inst->reconfig) return -EINVAL; ... } But regardless, I think that it would be better for a driver to not change the order of advertised VIDIOC_ENUM_FMT pixel formats. Because what happens now is that a decoding that was previously working by default is not working anymore due a combination of the default being changed and S_FMT not working as expected.
Hi all, On Tue, Mar 7, 2023 at 9:13 AM Javier Martinez Canillas <javierm@redhat.com> wrote: > > Dikshita Agarwal <quic_dikshita@quicinc.com> writes: > > Hello Dikshita, > > > On 3/6/2023 3:38 PM, Javier Martinez Canillas wrote: > >> Jordan Crouse <jorcrous@amazon.com> writes: > >> > >> Hello Jordan, > >> > >>> On Fri, Feb 10, 2023 at 09:18:35AM +0100, Javier Martinez Canillas wrote: > >>>> Commit 9593126dae3e ("media: venus: Add a handling of QC08C compressed > >>>> format") and commit cef92b14e653 ("media: venus: Add a handling of QC10C > >>>> compressed format") added support for the QC08C and QC10C compressed > >>>> formats respectively. > >>>> > >>>> But these also caused a regression, because the new formats where added > >>>> at the beginning of the vdec_formats[] array and the vdec_inst_init() > >>>> function sets the default format output and capture using fixed indexes > >>>> of that array: > >>>> > >>>> static void vdec_inst_init(struct venus_inst *inst) > >>>> { > >>>> ... > >>>> inst->fmt_out = &vdec_formats[8]; > >>>> inst->fmt_cap = &vdec_formats[0]; > >>>> ... > >>>> } > >>>> > >>>> Since now V4L2_PIX_FMT_NV12 is not the first entry in the array anymore, > >>>> the default capture format is not set to that as it was done before. > >>>> > >>>> Both commits changed the first index to keep inst->fmt_out default format > >>>> set to V4L2_PIX_FMT_H264, but did not update the latter to keep .fmt_out > >>>> default format set to V4L2_PIX_FMT_NV12. > >>>> > >>>> Rather than updating the index to the current V4L2_PIX_FMT_NV12 position, > >>>> let's reorder the entries so that this format is the first entry again. > >>>> > >>>> This would also make VIDIOC_ENUM_FMT report the V4L2_PIX_FMT_NV12 format > >>>> with an index 0 as it did before the QC08C and QC10C formats were added. > >>>> > >>>> Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format") > >>>> Fixes: cef92b14e653 ("media: venus: Add a handling of QC10C compressed format") > >>>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> > >>> I just came across this issue independently and can confirm this patch fixes > >>> the GStreamer V4L2 decoder on QRB5165. > >>> > >>> Tested-by: Jordan Crouse <jorcrous@amazon.com> > >>> This patch also fixes an issue running a V4L2 based decoder on Acer Chromebook Spin 513 which is very similar to the HP X2 Chromebook, not surprising as both platforms are basically the same, but anyway: Tested-by: Enric Balletbo i Serra <eballetbo@redhat.com> > > >> Thanks for testing it! > >> > >> Stanimir, can we please get this for v6.3 as well? > > > > Hi Javier, Jordan > > > > Could you please explain what regression/issue you see with patch? > > > > venus hardware supports QC08C which provides better performance hence > > driver is publishing it as preferred color format. > > > > if client doesn't support this or want to use any other format, they can > > set the desired format with s_fmt. > > I guess general clients are unlikely to support this format as it is an opaque intermediate format used by Qualcomm platforms, and the purpose of that format is to be used for other Qualcomm hardware blocks that know about this format. So I'd say that returning by default a more common format is more reliable. Using your argument if someone wants to use QC08C (because he knows it can use it) set with s_fmt will do the trick too. In any case, the problem here seems to be that s_fmt is not working, so it would be nice to have a solution for that first and meanwhile do not change the old behaviour. Just my two cents. Best regards, Enric Balletbo > > VIDIOC_S_FMT is currently broken for venus, at least on the HP X2 > Chromebook and only the default works. I'm still investigating why > vdec_s_fmt() is not working. > > But basically, if VIDIOC_S_FMT is called for the capture queue, > then later the VIDIOC_G_FMT ioctl fails with -EINVAL. This is due > the following condition checked in vdec_check_src_change(): > > static int vdec_check_src_change(struct venus_inst *inst) > { > ... > if (inst->subscriptions & V4L2_EVENT_SOURCE_CHANGE && > inst->codec_state == VENUS_DEC_STATE_INIT && > !inst->reconfig) > return -EINVAL; > ... > } > > But regardless, I think that it would be better for a driver to > not change the order of advertised VIDIOC_ENUM_FMT pixel formats. > > Because what happens now is that a decoding that was previously > working by default is not working anymore due a combination of > the default being changed and S_FMT not working as expected. > > -- > Best regards, > > Javier Martinez Canillas > Core Platforms > Red Hat >
On Tue, Mar 07, 2023 at 05:20:18PM +0100, Enric Balletbo i Serra wrote: > Hi all, > > On Tue, Mar 7, 2023 at 9:13 AM Javier Martinez Canillas > <javierm@redhat.com> wrote: > > > > Dikshita Agarwal <quic_dikshita@quicinc.com> writes: > > > > Hello Dikshita, > > > > > On 3/6/2023 3:38 PM, Javier Martinez Canillas wrote: > > >> Jordan Crouse <jorcrous@amazon.com> writes: > > >> > > >> Hello Jordan, > > >> > > >>> On Fri, Feb 10, 2023 at 09:18:35AM +0100, Javier Martinez Canillas wrote: > > >>>> Commit 9593126dae3e ("media: venus: Add a handling of QC08C compressed > > >>>> format") and commit cef92b14e653 ("media: venus: Add a handling of QC10C > > >>>> compressed format") added support for the QC08C and QC10C compressed > > >>>> formats respectively. > > >>>> > > >>>> But these also caused a regression, because the new formats where added > > >>>> at the beginning of the vdec_formats[] array and the vdec_inst_init() > > >>>> function sets the default format output and capture using fixed indexes > > >>>> of that array: > > >>>> > > >>>> static void vdec_inst_init(struct venus_inst *inst) > > >>>> { > > >>>> ... > > >>>> inst->fmt_out = &vdec_formats[8]; > > >>>> inst->fmt_cap = &vdec_formats[0]; > > >>>> ... > > >>>> } > > >>>> > > >>>> Since now V4L2_PIX_FMT_NV12 is not the first entry in the array anymore, > > >>>> the default capture format is not set to that as it was done before. > > >>>> > > >>>> Both commits changed the first index to keep inst->fmt_out default format > > >>>> set to V4L2_PIX_FMT_H264, but did not update the latter to keep .fmt_out > > >>>> default format set to V4L2_PIX_FMT_NV12. > > >>>> > > >>>> Rather than updating the index to the current V4L2_PIX_FMT_NV12 position, > > >>>> let's reorder the entries so that this format is the first entry again. > > >>>> > > >>>> This would also make VIDIOC_ENUM_FMT report the V4L2_PIX_FMT_NV12 format > > >>>> with an index 0 as it did before the QC08C and QC10C formats were added. > > >>>> > > >>>> Fixes: 9593126dae3e ("media: venus: Add a handling of QC08C compressed format") > > >>>> Fixes: cef92b14e653 ("media: venus: Add a handling of QC10C compressed format") > > >>>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> > > >>> I just came across this issue independently and can confirm this patch fixes > > >>> the GStreamer V4L2 decoder on QRB5165. > > >>> > > >>> Tested-by: Jordan Crouse <jorcrous@amazon.com> > > >>> > > This patch also fixes an issue running a V4L2 based decoder on Acer > Chromebook Spin 513 which is very similar to the HP X2 Chromebook, not > surprising as both platforms are basically the same, but anyway: > > Tested-by: Enric Balletbo i Serra <eballetbo@redhat.com> > > > > > >> Thanks for testing it! > > >> > > >> Stanimir, can we please get this for v6.3 as well? > > > > > > Hi Javier, Jordan > > > > > > Could you please explain what regression/issue you see with patch? > > > > > > venus hardware supports QC08C which provides better performance hence > > > driver is publishing it as preferred color format. > > > > > > if client doesn't support this or want to use any other format, they can > > > set the desired format with s_fmt. > > > > > I guess general clients are unlikely to support this format as it is > an opaque intermediate format used by Qualcomm platforms, and the > purpose of that format is to be used for other Qualcomm hardware > blocks that know about this format. So I'd say that returning by > default a more common format is more reliable. Using your argument if > someone wants to use QC08C (because he knows it can use it) set with > s_fmt will do the trick too. > > In any case, the problem here seems to be that s_fmt is not working, > so it would be nice to have a solution for that first and meanwhile do > not change the old behaviour. Just my two cents. > > Best regards, > Enric Balletbo > > > > > VIDIOC_S_FMT is currently broken for venus, at least on the HP X2 > > Chromebook and only the default works. I'm still investigating why > > vdec_s_fmt() is not working. > > > > But basically, if VIDIOC_S_FMT is called for the capture queue, > > then later the VIDIOC_G_FMT ioctl fails with -EINVAL. This is due > > the following condition checked in vdec_check_src_change(): > > > > static int vdec_check_src_change(struct venus_inst *inst) > > { > > ... > > if (inst->subscriptions & V4L2_EVENT_SOURCE_CHANGE && > > inst->codec_state == VENUS_DEC_STATE_INIT && > > !inst->reconfig) > > return -EINVAL; > > ... > > } > > > > But regardless, I think that it would be better for a driver to > > not change the order of advertised VIDIOC_ENUM_FMT pixel formats. > > > > Because what happens now is that a decoding that was previously > > working by default is not working anymore due a combination of > > the default being changed and S_FMT not working as expected. For my part, I was using the gstreamer v4l2 decoder which for some reason tries to verify it can support whatever format it gets with G_FMT *before* trying a S_FMT. I can't confirm or deny if S_FMT currently works or not. That said, I entirely agree with Javier. While it might be more bandwidth efficient, QC08C is a obscure format. It is far more likely that the average open source user would rather use a well known output format and, as has been mentioned, once S_FMT is fixed those in the know can use the other formats if they are working with other Qualcomm hardware blocks. Jordan
Jordan Crouse <jorcrous@amazon.com> writes: > On Tue, Mar 07, 2023 at 05:20:18PM +0100, Enric Balletbo i Serra wrote: [...] >> > >> > But regardless, I think that it would be better for a driver to >> > not change the order of advertised VIDIOC_ENUM_FMT pixel formats. >> > >> > Because what happens now is that a decoding that was previously >> > working by default is not working anymore due a combination of >> > the default being changed and S_FMT not working as expected. > > For my part, I was using the gstreamer v4l2 decoder which for some reason tries > to verify it can support whatever format it gets with G_FMT *before* > trying a S_FMT. I can't confirm or deny if S_FMT currently works or not. > > That said, I entirely agree with Javier. While it might be more > bandwidth efficient, QC08C is a obscure format. It is far more likely that the > average open source user would rather use a well known output format and, as > has been mentioned, once S_FMT is fixed those in the know can use the other > formats if they are working with other Qualcomm hardware blocks. > Agreed. The rule is that the kernel shouldn't regress user-space and the patches that changed the default format certainly did that. So from that point of view I think that this patch should land. There's also Enric's point that NV12 is a more common format and supported by more user-space programs. That's why think that regardless of the S_FMT situation, makes sense to revert to the previous default behaviour.
Javier Martinez Canillas <javierm@redhat.com> writes: Hello Stanimir and Dikshita, > Jordan Crouse <jorcrous@amazon.com> writes: > >> On Tue, Mar 07, 2023 at 05:20:18PM +0100, Enric Balletbo i Serra wrote: > > [...] > >>> > >>> > But regardless, I think that it would be better for a driver to >>> > not change the order of advertised VIDIOC_ENUM_FMT pixel formats. >>> > >>> > Because what happens now is that a decoding that was previously >>> > working by default is not working anymore due a combination of >>> > the default being changed and S_FMT not working as expected. >> >> For my part, I was using the gstreamer v4l2 decoder which for some reason tries >> to verify it can support whatever format it gets with G_FMT *before* >> trying a S_FMT. I can't confirm or deny if S_FMT currently works or not. >> >> That said, I entirely agree with Javier. While it might be more >> bandwidth efficient, QC08C is a obscure format. It is far more likely that the >> average open source user would rather use a well known output format and, as >> has been mentioned, once S_FMT is fixed those in the know can use the other >> formats if they are working with other Qualcomm hardware blocks. >> > > Agreed. The rule is that the kernel shouldn't regress user-space and the > patches that changed the default format certainly did that. So from that > point of view I think that this patch should land. > > There's also Enric's point that NV12 is a more common format and supported > by more user-space programs. That's why think that regardless of the S_FMT > situation, makes sense to revert to the previous default behaviour. > Any news on this patch? It would be great to fix this at least for v6.3.
diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 4ceaba37e2e5..bb14bea9fe09 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -31,15 +31,15 @@ */ static const struct venus_format vdec_formats[] = { { - .pixfmt = V4L2_PIX_FMT_QC08C, + .pixfmt = V4L2_PIX_FMT_NV12, .num_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, }, { - .pixfmt = V4L2_PIX_FMT_QC10C, + .pixfmt = V4L2_PIX_FMT_QC08C, .num_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, - },{ - .pixfmt = V4L2_PIX_FMT_NV12, + }, { + .pixfmt = V4L2_PIX_FMT_QC10C, .num_planes = 1, .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, }, {