WIP FPC-III support
[linux/fpc-iii.git] / drivers / media / platform / qcom / venus / hfi_parser.h
blob264e6dd2415fe408ad543d55a952a61012153359
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__
6 #include "core.h"
8 u32 hfi_parser(struct venus_core *core, struct venus_inst *inst,
9 void *buf, u32 size);
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;
20 unsigned int i;
22 caps = venus_caps_by_codec(core, inst->hfi_codec, inst->session_type);
23 if (!caps)
24 return 0;
26 for (i = 0; i < caps->num_caps; i++) {
27 if (caps->caps[i].capability_type == type) {
28 cap = &caps->caps[i];
29 break;
33 if (!cap)
34 return 0;
36 switch (which) {
37 case WHICH_CAP_MIN:
38 return cap->min;
39 case WHICH_CAP_MAX:
40 return cap->max;
41 case WHICH_CAP_STEP:
42 return cap->step_size;
43 default:
44 break;
47 return 0;
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);
115 #endif