linux/drivers/media/platform/qcom/iris/iris_state.h

146 lines
5.1 KiB
C
Raw Permalink Normal View History

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __IRIS_STATE_H__
#define __IRIS_STATE_H__
media: iris: implement vb2 streaming ops During the stream on operation, send HFI_CMD_START on the capture and output planes to start processing on the respective planes. During the stream off operation, send HFI_CMD_STOP to the firmware, which is a synchronous command. After the response is received by the firmware, the session is closed on the firmware. Introduce different states for the instance and state transitions. IRIS_INST_INIT - video instance is opened. IRIS_INST_INPUT_STREAMING - stream on is completed on output plane. IRIS_INST_OUTPUT_STREAMING - stream on is completed on capture plane. IRIS_INST_STREAMING - stream on is completed on both output and capture planes. IRIS_INST_DEINIT - video instance is closed. IRIS_INST_ERROR - error state. | v ------------- +---------| INIT |--------- + | ------------- | | ^ ^ | | / \ | | / \ | | v v | | ----------- ----------- | | | INPUT OUTPUT | | |---| STREAMING STREAMING |---| | ----------- ----------- | | ^ ^ | | \ / | | \ / | | v v | | ------------- | |--------| STREAMING |-----------| | ------------- | | | | | | | | v | | ----------- | +-------->| DEINIT |<----------+ | ----------- | | | | | | | | v | | ---------- | +-------->| ERROR |<-----------+ ----------. Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345) Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-07 13:24:56 +05:30
struct iris_inst;
/**
* enum iris_core_state
*
* @IRIS_CORE_DEINIT: default state.
* @IRIS_CORE_INIT: core state with core initialized. FW loaded and
* HW brought out of reset, shared queues established
* between host driver and firmware.
* @IRIS_CORE_ERROR: error state.
*
* -----------
* |
* V
* -----------
* +--->| DEINIT |<---+
* | ----------- |
* | | |
* | v |
* | ----------- |
* | / \ |
* | / \ |
* | / \ |
* | v v v
* ----------- -----------
* | INIT |--->| ERROR |
* ----------- -----------
*/
enum iris_core_state {
IRIS_CORE_DEINIT,
IRIS_CORE_INIT,
IRIS_CORE_ERROR,
};
media: iris: implement vb2 streaming ops During the stream on operation, send HFI_CMD_START on the capture and output planes to start processing on the respective planes. During the stream off operation, send HFI_CMD_STOP to the firmware, which is a synchronous command. After the response is received by the firmware, the session is closed on the firmware. Introduce different states for the instance and state transitions. IRIS_INST_INIT - video instance is opened. IRIS_INST_INPUT_STREAMING - stream on is completed on output plane. IRIS_INST_OUTPUT_STREAMING - stream on is completed on capture plane. IRIS_INST_STREAMING - stream on is completed on both output and capture planes. IRIS_INST_DEINIT - video instance is closed. IRIS_INST_ERROR - error state. | v ------------- +---------| INIT |--------- + | ------------- | | ^ ^ | | / \ | | / \ | | v v | | ----------- ----------- | | | INPUT OUTPUT | | |---| STREAMING STREAMING |---| | ----------- ----------- | | ^ ^ | | \ / | | \ / | | v v | | ------------- | |--------| STREAMING |-----------| | ------------- | | | | | | | | v | | ----------- | +-------->| DEINIT |<----------+ | ----------- | | | | | | | | v | | ---------- | +-------->| ERROR |<-----------+ ----------. Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345) Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-07 13:24:56 +05:30
/**
* enum iris_inst_state
*
* @IRIS_INST_INIT: video instance is opened.
* @IRIS_INST_INPUT_STREAMING: stream on is completed on output plane.
* @IRIS_INST_OUTPUT_STREAMING: stream on is completed on capture plane.
* @IRIS_INST_STREAMING: stream on is completed on both output and capture planes.
* @IRIS_INST_DEINIT: video instance is closed.
* @IRIS_INST_ERROR: error state.
* |
* V
* -------------
* +--------| INIT |----------+
* | ------------- |
* | ^ ^ |
* | / \ |
* | / \ |
* | v v |
* | ----------- ----------- |
* | | INPUT OUTPUT | |
* |---| STREAMING STREAMING |---|
* | ----------- ----------- |
* | ^ ^ |
* | \ / |
* | \ / |
* | v v |
* | ------------- |
* |--------| STREAMING |-----------|
* | ------------- |
* | | |
* | | |
* | v |
* | ----------- |
* +-------->| DEINIT |<----------+
* | ----------- |
* | | |
* | | |
* | v |
* | ---------- |
* +-------->| ERROR |<------------+
* ----------
*/
enum iris_inst_state {
IRIS_INST_DEINIT,
IRIS_INST_INIT,
IRIS_INST_INPUT_STREAMING,
IRIS_INST_OUTPUT_STREAMING,
IRIS_INST_STREAMING,
IRIS_INST_ERROR,
};
#define IRIS_INST_SUB_STATES 8
#define IRIS_INST_MAX_SUB_STATE_VALUE ((1 << IRIS_INST_SUB_STATES) - 1)
/**
* enum iris_inst_sub_state
*
* @IRIS_INST_SUB_FIRST_IPSC: indicates source change is received from firmware
* when output port is not yet streaming.
* @IRIS_INST_SUB_DRC: indicates source change is received from firmware
* when output port is streaming and source change event is
* sent to client.
* @IRIS_INST_SUB_DRC_LAST: indicates last buffer is received from firmware
* as part of source change.
* @IRIS_INST_SUB_DRAIN: indicates drain is in progress.
* @IRIS_INST_SUB_DRAIN_LAST: indicates last buffer is received from firmware
* as part of drain sequence.
* @IRIS_INST_SUB_INPUT_PAUSE: source change is received form firmware. This
* indicates that firmware is paused to process
* any further input frames.
* @IRIS_INST_SUB_OUTPUT_PAUSE: last buffer is received form firmware as part
* of drc sequence. This indicates that
* firmware is paused to process any further output frames.
* @IRIS_INST_SUB_LOAD_RESOURCES: indicates all the resources have been loaded by the
* firmware and it is ready for processing.
*/
enum iris_inst_sub_state {
IRIS_INST_SUB_FIRST_IPSC = BIT(0),
IRIS_INST_SUB_DRC = BIT(1),
IRIS_INST_SUB_DRC_LAST = BIT(2),
IRIS_INST_SUB_DRAIN = BIT(3),
IRIS_INST_SUB_DRAIN_LAST = BIT(4),
IRIS_INST_SUB_INPUT_PAUSE = BIT(5),
IRIS_INST_SUB_OUTPUT_PAUSE = BIT(6),
IRIS_INST_SUB_LOAD_RESOURCES = BIT(7),
};
media: iris: implement vb2 streaming ops During the stream on operation, send HFI_CMD_START on the capture and output planes to start processing on the respective planes. During the stream off operation, send HFI_CMD_STOP to the firmware, which is a synchronous command. After the response is received by the firmware, the session is closed on the firmware. Introduce different states for the instance and state transitions. IRIS_INST_INIT - video instance is opened. IRIS_INST_INPUT_STREAMING - stream on is completed on output plane. IRIS_INST_OUTPUT_STREAMING - stream on is completed on capture plane. IRIS_INST_STREAMING - stream on is completed on both output and capture planes. IRIS_INST_DEINIT - video instance is closed. IRIS_INST_ERROR - error state. | v ------------- +---------| INIT |--------- + | ------------- | | ^ ^ | | / \ | | / \ | | v v | | ----------- ----------- | | | INPUT OUTPUT | | |---| STREAMING STREAMING |---| | ----------- ----------- | | ^ ^ | | \ / | | \ / | | v v | | ------------- | |--------| STREAMING |-----------| | ------------- | | | | | | | | v | | ----------- | +-------->| DEINIT |<----------+ | ----------- | | | | | | | | v | | ---------- | +-------->| ERROR |<-----------+ ----------. Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345) Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-07 13:24:56 +05:30
int iris_inst_change_state(struct iris_inst *inst,
enum iris_inst_state request_state);
int iris_inst_change_sub_state(struct iris_inst *inst,
enum iris_inst_sub_state clear_sub_state,
enum iris_inst_sub_state set_sub_state);
media: iris: implement vb2 streaming ops During the stream on operation, send HFI_CMD_START on the capture and output planes to start processing on the respective planes. During the stream off operation, send HFI_CMD_STOP to the firmware, which is a synchronous command. After the response is received by the firmware, the session is closed on the firmware. Introduce different states for the instance and state transitions. IRIS_INST_INIT - video instance is opened. IRIS_INST_INPUT_STREAMING - stream on is completed on output plane. IRIS_INST_OUTPUT_STREAMING - stream on is completed on capture plane. IRIS_INST_STREAMING - stream on is completed on both output and capture planes. IRIS_INST_DEINIT - video instance is closed. IRIS_INST_ERROR - error state. | v ------------- +---------| INIT |--------- + | ------------- | | ^ ^ | | / \ | | / \ | | v v | | ----------- ----------- | | | INPUT OUTPUT | | |---| STREAMING STREAMING |---| | ----------- ----------- | | ^ ^ | | \ / | | \ / | | v v | | ------------- | |--------| STREAMING |-----------| | ------------- | | | | | | | | v | | ----------- | +-------->| DEINIT |<----------+ | ----------- | | | | | | | | v | | ---------- | +-------->| ERROR |<-----------+ ----------. Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345) Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-07 13:24:56 +05:30
int iris_inst_state_change_streamon(struct iris_inst *inst, u32 plane);
int iris_inst_state_change_streamoff(struct iris_inst *inst, u32 plane);
int iris_inst_sub_state_change_drc(struct iris_inst *inst);
int iris_inst_sub_state_change_drain_last(struct iris_inst *inst);
int iris_inst_sub_state_change_drc_last(struct iris_inst *inst);
int iris_inst_sub_state_change_pause(struct iris_inst *inst, u32 plane);
bool iris_allow_cmd(struct iris_inst *inst, u32 cmd);
bool iris_drc_pending(struct iris_inst *inst);
media: iris: implement vb2 streaming ops During the stream on operation, send HFI_CMD_START on the capture and output planes to start processing on the respective planes. During the stream off operation, send HFI_CMD_STOP to the firmware, which is a synchronous command. After the response is received by the firmware, the session is closed on the firmware. Introduce different states for the instance and state transitions. IRIS_INST_INIT - video instance is opened. IRIS_INST_INPUT_STREAMING - stream on is completed on output plane. IRIS_INST_OUTPUT_STREAMING - stream on is completed on capture plane. IRIS_INST_STREAMING - stream on is completed on both output and capture planes. IRIS_INST_DEINIT - video instance is closed. IRIS_INST_ERROR - error state. | v ------------- +---------| INIT |--------- + | ------------- | | ^ ^ | | / \ | | / \ | | v v | | ----------- ----------- | | | INPUT OUTPUT | | |---| STREAMING STREAMING |---| | ----------- ----------- | | ^ ^ | | \ / | | \ / | | v v | | ------------- | |--------| STREAMING |-----------| | ------------- | | | | | | | | v | | ----------- | +-------->| DEINIT |<----------+ | ----------- | | | | | | | | v | | ---------- | +-------->| ERROR |<-----------+ ----------. Reviewed-by: Hans Verkuil <hverkuil@xs4all.nl> Tested-by: Stefan Schmidt <stefan.schmidt@linaro.org> # x1e80100 (Dell XPS 13 9345) Reviewed-by: Stefan Schmidt <stefan.schmidt@linaro.org> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-QRD Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8550-HDK Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
2025-02-07 13:24:56 +05:30
#endif