From patchwork Sat Nov 25 19:35:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 10076077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C1771602BD for ; Mon, 27 Nov 2017 08:33:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF59A28D9A for ; Mon, 27 Nov 2017 08:33:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A449428DA6; Mon, 27 Nov 2017 08:33:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 66DD428DA7 for ; Mon, 27 Nov 2017 08:33:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A98786E207; Mon, 27 Nov 2017 08:33:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2C716E13A; Sat, 25 Nov 2017 19:36:00 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id n74so2374158wmi.3; Sat, 25 Nov 2017 11:36:00 -0800 (PST) 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; bh=XT5gdNyha/fYz1paWvHk9Y2niFLhcgeCsm8Z3z4ne44=; b=RZLAQf8eLoAE4ytR3mlF07MpUjwZBwcg7nweQu/7UECg4o0MOvYlhDCI74YIq67OnQ NxB0n68zvhGVIWjMBpdDt8TLJpuecvyrFlri/uLbbTzldseIYiZhwC7gURfyccQ8a+Fz TkBSvY2oBBWcFHNC7OiM7+8FutzY2LZZnojjeLfOdxTpwERbWFo1Fuf/bb+A2NkUUpqM 9w3bv9rT2yaPFNb3NFUyVMRZBxvMnekISP04tUtJarEvgqtp5nY7q2V9Q7d28BIQuS66 9ZzDfw/9jUdSCKfbjEhty6D1iVh0b3Fz09V2eci3X544MRJ6eVUB2U4QRJ1FDrsl2Y2I f3cw== 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; bh=XT5gdNyha/fYz1paWvHk9Y2niFLhcgeCsm8Z3z4ne44=; b=lCBanDzGQiP1NZtPwHOXjDUTB2MPJ6zoScVKLm6XR+huAsLM6cfuJGcHsUYseDuwKp StM69JaFPQZvFeRkRQa6zdMvrBb/Tifu4gboNim1PcJ6GOPOfqVTN3ei9c2O9iuvu8jI 64tMeBG8TAFVffXiGM1bMxB+5agyJ4kGKUzUToLJiD+YLqGkn8TrtuO74/FR75Lb0o78 AcsqgMBLjecbPvvid88kWTVF2WTh/Y16W9kS44SxVjVv9Wye0JeYgFUyHroQ/CXf6neI whve4Vvdezz+StXCZep3BdJEpQXI+lnR5jCr5F5tzh71O/Wm4UcA9yArfoSFYoABofoJ tSug== X-Gm-Message-State: AJaThX4C4kCsMpYV4sSVw1/g10SgH9CBKefSEWB4YujRO963duHoWvxC Ze4RITLABo+iSpvfSIbdYy0= X-Google-Smtp-Source: AGs4zMaMvSU4B98rgW8/Y+/VlBARL4pNDHCrlPbdq428TtqKg1KxiHVLKwxn+miW1+x5VFARAUlncg== X-Received: by 10.28.178.85 with SMTP id b82mr12245523wmf.47.1511638559583; Sat, 25 Nov 2017 11:35:59 -0800 (PST) Received: from localhost.localdomain.com ([2001:470:7a95:4242:2c1c:b9eb:f8cb:6ccb]) by smtp.gmail.com with ESMTPSA id l142sm1835010wmb.43.2017.11.25.11.35.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 25 Nov 2017 11:35:58 -0800 (PST) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Daniel Vetter , Jani Nikula , Sean Paul , Dave Airlie , Bartlomiej Zolnierkiewicz Subject: [PATCH v7 1/7] fbcon: Add fbcon_rotate_hint to struct fb_info Date: Sat, 25 Nov 2017 20:35:47 +0100 Message-Id: <20171125193553.23986-2-hdegoede@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171125193553.23986-1-hdegoede@redhat.com> References: <20171125193553.23986-1-hdegoede@redhat.com> X-Mailman-Approved-At: Mon, 27 Nov 2017 08:33:34 +0000 Cc: Hans de Goede , intel-gfx , linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On some hardware the LCD panel is not mounted upright in the casing, but upside-down or rotated 90 degrees. In this case we want the console to automatically be rotated to compensate. The fbdev-driver may know about the need to rotate. Add a new fbcon_rotate_hint field to struct fb_info, which gets initialized to -1. If the fbdev-driver knows that some sort of rotation is necessary then it can set this field to a FB_ROTATE_* value to tell the fbcon console driver to rotate the console. Signed-off-by: Hans de Goede --- drivers/video/fbdev/core/fbcon.c | 18 ++++++++++++------ drivers/video/fbdev/core/fbsysfs.c | 1 + include/linux/fb.h | 5 +++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index 04612f938bab..fb317ed76b45 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -963,10 +963,13 @@ static const char *fbcon_startup(void) ops->cur_rotate = -1; ops->cur_blink_jiffies = HZ / 5; info->fbcon_par = ops; - if (initial_rotation != -1) - p->con_rotate = initial_rotation; - else + + p->con_rotate = initial_rotation; + if (p->con_rotate == -1) + p->con_rotate = info->fbcon_rotate_hint; + if (p->con_rotate == -1) p->con_rotate = fbcon_platform_get_rotate(info); + set_blitting_type(vc, info); if (info->fix.type != FB_TYPE_TEXT) { @@ -1103,10 +1106,13 @@ static void fbcon_init(struct vc_data *vc, int init) ops = info->fbcon_par; ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms); - if (initial_rotation != -1) - p->con_rotate = initial_rotation; - else + + p->con_rotate = initial_rotation; + if (p->con_rotate == -1) + p->con_rotate = info->fbcon_rotate_hint; + if (p->con_rotate == -1) p->con_rotate = fbcon_platform_get_rotate(info); + set_blitting_type(vc, info); cols = vc->vc_cols; diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 15755ce1d26c..e31a182b42bf 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -58,6 +58,7 @@ struct fb_info *framebuffer_alloc(size_t size, struct device *dev) info->par = p + fb_info_size; info->device = dev; + info->fbcon_rotate_hint = -1; #ifdef CONFIG_FB_BACKLIGHT mutex_init(&info->bl_curve_mutex); diff --git a/include/linux/fb.h b/include/linux/fb.h index bc24e48e396d..d1e5bed39140 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -465,6 +465,11 @@ struct fb_info { atomic_t count; int node; int flags; + /* + * -1 by default, set to a FB_ROTATE_* value by the driver, if it knows + * a lcd is not mounted upright and fbcon should rotate to compensate. + */ + int fbcon_rotate_hint; struct mutex lock; /* Lock for open/release/ioctl funcs */ struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */ struct fb_var_screeninfo var; /* Current var */