Skip to content

Commit 0cb7041

Browse files
committed
drm: apple: Use defines for dcp's fourcc formats
Add defines for Apple's full gamut packed 10-bit ARGB format ("l10r") and 2 and 3 plane YCbCr 8-bit formats with 4:2:0, 4:2:2 and 4:4:4 subsampling in limited and full range. Signed-off-by: Janne Grunau <j@jannau.net>
1 parent a474ef8 commit 0cb7041

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

drivers/gpu/drm/apple/iomfb_plane.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,20 @@
77
#ifndef __APPLE_IOMFB_PLANE_H__
88
#define __APPLE_IOMFB_PLANE_H__
99

10+
#include <drm/drm_fourcc.h>
11+
1012
#include <linux/types.h>
1113

1214
#define DCP_SURF_MAX_PLANES 3
1315

16+
#define DCP_FORMAT_BGRA fourcc_code('A', 'R', 'G', 'B')
17+
#define DCP_FORMAT_RGBA fourcc_code('A', 'B', 'G', 'R')
18+
19+
#define DCP_FORMAT_W30R fourcc_code('r', '0', '3', 'w') // wide gamut packed 10-bit RGB without alpha
20+
#define DCP_FORMAT_L10R fourcc_code('r', '0', '1', 'l') // full range packed 10-bit RGB with alpha
21+
22+
23+
1424
struct dcp_rect {
1525
u32 x;
1626
u32 y;

drivers/gpu/drm/apple/plane.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ static u32 drm_format_to_dcp(u32 drm)
109109
switch (drm) {
110110
case DRM_FORMAT_XRGB8888:
111111
case DRM_FORMAT_ARGB8888:
112-
return fourcc_code('A', 'R', 'G', 'B');
112+
return DCP_FORMAT_BGRA;
113113

114114
case DRM_FORMAT_XBGR8888:
115115
case DRM_FORMAT_ABGR8888:
116-
return fourcc_code('A', 'B', 'G', 'R');
116+
return DCP_FORMAT_RGBA;
117117

118118
case DRM_FORMAT_XRGB2101010:
119-
return fourcc_code('r', '0', '3', 'w');
119+
return DCP_FORMAT_W30R;
120120
}
121121

122122
pr_warn("DRM format %X not supported in DCP\n", drm);

0 commit comments

Comments
 (0)