MDP5 SSPPs can flip the input source horizontally or vertically. This change is to support this feature by adding vflip/hflip properties to MDP5 planes. Signed-off-by: Jilai Wang <jilaiw@xxxxxxxxxxxxxx> --- drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h | 2 ++ drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 25 +++++++++++++++++++++++++ drivers/gpu/drm/msm/msm_drv.h | 2 ++ 3 files changed, 29 insertions(+) diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h index 8542b30..93545ec 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.h @@ -74,6 +74,8 @@ struct mdp5_plane_state { uint8_t premultiplied; uint8_t zpos; uint8_t alpha; + uint8_t hflip; + uint8_t vflip; /* assigned by crtc blender */ enum mdp_mixer_stage_id stage; diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 1fbb17d..edd20025 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c @@ -88,6 +88,16 @@ static const struct drm_prop_enum_list premultiplied_prop_enum_list[] = { { 1, "true" }, }; +static const struct drm_prop_enum_list hflip_prop_enum_list[] = { + { 0, "off" }, + { 1, "on" }, +}; + +static const struct drm_prop_enum_list vflip_prop_enum_list[] = { + { 0, "off" }, + { 1, "on" }, +}; + /* helper to install properties which are common to planes and crtcs */ void mdp5_plane_install_properties(struct drm_plane *plane, struct drm_mode_object *obj) @@ -95,6 +105,7 @@ void mdp5_plane_install_properties(struct drm_plane *plane, struct drm_device *dev = plane->dev; struct msm_drm_private *dev_priv = dev->dev_private; struct drm_property *prop; + struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); #define INSTALL_PROPERTY(name, NAME, init_val, fnc, ...) do { \ prop = dev_priv->plane_property[PLANE_PROP_##NAME]; \ @@ -125,6 +136,11 @@ void mdp5_plane_install_properties(struct drm_plane *plane, INSTALL_RANGE_PROPERTY(alpha, ALPHA, 0, 255, 255); INSTALL_ENUM_PROPERTY(premultiplied, PREMULTIPLIED, 0); + if (mdp5_plane->caps & MDP_PIPE_CAP_HFLIP) + INSTALL_ENUM_PROPERTY(hflip, HFLIP, 0); + if (mdp5_plane->caps & MDP_PIPE_CAP_VFLIP) + INSTALL_ENUM_PROPERTY(vflip, VFLIP, 0); + #undef INSTALL_RANGE_PROPERTY #undef INSTALL_ENUM_PROPERTY #undef INSTALL_PROPERTY @@ -152,6 +168,8 @@ static int mdp5_plane_atomic_set_property(struct drm_plane *plane, SET_PROPERTY(zpos, ZPOS, uint8_t); SET_PROPERTY(alpha, ALPHA, uint8_t); SET_PROPERTY(premultiplied, PREMULTIPLIED, uint8_t); + SET_PROPERTY(hflip, HFLIP, uint8_t); + SET_PROPERTY(vflip, VFLIP, uint8_t); dev_err(dev->dev, "Invalid property\n"); ret = -EINVAL; @@ -189,6 +207,8 @@ static int mdp5_plane_atomic_get_property(struct drm_plane *plane, GET_PROPERTY(zpos, ZPOS, uint8_t); GET_PROPERTY(alpha, ALPHA, uint8_t); GET_PROPERTY(premultiplied, PREMULTIPLIED, uint8_t); + GET_PROPERTY(hflip, HFLIP, uint8_t); + GET_PROPERTY(vflip, VFLIP, uint8_t); dev_err(dev->dev, "Invalid property\n"); ret = -EINVAL; @@ -210,6 +230,8 @@ static void mdp5_plane_reset(struct drm_plane *plane) /* assign default blend parameters */ mdp5_state->alpha = 255; mdp5_state->premultiplied = 0; + mdp5_state->hflip = 0; + mdp5_state->vflip = 0; if (plane->type == DRM_PLANE_TYPE_PRIMARY) mdp5_state->zpos = STAGE_BASE; @@ -565,6 +587,7 @@ static int mdp5_plane_mode_set(struct drm_plane *plane, uint32_t src_w, uint32_t src_h) { struct mdp5_plane *mdp5_plane = to_mdp5_plane(plane); + struct mdp5_plane_state *pstate = to_mdp5_plane_state(plane->state); struct mdp5_kms *mdp5_kms = get_kms(plane); struct device *dev = mdp5_kms->dev->dev; enum mdp5_pipe pipe = mdp5_plane->pipe; @@ -675,6 +698,8 @@ static int mdp5_plane_mode_set(struct drm_plane *plane, MDP5_PIPE_SRC_UNPACK_ELEM3(format->unpack[3])); mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC_OP_MODE(pipe), + (pstate->hflip ? MDP5_PIPE_SRC_OP_MODE_FLIP_LR : 0) | + (pstate->vflip ? MDP5_PIPE_SRC_OP_MODE_FLIP_UD : 0) | MDP5_PIPE_SRC_OP_MODE_BWC(BWC_LOSSLESS)); /* not using secure mode: */ diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index bd64a82..e047fec 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -68,6 +68,8 @@ enum msm_mdp_plane_property { PLANE_PROP_ZPOS, PLANE_PROP_ALPHA, PLANE_PROP_PREMULTIPLIED, + PLANE_PROP_HFLIP, + PLANE_PROP_VFLIP, PLANE_PROP_MAX_NUM }; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html