gpu: ipu-v3: enable remaining 32-bit RGB V4L2 pixel formats
authorPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 29 Jul 2019 12:22:10 +0000 (14:22 +0200)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Mon, 19 Aug 2019 14:08:55 +0000 (16:08 +0200)
Support is already implemented for the corresponding DRM formats,
just hook up the remaining V4L2 pixel formats.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
drivers/gpu/ipu-v3/ipu-common.c
drivers/gpu/ipu-v3/ipu-cpmem.c

index 6386e2f..ee2a025 100644 (file)
@@ -113,13 +113,17 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat)
        case V4L2_PIX_FMT_NV16:
        case V4L2_PIX_FMT_NV61:
                return IPUV3_COLORSPACE_YUV;
-       case V4L2_PIX_FMT_XRGB32:
-       case V4L2_PIX_FMT_XBGR32:
-       case V4L2_PIX_FMT_RGB32:
-       case V4L2_PIX_FMT_BGR32:
-       case V4L2_PIX_FMT_RGB24:
-       case V4L2_PIX_FMT_BGR24:
        case V4L2_PIX_FMT_RGB565:
+       case V4L2_PIX_FMT_BGR24:
+       case V4L2_PIX_FMT_RGB24:
+       case V4L2_PIX_FMT_ABGR32:
+       case V4L2_PIX_FMT_XBGR32:
+       case V4L2_PIX_FMT_BGRA32:
+       case V4L2_PIX_FMT_BGRX32:
+       case V4L2_PIX_FMT_RGBA32:
+       case V4L2_PIX_FMT_RGBX32:
+       case V4L2_PIX_FMT_ARGB32:
+       case V4L2_PIX_FMT_XRGB32:
                return IPUV3_COLORSPACE_RGB;
        default:
                return IPUV3_COLORSPACE_UNKNOWN;
index be1226c..a1c85d1 100644 (file)
@@ -182,9 +182,27 @@ static int v4l2_pix_fmt_to_drm_fourcc(u32 pixelformat)
        case V4L2_PIX_FMT_RGB32:
                /* R G B A <=> [32:0] A:B:G:R */
                return DRM_FORMAT_XBGR8888;
+       case V4L2_PIX_FMT_ABGR32:
+               /* B G R A <=> [32:0] A:R:G:B */
+               return DRM_FORMAT_ARGB8888;
        case V4L2_PIX_FMT_XBGR32:
                /* B G R X <=> [32:0] X:R:G:B */
                return DRM_FORMAT_XRGB8888;
+       case V4L2_PIX_FMT_BGRA32:
+               /* A B G R <=> [32:0] R:G:B:A */
+               return DRM_FORMAT_RGBA8888;
+       case V4L2_PIX_FMT_BGRX32:
+               /* X B G R <=> [32:0] R:G:B:X */
+               return DRM_FORMAT_RGBX8888;
+       case V4L2_PIX_FMT_RGBA32:
+               /* R G B A <=> [32:0] A:B:G:R */
+               return DRM_FORMAT_ABGR8888;
+       case V4L2_PIX_FMT_RGBX32:
+               /* R G B X <=> [32:0] X:B:G:R */
+               return DRM_FORMAT_XBGR8888;
+       case V4L2_PIX_FMT_ARGB32:
+               /* A R G B <=> [32:0] B:G:R:A */
+               return DRM_FORMAT_BGRA8888;
        case V4L2_PIX_FMT_XRGB32:
                /* X R G B <=> [32:0] B:G:R:X */
                return DRM_FORMAT_BGRX8888;
@@ -823,8 +841,14 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image)
                break;
        case V4L2_PIX_FMT_RGB32:
        case V4L2_PIX_FMT_BGR32:
-       case V4L2_PIX_FMT_XRGB32:
+       case V4L2_PIX_FMT_ABGR32:
        case V4L2_PIX_FMT_XBGR32:
+       case V4L2_PIX_FMT_BGRA32:
+       case V4L2_PIX_FMT_BGRX32:
+       case V4L2_PIX_FMT_RGBA32:
+       case V4L2_PIX_FMT_RGBX32:
+       case V4L2_PIX_FMT_ARGB32:
+       case V4L2_PIX_FMT_XRGB32:
                offset = image->rect.left * 4 +
                        image->rect.top * pix->bytesperline;
                break;