gpu: ipu-v3: add support for 15-bit RGB with 1-bit alpha formats
authorPhilipp Zabel <p.zabel@pengutronix.de>
Fri, 12 Dec 2014 12:40:14 +0000 (13:40 +0100)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Fri, 30 Oct 2015 16:13:47 +0000 (17:13 +0100)
This patch adds support for ARGB1555, ABGR1555, RGBA5551, and BGRA5551
in-memory formats.

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

index e5a38d202a21134f12e51061ef503afa29b81d73..c0b19160a94671dc68bb551e81a2577e37483386 100644 (file)
@@ -57,6 +57,10 @@ EXPORT_SYMBOL_GPL(ipu_srm_dp_sync_update);
 enum ipu_color_space ipu_drm_fourcc_to_colorspace(u32 drm_fourcc)
 {
        switch (drm_fourcc) {
+       case DRM_FORMAT_ARGB1555:
+       case DRM_FORMAT_ABGR1555:
+       case DRM_FORMAT_RGBA5551:
+       case DRM_FORMAT_BGRA5551:
        case DRM_FORMAT_RGB565:
        case DRM_FORMAT_BGR565:
        case DRM_FORMAT_RGB888:
index 3bf05bc4ab67b03c82187666eaf0c3fee022ae60..d26b8bee0269b2321ba533548e765907d3541f5d 100644 (file)
@@ -500,6 +500,38 @@ static const struct ipu_rgb def_bgr_16 = {
        .bits_per_pixel = 16,
 };
 
+static const struct ipu_rgb def_argb_16 = {
+       .red    = { .offset = 10, .length = 5, },
+       .green  = { .offset =  5, .length = 5, },
+       .blue   = { .offset =  0, .length = 5, },
+       .transp = { .offset = 15, .length = 1, },
+       .bits_per_pixel = 16,
+};
+
+static const struct ipu_rgb def_abgr_16 = {
+       .red    = { .offset =  0, .length = 5, },
+       .green  = { .offset =  5, .length = 5, },
+       .blue   = { .offset = 10, .length = 5, },
+       .transp = { .offset = 15, .length = 1, },
+       .bits_per_pixel = 16,
+};
+
+static const struct ipu_rgb def_rgba_16 = {
+       .red    = { .offset = 11, .length = 5, },
+       .green  = { .offset =  6, .length = 5, },
+       .blue   = { .offset =  1, .length = 5, },
+       .transp = { .offset =  0, .length = 1, },
+       .bits_per_pixel = 16,
+};
+
+static const struct ipu_rgb def_bgra_16 = {
+       .red    = { .offset =  1, .length = 5, },
+       .green  = { .offset =  6, .length = 5, },
+       .blue   = { .offset = 11, .length = 5, },
+       .transp = { .offset =  0, .length = 1, },
+       .bits_per_pixel = 16,
+};
+
 #define Y_OFFSET(pix, x, y)    ((x) + pix->width * (y))
 #define U_OFFSET(pix, x, y)    ((pix->width * pix->height) +           \
                                 (pix->width * (y) / 4) + (x) / 2)
@@ -581,6 +613,18 @@ int ipu_cpmem_set_fmt(struct ipuv3_channel *ch, u32 drm_fourcc)
        case DRM_FORMAT_BGR565:
                ipu_cpmem_set_format_rgb(ch, &def_bgr_16);
                break;
+       case DRM_FORMAT_ARGB1555:
+               ipu_cpmem_set_format_rgb(ch, &def_argb_16);
+               break;
+       case DRM_FORMAT_ABGR1555:
+               ipu_cpmem_set_format_rgb(ch, &def_abgr_16);
+               break;
+       case DRM_FORMAT_RGBA5551:
+               ipu_cpmem_set_format_rgb(ch, &def_rgba_16);
+               break;
+       case DRM_FORMAT_BGRA5551:
+               ipu_cpmem_set_format_rgb(ch, &def_bgra_16);
+               break;
        default:
                return -EINVAL;
        }