@@ -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 ,
@@ -1873,6 +1877,14 @@ static u32 vc6_plane_get_csc_mode(struct vc4_plane_state *vc4_state)
18731877 return ret ;
18741878}
18751879
1880+ static int vc6_get_plane_idx (const struct hvs_format * format , int plane )
1881+ {
1882+ if (!plane || !format -> hvs6_swap_chroma_pointers )
1883+ return plane ;
1884+
1885+ return (plane == 1 ) ? 2 : 1 ;
1886+ }
1887+
18761888static int vc6_plane_mode_set (struct drm_plane * plane ,
18771889 struct drm_plane_state * state )
18781890{
@@ -2165,8 +2177,10 @@ static int vc6_plane_mode_set(struct drm_plane *plane,
21652177 * TODO: This only covers Raster Scan Order planes
21662178 */
21672179 for (i = 0 ; i < num_planes ; i ++ ) {
2168- struct drm_gem_dma_object * bo = drm_fb_dma_get_gem_obj (fb , i );
2169- dma_addr_t paddr = bo -> dma_addr + fb -> offsets [i ] + offsets [i ];
2180+ int idx = vc6_get_plane_idx (format , i );
2181+ struct drm_gem_dma_object * bo =
2182+ drm_fb_dma_get_gem_obj (fb , idx );
2183+ dma_addr_t paddr = bo -> dma_addr + fb -> offsets [idx ] + offsets [idx ];
21702184
21712185 /* Pointer Word 0 */
21722186 vc4_state -> ptr0_offset [i ] = vc4_state -> dlist_count ;
0 commit comments