[PATCH 0/4] Make fbcon a built-time depency for fbdev, take 2

STALE3308d

21 messages, 5 authors, 2017-08-01 · open the first message on its own page

[PATCH 0/4] Make fbcon a built-time depency for fbdev, take 2

From: Daniel Vetter <hidden>
Date: 2017-07-06 12:57:31

Hi all,

So the original simple hack failed and we need to do a bit more. This time
tested including depmod for all combos. And since I had the pleasure to read
more fbdev code, 3 simple patches on top to clean up some more.

Cheers, Daniel

Daniel Vetter (4):
  fbcon: Make fbcon a built-time depency for fbdev
  fbdev: Nuke FBINFO_MODULE
  drm/qxl: Drop fbdev hwaccel flags
  drm/<drivers>: Drop fbdev info flags

 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c               |  1 -
 drivers/gpu/drm/armada/armada_fbdev.c                |  1 -
 drivers/gpu/drm/ast/ast_fb.c                         |  1 -
 drivers/gpu/drm/bochs/bochs_fbdev.c                  |  1 -
 drivers/gpu/drm/cirrus/cirrus_fbdev.c                |  1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c    |  1 -
 drivers/gpu/drm/i915/intel_fbdev.c                   |  1 -
 drivers/gpu/drm/mgag200/mgag200_fb.c                 |  1 -
 drivers/gpu/drm/msm/msm_fbdev.c                      |  1 -
 drivers/gpu/drm/omapdrm/omap_fbdev.c                 |  1 -
 drivers/gpu/drm/qxl/qxl_fb.c                         |  1 -
 drivers/gpu/drm/radeon/radeon_fb.c                   |  1 -
 drivers/gpu/drm/udl/udl_fb.c                         |  1 -
 drivers/gpu/drm/virtio/virtgpu_fb.c                  |  1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c                   |  1 -
 drivers/video/console/Kconfig                        |  2 +-
 drivers/video/console/Makefile                       |  8 --------
 drivers/video/fbdev/core/Makefile                    | 11 +++++++++++
 drivers/video/{console => fbdev/core}/bitblit.c      |  4 ----
 drivers/video/{console => fbdev/core}/fbcon.c        | 15 ++++-----------
 drivers/video/{console => fbdev/core}/fbcon.h        |  0
 drivers/video/{console => fbdev/core}/fbcon_ccw.c    |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_cw.c     |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_rotate.c |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_rotate.h |  0
 drivers/video/{console => fbdev/core}/fbcon_ud.c     |  4 ----
 drivers/video/fbdev/core/fbmem.c                     | 10 ++++++++--
 drivers/video/{console => fbdev/core}/softcursor.c   |  4 ----
 drivers/video/{console => fbdev/core}/tileblit.c     |  5 -----
 include/linux/fb.h                                   |  7 +------
 include/linux/fbcon.h                                | 12 ++++++++++++
 31 files changed, 37 insertions(+), 72 deletions(-)
 rename drivers/video/{console => fbdev/core}/bitblit.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon.c (99%)
 rename drivers/video/{console => fbdev/core}/fbcon.h (100%)
 rename drivers/video/{console => fbdev/core}/fbcon_ccw.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon_cw.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon_rotate.c (95%)
 rename drivers/video/{console => fbdev/core}/fbcon_rotate.h (100%)
 rename drivers/video/{console => fbdev/core}/fbcon_ud.c (98%)
 rename drivers/video/{console => fbdev/core}/softcursor.c (93%)
 rename drivers/video/{console => fbdev/core}/tileblit.c (96%)
 create mode 100644 include/linux/fbcon.h

-- 
2.13.2

[PATCH 1/4] fbcon: Make fbcon a built-time depency for fbdev

From: Daniel Vetter <hidden>
Date: 2017-07-06 12:57:32

There's a bunch of folks who're trying to make printk less
contended and faster, but there's a problem: printk uses the
console_lock, and the console lock has become the BKL for all things
fbdev/fbcon, which in turn pulled in half the drm subsystem under that
lock. That's awkward.

There reasons for that is probably just a historical accident:

- fbcon is a runtime option of fbdev, i.e. at runtime you can pick
  whether your fbdev driver instances are used as kernel consoles.
  Unfortunately this wasn't implemented with some module option, but
  through some module loading magic: As long as you don't load
  fbcon.ko, there's no fbdev console support, but loading it (in any
  order wrt fbdev drivers) will create console instances for all fbdev
  drivers.

- This was implemented through a notifier chain. fbcon.ko enumerates
  all fbdev instances at load time and also registers itself as
  listener in the fbdev notifier. The fbdev core tries to register new
  fbdev instances with fbcon using the notifier.

- On top of that the modifier chain is also used at runtime by the
  fbdev subsystem to e.g. control backlights for panels.

- The problem is that the notifier puts a mutex locking context
  between fbdev and fbcon, which mixes up the locking contexts for
  both the runtime usage and the register time usage to notify fbcon.
  And at runtime fbcon (through the fbdev core) might call into the
  notifier from a printk critical section while console_lock is held.

- This means console_lock must be an outer lock for the entire fbdev
  subsystem, which also means it must be acquired when registering a
  new framebuffer driver as the outermost lock since we might call
  into fbcon (through the notifier) which would result in a locking
  inversion if fbcon would acquire the console_lock from its notifier
  callback (which it needs to register the console).

- console_lock can be held anywhere, since printk can be called
  anywhere, and through the above story, plus drm/kms being an fbdev
  driver, we pull in a shocking amount of locking hiercharchy
  underneath the console_lock. Which makes cleaning up printk really
  hard (not even splitting console_lock into an rwsem is all that
  useful due to this).

There's various ways to address this, but the cleanest would be to
make fbcon a compile-time option, where fbdev directly calls the fbcon
register functions from register_framebuffer, or dummy static inline
versions if fbcon is disabled. Maybe augmented with a runtime knob to
disable fbcon, if that's needed (for debugging perhaps).

But this could break some users who rely on the magic "loading
fbcon.ko enables/disables fbdev framebuffers at runtime" thing, even
if that's unlikely. Hence we must be careful:

1. Create a compile-time dependency between fbcon and fbdev in the
least minimal way. This is what this patch does.

2. Wait at least 1 year to give possible users time to scream about
how we broke their setup. Unlikely, since all distros make fbcon
compile-in, and embedded platforms only compile stuff they know they
need anyway. But still.

3. Convert the notifier to direct functions calls, with dummy static
inlines if fbcon is disabled. We'll still need the fb notifier for the
other uses (like backlights), but we can probably move it into the fb
core (atm it must be built-into vmlinux).

4. Push console_lock down the call-chain, until it is down in
console_register again.

5. Finally start to clean up and rework the printk/console locking.

For context of this saga see

commit 50e244cc793d511b86adea24972f3a7264cae114
Author: Alan Cox [off-list ref]
Date:   Fri Jan 25 10:28:15 2013 +1000

    fb: rework locking to fix lock ordering on takeover

plus the pile of commits on top that tried to make this all work
without terminally upsetting lockdep. We've uncovered all this when
console_lock lockdep annotations where added in

commit daee779718a319ff9f83e1ba3339334ac650bb22
Author: Daniel Vetter [off-list ref]
Date:   Sat Sep 22 19:52:11 2012 +0200

    console: implement lockdep support for console_lock

On the patch itself:
- Switch CONFIG_FRAMEBUFFER_CONSOLE to be a boolean, using the overall
  CONFIG_FB tristate to decided whether it should be a module or
  built-in.

- At first I thought I could force the build depency with just a dummy
  symbol that fbcon.ko exports and fb.ko uses. But that leads to a
  module depency cycle (it works fine when built-in).

  Since this tight binding is the entire goal the simplest solution is
  to move all the fbcon modules (and there's a bunch of optinal
  source-files which are each modules of their own, for no good
  reason) into the overall fb.ko core module. That's a bit more than
  what I would have liked to do in this patch, but oh well.

Cc: Alan Cox <redacted>
Cc: Sergey Senozhatsky <redacted>
Cc: Linux Fbdev development list <redacted>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <redacted>
---
v2: Switch to building fbcon code into fb.ko right away because the
cheap trick leads to a module depency loop.
---
 drivers/video/console/Kconfig                        |  2 +-
 drivers/video/console/Makefile                       |  8 --------
 drivers/video/fbdev/core/Makefile                    | 11 +++++++++++
 drivers/video/{console => fbdev/core}/bitblit.c      |  4 ----
 drivers/video/{console => fbdev/core}/fbcon.c        | 13 +++----------
 drivers/video/{console => fbdev/core}/fbcon.h        |  0
 drivers/video/{console => fbdev/core}/fbcon_ccw.c    |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_cw.c     |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_rotate.c |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_rotate.h |  0
 drivers/video/{console => fbdev/core}/fbcon_ud.c     |  4 ----
 drivers/video/fbdev/core/fbmem.c                     |  6 ++++++
 drivers/video/{console => fbdev/core}/softcursor.c   |  4 ----
 drivers/video/{console => fbdev/core}/tileblit.c     |  5 -----
 include/linux/fbcon.h                                | 12 ++++++++++++
 15 files changed, 33 insertions(+), 48 deletions(-)
 rename drivers/video/{console => fbdev/core}/bitblit.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon.c (99%)
 rename drivers/video/{console => fbdev/core}/fbcon.h (100%)
 rename drivers/video/{console => fbdev/core}/fbcon_ccw.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon_cw.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon_rotate.c (95%)
 rename drivers/video/{console => fbdev/core}/fbcon_rotate.h (100%)
 rename drivers/video/{console => fbdev/core}/fbcon_ud.c (98%)
 rename drivers/video/{console => fbdev/core}/softcursor.c (93%)
 rename drivers/video/{console => fbdev/core}/tileblit.c (96%)
 create mode 100644 include/linux/fbcon.h
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 2111d06f8c81..7f1f1fbcef9e 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -117,7 +117,7 @@ config DUMMY_CONSOLE_ROWS
           Select 25 if you use a 640x480 resolution by default.
 
 config FRAMEBUFFER_CONSOLE
-	tristate "Framebuffer Console support"
+	bool "Framebuffer Console support"
 	depends on FB && !UML
 	select VT_HW_CONSOLE_BINDING
 	select CRC32
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 43bfa485db96..eb2cbec52643 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -7,13 +7,5 @@ obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o
 obj-$(CONFIG_STI_CONSOLE)         += sticon.o sticore.o
 obj-$(CONFIG_VGA_CONSOLE)         += vgacon.o
 obj-$(CONFIG_MDA_CONSOLE)         += mdacon.o
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o softcursor.o
-ifeq ($(CONFIG_FB_TILEBLITTING),y)
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE)     += tileblit.o
-endif
-ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y)
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE)     += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \
-                                         fbcon_ccw.o
-endif
 
 obj-$(CONFIG_FB_STI)              += sticore.o
diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile
index 9e3ddf225393..0214b863ac3f 100644
--- a/drivers/video/fbdev/core/Makefile
+++ b/drivers/video/fbdev/core/Makefile
@@ -4,6 +4,17 @@ obj-$(CONFIG_FB)                  += fb.o
 fb-y                              := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
                                      modedb.o fbcvt.o
 fb-$(CONFIG_FB_DEFERRED_IO)       += fb_defio.o
+
+ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE),y)
+fb-y				  += fbcon.o bitblit.o softcursor.o
+ifeq ($(CONFIG_FB_TILEBLITTING),y)
+fb-y				  += tileblit.o
+endif
+ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y)
+fb-y				  += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \
+				     fbcon_ccw.o
+endif
+endif
 fb-objs                           := $(fb-y)
 
 obj-$(CONFIG_FB_CFB_FILLRECT)  += cfbfillrect.o
diff --git a/drivers/video/console/bitblit.c b/drivers/video/fbdev/core/bitblit.c
similarity index 98%
rename from drivers/video/console/bitblit.c
rename to drivers/video/fbdev/core/bitblit.c
index dbfe4eecf12e..99f3a1c3d093 100644
--- a/drivers/video/console/bitblit.c
+++ b/drivers/video/fbdev/core/bitblit.c
@@ -416,7 +416,3 @@ void fbcon_set_bitops(struct fbcon_ops *ops)
 
 EXPORT_SYMBOL(fbcon_set_bitops);
 
-MODULE_AUTHOR("Antonino Daplas <adaplas@pol.net>");
-MODULE_DESCRIPTION("Bit Blitting Operation");
-MODULE_LICENSE("GPL");
-
diff --git a/drivers/video/console/fbcon.c b/drivers/video/fbdev/core/fbcon.c
similarity index 99%
rename from drivers/video/console/fbcon.c
rename to drivers/video/fbdev/core/fbcon.c
index 12ded23f1aaf..86b3bcbd01a8 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -68,6 +68,7 @@
 #include <linux/kd.h>
 #include <linux/slab.h>
 #include <linux/fb.h>
+#include <linux/fbcon.h>
 #include <linux/vt_kern.h>
 #include <linux/selection.h>
 #include <linux/font.h>
@@ -3606,7 +3607,7 @@ static void fbcon_exit(void)
 	fbcon_has_exited = 1;
 }
 
-static int __init fb_console_init(void)
+void __init fb_console_init(void)
 {
 	int i;
 
@@ -3628,11 +3629,8 @@ static int __init fb_console_init(void)
 
 	console_unlock();
 	fbcon_start();
-	return 0;
 }
 
-fs_initcall(fb_console_init);
-
 #ifdef MODULE
 
 static void __exit fbcon_deinit_device(void)
@@ -3647,7 +3645,7 @@ static void __exit fbcon_deinit_device(void)
 	}
 }
 
-static void __exit fb_console_exit(void)
+void __exit fb_console_exit(void)
 {
 	console_lock();
 	fb_unregister_client(&fbcon_event_notifier);
@@ -3657,9 +3655,4 @@ static void __exit fb_console_exit(void)
 	do_unregister_con_driver(&fb_con);
 	console_unlock();
 }	
-
-module_exit(fb_console_exit);
-
 #endif
-
-MODULE_LICENSE("GPL");
diff --git a/drivers/video/console/fbcon.h b/drivers/video/fbdev/core/fbcon.h
similarity index 100%
rename from drivers/video/console/fbcon.h
rename to drivers/video/fbdev/core/fbcon.h
diff --git a/drivers/video/console/fbcon_ccw.c b/drivers/video/fbdev/core/fbcon_ccw.c
similarity index 98%
rename from drivers/video/console/fbcon_ccw.c
rename to drivers/video/fbdev/core/fbcon_ccw.c
index 5a3cbf6dff4d..2eeefa97bd4a 100644
--- a/drivers/video/console/fbcon_ccw.c
+++ b/drivers/video/fbdev/core/fbcon_ccw.c
@@ -418,7 +418,3 @@ void fbcon_rotate_ccw(struct fbcon_ops *ops)
 	ops->update_start = ccw_update_start;
 }
 EXPORT_SYMBOL(fbcon_rotate_ccw);
-
-MODULE_AUTHOR("Antonino Daplas <adaplas@pol.net>");
-MODULE_DESCRIPTION("Console Rotation (270 degrees) Support");
-MODULE_LICENSE("GPL");
diff --git a/drivers/video/console/fbcon_cw.c b/drivers/video/fbdev/core/fbcon_cw.c
similarity index 98%
rename from drivers/video/console/fbcon_cw.c
rename to drivers/video/fbdev/core/fbcon_cw.c
index e7ee44db4e98..c321f7c59e5c 100644
--- a/drivers/video/console/fbcon_cw.c
+++ b/drivers/video/fbdev/core/fbcon_cw.c
@@ -401,7 +401,3 @@ void fbcon_rotate_cw(struct fbcon_ops *ops)
 	ops->update_start = cw_update_start;
 }
 EXPORT_SYMBOL(fbcon_rotate_cw);
-
-MODULE_AUTHOR("Antonino Daplas <adaplas@pol.net>");
-MODULE_DESCRIPTION("Console Rotation (90 degrees) Support");
-MODULE_LICENSE("GPL");
diff --git a/drivers/video/console/fbcon_rotate.c b/drivers/video/fbdev/core/fbcon_rotate.c
similarity index 95%
rename from drivers/video/console/fbcon_rotate.c
rename to drivers/video/fbdev/core/fbcon_rotate.c
index db6528f2d3f2..8a51e4d95cc5 100644
--- a/drivers/video/console/fbcon_rotate.c
+++ b/drivers/video/fbdev/core/fbcon_rotate.c
@@ -110,7 +110,3 @@ void fbcon_set_rotate(struct fbcon_ops *ops)
 	}
 }
 EXPORT_SYMBOL(fbcon_set_rotate);
-
-MODULE_AUTHOR("Antonino Daplas <adaplas@pol.net>");
-MODULE_DESCRIPTION("Console Rotation Support");
-MODULE_LICENSE("GPL");
diff --git a/drivers/video/console/fbcon_rotate.h b/drivers/video/fbdev/core/fbcon_rotate.h
similarity index 100%
rename from drivers/video/console/fbcon_rotate.h
rename to drivers/video/fbdev/core/fbcon_rotate.h
diff --git a/drivers/video/console/fbcon_ud.c b/drivers/video/fbdev/core/fbcon_ud.c
similarity index 98%
rename from drivers/video/console/fbcon_ud.c
rename to drivers/video/fbdev/core/fbcon_ud.c
index 19e3714abfe8..c0b605d49cb3 100644
--- a/drivers/video/console/fbcon_ud.c
+++ b/drivers/video/fbdev/core/fbcon_ud.c
@@ -446,7 +446,3 @@ void fbcon_rotate_ud(struct fbcon_ops *ops)
 	ops->update_start = ud_update_start;
 }
 EXPORT_SYMBOL(fbcon_rotate_ud);
-
-MODULE_AUTHOR("Antonino Daplas <adaplas@pol.net>");
-MODULE_DESCRIPTION("Console Rotation (180 degrees) Support");
-MODULE_LICENSE("GPL");
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 069fe7960df1..283d57cf8526 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -32,6 +32,7 @@
 #include <linux/device.h>
 #include <linux/efi.h>
 #include <linux/fb.h>
+#include <linux/fbcon.h>
 
 #include <asm/fb.h>
 
@@ -1888,6 +1889,9 @@ fbmem_init(void)
 		fb_class = NULL;
 		goto err_class;
 	}
+
+	fb_console_init();
+
 	return 0;
 
 err_class:
@@ -1902,6 +1906,8 @@ module_init(fbmem_init);
 static void __exit
 fbmem_exit(void)
 {
+	fb_console_exit();
+
 	remove_proc_entry("fb", NULL);
 	class_destroy(fb_class);
 	unregister_chrdev(FB_MAJOR, "fb");
diff --git a/drivers/video/console/softcursor.c b/drivers/video/fbdev/core/softcursor.c
similarity index 93%
rename from drivers/video/console/softcursor.c
rename to drivers/video/fbdev/core/softcursor.c
index 46dd8f5d2e9e..fc93f254498e 100644
--- a/drivers/video/console/softcursor.c
+++ b/drivers/video/fbdev/core/softcursor.c
@@ -76,7 +76,3 @@ int soft_cursor(struct fb_info *info, struct fb_cursor *cursor)
 }
 
 EXPORT_SYMBOL(soft_cursor);
-
-MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
-MODULE_DESCRIPTION("Generic software cursor");
-MODULE_LICENSE("GPL");
diff --git a/drivers/video/console/tileblit.c b/drivers/video/fbdev/core/tileblit.c
similarity index 96%
rename from drivers/video/console/tileblit.c
rename to drivers/video/fbdev/core/tileblit.c
index 15e8e1a89c45..4636a6110c27 100644
--- a/drivers/video/console/tileblit.c
+++ b/drivers/video/fbdev/core/tileblit.c
@@ -152,8 +152,3 @@ void fbcon_set_tileops(struct vc_data *vc, struct fb_info *info)
 }
 
 EXPORT_SYMBOL(fbcon_set_tileops);
-
-MODULE_AUTHOR("Antonino Daplas <adaplas@pol.net>");
-MODULE_DESCRIPTION("Tile Blitting Operation");
-MODULE_LICENSE("GPL");
-
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
new file mode 100644
index 000000000000..0fac6305d51c
--- /dev/null
+++ b/include/linux/fbcon.h
@@ -0,0 +1,12 @@
+#ifndef _LINUX_FBCON_H
+#define _LINUX_FBCON_H
+
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE
+void __init fb_console_init(void);
+void __exit fb_console_exit(void);
+#else
+static void fb_console_init(void) {}
+static void fb_console_exit(void) {}
+#endif
+
+#endif /* _LINUX_FBCON_H */
-- 
2.13.2

[PATCH 2/4] fbdev: Nuke FBINFO_MODULE

From: Daniel Vetter <hidden>
Date: 2017-07-06 12:57:33

Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
---
 drivers/video/fbdev/core/fbcon.c | 2 +-
 drivers/video/fbdev/core/fbmem.c | 4 ++--
 include/linux/fb.h               | 7 +------
 3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 86b3bcbd01a8..431a1533a2fe 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -564,7 +564,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
 	unsigned short *save = NULL, *r, *q;
 	int logo_height;
 
-	if (info->flags & FBINFO_MODULE) {
+	if (info->fbops->owner) {
 		logo_shown = FBCON_LOGO_DONTSHOW;
 		return;
 	}
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 283d57cf8526..2636f192e8c9 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -463,7 +463,7 @@ static int fb_show_logo_line(struct fb_info *info, int rotate,
 
 	/* Return if the frame buffer is not mapped or suspended */
 	if (logo = NULL || info->state != FBINFO_STATE_RUNNING ||
-	    info->flags & FBINFO_MODULE)
+	    info->fbops->owner)
 		return 0;
 
 	image.depth = 8;
@@ -601,7 +601,7 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
 	memset(&fb_logo, 0, sizeof(struct logo_data));
 
 	if (info->flags & FBINFO_MISC_TILEBLITTING ||
-	    info->flags & FBINFO_MODULE)
+	    info->fbops->owner)
 		return 0;
 
 	if (info->fix.visual = FB_VISUAL_DIRECTCOLOR) {
diff --git a/include/linux/fb.h b/include/linux/fb.h
index a964d076b4dc..40b767fa622f 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -400,7 +400,7 @@ struct fb_tile_ops {
 #endif /* CONFIG_FB_TILEBLITTING */
 
 /* FBINFO_* = fb_info.flags bit flags */
-#define FBINFO_MODULE		0x0001	/* Low-level driver is a module */
+#define FBINFO_DEFAULT		0
 #define FBINFO_HWACCEL_DISABLED	0x0002
 	/* When FBINFO_HWACCEL_DISABLED is set:
 	 *  Hardware acceleration is turned off.  Software implementations
@@ -533,11 +533,6 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
 	return a;
 }
 
-#ifdef MODULE
-#define FBINFO_DEFAULT	FBINFO_MODULE
-#else
-#define FBINFO_DEFAULT	0
-#endif
 
 // This will go away
 #define FBINFO_FLAG_MODULE	FBINFO_MODULE
-- 
2.13.2

[PATCH 3/4] drm/qxl: Drop fbdev hwaccel flags

From: Daniel Vetter <hidden>
Date: 2017-07-06 12:57:34

It's not accelarated, just system memory. Note we don't even need to
set the default flag since that's now always 0.

Cc: Dave Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Daniel Vetter <redacted>
---
 drivers/gpu/drm/qxl/qxl_fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 573e7e9a5f98..69e7359b562a 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -275,7 +275,7 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 
-	info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
+	info->flags = FBINFO_DEFAULT;
 	info->fbops = &qxlfb_ops;
 
 	/*
-- 
2.13.2

[PATCH 4/4] drm/<drivers>: Drop fbdev info flags

From: Daniel Vetter <hidden>
Date: 2017-07-06 12:57:49

- FBINFO_CAN_FORCE_OUTPUT has been a lie ever since we nerfed&removed
  the entire panic handling code in our fbdev emulation. We might
  restore kms panic output, but not through the bazillion of legacy
  code layers called fbdev/fbcon, there's just no way to make that
  work safely.

- With the module check change FBINFO_DEFAULT is always 0, so can be
  removed too.

That removes another change to cargo-cult stuff in kms drivers, yay!

Signed-off-by: Daniel Vetter <redacted>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c            | 1 -
 drivers/gpu/drm/armada/armada_fbdev.c             | 1 -
 drivers/gpu/drm/ast/ast_fb.c                      | 1 -
 drivers/gpu/drm/bochs/bochs_fbdev.c               | 1 -
 drivers/gpu/drm/cirrus/cirrus_fbdev.c             | 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 1 -
 drivers/gpu/drm/i915/intel_fbdev.c                | 1 -
 drivers/gpu/drm/mgag200/mgag200_fb.c              | 1 -
 drivers/gpu/drm/msm/msm_fbdev.c                   | 1 -
 drivers/gpu/drm/omapdrm/omap_fbdev.c              | 1 -
 drivers/gpu/drm/qxl/qxl_fb.c                      | 1 -
 drivers/gpu/drm/radeon/radeon_fb.c                | 1 -
 drivers/gpu/drm/udl/udl_fb.c                      | 1 -
 drivers/gpu/drm/virtio/virtgpu_fb.c               | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c                | 1 -
 15 files changed, 15 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index c0d8c6ff6380..1c57fefc364c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -245,7 +245,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &amdgpufb_ops;
 
 	tmp = amdgpu_bo_gpu_offset(abo) - adev->mc.vram_start;
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c
index 602dfead8eef..5b479b0ed06c 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -81,7 +81,6 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
 
 	strlcpy(info->fix.id, "armada-drmfb", sizeof(info->fix.id));
 	info->par = fbh;
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &armada_fb_ops;
 	info->fix.smem_start = obj->phys_addr;
 	info->fix.smem_len = obj->obj.size;
diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 4ad4acd0ccab..53ca6d099234 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -231,7 +231,6 @@ static int astfb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "astdrmfb");
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &astfb_ops;
 
 	info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);
diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c
index 49d5a2b7d630..14eb8d0d5a00 100644
--- a/drivers/gpu/drm/bochs/bochs_fbdev.c
+++ b/drivers/gpu/drm/bochs/bochs_fbdev.c
@@ -118,7 +118,6 @@ static int bochsfb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "bochsdrmfb");
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &bochsfb_ops;
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index 7fa58eeadc9d..c69586163d92 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -215,7 +215,6 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "cirrusdrmfb");
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &cirrusfb_ops;
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
index f5ac80daeef2..9740eed9231a 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
@@ -131,7 +131,6 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "hibmcdrmfb");
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &hibmc_drm_fb_ops;
 
 	drm_fb_helper_fill_fix(info, hi_fbdev->fb->fb.pitches[0],
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 5536591d3da0..b953365a3eec 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -232,7 +232,6 @@ static int intelfb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "inteldrmfb");
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &intelfb_ops;
 
 	/* setup aperture base/size for vesafb takeover */
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 5d3b1fac906f..e94d78a32fe0 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -210,7 +210,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "mgadrmfb");
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &mgag200fb_ops;
 
 	/* setup aperture base/size for vesafb takeover */
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 5ecf4ff9a059..9c00fedfc741 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -143,7 +143,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
 	helper->fb = fb;
 
 	fbi->par = helper;
-	fbi->flags = FBINFO_DEFAULT;
 	fbi->fbops = &msm_fb_ops;
 
 	strcpy(fbi->fix.id, "msm");
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index daf81a0a2899..9273118040b7 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -184,7 +184,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 	helper->fb = fb;
 
 	fbi->par = helper;
-	fbi->flags = FBINFO_DEFAULT;
 	fbi->fbops = &omap_fb_ops;
 
 	strcpy(fbi->fix.id, MODULE_NAME);
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 69e7359b562a..844c4a31ca13 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -275,7 +275,6 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &qxlfb_ops;
 
 	/*
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 356ad90a5238..e141fcd5e8e1 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -264,7 +264,6 @@ static int radeonfb_create(struct drm_fb_helper *helper,
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &radeonfb_ops;
 
 	tmp = radeon_bo_gpu_offset(rbo) - rdev->mc.vram_start;
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index 4a6500362564..a5c54dc60def 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -393,7 +393,6 @@ static int udlfb_create(struct drm_fb_helper *helper,
 	info->fix.smem_len = size;
 	info->fix.smem_start = (unsigned long)ufbdev->ufb.obj->vmapping;
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &udlfb_ops;
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 	drm_fb_helper_fill_var(info, &ufbdev->helper, sizes->fb_width, sizes->fb_height);
diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c b/drivers/gpu/drm/virtio/virtgpu_fb.c
index 33df067b11c1..046e28b69d99 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fb.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fb.c
@@ -273,7 +273,6 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,
 	vfbdev->helper.fb = fb;
 
 	strcpy(info->fix.id, "virtiodrmfb");
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &virtio_gpufb_ops;
 	info->pixmap.flags = FB_PIXMAP_SYSTEM;
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 6f4cb4678cbc..d23a18aae476 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -779,7 +779,6 @@ int vmw_fb_init(struct vmw_private *vmw_priv)
 	info->screen_base = (char __iomem *)par->vmalloc;
 	info->screen_size = fb_size;
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &vmw_fb_ops;
 
 	/* 24 depth per default */
-- 
2.13.2

Re: [Intel-gfx] [PATCH 2/4] fbdev: Nuke FBINFO_MODULE

From: kbuild test robot <hidden>
Date: 2017-07-07 23:21:45

Hi Daniel,

[auto build test ERROR on linus/master]
[also build test ERROR on v4.12 next-20170707]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/fbcon-Make-fbcon-a-built-time-depency-for-fbdev/20170708-063020
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 6.2.0
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All error/warnings (new ones prefixed by >>):

   In file included from drivers/video/fbdev/matrox/matroxfb_base.h:35:0,
                    from drivers/video/fbdev/matrox/matroxfb_base.c:104:
   drivers/video/fbdev/matrox/matroxfb_base.c: In function 'initMatrox2':
quoted
include/linux/fb.h:538:28: error: 'FBINFO_MODULE' undeclared (first use in this function)
    #define FBINFO_FLAG_MODULE FBINFO_MODULE
                               ^
quoted
drivers/video/fbdev/matrox/matroxfb_base.c:1798:33: note: in expansion of macro 'FBINFO_FLAG_MODULE'
     minfo->fbcon.flags = hotplug ? FBINFO_FLAG_MODULE : FBINFO_FLAG_DEFAULT;
                                    ^~~~~~~~~~~~~~~~~~
   include/linux/fb.h:538:28: note: each undeclared identifier is reported only once for each function it appears in
    #define FBINFO_FLAG_MODULE FBINFO_MODULE
                               ^
quoted
drivers/video/fbdev/matrox/matroxfb_base.c:1798:33: note: in expansion of macro 'FBINFO_FLAG_MODULE'
     minfo->fbcon.flags = hotplug ? FBINFO_FLAG_MODULE : FBINFO_FLAG_DEFAULT;
                                    ^~~~~~~~~~~~~~~~~~
--
   In file included from drivers/video//fbdev/matrox/matroxfb_base.h:35:0,
                    from drivers/video//fbdev/matrox/matroxfb_base.c:104:
   drivers/video//fbdev/matrox/matroxfb_base.c: In function 'initMatrox2':
quoted
include/linux/fb.h:538:28: error: 'FBINFO_MODULE' undeclared (first use in this function)
    #define FBINFO_FLAG_MODULE FBINFO_MODULE
                               ^
   drivers/video//fbdev/matrox/matroxfb_base.c:1798:33: note: in expansion of macro 'FBINFO_FLAG_MODULE'
     minfo->fbcon.flags = hotplug ? FBINFO_FLAG_MODULE : FBINFO_FLAG_DEFAULT;
                                    ^~~~~~~~~~~~~~~~~~
   include/linux/fb.h:538:28: note: each undeclared identifier is reported only once for each function it appears in
    #define FBINFO_FLAG_MODULE FBINFO_MODULE
                               ^
   drivers/video//fbdev/matrox/matroxfb_base.c:1798:33: note: in expansion of macro 'FBINFO_FLAG_MODULE'
     minfo->fbcon.flags = hotplug ? FBINFO_FLAG_MODULE : FBINFO_FLAG_DEFAULT;
                                    ^~~~~~~~~~~~~~~~~~

vim +/FBINFO_MODULE +538 include/linux/fb.h

1471ca9a Marcin Slusarz 2010-05-16  532  	a->count = max_num;
1471ca9a Marcin Slusarz 2010-05-16  533  	return a;
1471ca9a Marcin Slusarz 2010-05-16  534  }
1471ca9a Marcin Slusarz 2010-05-16  535  
^1da177e Linus Torvalds 2005-04-16  536  
^1da177e Linus Torvalds 2005-04-16  537  // This will go away
^1da177e Linus Torvalds 2005-04-16 @538  #define FBINFO_FLAG_MODULE	FBINFO_MODULE
^1da177e Linus Torvalds 2005-04-16  539  #define FBINFO_FLAG_DEFAULT	FBINFO_DEFAULT
^1da177e Linus Torvalds 2005-04-16  540  
^1da177e Linus Torvalds 2005-04-16  541  /* This will go away

:::::: The code at line 538 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds [off-list ref]
:::::: CC: Linus Torvalds [off-list ref]

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[PATCH] fbdev: Nuke FBINFO_MODULE

From: Daniel Vetter <hidden>
Date: 2017-07-11 09:27:03

Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

v2: Fixup matrox (reported by kbuild). Also nuke FBINFO_FLAG_* defines
that I've failed to spot.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
---
 drivers/video/fbdev/core/fbcon.c           |  2 +-
 drivers/video/fbdev/core/fbmem.c           |  4 ++--
 drivers/video/fbdev/matrox/matroxfb_base.c |  4 +---
 include/linux/fb.h                         | 11 +----------
 4 files changed, 5 insertions(+), 16 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 86b3bcbd01a8..431a1533a2fe 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -564,7 +564,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
 	unsigned short *save = NULL, *r, *q;
 	int logo_height;
 
-	if (info->flags & FBINFO_MODULE) {
+	if (info->fbops->owner) {
 		logo_shown = FBCON_LOGO_DONTSHOW;
 		return;
 	}
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 283d57cf8526..2636f192e8c9 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -463,7 +463,7 @@ static int fb_show_logo_line(struct fb_info *info, int rotate,
 
 	/* Return if the frame buffer is not mapped or suspended */
 	if (logo = NULL || info->state != FBINFO_STATE_RUNNING ||
-	    info->flags & FBINFO_MODULE)
+	    info->fbops->owner)
 		return 0;
 
 	image.depth = 8;
@@ -601,7 +601,7 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
 	memset(&fb_logo, 0, sizeof(struct logo_data));
 
 	if (info->flags & FBINFO_MISC_TILEBLITTING ||
-	    info->flags & FBINFO_MODULE)
+	    info->fbops->owner)
 		return 0;
 
 	if (info->fix.visual = FB_VISUAL_DIRECTCOLOR) {
diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c
index 11eb094396ae..15b412b4b783 100644
--- a/drivers/video/fbdev/matrox/matroxfb_base.c
+++ b/drivers/video/fbdev/matrox/matroxfb_base.c
@@ -1794,9 +1794,7 @@ static int initMatrox2(struct matrox_fb_info *minfo, struct board *b)
 	minfo->fbops = matroxfb_ops;
 	minfo->fbcon.fbops = &minfo->fbops;
 	minfo->fbcon.pseudo_palette = minfo->cmap;
-	/* after __init time we are like module... no logo */
-	minfo->fbcon.flags = hotplug ? FBINFO_FLAG_MODULE : FBINFO_FLAG_DEFAULT;
-	minfo->fbcon.flags |= FBINFO_PARTIAL_PAN_OK | 	 /* Prefer panning for scroll under MC viewer/edit */
+	minfo->fbcon.flags = FBINFO_PARTIAL_PAN_OK | 	 /* Prefer panning for scroll under MC viewer/edit */
 				      FBINFO_HWACCEL_COPYAREA |  /* We have hw-assisted bmove */
 				      FBINFO_HWACCEL_FILLRECT |  /* And fillrect */
 				      FBINFO_HWACCEL_IMAGEBLIT | /* And imageblit */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index a964d076b4dc..4c021b6dc384 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -400,7 +400,7 @@ struct fb_tile_ops {
 #endif /* CONFIG_FB_TILEBLITTING */
 
 /* FBINFO_* = fb_info.flags bit flags */
-#define FBINFO_MODULE		0x0001	/* Low-level driver is a module */
+#define FBINFO_DEFAULT		0
 #define FBINFO_HWACCEL_DISABLED	0x0002
 	/* When FBINFO_HWACCEL_DISABLED is set:
 	 *  Hardware acceleration is turned off.  Software implementations
@@ -533,15 +533,6 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
 	return a;
 }
 
-#ifdef MODULE
-#define FBINFO_DEFAULT	FBINFO_MODULE
-#else
-#define FBINFO_DEFAULT	0
-#endif
-
-// This will go away
-#define FBINFO_FLAG_MODULE	FBINFO_MODULE
-#define FBINFO_FLAG_DEFAULT	FBINFO_DEFAULT
 
 /* This will go away
  * fbset currently hacks in FB_ACCELF_TEXT into var.accel_flags
-- 
2.13.2

[PATCH] fbdev: Nuke FBINFO_MODULE

From: Daniel Vetter <hidden>
Date: 2017-07-11 14:52:27

Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

v2: Fixup matrox (reported by kbuild). Also nuke FBINFO_FLAG_* defines
that I've failed to spot.

v3: Don't nuke FBINFO_FLAG_DEFAULT, that's used all over the place.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
---
 drivers/video/fbdev/core/fbcon.c           |  2 +-
 drivers/video/fbdev/core/fbmem.c           |  4 ++--
 drivers/video/fbdev/matrox/matroxfb_base.c |  4 +---
 include/linux/fb.h                         | 10 +---------
 4 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 86b3bcbd01a8..431a1533a2fe 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -564,7 +564,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
 	unsigned short *save = NULL, *r, *q;
 	int logo_height;
 
-	if (info->flags & FBINFO_MODULE) {
+	if (info->fbops->owner) {
 		logo_shown = FBCON_LOGO_DONTSHOW;
 		return;
 	}
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 283d57cf8526..2636f192e8c9 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -463,7 +463,7 @@ static int fb_show_logo_line(struct fb_info *info, int rotate,
 
 	/* Return if the frame buffer is not mapped or suspended */
 	if (logo = NULL || info->state != FBINFO_STATE_RUNNING ||
-	    info->flags & FBINFO_MODULE)
+	    info->fbops->owner)
 		return 0;
 
 	image.depth = 8;
@@ -601,7 +601,7 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
 	memset(&fb_logo, 0, sizeof(struct logo_data));
 
 	if (info->flags & FBINFO_MISC_TILEBLITTING ||
-	    info->flags & FBINFO_MODULE)
+	    info->fbops->owner)
 		return 0;
 
 	if (info->fix.visual = FB_VISUAL_DIRECTCOLOR) {
diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c
index 11eb094396ae..15b412b4b783 100644
--- a/drivers/video/fbdev/matrox/matroxfb_base.c
+++ b/drivers/video/fbdev/matrox/matroxfb_base.c
@@ -1794,9 +1794,7 @@ static int initMatrox2(struct matrox_fb_info *minfo, struct board *b)
 	minfo->fbops = matroxfb_ops;
 	minfo->fbcon.fbops = &minfo->fbops;
 	minfo->fbcon.pseudo_palette = minfo->cmap;
-	/* after __init time we are like module... no logo */
-	minfo->fbcon.flags = hotplug ? FBINFO_FLAG_MODULE : FBINFO_FLAG_DEFAULT;
-	minfo->fbcon.flags |= FBINFO_PARTIAL_PAN_OK | 	 /* Prefer panning for scroll under MC viewer/edit */
+	minfo->fbcon.flags = FBINFO_PARTIAL_PAN_OK | 	 /* Prefer panning for scroll under MC viewer/edit */
 				      FBINFO_HWACCEL_COPYAREA |  /* We have hw-assisted bmove */
 				      FBINFO_HWACCEL_FILLRECT |  /* And fillrect */
 				      FBINFO_HWACCEL_IMAGEBLIT | /* And imageblit */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index a964d076b4dc..f4386b0ccf40 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -400,7 +400,7 @@ struct fb_tile_ops {
 #endif /* CONFIG_FB_TILEBLITTING */
 
 /* FBINFO_* = fb_info.flags bit flags */
-#define FBINFO_MODULE		0x0001	/* Low-level driver is a module */
+#define FBINFO_DEFAULT		0
 #define FBINFO_HWACCEL_DISABLED	0x0002
 	/* When FBINFO_HWACCEL_DISABLED is set:
 	 *  Hardware acceleration is turned off.  Software implementations
@@ -533,14 +533,6 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
 	return a;
 }
 
-#ifdef MODULE
-#define FBINFO_DEFAULT	FBINFO_MODULE
-#else
-#define FBINFO_DEFAULT	0
-#endif
-
-// This will go away
-#define FBINFO_FLAG_MODULE	FBINFO_MODULE
 #define FBINFO_FLAG_DEFAULT	FBINFO_DEFAULT
 
 /* This will go away
-- 
2.13.2

Re: [PATCH 1/4] fbcon: Make fbcon a built-time depency for fbdev

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2017-07-12 10:40:45

On Thursday, July 06, 2017 02:57:32 PM Daniel Vetter wrote:
There's a bunch of folks who're trying to make printk less
contended and faster, but there's a problem: printk uses the
console_lock, and the console lock has become the BKL for all things
fbdev/fbcon, which in turn pulled in half the drm subsystem under that
lock. That's awkward.

There reasons for that is probably just a historical accident:

- fbcon is a runtime option of fbdev, i.e. at runtime you can pick
  whether your fbdev driver instances are used as kernel consoles.
  Unfortunately this wasn't implemented with some module option, but
  through some module loading magic: As long as you don't load
  fbcon.ko, there's no fbdev console support, but loading it (in any
  order wrt fbdev drivers) will create console instances for all fbdev
  drivers.

- This was implemented through a notifier chain. fbcon.ko enumerates
  all fbdev instances at load time and also registers itself as
  listener in the fbdev notifier. The fbdev core tries to register new
  fbdev instances with fbcon using the notifier.

- On top of that the modifier chain is also used at runtime by the
  fbdev subsystem to e.g. control backlights for panels.

- The problem is that the notifier puts a mutex locking context
  between fbdev and fbcon, which mixes up the locking contexts for
  both the runtime usage and the register time usage to notify fbcon.
  And at runtime fbcon (through the fbdev core) might call into the
  notifier from a printk critical section while console_lock is held.

- This means console_lock must be an outer lock for the entire fbdev
  subsystem, which also means it must be acquired when registering a
  new framebuffer driver as the outermost lock since we might call
  into fbcon (through the notifier) which would result in a locking
  inversion if fbcon would acquire the console_lock from its notifier
  callback (which it needs to register the console).

- console_lock can be held anywhere, since printk can be called
  anywhere, and through the above story, plus drm/kms being an fbdev
  driver, we pull in a shocking amount of locking hiercharchy
  underneath the console_lock. Which makes cleaning up printk really
  hard (not even splitting console_lock into an rwsem is all that
  useful due to this).

There's various ways to address this, but the cleanest would be to
make fbcon a compile-time option, where fbdev directly calls the fbcon
register functions from register_framebuffer, or dummy static inline
versions if fbcon is disabled. Maybe augmented with a runtime knob to
disable fbcon, if that's needed (for debugging perhaps).

But this could break some users who rely on the magic "loading
fbcon.ko enables/disables fbdev framebuffers at runtime" thing, even
if that's unlikely. Hence we must be careful:

1. Create a compile-time dependency between fbcon and fbdev in the
least minimal way. This is what this patch does.

2. Wait at least 1 year to give possible users time to scream about
how we broke their setup. Unlikely, since all distros make fbcon
compile-in, and embedded platforms only compile stuff they know they
need anyway. But still.

3. Convert the notifier to direct functions calls, with dummy static
inlines if fbcon is disabled. We'll still need the fb notifier for the
other uses (like backlights), but we can probably move it into the fb
core (atm it must be built-into vmlinux).

4. Push console_lock down the call-chain, until it is down in
console_register again.

5. Finally start to clean up and rework the printk/console locking.

For context of this saga see

commit 50e244cc793d511b86adea24972f3a7264cae114
Author: Alan Cox [off-list ref]
Date:   Fri Jan 25 10:28:15 2013 +1000

    fb: rework locking to fix lock ordering on takeover

plus the pile of commits on top that tried to make this all work
without terminally upsetting lockdep. We've uncovered all this when
console_lock lockdep annotations where added in

commit daee779718a319ff9f83e1ba3339334ac650bb22
Author: Daniel Vetter [off-list ref]
Date:   Sat Sep 22 19:52:11 2012 +0200

    console: implement lockdep support for console_lock

On the patch itself:
- Switch CONFIG_FRAMEBUFFER_CONSOLE to be a boolean, using the overall
  CONFIG_FB tristate to decided whether it should be a module or
  built-in.

- At first I thought I could force the build depency with just a dummy
  symbol that fbcon.ko exports and fb.ko uses. But that leads to a
  module depency cycle (it works fine when built-in).

  Since this tight binding is the entire goal the simplest solution is
  to move all the fbcon modules (and there's a bunch of optinal
  source-files which are each modules of their own, for no good
  reason) into the overall fb.ko core module. That's a bit more than
  what I would have liked to do in this patch, but oh well.

Cc: Alan Cox <redacted>
Cc: Sergey Senozhatsky <redacted>
Cc: Linux Fbdev development list <redacted>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <redacted>
Acked-by: Bartlomiej Zolnierkiewicz <redacted>
---
v2: Switch to building fbcon code into fb.ko right away because the
cheap trick leads to a module depency loop.
---
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Re: [PATCH] fbdev: Nuke FBINFO_MODULE

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2017-07-12 10:41:34

On Tuesday, July 11, 2017 04:52:19 PM Daniel Vetter wrote:
Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

v2: Fixup matrox (reported by kbuild). Also nuke FBINFO_FLAG_* defines
that I've failed to spot.

v3: Don't nuke FBINFO_FLAG_DEFAULT, that's used all over the place.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
Acked-by: Bartlomiej Zolnierkiewicz <redacted>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Re: [PATCH] fbdev: Nuke FBINFO_MODULE

From: Daniel Vetter <hidden>
Date: 2017-07-12 12:42:18

On Wed, Jul 12, 2017 at 12:41:34PM +0200, Bartlomiej Zolnierkiewicz wrote:
On Tuesday, July 11, 2017 04:52:19 PM Daniel Vetter wrote:
quoted
Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

v2: Fixup matrox (reported by kbuild). Also nuke FBINFO_FLAG_* defines
that I've failed to spot.

v3: Don't nuke FBINFO_FLAG_DEFAULT, that's used all over the place.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
Acked-by: Bartlomiej Zolnierkiewicz <redacted>
Do you plan to pick these two patches up yourself, or do you expect me to
merge them?

I'm always confused when the official maintainer acks something without
saying anything else ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Re: [PATCH] fbdev: Nuke FBINFO_MODULE

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2017-07-12 12:54:11

On Wednesday, July 12, 2017 02:42:14 PM Daniel Vetter wrote:
On Wed, Jul 12, 2017 at 12:41:34PM +0200, Bartlomiej Zolnierkiewicz wrote:
quoted
On Tuesday, July 11, 2017 04:52:19 PM Daniel Vetter wrote:
quoted
Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

v2: Fixup matrox (reported by kbuild). Also nuke FBINFO_FLAG_* defines
that I've failed to spot.

v3: Don't nuke FBINFO_FLAG_DEFAULT, that's used all over the place.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
Acked-by: Bartlomiej Zolnierkiewicz <redacted>
Do you plan to pick these two patches up yourself, or do you expect me to
merge them?
Since the original patchset contained DRM changes (two last patches)
depending on fbdev changes (two first patches, the patch being discussed
was the second one) I assumed that you would like to take them all
through DRM tree. If this is not what is preferred, please tell me.
I'm always confused when the official maintainer acks something without
saying anything else ...
Point taken, I will try to be more verbose next time.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Re: [PATCH] fbdev: Nuke FBINFO_MODULE

From: Daniel Vetter <hidden>
Date: 2017-07-12 15:07:44

On Wed, Jul 12, 2017 at 2:54 PM, Bartlomiej Zolnierkiewicz
[off-list ref] wrote:
On Wednesday, July 12, 2017 02:42:14 PM Daniel Vetter wrote:
quoted
On Wed, Jul 12, 2017 at 12:41:34PM +0200, Bartlomiej Zolnierkiewicz wrote:
quoted
On Tuesday, July 11, 2017 04:52:19 PM Daniel Vetter wrote:
quoted
Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

v2: Fixup matrox (reported by kbuild). Also nuke FBINFO_FLAG_* defines
that I've failed to spot.

v3: Don't nuke FBINFO_FLAG_DEFAULT, that's used all over the place.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
Acked-by: Bartlomiej Zolnierkiewicz <redacted>
Do you plan to pick these two patches up yourself, or do you expect me to
merge them?
Since the original patchset contained DRM changes (two last patches)
depending on fbdev changes (two first patches, the patch being discussed
was the second one) I assumed that you would like to take them all
through DRM tree. If this is not what is preferred, please tell me.
There's no direct depency between 1&2 and 3&4, the only effect of
merging them through separate trees is that the bootup logo might not
show up when it's expected, until the trees are merged together. We
could merge them through separate trees if you prefer that (I forgot
to mention that in the cover letter), but I'm fine with putting them
all into drm-misc with your ack for 4.14.

Whatever you prefer, I don't mind either way.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Re: [PATCH] fbdev: Nuke FBINFO_MODULE

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2017-07-13 14:01:50

On Wednesday, July 12, 2017 05:07:42 PM Daniel Vetter wrote:
On Wed, Jul 12, 2017 at 2:54 PM, Bartlomiej Zolnierkiewicz
[off-list ref] wrote:
quoted
On Wednesday, July 12, 2017 02:42:14 PM Daniel Vetter wrote:
quoted
On Wed, Jul 12, 2017 at 12:41:34PM +0200, Bartlomiej Zolnierkiewicz wrote:
quoted
On Tuesday, July 11, 2017 04:52:19 PM Daniel Vetter wrote:
quoted
Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

v2: Fixup matrox (reported by kbuild). Also nuke FBINFO_FLAG_* defines
that I've failed to spot.

v3: Don't nuke FBINFO_FLAG_DEFAULT, that's used all over the place.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
Acked-by: Bartlomiej Zolnierkiewicz <redacted>
Do you plan to pick these two patches up yourself, or do you expect me to
merge them?
Since the original patchset contained DRM changes (two last patches)
depending on fbdev changes (two first patches, the patch being discussed
was the second one) I assumed that you would like to take them all
through DRM tree. If this is not what is preferred, please tell me.
There's no direct depency between 1&2 and 3&4, the only effect of
merging them through separate trees is that the bootup logo might not
show up when it's expected, until the trees are merged together. We
could merge them through separate trees if you prefer that (I forgot
to mention that in the cover letter), but I'm fine with putting them
all into drm-misc with your ack for 4.14.

Whatever you prefer, I don't mind either way.
Then I will merge patches 1&2 for v4.14 through fbdev tree (there are
some other changes pending touching fbdev core and I would like to avoid
conflicts between fbdev & drm-misc trees). Thanks!

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Re: [PATCH 1/4] fbcon: Make fbcon a built-time depency for fbdev

From: Sean Paul <hidden>
Date: 2017-07-13 14:47:53

On Thu, Jul 06, 2017 at 02:57:32PM +0200, Daniel Vetter wrote:

<snip>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <redacted>
Just 2 nits, code looks good.

Reviewed-by: Sean Paul <redacted>
quoted hunk
---
v2: Switch to building fbcon code into fb.ko right away because the
cheap trick leads to a module depency loop.
---
 drivers/video/console/Kconfig                        |  2 +-
 drivers/video/console/Makefile                       |  8 --------
 drivers/video/fbdev/core/Makefile                    | 11 +++++++++++
 drivers/video/{console => fbdev/core}/bitblit.c      |  4 ----
 drivers/video/{console => fbdev/core}/fbcon.c        | 13 +++----------
 drivers/video/{console => fbdev/core}/fbcon.h        |  0
 drivers/video/{console => fbdev/core}/fbcon_ccw.c    |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_cw.c     |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_rotate.c |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_rotate.h |  0
 drivers/video/{console => fbdev/core}/fbcon_ud.c     |  4 ----
 drivers/video/fbdev/core/fbmem.c                     |  6 ++++++
 drivers/video/{console => fbdev/core}/softcursor.c   |  4 ----
 drivers/video/{console => fbdev/core}/tileblit.c     |  5 -----
 include/linux/fbcon.h                                | 12 ++++++++++++
 15 files changed, 33 insertions(+), 48 deletions(-)
 rename drivers/video/{console => fbdev/core}/bitblit.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon.c (99%)
 rename drivers/video/{console => fbdev/core}/fbcon.h (100%)
 rename drivers/video/{console => fbdev/core}/fbcon_ccw.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon_cw.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon_rotate.c (95%)
 rename drivers/video/{console => fbdev/core}/fbcon_rotate.h (100%)
 rename drivers/video/{console => fbdev/core}/fbcon_ud.c (98%)
 rename drivers/video/{console => fbdev/core}/softcursor.c (93%)
 rename drivers/video/{console => fbdev/core}/tileblit.c (96%)
 create mode 100644 include/linux/fbcon.h
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 2111d06f8c81..7f1f1fbcef9e 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -117,7 +117,7 @@ config DUMMY_CONSOLE_ROWS
           Select 25 if you use a 640x480 resolution by default.
 
 config FRAMEBUFFER_CONSOLE
-	tristate "Framebuffer Console support"
+	bool "Framebuffer Console support"
 	depends on FB && !UML
 	select VT_HW_CONSOLE_BINDING
 	select CRC32
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 43bfa485db96..eb2cbec52643 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -7,13 +7,5 @@ obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o
 obj-$(CONFIG_STI_CONSOLE)         += sticon.o sticore.o
 obj-$(CONFIG_VGA_CONSOLE)         += vgacon.o
 obj-$(CONFIG_MDA_CONSOLE)         += mdacon.o
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o softcursor.o
-ifeq ($(CONFIG_FB_TILEBLITTING),y)
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE)     += tileblit.o
-endif
-ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y)
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE)     += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \
-                                         fbcon_ccw.o
-endif
 
 obj-$(CONFIG_FB_STI)              += sticore.o
diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile
index 9e3ddf225393..0214b863ac3f 100644
--- a/drivers/video/fbdev/core/Makefile
+++ b/drivers/video/fbdev/core/Makefile
@@ -4,6 +4,17 @@ obj-$(CONFIG_FB)                  += fb.o
 fb-y                              := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
                                      modedb.o fbcvt.o
 fb-$(CONFIG_FB_DEFERRED_IO)       += fb_defio.o
+
+ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE),y)
+fb-y				  += fbcon.o bitblit.o softcursor.o
fb-$(CONFIG_FRAMEBUFFER_CONSOLE) ?
+ifeq ($(CONFIG_FB_TILEBLITTING),y)
+fb-y				  += tileblit.o
+endif
+ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y)
+fb-y				  += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \
+				     fbcon_ccw.o
+endif
+endif
 fb-objs                           := $(fb-y)
 
 obj-$(CONFIG_FB_CFB_FILLRECT)  += cfbfillrect.o
<snip>
quoted hunk
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
new file mode 100644
index 000000000000..0fac6305d51c
--- /dev/null
+++ b/include/linux/fbcon.h
IANAL, but it seems like you're missing some GPL legalese here?

Sean
quoted hunk
@@ -0,0 +1,12 @@
+#ifndef _LINUX_FBCON_H
+#define _LINUX_FBCON_H
+
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE
+void __init fb_console_init(void);
+void __exit fb_console_exit(void);
+#else
+static void fb_console_init(void) {}
+static void fb_console_exit(void) {}
+#endif
+
+#endif /* _LINUX_FBCON_H */
-- 
2.13.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
-- 
Sean Paul, Software Engineer, Google / Chromium OS

Re: [PATCH] fbdev: Nuke FBINFO_MODULE

From: Sean Paul <hidden>
Date: 2017-07-13 14:50:47

On Tue, Jul 11, 2017 at 04:52:19PM +0200, Daniel Vetter wrote:
Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

v2: Fixup matrox (reported by kbuild). Also nuke FBINFO_FLAG_* defines
that I've failed to spot.

v3: Don't nuke FBINFO_FLAG_DEFAULT, that's used all over the place.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
Reviewed-by: Sean Paul <redacted>
quoted hunk
---
 drivers/video/fbdev/core/fbcon.c           |  2 +-
 drivers/video/fbdev/core/fbmem.c           |  4 ++--
 drivers/video/fbdev/matrox/matroxfb_base.c |  4 +---
 include/linux/fb.h                         | 10 +---------
 4 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
index 86b3bcbd01a8..431a1533a2fe 100644
--- a/drivers/video/fbdev/core/fbcon.c
+++ b/drivers/video/fbdev/core/fbcon.c
@@ -564,7 +564,7 @@ static void fbcon_prepare_logo(struct vc_data *vc, struct fb_info *info,
 	unsigned short *save = NULL, *r, *q;
 	int logo_height;
 
-	if (info->flags & FBINFO_MODULE) {
+	if (info->fbops->owner) {
 		logo_shown = FBCON_LOGO_DONTSHOW;
 		return;
 	}
diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index 283d57cf8526..2636f192e8c9 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -463,7 +463,7 @@ static int fb_show_logo_line(struct fb_info *info, int rotate,
 
 	/* Return if the frame buffer is not mapped or suspended */
 	if (logo = NULL || info->state != FBINFO_STATE_RUNNING ||
-	    info->flags & FBINFO_MODULE)
+	    info->fbops->owner)
 		return 0;
 
 	image.depth = 8;
@@ -601,7 +601,7 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
 	memset(&fb_logo, 0, sizeof(struct logo_data));
 
 	if (info->flags & FBINFO_MISC_TILEBLITTING ||
-	    info->flags & FBINFO_MODULE)
+	    info->fbops->owner)
 		return 0;
 
 	if (info->fix.visual = FB_VISUAL_DIRECTCOLOR) {
diff --git a/drivers/video/fbdev/matrox/matroxfb_base.c b/drivers/video/fbdev/matrox/matroxfb_base.c
index 11eb094396ae..15b412b4b783 100644
--- a/drivers/video/fbdev/matrox/matroxfb_base.c
+++ b/drivers/video/fbdev/matrox/matroxfb_base.c
@@ -1794,9 +1794,7 @@ static int initMatrox2(struct matrox_fb_info *minfo, struct board *b)
 	minfo->fbops = matroxfb_ops;
 	minfo->fbcon.fbops = &minfo->fbops;
 	minfo->fbcon.pseudo_palette = minfo->cmap;
-	/* after __init time we are like module... no logo */
-	minfo->fbcon.flags = hotplug ? FBINFO_FLAG_MODULE : FBINFO_FLAG_DEFAULT;
-	minfo->fbcon.flags |= FBINFO_PARTIAL_PAN_OK | 	 /* Prefer panning for scroll under MC viewer/edit */
+	minfo->fbcon.flags = FBINFO_PARTIAL_PAN_OK | 	 /* Prefer panning for scroll under MC viewer/edit */
 				      FBINFO_HWACCEL_COPYAREA |  /* We have hw-assisted bmove */
 				      FBINFO_HWACCEL_FILLRECT |  /* And fillrect */
 				      FBINFO_HWACCEL_IMAGEBLIT | /* And imageblit */
diff --git a/include/linux/fb.h b/include/linux/fb.h
index a964d076b4dc..f4386b0ccf40 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -400,7 +400,7 @@ struct fb_tile_ops {
 #endif /* CONFIG_FB_TILEBLITTING */
 
 /* FBINFO_* = fb_info.flags bit flags */
-#define FBINFO_MODULE		0x0001	/* Low-level driver is a module */
+#define FBINFO_DEFAULT		0
 #define FBINFO_HWACCEL_DISABLED	0x0002
 	/* When FBINFO_HWACCEL_DISABLED is set:
 	 *  Hardware acceleration is turned off.  Software implementations
@@ -533,14 +533,6 @@ static inline struct apertures_struct *alloc_apertures(unsigned int max_num) {
 	return a;
 }
 
-#ifdef MODULE
-#define FBINFO_DEFAULT	FBINFO_MODULE
-#else
-#define FBINFO_DEFAULT	0
-#endif
-
-// This will go away
-#define FBINFO_FLAG_MODULE	FBINFO_MODULE
 #define FBINFO_FLAG_DEFAULT	FBINFO_DEFAULT
 
 /* This will go away
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
-- 
Sean Paul, Software Engineer, Google / Chromium OS

Re: [PATCH 4/4] drm/<drivers>: Drop fbdev info flags

From: Sean Paul <hidden>
Date: 2017-07-13 14:52:05

On Thu, Jul 06, 2017 at 02:57:35PM +0200, Daniel Vetter wrote:
- FBINFO_CAN_FORCE_OUTPUT has been a lie ever since we nerfed&removed
  the entire panic handling code in our fbdev emulation. We might
  restore kms panic output, but not through the bazillion of legacy
  code layers called fbdev/fbcon, there's just no way to make that
  work safely.

- With the module check change FBINFO_DEFAULT is always 0, so can be
  removed too.

That removes another change to cargo-cult stuff in kms drivers, yay!

Signed-off-by: Daniel Vetter <redacted>
Reviewed-by: Sean Paul <redacted>
quoted hunk
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c            | 1 -
 drivers/gpu/drm/armada/armada_fbdev.c             | 1 -
 drivers/gpu/drm/ast/ast_fb.c                      | 1 -
 drivers/gpu/drm/bochs/bochs_fbdev.c               | 1 -
 drivers/gpu/drm/cirrus/cirrus_fbdev.c             | 1 -
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 1 -
 drivers/gpu/drm/i915/intel_fbdev.c                | 1 -
 drivers/gpu/drm/mgag200/mgag200_fb.c              | 1 -
 drivers/gpu/drm/msm/msm_fbdev.c                   | 1 -
 drivers/gpu/drm/omapdrm/omap_fbdev.c              | 1 -
 drivers/gpu/drm/qxl/qxl_fb.c                      | 1 -
 drivers/gpu/drm/radeon/radeon_fb.c                | 1 -
 drivers/gpu/drm/udl/udl_fb.c                      | 1 -
 drivers/gpu/drm/virtio/virtgpu_fb.c               | 1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_fb.c                | 1 -
 15 files changed, 15 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index c0d8c6ff6380..1c57fefc364c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -245,7 +245,6 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &amdgpufb_ops;
 
 	tmp = amdgpu_bo_gpu_offset(abo) - adev->mc.vram_start;
diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c
index 602dfead8eef..5b479b0ed06c 100644
--- a/drivers/gpu/drm/armada/armada_fbdev.c
+++ b/drivers/gpu/drm/armada/armada_fbdev.c
@@ -81,7 +81,6 @@ static int armada_fb_create(struct drm_fb_helper *fbh,
 
 	strlcpy(info->fix.id, "armada-drmfb", sizeof(info->fix.id));
 	info->par = fbh;
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &armada_fb_ops;
 	info->fix.smem_start = obj->phys_addr;
 	info->fix.smem_len = obj->obj.size;
diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 4ad4acd0ccab..53ca6d099234 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -231,7 +231,6 @@ static int astfb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "astdrmfb");
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &astfb_ops;
 
 	info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);
diff --git a/drivers/gpu/drm/bochs/bochs_fbdev.c b/drivers/gpu/drm/bochs/bochs_fbdev.c
index 49d5a2b7d630..14eb8d0d5a00 100644
--- a/drivers/gpu/drm/bochs/bochs_fbdev.c
+++ b/drivers/gpu/drm/bochs/bochs_fbdev.c
@@ -118,7 +118,6 @@ static int bochsfb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "bochsdrmfb");
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &bochsfb_ops;
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
diff --git a/drivers/gpu/drm/cirrus/cirrus_fbdev.c b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
index 7fa58eeadc9d..c69586163d92 100644
--- a/drivers/gpu/drm/cirrus/cirrus_fbdev.c
+++ b/drivers/gpu/drm/cirrus/cirrus_fbdev.c
@@ -215,7 +215,6 @@ static int cirrusfb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "cirrusdrmfb");
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &cirrusfb_ops;
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
index f5ac80daeef2..9740eed9231a 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c
@@ -131,7 +131,6 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "hibmcdrmfb");
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &hibmc_drm_fb_ops;
 
 	drm_fb_helper_fill_fix(info, hi_fbdev->fb->fb.pitches[0],
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 5536591d3da0..b953365a3eec 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -232,7 +232,6 @@ static int intelfb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "inteldrmfb");
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &intelfb_ops;
 
 	/* setup aperture base/size for vesafb takeover */
diff --git a/drivers/gpu/drm/mgag200/mgag200_fb.c b/drivers/gpu/drm/mgag200/mgag200_fb.c
index 5d3b1fac906f..e94d78a32fe0 100644
--- a/drivers/gpu/drm/mgag200/mgag200_fb.c
+++ b/drivers/gpu/drm/mgag200/mgag200_fb.c
@@ -210,7 +210,6 @@ static int mgag200fb_create(struct drm_fb_helper *helper,
 
 	strcpy(info->fix.id, "mgadrmfb");
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &mgag200fb_ops;
 
 	/* setup aperture base/size for vesafb takeover */
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
index 5ecf4ff9a059..9c00fedfc741 100644
--- a/drivers/gpu/drm/msm/msm_fbdev.c
+++ b/drivers/gpu/drm/msm/msm_fbdev.c
@@ -143,7 +143,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper,
 	helper->fb = fb;
 
 	fbi->par = helper;
-	fbi->flags = FBINFO_DEFAULT;
 	fbi->fbops = &msm_fb_ops;
 
 	strcpy(fbi->fix.id, "msm");
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c
index daf81a0a2899..9273118040b7 100644
--- a/drivers/gpu/drm/omapdrm/omap_fbdev.c
+++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c
@@ -184,7 +184,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,
 	helper->fb = fb;
 
 	fbi->par = helper;
-	fbi->flags = FBINFO_DEFAULT;
 	fbi->fbops = &omap_fb_ops;
 
 	strcpy(fbi->fix.id, MODULE_NAME);
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 69e7359b562a..844c4a31ca13 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -275,7 +275,6 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &qxlfb_ops;
 
 	/*
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c
index 356ad90a5238..e141fcd5e8e1 100644
--- a/drivers/gpu/drm/radeon/radeon_fb.c
+++ b/drivers/gpu/drm/radeon/radeon_fb.c
@@ -264,7 +264,6 @@ static int radeonfb_create(struct drm_fb_helper *helper,
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &radeonfb_ops;
 
 	tmp = radeon_bo_gpu_offset(rbo) - rdev->mc.vram_start;
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
index 4a6500362564..a5c54dc60def 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -393,7 +393,6 @@ static int udlfb_create(struct drm_fb_helper *helper,
 	info->fix.smem_len = size;
 	info->fix.smem_start = (unsigned long)ufbdev->ufb.obj->vmapping;
 
-	info->flags = FBINFO_DEFAULT | FBINFO_CAN_FORCE_OUTPUT;
 	info->fbops = &udlfb_ops;
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 	drm_fb_helper_fill_var(info, &ufbdev->helper, sizes->fb_width, sizes->fb_height);
diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c b/drivers/gpu/drm/virtio/virtgpu_fb.c
index 33df067b11c1..046e28b69d99 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fb.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fb.c
@@ -273,7 +273,6 @@ static int virtio_gpufb_create(struct drm_fb_helper *helper,
 	vfbdev->helper.fb = fb;
 
 	strcpy(info->fix.id, "virtiodrmfb");
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &virtio_gpufb_ops;
 	info->pixmap.flags = FB_PIXMAP_SYSTEM;
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index 6f4cb4678cbc..d23a18aae476 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -779,7 +779,6 @@ int vmw_fb_init(struct vmw_private *vmw_priv)
 	info->screen_base = (char __iomem *)par->vmalloc;
 	info->screen_size = fb_size;
 
-	info->flags = FBINFO_DEFAULT;
 	info->fbops = &vmw_fb_ops;
 
 	/* 24 depth per default */
-- 
2.13.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
-- 
Sean Paul, Software Engineer, Google / Chromium OS

Re: [PATCH 1/4] fbcon: Make fbcon a built-time depency for fbdev

From: Daniel Vetter <hidden>
Date: 2017-07-13 18:49:50

On Thu, Jul 13, 2017 at 4:47 PM, Sean Paul [off-list ref] wrote:
On Thu, Jul 06, 2017 at 02:57:32PM +0200, Daniel Vetter wrote:

<snip>
quoted
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <redacted>
Just 2 nits, code looks good.

Reviewed-by: Sean Paul <redacted>
quoted
---
v2: Switch to building fbcon code into fb.ko right away because the
cheap trick leads to a module depency loop.
---
 drivers/video/console/Kconfig                        |  2 +-
 drivers/video/console/Makefile                       |  8 --------
 drivers/video/fbdev/core/Makefile                    | 11 +++++++++++
 drivers/video/{console => fbdev/core}/bitblit.c      |  4 ----
 drivers/video/{console => fbdev/core}/fbcon.c        | 13 +++----------
 drivers/video/{console => fbdev/core}/fbcon.h        |  0
 drivers/video/{console => fbdev/core}/fbcon_ccw.c    |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_cw.c     |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_rotate.c |  4 ----
 drivers/video/{console => fbdev/core}/fbcon_rotate.h |  0
 drivers/video/{console => fbdev/core}/fbcon_ud.c     |  4 ----
 drivers/video/fbdev/core/fbmem.c                     |  6 ++++++
 drivers/video/{console => fbdev/core}/softcursor.c   |  4 ----
 drivers/video/{console => fbdev/core}/tileblit.c     |  5 -----
 include/linux/fbcon.h                                | 12 ++++++++++++
 15 files changed, 33 insertions(+), 48 deletions(-)
 rename drivers/video/{console => fbdev/core}/bitblit.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon.c (99%)
 rename drivers/video/{console => fbdev/core}/fbcon.h (100%)
 rename drivers/video/{console => fbdev/core}/fbcon_ccw.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon_cw.c (98%)
 rename drivers/video/{console => fbdev/core}/fbcon_rotate.c (95%)
 rename drivers/video/{console => fbdev/core}/fbcon_rotate.h (100%)
 rename drivers/video/{console => fbdev/core}/fbcon_ud.c (98%)
 rename drivers/video/{console => fbdev/core}/softcursor.c (93%)
 rename drivers/video/{console => fbdev/core}/tileblit.c (96%)
 create mode 100644 include/linux/fbcon.h
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 2111d06f8c81..7f1f1fbcef9e 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -117,7 +117,7 @@ config DUMMY_CONSOLE_ROWS
           Select 25 if you use a 640x480 resolution by default.

 config FRAMEBUFFER_CONSOLE
-     tristate "Framebuffer Console support"
+     bool "Framebuffer Console support"
      depends on FB && !UML
      select VT_HW_CONSOLE_BINDING
      select CRC32
diff --git a/drivers/video/console/Makefile b/drivers/video/console/Makefile
index 43bfa485db96..eb2cbec52643 100644
--- a/drivers/video/console/Makefile
+++ b/drivers/video/console/Makefile
@@ -7,13 +7,5 @@ obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o
 obj-$(CONFIG_STI_CONSOLE)         += sticon.o sticore.o
 obj-$(CONFIG_VGA_CONSOLE)         += vgacon.o
 obj-$(CONFIG_MDA_CONSOLE)         += mdacon.o
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o bitblit.o softcursor.o
-ifeq ($(CONFIG_FB_TILEBLITTING),y)
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE)     += tileblit.o
-endif
-ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y)
-obj-$(CONFIG_FRAMEBUFFER_CONSOLE)     += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \
-                                         fbcon_ccw.o
-endif

 obj-$(CONFIG_FB_STI)              += sticore.o
diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile
index 9e3ddf225393..0214b863ac3f 100644
--- a/drivers/video/fbdev/core/Makefile
+++ b/drivers/video/fbdev/core/Makefile
@@ -4,6 +4,17 @@ obj-$(CONFIG_FB)                  += fb.o
 fb-y                              := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
                                      modedb.o fbcvt.o
 fb-$(CONFIG_FB_DEFERRED_IO)       += fb_defio.o
+
+ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE),y)
+fb-y                           += fbcon.o bitblit.o softcursor.o
fb-$(CONFIG_FRAMEBUFFER_CONSOLE) ?
The ifeq is longer than just this line ...
quoted
+ifeq ($(CONFIG_FB_TILEBLITTING),y)
+fb-y                           += tileblit.o
+endif
+ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y)
+fb-y                           += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \
+                                  fbcon_ccw.oli
+endif
+endif
 fb-objs                           := $(fb-y)

 obj-$(CONFIG_FB_CFB_FILLRECT)  += cfbfillrect.o
<snip>
quoted
diff --git a/include/linux/fbcon.h b/include/linux/fbcon.h
new file mode 100644
index 000000000000..0fac6305d51c
--- /dev/null
+++ b/include/linux/fbcon.h
IANAL, but it seems like you're missing some GPL legalese here?
There's a pile of headers which don't have the GPL header (like
linux/fb.h), I went with the local style ... not strictly necessary I
think.
-Daniel
Sean
quoted
@@ -0,0 +1,12 @@
+#ifndef _LINUX_FBCON_H
+#define _LINUX_FBCON_H
+
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE
+void __init fb_console_init(void);
+void __exit fb_console_exit(void);
+#else
+static void fb_console_init(void) {}
+static void fb_console_exit(void) {}
+#endif
+
+#endif /* _LINUX_FBCON_H */
--
2.13.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS


-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

Re: [PATCH 3/4] drm/qxl: Drop fbdev hwaccel flags

From: Daniel Vetter <hidden>
Date: 2017-07-19 07:39:14

On Thu, Jul 06, 2017 at 02:57:34PM +0200, Daniel Vetter wrote:
It's not accelarated, just system memory. Note we don't even need to
set the default flag since that's now always 0.

Cc: Dave Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Daniel Vetter <redacted>
Merged with Dave's irc-ack + commit message amended that qxl once had
accel, but that was removed in 2015.
-Daniel
quoted hunk
---
 drivers/gpu/drm/qxl/qxl_fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/qxl/qxl_fb.c b/drivers/gpu/drm/qxl/qxl_fb.c
index 573e7e9a5f98..69e7359b562a 100644
--- a/drivers/gpu/drm/qxl/qxl_fb.c
+++ b/drivers/gpu/drm/qxl/qxl_fb.c
@@ -275,7 +275,7 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
 
 	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
 
-	info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
+	info->flags = FBINFO_DEFAULT;
 	info->fbops = &qxlfb_ops;
 
 	/*
-- 
2.13.2
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Re: [PATCH 1/4] fbcon: Make fbcon a built-time depency for fbdev

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2017-08-01 15:43:15

On Wednesday, July 12, 2017 12:40:45 PM Bartlomiej Zolnierkiewicz wrote:
On Thursday, July 06, 2017 02:57:32 PM Daniel Vetter wrote:
quoted
There's a bunch of folks who're trying to make printk less
contended and faster, but there's a problem: printk uses the
console_lock, and the console lock has become the BKL for all things
fbdev/fbcon, which in turn pulled in half the drm subsystem under that
lock. That's awkward.

There reasons for that is probably just a historical accident:

- fbcon is a runtime option of fbdev, i.e. at runtime you can pick
  whether your fbdev driver instances are used as kernel consoles.
  Unfortunately this wasn't implemented with some module option, but
  through some module loading magic: As long as you don't load
  fbcon.ko, there's no fbdev console support, but loading it (in any
  order wrt fbdev drivers) will create console instances for all fbdev
  drivers.

- This was implemented through a notifier chain. fbcon.ko enumerates
  all fbdev instances at load time and also registers itself as
  listener in the fbdev notifier. The fbdev core tries to register new
  fbdev instances with fbcon using the notifier.

- On top of that the modifier chain is also used at runtime by the
  fbdev subsystem to e.g. control backlights for panels.

- The problem is that the notifier puts a mutex locking context
  between fbdev and fbcon, which mixes up the locking contexts for
  both the runtime usage and the register time usage to notify fbcon.
  And at runtime fbcon (through the fbdev core) might call into the
  notifier from a printk critical section while console_lock is held.

- This means console_lock must be an outer lock for the entire fbdev
  subsystem, which also means it must be acquired when registering a
  new framebuffer driver as the outermost lock since we might call
  into fbcon (through the notifier) which would result in a locking
  inversion if fbcon would acquire the console_lock from its notifier
  callback (which it needs to register the console).

- console_lock can be held anywhere, since printk can be called
  anywhere, and through the above story, plus drm/kms being an fbdev
  driver, we pull in a shocking amount of locking hiercharchy
  underneath the console_lock. Which makes cleaning up printk really
  hard (not even splitting console_lock into an rwsem is all that
  useful due to this).

There's various ways to address this, but the cleanest would be to
make fbcon a compile-time option, where fbdev directly calls the fbcon
register functions from register_framebuffer, or dummy static inline
versions if fbcon is disabled. Maybe augmented with a runtime knob to
disable fbcon, if that's needed (for debugging perhaps).

But this could break some users who rely on the magic "loading
fbcon.ko enables/disables fbdev framebuffers at runtime" thing, even
if that's unlikely. Hence we must be careful:

1. Create a compile-time dependency between fbcon and fbdev in the
least minimal way. This is what this patch does.

2. Wait at least 1 year to give possible users time to scream about
how we broke their setup. Unlikely, since all distros make fbcon
compile-in, and embedded platforms only compile stuff they know they
need anyway. But still.

3. Convert the notifier to direct functions calls, with dummy static
inlines if fbcon is disabled. We'll still need the fb notifier for the
other uses (like backlights), but we can probably move it into the fb
core (atm it must be built-into vmlinux).

4. Push console_lock down the call-chain, until it is down in
console_register again.

5. Finally start to clean up and rework the printk/console locking.

For context of this saga see

commit 50e244cc793d511b86adea24972f3a7264cae114
Author: Alan Cox [off-list ref]
Date:   Fri Jan 25 10:28:15 2013 +1000

    fb: rework locking to fix lock ordering on takeover

plus the pile of commits on top that tried to make this all work
without terminally upsetting lockdep. We've uncovered all this when
console_lock lockdep annotations where added in

commit daee779718a319ff9f83e1ba3339334ac650bb22
Author: Daniel Vetter [off-list ref]
Date:   Sat Sep 22 19:52:11 2012 +0200

    console: implement lockdep support for console_lock

On the patch itself:
- Switch CONFIG_FRAMEBUFFER_CONSOLE to be a boolean, using the overall
  CONFIG_FB tristate to decided whether it should be a module or
  built-in.

- At first I thought I could force the build depency with just a dummy
  symbol that fbcon.ko exports and fb.ko uses. But that leads to a
  module depency cycle (it works fine when built-in).

  Since this tight binding is the entire goal the simplest solution is
  to move all the fbcon modules (and there's a bunch of optinal
  source-files which are each modules of their own, for no good
  reason) into the overall fb.ko core module. That's a bit more than
  what I would have liked to do in this patch, but oh well.

Cc: Alan Cox <redacted>
Cc: Sergey Senozhatsky <redacted>
Cc: Linux Fbdev development list <redacted>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Daniel Vetter <redacted>
Patch queued for 4.14, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

Re: [PATCH] fbdev: Nuke FBINFO_MODULE

From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2017-08-01 15:43:24

On Thursday, July 13, 2017 04:01:50 PM Bartlomiej Zolnierkiewicz wrote:
On Wednesday, July 12, 2017 05:07:42 PM Daniel Vetter wrote:
quoted
On Wed, Jul 12, 2017 at 2:54 PM, Bartlomiej Zolnierkiewicz
[off-list ref] wrote:
quoted
On Wednesday, July 12, 2017 02:42:14 PM Daniel Vetter wrote:
quoted
On Wed, Jul 12, 2017 at 12:41:34PM +0200, Bartlomiej Zolnierkiewicz wrote:
quoted
On Tuesday, July 11, 2017 04:52:19 PM Daniel Vetter wrote:
quoted
Instead check info->ops->owner, which amounts to the same.

Spotted because I want to remove the pile of broken and cargo-culted
fb_info->flags assignments in drm drivers.

v2: Fixup matrox (reported by kbuild). Also nuke FBINFO_FLAG_* defines
that I've failed to spot.

v3: Don't nuke FBINFO_FLAG_DEFAULT, that's used all over the place.

Cc: Bartlomiej Zolnierkiewicz <redacted>
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Daniel Vetter <redacted>
Acked-by: Bartlomiej Zolnierkiewicz <redacted>
Do you plan to pick these two patches up yourself, or do you expect me to
merge them?
Since the original patchset contained DRM changes (two last patches)
depending on fbdev changes (two first patches, the patch being discussed
was the second one) I assumed that you would like to take them all
through DRM tree. If this is not what is preferred, please tell me.
There's no direct depency between 1&2 and 3&4, the only effect of
merging them through separate trees is that the bootup logo might not
show up when it's expected, until the trees are merged together. We
could merge them through separate trees if you prefer that (I forgot
to mention that in the cover letter), but I'm fine with putting them
all into drm-misc with your ack for 4.14.

Whatever you prefer, I don't mind either way.
Then I will merge patches 1&2 for v4.14 through fbdev tree (there are
some other changes pending touching fbdev core and I would like to avoid
conflicts between fbdev & drm-misc trees). Thanks!
Patch queued for 4.14, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help