Skip to content

Commit

Permalink
media: venus: helpers: Add internal buffer list for v6
Browse files Browse the repository at this point in the history
- Internal buffers required by v6 are different than v4,
  add new list of internal buffers for v6.
- Differentiate encoder/decoder buffers for 6xx

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
Dikshita Agarwal authored and Mauro Carvalho Chehab committed Apr 6, 2021
1 parent ec7ad11 commit c934d9d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
13 changes: 12 additions & 1 deletion drivers/media/platform/qcom/venus/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,24 @@ static const unsigned int intbuf_types_4xx[] = {
HFI_BUFFER_INTERNAL_PERSIST_1,
};

static const unsigned int intbuf_types_6xx[] = {
HFI_BUFFER_INTERNAL_SCRATCH(HFI_VERSION_6XX),
HFI_BUFFER_INTERNAL_SCRATCH_1(HFI_VERSION_6XX),
HFI_BUFFER_INTERNAL_SCRATCH_2(HFI_VERSION_6XX),
HFI_BUFFER_INTERNAL_PERSIST,
HFI_BUFFER_INTERNAL_PERSIST_1,
};

int venus_helper_intbufs_alloc(struct venus_inst *inst)
{
const unsigned int *intbuf;
size_t arr_sz, i;
int ret;

if (IS_V4(inst->core)) {
if (IS_V6(inst->core)) {
arr_sz = ARRAY_SIZE(intbuf_types_6xx);
intbuf = intbuf_types_6xx;
} else if (IS_V4(inst->core)) {
arr_sz = ARRAY_SIZE(intbuf_types_4xx);
intbuf = intbuf_types_4xx;
} else {
Expand Down
9 changes: 6 additions & 3 deletions drivers/media/platform/qcom/venus/hfi_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,14 @@
#define HFI_BUFFER_INTERNAL_PERSIST 0x4
#define HFI_BUFFER_INTERNAL_PERSIST_1 0x5
#define HFI_BUFFER_INTERNAL_SCRATCH(ver) \
(((ver) == HFI_VERSION_4XX) ? 0x6 : 0x1000001)
(((ver) == HFI_VERSION_4XX || \
(ver) == HFI_VERSION_6XX) ? 0x6 : 0x1000001)
#define HFI_BUFFER_INTERNAL_SCRATCH_1(ver) \
(((ver) == HFI_VERSION_4XX) ? 0x7 : 0x1000005)
(((ver) == HFI_VERSION_4XX || \
(ver) == HFI_VERSION_6XX) ? 0x7 : 0x1000005)
#define HFI_BUFFER_INTERNAL_SCRATCH_2(ver) \
(((ver) == HFI_VERSION_4XX) ? 0x8 : 0x1000006)
(((ver) == HFI_VERSION_4XX || \
(ver) == HFI_VERSION_6XX) ? 0x8 : 0x1000006)
#define HFI_BUFFER_EXTRADATA_INPUT(ver) \
(((ver) == HFI_VERSION_4XX) ? 0xc : 0x1000002)
#define HFI_BUFFER_EXTRADATA_OUTPUT(ver) \
Expand Down
4 changes: 2 additions & 2 deletions drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ static int bufreq_dec(struct hfi_plat_buffers_params *params, u32 buftype,
} else if (buftype == HFI_BUFFER_INTERNAL_PERSIST_1) {
bufreq->size = dec_ops->persist1();
} else {
return -EINVAL;
bufreq->size = 0;
}

return 0;
Expand Down Expand Up @@ -1301,7 +1301,7 @@ static int bufreq_enc(struct hfi_plat_buffers_params *params, u32 buftype,
} else if (buftype == HFI_BUFFER_INTERNAL_PERSIST) {
bufreq->size = enc_ops->persist();
} else {
return -EINVAL;
bufreq->size = 0;
}

return 0;
Expand Down

0 comments on commit c934d9d

Please sign in to comment.