Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2541115rdg; Mon, 16 Oct 2023 07:33:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFq7qe+RonpP84tw4m6tFMYPlI9SvKRaB9rJWOo4e+VNjuYdy4rdXAEHHU5/slA+8o4Hkdj X-Received: by 2002:a17:902:ce84:b0:1b6:6f12:502e with SMTP id f4-20020a170902ce8400b001b66f12502emr37204581plg.49.1697466803513; Mon, 16 Oct 2023 07:33:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697466803; cv=none; d=google.com; s=arc-20160816; b=wXq/hYMm98ZYn3bZryXeZV0QG75fkhCsHzMLv7qK1WSIF7Px3LE5noFw/+EFaUcDQd X7Y8fekW0jmnJ0QxHRLOKa48Atzi0AKq+zvhO4m3Btsd9pFasjy5xXFt37qW4gCkCWb1 g3F9yc9YMohP/bdLYVXLQ+JM9qPSwQNpORPgVsmHK8qc+liWo9QWXlUznz3T3RjUHL4W iyKc1PvRyln1PwJcmWQHzOasLUOQH3T6W/xy8okekfww2iHTITJ12XQrk0PxDOxWMWpb mc0a98O20iVXx4W5VpWYfH/hNw8Xackl2+rV690BWFrt+ldcsiiIrjBCNO7d7f6v51SO leeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=RZL33r01zN/4YXlBL4wYBXBNUwSgMKem3Isvpwjn0ag=; fh=rvfjkWKWQ7H3dxwU/Mrzlf1SBsZ3Tuo/EBElQFetDNM=; b=HGzPG5auqzaIFB+D4ym+bRNmQXtUFkr0N6kPe8WMKoUQZWqAxdV+3kP4mVG9bRXA1C fFj+MaccWyTLvctw2Nvyzm6AANJdY69rI76Caaj3ksJ1kO7CMK+fgUPwniBQ4KEfveK+ d8u3uEpyXCKfU2AHH8FjegOQeET9FsUjgM+ijrQnA4jLGEp8RGNL4JCP2vp2Sjuo4Vhj f1tL3s9hQuDvJCj4Yo39pUZZaT/MA4wadYvjEXwvaqnn4oR4cf2PSAQaK+ZLPHZL6+aC n2YihsmQ+a3kME2jD+dU1+QmCfh5OuLBdMqd94QuiE4HI24FhZtXDyxyz1HhUJfaglxM 7PTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b11-20020a170902ed0b00b001ca110d482csi6584880pld.573.2023.10.16.07.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 07:33:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A6D8A8030BA8; Mon, 16 Oct 2023 07:33:22 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233685AbjJPOdR (ORCPT + 99 others); Mon, 16 Oct 2023 10:33:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231321AbjJPOdQ (ORCPT ); Mon, 16 Oct 2023 10:33:16 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AD38EA; Mon, 16 Oct 2023 07:33:14 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 364EBC433C8; Mon, 16 Oct 2023 14:33:11 +0000 (UTC) Message-ID: <953e9c30-0060-45b7-b6e3-8f03d331b6b8@xs4all.nl> Date: Mon, 16 Oct 2023 16:33:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v11 45/56] media: test-drivers: vivid: Increase max supported buffers for capture queues Content-Language: en-US, nl To: Benjamin Gaignard , mchehab@kernel.org, tfiga@chromium.org, m.szyprowski@samsung.com, ming.qian@nxp.com, ezequiel@vanguardiasur.com.ar, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, nicolas.dufresne@collabora.com Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-staging@lists.linux.dev, kernel@collabora.com References: <20231012114642.19040-1-benjamin.gaignard@collabora.com> <20231012114642.19040-46-benjamin.gaignard@collabora.com> <0ca82921-b71a-4d87-a1f1-6a6158f07c8c@xs4all.nl> From: Hans Verkuil In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 07:33:22 -0700 (PDT) On 16/10/2023 16:20, Benjamin Gaignard wrote: > > Le 16/10/2023 à 12:32, Hans Verkuil a écrit : >> On 12/10/2023 13:46, Benjamin Gaignard wrote: >>> Change the maximum number of buffers of some capture queues in order >>> to test max_num_buffers field. >>> >>> Allow to allocate up to: >>> - 64 buffers for video capture queue. >>> - 1024 buffers for sdr capture queue. >>> - 32768 buffers for vbi capture queue. >>> >>> Signed-off-by: Benjamin Gaignard >>> --- >>>   drivers/media/test-drivers/vivid/vivid-core.c | 7 +++++++ >>>   1 file changed, 7 insertions(+) >>> >>> diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c >>> index 394c9f81ea72..b5656330578d 100644 >>> --- a/drivers/media/test-drivers/vivid/vivid-core.c >>> +++ b/drivers/media/test-drivers/vivid/vivid-core.c >>> @@ -876,6 +876,13 @@ static int vivid_create_queue(struct vivid_dev *dev, >>>       q->type = buf_type; >>>       q->io_modes = VB2_MMAP | VB2_DMABUF; >>>       q->io_modes |= V4L2_TYPE_IS_OUTPUT(buf_type) ?  VB2_WRITE : VB2_READ; >>> +    if (buf_type == V4L2_BUF_TYPE_VIDEO_CAPTURE) >>> +        q->max_num_buffers = 64; >>> +    if (buf_type == V4L2_BUF_TYPE_SDR_CAPTURE) >>> +        q->max_num_buffers = 1024; >>> +    if (buf_type == V4L2_BUF_TYPE_VBI_CAPTURE) >>> +        q->max_num_buffers = 32768; >> This should use the same calculation as MAX_BUFFER_INDEX. >> >> I wonder if those defines should move to videobuf2-core.h instead. > > I'm not sure about what you want here, q->max_num_buffers is clamped in vb2_core_queue_init(): > > /* The maximum is limited by offset cookie encoding pattern */ > q->max_num_buffers = min_t(unsigned int, q->max_num_buffers, MAX_BUFFER_INDEX); > > Do you want to reuse MAX_BUFFER_INDEX for these drivers ? Ah, I forgot about the clamping. Add a comment like this: /* * The maximum number of buffers is 32768 if PAGE_SHIFT == 12, * see also MAX_BUFFER_INDEX in videobuf2-core.c. It will be less if * PAGE_SHIFT > 12, but then max_num_buffers will be clamped by * videobuf2-core.c to MAX_BUFFER_INDEX. */ Regards, Hans > > Regards, > Benjamin > >> >> Regards, >> >>     Hans >> >>> + >>>       if (allocators[dev->inst] != 1) >>>           q->io_modes |= VB2_USERPTR; >>>       q->drv_priv = dev; >>