@@ -97,6 +97,11 @@ mxsfb_fb_create(struct drm_device *dev, struct drm_file *file_priv,
return ERR_PTR(-EINVAL);
}
+ if (info->cpp[0] == 3 && mode_cmd->width % 4) {
+ dev_dbg(dev->dev, "24-bit RGB format requires a width aligned to 4\n");
+ return ERR_PTR(-EINVAL);
+ }
+
return drm_gem_fb_create(dev, file_priv, mode_cmd);
}
@@ -75,6 +75,12 @@ static void mxsfb_set_formats(struct mxsfb_drm_private *mxsfb)
ctrl |= CTRL_WORD_LENGTH_16;
ctrl1 |= CTRL1_SET_BYTE_PACKAGING(0xf);
break;
+ case DRM_FORMAT_RGB888:
+ dev_dbg(drm->dev, "Setting up RGB888 mode\n");
+ ctrl |= CTRL_WORD_LENGTH_24;
+ /* Enable pixel packing, 4 pixels in 3 bytes. */
+ ctrl1 |= CTRL1_SET_BYTE_PACKAGING(0xf);
+ break;
case DRM_FORMAT_XRGB8888:
dev_dbg(drm->dev, "Setting up XRGB8888 mode\n");
ctrl |= CTRL_WORD_LENGTH_24;
@@ -523,6 +529,7 @@ static const struct drm_plane_funcs mxsfb_plane_funcs = {
static const uint32_t mxsfb_primary_plane_formats[] = {
DRM_FORMAT_RGB565,
+ DRM_FORMAT_RGB888,
DRM_FORMAT_XRGB8888,
};
The primary plane can support the packed 24-bit RGB888 format. Enable it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 5 +++++ drivers/gpu/drm/mxsfb/mxsfb_kms.c | 7 +++++++ 2 files changed, 12 insertions(+)