From patchwork Sun Jun 14 20:01:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604079 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EB3B7913 for ; Mon, 15 Jun 2020 07:28:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C95B82068E for ; Mon, 15 Jun 2020 07:28:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p8FlROeI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C95B82068E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B32696E2CC; Mon, 15 Jun 2020 07:27:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 12B0D89ED3 for ; Sun, 14 Jun 2020 20:01:44 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id o4so642329lfi.7 for ; Sun, 14 Jun 2020 13:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=//s7SgUTdZk+8R0ozrOfOf203NYUFv49iTLgW3uAUIg=; b=p8FlROeIHMU+80XLsAsY3zFZqSiEq7oaT2fgY3JL8e//OFfrvoGekDl4kI3JmydCIZ CpYcdY44klOGtGOluYcC/Zvope3pfNNDWyAIe7KM4swQYNeaKEZ1zb4Mm8tTbNhocus+ PJMZfrqLJKnhQMUJl/0iyeFLNCJDCGnp8qTMHf7x4R1W34Kp+Bzs0qpNehklXR7fms1V L5clzZYyZE8+87NGdo9JL+Yaam8lvssz5FskCZ/LMRqShGIFpTzu6HgiXnlnEUSWV6tL fLy0zG3S7QKUZ6yMxIoFHzOOpfaj5QyqX+iGmk4m31zncYElQLlMrWjjHMcZhBcrOtQ2 FpmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=//s7SgUTdZk+8R0ozrOfOf203NYUFv49iTLgW3uAUIg=; b=hWviB26LV0gWTXDfhRlsMRSJWaJ0F3/6LYKKdvi4ASxpmKk0IXuCELpLE4rsrjTWDH dgSKyCSWkjyE8RA1P1HUpDLL7oKggCV+dlrqjyofdaAUqakyrh7gB96xH8AWrxjfOEHf iOcXeK/J0RmLTQU7j2QI8A0OfCqlRbF1mdVLCTRCvpE0WwhYork7ypDYasF5zeNXoj6D 1QT4WBeLWLtblsYPY+tyUZJ6ucKplZyxSt5/hJvRK6TtNFPn29XHMoP98D4Lt9VYAYji E34gZilF0E084j5aEkGipEhZOn/2ExKsvW4eTJB1rL2cP9NKuKBlHSZ9ghkuw8j/x7Z0 beTQ== X-Gm-Message-State: AOAM532Zy9ZuxiYBW7/zfTS8PBPcauJsMPC7muAVhgVrcPFrHTAsfYdg WtG+WOGxXTGTym+v3RMy3sk= X-Google-Smtp-Source: ABdhPJzDUXrvTGWJPXT1RIij9O/dOiKRpxwRH+3PWIhrxfAWUuI7IRJJLtpJO2GCLBjc+jxQlKu/6w== X-Received: by 2002:a19:4bd1:: with SMTP id y200mr3556664lfa.60.1592164902463; Sun, 14 Jun 2020 13:01:42 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id 144sm1422105lfm.87.2020.06.14.13.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 13:01:41 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v2 1/5] drm/panel: Add helper for reading DT rotation Date: Sun, 14 Jun 2020 23:01:17 +0300 Message-Id: <20200614200121.14147-2-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614200121.14147-1-digetx@gmail.com> References: <20200614200121.14147-1-digetx@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 15 Jun 2020 07:27:17 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Derek Basehore This adds a helper function for reading the rotation (panel orientation) from the device tree. Signed-off-by: Derek Basehore Reviewed-by: Sam Ravnborg Tested-by: Dmitry Osipenko Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_panel.c | 43 +++++++++++++++++++++++++++++++++++++ include/drm/drm_panel.h | 9 ++++++++ 2 files changed, 52 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 8c7bac85a793..5557c75301f1 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -300,6 +300,49 @@ struct drm_panel *of_drm_find_panel(const struct device_node *np) return ERR_PTR(-EPROBE_DEFER); } EXPORT_SYMBOL(of_drm_find_panel); + +/** + * of_drm_get_panel_orientation - look up the orientation of the panel through + * the "rotation" binding from a device tree node + * @np: device tree node of the panel + * @orientation: orientation enum to be filled in + * + * Looks up the rotation of a panel in the device tree. The orientation of the + * panel is expressed as a property name "rotation" in the device tree. The + * rotation in the device tree is counter clockwise. + * + * Return: 0 when a valid rotation value (0, 90, 180, or 270) is read or the + * rotation property doesn't exist. -EERROR otherwise. + */ +int of_drm_get_panel_orientation(const struct device_node *np, + enum drm_panel_orientation *orientation) +{ + int rotation, ret; + + ret = of_property_read_u32(np, "rotation", &rotation); + if (ret == -EINVAL) { + /* Don't return an error if there's no rotation property. */ + *orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; + return 0; + } + + if (ret < 0) + return ret; + + if (rotation == 0) + *orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; + else if (rotation == 90) + *orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; + else if (rotation == 180) + *orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; + else if (rotation == 270) + *orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; + else + return -EINVAL; + + return 0; +} +EXPORT_SYMBOL(of_drm_get_panel_orientation); #endif #if IS_REACHABLE(CONFIG_BACKLIGHT_CLASS_DEVICE) diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 6193cb555acc..781c735f0f9b 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -35,6 +35,8 @@ struct drm_device; struct drm_panel; struct display_timing; +enum drm_panel_orientation; + /** * struct drm_panel_funcs - perform operations on a given panel * @@ -191,11 +193,18 @@ int drm_panel_get_modes(struct drm_panel *panel, struct drm_connector *connector #if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL) struct drm_panel *of_drm_find_panel(const struct device_node *np); +int of_drm_get_panel_orientation(const struct device_node *np, + enum drm_panel_orientation *orientation); #else static inline struct drm_panel *of_drm_find_panel(const struct device_node *np) { return ERR_PTR(-ENODEV); } +static inline int of_drm_get_panel_orientation(const struct device_node *np, + enum drm_panel_orientation *orientation) +{ + return -ENODEV; +} #endif #if IS_ENABLED(CONFIG_DRM_PANEL) && (IS_BUILTIN(CONFIG_BACKLIGHT_CLASS_DEVICE) || \ From patchwork Sun Jun 14 20:01:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604053 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CA2F913 for ; Mon, 15 Jun 2020 07:28:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DF4732068E for ; Mon, 15 Jun 2020 07:28:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="I92A6vFv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DF4732068E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CBF546E2CD; Mon, 15 Jun 2020 07:27:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1696289EF7 for ; Sun, 14 Jun 2020 20:01:45 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id u16so8284470lfl.8 for ; Sun, 14 Jun 2020 13:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vWfY4zIihMKIqVQsNJvI1F9WXeF9VfCOeT2znS/jkBE=; b=I92A6vFvYRmXFMFlLXE0dvrv2v1ZT86Q6B8yuD0d7W4+I6+lG5BtRpx6yMHvP2zWn3 IQbQGP515wItCFw3PVnxaY1z9uIJzgi7PUq+BWx9EYmjRYDt5p0orxHCIFkVeRNrvrEF ZIaYIfF56FpyWmNBYPnZ9S9FiLM/Mlcgjsi04F2cg3tgBgRxufrcQY0RZRzSa/r42PrP NLV6ySPjIytaou8FXRmy0Vl/vANztw1x0K3DdpGSXZ6pw4zp3OAu/xGGScXn5iO5tIUu G9Ja2WdsdbPJq2HRB4tKmJUNpH02hqRDNkxkpovZ+PxLRYaHcO0wvCANcu2+emhGmj1j 5XXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vWfY4zIihMKIqVQsNJvI1F9WXeF9VfCOeT2znS/jkBE=; b=f61Y8PjhvqltuXy4gzwV/7dnR2+En/1McIB23+5uU9BaeZPG3nTF9XXsLcmJYw+vRb 8xNF6UbEf8aDO0YTAP7PJm6Z89Mz5G2wx9lGlf8AQn2fjhO304bwIUCqAALlyxZO5x3J /miyC3gRo3oMocgk/syD1eulP8CaOykWI4zfSQLNaJXIvP6GRzHxv1Js84FxtWOIWc9x hXpzgG0BnxsY1b8wAh3arPdBCvUBSdSq5XLbZ61QWmvxeE8a9J/vVeJjxNeLUlZ+Pgr5 F17qRM5B03GnsJtwRuFkd5FLyDjKQeryFScmdK1Ar+EznEhlVH787MOi6MZbXgtp2NeJ aPWg== X-Gm-Message-State: AOAM533OeBWnRFoQQeF+Ked7yN8pX6lRCjZc/mdQ3Jh754HQe/X3ZnzO zjZVAhdwgsM06pOHwOVMIhI= X-Google-Smtp-Source: ABdhPJyquOv0rIens15YMdI/BhmzeC2GXeZ/2F8wC+6/DIjUEi9FTzACjRXR4/AQ7tL3D0TaQsUlCA== X-Received: by 2002:a19:8389:: with SMTP id f131mr487597lfd.16.1592164903554; Sun, 14 Jun 2020 13:01:43 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id 144sm1422105lfm.87.2020.06.14.13.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 13:01:42 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v2 2/5] drm/panel: lvds: Set up panel orientation Date: Sun, 14 Jun 2020 23:01:18 +0300 Message-Id: <20200614200121.14147-3-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614200121.14147-1-digetx@gmail.com> References: <20200614200121.14147-1-digetx@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 15 Jun 2020 07:27:17 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The panel orientation needs to parsed from a device-tree and assigned to the panel's connector in order to make orientation property available to userspace. That's what this patch does for the generic LVDS panel. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/panel/panel-lvds.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 5ce3f4a2b7a1..333d21cee5f6 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -37,6 +37,8 @@ struct panel_lvds { struct gpio_desc *enable_gpio; struct gpio_desc *reset_gpio; + + enum drm_panel_orientation orientation; }; static inline struct panel_lvds *to_panel_lvds(struct drm_panel *panel) @@ -99,6 +101,7 @@ static int panel_lvds_get_modes(struct drm_panel *panel, connector->display_info.bus_flags = lvds->data_mirror ? DRM_BUS_FLAG_DATA_LSB_TO_MSB : DRM_BUS_FLAG_DATA_MSB_TO_LSB; + drm_connector_set_panel_orientation(connector, lvds->orientation); return 1; } @@ -223,6 +226,11 @@ static int panel_lvds_probe(struct platform_device *pdev) drm_panel_init(&lvds->panel, lvds->dev, &panel_lvds_funcs, DRM_MODE_CONNECTOR_LVDS); + ret = of_drm_get_panel_orientation(lvds->dev->of_node, + &lvds->orientation); + if (ret) + return ret; + ret = drm_panel_of_backlight(&lvds->panel); if (ret) return ret; From patchwork Sun Jun 14 20:01:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604067 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 569A51392 for ; Mon, 15 Jun 2020 07:28:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31D9420707 for ; Mon, 15 Jun 2020 07:28:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SoB/4euz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31D9420707 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 198E86E2B1; Mon, 15 Jun 2020 07:27:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by gabe.freedesktop.org (Postfix) with ESMTPS id 29B5989ED3 for ; Sun, 14 Jun 2020 20:01:46 +0000 (UTC) Received: by mail-lf1-x141.google.com with SMTP id w15so8262102lfe.11 for ; Sun, 14 Jun 2020 13:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ye8LBDqYIu3EMl0SpXZiBgFDVin4wanrCIFCoDUlTCY=; b=SoB/4euzW5k9CYw5Ii/nVBn2BfJ2i2v+InpObJBSDnnxtZ/To/YPToipPIeTij/I5z Uqd/0q9ppDSmpzW7/9JEiPB6JCfceumQrwKAzRtZlXZKZ0TcxriVt0hgx8fZMBsd4gQj uUW+ZzjRWNR5Q2aULIGx96jcpJv6zBygMjitVZAmW+q/RU4cSVXthXzIXHT8g0QXjWfP diEjpSI6ZOAk8Xbk1s6ermwghWT8VlUH3A+NzxgnIyG8q/vZahTEHBalwSG1C5Umi83C fTuY2IGmZYbVbfqiisGf0zLZrIlDsCFxgb4bCpHS9wHyweDFoPmp+NcxyMac1F9eS4U5 dw0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ye8LBDqYIu3EMl0SpXZiBgFDVin4wanrCIFCoDUlTCY=; b=gQM1cjPu0zrnGbn9x79Wv9LhT9Cz6AUHNq3swT1qkpLYGOpGqENlWR3Omh+MBFUrk/ 79ln4uoguB/78WnuHErr86R0SG410QDFUMYuVOgXz1EvtygKLQatHg2CVIvbPp+QjtH5 WuFvZkXvP3QlGV1VaoeBQGBXxMb5rtnacmC+fsglo/GNNl4et5Sdcah/nsmmMZSgoKJ3 Cqc2+mVGnhYqVzdRdvKL8dsS4Uemd3H3uxel0wx3zXDLg9rM/RBMXIdF8/7ZWIL+HwZm Eq1qRVb1lhbY2yPiUakIhGM3/m5/IZXCGhoXRbcqNR8uOHMICBSP5wFpa6ufVddGfEM7 B1qw== X-Gm-Message-State: AOAM532PImgkcOhjgKQBy68ATUQ8/g2gM0a713rDTK2E1rWqlEFevgVH LkYx3miMhaWs/J5cVczWr3k= X-Google-Smtp-Source: ABdhPJz3xWCaB9MQX7FZu+cXBk094pgmQx9brJzlxQLAMXmhXUdExTSG1KrVTTnUUAI2TC5it+n3gw== X-Received: by 2002:a19:a405:: with SMTP id q5mr11586700lfc.164.1592164904535; Sun, 14 Jun 2020 13:01:44 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id 144sm1422105lfm.87.2020.06.14.13.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 13:01:44 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v2 3/5] drm/tegra: plane: Rename bottom_up to reflect_y Date: Sun, 14 Jun 2020 23:01:19 +0300 Message-Id: <20200614200121.14147-4-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614200121.14147-1-digetx@gmail.com> References: <20200614200121.14147-1-digetx@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 15 Jun 2020 07:27:17 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This makes the naming consistent with the DRM core. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/dc.c | 10 +++++----- drivers/gpu/drm/tegra/dc.h | 2 +- drivers/gpu/drm/tegra/plane.c | 2 +- drivers/gpu/drm/tegra/plane.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 83f31c6e891c..ed282f88e409 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -404,7 +404,7 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, tegra_plane_writel(plane, window->stride[0], DC_WIN_LINE_STRIDE); } - if (window->bottom_up) + if (window->reflect_y) v_offset += window->src.h - 1; tegra_plane_writel(plane, h_offset, DC_WINBUF_ADDR_H_OFFSET); @@ -470,7 +470,7 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, value |= COLOR_EXPAND; } - if (window->bottom_up) + if (window->reflect_y) value |= V_DIRECTION; if (tegra_plane_use_horizontal_filtering(plane, window)) { @@ -642,9 +642,9 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, rotation = drm_rotation_simplify(state->rotation, rotation); if (rotation & DRM_MODE_REFLECT_Y) - plane_state->bottom_up = true; + plane_state->reflect_y = true; else - plane_state->bottom_up = false; + plane_state->reflect_y = false; /* * Tegra doesn't support different strides for U and V planes so we @@ -706,7 +706,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, window.dst.w = drm_rect_width(&plane->state->dst); window.dst.h = drm_rect_height(&plane->state->dst); window.bits_per_pixel = fb->format->cpp[0] * 8; - window.bottom_up = tegra_fb_is_bottom_up(fb) || state->bottom_up; + window.reflect_y = tegra_fb_is_bottom_up(fb) || state->reflect_y; /* copy from state */ window.zpos = plane->state->normalized_zpos; diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 3d8ddccd758f..98e1b625168e 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -136,7 +136,7 @@ struct tegra_dc_window { unsigned int stride[2]; unsigned long base[3]; unsigned int zpos; - bool bottom_up; + bool reflect_y; struct tegra_bo_tiling tiling; u32 format; diff --git a/drivers/gpu/drm/tegra/plane.c b/drivers/gpu/drm/tegra/plane.c index 9ccfb56e9b01..e05ef6013a97 100644 --- a/drivers/gpu/drm/tegra/plane.c +++ b/drivers/gpu/drm/tegra/plane.c @@ -61,7 +61,7 @@ tegra_plane_atomic_duplicate_state(struct drm_plane *plane) copy->tiling = state->tiling; copy->format = state->format; copy->swap = state->swap; - copy->bottom_up = state->bottom_up; + copy->reflect_y = state->reflect_y; copy->opaque = state->opaque; for (i = 0; i < 2; i++) diff --git a/drivers/gpu/drm/tegra/plane.h b/drivers/gpu/drm/tegra/plane.h index a158a915109a..8047fc916d8c 100644 --- a/drivers/gpu/drm/tegra/plane.h +++ b/drivers/gpu/drm/tegra/plane.h @@ -46,7 +46,7 @@ struct tegra_plane_state { u32 format; u32 swap; - bool bottom_up; + bool reflect_y; /* used for legacy blending support only */ struct tegra_plane_legacy_blending_state blending[2]; From patchwork Sun Jun 14 20:01:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604045 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E5751392 for ; Mon, 15 Jun 2020 07:28:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C8F22068E for ; Mon, 15 Jun 2020 07:28:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vMkCjCpZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C8F22068E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 824EE6E2D7; Mon, 15 Jun 2020 07:27:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 167D389F06 for ; Sun, 14 Jun 2020 20:01:47 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id w15so8262121lfe.11 for ; Sun, 14 Jun 2020 13:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lFel57lgzkdFi66A+blGOSEVo/1btB7qpZRFUjdwuaU=; b=vMkCjCpZdLUYv4suIqfx/3MUEZK1a6KD7CNZtbYGdSdsPJeaicMH3Vge7RWPzTknLh EBruytN8H/ucQwnaWfYH7FRtktEa54ZS9pRuJHdxX+TBGNZ58+vP5DndOQ1jQJk2T659 nf93A936pfBRYyHl5QXaT4NudEW35KwfecF/No1EP0u8FKIiOV6/WRaVGGw+cPhh02Ug l32ioBRxMnesvhq/nW7pCAeaeZq5jeS9AyVoni47+tY1jEYQ+trPXen6z486WezTghUw c2Ij7fzQh1vt3D7P1iQY646Fz4CuDgvZyru32vFUh6y+CNKN+LxsZZ600CJGSTuhefZq s99A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lFel57lgzkdFi66A+blGOSEVo/1btB7qpZRFUjdwuaU=; b=Wrbe8UO8U2FqOvgrFvNsdsEJt/xzk7FdhvVEyZE+g+mLDWQ9e0KQHIpWF1sbiYb+QI Efeg1T0L4B8HD4m5tcXwFD6VwWWyyHG21SsPSdmMLc1C9dW+2g6DBANPi4F6ZAxriJpw JKdONr//E588LA9Uk5RKM0zvLuInZzra24aNq4wEnXNuM5rool/kZdRTUsWi5x8ZT6fF 9fxIYWiv2mv0zU192M2brqIL0+HDR9QckLfaPmHAOfQefeI7gpxUmkgU1APi4CtCBl7S d/fXolBMikPK40KK6KcluiSHHmUolrSGyFe65ZTj7DHWipnx2nQ9fnQtmyUbYH3Jx9YF 8lOg== X-Gm-Message-State: AOAM531EkkEyst+e/JIL5/RGfgEHBHV+uz66Q/GViAsIOGueDe8lgExu VHqxrhvXGGoDBbc2gs8xEqY= X-Google-Smtp-Source: ABdhPJzNUu4NpTHxztFbm6URTJe+XIxQZ+nkTLzrk8ITpSUydiX1sZV0V1uqoL2VvkWht7I0fO+RYg== X-Received: by 2002:a19:c212:: with SMTP id l18mr11722963lfc.68.1592164905521; Sun, 14 Jun 2020 13:01:45 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id 144sm1422105lfm.87.2020.06.14.13.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 13:01:45 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v2 4/5] drm/tegra: plane: Support horizontal reflection mode Date: Sun, 14 Jun 2020 23:01:20 +0300 Message-Id: <20200614200121.14147-5-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614200121.14147-1-digetx@gmail.com> References: <20200614200121.14147-1-digetx@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 15 Jun 2020 07:27:17 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Support horizontal reflection mode which will allow to support 180° rotation mode when combined with the vertical reflection. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/dc.c | 24 ++++++++++++++++++++---- drivers/gpu/drm/tegra/dc.h | 1 + drivers/gpu/drm/tegra/plane.c | 1 + drivers/gpu/drm/tegra/plane.h | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index ed282f88e409..f31bca27cde4 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -368,6 +368,12 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, h_size = window->src.w * bpp; v_size = window->src.h; + if (window->reflect_x) + h_offset += (window->src.w - 1) * bpp; + + if (window->reflect_y) + v_offset += window->src.h - 1; + value = V_PRESCALED_SIZE(v_size) | H_PRESCALED_SIZE(h_size); tegra_plane_writel(plane, value, DC_WIN_PRESCALED_SIZE); @@ -404,9 +410,6 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, tegra_plane_writel(plane, window->stride[0], DC_WIN_LINE_STRIDE); } - if (window->reflect_y) - v_offset += window->src.h - 1; - tegra_plane_writel(plane, h_offset, DC_WINBUF_ADDR_H_OFFSET); tegra_plane_writel(plane, v_offset, DC_WINBUF_ADDR_V_OFFSET); @@ -470,6 +473,9 @@ static void tegra_dc_setup_window(struct tegra_plane *plane, value |= COLOR_EXPAND; } + if (window->reflect_x) + value |= H_DIRECTION; + if (window->reflect_y) value |= V_DIRECTION; @@ -601,7 +607,9 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, struct drm_plane_state *state) { struct tegra_plane_state *plane_state = to_tegra_plane_state(state); - unsigned int rotation = DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y; + unsigned int rotation = DRM_MODE_ROTATE_0 | + DRM_MODE_REFLECT_X | + DRM_MODE_REFLECT_Y; struct tegra_bo_tiling *tiling = &plane_state->tiling; struct tegra_plane *tegra = to_tegra_plane(plane); struct tegra_dc *dc = to_tegra_dc(state->crtc); @@ -641,6 +649,11 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, rotation = drm_rotation_simplify(state->rotation, rotation); + if (rotation & DRM_MODE_REFLECT_X) + plane_state->reflect_x = true; + else + plane_state->reflect_x = false; + if (rotation & DRM_MODE_REFLECT_Y) plane_state->reflect_y = true; else @@ -706,6 +719,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, window.dst.w = drm_rect_width(&plane->state->dst); window.dst.h = drm_rect_height(&plane->state->dst); window.bits_per_pixel = fb->format->cpp[0] * 8; + window.reflect_x = state->reflect_x; window.reflect_y = tegra_fb_is_bottom_up(fb) || state->reflect_y; /* copy from state */ @@ -792,6 +806,7 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | + DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); if (err < 0) dev_err(dc->dev, "failed to create rotation property: %d\n", @@ -1079,6 +1094,7 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | + DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); if (err < 0) dev_err(dc->dev, "failed to create rotation property: %d\n", diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h index 98e1b625168e..051d03dcb9b0 100644 --- a/drivers/gpu/drm/tegra/dc.h +++ b/drivers/gpu/drm/tegra/dc.h @@ -136,6 +136,7 @@ struct tegra_dc_window { unsigned int stride[2]; unsigned long base[3]; unsigned int zpos; + bool reflect_x; bool reflect_y; struct tegra_bo_tiling tiling; diff --git a/drivers/gpu/drm/tegra/plane.c b/drivers/gpu/drm/tegra/plane.c index e05ef6013a97..4cd0461cc508 100644 --- a/drivers/gpu/drm/tegra/plane.c +++ b/drivers/gpu/drm/tegra/plane.c @@ -61,6 +61,7 @@ tegra_plane_atomic_duplicate_state(struct drm_plane *plane) copy->tiling = state->tiling; copy->format = state->format; copy->swap = state->swap; + copy->reflect_x = state->reflect_x; copy->reflect_y = state->reflect_y; copy->opaque = state->opaque; diff --git a/drivers/gpu/drm/tegra/plane.h b/drivers/gpu/drm/tegra/plane.h index 8047fc916d8c..c691dd79b27b 100644 --- a/drivers/gpu/drm/tegra/plane.h +++ b/drivers/gpu/drm/tegra/plane.h @@ -46,6 +46,7 @@ struct tegra_plane_state { u32 format; u32 swap; + bool reflect_x; bool reflect_y; /* used for legacy blending support only */ From patchwork Sun Jun 14 20:01:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604073 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F5581392 for ; Mon, 15 Jun 2020 07:28:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6DA7E20707 for ; Mon, 15 Jun 2020 07:28:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jQ4is4o3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DA7E20707 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6F0B6E26F; Mon, 15 Jun 2020 07:27:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F88289F06 for ; Sun, 14 Jun 2020 20:01:48 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id s1so16694563ljo.0 for ; Sun, 14 Jun 2020 13:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1tlVNSxgPSIVY7njRp82EoP3y9oei5GEhi6LB4YQ4wY=; b=jQ4is4o3msNRctJPE8x/rXfdtxgqL+UaT5OUefWyjpSdGCCCRnJTJD8hwrAK+7dPak ccLE732RqdOIO/h1BblHTlMoyhV6snAr+fWgyjo2ypIIksW1HO090SR7hNyA74nKJ6/5 am79uNqc5PvmxUBgiI7DxAt+1ki57FYP2g/LNw1/WiArCa6EES4f+ZwZaXqFbvM8WLiG 73o+tLz0aSqAxnAUFfKgQQYFmlipvKHJWrOFKIsFuhb+NW/FS6TCteBvhKhFvRplnG7N QgdOsenUoIWC55wmJq6fPfYqWFpBf9CNRsDhakCSfMBa625Z6xw25OV8BPkh3+zeM+/v kJog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1tlVNSxgPSIVY7njRp82EoP3y9oei5GEhi6LB4YQ4wY=; b=ZhM7tIBXjJvhkxnBn94Ri0iOaWvsedwV6kYmKQ3i8TvCqoXvIqgI24Rf4Kdq1oK5Mp 2XT5JsVKg2M8t3ezzzLPbt4oGi0lLJZqziVIP+GgiAwFaHYNrJE2DaET/608kcbJrEpA 0aWfHjL3Py4+og3usa+dgQTvY/78apLxBoMs44ueMAW7cVpYiWtNsRxkH1EtozrChU2H sxWL1dmD7IFH8qx0mU3JsYQ1Q++u4BUApIIhMCkTMh8CRPGYVzAMDsysWtnB3C0rp7iN XbafwFJauLJiSFEKHoUsmA+do8WST+ogIly6fk3QrZ93aL+wepL5ccM86iDDZflktvWA 7MPw== X-Gm-Message-State: AOAM531ZdscWATw/QaG83MwgfNPE8ca0FbGDCfj0AKyUfBThxX+lf++a ZfefF28Mebchyrzd2nVEOtY= X-Google-Smtp-Source: ABdhPJwkjAohrFdbnjXNIyKjz2EOPAHBkTIDfMEzdvwoiExIpOvjnhuRzO8/1I+pHiLBdhjK8q9qyw== X-Received: by 2002:a05:651c:1193:: with SMTP id w19mr11737184ljo.121.1592164906663; Sun, 14 Jun 2020 13:01:46 -0700 (PDT) Received: from localhost.localdomain (79-139-237-54.dynamic.spd-mgts.ru. [79.139.237.54]) by smtp.gmail.com with ESMTPSA id 144sm1422105lfm.87.2020.06.14.13.01.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 13:01:46 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v2 5/5] =?utf-8?q?drm/tegra=3A_plane=3A_Support_180=C2=B0_ro?= =?utf-8?q?tation?= Date: Sun, 14 Jun 2020 23:01:21 +0300 Message-Id: <20200614200121.14147-6-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614200121.14147-1-digetx@gmail.com> References: <20200614200121.14147-1-digetx@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 15 Jun 2020 07:27:17 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Combining horizontal and vertical reflections gives us 180 degrees of rotation. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/dc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index f31bca27cde4..ddd9b88f8fce 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -608,6 +608,7 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, { struct tegra_plane_state *plane_state = to_tegra_plane_state(state); unsigned int rotation = DRM_MODE_ROTATE_0 | + DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; struct tegra_bo_tiling *tiling = &plane_state->tiling; @@ -659,6 +660,14 @@ static int tegra_plane_atomic_check(struct drm_plane *plane, else plane_state->reflect_y = false; + if (tegra_fb_is_bottom_up(state->fb)) + plane_state->reflect_y = true; + + if (rotation & DRM_MODE_ROTATE_180) { + plane_state->reflect_x = !plane_state->reflect_x; + plane_state->reflect_y = !plane_state->reflect_y; + } + /* * Tegra doesn't support different strides for U and V planes so we * error out if the user tries to display a framebuffer with such a @@ -720,7 +729,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane, window.dst.h = drm_rect_height(&plane->state->dst); window.bits_per_pixel = fb->format->cpp[0] * 8; window.reflect_x = state->reflect_x; - window.reflect_y = tegra_fb_is_bottom_up(fb) || state->reflect_y; + window.reflect_y = state->reflect_y; /* copy from state */ window.zpos = plane->state->normalized_zpos; @@ -806,6 +815,7 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | + DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); if (err < 0) @@ -1094,6 +1104,7 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm, err = drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | + DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); if (err < 0)