video/drm: add panel node parameters for screen rotate
Change-Id: I83112f8a05bd301327d7d1ca21eda97594d95823 Signed-off-by: Shixiang Zheng <shixiang.zheng@rock-chips.com>
This commit is contained in:
parent
cb0376d1ac
commit
ffa55e1823
|
@ -294,6 +294,9 @@ static int display_get_timing_from_dts(struct panel_state *panel_state,
|
|||
return -ENXIO; \
|
||||
}
|
||||
|
||||
#define FDT_GET_INT_DEFAULT(val, name, default) \
|
||||
val = ofnode_read_s32_default(native_mode, name, default);
|
||||
|
||||
FDT_GET_INT(hactive, "hactive");
|
||||
FDT_GET_INT(vactive, "vactive");
|
||||
FDT_GET_INT(pixelclock, "clock-frequency");
|
||||
|
@ -310,6 +313,15 @@ static int display_get_timing_from_dts(struct panel_state *panel_state,
|
|||
FDT_GET_INT(val, "pixelclk-active");
|
||||
flags |= val ? DRM_MODE_FLAG_PPIXDATA : 0;
|
||||
|
||||
FDT_GET_INT_DEFAULT(val, "screen-rotate", 0);
|
||||
if (val == DRM_MODE_FLAG_XMIRROR) {
|
||||
flags |= DRM_MODE_FLAG_XMIRROR;
|
||||
} else if (val == DRM_MODE_FLAG_YMIRROR) {
|
||||
flags |= DRM_MODE_FLAG_YMIRROR;
|
||||
} else if (val == DRM_MODE_FLAG_XYMIRROR) {
|
||||
flags |= DRM_MODE_FLAG_XMIRROR;
|
||||
flags |= DRM_MODE_FLAG_YMIRROR;
|
||||
}
|
||||
mode->hdisplay = hactive;
|
||||
mode->hsync_start = mode->hdisplay + hfront_porch;
|
||||
mode->hsync_end = mode->hsync_start + hsync_len;
|
||||
|
|
|
@ -653,6 +653,7 @@ static int rockchip_vop_set_plane(struct display_state *state)
|
|||
int crtc_w = crtc_state->crtc_w;
|
||||
int crtc_h = crtc_state->crtc_h;
|
||||
int xvir = crtc_state->xvir;
|
||||
int x_mirror = 0, y_mirror = 0;
|
||||
|
||||
act_info = (src_h - 1) << 16;
|
||||
act_info |= (src_w - 1) & 0xffff;
|
||||
|
@ -664,13 +665,27 @@ static int rockchip_vop_set_plane(struct display_state *state)
|
|||
dsp_sty = crtc_y + mode->crtc_vtotal - mode->crtc_vsync_start;
|
||||
dsp_st = dsp_sty << 16 | (dsp_stx & 0xffff);
|
||||
|
||||
if (crtc_state->ymirror) {
|
||||
if (VOP_WIN_SUPPORT(vop, vop->win, ymirror))
|
||||
if (mode->flags & DRM_MODE_FLAG_YMIRROR)
|
||||
y_mirror = 1;
|
||||
else
|
||||
y_mirror = 0;
|
||||
if (mode->flags & DRM_MODE_FLAG_XMIRROR)
|
||||
x_mirror = 1;
|
||||
else
|
||||
x_mirror = 0;
|
||||
if (crtc_state->ymirror ^ y_mirror)
|
||||
y_mirror = 1;
|
||||
else
|
||||
y_mirror = 0;
|
||||
if (y_mirror) {
|
||||
if (VOP_CTRL_SUPPORT(vop, ymirror))
|
||||
crtc_state->dma_addr += (src_h - 1) * xvir * 4;
|
||||
else
|
||||
crtc_state->ymirror = 0;
|
||||
}
|
||||
VOP_WIN_SET(vop, ymirror, crtc_state->ymirror);
|
||||
y_mirror = 0;
|
||||
}
|
||||
VOP_CTRL_SET(vop, ymirror, y_mirror);
|
||||
VOP_CTRL_SET(vop, xmirror, x_mirror);
|
||||
|
||||
VOP_WIN_SET(vop, format, crtc_state->format);
|
||||
VOP_WIN_SET(vop, yrgb_vir, xvir);
|
||||
VOP_WIN_SET(vop, yrgb_mst, crtc_state->dma_addr);
|
||||
|
|
|
@ -38,6 +38,11 @@
|
|||
#define DRM_MODE_FLAG_CLKDIV2 (1 << 13)
|
||||
#define DRM_MODE_FLAG_PPIXDATA BIT(31)
|
||||
|
||||
/* Panel Mirror control */
|
||||
#define DRM_MODE_FLAG_XMIRROR (1<<28)
|
||||
#define DRM_MODE_FLAG_YMIRROR (1<<29)
|
||||
#define DRM_MODE_FLAG_XYMIRROR (DRM_MODE_FLAG_XMIRROR | DRM_MODE_FLAG_YMIRROR)
|
||||
|
||||
#define DRM_MODE_CONNECTOR_Unknown 0
|
||||
#define DRM_MODE_CONNECTOR_VGA 1
|
||||
#define DRM_MODE_CONNECTOR_DVII 2
|
||||
|
|
|
@ -145,4 +145,9 @@
|
|||
/* HSV - next is 0x6002 */
|
||||
#define MEDIA_BUS_FMT_AHSV8888_1X32 0x6001
|
||||
|
||||
/* Panel Mirror control */
|
||||
#define DRM_MODE_FLAG_XMIRROR (1<<28)
|
||||
#define DRM_MODE_FLAG_YMIRROR (1<<29)
|
||||
#define DRM_MODE_FLAG_XYMIRROR (DRM_MODE_FLAG_XMIRROR | DRM_MODE_FLAG_YMIRROR)
|
||||
|
||||
#endif /* __LINUX_MEDIA_BUS_FORMAT_H */
|
||||
|
|
Loading…
Reference in New Issue