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 <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
3a75bf4e79
commit
e29929266b
1 changed files with 38 additions and 0 deletions
|
@ -228,11 +228,49 @@ static void parser_fini(struct venus_inst *inst, u32 codecs, u32 domain)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int hfi_platform_parser(struct venus_core *core, struct venus_inst *inst)
|
||||||
|
{
|
||||||
|
const struct hfi_platform *plat;
|
||||||
|
const struct hfi_plat_caps *caps = NULL;
|
||||||
|
u32 enc_codecs, dec_codecs, count;
|
||||||
|
unsigned int entries;
|
||||||
|
|
||||||
|
if (inst)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
plat = hfi_platform_get(core->res->hfi_version);
|
||||||
|
if (!plat)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (plat->codecs)
|
||||||
|
plat->codecs(&enc_codecs, &dec_codecs, &count);
|
||||||
|
|
||||||
|
if (plat->capabilities)
|
||||||
|
caps = plat->capabilities(&entries);
|
||||||
|
|
||||||
|
if (!caps || !entries || !count)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
core->enc_codecs = enc_codecs;
|
||||||
|
core->dec_codecs = dec_codecs;
|
||||||
|
core->codecs_count = count;
|
||||||
|
core->max_sessions_supported = MAX_SESSIONS;
|
||||||
|
memset(core->caps, 0, sizeof(*caps) * MAX_CODEC_NUM);
|
||||||
|
memcpy(core->caps, caps, sizeof(*caps) * entries);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
u32 hfi_parser(struct venus_core *core, struct venus_inst *inst, void *buf,
|
u32 hfi_parser(struct venus_core *core, struct venus_inst *inst, void *buf,
|
||||||
u32 size)
|
u32 size)
|
||||||
{
|
{
|
||||||
unsigned int words_count = size >> 2;
|
unsigned int words_count = size >> 2;
|
||||||
u32 *word = buf, *data, codecs = 0, domain = 0;
|
u32 *word = buf, *data, codecs = 0, domain = 0;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = hfi_platform_parser(core, inst);
|
||||||
|
if (!ret)
|
||||||
|
return HFI_ERR_NONE;
|
||||||
|
|
||||||
if (size % 4)
|
if (size % 4)
|
||||||
return HFI_ERR_SYS_INSUFFICIENT_RESOURCES;
|
return HFI_ERR_SYS_INSUFFICIENT_RESOURCES;
|
||||||
|
|
Loading…
Add table
Reference in a new issue