Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38fc7b31 authored by Philipp Zabel's avatar Philipp Zabel Committed by Greg Kroah-Hartman
Browse files

staging: drm/imx: add BGR565 format

parent 7cb17797
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -324,6 +324,14 @@ static const struct ipu_rgb def_rgb_16 = {
	.bits_per_pixel = 16,
	.bits_per_pixel = 16,
};
};


static const struct ipu_rgb def_bgr_16 = {
	.red	= { .offset =  0, .length = 5, },
	.green	= { .offset =  5, .length = 6, },
	.blue	= { .offset = 11, .length = 5, },
	.transp = { .offset =  0, .length = 0, },
	.bits_per_pixel = 16,
};

#define Y_OFFSET(pix, x, y)	((x) + pix->width * (y))
#define Y_OFFSET(pix, x, y)	((x) + pix->width * (y))
#define U_OFFSET(pix, x, y)	((pix->width * pix->height) + \
#define U_OFFSET(pix, x, y)	((pix->width * pix->height) + \
					(pix->width * (y) / 4) + (x) / 2)
					(pix->width * (y) / 4) + (x) / 2)
@@ -374,6 +382,9 @@ int ipu_cpmem_set_fmt(struct ipu_ch_param __iomem *cpmem, u32 drm_fourcc)
	case DRM_FORMAT_RGB565:
	case DRM_FORMAT_RGB565:
		ipu_cpmem_set_format_rgb(cpmem, &def_rgb_16);
		ipu_cpmem_set_format_rgb(cpmem, &def_rgb_16);
		break;
		break;
	case DRM_FORMAT_BGR565:
		ipu_cpmem_set_format_rgb(cpmem, &def_bgr_16);
		break;
	default:
	default:
		return -EINVAL;
		return -EINVAL;
	}
	}