Skip to content

Commit f55958e

Browse files
6by9pelwell
authored andcommitted
drm/vc4: plane: Swap Cb/Cr pointers for YVU formats
hvs6 appears to have dropped support for the component order field in 3 plane YUV formats. Support them by swapping the Cb and Cr planes over when reading the image pointers. Signed-off-by: Dave Stevenson <[email protected]>
1 parent eaa5a91 commit f55958e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/gpu/drm/vc4/vc4_plane.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static const struct hvs_format {
3737
u32 pixel_order_hvs5;
3838
bool hvs5_only;
3939
bool hvs6_only;
40+
bool hvs6_swap_chroma_pointers;
4041
} hvs_formats[] = {
4142
{
4243
.drm = DRM_FORMAT_XRGB8888,
@@ -109,6 +110,7 @@ static const struct hvs_format {
109110
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE,
110111
.pixel_order = HVS_PIXEL_ORDER_XYCRCB,
111112
.pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCRCB,
113+
.hvs6_swap_chroma_pointers = true,
112114
},
113115
{
114116
.drm = DRM_FORMAT_YUV444,
@@ -121,6 +123,7 @@ static const struct hvs_format {
121123
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE,
122124
.pixel_order = HVS_PIXEL_ORDER_XYCRCB,
123125
.pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCRCB,
126+
.hvs6_swap_chroma_pointers = true,
124127
},
125128
{
126129
.drm = DRM_FORMAT_YUV420,
@@ -133,6 +136,7 @@ static const struct hvs_format {
133136
.hvs = HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE,
134137
.pixel_order = HVS_PIXEL_ORDER_XYCRCB,
135138
.pixel_order_hvs5 = HVS_PIXEL_ORDER_XYCRCB,
139+
.hvs6_swap_chroma_pointers = true,
136140
},
137141
{
138142
.drm = DRM_FORMAT_NV12,
@@ -1870,6 +1874,14 @@ static u32 vc6_plane_get_csc_mode(struct vc4_plane_state *vc4_state)
18701874
return ret;
18711875
}
18721876

1877+
static int vc6_get_plane_idx(const struct hvs_format *format, int plane)
1878+
{
1879+
if (!plane || !format->hvs6_swap_chroma_pointers)
1880+
return plane;
1881+
1882+
return (plane == 1) ? 2 : 1;
1883+
}
1884+
18731885
static int vc6_plane_mode_set(struct drm_plane *plane,
18741886
struct drm_plane_state *state)
18751887
{
@@ -2162,7 +2174,8 @@ static int vc6_plane_mode_set(struct drm_plane *plane,
21622174
* TODO: This only covers Raster Scan Order planes
21632175
*/
21642176
for (i = 0; i < num_planes; i++) {
2165-
struct drm_gem_dma_object *bo = drm_fb_dma_get_gem_obj(fb, i);
2177+
struct drm_gem_dma_object *bo =
2178+
drm_fb_dma_get_gem_obj(fb, vc6_get_plane_idx(format, i));
21662179
dma_addr_t paddr = bo->dma_addr + fb->offsets[i] + offsets[i];
21672180

21682181
/* Pointer Word 0 */

0 commit comments

Comments
 (0)