drm/rockchip: vop: add support afbc format

Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Change-Id: Idff1ac169854d7338eb63ae49a8ed0496659298e
This commit is contained in:
Sandy Huang
2021-09-16 16:09:44 +08:00
committed by Tao Huang
parent 3c95a80fe2
commit f4725608d9
2 changed files with 54 additions and 1 deletions

View File

@@ -212,6 +212,7 @@ struct vop_win {
const struct vop_csc *csc;
const uint32_t *data_formats;
uint32_t nformats;
const uint64_t *format_modifiers;
u64 feature;
struct vop *vop;
struct vop_plane_state state;
@@ -4197,7 +4198,7 @@ static int vop_plane_init(struct vop *vop, struct vop_win *win,
int ret;
ret = drm_universal_plane_init(vop->drm_dev, &win->base, possible_crtcs, &vop_plane_funcs,
win->data_formats, win->nformats, NULL,
win->data_formats, win->nformats, win->format_modifiers,
win->type, win->name);
if (ret) {
DRM_ERROR("failed to initialize plane %d\n", ret);
@@ -4574,6 +4575,7 @@ static int vop_win_init(struct vop *vop)
vop_win->type = win_data->type;
vop_win->data_formats = win_data->phy->data_formats;
vop_win->nformats = win_data->phy->nformats;
vop_win->format_modifiers = win_data->format_modifiers;
vop_win->feature = win_data->feature;
vop_win->vop = vop;
vop_win->win_id = i;
@@ -4599,6 +4601,7 @@ static int vop_win_init(struct vop *vop)
vop_area->type = DRM_PLANE_TYPE_OVERLAY;
vop_area->data_formats = vop_win->data_formats;
vop_area->nformats = vop_win->nformats;
vop_area->format_modifiers = win_data->format_modifiers;
vop_area->vop = vop;
vop_area->win_id = i;
vop_area->area_id = j + 1;

View File

@@ -96,6 +96,50 @@ static const uint32_t formats_win_lite[] = {
DRM_FORMAT_BGR565,
};
static const uint64_t format_modifiers[] = {
DRM_FORMAT_MOD_LINEAR,
DRM_FORMAT_MOD_INVALID,
};
static const uint64_t format_modifiers_afbc[] = {
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16),
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
AFBC_FORMAT_MOD_SPARSE),
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
AFBC_FORMAT_MOD_YTR),
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
AFBC_FORMAT_MOD_CBR),
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
AFBC_FORMAT_MOD_YTR |
AFBC_FORMAT_MOD_SPARSE),
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
AFBC_FORMAT_MOD_CBR |
AFBC_FORMAT_MOD_SPARSE),
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
AFBC_FORMAT_MOD_YTR |
AFBC_FORMAT_MOD_CBR),
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
AFBC_FORMAT_MOD_YTR |
AFBC_FORMAT_MOD_CBR |
AFBC_FORMAT_MOD_SPARSE),
/* SPLIT mandates SPARSE, RGB modes mandates YTR */
DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
AFBC_FORMAT_MOD_YTR |
AFBC_FORMAT_MOD_SPARSE |
AFBC_FORMAT_MOD_SPLIT),
DRM_FORMAT_MOD_LINEAR,
DRM_FORMAT_MOD_INVALID,
};
static const struct vop_scl_extension rk3288_win_full_scl_ext = {
.cbcr_vsd_mode = VOP_REG(RK3288_WIN0_CTRL1, 0x1, 31),
.cbcr_vsu_mode = VOP_REG(RK3288_WIN0_CTRL1, 0x1, 30),
@@ -632,17 +676,21 @@ static const struct vop_win_phy rk3399_win01_data = {
static const struct vop_win_data rk3399_vop_win_data[] = {
{ .base = 0x00, .phy = &rk3399_win01_data, .csc = &rk3399_win0_csc,
.format_modifiers = format_modifiers_afbc,
.type = DRM_PLANE_TYPE_PRIMARY,
.feature = WIN_FEATURE_AFBDC },
{ .base = 0x40, .phy = &rk3399_win01_data, .csc = &rk3399_win1_csc,
.format_modifiers = format_modifiers_afbc,
.type = DRM_PLANE_TYPE_OVERLAY,
.feature = WIN_FEATURE_AFBDC },
{ .base = 0x00, .phy = &rk3368_win23_data, .csc = &rk3399_win2_csc,
.format_modifiers = format_modifiers_afbc,
.type = DRM_PLANE_TYPE_OVERLAY,
.feature = WIN_FEATURE_AFBDC,
.area = rk3368_area_data,
.area_size = ARRAY_SIZE(rk3368_area_data), },
{ .base = 0x50, .phy = &rk3368_win23_data, .csc = &rk3399_win3_csc,
.format_modifiers = format_modifiers_afbc,
.type = DRM_PLANE_TYPE_CURSOR,
.feature = WIN_FEATURE_AFBDC,
.area = rk3368_area_data,
@@ -665,10 +713,12 @@ static const struct vop_data rk3399_vop_big = {
static const struct vop_win_data rk3399_vop_lit_win_data[] = {
{ .base = 0x00, .phy = &rk3399_win01_data, .csc = &rk3399_win0_csc,
.format_modifiers = format_modifiers,
.type = DRM_PLANE_TYPE_OVERLAY,
.feature = WIN_FEATURE_AFBDC },
{ .phy = NULL },
{ .base = 0x00, .phy = &rk3368_win23_data, .csc = &rk3399_win2_csc,
.format_modifiers = format_modifiers,
.type = DRM_PLANE_TYPE_PRIMARY,
.feature = WIN_FEATURE_AFBDC,
.area = rk3368_area_data,