1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2018 Linaro Ltd. */
3 #ifndef __VENUS_HFI_PARSER_H__
4 #define __VENUS_HFI_PARSER_H__
8 u32
hfi_parser(struct venus_core
*core
, struct venus_inst
*inst
,
11 #define WHICH_CAP_MIN 0
12 #define WHICH_CAP_MAX 1
13 #define WHICH_CAP_STEP 2
15 static inline u32
get_cap(struct venus_inst
*inst
, u32 type
, u32 which
)
17 struct venus_core
*core
= inst
->core
;
18 struct hfi_capability
*cap
= NULL
;
19 struct venus_caps
*caps
;
22 caps
= venus_caps_by_codec(core
, inst
->hfi_codec
, inst
->session_type
);
26 for (i
= 0; i
< caps
->num_caps
; i
++) {
27 if (caps
->caps
[i
].capability_type
== type
) {
42 return cap
->step_size
;
50 static inline u32
cap_min(struct venus_inst
*inst
, u32 type
)
52 return get_cap(inst
, type
, WHICH_CAP_MIN
);
55 static inline u32
cap_max(struct venus_inst
*inst
, u32 type
)
57 return get_cap(inst
, type
, WHICH_CAP_MAX
);
60 static inline u32
cap_step(struct venus_inst
*inst
, u32 type
)
62 return get_cap(inst
, type
, WHICH_CAP_STEP
);
65 static inline u32
frame_width_min(struct venus_inst
*inst
)
67 return cap_min(inst
, HFI_CAPABILITY_FRAME_WIDTH
);
70 static inline u32
frame_width_max(struct venus_inst
*inst
)
72 return cap_max(inst
, HFI_CAPABILITY_FRAME_WIDTH
);
75 static inline u32
frame_width_step(struct venus_inst
*inst
)
77 return cap_step(inst
, HFI_CAPABILITY_FRAME_WIDTH
);
80 static inline u32
frame_height_min(struct venus_inst
*inst
)
82 return cap_min(inst
, HFI_CAPABILITY_FRAME_HEIGHT
);
85 static inline u32
frame_height_max(struct venus_inst
*inst
)
87 return cap_max(inst
, HFI_CAPABILITY_FRAME_HEIGHT
);
90 static inline u32
frame_height_step(struct venus_inst
*inst
)
92 return cap_step(inst
, HFI_CAPABILITY_FRAME_HEIGHT
);
95 static inline u32
frate_min(struct venus_inst
*inst
)
97 return cap_min(inst
, HFI_CAPABILITY_FRAMERATE
);
100 static inline u32
frate_max(struct venus_inst
*inst
)
102 return cap_max(inst
, HFI_CAPABILITY_FRAMERATE
);
105 static inline u32
frate_step(struct venus_inst
*inst
)
107 return cap_step(inst
, HFI_CAPABILITY_FRAMERATE
);
110 static inline u32
core_num_max(struct venus_inst
*inst
)
112 return cap_max(inst
, HFI_CAPABILITY_MAX_VIDEOCORES
);