Re: [PATCH v2 2/3] drm: simpledrm: add fbdev fallback support

From: Noralf TrÃnnes
Date: Mon Aug 08 2016 - 09:38:13 EST



Den 06.08.2016 00:38, skrev Paul Gortmaker:
On Fri, Aug 5, 2016 at 11:44 AM, Noralf TrÃnnes <noralf@xxxxxxxxxxx> wrote:
Create a simple fbdev device during SimpleDRM setup so legacy user-space
and fbcon can use it.

Original work by David Herrmann.

Cc: dh.herrmann@xxxxxxxxx
Signed-off-by: Noralf TrÃnnes <noralf@xxxxxxxxxxx>
---

Changes from version 1:
No changes

Changes from previous version:
- Remove the DRM_SIMPLEDRM_FBDEV kconfig option and use DRM_FBDEV_EMULATION
- Suspend fbcon/fbdev when the pipeline is enabled, resume in lastclose
- Add FBINFO_CAN_FORCE_OUTPUT flag so we get oops'es on the console

<snip>

diff --git a/drivers/gpu/drm/simpledrm/simpledrm_fbdev.c b/drivers/gpu/drm/simpledrm/simpledrm_fbdev.c
new file mode 100644
index 0000000..b83646b
--- /dev/null
+++ b/drivers/gpu/drm/simpledrm/simpledrm_fbdev.c
@@ -0,0 +1,160 @@
+/*
+ * SimpleDRM firmware framebuffer driver
+ * Copyright (c) 2012-2014 David Herrmann <dh.herrmann@xxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+/*
+ * fbdev compatibility layer
+ * We provide a basic fbdev device for the same framebuffer that is used for
+ * the pseudo CRTC.
+ */
+
+#include <linux/console.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/module.h>
You should not need module.h here since this file is not doing the
module_init or module_exit or MODULE_ALIAS etc etc.

An empty file with just module.h in it outputs about 750k of goo
from cpp, so it is best avoided wherever not strictly needed.

I've never thought of superfluous includes in terms of compile time before,
but that makes sense, especially on a large project like this.

Thanks,
Noralf.


Thanks,
Paul.
--

+#include <linux/string.h>
+#include <linux/fb.h>
+#include "simpledrm.h"
+