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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e962ecc5-1a41-14b4-5c98-f9f1ac284267@gmail.com>
Date:   Wed, 5 Apr 2023 09:12:33 +0300
From:   Stanimir Varbanov <stanimir.k.varbanov@...il.com>
To:     Dikshita Agarwal <quic_dikshita@...cinc.com>,
        linux-media@...r.kernel.org, quic_vgarodia@...cinc.com
Cc:     linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
        nicolas@...fresne.ca
Subject: Re: [PATCH v3] venus: venc: add handling for VIDIOC_ENCODER_CMD



On 4.01.23 г. 16:44 ч., Dikshita Agarwal wrote:
> Add handling for below commands in encoder:
> 1. V4L2_ENC_CMD_STOP
> 2. V4L2_ENC_CMD_START
> 
> Signed-off-by: Dikshita Agarwal <quic_dikshita@...cinc.com>
> 
> ---
> change since v2:
>    add a check to return EBUSY if CMD_START is called
>    in VENUS_ENC_STATE_DRAIN state
> 
>   drivers/media/platform/qcom/venus/core.h |  9 +++++
>   drivers/media/platform/qcom/venus/venc.c | 66 ++++++++++++++++++++++++++++++++
>   2 files changed, 75 insertions(+)
> 

> +static int
> +venc_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *cmd)
> +{
> +	struct venus_inst *inst = to_inst(file);
> +	struct hfi_frame_data fdata = {0};
> +	int ret = 0;
> +
> +	ret = v4l2_m2m_ioctl_try_encoder_cmd(file, fh, cmd);
> +	if (ret)
> +		return ret;
> +
> +	mutex_lock(&inst->lock);
> +
> +	if (cmd->cmd == V4L2_ENC_CMD_STOP &&
> +	    inst->enc_state == VENUS_ENC_STATE_ENCODING) {
> +		/*
> +		 * Implement V4L2_ENC_CMD_STOP by enqueue an empty buffer on
> +		 * encoder input to signal EOS.
> +		 */
> +		if (!(inst->streamon_out && inst->streamon_cap))
> +			goto unlock;
> +
> +		fdata.buffer_type = HFI_BUFFER_INPUT;
> +		fdata.flags |= HFI_BUFFERFLAG_EOS;
> +		fdata.device_addr = 0xdeadb000;
> +
> +		ret = hfi_session_process_buf(inst, &fdata);
> +
> +		inst->enc_state = VENUS_ENC_STATE_DRAIN;
> +	} else if (cmd->cmd == V4L2_ENC_CMD_START) {
> +		if (inst->enc_state == VENUS_ENC_STATE_DRAIN)
unlock the mutex!

			ret = -EBUSY;
			goto unlock;

> +			return -EBUSY;
> +		if (inst->enc_state == VENUS_ENC_STATE_STOPPED) {
> +			vb2_clear_last_buffer_dequeued(&inst->fh.m2m_ctx->cap_q_ctx.q);
> +			inst->enc_state = VENUS_ENC_STATE_ENCODING;
> +		}
> +	}
> +
> +unlock:
> +	mutex_unlock(&inst->lock);
> +	return ret;
> +}
> +

-- 
regards,
Stan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ