OSDN Git Service

vgaswitcheroo: call fbcon_remap_all directly
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 28 May 2019 09:03:00 +0000 (11:03 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 12 Jun 2019 18:30:30 +0000 (20:30 +0200)
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
drivers/gpu/vga/vga_switcheroo.c
drivers/video/fbdev/core/fbcon.c
include/linux/fb.h
include/linux/fbcon.h

index a132c37..65d7541 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/debugfs.h>
 #include <linux/fb.h>
 #include <linux/fs.h>
+#include <linux/fbcon.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/pm_domain.h>
@@ -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);
index 1837985..44779a4 100644 (file)
@@ -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;
 }
index f9c212f..25e4b88 100644 (file)
@@ -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 */
index de31eeb..69f900d 100644 (file)
@@ -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 */