diff mbox series

[v2,4/8] venus: helpers: Calculate properly compressed buffer size

Message ID 20201111143755.24541-5-stanimir.varbanov@linaro.org
State Accepted
Commit ddd1fc49b60822b29d476564a4b8509565cc51ab
Headers show
Series [v2,1/8] venus: hfi: Use correct state in unload resources | expand

Commit Message

Stanimir Varbanov Nov. 11, 2020, 2:37 p.m. UTC
For resolutions below 720p the size of the compressed buffer must
be bigger. Correct this by checking the resolution when calculating
buffer size and multiply by four.

Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
---
 drivers/media/platform/qcom/venus/helpers.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Fritz Koenig Nov. 29, 2020, 6:07 a.m. UTC | #1
On Wed, Nov 11, 2020 at 6:38 AM Stanimir Varbanov
<stanimir.varbanov@linaro.org> wrote:
>

> For resolutions below 720p the size of the compressed buffer must

> be bigger. Correct this by checking the resolution when calculating

> buffer size and multiply by four.


I'm confused because the commit message doesn't appear to line up with
the code.  It says multiply by four here, but the code has by eight.

>

> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

> ---

>  drivers/media/platform/qcom/venus/helpers.c | 2 ++

>  1 file changed, 2 insertions(+)

>

> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c

> index 688e3e3e8362..490c026b58a3 100644

> --- a/drivers/media/platform/qcom/venus/helpers.c

> +++ b/drivers/media/platform/qcom/venus/helpers.c

> @@ -986,6 +986,8 @@ u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height)

>

>         if (compressed) {

>                 sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2 / 2;

> +               if (width < 1280 || height < 720)

> +                       sz *= 8;

>                 return ALIGN(sz, SZ_4K);

>         }

>

> --

> 2.17.1

>
Stanimir Varbanov Nov. 30, 2020, 7:52 a.m. UTC | #2
On 11/29/20 8:07 AM, Fritz Koenig wrote:
> On Wed, Nov 11, 2020 at 6:38 AM Stanimir Varbanov

> <stanimir.varbanov@linaro.org> wrote:

>>

>> For resolutions below 720p the size of the compressed buffer must

>> be bigger. Correct this by checking the resolution when calculating

>> buffer size and multiply by four.

> 

> I'm confused because the commit message doesn't appear to line up with

> the code.  It says multiply by four here, but the code has by eight.


Yes, it is confusing. I will correct it in next version.

> 

>>

>> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

>> ---

>>  drivers/media/platform/qcom/venus/helpers.c | 2 ++

>>  1 file changed, 2 insertions(+)

>>

>> diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c

>> index 688e3e3e8362..490c026b58a3 100644

>> --- a/drivers/media/platform/qcom/venus/helpers.c

>> +++ b/drivers/media/platform/qcom/venus/helpers.c

>> @@ -986,6 +986,8 @@ u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height)

>>

>>         if (compressed) {

>>                 sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2 / 2;

>> +               if (width < 1280 || height < 720)

>> +                       sz *= 8;

>>                 return ALIGN(sz, SZ_4K);

>>         }

>>

>> --

>> 2.17.1

>>


-- 
regards,
Stan
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c
index 688e3e3e8362..490c026b58a3 100644
--- a/drivers/media/platform/qcom/venus/helpers.c
+++ b/drivers/media/platform/qcom/venus/helpers.c
@@ -986,6 +986,8 @@  u32 venus_helper_get_framesz(u32 v4l2_fmt, u32 width, u32 height)
 
 	if (compressed) {
 		sz = ALIGN(height, 32) * ALIGN(width, 32) * 3 / 2 / 2;
+		if (width < 1280 || height < 720)
+			sz *= 8;
 		return ALIGN(sz, SZ_4K);
 	}