Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4717470yba; Mon, 20 May 2019 02:29:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQ5i5EYZ8TOModTPXpiJX8urdeTHa+7UrgTQnE+AkrU/8npmZcOVJ426ChY6ezxkB1KxM/ X-Received: by 2002:a17:902:2bc9:: with SMTP id l67mr39028848plb.171.1558344551174; Mon, 20 May 2019 02:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558344551; cv=none; d=google.com; s=arc-20160816; b=hdkh7s1g5n0C9FMcV3DMD708HqxEy0zgHsiT5ZGu0id83odKN10N0aqkLk89fhl0K2 ZBc03qndREnBedX4cFD2ZN/gS/jRCXOXIj++a3FaC2QLjEtdgfBRSTUIhdmXPpVaT8tP lloLj2tLh6Uh5el/ygwD/mNb5jf0UvxryQNbv/FyvkhBsK1H2G0X30F0+5RTUX4xDTr+ hsrUeZvEji6Z1C4aiftTYHR9u8MlOcSsLED+bCYeb/OodTMJrp8N0pBFUJysytkjiovH +NrLrX+94AD1Sxl7L2TqlWNDH2Kl21Nz4OGbI0G+wMR2lIZTQR8skCmpBgel7HRD+16f PUsg== 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=gP9JWtZYIDChqhoaVz3EsPvoQXah1TnF7aRj3vegt3E=; b=aNL2IT4NFsfFzDFRlhSsKLaQhcNB+Vn8WCCflPHwetlERUVIoHOxVD8aSyiD9cHElC T3ZM7MsADW8O8RV7c5Ng9x5RdWu5ZPFC6EjDx5z0Y0q/FiN7pJrkUKIW4zyhiDEMEAYg uwUbiUVlnDfJlB8h0LBAeYL9pCFeBz2qEBzfZs/IwbTxPyvtvch3I4fk/uV5j8YXiJe6 YV2i1+uV3cWxcEQyAnNzBJdBMjIqeBsOl+0LIJGLjmVA5vcdBLs0jGcDwKIuBgCvSp4x hfydaB/dmIp2opoOb85z7VYkN3ImXqZ9a/nF7BZohjfIXl6Bt+INDkhw8RsSPEPfkONQ c6KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=BUP+ZVHp; 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 e15si17923103pge.578.2019.05.20.02.28.48; Mon, 20 May 2019 02:29:11 -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=BUP+ZVHp; 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 S1731508AbfETIXD (ORCPT + 99 others); Mon, 20 May 2019 04:23:03 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:43028 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731483AbfETIW7 (ORCPT ); Mon, 20 May 2019 04:22:59 -0400 Received: by mail-ed1-f68.google.com with SMTP id w33so22506194edb.10 for ; Mon, 20 May 2019 01:22:57 -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=gP9JWtZYIDChqhoaVz3EsPvoQXah1TnF7aRj3vegt3E=; b=BUP+ZVHpSa6cm0eQ2i5P1I8TI4De/3rS6Ui4iYSGE+J5pYNyl3gfHlOQEBrM87Khlv cmiALWLfTnw2dtMq3P7g/q1F6wThHrEk8buZl4oanGqblRMMZmgwQMeAsYNtDMNs4cwx qW8Cp2AQc8vCtMxYwY4yv2TiXOCexYNIQBfi4= 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=gP9JWtZYIDChqhoaVz3EsPvoQXah1TnF7aRj3vegt3E=; b=gzcTj4oztiR1A3gZJQjqY11OJcYT466LTth2Tuk0PbUnTLGPFvbbGvFFP+3X1c96jh x1ih6SZ6lTlWQwBNQDWsaLbjx1IqR02Eg3xGLOANEqWW3WGKL5oMtJuAQhccFp5nACCk bpUDJ9OFzJY3AORoCO6+AKdCRhkeULQnvPm4Wz7HndZYjbYCmu47lWN0iMsG4LJBwTnZ qWOWX1UFR0VXyHo/KzhELBt6sAw2dB/Ut+jGxcXO9NhhNzXug5KqRrzclpI5SrM3yHVw Gcx8KVR1jCKRf5IuWDXAcXFhch9aFMCxvl4N41N0bYM5rnLUuy/p9IRSwvcaDQqKKmZp BozQ== X-Gm-Message-State: APjAAAXt7pTypBn1/RnjRQvEm9UvtQ22PHRf4T2CASbCJbfqUNoTkCbR 9L09pWWy0kD4c754EggjRnd78w== X-Received: by 2002:a17:906:8311:: with SMTP id j17mr32001014ejx.227.1558340577317; Mon, 20 May 2019 01:22:57 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id t25sm3021263ejx.8.2019.05.20.01.22.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 01:22:56 -0700 (PDT) From: Daniel Vetter To: DRI Development Cc: Intel Graphics Development , LKML , Daniel Vetter , Daniel Vetter , Lukas Wunner , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Sean Paul , Bartlomiej Zolnierkiewicz , Hans de Goede , Yisheng Xie , linux-fbdev@vger.kernel.org Subject: [PATCH 30/33] vgaswitcheroo: call fbcon_remap_all directly Date: Mon, 20 May 2019 10:22:13 +0200 Message-Id: <20190520082216.26273-31-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190520082216.26273-1-daniel.vetter@ffwll.ch> References: <20190520082216.26273-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. Signed-off-by: Daniel Vetter 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 | 13 +++++-------- include/linux/fb.h | 2 -- include/linux/fbcon.h | 2 ++ 4 files changed, 10 insertions(+), 18 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 8cc62d340387..fd604ffb3c05 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -3146,16 +3146,16 @@ void fbcon_fb_unregistered(struct fb_info *info) } /* 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; } @@ -3168,6 +3168,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 @@ -3333,10 +3334,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 54d6bee09121..acd8daa23002 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -130,8 +130,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 daaa97b0c9e6..3f854e803746 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 @@ 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) {} #endif #endif /* _LINUX_FBCON_H */ -- 2.20.1