From patchwork Sun Jun 14 19:03:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604091 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 1C2AE1392 for ; Mon, 15 Jun 2020 07:29:03 +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 EE8012068E for ; Mon, 15 Jun 2020 07:29:02 +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="Iyjdkh0m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE8012068E 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 3EA696E2C0; 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-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8642189F9F for ; Sun, 14 Jun 2020 19:04:06 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id y11so16593641ljm.9 for ; Sun, 14 Jun 2020 12:04:06 -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=Iyjdkh0mbQkgHvVan288CrdQuoR5cmQ6FWASyvs8zcJCE/P0982J1hgDDiRYX1uRm/ Xi0HAcQBRfd1wIHERU96sEpt8gjq7PojpXhez1X8JjVxM2BFS/fuKeKQn0ihSWDUIcFX 0rvluEOhC/DEK1ym9mSfcZyoNYjhNBDino1i2qFcs17gLjU6mTm+UXbEkqsaSZmOR7pw QXkkn5C8FM4F9DBIH/IMhxcOKfVJ4sC2e9/t1QGKf6sPgL8pOnx5PXqo8Ie2mI1EMomG 2HkTkPJ+IvtjoqzgVnH/BhwEqQKuT7PTN5y61JySInVktU577Sqv4DH7ZVLoHn+7d5uu jJzw== 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=honqCBaEHE6PYXRkqLDl8Y27Z9FiOXM6iAKHpcuGbYQtlCp9huPhj+V60VBbAA5T0P tQEYd3irl7yi6AVFr64X9BNw5iSsRX1/mmJVqjXRAJv+wypHQiD2wJXA4wx9wNTlt32p aYiMAj27fWDHW4ZL5cwbAgxRaDeu/F/wSwf7R9P9AkXkhCf2MwSpyd1Lm/IXQbB+j5Ga 7lf5FT6iJYirJ1muNa/eTZKD4n5S+eZC+yNiAsonrEI55r3TZzy7w3tH4EuJ1HFSve6z 09LjuwlOVViuFbi8EG7fLS9/IO/TXa7GI5+XCU86smndeJhFAEB0s3x84eYFWBtxiB/Y oKIw== X-Gm-Message-State: AOAM531i1M6ojk0XmHZ78AdL0FagwM9Vjnb2qoTtJgy3SzrrwwkfGgYP k6KxFButsD/8XoICgOIRc5I= X-Google-Smtp-Source: ABdhPJzPp91GdqO3kCC1kc6IhuJKumRGs2/R0UkwI0FYu3XOpGGkrWqyTp55S7XHuA3La+NCL2rFtg== X-Received: by 2002:a2e:7311:: with SMTP id o17mr11125740ljc.35.1592161444972; Sun, 14 Jun 2020 12:04:04 -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 p15sm3410856ljn.53.2020.06.14.12.04.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 12:04:04 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v1 1/6] drm/panel: Add helper for reading DT rotation Date: Sun, 14 Jun 2020 22:03:43 +0300 Message-Id: <20200614190348.12193-2-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614190348.12193-1-digetx@gmail.com> References: <20200614190348.12193-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 19:03:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604043 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 11CAA1392 for ; Mon, 15 Jun 2020 07:28:20 +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 E46042068E for ; Mon, 15 Jun 2020 07:28:19 +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="JSKo+AQD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E46042068E 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 C709D6E21D; Mon, 15 Jun 2020 07:27:21 +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 7A72789F9F for ; Sun, 14 Jun 2020 19:04:07 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id z206so8237677lfc.6 for ; Sun, 14 Jun 2020 12:04:07 -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=Uf8zIpYQk6KPBTmw2T9hHkd8Lw+t/UJ+qTlgdHhWoBk=; b=JSKo+AQD/wnWM9r9qfNTqUfAg59MFyFM9IX0DGecmEWEI2dIyWaqjGuPe0qpaUINfG RiemcG9UV0J4yu9CjG3/hBQWsdzGPTXxROVLlJAz4+rB/NtD//k7jPh8/4JUXFkm3YxQ goq8H6zvW6yxBg764f5UnaI3mQ6kusB97ucVARx0tV0gxk0C0P8CDQmi4904gHweFN0s gUpeBo2zAjdqHkiHC29AUbFF46A38sRq6rAcgWMF+CuKh14wEXoQ45HwyPX396sBcGb9 lVChyNpnwPWMch4kmYbyJfG7CV1z8D9RTgYFtWU9DPPVcYrX7tuEDpkGK1JpA9vrytH3 fNUw== 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=Uf8zIpYQk6KPBTmw2T9hHkd8Lw+t/UJ+qTlgdHhWoBk=; b=T2A5EHkGTzt5ewxJh3L3GInUx6TkHPT3X+CdQ9T0iFHUycTfbVOkF7xU6O2TEsn3I8 4TyI4kZjz++Tz8XSoXQMRcNC7xgZV5+v7kKy3Rcvgv7uaJaxQnkqy+lIlqSq+AuSxby5 s8eu+iB7oKsGOYaRS4zI2nwTwzPVQA/eOgE2UpEm1Wvxc4NYmMoFRIj12I4kXaQjvwHs 02aIXbByP6PPSRR+55qwspb5by8VZnJ9ZqYORWB2D0cncsCDUqrBTvp9bmwiVbqRRhf4 fG21yFa5yogikO2FgQWdfWaV6Yf2KT7cY0m6cnCMKPRUGChdDHbqJ8/bcymyOSUX3MVf JgGQ== X-Gm-Message-State: AOAM531Y61qF3OK7p90e0LFiDhhkNzLF0061abVDKGWtjiPsH7NJChwM uyd8vumUqPW6djRUJ62P+mc= X-Google-Smtp-Source: ABdhPJzXALOkf+KtpKcHwrvfp97TmMlYrYZAJ9iaS0lOVua0wtnMBmER+SrdQOz85eR78w/RqAZx+w== X-Received: by 2002:a19:8253:: with SMTP id e80mr3203832lfd.199.1592161445925; Sun, 14 Jun 2020 12:04:05 -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 p15sm3410856ljn.53.2020.06.14.12.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 12:04:05 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v1 2/6] drm/panel: Set display info in panel attach Date: Sun, 14 Jun 2020 22:03:44 +0300 Message-Id: <20200614190348.12193-3-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614190348.12193-1-digetx@gmail.com> References: <20200614190348.12193-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 Devicetree systems can set panel orientation via a panel binding, but there's no way, as is, to propagate this setting to the connector, where the property need to be added. To address this, this patch sets orientation, as well as other fixed values for the panel, in the drm_panel_attach function. These values are stored from probe in the drm_panel struct. Signed-off-by: Derek Basehore Reviewed-by: Sam Ravnborg Tested-by: Dmitry Osipenko Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_panel.c | 13 ++++++++++ include/drm/drm_panel.h | 50 +++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 5557c75301f1..9748972f2e7c 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -114,6 +114,19 @@ EXPORT_SYMBOL(drm_panel_remove); */ int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector) { + struct drm_display_info *info; + + info = &connector->display_info; + info->width_mm = panel->width_mm; + info->height_mm = panel->height_mm; + info->bpc = panel->bpc; + info->panel_orientation = panel->orientation; + info->bus_flags = panel->bus_flags; + if (panel->bus_formats) + drm_display_info_set_bus_formats(&connector->display_info, + panel->bus_formats, + panel->num_bus_formats); + return 0; } EXPORT_SYMBOL(drm_panel_attach); diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 781c735f0f9b..97ac5f12a07c 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -165,6 +165,56 @@ struct drm_panel { */ int connector_type; + /** + * @width_mm: + * + * Physical width in mm. + */ + unsigned int width_mm; + + /** + * @height_mm: + * + * Physical height in mm. + */ + unsigned int height_mm; + + /** + * @bpc: + * + * Maximum bits per color channel. Used by HDMI and DP outputs. + */ + unsigned int bpc; + + /** + * @orientation + * + * Installation orientation of the panel with respect to the chassis. + */ + int orientation; + + /** + * @bus_formats + * + * Pixel data format on the wire. + */ + const u32 *bus_formats; + + /** + * @num_bus_formats: + * + * Number of elements pointed to by @bus_formats + */ + unsigned int num_bus_formats; + + /** + * @bus_flags: + * + * Additional information (like pixel signal polarity) for the pixel + * data on the bus. + */ + u32 bus_flags; + /** * @list: * From patchwork Sun Jun 14 19:03:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604013 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 0564F13B1 for ; Mon, 15 Jun 2020 07:27:51 +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 D68302068E for ; Mon, 15 Jun 2020 07:27:50 +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="tDyw/Z0N" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D68302068E 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 7A65A6E1C4; Mon, 15 Jun 2020 07:27:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B12C89F9F for ; Sun, 14 Jun 2020 19:04:08 +0000 (UTC) Received: by mail-lf1-x144.google.com with SMTP id z206so8237692lfc.6 for ; Sun, 14 Jun 2020 12:04:08 -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=ofH5y+DsAUKO47Nkj6CHgyEmv07V+x06WqiTKtmxkz8=; b=tDyw/Z0NbyseYNFw0tmkDEmK0+rdlxT3B6Rx0ogIl0xtyfgXfz6h1CglbOficaxF7j opyTD6xXyzEhidGf0dAsVGJxGEJLW+5tIFSWwFwYrEUtVp4RkJQwNVuVPpfTsfi/xGRg lUvTrWWu5SISnnOknRogcrt75rMJBefk8sfOvpjnv1LtW5WIFo4NOx7jmgZESMgNxw0m NRa2NWMragB95iD4zcf3Z2hYf4HA+Tph53CfFfyTJPB0ELrZ8dR4ekL6nrFaB6DJ0fd1 0HwkduwlYNPJdXHLlJHsa+VPG52wtU8H9fgC4wvWWAQQKdVLbiS8fWkw//BeawlVZBdF OZUA== 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=ofH5y+DsAUKO47Nkj6CHgyEmv07V+x06WqiTKtmxkz8=; b=YSe+8KI+YBzUk5QeJ8lpTZj1zghcINPhak4COALGs8QsA1FZaw22LETMo1zjQCHM/1 f8931k1qOljqXlZE41CatDZXUf9ByCDarB1zhXrOSVF7Qs7yJrQ+APDdOFjjsiUilJoB GSubWhGNHbqnNlSLvCFNbZ3GKCEeD1qc8xkk24ELakb5x0opuBGBbccHreGV1MfJkRuE GBWbAnJ6usf2IGDWdUXVy+WpXWlQaoXhUwhk35uPuGzconnNZjm0yhnCZSS+mFipaeV1 7rQHBTxDI8hJteB3rUohAFef10CJX49UECqlJjUlLokP7fWaEoO/AlbWmwEZOVM1hjoC 1SEA== X-Gm-Message-State: AOAM533qM+hAxjMr8q9cnutqZDwRlTC4YlZNE3j+RVv0eu6hqjdUAB1B R1DQxFuSO087EWiAqq2AIJ4= X-Google-Smtp-Source: ABdhPJwnG7yAfF3RYIYSWw/kDrX3Tt8hscqrxTuGTxm3j3w/fphxrbebeuo7y9inPvrpN1G6fHc9Ew== X-Received: by 2002:a19:7612:: with SMTP id c18mr11900032lff.7.1592161446900; Sun, 14 Jun 2020 12:04:06 -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 p15sm3410856ljn.53.2020.06.14.12.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 12:04:06 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v1 3/6] drm/panel: lvds: Set up panel orientation Date: Sun, 14 Jun 2020 22:03:45 +0300 Message-Id: <20200614190348.12193-4-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614190348.12193-1-digetx@gmail.com> References: <20200614190348.12193-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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 5ce3f4a2b7a1..9421246ac80f 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -99,6 +99,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->panel.orientation); return 1; } @@ -223,6 +224,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->panel.orientation); + if (ret) + return ret; + ret = drm_panel_of_backlight(&lvds->panel); if (ret) return ret; From patchwork Sun Jun 14 19:03:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604035 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 98ED11392 for ; Mon, 15 Jun 2020 07:28:12 +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 770F82068E for ; Mon, 15 Jun 2020 07:28:12 +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="lWA21eD5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 770F82068E 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 C35716E0D1; Mon, 15 Jun 2020 07:27:19 +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 AB80F89FAD for ; Sun, 14 Jun 2020 19:04:09 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id n23so16547603ljh.7 for ; Sun, 14 Jun 2020 12:04:09 -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=lWA21eD5Zk5I44oSNWVi8lPf1+OiG9NoVYobu2YDCitzaIbXYxMWu6KCSGjP2CfwXR Yyi98taZ/99CCIdTM04RG3JncNPOBcJThLWBsTq0ka+1tOFxHhAMERjhmS/ym4mCVRnD mr/VlnBHemWMS/Y5rNS5LTd0gfrajlTAxoGA51gVt0h1pWbG3Ay6q8hbYhyMghmPrtBD vAys9NzIkmhguLsQDydvcjIh5hakbQyNG5HWvpNNgUrvRPX6KRJ8IF3C8kl4TwtPAE27 FiQDOr7ZaOIcJ+Bz4n0pdU0SXYAiEHhlmXYEcur1VkD5AhG87InFCfqmOOX2X89wFf2/ kYhw== 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=IOc6U0z4ZxumvC3fIAtITxYqb516VUVSPcteL+PxMMi+HeUi7JnkPD2oAE9GncJx+c dSIpM4WxmvQBaj7vf9yD0CltXw/IQGHCa435cWIrrk/ux4IQLuImwAAQCSESYCfx9iNp y/PfzI9httDtCqNbcGq6ayOOUHNAB3MZdCIxSUlIARNgZZuAAsNCXqYICaKy/+4r2FyO e3cm6rStk1698FVjVQbtHhexLrEnOFZ8RK8XChtQcpTsXoe8yDW8h4D4SAei7E3H8O0Q 5cddeCgZLp/Gt3aFDhOrn8Tz+aPwLIyr57bThR47jyYM8Oy8ULcPyUBPfgZFfgXG9nLy UXVQ== X-Gm-Message-State: AOAM530PqOBv82CowuHB52VthKEZYm1+or9Vr8ZtnDyJgz34yyc9jQUJ C8MS8PYuSRcMD22RWGg577w= X-Google-Smtp-Source: ABdhPJydq3O7wM9zT04En/+a1wqWXkBZL51pkj7tiQD3UNNMIhI879CJqKO/A2fgNVQHGp4WYUhJNw== X-Received: by 2002:a2e:8705:: with SMTP id m5mr10782304lji.269.1592161447898; Sun, 14 Jun 2020 12:04:07 -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 p15sm3410856ljn.53.2020.06.14.12.04.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 12:04:07 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v1 4/6] drm/tegra: plane: Rename bottom_up to reflect_y Date: Sun, 14 Jun 2020 22:03:46 +0300 Message-Id: <20200614190348.12193-5-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614190348.12193-1-digetx@gmail.com> References: <20200614190348.12193-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 19:03:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604059 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 4C278913 for ; Mon, 15 Jun 2020 07:28:37 +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 2A11F2068E for ; Mon, 15 Jun 2020 07:28:37 +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="Cp+Gd07S" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A11F2068E 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 68B2A6E290; Mon, 15 Jun 2020 07:27:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id 749A489FAD for ; Sun, 14 Jun 2020 19:04:10 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id t74so642635lff.2 for ; Sun, 14 Jun 2020 12:04:10 -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=Cp+Gd07SBw9hSPEujgevVcOyWCocSb8AE/x3IHu8df9vPU4L80W7M4vTmH3z8C5QZo sUwDBB1USSZa8/cRaTnUDXQQh26YkN9PcTptM7CRUh0Hlypdw0iYtKz0m5PHo9saGd34 f7LuEUID+FA4+nCs13JgBvmjoVLBPVG3E0OzL3zqHyDfnGYp6GqPaVn1yMlannrwdSQj uaS/ZdJiGJAy5IMSi1N/f4RiuZbW8R4cYXz/HApJ4FrP5vfc9G4VzMk0zPDmGaptxbLR 0iDcSNq6vBdY4cUMXIlEGALaMgAh1z9P3IzZiCaB9tHEPlpuQseCx6Fvhl4lXfXPltJh n/vQ== 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=rCofBTSjfwaga5HJHl15zXVEXY9qT3O22OMBnti/wLrfoy2mlINEf3XlvcDFe89n5/ u8ZGtsft9U9nFUqRdK1HXiAvXzrgviknyrHOGd2omhQEBgvnz1VWoTd79GqK62m0WyKC k7SZ5nstW3FaT7r6oB/h9bz8ZiXpMX80N4HrHeJ8WM8u9+U/RaX3ls7ciETGrOltb3oV BS4RholiY4B9mAAD/ECRln5+xoL+3+GmvXP77z6Zdzkq72MH3XaUkGWL3Pbpj58kCOkF J+Sj2dQXEPE9xhyQ8S6boEkXBV8K0l1fiGGfGSrRVKSOVF8pD7ywM9l5N6xvS2Lf27k3 4xjQ== X-Gm-Message-State: AOAM530sVlWJy/XyM3olOuBHTK+j8vL+FTNjpe97mE6kiC8Gff0RzIOy 1OlAk5q+bil/t8/LOGHe2oQ= X-Google-Smtp-Source: ABdhPJyiXu1TKbJxhwNWXMC6HYJcqRA74MiBjR//OFPlqWLa+1PMQnVOxILMzoDr1ib24Jk+ABNhDA== X-Received: by 2002:ac2:485a:: with SMTP id 26mr12022269lfy.57.1592161448852; Sun, 14 Jun 2020 12:04:08 -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 p15sm3410856ljn.53.2020.06.14.12.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 12:04:08 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v1 5/6] drm/tegra: plane: Support horizontal reflection mode Date: Sun, 14 Jun 2020 22:03:47 +0300 Message-Id: <20200614190348.12193-6-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614190348.12193-1-digetx@gmail.com> References: <20200614190348.12193-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 19:03:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 11604065 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 E8646913 for ; Mon, 15 Jun 2020 07:28:40 +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 C66B320707 for ; Mon, 15 Jun 2020 07:28:40 +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="ACmbn+5L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C66B320707 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 76A616E2E8; Mon, 15 Jun 2020 07:27:29 +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 87A4889FBC for ; Sun, 14 Jun 2020 19:04:11 +0000 (UTC) Received: by mail-lj1-x242.google.com with SMTP id y11so16593770ljm.9 for ; Sun, 14 Jun 2020 12:04:11 -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=ACmbn+5LXY4ZgSyB5eD2v8bAUH7BhdjMukZJxujxn21BKNuQCWiZ6pskW4u3Tm5yr0 tDiPjS6qceDlCgDUbJgscgg2oTd5+P+OKeH6aTet8up1loIk7GrZbca3gwLO6ZWhtC6k 9DBOA9ckjUqT0Hw5EeYNOvsiUYVNxxeWEPZ9ycUTi8JEGh9wjMhDi5c7Sz53SMGozPTz 7ObH4sMO3A2aHTAMMmPDsjHZZ/kqv8nbR5PqpesorGkwfOGlhTZchvKwB+EtvAGaMEm2 SNmyqRbk4oasOKl1C6l2Aefo6oBLjDcj19++pAZE3rLyK1NK1BN6ZOUpXqoF3Zvq7Z0e s5sw== 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=OGsuUdZj3LnelnHbQOMH+J3immivGmBxRFUIcDt3WYgLgytGAAT/TbAJ6QZCnfMeWk RIUn3MnAA2dEAOghVnraUJYxrvI/QVmFsVs5BSu+UzqO92Wx3G/emsQ7K5+zDq30eqWP Xf2yzN9/7oDQBkbxZb1JiOuRX7uch+lf+GOT7OGWhYMwWOXzO2KMxKns102jy/WGi1/c W3uBkVdkrtLbbjK6a2Zof0z1gxv/AG6O/LVaMHw9E9jorQWML/Kntu3AZJanpie02dOP XaQ/yE7+G+E99N48sWoh2DOvWw3MUa7SE33y/clDz47GBObtEZ9SEtnm8H/J6izdZZMb Zl6g== X-Gm-Message-State: AOAM5305bmk5oFPC5T4oTnpyQeUpp+mY7+macUy+GwU71MlAZUISG7pQ aFR7zFOHRUXP0nJbwf8u6Wo= X-Google-Smtp-Source: ABdhPJxQT3G2mCw18H746uY1ijS4rGlw8gNoDzHcB1Pz3EhK7VWgAyWf/terviKuL7YatcalbXOC6Q== X-Received: by 2002:a2e:6c12:: with SMTP id h18mr11938124ljc.62.1592161449972; Sun, 14 Jun 2020 12:04:09 -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 p15sm3410856ljn.53.2020.06.14.12.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2020 12:04:09 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Thomas Zimmermann , Derek Basehore , Sam Ravnborg , Laurent Pinchart , Sean Paul Subject: [PATCH v1 6/6] =?utf-8?q?drm/tegra=3A_plane=3A_Support_180=C2=B0_ro?= =?utf-8?q?tation?= Date: Sun, 14 Jun 2020 22:03:48 +0300 Message-Id: <20200614190348.12193-7-digetx@gmail.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200614190348.12193-1-digetx@gmail.com> References: <20200614190348.12193-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)