From patchwork Mon Oct 23 09:24:56 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: 10023589 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 1F373601E8 for ; Tue, 24 Oct 2017 07:38:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10AF828995 for ; Tue, 24 Oct 2017 07:38:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 057F528998; Tue, 24 Oct 2017 07:38:14 +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 BD5B628995 for ; Tue, 24 Oct 2017 07:38:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 328CD6E3F7; Tue, 24 Oct 2017 07:37:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id D44586E320; Mon, 23 Oct 2017 09:25:10 +0000 (UTC) Received: by mail-wr0-x242.google.com with SMTP id y39so16612337wrd.4; Mon, 23 Oct 2017 02:25: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; bh=3wtasRbZk/hHnJjvV/SacDRGi5aWzMqwHV0fNXEoA1c=; b=cXqXDt8R7JeXGtph9ejM6mjkac/JaltrXnX7qALFPrqxzHvtvZNyg7ecKEzEiPI0xs 7uj+h+ZJN0qxySEx6VAHimO/Epe34ueYOc7S8J+vtWkDNBy4PfmsbfnTja61AtfGZRNV 7PXy/2fKlOc4+X7SuiE+dghB3dYBBSyN43LgDsmsajAn04BESbvl0tkYCEav9kFWl7UY s9l9Zz+9wXI6e6o24hFi5p6Ok2vGyKhQTQ7sHOeS79l10+jyW8ARSyns85l8x7IWC7UH VkcJApCboWEZDzP93njjPohCdfXjhSn0YlYMRzsZaUANU3CLQanJ0GjI4jb63jq54Nch 4qAg== 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=3wtasRbZk/hHnJjvV/SacDRGi5aWzMqwHV0fNXEoA1c=; b=jD20cLpEGWSqE4RbiN8Qnceop6q/2wDnOW1Z5thM0tr2OaSGFC/a0yDTn2zscjCWY+ m3GlqJ4G2QdduTZ+guY8UXl6aTS7/oTEka3a3q3YlzbCw8j21hIXrr0qx9lYwHYzgXDw I2rug96phYqzZJdWnDqP9nyNfTjwjUL4EMCdeu9mIVlDEsP3w+LGUNElJbDN+HlFiue6 TOMroNeqlJ9X4cufhbf7HVCI76yF3wH8kQbJuohUOrdKb49gXSD6rDmVKQOMSS2h+B+X 4Wbk6Oq0OgdciogPYi9KnV9SLgEo1jJKkdEQKGwelPrX1J/VosYp+JuwQbHXQA3mU3jm jzIg== X-Gm-Message-State: AMCzsaXdP8x6/nBMKK/hEDnKEJvHyg5ffJWWEPhj+/n5FeADxvagPZen er2fCsn/OJY9GvXweI7zVK4= X-Google-Smtp-Source: ABhQp+RhrxsNAvsNdNnCJEBJoXMUMNh3c8ii02WYmQtBc2zQva0oYUyjlG81WNEQLuFTtZSVprS3qg== X-Received: by 10.223.196.174 with SMTP id m43mr4745470wrf.7.1508750709287; Mon, 23 Oct 2017 02:25:09 -0700 (PDT) Received: from shalem.localdomain.com (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id t143sm2870584wmt.45.2017.10.23.02.25.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 02:25:08 -0700 (PDT) From: Hans de Goede X-Google-Original-From: Hans de Goede To: Daniel Vetter , Jani Nikula , Sean Paul , David Airlie , Bartlomiej Zolnierkiewicz Subject: [PATCH v4 1/7] fbcon: Add fbcon_rotate_hint to struct fb_info Date: Mon, 23 Oct 2017 11:24:56 +0200 Message-Id: <20171023092502.1095-2-hdegoede@redhat.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171023092502.1095-1-hdegoede@redhat.com> References: <20171023092502.1095-1-hdegoede@redhat.com> X-Mailman-Approved-At: Tue, 24 Oct 2017 07:36:57 +0000 Cc: linux-fbdev@vger.kernel.org, intel-gfx , dri-devel@lists.freedesktop.org, Daniel Drake , Hans de Goede , Bastien Nocera 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 f4386b0ccf40..10cf71cc5d13 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -464,6 +464,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 */