diff mbox series

[v2,21/25] media: venus: helpers: Add internal buffer list for v6

Message ID 20210312173039.1387617-22-bryan.odonoghue@linaro.org (mailing list archive)
State Superseded
Headers show
Series media: venus: Enable 6xx support | expand

Commit Message

Bryan O'Donoghue March 12, 2021, 5:30 p.m. UTC
From: Dikshita Agarwal <dikshita@codeaurora.org>

- 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>
---
 drivers/media/platform/qcom/venus/helpers.c    | 13 ++++++++++++-
 drivers/media/platform/qcom/venus/hfi_helper.h |  9 ++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)

Comments

Dikshita Agarwal March 17, 2021, 9:59 a.m. UTC | #1
On 2021-03-12 23:00, Bryan O'Donoghue wrote:
> From: Dikshita Agarwal <dikshita@codeaurora.org>
> 
> - 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>
> ---
>  drivers/media/platform/qcom/venus/helpers.c    | 13 ++++++++++++-
>  drivers/media/platform/qcom/venus/hfi_helper.h |  9 ++++++---
>  2 files changed, 18 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/helpers.c
> b/drivers/media/platform/qcom/venus/helpers.c
> index 2515a2225614..8b08632b0296 100644
> --- a/drivers/media/platform/qcom/venus/helpers.c
> +++ b/drivers/media/platform/qcom/venus/helpers.c
> @@ -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,
> +};
> +

Hi Bryan,

this change will require additional handling in hfi_plat_buf_v6.c to
return buffer_size as 0 for internal buffer type which is not applicable 
for
encoder or decoder, currently we return -EINVAL for the same.

Thanks,
Dikshita

>  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 {
> diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h
> b/drivers/media/platform/qcom/venus/hfi_helper.h
> index 6b524c7cde5f..f367f43c9fb7 100644
> --- a/drivers/media/platform/qcom/venus/hfi_helper.h
> +++ b/drivers/media/platform/qcom/venus/hfi_helper.h
> @@ -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)	\
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 2515a2225614..8b08632b0296 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -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 {
diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h
index 6b524c7cde5f..f367f43c9fb7 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -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)	\