From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Dikshita Agarwal <quic_dikshita@quicinc.com>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
stanimir.k.varbanov@gmail.com, quic_vgarodia@quicinc.com,
agross@kernel.org, andersson@kernel.org,
konrad.dybcio@linaro.org, mchehab@kernel.org
Cc: linux-arm-msm@vger.kernel.org, quic_abhinavk@quicinc.com
Subject: Re: [PATCH v2 14/34] media: iris: implement iris v4l2 file ops
Date: Tue, 19 Dec 2023 11:57:03 +0000 [thread overview]
Message-ID: <6b2ce264-3cc6-4c00-85c8-c885b2707787@linaro.org> (raw)
In-Reply-To: <1702899149-21321-15-git-send-email-quic_dikshita@quicinc.com>
On 18/12/2023 11:32, Dikshita Agarwal wrote:
> From: Vikash Garodia <quic_vgarodia@quicinc.com>
>
> Implements iris v4l2 file ops - open, close and poll.
>
> Open:
> Configure the vb2 queue and v4l2 file handler. Initialize
> a video instance and add the instance to core instance list.
> Open a session in video firmware via HFI_CMD_OPEN.
>
> Close:
> De-initialize the instance and remove it from core
> instance list. Close the session in firmware via HFI_CMD_CLOSE.
>
> Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
> ---
> drivers/media/platform/qcom/vcodec/iris/Makefile | 2 +
> .../media/platform/qcom/vcodec/iris/hfi_defines.h | 2 +
> .../media/platform/qcom/vcodec/iris/iris_common.h | 26 ++
> .../media/platform/qcom/vcodec/iris/iris_core.c | 42 ++-
> .../media/platform/qcom/vcodec/iris/iris_core.h | 8 +
> .../media/platform/qcom/vcodec/iris/iris_helpers.c | 62 +++++
> .../media/platform/qcom/vcodec/iris/iris_helpers.h | 2 +
> drivers/media/platform/qcom/vcodec/iris/iris_hfi.c | 115 +++++++-
> drivers/media/platform/qcom/vcodec/iris/iris_hfi.h | 3 +
> .../platform/qcom/vcodec/iris/iris_hfi_packet.c | 28 ++
> .../platform/qcom/vcodec/iris/iris_hfi_packet.h | 7 +
> .../platform/qcom/vcodec/iris/iris_instance.h | 48 ++++
> .../media/platform/qcom/vcodec/iris/iris_probe.c | 10 +
> .../media/platform/qcom/vcodec/iris/iris_vdec.c | 47 ++++
> .../media/platform/qcom/vcodec/iris/iris_vdec.h | 14 +
> .../media/platform/qcom/vcodec/iris/iris_vidc.c | 298 +++++++++++++++++++++
> .../media/platform/qcom/vcodec/iris/iris_vidc.h | 15 ++
> 17 files changed, 719 insertions(+), 10 deletions(-)
> create mode 100644 drivers/media/platform/qcom/vcodec/iris/iris_common.h
> create mode 100644 drivers/media/platform/qcom/vcodec/iris/iris_instance.h
> create mode 100644 drivers/media/platform/qcom/vcodec/iris/iris_vdec.c
> create mode 100644 drivers/media/platform/qcom/vcodec/iris/iris_vdec.h
> create mode 100644 drivers/media/platform/qcom/vcodec/iris/iris_vidc.c
> create mode 100644 drivers/media/platform/qcom/vcodec/iris/iris_vidc.h
>
> diff --git a/drivers/media/platform/qcom/vcodec/iris/Makefile b/drivers/media/platform/qcom/vcodec/iris/Makefile
> index c50e3241..3c076d0 100644
> --- a/drivers/media/platform/qcom/vcodec/iris/Makefile
> +++ b/drivers/media/platform/qcom/vcodec/iris/Makefile
> @@ -3,6 +3,8 @@ iris-objs += ../hfi_queue.o ../firmware.o
> iris-objs += iris_probe.o \
> iris_state.o \
> iris_core.o \
> + iris_vidc.o \
> + iris_vdec.o \
> iris_state.o \
> iris_helpers.o \
> iris_hfi.o \
> diff --git a/drivers/media/platform/qcom/vcodec/iris/hfi_defines.h b/drivers/media/platform/qcom/vcodec/iris/hfi_defines.h
> index fb383b2..423ba1a 100644
> --- a/drivers/media/platform/qcom/vcodec/iris/hfi_defines.h
> +++ b/drivers/media/platform/qcom/vcodec/iris/hfi_defines.h
> @@ -9,6 +9,8 @@
> #define HFI_VIDEO_ARCH_LX 0x1
>
> #define HFI_CMD_INIT 0x01000001
> +#define HFI_CMD_OPEN 0x01000003
> +#define HFI_CMD_CLOSE 0x01000004
>
> #define HFI_PROP_IMAGE_VERSION 0x03000001
>
> diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_common.h b/drivers/media/platform/qcom/vcodec/iris/iris_common.h
> new file mode 100644
> index 0000000..3e4dd71
> --- /dev/null
> +++ b/drivers/media/platform/qcom/vcodec/iris/iris_common.h
> @@ -0,0 +1,26 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
> + */
> +#ifndef _IRIS_COMMON_H_
> +#define _IRIS_COMMON_H_
> +
> +#include <media/v4l2-device.h>
> +#include <media/v4l2-event.h>
> +#include <media/v4l2-ioctl.h>
> +#include <media/videobuf2-v4l2.h>
> +
> +#define INPUT_MPLANE V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE
> +#define OUTPUT_MPLANE V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
> +#define DEFAULT_WIDTH 320
> +#define DEFAULT_HEIGHT 240
> +#define DEFAULT_BUF_SIZE 115200
> +
> +enum signal_session_response {
> + SIGNAL_CMD_STOP_INPUT = 0,
> + SIGNAL_CMD_STOP_OUTPUT,
> + SIGNAL_CMD_CLOSE,
> + MAX_SIGNAL,
> +};
> +
> +#endif
> diff --git a/drivers/media/platform/qcom/vcodec/iris/iris_core.c b/drivers/media/platform/qcom/vcodec/iris/iris_core.c
> index ba8960d..174fad9 100644
> --- a/drivers/media/platform/qcom/vcodec/iris/iris_core.c
> +++ b/drivers/media/platform/qcom/vcodec/iris/iris_core.c
> @@ -3,12 +3,14 @@
> * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
> */
>
> +#include <linux/delay.h>
> +
> #include "iris_core.h"
> #include "iris_helpers.h"
> #include "iris_hfi.h"
> #include "iris_state.h"
>
> -static int iris_core_deinit_locked(struct iris_core *core)
> +int iris_core_deinit_locked(struct iris_core *core)
> {
> int ret;
>
> @@ -68,3 +70,41 @@ int iris_core_init(struct iris_core *core)
>
> return ret;
> }
> +
> +int iris_core_init_wait(struct iris_core *core)
> +{
> + const int interval = 10;
> + int max_tries, count = 0, ret = 0;
> +
> + mutex_lock(&core->lock);
> + if (!core_in_valid_state(core)) {
> + ret = -EINVAL;
> + goto unlock;
> + }
> +
> + if (core->state == IRIS_CORE_INIT)
> + goto unlock;
> +
> + max_tries = core->cap[HW_RESPONSE_TIMEOUT].value / interval;
> + while (count < max_tries) {
> + if (core->state != IRIS_CORE_INIT_WAIT)
> + break;
> + msleep(interval);
> + count++;
> + }
Is the intention here really to poll and sleep for 10 milliseconds and
if so why ?
Shouldn't there be some sort of bootup IRQ or event that we can trap ?
That's how it works in the venus driver right ? Just kick a workqueue
when the IRQ fires and have the iris_core_init_wait() do a
wait_for_completion_timeout().
> +int iris_hfi_session_open(struct iris_inst *inst)
> +{
> + struct iris_core *core;
> + int ret;
> +
> + inst->packet_size = 4096;
> + inst->packet = kzalloc(inst->packet_size, GFP_KERNEL);
> + if (!inst->packet)
> + return -ENOMEM;
Who is responsible for cleaning up this allocation ?
> +
> +fail_free_packet:
> + kfree(inst->packet);
freed here.
> +int iris_hfi_session_close(struct iris_inst *inst)
> +{
> }
but not here ?
Still finding this alot of code to go through.
Please try to break this up into smaller series.
---
bod
next prev parent reply other threads:[~2023-12-19 11:57 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-18 11:31 [PATCH v2 00/34] Qualcomm video encoder and decoder driver Dikshita Agarwal
2023-12-18 11:31 ` [PATCH v2 01/34] media: introduce common helpers for video firmware handling Dikshita Agarwal
2023-12-18 18:24 ` Dmitry Baryshkov
2023-12-20 8:01 ` Dikshita Agarwal
2023-12-20 8:12 ` Dmitry Baryshkov
2023-12-20 17:10 ` Abhinav Kumar
2023-12-20 20:56 ` Dmitry Baryshkov
2023-12-20 21:03 ` Abhinav Kumar
2023-12-19 11:40 ` Bryan O'Donoghue
2023-12-19 13:26 ` Dmitry Baryshkov
2023-12-20 8:01 ` Dikshita Agarwal
2023-12-18 11:31 ` [PATCH v2 02/34] media: introduce common helpers for queues handling Dikshita Agarwal
2023-12-18 18:29 ` Dmitry Baryshkov
2023-12-20 8:03 ` Dikshita Agarwal
2023-12-18 11:31 ` [PATCH v2 03/34] media: introduce common helpers for buffer size calculation Dikshita Agarwal
2023-12-18 18:32 ` Dmitry Baryshkov
2023-12-20 8:04 ` Dikshita Agarwal
2023-12-20 8:15 ` Dmitry Baryshkov
2023-12-18 11:31 ` [PATCH v2 04/34] dt-bindings: media: Add sm8550 dt schema Dikshita Agarwal
2023-12-18 16:10 ` Krzysztof Kozlowski
2023-12-18 18:17 ` Dmitry Baryshkov
2023-12-18 11:32 ` [PATCH v2 05/34] media: MAINTAINERS: Add Qualcomm Iris video accelerator driver Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 06/34] media: iris: register video device to platform driver Dikshita Agarwal
2023-12-18 18:40 ` Dmitry Baryshkov
2023-12-18 11:32 ` [PATCH v2 07/34] media: iris: initialize power resources Dikshita Agarwal
2023-12-18 15:09 ` Konrad Dybcio
2023-12-20 8:04 ` Dikshita Agarwal
2024-01-03 13:45 ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 08/34] media: iris: introduce state machine for iris core Dikshita Agarwal
2023-12-18 18:46 ` Dmitry Baryshkov
2023-12-20 8:05 ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 09/34] media: iris: initialize shared queues for host and firmware communication Dikshita Agarwal
2023-12-18 18:46 ` Dmitry Baryshkov
2023-12-20 8:05 ` Dikshita Agarwal
2023-12-18 21:33 ` Konrad Dybcio
2023-12-20 8:05 ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 10/34] media: iris: add PIL functionality for video firmware Dikshita Agarwal
2023-12-18 21:40 ` Konrad Dybcio
2023-12-20 8:15 ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 11/34] media: iris: introduce packetization layer for creating HFI packets Dikshita Agarwal
2023-12-18 21:50 ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 12/34] media: iris: add video processing unit(VPU) specific register handling Dikshita Agarwal
2023-12-18 16:19 ` Krzysztof Kozlowski
2023-12-18 22:00 ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 13/34] media: iris: introduce platform specific capabilities for core and instance Dikshita Agarwal
2023-12-18 22:08 ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 14/34] media: iris: implement iris v4l2 file ops Dikshita Agarwal
2023-12-19 11:57 ` Bryan O'Donoghue [this message]
2023-12-18 11:32 ` [PATCH v2 15/34] media: iris: add handling for interrupt service routine(ISR) invoked by hardware Dikshita Agarwal
2023-12-19 11:48 ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 16/34] media: iris: implement iris v4l2_ctrl_ops and prepare capabilities Dikshita Agarwal
2023-12-19 11:50 ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 17/34] media: iris: implement vb2_ops queue setup Dikshita Agarwal
2023-12-19 11:56 ` Konrad Dybcio
2023-12-20 8:37 ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 18/34] media: iris: introduce and implement iris vb2 mem ops Dikshita Agarwal
2023-12-19 11:58 ` Konrad Dybcio
2023-12-18 11:32 ` [PATCH v2 19/34] media: iris: implement HFI to queue and release buffers Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 20/34] media: iris: add video hardware internal buffer count and size calculation Dikshita Agarwal
2023-12-19 12:06 ` Bryan O'Donoghue
2023-12-20 8:29 ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 21/34] media: iris: implement internal buffer management Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 22/34] media: iris: introduce instance states Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 23/34] media: iris: implement iris v4l2 ioctl ops supported by decoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 24/34] media: iris: subscribe input and output properties to firmware Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 25/34] media: iris: subscribe src change and handle firmware responses Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 26/34] media: iris: implement vb2 streaming ops on capture and output planes Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 27/34] media: iris: implement vb2 ops for buf_queue and firmware response Dikshita Agarwal
2023-12-19 12:21 ` Konrad Dybcio
2023-12-20 8:25 ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 28/34] media: iris: add instance sub states and implement DRC and Drain sequence Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 29/34] media: iris: implement power management Dikshita Agarwal
2023-12-19 12:24 ` Konrad Dybcio
2023-12-20 8:23 ` Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 30/34] media: iris: register video encoder device to platform driver Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 31/34] media: iris: add platform specific instance capabilities for encoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 32/34] media: iris: implement iris v4l2 ioctl ops supported by encoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 33/34] media: iris: add vb2 streaming and buffer ops for encoder Dikshita Agarwal
2023-12-18 11:32 ` [PATCH v2 34/34] media: iris: add power management " Dikshita Agarwal
2023-12-19 12:26 ` Konrad Dybcio
2023-12-18 12:09 ` [PATCH v2 00/34] Qualcomm video encoder and decoder driver Dikshita Agarwal
2023-12-18 14:36 ` Bryan O'Donoghue
2023-12-18 18:38 ` Dmitry Baryshkov
2023-12-19 12:10 ` Bryan O'Donoghue
2023-12-20 6:32 ` Vikash Garodia
2023-12-20 7:37 ` Dmitry Baryshkov
2023-12-20 8:14 ` Vikash Garodia
2023-12-20 8:39 ` Dmitry Baryshkov
2023-12-20 8:53 ` Vikash Garodia
2023-12-20 9:52 ` Dmitry Baryshkov
2023-12-20 18:55 ` Abhinav Kumar
2023-12-20 21:24 ` Dmitry Baryshkov
2023-12-20 8:15 ` Krzysztof Kozlowski
2023-12-20 8:32 ` Vikash Garodia
2023-12-20 20:51 ` Nicolas Dufresne
2024-02-29 15:09 ` Vikash Garodia
2024-03-12 10:37 ` Hans Verkuil
2024-03-15 13:51 ` Vikash Garodia
2024-04-12 7:13 ` Hyunjun Ko
2024-04-12 13:52 ` Bryan O'Donoghue
2024-05-16 7:57 ` Hyunjun Ko
2024-05-16 8:06 ` Vikash Garodia
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=6b2ce264-3cc6-4c00-85c8-c885b2707787@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_dikshita@quicinc.com \
--cc=quic_vgarodia@quicinc.com \
--cc=stanimir.k.varbanov@gmail.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).