Skip to content

Commit 938fbb1

Browse files
Andy Yanmmind
authored andcommitted
drm/rockchip: vop2: Support 32x8 superblock afbc
This is the only afbc format supported by the upcoming VOP for rk3576. Add support for it. Signed-off-by: Andy Yan <[email protected]> Tested-by: Michael Riesch <[email protected]> # on RK3568 Tested-by: Detlev Casanova <[email protected]> Signed-off-by: Heiko Stuebner <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 2ea9ec5 commit 938fbb1

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

drivers/gpu/drm/rockchip/rockchip_drm_vop2.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,16 +1454,18 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
14541454
vop2_win_write(win, VOP2_WIN_AFBC_HALF_BLOCK_EN, half_block_en);
14551455

14561456
if (afbc_en) {
1457-
u32 stride;
1457+
u32 stride, block_w;
1458+
1459+
/* the afbc superblock is 16 x 16 or 32 x 8 */
1460+
block_w = fb->modifier & AFBC_FORMAT_MOD_BLOCK_SIZE_32x8 ? 32 : 16;
14581461

1459-
/* the afbc superblock is 16 x 16 */
14601462
afbc_format = vop2_convert_afbc_format(fb->format->format);
14611463

14621464
/* Enable color transform for YTR */
14631465
if (fb->modifier & AFBC_FORMAT_MOD_YTR)
14641466
afbc_format |= (1 << 4);
14651467

1466-
afbc_tile_num = ALIGN(actual_w, 16) >> 4;
1468+
afbc_tile_num = ALIGN(actual_w, block_w) / block_w;
14671469

14681470
/*
14691471
* AFBC pic_vir_width is count by pixel, this is different
@@ -1474,6 +1476,9 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
14741476
drm_dbg_kms(vop2->drm, "vp%d %s stride[%d] not 64 pixel aligned\n",
14751477
vp->id, win->data->name, stride);
14761478

1479+
/* It's for head stride, each head size is 16 byte */
1480+
stride = ALIGN(stride, block_w) / block_w * 16;
1481+
14771482
uv_swap = vop2_afbc_uv_swap(fb->format->format);
14781483
/*
14791484
* This is a workaround for crazy IC design, Cluster
@@ -1504,7 +1509,11 @@ static void vop2_plane_atomic_update(struct drm_plane *plane,
15041509
else
15051510
vop2_win_write(win, VOP2_WIN_AFBC_AUTO_GATING_EN, 1);
15061511

1507-
vop2_win_write(win, VOP2_WIN_AFBC_BLOCK_SPLIT_EN, 0);
1512+
if (fb->modifier & AFBC_FORMAT_MOD_SPLIT)
1513+
vop2_win_write(win, VOP2_WIN_AFBC_BLOCK_SPLIT_EN, 1);
1514+
else
1515+
vop2_win_write(win, VOP2_WIN_AFBC_BLOCK_SPLIT_EN, 0);
1516+
15081517
transform_offset = vop2_afbc_transform_offset(pstate, half_block_en);
15091518
vop2_win_write(win, VOP2_WIN_AFBC_HDR_PTR, yrgb_mst);
15101519
vop2_win_write(win, VOP2_WIN_AFBC_PIC_SIZE, act_info);

0 commit comments

Comments
 (0)