summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2011-11-17 16:05:13 (GMT)
committerDave Airlie <airlied@redhat.com>2011-12-01 14:16:10 (GMT)
commit04b3924db60f974d2b4af0b2e19a0ae7ca202dc7 (patch)
treef16a79ad676ba2333ee5af9c431b9882d574af9e /drivers
parent248dbc2350501e2c7b9f5ceb60c75515d82f4134 (diff)
downloadlinux-fsl-qoriq-04b3924db60f974d2b4af0b2e19a0ae7ca202dc7.tar.xz
drm: Redefine pixel formats
Name the formats as DRM_FORMAT_X instead of DRM_FOURCC_X. Use consistent names, especially for the RGB formats. Component order and byte order are now strictly specified for each format. The RGB format naming follows a convention where the components names and sizes are listed from left to right, matching the order within a single pixel from most significant bit to least significant bit. The YUV format names vary more. For the 4:2:2 packed formats and 2 plane formats use the fourcc. For the three plane formats the name includes the plane order and subsampling information using the standard subsampling notation. Some of those also happen to match the official fourcc definition. The fourccs for for all the RGB formats and some of the YUV formats I invented myself. The idea was that looking at just the fourcc you get some idea what the format is about without having to decode it using some external reference. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_crtc.c57
-rw-r--r--drivers/gpu/drm/i915/intel_display.c18
2 files changed, 52 insertions, 23 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 07c80fd..1dfc286 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1923,28 +1923,28 @@ uint32_t drm_mode_legacy_fb_format(uint32_t bpp, uint32_t depth)
switch (bpp) {
case 8:
- fmt = DRM_FOURCC_RGB332;
+ fmt = DRM_FORMAT_RGB332;
break;
case 16:
if (depth == 15)
- fmt = DRM_FOURCC_RGB555;
+ fmt = DRM_FORMAT_XRGB1555;
else
- fmt = DRM_FOURCC_RGB565;
+ fmt = DRM_FORMAT_RGB565;
break;
case 24:
- fmt = DRM_FOURCC_RGB24;
+ fmt = DRM_FORMAT_RGB888;
break;
case 32:
if (depth == 24)
- fmt = DRM_FOURCC_RGB24;
+ fmt = DRM_FORMAT_XRGB8888;
else if (depth == 30)
- fmt = DRM_INTEL_RGB30;
+ fmt = DRM_FORMAT_XRGB2101010;
else
- fmt = DRM_FOURCC_RGB32;
+ fmt = DRM_FORMAT_ARGB8888;
break;
default:
- DRM_ERROR("bad bpp, assuming RGB24 pixel format\n");
- fmt = DRM_FOURCC_RGB24;
+ DRM_ERROR("bad bpp, assuming x8r8g8b8 pixel format\n");
+ fmt = DRM_FORMAT_XRGB8888;
break;
}
@@ -3145,27 +3145,54 @@ void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
int *bpp)
{
switch (format) {
- case DRM_FOURCC_RGB332:
+ case DRM_FORMAT_RGB332:
+ case DRM_FORMAT_BGR233:
*depth = 8;
*bpp = 8;
break;
- case DRM_FOURCC_RGB555:
+ case DRM_FORMAT_XRGB1555:
+ case DRM_FORMAT_XBGR1555:
+ case DRM_FORMAT_RGBX5551:
+ case DRM_FORMAT_BGRX5551:
+ case DRM_FORMAT_ARGB1555:
+ case DRM_FORMAT_ABGR1555:
+ case DRM_FORMAT_RGBA5551:
+ case DRM_FORMAT_BGRA5551:
*depth = 15;
*bpp = 16;
break;
- case DRM_FOURCC_RGB565:
+ case DRM_FORMAT_RGB565:
+ case DRM_FORMAT_BGR565:
*depth = 16;
*bpp = 16;
break;
- case DRM_FOURCC_RGB24:
+ case DRM_FORMAT_RGB888:
+ case DRM_FORMAT_BGR888:
+ *depth = 24;
+ *bpp = 24;
+ break;
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_XBGR8888:
+ case DRM_FORMAT_RGBX8888:
+ case DRM_FORMAT_BGRX8888:
*depth = 24;
*bpp = 32;
break;
- case DRM_INTEL_RGB30:
+ case DRM_FORMAT_XRGB2101010:
+ case DRM_FORMAT_XBGR2101010:
+ case DRM_FORMAT_RGBX1010102:
+ case DRM_FORMAT_BGRX1010102:
+ case DRM_FORMAT_ARGB2101010:
+ case DRM_FORMAT_ABGR2101010:
+ case DRM_FORMAT_RGBA1010102:
+ case DRM_FORMAT_BGRA1010102:
*depth = 30;
*bpp = 32;
break;
- case DRM_FOURCC_RGB32:
+ case DRM_FORMAT_ARGB8888:
+ case DRM_FORMAT_ABGR8888:
+ case DRM_FORMAT_RGBA8888:
+ case DRM_FORMAT_BGRA8888:
*depth = 32;
*bpp = 32;
break;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 50ae915..0bc93c3 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7585,16 +7585,18 @@ int intel_framebuffer_init(struct drm_device *dev,
return -EINVAL;
switch (mode_cmd->pixel_format) {
- case DRM_FOURCC_RGB332:
- case DRM_FOURCC_RGB565:
- case DRM_FOURCC_RGB24:
- case DRM_INTEL_RGB30:
+ case DRM_FORMAT_RGB332:
+ case DRM_FORMAT_RGB565:
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_ARGB8888:
+ case DRM_FORMAT_XRGB2101010:
+ case DRM_FORMAT_ARGB2101010:
/* RGB formats are common across chipsets */
break;
- case DRM_FOURCC_YUYV:
- case DRM_FOURCC_UYVY:
- case DRM_FOURCC_YVYU:
- case DRM_FOURCC_VYUY:
+ case DRM_FORMAT_YUYV:
+ case DRM_FORMAT_UYVY:
+ case DRM_FORMAT_YVYU:
+ case DRM_FORMAT_VYUY:
break;
default:
DRM_ERROR("unsupported pixel format\n");