[PATCH] [media] v4l: vsp1: bru: Fix minimum input pixel size
According to the spec, the minimum input pixel size for BRU is 1px, not 4px. Signed-off-by: Takanari Hayama t...@igel.co.jp --- drivers/media/platform/vsp1/vsp1_bru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c index b21f381..401e2b7 100644 --- a/drivers/media/platform/vsp1/vsp1_bru.c +++ b/drivers/media/platform/vsp1/vsp1_bru.c @@ -20,7 +20,7 @@ #include vsp1_bru.h #include vsp1_rwpf.h -#define BRU_MIN_SIZE 4U +#define BRU_MIN_SIZE 1U #define BRU_MAX_SIZE 8190U /* - -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/2] v4l: vsp1: Reset VSP1 RPF source address
Hi Laurent, Thank you for your comments. On 11/28/14, 4:11 AM, Laurent Pinchart wrote: Hi Hayama-san, Thank you for the patch. On Thursday 27 November 2014 10:25:01 Takanari Hayama wrote: Source address of VSP1 RPF needs to be reset whenever crop offsets are recalculated. This correctly reflects a crop setting even VIDIOC_QBUF is called before VIDIOIC_STREAMON is called. Signed-off-by: Takanari Hayama t...@igel.co.jp --- drivers/media/platform/vsp1/vsp1_rpf.c | 15 +++ drivers/media/platform/vsp1/vsp1_rwpf.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index d14d26b..79c0db8 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -106,11 +106,22 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) + crop-left * fmtinfo-bpp[0] / 8; pstride = format-plane_fmt[0].bytesperline VI6_RPF_SRCM_PSTRIDE_Y_SHIFT; + +vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, + rpf-buf_addr[0] + rpf-offsets[0]); + if (format-num_planes 1) { rpf-offsets[1] = crop-top * format-plane_fmt[1].bytesperline + crop-left * fmtinfo-bpp[1] / 8; pstride |= format-plane_fmt[1].bytesperline VI6_RPF_SRCM_PSTRIDE_C_SHIFT; + +vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C0, + rpf-buf_addr[1] + rpf-offsets[1]); + +if (format-num_planes 2) +vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C1, + rpf-buf_addr[2] + rpf-offsets[1]); } vsp1_rpf_write(rpf, VI6_RPF_SRCM_PSTRIDE, pstride); @@ -179,6 +190,10 @@ static void rpf_vdev_queue(struct vsp1_video *video, struct vsp1_video_buffer *buf) { struct vsp1_rwpf *rpf = container_of(video, struct vsp1_rwpf, video); +int i; Nitpicking, i is always positive and should be unsigned int. Ok. + +for (i = 0; i 3; i++) +rpf-buf_addr[i] = buf-addr[i]; How about adding if (!vsp1_entity_is_streaming(rpf-entity)) return; here to avoid configuring the hardware with random offsets if s_stream hasn't been called yet ? Agreed. That's better. If you're fine with those changes I'll modify the patch when applying, there's no need to resubmit. Thank you. I'm all good with those changes. vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, buf-addr[0] + rpf-offsets[0]); diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h index 28dd9e7..1c793bc 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.h +++ b/drivers/media/platform/vsp1/vsp1_rwpf.h @@ -39,6 +39,8 @@ struct vsp1_rwpf { struct v4l2_rect crop; unsigned int offsets[2]; + +dma_addr_t buf_addr[3]; }; static inline struct vsp1_rwpf *to_rwpf(struct v4l2_subdev *subdev) Cheers, Takanari Hayama, Ph.D. (t...@igel.co.jp) IGEL Co.,Ltd. http://www.igel.co.jp/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 2/2] v4l: vsp1: Always enable virtual RPF when BRU is in use
Hi Laurent, On 11/28/14, 5:03 AM, Laurent Pinchart wrote: Hi Hayama-san, Thank you for the patch. On Thursday 27 November 2014 10:25:02 Takanari Hayama wrote: Regardless of a number of inputs, we should always enable virtual RPF when BRU is used. This allows the case when there's only one input to BRU, and a size of the input is smaller than a size of an output of BRU. Signed-off-by: Takanari Hayama t...@igel.co.jp Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com I've applied the patch to my tree. I'll wait for your reply regarding my comments to the first patch and will then send a pull request for both. Thank you. As I already mentioned in my other email, I'm all good with your suggestions. --- drivers/media/platform/vsp1/vsp1_wpf.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 6e05776..cb17c4d 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -92,19 +92,20 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) return 0; } -/* Sources. If the pipeline has a single input configure it as the - * master layer. Otherwise configure all inputs as sub-layers and - * select the virtual RPF as the master layer. +/* Sources. If the pipeline has a single input and BRU is not used, + * configure it as the master layer. Otherwise configure all + * inputs as sub-layers and select the virtual RPF as the master + * layer. */ for (i = 0; i pipe-num_inputs; ++i) { struct vsp1_rwpf *input = pipe-inputs[i]; -srcrpf |= pipe-num_inputs == 1 +srcrpf |= (!pipe-bru pipe-num_inputs == 1) ? VI6_WPF_SRCRPF_RPF_ACT_MST(input-entity.index) : VI6_WPF_SRCRPF_RPF_ACT_SUB(input-entity.index); } -if (pipe-num_inputs 1) +if (pipe-bru || pipe-num_inputs 1) srcrpf |= VI6_WPF_SRCRPF_VIRACT_MST; vsp1_wpf_write(wpf, VI6_WPF_SRCRPF, srcrpf); Cheers, Takanari Hayama, Ph.D. (t...@igel.co.jp) IGEL Co.,Ltd. http://www.igel.co.jp/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] v4l: vsp1: Reset VSP1 RPF source address
Hi Geert, On 11/26/14, 5:59 PM, Geert Uytterhoeven wrote: Hi Hayama-san, On Wed, Nov 26, 2014 at 7:19 AM, Takanari Hayama t...@igel.co.jp wrote: @@ -179,6 +190,10 @@ static void rpf_vdev_queue(struct vsp1_video *video, struct vsp1_video_buffer *buf) { struct vsp1_rwpf *rpf = container_of(video, struct vsp1_rwpf, video); + int i; + + for (i = 0; i 3; i++) + rpf-buf_addr[i] = buf-addr[i]; vsp1_video_buffer.addr is dma_addr_t addr[3];... Oops. Thank you for pointing that out. BTW, you can use memcpy() instead of an explicit loop. I thought about it too. However, it might not be that straight forward. VSP1 accepts only 32-bit address. If we enable LPAE, the address should be converted and mapped to 32-bit address space via IPMMU. So, once IPMMU is supported, we should do address mapping. So, I guess we should leave this loop as is here, so that we can add some address conversion in the future. vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, buf-addr[0] + rpf-offsets[0]); diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h index 28dd9e7..1f98fe3 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.h +++ b/drivers/media/platform/vsp1/vsp1_rwpf.h @@ -39,6 +39,8 @@ struct vsp1_rwpf { struct v4l2_rect crop; unsigned int offsets[2]; + + unsigned int buf_addr[3]; ... hence the above should use dma_addr_t, too. If CONFIG_ARM_LPAE is enabled, CONFIG_ARCH_DMA_ADDR_T_64BIT will be enabled, too, and dma_addr_t will be u64. Thanks. Although we cannot support LPAE for VSP1 without IPMMU, I'll change it to dma_addr_t anyway. }; Cheers, Takanari Hayama, Ph.D. (t...@igel.co.jp) IGEL Co.,Ltd. http://www.igel.co.jp/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] v4l: vsp1: Always enable virtual RPF when BRU is in use
Hi Sergei, On 11/26/14, 9:55 PM, Sergei Shtylyov wrote: Hello. On 11/26/2014 9:19 AM, Takanari Hayama wrote: Regardless of a number of inputs, we should always enable virtual RPF when BRU is used. This allows the case when there's only one input to BRU, and a size of the input is smaller than a size of an output of BRU. Signed-off-by: Takanari Hayama t...@igel.co.jp --- drivers/media/platform/vsp1/vsp1_wpf.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 6e05776..29ea28b 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -92,19 +92,20 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) return 0; } -/* Sources. If the pipeline has a single input configure it as the - * master layer. Otherwise configure all inputs as sub-layers and - * select the virtual RPF as the master layer. +/* Sources. If the pipeline has a single input and BRU is not used, + * configure it as the master layer. Otherwise configure all + * inputs as sub-layers and select the virtual RPF as the master + * layer. */ for (i = 0; i pipe-num_inputs; ++i) { struct vsp1_rwpf *input = pipe-inputs[i]; -srcrpf |= pipe-num_inputs == 1 +srcrpf |= ((!pipe-bru) (pipe-num_inputs == 1)) Inner parens not needed, especially in the first case. Ok. Will fix it. ? VI6_WPF_SRCRPF_RPF_ACT_MST(input-entity.index) : VI6_WPF_SRCRPF_RPF_ACT_SUB(input-entity.index); } -if (pipe-num_inputs 1) +if ((pipe-bru) || (pipe-num_inputs 1)) Likewise. Here too. Thanks! [...] WBR, Sergei Cheers, Takanari Hayama, Ph.D. (t...@igel.co.jp) IGEL Co.,Ltd. http://www.igel.co.jp/ -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 0/2] v4l: vsp1: crop and a single input issues
Hi, I've updated patches to reflect comments from Geert and Sergei. Hope this version could be given a go. Takanari Hayama (2): v4l: vsp1: Reset VSP1 RPF source address v4l: vsp1: Always enable virtual RPF when BRU is in use drivers/media/platform/vsp1/vsp1_rpf.c | 15 +++ drivers/media/platform/vsp1/vsp1_rwpf.h | 2 ++ drivers/media/platform/vsp1/vsp1_wpf.c | 11 ++- 3 files changed, 23 insertions(+), 5 deletions(-) Best Regards, Takanari Hayama -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 1/2] v4l: vsp1: Reset VSP1 RPF source address
Source address of VSP1 RPF needs to be reset whenever crop offsets are recalculated. This correctly reflects a crop setting even VIDIOC_QBUF is called before VIDIOIC_STREAMON is called. Signed-off-by: Takanari Hayama t...@igel.co.jp --- drivers/media/platform/vsp1/vsp1_rpf.c | 15 +++ drivers/media/platform/vsp1/vsp1_rwpf.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index d14d26b..79c0db8 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -106,11 +106,22 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) + crop-left * fmtinfo-bpp[0] / 8; pstride = format-plane_fmt[0].bytesperline VI6_RPF_SRCM_PSTRIDE_Y_SHIFT; + + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, + rpf-buf_addr[0] + rpf-offsets[0]); + if (format-num_planes 1) { rpf-offsets[1] = crop-top * format-plane_fmt[1].bytesperline + crop-left * fmtinfo-bpp[1] / 8; pstride |= format-plane_fmt[1].bytesperline VI6_RPF_SRCM_PSTRIDE_C_SHIFT; + + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C0, + rpf-buf_addr[1] + rpf-offsets[1]); + + if (format-num_planes 2) + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C1, + rpf-buf_addr[2] + rpf-offsets[1]); } vsp1_rpf_write(rpf, VI6_RPF_SRCM_PSTRIDE, pstride); @@ -179,6 +190,10 @@ static void rpf_vdev_queue(struct vsp1_video *video, struct vsp1_video_buffer *buf) { struct vsp1_rwpf *rpf = container_of(video, struct vsp1_rwpf, video); + int i; + + for (i = 0; i 3; i++) + rpf-buf_addr[i] = buf-addr[i]; vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, buf-addr[0] + rpf-offsets[0]); diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h index 28dd9e7..1c793bc 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.h +++ b/drivers/media/platform/vsp1/vsp1_rwpf.h @@ -39,6 +39,8 @@ struct vsp1_rwpf { struct v4l2_rect crop; unsigned int offsets[2]; + + dma_addr_t buf_addr[3]; }; static inline struct vsp1_rwpf *to_rwpf(struct v4l2_subdev *subdev) -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 2/2] v4l: vsp1: Always enable virtual RPF when BRU is in use
Regardless of a number of inputs, we should always enable virtual RPF when BRU is used. This allows the case when there's only one input to BRU, and a size of the input is smaller than a size of an output of BRU. Signed-off-by: Takanari Hayama t...@igel.co.jp --- drivers/media/platform/vsp1/vsp1_wpf.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 6e05776..cb17c4d 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -92,19 +92,20 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) return 0; } - /* Sources. If the pipeline has a single input configure it as the -* master layer. Otherwise configure all inputs as sub-layers and -* select the virtual RPF as the master layer. + /* Sources. If the pipeline has a single input and BRU is not used, +* configure it as the master layer. Otherwise configure all +* inputs as sub-layers and select the virtual RPF as the master +* layer. */ for (i = 0; i pipe-num_inputs; ++i) { struct vsp1_rwpf *input = pipe-inputs[i]; - srcrpf |= pipe-num_inputs == 1 + srcrpf |= (!pipe-bru pipe-num_inputs == 1) ? VI6_WPF_SRCRPF_RPF_ACT_MST(input-entity.index) : VI6_WPF_SRCRPF_RPF_ACT_SUB(input-entity.index); } - if (pipe-num_inputs 1) + if (pipe-bru || pipe-num_inputs 1) srcrpf |= VI6_WPF_SRCRPF_VIRACT_MST; vsp1_wpf_write(wpf, VI6_WPF_SRCRPF, srcrpf); -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] v4l: vsp1: crop and a single input issues
Hi, We've found a couple of issues in VSP1 driver. Each issue is described in each patch. They can be applied separetely. Takanari Hayama (2): v4l: vsp1: Reset VSP1 RPF source address v4l: vsp1: Always enable virtual RPF when BRU is in use drivers/media/platform/vsp1/vsp1_rpf.c | 15 +++ drivers/media/platform/vsp1/vsp1_rwpf.h | 2 ++ drivers/media/platform/vsp1/vsp1_wpf.c | 11 ++- 3 files changed, 23 insertions(+), 5 deletions(-) Best Regards, Takanari Hayama -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] v4l: vsp1: Reset VSP1 RPF source address
Source address of VSP1 RPF needs to be reset whenever crop offsets are recalculated. This correctly reflects a crop setting even VIDIOC_QBUF is called before VIDIOIC_STREAMON is called. Signed-off-by: Takanari Hayama t...@igel.co.jp --- drivers/media/platform/vsp1/vsp1_rpf.c | 15 +++ drivers/media/platform/vsp1/vsp1_rwpf.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index d14d26b..79c0db8 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c @@ -106,11 +106,22 @@ static int rpf_s_stream(struct v4l2_subdev *subdev, int enable) + crop-left * fmtinfo-bpp[0] / 8; pstride = format-plane_fmt[0].bytesperline VI6_RPF_SRCM_PSTRIDE_Y_SHIFT; + + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, + rpf-buf_addr[0] + rpf-offsets[0]); + if (format-num_planes 1) { rpf-offsets[1] = crop-top * format-plane_fmt[1].bytesperline + crop-left * fmtinfo-bpp[1] / 8; pstride |= format-plane_fmt[1].bytesperline VI6_RPF_SRCM_PSTRIDE_C_SHIFT; + + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C0, + rpf-buf_addr[1] + rpf-offsets[1]); + + if (format-num_planes 2) + vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_C1, + rpf-buf_addr[2] + rpf-offsets[1]); } vsp1_rpf_write(rpf, VI6_RPF_SRCM_PSTRIDE, pstride); @@ -179,6 +190,10 @@ static void rpf_vdev_queue(struct vsp1_video *video, struct vsp1_video_buffer *buf) { struct vsp1_rwpf *rpf = container_of(video, struct vsp1_rwpf, video); + int i; + + for (i = 0; i 3; i++) + rpf-buf_addr[i] = buf-addr[i]; vsp1_rpf_write(rpf, VI6_RPF_SRCM_ADDR_Y, buf-addr[0] + rpf-offsets[0]); diff --git a/drivers/media/platform/vsp1/vsp1_rwpf.h b/drivers/media/platform/vsp1/vsp1_rwpf.h index 28dd9e7..1f98fe3 100644 --- a/drivers/media/platform/vsp1/vsp1_rwpf.h +++ b/drivers/media/platform/vsp1/vsp1_rwpf.h @@ -39,6 +39,8 @@ struct vsp1_rwpf { struct v4l2_rect crop; unsigned int offsets[2]; + + unsigned int buf_addr[3]; }; static inline struct vsp1_rwpf *to_rwpf(struct v4l2_subdev *subdev) -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] v4l: vsp1: Always enable virtual RPF when BRU is in use
Regardless of a number of inputs, we should always enable virtual RPF when BRU is used. This allows the case when there's only one input to BRU, and a size of the input is smaller than a size of an output of BRU. Signed-off-by: Takanari Hayama t...@igel.co.jp --- drivers/media/platform/vsp1/vsp1_wpf.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 6e05776..29ea28b 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c @@ -92,19 +92,20 @@ static int wpf_s_stream(struct v4l2_subdev *subdev, int enable) return 0; } - /* Sources. If the pipeline has a single input configure it as the -* master layer. Otherwise configure all inputs as sub-layers and -* select the virtual RPF as the master layer. + /* Sources. If the pipeline has a single input and BRU is not used, +* configure it as the master layer. Otherwise configure all +* inputs as sub-layers and select the virtual RPF as the master +* layer. */ for (i = 0; i pipe-num_inputs; ++i) { struct vsp1_rwpf *input = pipe-inputs[i]; - srcrpf |= pipe-num_inputs == 1 + srcrpf |= ((!pipe-bru) (pipe-num_inputs == 1)) ? VI6_WPF_SRCRPF_RPF_ACT_MST(input-entity.index) : VI6_WPF_SRCRPF_RPF_ACT_SUB(input-entity.index); } - if (pipe-num_inputs 1) + if ((pipe-bru) || (pipe-num_inputs 1)) srcrpf |= VI6_WPF_SRCRPF_VIRACT_MST; vsp1_wpf_write(wpf, VI6_WPF_SRCRPF, srcrpf); -- 1.8.0 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html