From: Dikshita Agarwal <quic_dikshita@quicinc.com>
To: Konrad Dybcio <konrad.dybcio@linaro.org>,
Vikash Garodia <quic_vgarodia@quicinc.com>,
<stanimir.k.varbanov@gmail.com>, <agross@kernel.org>,
<andersson@kernel.org>, <mchehab@kernel.org>,
<hans.verkuil@cisco.com>, <linux-kernel@vger.kernel.org>,
<linux-media@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH 14/33] iris: vidc: add helpers for state management
Date: Tue, 15 Aug 2023 00:47:38 +0530 [thread overview]
Message-ID: <0d77682a-74ff-cdf6-bd96-dbe10f2b5e71@quicinc.com> (raw)
In-Reply-To: <60271d41-7807-0808-34d0-684ab9e81a90@linaro.org>
On 7/28/2023 11:22 PM, Konrad Dybcio wrote:
> On 28.07.2023 15:23, Vikash Garodia wrote:
>> This implements the functions to handle different core
>> and instance state transitions.
>>
>> Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
>> Signed-off-by: Vikash Garodia <quic_vgarodia@quicinc.com>
>> ---
> [...]
>
>> +enum msm_vidc_core_sub_state {
>> + CORE_SUBSTATE_NONE = 0x0,
>> + CORE_SUBSTATE_POWER_ENABLE = BIT(0),
>> + CORE_SUBSTATE_GDSC_HANDOFF = BIT(1),
>> + CORE_SUBSTATE_PM_SUSPEND = BIT(2),
>> + CORE_SUBSTATE_FW_PWR_CTRL = BIT(3),
>> + CORE_SUBSTATE_PAGE_FAULT = BIT(4),
>> + CORE_SUBSTATE_CPU_WATCHDOG = BIT(5),
>> + CORE_SUBSTATE_VIDEO_UNRESPONSIVE = BIT(6),
>> + CORE_SUBSTATE_MAX = BIT(7),
> Why store it in an enum if they're not consecutive? You can make them
> preprocessor #defines.
>
I understand that these are not consecutive but a enum for these makes them
under one roof which is easy to read and maintain, we will loose this if
replaced with macro.
>> +};
>> +
>> +enum msm_vidc_core_event_type {
>> + CORE_EVENT_NONE = BIT(0),
>> + CORE_EVENT_UPDATE_SUB_STATE = BIT(1),
>> +};
> Ditto (even though techinically they're consecutive)
>
>> +
>> +enum msm_vidc_state {
>> + MSM_VIDC_OPEN,
>> + MSM_VIDC_INPUT_STREAMING,
>> + MSM_VIDC_OUTPUT_STREAMING,
>> + MSM_VIDC_STREAMING,
>> + MSM_VIDC_CLOSE,
>> + MSM_VIDC_ERROR,
>> +};
>> +
>> +#define MSM_VIDC_SUB_STATE_NONE 0
>> +#define MSM_VIDC_MAX_SUB_STATES 6
>> +/*
>> + * max value of inst->sub_state if all
>> + * the 6 valid bits are set i.e 111111==>63
>> + */
>> +#define MSM_VIDC_MAX_SUB_STATE_VALUE ((1 << MSM_VIDC_MAX_SUB_STATES) - 1)
>> +
>> +enum msm_vidc_sub_state {
>> + MSM_VIDC_DRAIN = BIT(0),
>> + MSM_VIDC_DRC = BIT(1),
>> + MSM_VIDC_DRAIN_LAST_BUFFER = BIT(2),
>> + MSM_VIDC_DRC_LAST_BUFFER = BIT(3),
>> + MSM_VIDC_INPUT_PAUSE = BIT(4),
>> + MSM_VIDC_OUTPUT_PAUSE = BIT(5),
> Ditto
>
these are bit wise and are being used in state machine. At a time, two or
more bits can be set to define the state of and instance, hence needed.
> [...]
>
>> +static int msm_vidc_core_init_wait_state(struct msm_vidc_core *core,
>> + enum msm_vidc_core_event_type type,
>> + struct msm_vidc_event_data *data)
>> +{
>> + int rc = 0;
> rc seems never assigned again, good to drop
>
> [...]
>
Sure, will remove in next version
>> +
>> +static int msm_vidc_core_init_state(struct msm_vidc_core *core,
>> + enum msm_vidc_core_event_type type,
>> + struct msm_vidc_event_data *data)
>> +{
>> + int rc = 0;
> Ditto
>
> [...]
>
>> +static int msm_vidc_core_error_state(struct msm_vidc_core *core,
>> + enum msm_vidc_core_event_type type,
>> + struct msm_vidc_event_data *data)
>> +{
>> + int rc = 0;
> Ditto
>
> [...]
>
>> +int msm_vidc_update_core_state(struct msm_vidc_core *core,
>> + enum msm_vidc_core_state request_state, const char *func)
>> +{
>> + struct msm_vidc_core_state_handle *state_handle = NULL;
>> + int rc = 0;
> Ditto
>
> [...]
>
>> +int msm_vidc_change_core_state(struct msm_vidc_core *core,
>> + enum msm_vidc_core_state request_state, const char *func)
>> +{
>> + enum msm_vidc_allow allow;
>> + int rc = 0;
> Ditto
>
will remove all such instances of unused rc in next version
> [...]
>
>> +bool is_state(struct msm_vidc_inst *inst, enum msm_vidc_state state)
>> +{
>> + return inst->state == state;
>> +}
>> +
>> +bool is_sub_state(struct msm_vidc_inst *inst, enum msm_vidc_sub_state sub_state)
>> +{
>> + return (inst->sub_state & sub_state);
>> +}
> Why are there 2 separate funcs for core and inst? Don't we have
> a pointer within one to the other?
>
>
core and instance sub states are maintained differently for ex in SSR, we
need to check the core sub state, if we combine instance and core state
checks, we won't know against which sub state we should check.
> [...]
>
>> +
>> +int msm_vidc_update_state(struct msm_vidc_inst *inst,
>> + enum msm_vidc_state request_state, const char *func)
>> +{
>> + struct msm_vidc_state_handle *state_handle = NULL;
>> + int rc = 0;
> rc is unused
>
> [...]
>
>> +static int msm_vidc_set_sub_state(struct msm_vidc_inst *inst,
>> + enum msm_vidc_sub_state sub_state, const char *func)
>> +{
>> + char sub_state_name[MAX_NAME_LENGTH];
>> + int cnt, rc = 0;
> ditto
>
Thanks for pointing these out, will remove all unused rc.
Thanks,
Dikshita
> Konrad
next prev parent reply other threads:[~2023-08-14 19:18 UTC|newest]
Thread overview: 107+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 13:23 [PATCH 00/33] Qualcomm video decoder/encoder driver Vikash Garodia
2023-07-28 13:23 ` [PATCH 01/33] MAINTAINERS: Add Qualcomm Iris video accelerator driver Vikash Garodia
2023-07-28 22:48 ` Randy Dunlap
2023-08-14 18:44 ` Dikshita Agarwal
2023-08-16 12:00 ` Bryan O'Donoghue
2023-08-16 13:14 ` Dmitry Baryshkov
2023-07-28 13:23 ` [PATCH 02/33] iris: vidc: add core functions Vikash Garodia
2023-07-28 13:45 ` Konrad Dybcio
2023-08-14 18:49 ` Dikshita Agarwal
2023-07-28 13:47 ` Konrad Dybcio
2023-07-28 13:49 ` Dmitry Baryshkov
2023-08-14 18:58 ` Dikshita Agarwal
2023-08-14 21:03 ` Dmitry Baryshkov
2023-08-24 15:32 ` Vikash Garodia
2023-07-31 21:16 ` Krzysztof Kozlowski
2023-08-14 18:54 ` Dikshita Agarwal
2023-08-14 20:04 ` Krzysztof Kozlowski
2023-07-31 21:23 ` Krzysztof Kozlowski
2023-08-14 18:51 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 03/33] iris: vidc: add v4l2 wrapper file Vikash Garodia
2023-07-28 13:34 ` Dmitry Baryshkov
2023-08-14 18:59 ` Dikshita Agarwal
2023-08-14 21:19 ` Dmitry Baryshkov
2023-07-28 16:23 ` Bjorn Andersson
2023-07-28 17:50 ` Nicolas Dufresne
2023-08-14 19:14 ` Dikshita Agarwal
2023-07-31 21:23 ` Krzysztof Kozlowski
2023-08-14 19:00 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 04/33] iris: add vidc " Vikash Garodia
2023-07-28 13:23 ` [PATCH 05/33] iris: vidc: add vb2 ops Vikash Garodia
2023-07-28 18:03 ` Nicolas Dufresne
2023-08-14 19:03 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 06/33] iris: vidc: define video core and instance context Vikash Garodia
2023-07-28 15:47 ` Bryan O'Donoghue
2023-08-14 19:04 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 07/33] iris: iris: add video encoder files Vikash Garodia
2023-07-28 13:23 ` [PATCH 08/33] iris: vidc: add video decoder files Vikash Garodia
2023-07-28 17:21 ` Konrad Dybcio
2023-08-14 19:13 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 09/33] iris: vidc: add control files Vikash Garodia
2023-07-28 13:23 ` [PATCH 11/33] iris: vidc: add helpers for memory management Vikash Garodia
2023-07-28 16:28 ` Bjorn Andersson
2023-07-28 17:22 ` Konrad Dybcio
2023-08-14 19:06 ` Dikshita Agarwal
2023-08-25 18:38 ` Konrad Dybcio
2023-08-14 19:05 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 12/33] iris: vidc: add helper functions for resource management Vikash Garodia
2023-07-28 17:30 ` Konrad Dybcio
2023-08-14 19:07 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 13/33] iris: vidc: add helper functions for power management Vikash Garodia
2023-07-28 17:46 ` Konrad Dybcio
2023-08-14 19:10 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 14/33] iris: vidc: add helpers for state management Vikash Garodia
2023-07-28 17:52 ` Konrad Dybcio
2023-08-14 19:17 ` Dikshita Agarwal [this message]
2023-07-28 13:23 ` [PATCH 15/33] iris: add vidc buffer files Vikash Garodia
2023-07-28 13:23 ` [PATCH 16/33] iris: add helpers for media format Vikash Garodia
2023-07-28 17:55 ` Konrad Dybcio
2023-08-14 19:18 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 17/33] iris: vidc: define various structures and enum Vikash Garodia
2023-07-28 13:23 ` [PATCH 18/33] iris: vidc: hfi: add Host Firmware Interface (HFI) Vikash Garodia
2023-07-28 15:58 ` Bryan O'Donoghue
2023-08-14 19:11 ` Dikshita Agarwal
2023-07-31 9:02 ` Bryan O'Donoghue
2023-08-14 19:11 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 19/33] iris: vidc: hfi: add Host Firmware Interface (HFI) response handling Vikash Garodia
2023-07-28 13:23 ` [PATCH 20/33] iris: vidc: hfi: add helpers for handling shared queues Vikash Garodia
2023-07-28 17:58 ` Konrad Dybcio
2023-08-14 19:19 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 21/33] iris: vidc: hfi: Add packetization layer Vikash Garodia
2023-07-28 13:23 ` [PATCH 22/33] iris: vidc: hfi: defines HFI properties and enums Vikash Garodia
2023-07-28 13:23 ` [PATCH 23/33] iris: vidc: add PIL functionality for video firmware Vikash Garodia
2023-07-28 13:23 ` [PATCH 24/33] iris: vidc: add debug files Vikash Garodia
2023-07-31 21:31 ` Krzysztof Kozlowski
2023-08-14 19:12 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 25/33] iris: platform: add platform files Vikash Garodia
2023-07-28 13:23 ` [PATCH 26/33] iris: platform: sm8550: add capability file for sm8550 Vikash Garodia
2023-07-28 14:13 ` Dmitry Baryshkov
2023-08-14 19:35 ` Dikshita Agarwal
2023-08-14 21:17 ` Dmitry Baryshkov
2023-07-28 13:23 ` [PATCH 27/33] iris: variant: add helper functions for register handling Vikash Garodia
2023-07-28 13:23 ` [PATCH 28/33] iris: variant: iris3: add iris3 specific ops Vikash Garodia
2023-07-28 13:23 ` [PATCH 29/33] iris: variant: iris3: add helpers for buffer size calculations Vikash Garodia
2023-07-28 14:19 ` Dmitry Baryshkov
2023-08-14 20:00 ` Dikshita Agarwal
2023-08-14 20:59 ` Dmitry Baryshkov
2023-07-28 13:23 ` [PATCH 30/33] iris: variant: iris3: add helper for bus and clock calculation Vikash Garodia
2023-07-28 13:23 ` [PATCH 31/33] iris: variant: iris: implement the logic to compute bus bandwidth Vikash Garodia
2023-07-28 18:09 ` Konrad Dybcio
2023-08-14 19:21 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 32/33] iris: variant: iris3: implement logic to compute clock frequency Vikash Garodia
2023-07-28 18:13 ` Konrad Dybcio
2023-08-14 19:25 ` Dikshita Agarwal
2023-07-28 13:23 ` [PATCH 33/33] iris: enable building of iris video driver Vikash Garodia
2023-07-28 14:40 ` Dmitry Baryshkov
2023-07-28 15:25 ` Bryan O'Donoghue
2023-07-28 15:51 ` Dmitry Baryshkov
2023-07-28 13:32 ` [PATCH 00/33] Qualcomm video decoder/encoder driver Dmitry Baryshkov
2023-07-28 17:38 ` Nicolas Dufresne
2023-07-28 14:01 ` Dmitry Baryshkov
2023-08-14 12:58 ` Stanimir Varbanov
2023-08-14 15:00 ` Dmitry Baryshkov
2023-08-24 15:23 ` Vikash Garodia
2023-07-28 14:34 ` Bryan O'Donoghue
[not found] ` <1690550624-14642-11-git-send-email-quic_vgarodia@quicinc.com>
2023-07-28 17:41 ` [PATCH 10/33] iris: vidc: add helper functions Konrad Dybcio
2023-08-14 19:15 ` Dikshita Agarwal
2023-08-16 11:46 ` Konrad Dybcio
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=0d77682a-74ff-cdf6-bd96-dbe10f2b5e71@quicinc.com \
--to=quic_dikshita@quicinc.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=hans.verkuil@cisco.com \
--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_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