summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2019-05-28 05:03:00 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2019-06-12 14:30:30 -0400
commit1cd51b5d200dec292577a4656803d8aeff54ad51 (patch)
tree93c308be2f681545e7ccb82e77354cdff32f1a1f
parent9e1467002630065ed86c65ea28bfc9194fff6f0e (diff)
vgaswitcheroo: call fbcon_remap_all directly
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 <lukas@wunner.de> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Lukas Wunner <lukas@wunner.de> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com> Cc: Sean Paul <sean@poorly.run> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Yisheng Xie <ysxie@foxmail.com> Cc: linux-fbdev@vger.kernel.org Link: https://patchwork.freedesktop.org/patch/msgid/20190528090304.9388-30-daniel.vetter@ffwll.ch
-rw-r--r--drivers/gpu/vga/vga_switcheroo.c11
-rw-r--r--drivers/video/fbdev/core/fbcon.c14
-rw-r--r--include/linux/fb.h2
-rw-r--r--include/linux/fbcon.h2
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 @@
35#include <linux/debugfs.h> 35#include <linux/debugfs.h>
36#include <linux/fb.h> 36#include <linux/fb.h>
37#include <linux/fs.h> 37#include <linux/fs.h>
38#include <linux/fbcon.h>
38#include <linux/module.h> 39#include <linux/module.h>
39#include <linux/pci.h> 40#include <linux/pci.h>
40#include <linux/pm_domain.h> 41#include <linux/pm_domain.h>
@@ -736,14 +737,8 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
736 if (!active->driver_power_control) 737 if (!active->driver_power_control)
737 set_audio_state(active->id, VGA_SWITCHEROO_OFF); 738 set_audio_state(active->id, VGA_SWITCHEROO_OFF);
738 739
739 if (new_client->fb_info) { 740 if (new_client->fb_info)
740 struct fb_event event; 741 fbcon_remap_all(new_client->fb_info);
741
742 console_lock();
743 event.info = new_client->fb_info;
744 fb_notifier_call_chain(FB_EVENT_REMAP_ALL_CONSOLE, &event);
745 console_unlock();
746 }
747 742
748 mutex_lock(&vgasr_priv.mux_hw_lock); 743 mutex_lock(&vgasr_priv.mux_hw_lock);
749 ret = vgasr_priv.handler->switchto(new_client->id); 744 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 1837985e1ffb..44779a4371ee 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)
3149 do_unregister_con_driver(&fb_con); 3149 do_unregister_con_driver(&fb_con);
3150} 3150}
3151 3151
3152/* called with console_lock held */ 3152void fbcon_remap_all(struct fb_info *info)
3153static void fbcon_remap_all(int idx)
3154{ 3153{
3155 int i; 3154 int i, idx = info->node;
3156
3157 WARN_CONSOLE_UNLOCKED();
3158 3155
3156 console_lock();
3159 if (deferred_takeover) { 3157 if (deferred_takeover) {
3160 for (i = first_fb_vc; i <= last_fb_vc; i++) 3158 for (i = first_fb_vc; i <= last_fb_vc; i++)
3161 con2fb_map_boot[i] = idx; 3159 con2fb_map_boot[i] = idx;
3162 fbcon_map_override(); 3160 fbcon_map_override();
3161 console_unlock();
3163 return; 3162 return;
3164 } 3163 }
3165 3164
@@ -3172,6 +3171,7 @@ static void fbcon_remap_all(int idx)
3172 first_fb_vc + 1, last_fb_vc + 1); 3171 first_fb_vc + 1, last_fb_vc + 1);
3173 info_idx = idx; 3172 info_idx = idx;
3174 } 3173 }
3174 console_unlock();
3175} 3175}
3176 3176
3177#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY 3177#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
@@ -3337,10 +3337,6 @@ static int fbcon_event_notify(struct notifier_block *self,
3337 con2fb = event->data; 3337 con2fb = event->data;
3338 con2fb->framebuffer = con2fb_map[con2fb->console - 1]; 3338 con2fb->framebuffer = con2fb_map[con2fb->console - 1];
3339 break; 3339 break;
3340 case FB_EVENT_REMAP_ALL_CONSOLE:
3341 idx = info->node;
3342 fbcon_remap_all(idx);
3343 break;
3344 } 3340 }
3345 return ret; 3341 return ret;
3346} 3342}
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 {
139#define FB_EVENT_SET_CONSOLE_MAP 0x08 139#define FB_EVENT_SET_CONSOLE_MAP 0x08
140/* A display blank is requested */ 140/* A display blank is requested */
141#define FB_EVENT_BLANK 0x09 141#define FB_EVENT_BLANK 0x09
142/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga_switcheroo */
143#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
144/* A hardware display blank early change occurred */ 142/* A hardware display blank early change occurred */
145#define FB_EARLY_EVENT_BLANK 0x10 143#define FB_EARLY_EVENT_BLANK 0x10
146/* A hardware display blank revert early change occurred */ 144/* 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,
16 struct fb_blit_caps *caps); 16 struct fb_blit_caps *caps);
17void fbcon_fb_blanked(struct fb_info *info, int blank); 17void fbcon_fb_blanked(struct fb_info *info, int blank);
18void fbcon_update_vcs(struct fb_info *info, bool all); 18void fbcon_update_vcs(struct fb_info *info, bool all);
19void fbcon_remap_all(struct fb_info *info);
19#else 20#else
20static inline void fb_console_init(void) {} 21static inline void fb_console_init(void) {}
21static inline void fb_console_exit(void) {} 22static inline void fb_console_exit(void) {}
@@ -31,6 +32,7 @@ static inline void fbcon_get_requirement(struct fb_info *info,
31 struct fb_blit_caps *caps) {} 32 struct fb_blit_caps *caps) {}
32static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {} 33static inline void fbcon_fb_blanked(struct fb_info *info, int blank) {}
33static inline void fbcon_update_vcs(struct fb_info *info, bool all) {} 34static inline void fbcon_update_vcs(struct fb_info *info, bool all) {}
35static inline void fbcon_remap_all(struct fb_info *info) {}
34#endif 36#endif
35 37
36#endif /* _LINUX_FBCON_H */ 38#endif /* _LINUX_FBCON_H */