Commit 5c41bb60 authored by Philipp Zabel's avatar Philipp Zabel

gpu: ipu-v3: add support for XRGB32 and XBGR32 V4L2 pixel formats

These should be used instead of the ill-defined deprecated RGB32 and
BGR32 V4L2 pixel formats.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
parent 64f2cafc
...@@ -122,6 +122,8 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat) ...@@ -122,6 +122,8 @@ enum ipu_color_space ipu_pixelformat_to_colorspace(u32 pixelformat)
case V4L2_PIX_FMT_NV16: case V4L2_PIX_FMT_NV16:
case V4L2_PIX_FMT_NV61: case V4L2_PIX_FMT_NV61:
return IPUV3_COLORSPACE_YUV; return IPUV3_COLORSPACE_YUV;
case V4L2_PIX_FMT_XRGB32:
case V4L2_PIX_FMT_XBGR32:
case V4L2_PIX_FMT_RGB32: case V4L2_PIX_FMT_RGB32:
case V4L2_PIX_FMT_BGR32: case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_RGB24: case V4L2_PIX_FMT_RGB24:
...@@ -190,6 +192,8 @@ int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat) ...@@ -190,6 +192,8 @@ int ipu_stride_to_bytes(u32 pixel_stride, u32 pixelformat)
return (24 * pixel_stride) >> 3; return (24 * pixel_stride) >> 3;
case V4L2_PIX_FMT_BGR32: case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_RGB32: case V4L2_PIX_FMT_RGB32:
case V4L2_PIX_FMT_XBGR32:
case V4L2_PIX_FMT_XRGB32:
return (32 * pixel_stride) >> 3; return (32 * pixel_stride) >> 3;
default: default:
break; break;
......
...@@ -188,6 +188,12 @@ static int v4l2_pix_fmt_to_drm_fourcc(u32 pixelformat) ...@@ -188,6 +188,12 @@ static int v4l2_pix_fmt_to_drm_fourcc(u32 pixelformat)
case V4L2_PIX_FMT_RGB32: case V4L2_PIX_FMT_RGB32:
/* R G B A <=> [32:0] A:B:G:R */ /* R G B A <=> [32:0] A:B:G:R */
return DRM_FORMAT_XBGR8888; return DRM_FORMAT_XBGR8888;
case V4L2_PIX_FMT_XBGR32:
/* B G R X <=> [32:0] X:R:G:B */
return DRM_FORMAT_XRGB8888;
case V4L2_PIX_FMT_XRGB32:
/* X R G B <=> [32:0] B:G:R:X */
return DRM_FORMAT_BGRX8888;
case V4L2_PIX_FMT_UYVY: case V4L2_PIX_FMT_UYVY:
return DRM_FORMAT_UYVY; return DRM_FORMAT_UYVY;
case V4L2_PIX_FMT_YUYV: case V4L2_PIX_FMT_YUYV:
...@@ -787,6 +793,8 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image) ...@@ -787,6 +793,8 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image)
break; break;
case V4L2_PIX_FMT_RGB32: case V4L2_PIX_FMT_RGB32:
case V4L2_PIX_FMT_BGR32: case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_XRGB32:
case V4L2_PIX_FMT_XBGR32:
offset = image->rect.left * 4 + offset = image->rect.left * 4 +
image->rect.top * pix->bytesperline; image->rect.top * pix->bytesperline;
break; break;
......
...@@ -226,6 +226,12 @@ static const struct ipu_image_pixfmt image_convert_formats[] = { ...@@ -226,6 +226,12 @@ static const struct ipu_image_pixfmt image_convert_formats[] = {
}, { }, {
.fourcc = V4L2_PIX_FMT_BGR32, .fourcc = V4L2_PIX_FMT_BGR32,
.bpp = 32, .bpp = 32,
}, {
.fourcc = V4L2_PIX_FMT_XRGB32,
.bpp = 32,
}, {
.fourcc = V4L2_PIX_FMT_XBGR32,
.bpp = 32,
}, { }, {
.fourcc = V4L2_PIX_FMT_YUYV, .fourcc = V4L2_PIX_FMT_YUYV,
.bpp = 16, .bpp = 16,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment