Skip to content

Commit e299292

Browse files
Stanimir Varbanovmchehab
authored andcommitted
media: venus: Get codecs and capabilities from hfi platform
Wire up hfi platform codec and capabilities instead of getting them from firmware. Signed-off-by: Stanimir Varbanov <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 3a75bf4 commit e299292

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

drivers/media/platform/qcom/venus/hfi_parser.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,49 @@ static void parser_fini(struct venus_inst *inst, u32 codecs, u32 domain)
228228
}
229229
}
230230

231+
static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst)
232+
{
233+
const struct hfi_platform *plat;
234+
const struct hfi_plat_caps *caps = NULL;
235+
u32 enc_codecs, dec_codecs, count;
236+
unsigned int entries;
237+
238+
if (inst)
239+
return 0;
240+
241+
plat = hfi_platform_get(core->res->hfi_version);
242+
if (!plat)
243+
return -EINVAL;
244+
245+
if (plat->codecs)
246+
plat->codecs(&enc_codecs, &dec_codecs, &count);
247+
248+
if (plat->capabilities)
249+
caps = plat->capabilities(&entries);
250+
251+
if (!caps || !entries || !count)
252+
return -EINVAL;
253+
254+
core->enc_codecs = enc_codecs;
255+
core->dec_codecs = dec_codecs;
256+
core->codecs_count = count;
257+
core->max_sessions_supported = MAX_SESSIONS;
258+
memset(core->caps, 0, sizeof(*caps) * MAX_CODEC_NUM);
259+
memcpy(core->caps, caps, sizeof(*caps) * entries);
260+
261+
return 0;
262+
}
263+
231264
u32 hfi_parser(struct venus_core *core, struct venus_inst *inst, void *buf,
232265
u32 size)
233266
{
234267
unsigned int words_count = size >> 2;
235268
u32 *word = buf, *data, codecs = 0, domain = 0;
269+
int ret;
270+
271+
ret = hfi_platform_parser(core, inst);
272+
if (!ret)
273+
return HFI_ERR_NONE;
236274

237275
if (size % 4)
238276
return HFI_ERR_SYS_INSUFFICIENT_RESOURCES;

0 commit comments

Comments
 (0)