[PATCH] media: mtk-vcodec: vdec: Reduce padding in VIDIOC_TRY_FMT

2021-03-30 Thread Fritz Koenig
If the header has been parsed or the codec is stateless reduce the padding of the decoded frame. In stateless codecs width and height are specified by the application. Signed-off-by: Fritz Koenig --- .../platform/mtk-vcodec/mtk_vcodec_dec.c | 59 --- 1 file changed, 39

Re: [PATCH -next] media: venus: Include io.h for memremap()

2021-02-05 Thread Fritz Koenig
644 > --- a/drivers/media/platform/qcom/venus/core.c > +++ b/drivers/media/platform/qcom/venus/core.c > @@ -5,6 +5,7 @@ > */ > #include > #include > +#include > #include > #include > #include > > base-commit: 0ca0ca9805055bb0efc16890f9d6433c65bd07cc > -- > https://chromeos.dev Reviewed-by: Fritz Koenig

[PATCH] venus: Check for valid device instance

2021-01-12 Thread Fritz Koenig
core->dev_dec and core-dev->enc are set up by the corresponding vdec_probe and venc_probe. If the probe fails, they will not be set and so could be null when venus_sys_error_handler is called. Fixes: 43e221e485e5 ("media: venus: Rework recovery mechanism") Signed-off

Re: [PATCH RESEND v3] venus: venc: set inband mode property to FW.

2021-01-12 Thread Fritz Koenig
+656,19 @@ static int venc_set_properties(struct venus_inst *inst) > if (ret) > return ret; > > + if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264 || > + inst->fmt_cap->pixfmt == V4L2_PIX_FMT_

Re: [PATCH] venus: pm_helpers: Control core power domain manually

2021-01-11 Thread Fritz Koenig
struct opp_table *opp_table; > bool has_opp_table; > - struct device_link *pd_dl_venus; remove from comment at start of struct as well. * @pd_dl_venus: pmdomain device-link for venus domain The patch gives huge improvements in encoder stability! Tested-by: Fritz Koeni

Re: [PATCH v2 7/8] venus: venc: Handle reset encoder state

2021-01-01 Thread Fritz Koenig
How should we resolve this patch in relation to the "venus: venc: Init the session only once in queue_setup" [1] patch? "venus: venc: Init the session only once in queue_setup" comes after and reworks |venc_start_streaming| substantially. This patch implements |venc_stop_streaming|, but maybe

Re: [PATCH v2 0/4] Venus encoder improvements

2020-12-04 Thread Fritz Koenig
eview the code yet, I'll leave that for early next week. In the meantime I have tested the patches and found them to be working well. Tested-by: Fritz Koenig

Re: [PATCH v2] venus: vdec: Handle DRC after drain

2020-12-02 Thread Fritz Koenig
On Tue, Dec 1, 2020 at 9:58 PM Alexandre Courbot wrote: > > On Wed, Dec 2, 2020 at 7:34 AM Stanimir Varbanov > wrote: > > > > Hi Fritz, > > > > On 12/1/20 6:23 AM, Fritz Koenig wrote: > > > If the DRC is near the end of the stream the client > &g

[PATCH v2] venus: vdec: Handle DRC after drain

2020-11-30 Thread Fritz Koenig
If the DRC is near the end of the stream the client may send a V4L2_DEC_CMD_STOP before the DRC occurs. V4L2_DEC_CMD_STOP puts the driver into the VENUS_DEC_STATE_DRAIN state. DRC must be aware so that after the DRC event the state can be restored correctly. Signed-off-by: Fritz Koenig --- v2

Re: [PATCH] venus: venc: Add VIDIOC_TRY_ENCODER_CMD support

2020-11-30 Thread Fritz Koenig
On Mon, Nov 30, 2020 at 7:24 PM Alexandre Courbot wrote: > > On Sun, Nov 29, 2020 at 3:05 PM Fritz Koenig wrote: > > > > V4L2_ENC_CMD_STOP and V4L2_ENC_CMD_START are already > > supported. Add a way to query for support. > > I think your Signed-off-by is missing

Re: [PATCH v2 0/8] Venus stateful encoder compliance

2020-11-30 Thread Fritz Koenig
On Sun, Nov 29, 2020 at 11:55 PM Stanimir Varbanov wrote: > > Hi Fritz, > > On 11/29/20 9:17 PM, Fritz Koenig wrote: > > Since this patchset adds support for V4L2_ENC_CMD_STOP and > > VENUS_ENC_STATE_ENCODING it should also add support for > > VIDIOC_TRY_ENCO

Re: [PATCH v2 0/8] Venus stateful encoder compliance

2020-11-29 Thread Fritz Koenig
Since this patchset adds support for V4L2_ENC_CMD_STOP and VENUS_ENC_STATE_ENCODING it should also add support for VIDIOC_TRY_ENCODER_CMD so that those commands are discoverable. I've made an attempt at that here: https://www.spinics.net/lists/linux-media/msg182319.html On Wed, Nov 11, 2020 at

Re: [PATCH v2 6/8] venus: venc: add handling for VIDIOC_ENCODER_CMD

2020-11-28 Thread Fritz Koenig
et; > vb->timestamp = timestamp_us * NSEC_PER_USEC; > vbuf->sequence = inst->sequence_cap++; > + > + if ((!bytesused && m2m_ctx->is_draining) || > + (vbuf->flags & V4L2_BUF_FLAG_LAST)) { > + vbuf->flags |= V4L2_BUF_FLAG_LAST; > + v4l2_m2m_mark_stopped(inst->m2m_ctx); > + } > } else { > vbuf->sequence = inst->sequence_out++; > } > -- > 2.17.1 > Reviewed-by: Fritz Koenig

Re: [PATCH v2 5/8] venus: pm_helpers: Check instance state when calculate instance frequency

2020-11-28 Thread Fritz Koenig
>vpp_freq; > /* 21 / 20 is overhead factor */ > vpp_freq += vpp_freq / 20; > -- > 2.17.1 > Reviewed-by: Fritz Koenig

Re: [PATCH v2 8/8] venus: helpers: Delete unused stop streaming helper

2020-11-28 Thread Fritz Koenig
uf_prepare(struct vb2_buffer *vb); > void venus_helper_vb2_buf_queue(struct vb2_buffer *vb); > void venus_helper_process_buf(struct vb2_buffer *vb); > -void venus_helper_vb2_stop_streaming(struct vb2_queue *q); > int venus_helper_vb2_start_streaming(struct venus_inst *inst); > void venus_helper_m2m_device_run(void *priv); > void venus_helper_m2m_job_abort(void *priv); > -- > 2.17.1 > Reviewed-by: Fritz Koenig

Re: [PATCH v2 4/8] venus: helpers: Calculate properly compressed buffer size

2020-11-28 Thread Fritz Koenig
On Wed, Nov 11, 2020 at 6:38 AM Stanimir Varbanov wrote: > > For resolutions below 720p the size of the compressed buffer must > be bigger. Correct this by checking the resolution when calculating > buffer size and multiply by four. I'm confused because the commit message doesn't appear to line

Re: [PATCH v2 3/8] venus: hfi_cmds: Allow null buffer address on encoder input

2020-11-28 Thread Fritz Koenig
device_addr) > + if (!cookie) > return -EINVAL; > > pkt->shdr.hdr.size = sizeof(*pkt); > -- > 2.17.1 > Reviewed-by: Fritz Koenig

[PATCH] venus: venc: Add VIDIOC_TRY_ENCODER_CMD support

2020-11-28 Thread Fritz Koenig
V4L2_ENC_CMD_STOP and V4L2_ENC_CMD_START are already supported. Add a way to query for support. --- drivers/media/platform/qcom/venus/venc.c | 26 1 file changed, 26 insertions(+) diff --git a/drivers/media/platform/qcom/venus/venc.c

Re: [PATCH v2 1/8] venus: hfi: Use correct state in unload resources

2020-11-28 Thread Fritz Koenig
t; @@ -87,7 +87,6 @@ struct hfi_event_data { > #define INST_LOAD_RESOURCES4 > #define INST_START 5 > #define INST_STOP 6 > -#define INST_RELEASE_RESOURCES 7 > > struct venus_core; > struct venus_inst; > -- > 2.17.1 > Reviewed-by: Fritz Koenig

Re: [PATCH v2 2/8] venus: helpers: Add a new helper for buffer processing

2020-11-28 Thread Fritz Koenig
_init(struct vb2_buffer *vb); > int venus_helper_vb2_buf_prepare(struct vb2_buffer *vb); > void venus_helper_vb2_buf_queue(struct vb2_buffer *vb); > +void venus_helper_process_buf(struct vb2_buffer *vb); > void venus_helper_vb2_stop_streaming(struct vb2_queue *q); > int venus_helper_vb2_start_streaming(struct venus_inst *inst); > void venus_helper_m2m_device_run(void *priv); > -- > 2.17.1 > Reviewed-by: Fritz Koenig

Re: [PATCH 2/3] venus: Limit HFI sessions to the maximum supported

2020-11-22 Thread Fritz Koenig
On Sun, Nov 22, 2020 at 6:48 AM Stanimir Varbanov wrote: > > > > On 11/21/20 3:14 AM, Fritz Koenig wrote: > > On Thu, Nov 19, 2020 at 4:12 PM Stanimir Varbanov > > wrote: > >> > >> Currently we rely on firmware to return error when we reach the

Re: [PATCH 1/3] venus: venc: Init the session only once in queue_setup

2020-11-20 Thread Fritz Koenig
_session_deinit(inst); > -bufs_done: > +error: > venus_helper_buffers_done(inst, q->type, VB2_BUF_STATE_QUEUED); > if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) > inst->streamon_out = 0; > @@ -940,7 +987,8 @@ static void venc_vb2_buf_queue(struct vb2_buffer *vb) > > static const struct vb2_ops venc_vb2_ops = { > .queue_setup = venc_queue_setup, > - .buf_init = venus_helper_vb2_buf_init, > + .buf_init = venc_buf_init, > + .buf_cleanup = venc_buf_cleanup, > .buf_prepare = venus_helper_vb2_buf_prepare, > .start_streaming = venc_start_streaming, > .stop_streaming = venus_helper_vb2_stop_streaming, > -- > 2.17.1 > Reviewed-by: Fritz Koenig

Re: [PATCH 2/3] venus: Limit HFI sessions to the maximum supported

2020-11-20 Thread Fritz Koenig
On Thu, Nov 19, 2020 at 4:12 PM Stanimir Varbanov wrote: > > Currently we rely on firmware to return error when we reach the maximum > supported number of sessions. But this errors are happened at reqbuf > time which is a bit later. The more reasonable way looks like is to > return the error on

Re: [PATCH 3/3] media: hfi_venus: Request interrupt for sync cmds

2020-11-20 Thread Fritz Koenig
On Thu, Nov 19, 2020 at 4:12 PM Stanimir Varbanov wrote: > > From: Vikash Garodia > > For synchronous commands, update the message queue variable. > This would inform video firmware to raise interrupt on host > CPU whenever there is a response for such commands. > > Signed-off-by: Vikash Garodia

Re: [PATCH 3/4] venus: venc: Handle reset encoder state

2020-11-10 Thread Fritz Koenig
On Mon, Nov 9, 2020 at 9:48 PM Fritz Koenig wrote: > > On Thu, Nov 5, 2020 at 3:51 AM Stanimir Varbanov > wrote: > > > > > > > > On 11/4/20 12:44 PM, vgaro...@codeaurora.org wrote: > > > Hi Stan, > > > > > > On 2020-11-03 06:46, Fritz K

[PATCH] venus: guard load_scale

2020-11-09 Thread Fritz Koenig
load_scale can only be safely called after the encoder has been initialized. Signed-off-by: Fritz Koenig --- drivers/media/platform/qcom/venus/pm_helpers.h | 4 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/qcom/venus/pm_helpers.h b/drivers/media/platform/qcom/venus

Re: [PATCH 3/4] venus: venc: Handle reset encoder state

2020-11-09 Thread Fritz Koenig
On Thu, Nov 5, 2020 at 3:51 AM Stanimir Varbanov wrote: > > > > On 11/4/20 12:44 PM, vgaro...@codeaurora.org wrote: > > Hi Stan, > > > > On 2020-11-03 06:46, Fritz Koenig wrote: > >> On Fri, Oct 23, 2020 at 5:57 AM Stanimir Varbanov > >>

Re: [PATCH] venus: fix calculating mbps in calculate_inst_freq()

2020-11-09 Thread Fritz Koenig
a.codec_freq_data->vpp_freq; > /* 21 / 20 is overhead factor */ > -- > QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member > of Code Aurora Forum, hosted by The Linux Foundation > Reviewed-by: Fritz Koenig

Re: [PATCH] venus: venc: fix handlig of S_SELECTION and G_SELECTION

2020-11-04 Thread Fritz Koenig
On Tue, Nov 3, 2020 at 8:50 AM Dikshita Agarwal wrote: > > - return correct width and height for G_SELECTION > - update capture port wxh with rectangle wxh. > - add support for HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_INFO > to set stride info and chroma offset to FW. > > Signed-off-by:

Re: [PATCH 3/4] venus: venc: Handle reset encoder state

2020-11-02 Thread Fritz Koenig
On Fri, Oct 23, 2020 at 5:57 AM Stanimir Varbanov wrote: > > Redesign the encoder driver to be compliant with stateful encoder > spec - specifically adds handling of Reset state. > > Signed-off-by: Stanimir Varbanov > --- > drivers/media/platform/qcom/venus/core.h | 10 +- >

Re: [PATCH] venus: vdec: return parsed crop information from stream

2020-10-18 Thread Fritz Koenig
It looks like only h.264 streams are populating the event.input_crop struct when receiving the HFI_INDEX_EXTRADATA_INPUT_CROP message in event_seq_changed(). vp8/vp9 streams end up with the struct filled with 0. On Fri, Oct 9, 2020 at 1:45 AM Alexandre Courbot wrote: > > Per the stateful codec

Re: [PATCH] venus: fixes for list corruption

2020-08-07 Thread Fritz Koenig
> + > + mutex_lock(>lock); > + if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) > + if (!list_empty(>registeredbufs)) > + list_del_init(>reg_list); > + mutex_unlock(>lock); > > inst->buf_count--; > if (!inst->buf_count) > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > Reviewed-by: Fritz Koenig

Re: [PATCH 3/3] venus: Add new interface queues reinit

2020-08-07 Thread Fritz Koenig
); > + > + mutex_unlock(>lock); > +} > diff --git a/drivers/media/platform/qcom/venus/hfi_venus.h > b/drivers/media/platform/qcom/venus/hfi_venus.h > index 57154832090e..1b656ef2bf07 100644 > --- a/drivers/media/platform/qcom/venus/hfi_venus.h > +++ b/drivers/media/platform/qcom/venus/hfi_venus.h > @@ -10,5 +10,6 @@ struct venus_core; > > void venus_hfi_destroy(struct venus_core *core); > int venus_hfi_create(struct venus_core *core); > +void venus_hfi_queues_reinit(struct venus_core *core); > > #endif > -- > 2.17.1 > Reviewed-by: Fritz Koenig

Re: [PATCH 2/3] venus: Rework recovery mechanism

2020-08-07 Thread Fritz Koenig
alt_axi(hdev); > venus_sfr_print(hdev); > } > > @@ -1009,10 +1002,6 @@ static irqreturn_t venus_isr_thread(struct venus_core > *core) > res = hdev->core->res; > pkt = hdev->pkt_buf; > > - if (hdev->irq_status & WRAPPER_INTR_STATUS_A2HWD_MASK) { > - venus_sfr_print(hdev); > - hfi_process_watchdog_timeout(core); > - } > > while (!venus_iface_msgq_read(hdev, pkt)) { > msg_ret = hfi_process_msg_packet(core, pkt); > -- > 2.17.1 > Reviewed-by: Fritz Koenig

Re: [PATCH 1/3] venus: parser: Prepare parser for multiple invocations

2020-08-07 Thread Fritz Koenig
gt; + core->codecs_count = 0; > + memset(core->caps, 0, sizeof(core->caps)); > + > while (words_count) { > data = word + 1; > > -- > 2.17.1 > Reviewed-by: Fritz Koenig