Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4766926ybi; Tue, 28 May 2019 02:06:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyB0d7cLhcwCfgLXzKG5rUjwKD+Jepiw92fPp2hSwl+0PeejrKS1kHalDFDCDfpupSCj0F2 X-Received: by 2002:a17:90a:b004:: with SMTP id x4mr4287054pjq.60.1559034397176; Tue, 28 May 2019 02:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559034397; cv=none; d=google.com; s=arc-20160816; b=azmTvrGyqXsdFAY1KiU3PcD0LehoUSY4glZx2pipsfaXoYbY/LaWFuntE5qN1ijQY8 99alVSeRRg5appXGCM2UGrasZrAjYqpINjQFb5tydoAbqujChu5TAOtxl0plIzAlECMk dxXoQkC+Px2IrcdUv3bDDQUDIWOnW/MWm66dYr5ipBBXcecLXx7tRLk3FU/ut7wawfeY EVpKVwCPU6zRC9EQnCeqEo4gnVVI6KoRRMr8Xkoq5vfZgWBJcE4MpFsxfP9/oLhjW6fB /++nIdYiJPpiIY7OA1QcM24K83ar/n6/+gE2TaTvkoCArlGs3LHT+pNj2gArrnbhIUOl R0NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cIvSBS1B4MGUlvtXGtjMOQmcHlrlcr23oBPyjEdIMqw=; b=OzugAlYd3mqPmRGKHLdNs26jCYpkbmZgL3o/B+QVQTXKVbhGeiOk2wQqyzmzU2JELv JcvJOx+T/EyPnfNhN7RXXgSYTYDuKorSS/prtE6FKKz7LeJAR/X0RnYA+Aar1WxdKlLR W7J4G9YO5Ovc0hxLoUPmndPm5oG4khtUCMGnuMzxmNJsyY8z2di+6SGIk/m4xR+l+qPc CRDm4KT8H9o9lrKyRttdgHvqZkzIeabnWqJU1XIqWTJhc14laTCx2AOLKaLBIlJEbYju 5Do9zcM97ZsiHMJgA5K5lIto6Qe8dTrUD7S/l1wsIW7ShCKmeh48pwNB5/7dd2Be7Qo7 LBEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=kEX1dBYs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g90si17051048plb.282.2019.05.28.02.06.21; Tue, 28 May 2019 02:06:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=kEX1dBYs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727290AbfE1JD6 (ORCPT + 99 others); Tue, 28 May 2019 05:03:58 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38172 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727218AbfE1JDz (ORCPT ); Tue, 28 May 2019 05:03:55 -0400 Received: by mail-ed1-f66.google.com with SMTP id g13so838094edu.5 for ; Tue, 28 May 2019 02:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cIvSBS1B4MGUlvtXGtjMOQmcHlrlcr23oBPyjEdIMqw=; b=kEX1dBYsfLZqMz1zXWP5urOCL4wj3GR50ijZkMz53o+IqxGumJznNh5bWHFqzz/57F g2GIL+FYqK5zeRJoDlXmOwePs6wvEYLvE/nkB5jnXi45FLkvBnGQbiXCyV5IfNvHSdoU Rfo20w4pFvtVPLYS9Hx6btvQPMdK9n+DhCJB0= 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=cIvSBS1B4MGUlvtXGtjMOQmcHlrlcr23oBPyjEdIMqw=; b=VOLb5pqXZzclXd1p4NiXsjJPNr51kAijn1xcr9078YFjCrkuTnvqrLhD93a0scjtUK 5oSBsmztY+PBn6y8+TXD+PCJfMpXfA3bYclP77wLfLUEuAhu3C51CeQ5QsfTZAyPieBr U1Wi0QbJ7JCvHdvvOJvzDULkT2GOmLmhx6MsMacY0NzJXShlqKVSoCe7UozkyGGM9ta9 vxtLdmHPSrX2aRbdic3VL80EsliZy5Prjvv2HvJ2VCKVt/fYb2p+38cWikq3dpm0tC7I l7CNL/dF9ZSSvJWbNeFcwG2EmuI1tD3XINB5A6MgC5Kvcs5SQJ+QwDPBRRZY8iaRcTBw 1ZmA== X-Gm-Message-State: APjAAAVSWZrXEitFPdsoWofm1TIMXKObLW/dpinlr5Z2AxBv7RU0UDTp FE7cpacJDZddqf9q3BvxPSnngSTVAsI= X-Received: by 2002:a17:906:f14a:: with SMTP id gw10mr94060688ejb.158.1559034233120; Tue, 28 May 2019 02:03:53 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id x49sm4072656edm.25.2019.05.28.02.03.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 May 2019 02:03:52 -0700 (PDT) From: Daniel Vetter To: LKML Cc: DRI Development , Intel Graphics Development , linux-fbdev@vger.kernel.org, Daniel Thompson , Bartlomiej Zolnierkiewicz , Daniel Vetter , Lukas Wunner , Daniel Vetter , Sam Ravnborg , Maarten Lankhorst , David Airlie , Daniel Vetter , Maxime Ripard , Sean Paul , Hans de Goede , Yisheng Xie Subject: [PATCH 29/33] vgaswitcheroo: call fbcon_remap_all directly Date: Tue, 28 May 2019 11:03:00 +0200 Message-Id: <20190528090304.9388-30-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190528090304.9388-1-daniel.vetter@ffwll.ch> References: <20190528090304.9388-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While at it, clean up the interface a bit and push the console locking into fbcon.c. v2: Remove now outdated comment (Lukas). v3: Forgot to add static inline to the dummy function. Acked-by: Lukas Wunner Signed-off-by: Daniel Vetter Reviewed-by: Sam Ravnborg Reviewed-by: Maarten Lankhorst Cc: Lukas Wunner Cc: David Airlie Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Sean Paul Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Yisheng Xie Cc: linux-fbdev@vger.kernel.org --- drivers/gpu/vga/vga_switcheroo.c | 11 +++-------- drivers/video/fbdev/core/fbcon.c | 14 +++++--------- include/linux/fb.h | 2 -- include/linux/fbcon.h | 2 ++ 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index a132c37d7334..65d7541c413a 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -736,14 +737,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client) if (!active->driver_power_control) set_audio_state(active->id, VGA_SWITCHEROO_OFF); - if (new_client->fb_info) { - struct fb_event event; - - console_lock(); - event.info = new_client->fb_info; - fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event); - console_unlock(); - } + if (new_client->fb_info) + fbcon_remap_all(new_client->fb_info); mutex_lock(&vgasr_priv.mux_hw_lock); ret = vgasr_priv.handler->switchto(new_client->id); diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index e98551f96138..158b9d5233e1 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3149,17 +3149,16 @@ void fbcon_fb_unregistered(struct fb_info *info) do_unregister_con_driver(&fb_con); } -/* called with console_lock held */ -static void fbcon_remap_all(int idx) +void fbcon_remap_all(struct fb_info *info) { - int i; - - WARN_CONSOLE_UNLOCKED(); + int i, idx = info->node; + console_lock(); if (deferred_takeover) { for (i = first_fb_vc; i <= last_fb_vc; i++) con2fb_map_boot[i] = idx; fbcon_map_override(); + console_unlock(); return; } @@ -3172,6 +3171,7 @@ static void fbcon_remap_all(int idx) first_fb_vc + 1, last_fb_vc + 1); info_idx = idx; } + console_unlock(); } #ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY @@ -3337,10 +3337,6 @@ static int fbcon_event_notify(struct notifier_block *self, con2fb = event->data; con2fb->framebuffer = con2fb_map[con2fb->console - 1]; break; - case FB_EVENT_REMAP_ALL_CONSOLE: - idx = info->node; - fbcon_remap_all(idx); - break; } return ret; } diff --git a/include/linux/fb.h b/include/linux/fb.h index f9c212f9b661..25e4b885f5b3 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -139,8 +139,6 @@ struct fb_cursor_user { #define FB_EVENT_SET_CONSOLE_MAP 0x08 /* A display blank is requested */ #define FB_EVENT_BLANK 0x09 -/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */ -#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F /* A hardware display blank early change occurred */ #define FB_EARLY_EVENT_BLANK 0x10 /* A hardware display blank revert early change occurred */ diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h index de31eeb22c97..69f900d289b2 100644 --- a/include/linux/fbcon.h +++ b/include/linux/fbcon.h @@ -16,6 +16,7 @@ void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps); void fbcon_fb_blanked(struct fb_info *info, int blank); void fbcon_update_vcs(struct fb_info *info, bool all); +void fbcon_remap_all(struct fb_info *info); #else static inline void fb_console_init(void) {} static inline void fb_console_exit(void) {} @@ -31,6 +32,7 @@ static inline void fbcon_get_requirement(struct fb_info *info, struct fb_blit_caps *caps) {} static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} static inline void fbcon_update_vcs(struct fb_info *info, bool all) {} +static inline void fbcon_remap_all(struct fb_info *info) {} #endif #endif /* _LINUX_FBCON_H */ -- 2.20.1