From patchwork Mon Jul 27 22:57:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jilai wang X-Patchwork-Id: 6877241 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E2C3D9F39D for ; Mon, 27 Jul 2015 22:58:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F09B220718 for ; Mon, 27 Jul 2015 22:58:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D54D420684 for ; Mon, 27 Jul 2015 22:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754829AbbG0W6H (ORCPT ); Mon, 27 Jul 2015 18:58:07 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48241 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754664AbbG0W6F (ORCPT ); Mon, 27 Jul 2015 18:58:05 -0400 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 213971411F9; Mon, 27 Jul 2015 22:58:05 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 1355014122A; Mon, 27 Jul 2015 22:58:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from yyzubuntu29.qualcomm.com (rrcs-67-52-130-30.west.biz.rr.com [67.52.130.30]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jilaiw@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id A0ECC1411F9; Mon, 27 Jul 2015 22:58:03 +0000 (UTC) From: Jilai Wang To: dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, robdclark@gmail.com, Jilai Wang Subject: [PATCH 2/2] drm/msm/mdp5: Add hflip/vflip support to MDP5 planes Date: Mon, 27 Jul 2015 18:57:56 -0400 Message-Id: <1438037876-14957-1-git-send-email-jilaiw@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 };