Skip to content

Commit b368d3e

Browse files
atseanpaulckhu-mediatek
authored andcommitted
drm/mediatek: Support reflect-x plane rotation
Add support for REFLECT_X rotations. Cc: Fritz Koenig <[email protected]> Cc: Daniele Castagna <[email protected]> Cc: Miguel Casas <[email protected]> Cc: Mark Yacoub <[email protected]> Signed-off-by: Sean Paul <[email protected]> Signed-off-by: CK Hu <[email protected]>
1 parent 84d8057 commit b368d3e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/gpu/drm/mediatek/mtk_disp_ovl.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#define OVL_CON_AEN BIT(8)
5454
#define OVL_CON_ALPHA 0xff
5555
#define OVL_CON_VIRT_FLIP BIT(9)
56+
#define OVL_CON_HORZ_FLIP BIT(10)
5657

5758
struct mtk_disp_ovl_data {
5859
unsigned int addr;
@@ -142,7 +143,8 @@ static unsigned int mtk_ovl_layer_nr(struct mtk_ddp_comp *comp)
142143

143144
static unsigned int mtk_ovl_supported_rotations(struct mtk_ddp_comp *comp)
144145
{
145-
return DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y;
146+
return DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y |
147+
DRM_MODE_REFLECT_X;
146148
}
147149

148150
static int mtk_ovl_layer_check(struct mtk_ddp_comp *comp, unsigned int idx,
@@ -153,6 +155,7 @@ static int mtk_ovl_layer_check(struct mtk_ddp_comp *comp, unsigned int idx,
153155

154156
rotation = drm_rotation_simplify(state->rotation,
155157
DRM_MODE_ROTATE_0 |
158+
DRM_MODE_REFLECT_X |
156159
DRM_MODE_REFLECT_Y);
157160
rotation &= ~DRM_MODE_ROTATE_0;
158161

@@ -269,6 +272,11 @@ static void mtk_ovl_layer_config(struct mtk_ddp_comp *comp, unsigned int idx,
269272
addr += (pending->height - 1) * pending->pitch;
270273
}
271274

275+
if (pending->rotation & DRM_MODE_REFLECT_X) {
276+
con |= OVL_CON_HORZ_FLIP;
277+
addr += pending->pitch - 1;
278+
}
279+
272280
writel_relaxed(con, comp->regs + DISP_REG_OVL_CON(idx));
273281
writel_relaxed(pitch, comp->regs + DISP_REG_OVL_PITCH(idx));
274282
writel_relaxed(src_size, comp->regs + DISP_REG_OVL_SRC_SIZE(idx));

0 commit comments

Comments
 (0)