diff mbox series

[3/3] venus: core: add sc7180 DT compatible and resource struct

Message ID 1576828760-13176-4-git-send-email-dikshita@codeaurora.org (mailing list archive)
State Superseded
Headers show
Series Enable video on sc7180 | expand

Commit Message

Dikshita Agarwal Dec. 20, 2019, 7:59 a.m. UTC
This add DT compatible string and resource structure for sc7180.

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
---
 drivers/media/platform/qcom/venus/core.c | 58 +++++++++++++++++++++++++++++++-
 1 file changed, 57 insertions(+), 1 deletion(-)

Comments

Stanimir Varbanov Dec. 20, 2019, 9:33 a.m. UTC | #1
Hi Dikshita,

Thanks for the patch!

On 12/20/19 9:59 AM, Dikshita Agarwal wrote:
> This add DT compatible string and resource structure for sc7180.
> 
> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
> ---
>  drivers/media/platform/qcom/venus/core.c | 58 +++++++++++++++++++++++++++++++-
>  1 file changed, 57 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index c7525d9..e8c8b28 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -469,7 +469,7 @@ static __maybe_unused int venus_runtime_resume(struct device *dev)
>  	{ 2073600, 3929000, 0, 5551000, 0 },	/* 4096x2160@60 */
>  	{ 1036800, 1987000, 0, 2797000, 0 },	/* 4096x2160@30 */
>  	{  489600, 1040000, 0, 1298000, 0 },	/* 1920x1080@60 */
> -	{  244800,  530000, 0,  659000, 0 },	/* 1920x1080@30 */
> +	{  244800,  442000, 0,  659000, 0 },	/* 1920x1080@30 */

unrelated change, please drop it

>  };
>  
>  static const struct venus_resources sdm845_res = {
> @@ -521,11 +521,67 @@ static __maybe_unused int venus_runtime_resume(struct device *dev)
>  	.fwname = "qcom/venus-5.2/venus.mdt",
>  };
>  
> +static const struct freq_tbl sc7180_freq_table[] = {
> +	{  0, 380000000 },
> +	{  0, 340000000 },
> +	{  0, 270000000 },
> +	{  0, 150000000 },

why .load is zero?

> +};
> +
> +static struct codec_freq_data sc7180_codec_freq_data[] =  {
> +	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_ENC, 675, 10 },
> +	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_ENC, 675, 10 },
> +	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_ENC, 675, 10 },
> +	{ V4L2_PIX_FMT_MPEG2, VIDC_SESSION_TYPE_DEC, 200, 10 },
> +	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 200, 10 },
> +	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 200, 10 },
> +	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_DEC, 200, 10 },
> +	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 10 },
> +};

the table is exactly the same as sdm845 one, please reuse it.

> +
> +static const struct bw_tbl sc7180_bw_table_enc[] = {
> +	{  972000,  750000, 0, 0, 0 },	/* 3840x2160@30 */
> +	{  489600,  451000, 0, 0, 0 },	/* 1920x1080@60 */
> +	{  244800,  234000, 0, 0, 0 },	/* 1920x1080@30 */
> +};
> +
> +static const struct bw_tbl sc7180_bw_table_dec[] = {
> +	{ 1036800, 1386000, 0, 1875000, 0 },	/* 4096x2160@30 */
> +	{  489600,  865000, 0, 1146000, 0 },	/* 1920x1080@60 */
> +	{  244800,  530000, 0,  583000, 0 },	/* 1920x1080@30 */
> +};
> +
> +static const struct venus_resources sc7180_res = {
> +	.freq_tbl = sc7180_freq_table,
> +	.freq_tbl_size = ARRAY_SIZE(sc7180_freq_table),
> +	.bw_tbl_enc = sc7180_bw_table_enc,
> +	.bw_tbl_enc_size = ARRAY_SIZE(sc7180_bw_table_enc),
> +	.bw_tbl_dec = sc7180_bw_table_dec,
> +	.bw_tbl_dec_size = ARRAY_SIZE(sc7180_bw_table_dec),
> +	.codec_freq_data = sc7180_codec_freq_data,
> +	.codec_freq_data_size = ARRAY_SIZE(sc7180_codec_freq_data),
> +	.clks = {"core", "iface", "bus" },
> +	.clks_num = 3,
> +	.vcodec0_clks = { "vcodec0_core", "vcodec0_bus" },
> +	.vcodec_clks_num = 2,
> +	.vcodec_pmdomains = { "venus", "vcodec0" },
> +	.vcodec_pmdomains_num = 2,
> +	.vcodec_num = 1,
> +	.max_load = 3110400,	/* 4096x2160@90 */

Looking into above bandwidth tables I can guess that the maximimum load
is reached at 4096x2160@30? If so you have to change it here.

<cut>
Dikshita Agarwal Dec. 23, 2019, 10:04 a.m. UTC | #2
Hi Stan,

Thanks for the review!

On 2019-12-20 15:03, Stanimir Varbanov wrote:
> Hi Dikshita,
> 
> Thanks for the patch!
> 
> On 12/20/19 9:59 AM, Dikshita Agarwal wrote:
>> This add DT compatible string and resource structure for sc7180.
>> 
>> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
>> ---
>>  drivers/media/platform/qcom/venus/core.c | 58 
>> +++++++++++++++++++++++++++++++-
>>  1 file changed, 57 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/media/platform/qcom/venus/core.c 
>> b/drivers/media/platform/qcom/venus/core.c
>> index c7525d9..e8c8b28 100644
>> --- a/drivers/media/platform/qcom/venus/core.c
>> +++ b/drivers/media/platform/qcom/venus/core.c
>> @@ -469,7 +469,7 @@ static __maybe_unused int 
>> venus_runtime_resume(struct device *dev)
>>  	{ 2073600, 3929000, 0, 5551000, 0 },	/* 4096x2160@60 */
>>  	{ 1036800, 1987000, 0, 2797000, 0 },	/* 4096x2160@30 */
>>  	{  489600, 1040000, 0, 1298000, 0 },	/* 1920x1080@60 */
>> -	{  244800,  530000, 0,  659000, 0 },	/* 1920x1080@30 */
>> +	{  244800,  442000, 0,  659000, 0 },	/* 1920x1080@30 */
> 
> unrelated change, please drop it
Sure, I will address this in next version.
> 
>>  };
>> 
>>  static const struct venus_resources sdm845_res = {
>> @@ -521,11 +521,67 @@ static __maybe_unused int 
>> venus_runtime_resume(struct device *dev)
>>  	.fwname = "qcom/venus-5.2/venus.mdt",
>>  };
>> 
>> +static const struct freq_tbl sc7180_freq_table[] = {
>> +	{  0, 380000000 },
>> +	{  0, 340000000 },
>> +	{  0, 270000000 },
>> +	{  0, 150000000 },
> 
> why .load is zero?
.load is not being used any longer to calculate load and is a dummy 
value.
So keeping it 0.

> 
>> +};
>> +
>> +static struct codec_freq_data sc7180_codec_freq_data[] =  {
>> +	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_ENC, 675, 10 },
>> +	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_ENC, 675, 10 },
>> +	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_ENC, 675, 10 },
>> +	{ V4L2_PIX_FMT_MPEG2, VIDC_SESSION_TYPE_DEC, 200, 10 },
>> +	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 200, 10 },
>> +	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 200, 10 },
>> +	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_DEC, 200, 10 },
>> +	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 10 },
>> +};
> 
> the table is exactly the same as sdm845 one, please reuse it.
Sure, I will address this in next version.
> 
>> +
>> +static const struct bw_tbl sc7180_bw_table_enc[] = {
>> +	{  972000,  750000, 0, 0, 0 },	/* 3840x2160@30 */
>> +	{  489600,  451000, 0, 0, 0 },	/* 1920x1080@60 */
>> +	{  244800,  234000, 0, 0, 0 },	/* 1920x1080@30 */
>> +};
>> +
>> +static const struct bw_tbl sc7180_bw_table_dec[] = {
>> +	{ 1036800, 1386000, 0, 1875000, 0 },	/* 4096x2160@30 */
>> +	{  489600,  865000, 0, 1146000, 0 },	/* 1920x1080@60 */
>> +	{  244800,  530000, 0,  583000, 0 },	/* 1920x1080@30 */
>> +};
>> +
>> +static const struct venus_resources sc7180_res = {
>> +	.freq_tbl = sc7180_freq_table,
>> +	.freq_tbl_size = ARRAY_SIZE(sc7180_freq_table),
>> +	.bw_tbl_enc = sc7180_bw_table_enc,
>> +	.bw_tbl_enc_size = ARRAY_SIZE(sc7180_bw_table_enc),
>> +	.bw_tbl_dec = sc7180_bw_table_dec,
>> +	.bw_tbl_dec_size = ARRAY_SIZE(sc7180_bw_table_dec),
>> +	.codec_freq_data = sc7180_codec_freq_data,
>> +	.codec_freq_data_size = ARRAY_SIZE(sc7180_codec_freq_data),
>> +	.clks = {"core", "iface", "bus" },
>> +	.clks_num = 3,
>> +	.vcodec0_clks = { "vcodec0_core", "vcodec0_bus" },
>> +	.vcodec_clks_num = 2,
>> +	.vcodec_pmdomains = { "venus", "vcodec0" },
>> +	.vcodec_pmdomains_num = 2,
>> +	.vcodec_num = 1,
>> +	.max_load = 3110400,	/* 4096x2160@90 */
> 
> Looking into above bandwidth tables I can guess that the maximimum load
> is reached at 4096x2160@30? If so you have to change it here.

After checking further on this I see that max_load can be removed since
it is not being used now to determine if H/W is overloaded or not.
What do you suggest?
> 
> <cut>
Stanimir Varbanov Dec. 23, 2019, 10:43 a.m. UTC | #3
Hi Dikshita,

On 12/23/19 12:04 PM, dikshita@codeaurora.org wrote:
> Hi Stan,
> 
> Thanks for the review!
> 
> On 2019-12-20 15:03, Stanimir Varbanov wrote:
>> Hi Dikshita,
>>
>> Thanks for the patch!
>>
>> On 12/20/19 9:59 AM, Dikshita Agarwal wrote:
>>> This add DT compatible string and resource structure for sc7180.
>>>
>>> Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
>>> ---
>>>  drivers/media/platform/qcom/venus/core.c | 58
>>> +++++++++++++++++++++++++++++++-
>>>  1 file changed, 57 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/core.c
>>> b/drivers/media/platform/qcom/venus/core.c
>>> index c7525d9..e8c8b28 100644
>>> --- a/drivers/media/platform/qcom/venus/core.c
>>> +++ b/drivers/media/platform/qcom/venus/core.c
>>> @@ -469,7 +469,7 @@ static __maybe_unused int
>>> venus_runtime_resume(struct device *dev)
>>>      { 2073600, 3929000, 0, 5551000, 0 },    /* 4096x2160@60 */
>>>      { 1036800, 1987000, 0, 2797000, 0 },    /* 4096x2160@30 */
>>>      {  489600, 1040000, 0, 1298000, 0 },    /* 1920x1080@60 */
>>> -    {  244800,  530000, 0,  659000, 0 },    /* 1920x1080@30 */
>>> +    {  244800,  442000, 0,  659000, 0 },    /* 1920x1080@30 */
>>
>> unrelated change, please drop it
> Sure, I will address this in next version.
>>
>>>  };
>>>
>>>  static const struct venus_resources sdm845_res = {
>>> @@ -521,11 +521,67 @@ static __maybe_unused int
>>> venus_runtime_resume(struct device *dev)
>>>      .fwname = "qcom/venus-5.2/venus.mdt",
>>>  };
>>>
>>> +static const struct freq_tbl sc7180_freq_table[] = {
>>> +    {  0, 380000000 },
>>> +    {  0, 340000000 },
>>> +    {  0, 270000000 },
>>> +    {  0, 150000000 },
>>
>> why .load is zero?
> .load is not being used any longer to calculate load and is a dummy value.
> So keeping it 0.

Hmm, ok I forgot about that fact. I suppose it is fine then.

I found some other issue. Looking into [1], for sc7180 we have two more
clock-controller frequencies, could you add them too in the table. And
last, in the same patch we have 19.2MHz do you think such frequency
makes any sense?

[1] https://lkml.org/lkml/2019/11/15/361
> 
>>
>>> +};
>>> +
>>> +static struct codec_freq_data sc7180_codec_freq_data[] =  {
>>> +    { V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_ENC, 675, 10 },
>>> +    { V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_ENC, 675, 10 },
>>> +    { V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_ENC, 675, 10 },
>>> +    { V4L2_PIX_FMT_MPEG2, VIDC_SESSION_TYPE_DEC, 200, 10 },
>>> +    { V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 200, 10 },
>>> +    { V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 200, 10 },
>>> +    { V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_DEC, 200, 10 },
>>> +    { V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 10 },
>>> +};
>>
>> the table is exactly the same as sdm845 one, please reuse it.
> Sure, I will address this in next version.
>>
>>> +
>>> +static const struct bw_tbl sc7180_bw_table_enc[] = {
>>> +    {  972000,  750000, 0, 0, 0 },    /* 3840x2160@30 */
>>> +    {  489600,  451000, 0, 0, 0 },    /* 1920x1080@60 */
>>> +    {  244800,  234000, 0, 0, 0 },    /* 1920x1080@30 */
>>> +};
>>> +
>>> +static const struct bw_tbl sc7180_bw_table_dec[] = {
>>> +    { 1036800, 1386000, 0, 1875000, 0 },    /* 4096x2160@30 */
>>> +    {  489600,  865000, 0, 1146000, 0 },    /* 1920x1080@60 */
>>> +    {  244800,  530000, 0,  583000, 0 },    /* 1920x1080@30 */
>>> +};
>>> +
>>> +static const struct venus_resources sc7180_res = {
>>> +    .freq_tbl = sc7180_freq_table,
>>> +    .freq_tbl_size = ARRAY_SIZE(sc7180_freq_table),
>>> +    .bw_tbl_enc = sc7180_bw_table_enc,
>>> +    .bw_tbl_enc_size = ARRAY_SIZE(sc7180_bw_table_enc),
>>> +    .bw_tbl_dec = sc7180_bw_table_dec,
>>> +    .bw_tbl_dec_size = ARRAY_SIZE(sc7180_bw_table_dec),
>>> +    .codec_freq_data = sc7180_codec_freq_data,
>>> +    .codec_freq_data_size = ARRAY_SIZE(sc7180_codec_freq_data),
>>> +    .clks = {"core", "iface", "bus" },
>>> +    .clks_num = 3,
>>> +    .vcodec0_clks = { "vcodec0_core", "vcodec0_bus" },
>>> +    .vcodec_clks_num = 2,
>>> +    .vcodec_pmdomains = { "venus", "vcodec0" },
>>> +    .vcodec_pmdomains_num = 2,
>>> +    .vcodec_num = 1,
>>> +    .max_load = 3110400,    /* 4096x2160@90 */
>>
>> Looking into above bandwidth tables I can guess that the maximimum load
>> is reached at 4096x2160@30? If so you have to change it here.
> 
> After checking further on this I see that max_load can be removed since
> it is not being used now to determine if H/W is overloaded or not.
> What do you suggest?

Lets have it just for informational reasons.
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index c7525d9..e8c8b28 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -469,7 +469,7 @@  static __maybe_unused int venus_runtime_resume(struct device *dev)
 	{ 2073600, 3929000, 0, 5551000, 0 },	/* 4096x2160@60 */
 	{ 1036800, 1987000, 0, 2797000, 0 },	/* 4096x2160@30 */
 	{  489600, 1040000, 0, 1298000, 0 },	/* 1920x1080@60 */
-	{  244800,  530000, 0,  659000, 0 },	/* 1920x1080@30 */
+	{  244800,  442000, 0,  659000, 0 },	/* 1920x1080@30 */
 };
 
 static const struct venus_resources sdm845_res = {
@@ -521,11 +521,67 @@  static __maybe_unused int venus_runtime_resume(struct device *dev)
 	.fwname = "qcom/venus-5.2/venus.mdt",
 };
 
+static const struct freq_tbl sc7180_freq_table[] = {
+	{  0, 380000000 },
+	{  0, 340000000 },
+	{  0, 270000000 },
+	{  0, 150000000 },
+};
+
+static struct codec_freq_data sc7180_codec_freq_data[] =  {
+	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_ENC, 675, 10 },
+	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_ENC, 675, 10 },
+	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_ENC, 675, 10 },
+	{ V4L2_PIX_FMT_MPEG2, VIDC_SESSION_TYPE_DEC, 200, 10 },
+	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 200, 10 },
+	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 200, 10 },
+	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_DEC, 200, 10 },
+	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 10 },
+};
+
+static const struct bw_tbl sc7180_bw_table_enc[] = {
+	{  972000,  750000, 0, 0, 0 },	/* 3840x2160@30 */
+	{  489600,  451000, 0, 0, 0 },	/* 1920x1080@60 */
+	{  244800,  234000, 0, 0, 0 },	/* 1920x1080@30 */
+};
+
+static const struct bw_tbl sc7180_bw_table_dec[] = {
+	{ 1036800, 1386000, 0, 1875000, 0 },	/* 4096x2160@30 */
+	{  489600,  865000, 0, 1146000, 0 },	/* 1920x1080@60 */
+	{  244800,  530000, 0,  583000, 0 },	/* 1920x1080@30 */
+};
+
+static const struct venus_resources sc7180_res = {
+	.freq_tbl = sc7180_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(sc7180_freq_table),
+	.bw_tbl_enc = sc7180_bw_table_enc,
+	.bw_tbl_enc_size = ARRAY_SIZE(sc7180_bw_table_enc),
+	.bw_tbl_dec = sc7180_bw_table_dec,
+	.bw_tbl_dec_size = ARRAY_SIZE(sc7180_bw_table_dec),
+	.codec_freq_data = sc7180_codec_freq_data,
+	.codec_freq_data_size = ARRAY_SIZE(sc7180_codec_freq_data),
+	.clks = {"core", "iface", "bus" },
+	.clks_num = 3,
+	.vcodec0_clks = { "vcodec0_core", "vcodec0_bus" },
+	.vcodec_clks_num = 2,
+	.vcodec_pmdomains = { "venus", "vcodec0" },
+	.vcodec_pmdomains_num = 2,
+	.vcodec_num = 1,
+	.max_load = 3110400,	/* 4096x2160@90 */
+	.hfi_version = HFI_VERSION_4XX,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.dma_mask = 0xe0000000 - 1,
+	.fwname = "qcom/venus-5.4/venus.mdt",
+};
+
 static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
 	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
 	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
 	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
+	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, venus_dt_match);