1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4 */
5
6 #ifndef __IRIS_UTILS_H__
7 #define __IRIS_UTILS_H__
8
9 struct iris_core;
10 #include "iris_buffer.h"
11
12 struct iris_hfi_rect_desc {
13 u32 left;
14 u32 top;
15 u32 width;
16 u32 height;
17 };
18
19 struct iris_hfi_frame_info {
20 u32 picture_type;
21 u32 no_output;
22 u32 data_corrupt;
23 u32 overflow;
24 };
25
26 struct iris_ts_metadata {
27 u64 ts_ns;
28 u64 ts_us;
29 u32 flags;
30 struct v4l2_timecode tc;
31 };
32
33 #define NUM_MBS_PER_FRAME(height, width) \
34 (DIV_ROUND_UP(height, 16) * DIV_ROUND_UP(width, 16))
35
iris_v4l2_type_to_driver(u32 type)36 static inline enum iris_buffer_type iris_v4l2_type_to_driver(u32 type)
37 {
38 if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
39 return BUF_INPUT;
40 else
41 return BUF_OUTPUT;
42 }
43
44 bool iris_res_is_less_than(u32 width, u32 height,
45 u32 ref_width, u32 ref_height);
46 int iris_get_mbpf(struct iris_inst *inst);
47 bool iris_split_mode_enabled(struct iris_inst *inst);
48 struct iris_inst *iris_get_instance(struct iris_core *core, u32 session_id);
49 void iris_helper_buffers_done(struct iris_inst *inst, unsigned int type,
50 enum vb2_buffer_state state);
51 int iris_wait_for_session_response(struct iris_inst *inst, bool is_flush);
52
53 #endif
54