linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sebastian Fricke <sebastian.fricke@collabora.com>
Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Dafna Hirschfeld <dafna@fastmail.com>,
	"open list:ROCKCHIP ISP V1 DRIVER" <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Heiko Stuebner <heiko@sntech.de>,
	"open list:ROCKCHIP ISP V1 DRIVER"
	<linux-rockchip@lists.infradead.org>,
	Adam Pigg <adam@piggz.co.uk>
Subject: Re: [PATCH] media: rkisp1: Reduce min_queued_buffers to 1
Date: Mon, 7 Oct 2024 16:47:34 +0300	[thread overview]
Message-ID: <20241007134734.GA7439@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20241007125730.yn6xinehhm73yqob@basti-XPS-13-9310>

On Mon, Oct 07, 2024 at 02:57:30PM +0200, Sebastian Fricke wrote:
> Hey Jacopo,
> 
> On 07.10.2024 14:42, Jacopo Mondi wrote:
> > There apparently is no reason to require 3 queued buffers to call
> > streamon() for the RkISP1 as the driver operates with a scratch buffer
> > where frames can be directed to if there's no available buffer provided
> > by userspace.
> > 
> > Reduce the number of required buffers to 1 to allow applications to
> > operate with a single queued buffer.
> > 
> > Tested with libcamera, by operating with a single capture a request. The
> > same request (and associated capture buffer) gets recycled once
> > completed. This of course causes a frame rate drop but doesn't hinder
> > operations.
> > 
> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > ---
> > 
> > Adam,
> >    a few months ago you were exercizing your pinhole app with a single capture
> > request for StillCapture operations and you got the video device to hang because
> > no enough buffers where provided.
> > 
> > This small change should be enough to unblock you. Could you maybe give it a
> > spin if you're still working on this ?
> > 
> > Thanks
> >    j
> > ---
> > 
> >  drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > index 2bddb4fa8a5c..34adaecdee54 100644
> > --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> > @@ -35,8 +35,6 @@
> >  #define RKISP1_SP_DEV_NAME	RKISP1_DRIVER_NAME "_selfpath"
> >  #define RKISP1_MP_DEV_NAME	RKISP1_DRIVER_NAME "_mainpath"
> > 
> > -#define RKISP1_MIN_BUFFERS_NEEDED 3
> > -
> >  enum rkisp1_plane {
> >  	RKISP1_PLANE_Y	= 0,
> >  	RKISP1_PLANE_CB	= 1,
> > @@ -1563,7 +1561,7 @@ static int rkisp1_register_capture(struct rkisp1_capture *cap)
> >  	q->ops = &rkisp1_vb2_ops;
> >  	q->mem_ops = &vb2_dma_contig_memops;
> >  	q->buf_struct_size = sizeof(struct rkisp1_buffer);
> > -	q->min_queued_buffers = RKISP1_MIN_BUFFERS_NEEDED;
> 
> It looks like RKISP1_MIN_BUFFERS_NEEDED is used only here, so can you
> remove the define as well?

Isn't that exactly what this patch is doing ?

> rg 'RKISP1_MIN_BUFFERS_NEEDED' 
> drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c
> 38:#define RKISP1_MIN_BUFFERS_NEEDED 3
> 1566:	q->min_queued_buffers = RKISP1_MIN_BUFFERS_NEEDED;
> 
> Or maybe just change the value, but I am not sure whether this can be
> considered a magic value.
> 
> > +	q->min_queued_buffers = 1;
> >  	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
> >  	q->lock = &node->vlock;
> >  	q->dev = cap->rkisp1->dev;

-- 
Regards,

Laurent Pinchart

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2024-10-07 13:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07 12:42 [PATCH] media: rkisp1: Reduce min_queued_buffers to 1 Jacopo Mondi
2024-10-07 12:57 ` Sebastian Fricke
2024-10-07 13:47   ` Laurent Pinchart [this message]
2024-10-07 14:05     ` Sebastian Fricke
2024-10-07 19:35       ` Jacopo Mondi
2024-10-07 19:49         ` Laurent Pinchart
2024-10-08  6:49           ` Sebastian Fricke
2024-10-07 13:55 ` Laurent Pinchart
2024-10-09 10:09   ` Jacopo Mondi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241007134734.GA7439@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=adam@piggz.co.uk \
    --cc=dafna@fastmail.com \
    --cc=heiko@sntech.de \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mchehab@kernel.org \
    --cc=sebastian.fricke@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).