diff mbox

[02/16] gpu: ipu-cpmem: Add ipu_cpmem_set_uv_offset()

Message ID 1467932621-358-3-git-send-email-steve_longerbeam@mentor.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Longerbeam July 7, 2016, 11:03 p.m. UTC
Adds ipu_cpmem_set_uv_offset(), to set planar U/V offsets.

Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
---
 drivers/gpu/ipu-v3/ipu-cpmem.c | 7 +++++++
 include/video/imx-ipu-v3.h     | 1 +
 2 files changed, 8 insertions(+)

Comments

Philipp Zabel July 8, 2016, 5:34 p.m. UTC | #1
Am Donnerstag, den 07.07.2016, 16:03 -0700 schrieb Steve Longerbeam:
> Adds ipu_cpmem_set_uv_offset(), to set planar U/V offsets.
> 
> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
> ---
>  drivers/gpu/ipu-v3/ipu-cpmem.c | 7 +++++++
>  include/video/imx-ipu-v3.h     | 1 +
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c
> index 6494a4d..a36c35e 100644
> --- a/drivers/gpu/ipu-v3/ipu-cpmem.c
> +++ b/drivers/gpu/ipu-v3/ipu-cpmem.c
> @@ -253,6 +253,13 @@ void ipu_cpmem_set_buffer(struct ipuv3_channel *ch, int bufnum, dma_addr_t buf)
>  }
>  EXPORT_SYMBOL_GPL(ipu_cpmem_set_buffer);
>  
> +void ipu_cpmem_set_uv_offset(struct ipuv3_channel *ch, u32 u_off, u32 v_off)
> +{
> +	ipu_ch_param_write_field(ch, IPU_FIELD_UBO, u_off / 8);
> +	ipu_ch_param_write_field(ch, IPU_FIELD_VBO, v_off / 8);
> +}
> +EXPORT_SYMBOL_GPL(ipu_cpmem_set_uv_offset);
> +

I'd prefer to avoid too much duplication in the API. Is there a reason
you can't use ipu_cpmem_set_yuv_planar_full?

regards
Philipp
Steve Longerbeam July 13, 2016, 10:54 p.m. UTC | #2
Hi Philipp,

On 07/08/2016 10:34 AM, Philipp Zabel wrote:
> Am Donnerstag, den 07.07.2016, 16:03 -0700 schrieb Steve Longerbeam:
>> Adds ipu_cpmem_set_uv_offset(), to set planar U/V offsets.
>>
>> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
>> ---
>>  drivers/gpu/ipu-v3/ipu-cpmem.c | 7 +++++++
>>  include/video/imx-ipu-v3.h     | 1 +
>>  2 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c
>> index 6494a4d..a36c35e 100644
>> --- a/drivers/gpu/ipu-v3/ipu-cpmem.c
>> +++ b/drivers/gpu/ipu-v3/ipu-cpmem.c
>> @@ -253,6 +253,13 @@ void ipu_cpmem_set_buffer(struct ipuv3_channel *ch, int bufnum, dma_addr_t buf)
>>  }
>>  EXPORT_SYMBOL_GPL(ipu_cpmem_set_buffer);
>>  
>> +void ipu_cpmem_set_uv_offset(struct ipuv3_channel *ch, u32 u_off, u32 v_off)
>> +{
>> +	ipu_ch_param_write_field(ch, IPU_FIELD_UBO, u_off / 8);
>> +	ipu_ch_param_write_field(ch, IPU_FIELD_VBO, v_off / 8);
>> +}
>> +EXPORT_SYMBOL_GPL(ipu_cpmem_set_uv_offset);
>> +
> I'd prefer to avoid too much duplication in the API. Is there a reason
> you can't use ipu_cpmem_set_yuv_planar_full?

I could, but it would be cumbersome. ipu_cpmem_set_uv_offset() is being
called when kicking off a new tile conversion, and the stride length would
have to be calculated all over again if I were to use ipu_cpmem_set_yuv_planar_ful().
When kicking off a new tile conversion, the stride doesn't change, only the
tile's buffer address, and U/V offsets for planar, need to be updated.

Steve
Philipp Zabel July 15, 2016, 12:45 p.m. UTC | #3
Am Mittwoch, den 13.07.2016, 15:54 -0700 schrieb Steve Longerbeam:
> Hi Philipp,
> 
> On 07/08/2016 10:34 AM, Philipp Zabel wrote:
> > Am Donnerstag, den 07.07.2016, 16:03 -0700 schrieb Steve Longerbeam:
> >> Adds ipu_cpmem_set_uv_offset(), to set planar U/V offsets.
> >>
> >> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
> >> ---
> >>  drivers/gpu/ipu-v3/ipu-cpmem.c | 7 +++++++
> >>  include/video/imx-ipu-v3.h     | 1 +
> >>  2 files changed, 8 insertions(+)
> >>
> >> diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c
> >> index 6494a4d..a36c35e 100644
> >> --- a/drivers/gpu/ipu-v3/ipu-cpmem.c
> >> +++ b/drivers/gpu/ipu-v3/ipu-cpmem.c
> >> @@ -253,6 +253,13 @@ void ipu_cpmem_set_buffer(struct ipuv3_channel *ch, int bufnum, dma_addr_t buf)
> >>  }
> >>  EXPORT_SYMBOL_GPL(ipu_cpmem_set_buffer);
> >>  
> >> +void ipu_cpmem_set_uv_offset(struct ipuv3_channel *ch, u32 u_off, u32 v_off)
> >> +{
> >> +	ipu_ch_param_write_field(ch, IPU_FIELD_UBO, u_off / 8);
> >> +	ipu_ch_param_write_field(ch, IPU_FIELD_VBO, v_off / 8);
> >> +}
> >> +EXPORT_SYMBOL_GPL(ipu_cpmem_set_uv_offset);
> >> +
> > I'd prefer to avoid too much duplication in the API. Is there a reason
> > you can't use ipu_cpmem_set_yuv_planar_full?
> 
> I could, but it would be cumbersome. ipu_cpmem_set_uv_offset() is being
> called when kicking off a new tile conversion, and the stride length would
> have to be calculated all over again if I were to use ipu_cpmem_set_yuv_planar_ful().
> When kicking off a new tile conversion, the stride doesn't change, only the
> tile's buffer address, and U/V offsets for planar, need to be updated.

Ok. We'll have to change tile width and height as well, but the stride
indeed is constant.

regards
Philipp
diff mbox

Patch

diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c
index 6494a4d..a36c35e 100644
--- a/drivers/gpu/ipu-v3/ipu-cpmem.c
+++ b/drivers/gpu/ipu-v3/ipu-cpmem.c
@@ -253,6 +253,13 @@  void ipu_cpmem_set_buffer(struct ipuv3_channel *ch, int bufnum, dma_addr_t buf)
 }
 EXPORT_SYMBOL_GPL(ipu_cpmem_set_buffer);
 
+void ipu_cpmem_set_uv_offset(struct ipuv3_channel *ch, u32 u_off, u32 v_off)
+{
+	ipu_ch_param_write_field(ch, IPU_FIELD_UBO, u_off / 8);
+	ipu_ch_param_write_field(ch, IPU_FIELD_VBO, v_off / 8);
+}
+EXPORT_SYMBOL_GPL(ipu_cpmem_set_uv_offset);
+
 void ipu_cpmem_interlaced_scan(struct ipuv3_channel *ch, int stride)
 {
 	ipu_ch_param_write_field(ch, IPU_FIELD_SO, 1);
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index 22662a1..904fd12 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -194,6 +194,7 @@  void ipu_cpmem_set_resolution(struct ipuv3_channel *ch, int xres, int yres);
 void ipu_cpmem_set_stride(struct ipuv3_channel *ch, int stride);
 void ipu_cpmem_set_high_priority(struct ipuv3_channel *ch);
 void ipu_cpmem_set_buffer(struct ipuv3_channel *ch, int bufnum, dma_addr_t buf);
+void ipu_cpmem_set_uv_offset(struct ipuv3_channel *ch, u32 u_off, u32 v_off);
 void ipu_cpmem_interlaced_scan(struct ipuv3_channel *ch, int stride);
 void ipu_cpmem_set_axi_id(struct ipuv3_channel *ch, u32 id);
 void ipu_cpmem_set_burstsize(struct ipuv3_channel *ch, int burstsize);