lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e154b22c-1cb4-dbb1-40e0-91fad130363d@collabora.com>
Date:   Mon, 16 Jan 2023 09:23:09 +0100
From:   Andrzej Pietrasiewicz <andrzej.p@...labora.com>
To:     Sebastian Fricke <sebastian.fricke@...labora.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-rockchip@...ts.infradead.org, linux-staging@...ts.linux.dev,
        Jonas Karlman <jonas@...boo.se>,
        Alex Bee <knaerzche@...il.com>,
        Nicolas Dufresne <nicolas.dufresne@...labora.com>,
        Collabora Kernel-domain <kernel@...labora.com>,
        Robert Beckett <bob.beckett@...labora.com>,
        Laurent Pinchart <laurent.pinchart@...asonboard.com>,
        Benjamin Gaignard <benjamin.gaignard@...labora.com>
Subject: Re: [PATCH v2 04/12] staging: media: rkvdec: Block start streaming
 until both queues run

Hi Sebastian,

Ezequiel and Dan have had some comments, they need addressing.

If, as a result, the logic of this patch remains in place then:

W dniu 12.01.2023 o 13:56, Sebastian Fricke pisze:
> Ensure that both the CAPTURE and the OUTPUT queue are running (e.g. busy
> -> have buffers allocated) before starting the actual streaming process.
> 
> Signed-off-by: Sebastian Fricke <sebastian.fricke@...labora.com>
> ---
>   drivers/staging/media/rkvdec/rkvdec.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/staging/media/rkvdec/rkvdec.c b/drivers/staging/media/rkvdec/rkvdec.c
> index c849f6c20279..e0e95d06e216 100644
> --- a/drivers/staging/media/rkvdec/rkvdec.c
> +++ b/drivers/staging/media/rkvdec/rkvdec.c
> @@ -562,6 +562,13 @@ static int rkvdec_start_streaming(struct vb2_queue *q, unsigned int count)
>   	if (V4L2_TYPE_IS_CAPTURE(q->type))
>   		return 0;
>   
> +	/*
> +	 * Make sure that both the output and the capture queue are running
> +	 */
> +	if (rkvdec_queue_busy(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) == 0 ||
> +	    rkvdec_queue_busy(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) == 0)

if you convert to a macro in PATCH 03/12 then the conditions can be rewritten as

!rkvdec_queue_busy(.....)

instead of comparing to 0. (actually, this can be done regardless, but makes 
more sense if the result of rkvdec_queue_busy() is boolean which it is when
it becomes a macro as suggested)

Then you can optionally follow De Morgan's law:

if (!(rkvdec_queue_busy() && rkvdec_queue_busy()))
	return -EAGAIN;

and you get one negation less.

Regards,

Andrzej

> +		return -EAGAIN;
> +
>   	desc = ctx->coded_fmt_desc;
>   	if (WARN_ON(!desc))
>   		return -EINVAL;
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ