Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] media: venus: core: Fix msm8996 frequency table
@ 2019-09-04 10:06 Loic Poulain
  2019-09-11  9:29 ` Stanimir Varbanov
  0 siblings, 1 reply; 3+ messages in thread
From: Loic Poulain @ 2019-09-04 10:06 UTC (permalink / raw)
  To: stanimir.varbanov, agross; +Cc: linux-arm-msm, linux-media, Loic Poulain

In downstream driver, there are two frequency tables defined,
one for the encoder and one for the decoder:

/* Encoders /
<972000 490000000 0x55555555>, / 4k UHD @ 30 /
<489600 320000000 0x55555555>, / 1080p @ 60 /
<244800 150000000 0x55555555>, / 1080p @ 30 /
<108000 75000000 0x55555555>, / 720p @ 30 */

/* Decoders /
<1944000 490000000 0xffffffff>, / 4k UHD @ 60 /
< 972000 320000000 0xffffffff>, / 4k UHD @ 30 /
< 489600 150000000 0xffffffff>, / 1080p @ 60 /
< 244800 75000000 0xffffffff>; / 1080p @ 30 */

It shows that encoder always needs a higher clock than decoder.

In current venus driver, the unified frequency table is aligned
with the downstream decoder table which causes performance issues
in decoding scenarios. Fix that by aligning frequency table on
worst case (encoding).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/media/platform/qcom/venus/core.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 0acc757..1e80689 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -427,10 +427,11 @@ static const struct venus_resources msm8916_res = {
 };
 
 static const struct freq_tbl msm8996_freq_table[] = {
-	{ 1944000, 490000000 },	/* 4k UHD @ 60 */
-	{  972000, 320000000 },	/* 4k UHD @ 30 */
-	{  489600, 150000000 },	/* 1080p @ 60 */
-	{  244800,  75000000 },	/* 1080p @ 30 */
+	{ 1944000, 490000000 },	/* 4k UHD @ 60 (decode only) */
+	{  972000, 490000000 },	/* 4k UHD @ 30 */
+	{  489600, 320000000 },	/* 1080p @ 60 */
+	{  244800, 150000000 },	/* 1080p @ 30 */
+	{  108000,  75000000 },	/* 720p @ 30 */
 };
 
 static const struct reg_val msm8996_reg_preset[] = {
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: venus: core: Fix msm8996 frequency table
  2019-09-04 10:06 [PATCH] media: venus: core: Fix msm8996 frequency table Loic Poulain
@ 2019-09-11  9:29 ` Stanimir Varbanov
       [not found]   ` <CAMZdPi82ZCJK1QOXHo7hq9iCOq5vzuJF1shq=4ut+zRJ5FfmMw@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Stanimir Varbanov @ 2019-09-11  9:29 UTC (permalink / raw)
  To: Loic Poulain, agross; +Cc: linux-arm-msm, linux-media

Hi Loic,

Thanks for the patch!

On 9/4/19 1:06 PM, Loic Poulain wrote:
> In downstream driver, there are two frequency tables defined,
> one for the encoder and one for the decoder:
> 
> /* Encoders /
> <972000 490000000 0x55555555>, / 4k UHD @ 30 /
> <489600 320000000 0x55555555>, / 1080p @ 60 /
> <244800 150000000 0x55555555>, / 1080p @ 30 /
> <108000 75000000 0x55555555>, / 720p @ 30 */
> 
> /* Decoders /
> <1944000 490000000 0xffffffff>, / 4k UHD @ 60 /
> < 972000 320000000 0xffffffff>, / 4k UHD @ 30 /
> < 489600 150000000 0xffffffff>, / 1080p @ 60 /
> < 244800 75000000 0xffffffff>; / 1080p @ 30 */
> 
> It shows that encoder always needs a higher clock than decoder.
> 
> In current venus driver, the unified frequency table is aligned
> with the downstream decoder table which causes performance issues
> in decoding scenarios. Fix that by aligning frequency table on

s/decoding scenarios/encoding scenarios

> worst case (encoding).

Did you checked the exact rate from clk_summary? Checking the frequency
table for subcore0|1 from mmcc-msm8996.c clock driver shows that the
tables are slightly different for higher rates.

Otherwise, I'd take the patch but it would be better to align the
frequency tables to avoid confusions.

On the other side we can split freq table to encode and decode tables,
but I'm still not sure is it possible to have:
subcore0_freq != subcore1_freq.

> 
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>  drivers/media/platform/qcom/venus/core.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 0acc757..1e80689 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -427,10 +427,11 @@ static const struct venus_resources msm8916_res = {
>  };
>  
>  static const struct freq_tbl msm8996_freq_table[] = {
> -	{ 1944000, 490000000 },	/* 4k UHD @ 60 */
> -	{  972000, 320000000 },	/* 4k UHD @ 30 */
> -	{  489600, 150000000 },	/* 1080p @ 60 */
> -	{  244800,  75000000 },	/* 1080p @ 30 */
> +	{ 1944000, 490000000 },	/* 4k UHD @ 60 (decode only) */
> +	{  972000, 490000000 },	/* 4k UHD @ 30 */
> +	{  489600, 320000000 },	/* 1080p @ 60 */
> +	{  244800, 150000000 },	/* 1080p @ 30 */
> +	{  108000,  75000000 },	/* 720p @ 30 */
>  };
>  
>  static const struct reg_val msm8996_reg_preset[] = {
> 

-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: venus: core: Fix msm8996 frequency table
       [not found]   ` <CAMZdPi82ZCJK1QOXHo7hq9iCOq5vzuJF1shq=4ut+zRJ5FfmMw@mail.gmail.com>
@ 2019-09-11 15:03     ` Stanimir Varbanov
  0 siblings, 0 replies; 3+ messages in thread
From: Stanimir Varbanov @ 2019-09-11 15:03 UTC (permalink / raw)
  To: Loic Poulain; +Cc: agross, linux-arm-msm, linux-media


On 9/11/19 5:40 PM, Loic Poulain wrote:
> On Wed, 11 Sep 2019 at 11:29, Stanimir Varbanov <
> stanimir.varbanov@linaro.org> wrote:
> 
>> Hi Loic,
>>
>> Thanks for the patch!
>>
>> On 9/4/19 1:06 PM, Loic Poulain wrote:
>>> In downstream driver, there are two frequency tables defined,
>>> one for the encoder and one for the decoder:
>>>
>>> /* Encoders /
>>> <972000 490000000 0x55555555>, / 4k UHD @ 30 /
>>> <489600 320000000 0x55555555>, / 1080p @ 60 /
>>> <244800 150000000 0x55555555>, / 1080p @ 30 /
>>> <108000 75000000 0x55555555>, / 720p @ 30 */
>>>
>>> /* Decoders /
>>> <1944000 490000000 0xffffffff>, / 4k UHD @ 60 /
>>> < 972000 320000000 0xffffffff>, / 4k UHD @ 30 /
>>> < 489600 150000000 0xffffffff>, / 1080p @ 60 /
>>> < 244800 75000000 0xffffffff>; / 1080p @ 30 */
>>>
>>> It shows that encoder always needs a higher clock than decoder.
>>>
>>> In current venus driver, the unified frequency table is aligned
>>> with the downstream decoder table which causes performance issues
>>> in decoding scenarios. Fix that by aligning frequency table on
>>
>> s/decoding scenarios/encoding scenarios
>>
>>> worst case (encoding).
>>
>> Did you checked the exact rate from clk_summary? Checking the frequency
>> table for subcore0|1 from mmcc-msm8996.c clock driver shows that the
>> tables are slightly different for higher rates.
>>
>> Otherwise, I'd take the patch but it would be better to align the
>> frequency tables to avoid confusions.
>>
> 
> Thanks, yes I'm going to send a V2 with aligned freqs, note however that
> with my setup (DB820C), debugfs reported clk rates seem to be a bit
> misaligned.
> I get either 75000000, 150000000, 326666666 or 490000000... regardless
> frequency table.

What kernel version is that?

-- 
regards,
Stan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04 10:06 [PATCH] media: venus: core: Fix msm8996 frequency table Loic Poulain
2019-09-11  9:29 ` Stanimir Varbanov
     [not found]   ` <CAMZdPi82ZCJK1QOXHo7hq9iCOq5vzuJF1shq=4ut+zRJ5FfmMw@mail.gmail.com>
2019-09-11 15:03     ` Stanimir Varbanov

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org linux-arm-msm@archiver.kernel.org
	public-inbox-index linux-arm-msm


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/ public-inbox