Re: [PATCH 1/5] media: venus: Add codec data table

2019-06-20 Thread amasule

Hi Stan,

On 2019-06-17 14:07, Stanimir Varbanov wrote:

Hi Aniket,

On 6/11/19 9:05 AM, Aniket Masule wrote:

Add vpp cycles for for different types of codec
It indicates the cycles required by video hardware
to process each macroblock.

Signed-off-by: Aniket Masule 
---
 drivers/media/platform/qcom/venus/core.c | 13 +
 drivers/media/platform/qcom/venus/core.h | 15 +++
 2 files changed, 28 insertions(+)

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

index 7393667..43eb446 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -473,9 +473,22 @@ static __maybe_unused int 
venus_runtime_resume(struct device *dev)

{  244800, 1 }, /* 1920x1080@30 */
 };

+static struct codec_data sdm845_codec_data[] =  {
+   { V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_ENC, 675 },
+   { V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_ENC, 675 },
+   { V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_ENC, 675 },
+   { V4L2_PIX_FMT_MPEG2, VIDC_SESSION_TYPE_DEC, 200 },
+   { V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 200 },
+   { V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 200 },
+   { V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_DEC, 200 },
+   { V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200 },
+};
+
 static const struct venus_resources sdm845_res = {
.freq_tbl = sdm845_freq_table,
.freq_tbl_size = ARRAY_SIZE(sdm845_freq_table),
+   .codec_data = sdm845_codec_data,
+   .codec_data_size = ARRAY_SIZE(sdm845_codec_data),
.clks = {"core", "iface", "bus" },
.clks_num = 3,
.max_load = 2563200,
diff --git a/drivers/media/platform/qcom/venus/core.h 
b/drivers/media/platform/qcom/venus/core.h

index 7a3feb5..b1a9b43 100644
--- a/drivers/media/platform/qcom/venus/core.h
+++ b/drivers/media/platform/qcom/venus/core.h
@@ -35,12 +35,20 @@ struct reg_val {
u32 value;
 };

+struct codec_data {


The name is very generic, could you rename the structure to something
like vpp_cycles_data?

I will be adding vsp_cycles with next patch for bitrate based clock 
scaling.

So, I could rename it to codec_cycles_data.


+u32 pixfmt;
+u32 session_type;
+int vpp_cycles;


please check your editor, those fields should have a tab to the right.


+};
+
 struct venus_resources {
u64 dma_mask;
const struct freq_tbl *freq_tbl;
unsigned int freq_tbl_size;
const struct reg_val *reg_tbl;
unsigned int reg_tbl_size;
+   const struct codec_data *codec_data;
+   unsigned int codec_data_size;
const char * const clks[VIDC_CLKS_NUM_MAX];
unsigned int clks_num;
enum hfi_version hfi_version;
@@ -216,6 +224,12 @@ struct venus_buffer {
struct list_head ref_list;
 };

+struct clock_data {
+   u32 core_id;
+   unsigned long freq;


I cannot see how this 'freq' structure field is used? I can see that 
you

fill it in 3/5 patch but you don't used nowhere.


Yes Stan, I will remove 'freq' from clock data structure.


+   struct codec_data *codec_data;
+};


Having the fact that freq field seems not needed can we just merge the
fields in venus_inst structure?


I will be adding 'freq' with next patch for bitrate based clock scaling.
So, it would be easier if we maintain separate structure from this 
patch.

+
 #define to_venus_buffer(ptr)	container_of(ptr, struct venus_buffer, 
vb)


 /**
@@ -275,6 +289,7 @@ struct venus_inst {
struct list_head list;
struct mutex lock;
struct venus_core *core;
+   struct clock_data clk_data;
struct list_head dpbbufs;
struct list_head internalbufs;
struct list_head registeredbufs;



Re: [PATCH 1/5] media: venus: Add codec data table

2019-06-17 Thread Stanimir Varbanov
Hi Aniket,

On 6/11/19 9:05 AM, Aniket Masule wrote:
> Add vpp cycles for for different types of codec
> It indicates the cycles required by video hardware
> to process each macroblock.
> 
> Signed-off-by: Aniket Masule 
> ---
>  drivers/media/platform/qcom/venus/core.c | 13 +
>  drivers/media/platform/qcom/venus/core.h | 15 +++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.c 
> b/drivers/media/platform/qcom/venus/core.c
> index 7393667..43eb446 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -473,9 +473,22 @@ static __maybe_unused int venus_runtime_resume(struct 
> device *dev)
>   {  244800, 1 }, /* 1920x1080@30 */
>  };
>  
> +static struct codec_data sdm845_codec_data[] =  {
> + { V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_ENC, 675 },
> + { V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_ENC, 675 },
> + { V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_ENC, 675 },
> + { V4L2_PIX_FMT_MPEG2, VIDC_SESSION_TYPE_DEC, 200 },
> + { V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 200 },
> + { V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 200 },
> + { V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_DEC, 200 },
> + { V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200 },
> +};
> +
>  static const struct venus_resources sdm845_res = {
>   .freq_tbl = sdm845_freq_table,
>   .freq_tbl_size = ARRAY_SIZE(sdm845_freq_table),
> + .codec_data = sdm845_codec_data,
> + .codec_data_size = ARRAY_SIZE(sdm845_codec_data),
>   .clks = {"core", "iface", "bus" },
>   .clks_num = 3,
>   .max_load = 2563200,
> diff --git a/drivers/media/platform/qcom/venus/core.h 
> b/drivers/media/platform/qcom/venus/core.h
> index 7a3feb5..b1a9b43 100644
> --- a/drivers/media/platform/qcom/venus/core.h
> +++ b/drivers/media/platform/qcom/venus/core.h
> @@ -35,12 +35,20 @@ struct reg_val {
>   u32 value;
>  };
>  
> +struct codec_data {

The name is very generic, could you rename the structure to something
like vpp_cycles_data?

> +u32 pixfmt;
> +u32 session_type;
> +int vpp_cycles;

please check your editor, those fields should have a tab to the right.

> +};
> +
>  struct venus_resources {
>   u64 dma_mask;
>   const struct freq_tbl *freq_tbl;
>   unsigned int freq_tbl_size;
>   const struct reg_val *reg_tbl;
>   unsigned int reg_tbl_size;
> + const struct codec_data *codec_data;
> + unsigned int codec_data_size;
>   const char * const clks[VIDC_CLKS_NUM_MAX];
>   unsigned int clks_num;
>   enum hfi_version hfi_version;
> @@ -216,6 +224,12 @@ struct venus_buffer {
>   struct list_head ref_list;
>  };
>  
> +struct clock_data {
> + u32 core_id;
> + unsigned long freq;

I cannot see how this 'freq' structure field is used? I can see that you
fill it in 3/5 patch but you don't used nowhere.

> + struct codec_data *codec_data;
> +};

Having the fact that freq field seems not needed can we just merge the
fields in venus_inst structure?

> +
>  #define to_venus_buffer(ptr) container_of(ptr, struct venus_buffer, vb)
>  
>  /**
> @@ -275,6 +289,7 @@ struct venus_inst {
>   struct list_head list;
>   struct mutex lock;
>   struct venus_core *core;
> + struct clock_data clk_data;
>   struct list_head dpbbufs;
>   struct list_head internalbufs;
>   struct list_head registeredbufs;
> 

-- 
regards,
Stan