gpu: ipu-cpmem: Add second buffer support to ipu_cpmem_set_image()
Add a second buffer physaddr to struct ipu_image, for double-buffering support. Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
parent
c42d37ca42
commit
2094b603ae
|
@ -538,7 +538,7 @@ EXPORT_SYMBOL_GPL(ipu_cpmem_set_fmt);
|
||||||
int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image)
|
int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image)
|
||||||
{
|
{
|
||||||
struct v4l2_pix_format *pix = &image->pix;
|
struct v4l2_pix_format *pix = &image->pix;
|
||||||
int y_offset, u_offset, v_offset;
|
int offset, y_offset, u_offset, v_offset;
|
||||||
|
|
||||||
pr_debug("%s: resolution: %dx%d stride: %d\n",
|
pr_debug("%s: resolution: %dx%d stride: %d\n",
|
||||||
__func__, pix->width, pix->height,
|
__func__, pix->width, pix->height,
|
||||||
|
@ -560,30 +560,30 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image)
|
||||||
|
|
||||||
ipu_cpmem_set_yuv_planar_full(ch, pix->pixelformat,
|
ipu_cpmem_set_yuv_planar_full(ch, pix->pixelformat,
|
||||||
pix->bytesperline, u_offset, v_offset);
|
pix->bytesperline, u_offset, v_offset);
|
||||||
ipu_cpmem_set_buffer(ch, 0, image->phys + y_offset);
|
ipu_cpmem_set_buffer(ch, 0, image->phys0 + y_offset);
|
||||||
|
ipu_cpmem_set_buffer(ch, 1, image->phys1 + y_offset);
|
||||||
break;
|
break;
|
||||||
case V4L2_PIX_FMT_UYVY:
|
case V4L2_PIX_FMT_UYVY:
|
||||||
case V4L2_PIX_FMT_YUYV:
|
case V4L2_PIX_FMT_YUYV:
|
||||||
ipu_cpmem_set_buffer(ch, 0, image->phys +
|
case V4L2_PIX_FMT_RGB565:
|
||||||
image->rect.left * 2 +
|
offset = image->rect.left * 2 +
|
||||||
image->rect.top * image->pix.bytesperline);
|
image->rect.top * pix->bytesperline;
|
||||||
|
ipu_cpmem_set_buffer(ch, 0, image->phys0 + offset);
|
||||||
|
ipu_cpmem_set_buffer(ch, 1, image->phys1 + offset);
|
||||||
break;
|
break;
|
||||||
case V4L2_PIX_FMT_RGB32:
|
case V4L2_PIX_FMT_RGB32:
|
||||||
case V4L2_PIX_FMT_BGR32:
|
case V4L2_PIX_FMT_BGR32:
|
||||||
ipu_cpmem_set_buffer(ch, 0, image->phys +
|
offset = image->rect.left * 4 +
|
||||||
image->rect.left * 4 +
|
image->rect.top * pix->bytesperline;
|
||||||
image->rect.top * image->pix.bytesperline);
|
ipu_cpmem_set_buffer(ch, 0, image->phys0 + offset);
|
||||||
break;
|
ipu_cpmem_set_buffer(ch, 1, image->phys1 + offset);
|
||||||
case V4L2_PIX_FMT_RGB565:
|
|
||||||
ipu_cpmem_set_buffer(ch, 0, image->phys +
|
|
||||||
image->rect.left * 2 +
|
|
||||||
image->rect.top * image->pix.bytesperline);
|
|
||||||
break;
|
break;
|
||||||
case V4L2_PIX_FMT_RGB24:
|
case V4L2_PIX_FMT_RGB24:
|
||||||
case V4L2_PIX_FMT_BGR24:
|
case V4L2_PIX_FMT_BGR24:
|
||||||
ipu_cpmem_set_buffer(ch, 0, image->phys +
|
offset = image->rect.left * 3 +
|
||||||
image->rect.left * 3 +
|
image->rect.top * pix->bytesperline;
|
||||||
image->rect.top * image->pix.bytesperline);
|
ipu_cpmem_set_buffer(ch, 0, image->phys0 + offset);
|
||||||
|
ipu_cpmem_set_buffer(ch, 1, image->phys1 + offset);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
@ -185,7 +185,8 @@ struct ipu_rgb {
|
||||||
struct ipu_image {
|
struct ipu_image {
|
||||||
struct v4l2_pix_format pix;
|
struct v4l2_pix_format pix;
|
||||||
struct v4l2_rect rect;
|
struct v4l2_rect rect;
|
||||||
dma_addr_t phys;
|
dma_addr_t phys0;
|
||||||
|
dma_addr_t phys1;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ipu_cpmem_zero(struct ipuv3_channel *ch);
|
void ipu_cpmem_zero(struct ipuv3_channel *ch);
|
||||||
|
|
Loading…
Reference in a new issue