Skip to content

Commit 2aae8ed

Browse files
paulkocialkowskimmind
authored andcommitted
drm/rockchip: Add per-pixel alpha support for the PX30 VOP
Compared to its predecessors, the PX30 VOP has a different register layout for enabling per-pixel alpha. Instead of src_alpha_ctl and dst_alpha_ctl, there is a single alpha control register. This register takes some fields from src_alpha_ctl, but with a different layout. Add support for the required fields to the PX30 VOP window descriptions, which makes per-pixel-alpha formats behave correctly. Signed-off-by: Paul Kocialkowski <[email protected]> Signed-off-by: Heiko Stuebner <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent cfe28f9 commit 2aae8ed

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

drivers/gpu/drm/rockchip/rockchip_drm_vop.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,10 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
10071007
SRC_ALPHA_CAL_M0(ALPHA_NO_SATURATION) |
10081008
SRC_FACTOR_M0(ALPHA_ONE);
10091009
VOP_WIN_SET(vop, win, src_alpha_ctl, val);
1010+
1011+
VOP_WIN_SET(vop, win, alpha_pre_mul, ALPHA_SRC_PRE_MUL);
1012+
VOP_WIN_SET(vop, win, alpha_mode, ALPHA_PER_PIX);
1013+
VOP_WIN_SET(vop, win, alpha_en, 1);
10101014
} else {
10111015
VOP_WIN_SET(vop, win, src_alpha_ctl, SRC_ALPHA_EN(0));
10121016
}

drivers/gpu/drm/rockchip/rockchip_drm_vop.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ struct vop_win_phy {
167167

168168
struct vop_reg dst_alpha_ctl;
169169
struct vop_reg src_alpha_ctl;
170+
struct vop_reg alpha_pre_mul;
171+
struct vop_reg alpha_mode;
172+
struct vop_reg alpha_en;
170173
struct vop_reg channel;
171174
};
172175

drivers/gpu/drm/rockchip/rockchip_vop_reg.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ static const struct vop_win_phy px30_win0_data = {
264264
.uv_mst = VOP_REG(PX30_WIN0_CBR_MST0, 0xffffffff, 0),
265265
.yrgb_vir = VOP_REG(PX30_WIN0_VIR, 0x1fff, 0),
266266
.uv_vir = VOP_REG(PX30_WIN0_VIR, 0x1fff, 16),
267+
.alpha_pre_mul = VOP_REG(PX30_WIN0_ALPHA_CTRL, 0x1, 2),
268+
.alpha_mode = VOP_REG(PX30_WIN0_ALPHA_CTRL, 0x1, 1),
269+
.alpha_en = VOP_REG(PX30_WIN0_ALPHA_CTRL, 0x1, 0),
267270
};
268271

269272
static const struct vop_win_phy px30_win1_data = {
@@ -277,6 +280,9 @@ static const struct vop_win_phy px30_win1_data = {
277280
.dsp_st = VOP_REG(PX30_WIN1_DSP_ST, 0xffffffff, 0),
278281
.yrgb_mst = VOP_REG(PX30_WIN1_MST, 0xffffffff, 0),
279282
.yrgb_vir = VOP_REG(PX30_WIN1_VIR, 0x1fff, 0),
283+
.alpha_pre_mul = VOP_REG(PX30_WIN1_ALPHA_CTRL, 0x1, 2),
284+
.alpha_mode = VOP_REG(PX30_WIN1_ALPHA_CTRL, 0x1, 1),
285+
.alpha_en = VOP_REG(PX30_WIN1_ALPHA_CTRL, 0x1, 0),
280286
};
281287

282288
static const struct vop_win_phy px30_win2_data = {
@@ -291,6 +297,9 @@ static const struct vop_win_phy px30_win2_data = {
291297
.dsp_st = VOP_REG(PX30_WIN2_DSP_ST0, 0x1fff1fff, 0),
292298
.yrgb_mst = VOP_REG(PX30_WIN2_MST0, 0xffffffff, 0),
293299
.yrgb_vir = VOP_REG(PX30_WIN2_VIR0_1, 0x1fff, 0),
300+
.alpha_pre_mul = VOP_REG(PX30_WIN2_ALPHA_CTRL, 0x1, 2),
301+
.alpha_mode = VOP_REG(PX30_WIN2_ALPHA_CTRL, 0x1, 1),
302+
.alpha_en = VOP_REG(PX30_WIN2_ALPHA_CTRL, 0x1, 0),
294303
};
295304

296305
static const struct vop_win_data px30_vop_big_win_data[] = {

0 commit comments

Comments
 (0)