gpu: ipu-cpmem: add bayer formats to ipu_cpmem_set_image
authorPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 6 Feb 2017 11:44:08 +0000 (12:44 +0100)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Wed, 15 Mar 2017 14:28:27 +0000 (15:28 +0100)
The IPU does not natively understand bayer formats, but it can pass them
through unchanged. Add support for setting the image base address and
cropping offset to ipu_cpmem_set_image.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/gpu/ipu-v3/ipu-cpmem.c

index f29aa7b0853c99be0759ab7bb3a020c51691f9e8..b72f725e00b599abe88cdf090452c2e0fd089fe7 100644 (file)
@@ -720,6 +720,19 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image)
                offset = image->rect.left * 3 +
                        image->rect.top * pix->bytesperline;
                break;
+       case V4L2_PIX_FMT_SBGGR8:
+       case V4L2_PIX_FMT_SGBRG8:
+       case V4L2_PIX_FMT_SGRBG8:
+       case V4L2_PIX_FMT_SRGGB8:
+               offset = image->rect.left + image->rect.top * pix->bytesperline;
+               break;
+       case V4L2_PIX_FMT_SBGGR16:
+       case V4L2_PIX_FMT_SGBRG16:
+       case V4L2_PIX_FMT_SGRBG16:
+       case V4L2_PIX_FMT_SRGGB16:
+               offset = image->rect.left * 2 +
+                        image->rect.top * pix->bytesperline;
+               break;
        default:
                /* This should not happen */
                WARN_ON(1);