SimpleDRM & Sysfb
Subsystems (9)
cover SimpleDRM & Sysfb
Hi
Another round of SimpleDRM patches. I somehow lost track of the last ones and as this is a major rewrite, I'll just start at v1 again.
Some comments up-front:
- @Ingo: Patch #1 and #2 are unchanged from the previous ML discussions. I included them in this series as the other patches depend on them. Could you pick them up for the x86 tree? The other 9 patches won't make it in 3.14 so no reason to put them through the DRM tree.
All mentioned issues should be addressed. If there's still sth missing, please let me know.
- The DRM patches depend on my "DRM Anonymous Inode" patches. But it should be trivial to apply them on drm-next (I think only one line needs to be changed:
i_mapping => dev_mapping).
- I tested the SimpleDRM fbdev fallback with linux-console+Xorg and it works fine. The DRM backend is only tested with some DRM tests I have locally. I have no idea how to make Xorg pick up a specific /dev/dri/card0 card. It always tells me "no screens found" (as the underlying device is not marked as boot_vga..). If someone knows how to tell Xorg to use card0, I'd gladly test this. But I'm no longer used to writing xorg.confs..
This series introduces two new concepts: sysfb and SimpleDRM
Sysfb is just a generalization of the x86-sysfb concept. It allows to register firmware-framebuffers with the system as platform-devices. This way, drivers can properly bind to these devices and we prevent multiple drivers from accessing the same firmware-framebuffer.
Sysfb also provides hooks to get a safe handover to real hw-drivers (like i915). Please see the "video: sysfb: add generic firmware-fb interface" patch for a thorough description of the API. This patch also adds a rather verbose documentation of all known firmware-fb facilities.
As second part, this series introduces SimpleDRM. It's a very basic DRM driver that can replace efifb, vesafb, simplefb and friends. It's 100% compatible to the "udl" DRM driver, so user-space like xf86-video-modesetting can pick them up just fine. User-space that cannot deal with drmModeDirtyFB() (like weston and friends) currently cannot use SimpleDRM. However, that's also true for all other DRM drivers which provide shadow framebuffers. We could provide something like FB-DEFIO, but that's just useless overhead to paper of lazy user-space.
I have tested this with all hardware that I have at home, with a lot hand-over combinations (with/without SYSFB, with efifb/vesafb/simplefb, with SimpleDRM, ...) and all worked great so far.
Comments welcome!
David
David Herrmann (11):
x86: sysfb: fool-proof CONFIG_X86_SYSFB
x86: sysfb: remove sysfb when probing real hw
fbdev: efifb: add dev->remove() callback
fbdev: vesafb: add dev->remove() callback
x86: sysfb: store apertures in simplefb platform-data
video: sysfb: add generic firmware-fb interface
drm: mgag200: remove redundant fbdev removal drm/i915: remove sysfbs early
drm: add SimpleDRM driver
drm: simpledrm: add fbdev fallback support x86/sysfb: allow sysfb+simpledrm combination
Documentation/firmware-fbs.txt | 236 +++++++++++++++++ MAINTAINERS | 8 + arch/x86/Kconfig | 2 + arch/x86/include/asm/sysfb.h | 6 +- arch/x86/kernel/sysfb.c | 3 +- arch/x86/kernel/sysfb_simplefb.c | 97 ++++--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.c | 6 + drivers/gpu/drm/mgag200/mgag200_main.c | 9 - drivers/gpu/drm/simpledrm/Kconfig | 29 +++ drivers/gpu/drm/simpledrm/Makefile | 4 + drivers/gpu/drm/simpledrm/simpledrm.c | 263 +++++++++++++++++++ drivers/gpu/drm/simpledrm/simpledrm.h | 122 +++++++++ drivers/gpu/drm/simpledrm/simpledrm_damage.c | 306 ++++++++++++++++++++++ drivers/gpu/drm/simpledrm/simpledrm_fbdev.c | 148 +++++++++++ drivers/gpu/drm/simpledrm/simpledrm_gem.c | 282 +++++++++++++++++++++ drivers/gpu/drm/simpledrm/simpledrm_kms.c | 365 +++++++++++++++++++++++++++ drivers/video/Kconfig | 3 + drivers/video/Makefile | 1 + drivers/video/efifb.c | 13 +- drivers/video/fbmem.c | 17 +- drivers/video/simplefb.c | 8 - drivers/video/sysfb.c | 348 +++++++++++++++++++++++++ drivers/video/vesafb.c | 13 +- include/linux/fb.h | 9 +- include/linux/platform_data/simplefb.h | 2 + include/linux/sysfb.h | 62 +++++ 28 files changed, 2299 insertions(+), 66 deletions(-) create mode 100644 Documentation/firmware-fbs.txt create mode 100644 drivers/gpu/drm/simpledrm/Kconfig create mode 100644 drivers/gpu/drm/simpledrm/Makefile create mode 100644 drivers/gpu/drm/simpledrm/simpledrm.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm.h create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_damage.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_fbdev.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_gem.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_kms.c create mode 100644 drivers/video/sysfb.c create mode 100644 include/linux/sysfb.h
Signature · 1 line
1.8.5.3
PATCH 1/11 x86: sysfb: fool-proof CONFIG_X86_SYSFB
Turns out, people do not read help-texts of new config-options and enable them nonetheless. So several reports came in with X86_SYSFB=y and FB_SIMPLE=n, which in almost all situations prevents firmware-fbs from being probed.
X86_SYSFB clearly states that it turns legacy vesa/efi framebuffers into a format compatible to simplefb (and does nothing else..). So to avoid further complaints about missing gfx-support during boot, simply depend on FB_SIMPLE now.
As FB_SIMPLE is disabled by default and usually only enabled on selected ARM architectures, x86 users should thus never see the X86_SYSFB config-option. And if they do, everything is fine as simplefb will be available.
Note that most of the sysfb code is enabled independently of X86_SYSFB. The config option only selects a compatibility mode for simplefb. It was introduced to ease the transition to SimpleDRM and disabling fbdev. As this is still ongoing, there's no need for non-developers to care for X86_SYSFB so we can safely hide it behind FB_SIMPLE.
--- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/x86/Kconfig +1 -0
@@ -2299,6 +2299,7 @@ source "drivers/rapidio/Kconfig" config X86_SYSFB bool "Mark VGA/VBE/EFI FB as generic system framebuffer" + depends on FB_SIMPLE help Firmwares often provide initial graphics framebuffers so the BIOS, bootloader or kernel can show basic video-output during boot for
Signature · 1 line
1.8.5.3
PATCH 2/11 x86: sysfb: remove sysfb when probing real hw
In reply to David HerrmannWith CONFIG_X86_SYSFB=y, probing real hw-drivers may result in resource-conflicts and drivers will refuse to load. A call to request_mem_region() will fail, if the region overlaps with the mem-region used by simplefb. The common desktop DRM drivers (intel, nouveau, radeon) are not affected as they don't reserve their resources, but some others do, including (nvidiafb, cirrus, ..).
The problem is that we add an IORESOURCE_MEM to the simple-framebuffer platform-device during bootup but never release it. Probing simplefb on this platform-device is fine, but the handover to real-hw via remove_conflicting_framebuffers() will only unload the fbdev driver, but keep the platform-device around. Thus, if the real hw-driver calls request_mem_region() and friends on the same PCI region, we will get a resource conflict and most drivers refuse to load. Users will see errors like:
"nvidiafb: cannot reserve video memory at <xyz>"
vesafb and efifb don't store any resources, so disabling CONFIG_X86_SYSFB and falling back to those drivers will avoid the bug. With sysfb enabled, we need to properly unload the simple-framebuffer devices before probing real hw-drivers.
This patch adds sysfb_unregister() for that purpose. It can be called from any context (except from the platform-device ->probe and ->remove callback path), synchronously unloads any global sysfb and prevents new sysfbs from getting registered. Thus, you can call it even before any sysfb has been loaded. Note that for now we only do that for simple-framebuffer devices, as efi/vesa-framebuffer platform-drivers lack ->remove() callbacks. They're not affected by the resource-conflicts, so we can fix those later.
This also changes remove_conflicting_framebuffer() to call this helper *before* trying its heuristic to remove conflicting drivers. This way, we unload sysfbs properly on any conflict. But to avoid dead-locks in register_framebuffer(), we must not call sysfb_unregister() for framebuffers probing on sysfb devices. Hence, we simply remove any aperture from simplefb and we're good to go. simplefb is unregistered by sysfb_unregister() now, so no reason to keep the apertures (on non-x86, there currently is no handover from simplefb, so we're fine. If it's added, they need to provide something like sysfb_unregister() too)
--- arch/x86/include/asm/sysfb.h | 5 ++++ arch/x86/kernel/sysfb.c | 65 ++++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/sysfb_simplefb.c | 9 ++---- drivers/video/fbmem.c | 11 +++++++ drivers/video/simplefb.c | 8 ----- 5 files changed, 83 insertions(+), 15 deletions(-)
arch/x86/include/asm/sysfb.h +5 -0
@@ -59,6 +59,11 @@ struct efifb_dmi_info {int flags; }; +int __init sysfb_register (const char *name,int id, +const struct resource *res,unsigned int res_num, +const void *data,size_t data_size); +void sysfb_unregister (const struct apertures_struct *apert,bool primary); +#ifdef CONFIG_EFI extern struct efifb_dmi_info efifb_dmi_list[];
arch/x86/kernel/sysfb.c +65 -0
76 lines not on this page · raw message
arch/x86/kernel/sysfb_simplefb.c +2 -7
@@ -64,7 +64,6 @@ __init bool parse_mode(const struct screen_info *si,__init int create_simplefb (const struct screen_info *si,const struct simplefb_platform_data *mode) { -struct platform_device *pd;struct resource res;unsigned long len;
@@ -86,10 +85,6 @@ __init int create_simplefb(const struct screen_info *si,if (res.end <= res.start)return -EINVAL ; - pd =platform_device_register_resndata (NULL ,"simple-framebuffer" ,0 , - &res,1 , mode,sizeof (*mode)); -if (IS_ERR (pd)) -return PTR_ERR (pd); - -return 0 ; +return sysfb_register ("simple-framebuffer" ,0 , &res,1 , mode, +sizeof (*mode)); }
drivers/video/fbmem.c +11 -0
@@ -35,6 +35,9 @@#include <asm/fb.h> +#ifdef CONFIG_X86_SYSFB +# include <asm/sysfb.h> +#endif /* * Frame buffer device initialization and setup routines
@@ -1751,6 +1754,10 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, {int ret; +#ifdef CONFIG_X86_SYSFB +sysfb_unregister (a, primary); +#endif +mutex_lock (®istration_lock); ret =do_remove_conflicting_framebuffers (a, name, primary);mutex_unlock (®istration_lock);
@@ -1773,6 +1780,10 @@ register_framebuffer(struct fb_info *fb_info) {int ret; +#ifdef CONFIG_X86_SYSFB +sysfb_unregister (fb_info->apertures,fb_is_primary_device (fb_info)); +#endif +mutex_lock (®istration_lock); ret =do_register_framebuffer (fb_info);mutex_unlock (®istration_lock);
drivers/video/simplefb.c +0 -8
@@ -209,14 +209,6 @@ static int simplefb_probe(struct platform_device *pdev) info->var.blue = params.format->blue; info->var.transp = params.format->transp; - info->apertures =alloc_apertures (1 ); -if (!info->apertures) { -framebuffer_release (info); -return -ENOMEM ; - } - info->apertures->ranges[0 ].base = info->fix.smem_start; - info->apertures->ranges[0 ].size = info->fix.smem_len; - info->fbops = &simplefb_ops; info->flags =FBINFO_DEFAULT |FBINFO_MISC_FIRMWARE ; info->screen_base = ioremap_wc(info->fix.smem_start,
Signature · 1 line
1.8.5.3
Re: [PATCH 02/11] x86: sysfb: remove sysfb when probing real hw
Just a couple of small nits:
Quoted 49 lines · David Herrmann
arch/x86/kernel/sysfb.c +38
-0@@ -33,11 +33,76 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/mm.h> +#include <linux/mutex.h> #include <linux/platform_data/simplefb.h> #include <linux/platform_device.h> #include <linux/screen_info.h> #include <asm/sysfb.h> +static DEFINE_MUTEX (sysfb_lock); +static struct platform_device *sysfb_dev; + +int __init sysfb_register (const char *name,int id, +const struct resource *res,unsigned int res_num, +const void *data,size_t data_size) +{ +struct platform_device *pd; +int ret =0 ; + +mutex_lock (&sysfb_lock); +if (!sysfb_dev) { + pd =platform_device_register_resndata (NULL , name, id, + res, res_num, + data, data_size); +if (IS_ERR (pd)) + ret =PTR_ERR (pd); +else + sysfb_dev = pd; + } +mutex_unlock (&sysfb_lock); + +return ret; +} + +static bool sysfb_match (const struct apertures_struct *apert) +{ +struct screen_info *si = &screen_info; +unsigned int i; +const struct aperture *a; + +for (i =0 ; i < apert->count; ++i) { + a = &apert->ranges[i]; +if (a->base >= si->lfb_base && + a->base < si->lfb_base + ((u64 )si->lfb_size <<16 )) +return true; + if (si->lfb_base >= a->base &&
arch/x86/kernel/sysfb.c line 88
Quoted 10 lines
arch/x86/kernel/sysfb.c +10
-0+ si->lfb_base < a->base + a->size) +return true; + } + +return false; +} + +/* Remove sysfb and disallow new sysfbs from now on. Can be called from any +* context except recursively (see also remove_conflicting_framebuffers()). */ +void sysfb_unregister (const struct apertures_struct *apert,bool primary)
Please use the customary (multi-line) comment style:
/*
* Comment .....
* ...... goes here.
*/
specified in Documentation/CodingStyle.
arch/x86/kernel/sysfb.c line 91
Quoted 3 lines
arch/x86/kernel/sysfb.c +3
-0+#ifdef CONFIG_X86_SYSFB +# include <asm/sysfb.h> +#endif
I guess a single space is sufficient?
Better yet, I'd include sysfb.h unconditionally:
arch/x86/kernel/sysfb.c register_framebuffer(struct fb_info *fb_info) · line 1785
Quoted 7 lines
arch/x86/kernel/sysfb.c +3
-0@@ -1773,6 +1780,10 @@ register_framebuffer(struct fb_info *fb_info) {int ret; +#ifdef CONFIG_X86_SYSFB +sysfb_unregister (fb_info->apertures,fb_is_primary_device (fb_info)); +#endif
So, if a dummy sysfb_unregister() inline was defined in the !CONFIG_X86_SYSFB case then this ugly #ifdef could possibly be removed? Especially as it's used twice.
Thanks,
Ingo
Re: [PATCH 02/11] x86: sysfb: remove sysfb when probing real hw
Hi
Quoted 67 lines · Ingo Molnar
Just a couple of small nits:
Quoted 49 lines · David Herrmann
arch/x86/kernel/sysfb.c +38
-0@@ -33,11 +33,76 @@#include <linux/init.h> #include <linux/kernel.h> #include <linux/mm.h> +#include <linux/mutex.h> #include <linux/platform_data/simplefb.h> #include <linux/platform_device.h> #include <linux/screen_info.h> #include <asm/sysfb.h> +static DEFINE_MUTEX (sysfb_lock); +static struct platform_device *sysfb_dev; + +int __init sysfb_register (const char *name,int id, +const struct resource *res,unsigned int res_num, +const void *data,size_t data_size) +{ +struct platform_device *pd; +int ret =0 ; + +mutex_lock (&sysfb_lock); +if (!sysfb_dev) { + pd =platform_device_register_resndata (NULL , name, id, + res, res_num, + data, data_size); +if (IS_ERR (pd)) + ret =PTR_ERR (pd); +else + sysfb_dev = pd; + } +mutex_unlock (&sysfb_lock); + +return ret; +} + +static bool sysfb_match (const struct apertures_struct *apert) +{ +struct screen_info *si = &screen_info; +unsigned int i; +const struct aperture *a; + +for (i =0 ; i < apert->count; ++i) { + a = &apert->ranges[i]; +if (a->base >= si->lfb_base && + a->base < si->lfb_base + ((u64 )si->lfb_size <<16 )) +return true; + if (si->lfb_base >= a->base &&arch/x86/kernel/sysfb.c line 88
Quoted 10 lines
arch/x86/kernel/sysfb.c +10
-0+ si->lfb_base < a->base + a->size) +return true; + } + +return false; +} + +/* Remove sysfb and disallow new sysfbs from now on. Can be called from any +* context except recursively (see also remove_conflicting_framebuffers()). */ +void sysfb_unregister (const struct apertures_struct *apert,bool primary)Please use the customary (multi-line) comment style:
Quoted 6 lines
/*
* Comment .....
* ...... goes here.
*/specified in
Documentation/CodingStyle.
Whoops, will fix it up. Still used to that from HID code.
Quoted 7 lines
arch/x86/kernel/sysfb.c line 91
Quoted 3 lines
arch/x86/kernel/sysfb.c +3
-0+#ifdef CONFIG_X86_SYSFB +# include <asm/sysfb.h> +#endif I guess a single space is sufficient?
Better yet, I'd include
sysfb.hunconditionally:
Unconditionally won't work as only x86 has this header. If there's a way to place a dummy into asm-generic which is picked if arch/xy/include/asm/ doesn't have the header, let me know. But if I include it unconditionally without any fallback, this will fail on non-x86.
And adding the header to all archs seems overkill.
Quoted 11 lines
arch/x86/kernel/sysfb.c register_framebuffer(struct fb_info *fb_info) · line 1785
Quoted 7 lines
arch/x86/kernel/sysfb.c +3
-0@@ -1773,6 +1780,10 @@ register_framebuffer(struct fb_info *fb_info) {int ret; +#ifdef CONFIG_X86_SYSFB +sysfb_unregister (fb_info->apertures,fb_is_primary_device (fb_info)); +#endif So, if a dummy
sysfb_unregister()inline was defined in the !CONFIG_X86_SYSFB case then this ugly #ifdef could possibly be removed? Especially as it's used twice.
Again, this is fine for x86, but not for other archs. I would still need the #ifdef x86.
Note that patch #6 introduces linux/sysfb.h and removes all these ugly #ifdefs again. They're only needed to fix the x86 code *now*. Patch #6 generalizes the x86-sysfb infrastructure and makes it arch-independent. But Patch #6 introduces new features and thus shouldn't go to stable or 3.14.
As Patch #1 already fixes nearly all issues with sysfb, let me know if you want to drop this patch and just wait for the arch-independent sysfb to get merged. This patch is only needed if people enable X86_SYSFB *and* FB_SIMPLE *purposely* and want hw-handover. The case were people enable it accidentally is fixed by Patch #1. The situation is kind of screwed.. sorry for that.
Thanks
David
Re: [PATCH 02/11] x86: sysfb: remove sysfb when probing real hw
Quoted 9 lines · David Herrmann
Quoted 7 lines
drivers/video/fbmem.c line 40
Quoted 3 lines
drivers/video/fbmem.c +3
-0+#ifdef CONFIG_X86_SYSFB +# include <asm/sysfb.h> +#endif I guess a single space is sufficient?
Better yet, I'd include
sysfb.hunconditionally:Unconditionally won't work as only x86 has this header. [...]
Well, in non-x86 code an #ifdef x86 looks ugly as well - but I guess better than not building.
Quoted 2 lines
[...] If there's a way to place a dummy into asm-generic which is picked if
arch/xy/include/asm/doesn't have the header, let me know.
Not that I know of.
Quoted 2 lines
But if I include it unconditionally without any fallback, this will fail on non-x86. And adding the header to all archs seems overkill.
So why not drop the x86-ism and rename it to CONFIG_PLATFORM_SYSFB? Some platforms configure it, some don't. Then the prototypes could move into include/linux/sysfb.h or so and would be platform agnostic.
Thanks,
Ingo
Re: [PATCH 02/11] x86: sysfb: remove sysfb when probing real hw
Hi
Quoted 19 lines · Ingo Molnar
Quoted 9 lines · David Herrmann
Quoted 7 lines
drivers/video/fbmem.c line 40
Quoted 3 lines
drivers/video/fbmem.c +3
-0+#ifdef CONFIG_X86_SYSFB +# include <asm/sysfb.h> +#endif I guess a single space is sufficient?
Better yet, I'd include
sysfb.hunconditionally:Unconditionally won't work as only x86 has this header. [...]
Well, in non-x86 code an #ifdef x86 looks ugly as well - but I guess better than not building.
Quoted 2 lines
[...] If there's a way to place a dummy into asm-generic which is picked if
arch/xy/include/asm/doesn't have the header, let me know.
Quoted 8 lines
Not that I know of.
Quoted 2 lines
But if I include it unconditionally without any fallback, this will fail on non-x86. And adding the header to all archs seems overkill.
So why not drop the x86-ism and rename it to
CONFIG_PLATFORM_SYSFB? Some platforms configure it, some don't. Then the prototypes could move intoinclude/linux/sysfb.hor so and would be platform agnostic.
This is almost exactly what patch #6 does. But it also adds ~400 lines of kernel-doc and ~400 lines of Documentation/. Given your remarks, I guess I will just split this patch into code and docs, so we can just pick it up for stable in case patch #1 does not fix all issues.
Thanks
David
Re: [PATCH 02/11] x86: sysfb: remove sysfb when probing real hw
Quoted 24 lines · David Herrmann
Hi
Quoted 21 lines · Ingo Molnar
Quoted 9 lines · David Herrmann
Quoted 7 lines
drivers/video/fbmem.c line 40
Quoted 3 lines
drivers/video/fbmem.c +3
-0+#ifdef CONFIG_X86_SYSFB +# include <asm/sysfb.h> +#endif I guess a single space is sufficient?
Better yet, I'd include
sysfb.hunconditionally:Unconditionally won't work as only x86 has this header. [...]
Well, in non-x86 code an #ifdef x86 looks ugly as well - but I guess better than not building.
Quoted 2 lines
[...] If there's a way to place a dummy into asm-generic which is picked if
arch/xy/include/asm/doesn't have the header, let me know.Not that I know of.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
But if I include it unconditionally without any fallback, this will fail on non-x86. And adding the header to all archs seems overkill.
So why not drop the x86-ism and rename it to
CONFIG_PLATFORM_SYSFB? Some platforms configure it, some don't. Then the prototypes could move intoinclude/linux/sysfb.hor so and would be platform agnostic.This is almost exactly what patch #6 does. [...]
Indeed - I never got so far down into the series.
Quoted 4 lines
[...] But it also adds ~400 lines of kernel-doc and ~400 lines of
Documentation/. Given your remarks, I guess I will just split this patch into code and docs, so we can just pick it up for stable in case patch #1 does not fix all issues.
I have no objections to this form if it's fixed in a later patch and this one is easier to backport. I just missed that aspect.
Thanks,
Ingo
PATCH 3/11 fbdev: efifb: add dev->remove() callback
In reply to David HerrmannIf x86-sysfb platform-devices are removed from a system, we should properly unload efifb. Otherwise, we end up releasing the parent while our efi framebuffer is still running. This currently works just fine, but will cause problems on handover to real hw. So add the ->remove() callback and unregister efifb.
--- drivers/video/efifb.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/video/efifb.c +12 -1
@@ -73,7 +73,6 @@ static void efifb_destroy(struct fb_info *info)release_mem_region (info->apertures->ranges[0 ].base, info->apertures->ranges[0 ].size);fb_dealloc_cmap (&info->cmap); -framebuffer_release (info); }static struct fb_ops efifb_ops = {
@@ -244,6 +243,7 @@ static int efifb_probe(struct platform_device *dev) err = -ENOMEM ; goto err_release_mem; } +platform_set_drvdata (dev, info); info->pseudo_palette = info->par; info->par =NULL ;
@@ -337,12 +337,23 @@ err_release_mem:return err; } +static int efifb_remove (struct platform_device *pdev) +{ +struct fb_info *info =platform_get_drvdata (pdev); + +unregister_framebuffer (info); +framebuffer_release (info); + +return 0 ; +} +static struct platform_driver efifb_driver = { .driver = { .name ="efi-framebuffer" , .owner =THIS_MODULE , }, .probe = efifb_probe, + .remove = efifb_remove, };module_platform_driver (efifb_driver);
Signature · 1 line
1.8.5.3
PATCH 4/11 fbdev: vesafb: add dev->remove() callback
In reply to David HerrmannIf x86-sysfb platform-devices are removed from a system, we should properly unload vesafb. Otherwise, we end up releasing the parent while our vesa framebuffer is still running. This currently works just fine, but will cause problems on handover to real hw. So add the ->remove() callback and unregister vesafb.
--- drivers/video/vesafb.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/video/vesafb.c +12 -1
@@ -179,7 +179,6 @@ static void vesafb_destroy(struct fb_info *info)if (info->screen_base)iounmap (info->screen_base);release_mem_region (info->apertures->ranges[0 ].base, info->apertures->ranges[0 ].size); -framebuffer_release (info); }static struct fb_ops vesafb_ops = {
@@ -297,6 +296,7 @@ static int vesafb_probe(struct platform_device *dev)release_mem_region (vesafb_fix.smem_start, size_total);return -ENOMEM ; } +platform_set_drvdata (dev, info); info->pseudo_palette = info->par; info->par =NULL ;
@@ -499,12 +499,23 @@ err:return err; } +static int vesafb_remove (struct platform_device *pdev) +{ +struct fb_info *info =platform_get_drvdata (pdev); + +unregister_framebuffer (info); +framebuffer_release (info); + +return 0 ; +} +static struct platform_driver vesafb_driver = { .driver = { .name ="vesa-framebuffer" , .owner =THIS_MODULE , }, .probe = vesafb_probe, + .remove = vesafb_remove, };module_platform_driver (vesafb_driver);
Signature · 1 line
1.8.5.3
PATCH 5/11 x86: sysfb: store apertures in simplefb platform-data
In reply to David HerrmannTo get a generic remove_conflicting_framebuffers() for firmware-framebuffers, we need to store the apertures in the platform-data of each framebuffer. So make x86-sysfb do that for simple-framebuffer devices.
Unfortunately, "struct apertures_struct" contains a VLA so we cannot easily embed it. Thus, we have to use a "apert_buf" buffer with enough room for one "struct aperture".
--- arch/x86/include/asm/sysfb.h | 6 +-- arch/x86/kernel/sysfb.c | 2 +- arch/x86/kernel/sysfb_simplefb.c | 68 ++++++++++++++++++++-------------- include/linux/platform_data/simplefb.h | 1 + 4 files changed, 44 insertions(+), 33 deletions(-)
arch/x86/include/asm/sysfb.h +2 -4
@@ -81,8 +81,7 @@ static inline void sysfb_apply_efi_quirks(void)bool parse_mode (const struct screen_info *si,struct simplefb_platform_data *mode); -int create_simplefb (const struct screen_info *si, -const struct simplefb_platform_data *mode); +int create_simplefb (const struct simplefb_platform_data *mode);#else /* CONFIG_X86_SYSFB */
@@ -92,8 +91,7 @@ static inline bool parse_mode(const struct screen_info *si,return false; } -static inline int create_simplefb (const struct screen_info *si, -const struct simplefb_platform_data *mode) +static inline int create_simplefb (const struct simplefb_platform_data *mode) {return -EINVAL ; }
arch/x86/kernel/sysfb.c +1 -1
@@ -117,7 +117,7 @@ static __init int sysfb_init(void)/* try to create a simple-framebuffer device */ compatible =parse_mode (si, &mode);if (compatible) { - ret =create_simplefb (si, &mode); + ret =create_simplefb (&mode);if (!ret)return 0 ; }
arch/x86/kernel/sysfb_simplefb.c +40 -28
96 lines not on this page · raw message
include/linux/platform_data/simplefb.h +1 -0
@@ -59,6 +59,7 @@ struct simplefb_platform_data {u32 height;u32 stride;const char *format; + u8 apert_buf[sizeof(struct apertures_struct) + sizeof(struct aperture)]; };#endif /* __PLATFORM_DATA_SIMPLEFB_H__ */
Signature · 1 line
1.8.5.3
PATCH 6/11 video: sysfb: add generic firmware-fb interface
In reply to David HerrmannWe supported many different firmware-fbs in linux for a long time. On x86, we tried to unify the different types into platform-devices so their lifetime and drivers can be more easily controlled. This patch moves the x86-specific sysfb_*() helpers into drivers/video/sysfb.c so other architectures can make use of it, too.
The sysfb API consists of 4 functions:
sysfb_register()
sysfb_register_dyn()
sysfb_unregister()
sysfb_claim()
The first 3 can be used by architecture setup code to register firmware-framebuffers with the system/sysfb. Once the framebuffers are registered, matching platform-drivers will pick it up. Via sysfb_unregister() devices can be manually removed again, in case this is ever needed (x86 doesn't make use of this).
Real hw-drivers like i915/radeon/nouveau can use sysfb_claim() to evict any firmware-framebuffer from the system before accessing the hw. This guarantees that any previous driver (like vesafb/efifb) will be unloaded before the real hw driver takes over.
The sysfb file contains a thorough API documentation which explains the corner-cases and how we guarantee firmware-fb drivers can no longer interfere with real-hw drivers. Additionally, a short documentation of the different existing firmware-fbs and handover-mechanisms is put into Documentation/firmware-fbs.txt.
Compared to remove_conflicting_framebuffers(), the sysfb interface is independent of FBDEV. Thus, we can use it for DRM-only handovers.
--- Documentation/firmware-fbs.txt | 236 ++++++++++++++++++++++ arch/x86/Kconfig | 1 + arch/x86/include/asm/sysfb.h | 5 - arch/x86/kernel/sysfb.c | 64 ------ arch/x86/kernel/sysfb_simplefb.c | 26 ++- drivers/video/Kconfig | 3 + drivers/video/Makefile | 1 + drivers/video/fbmem.c | 24 ++- drivers/video/sysfb.c | 348 +++++++++++++++++++++++++++++++++ include/linux/fb.h | 9 +- include/linux/platform_data/simplefb.h | 1 + include/linux/sysfb.h | 62 ++++++ 12 files changed, 692 insertions(+), 88 deletions(-) create mode 100644 Documentation/firmware-fbs.txt create mode 100644 drivers/video/sysfb.c create mode 100644 include/linux/sysfb.h
Documentation/firmware-fbs.txt new file +236 -0
@@ -0,0 +1,236 @@ + Firmware Framebuffers +---------------------------------------------------------------------------- + +1. Intro +~~~~~~~~ +Modern firmware often initializes the graphics hardware before booting the +kernel. A basic framebuffer is created and used for single-buffered rendering. +Linux can detect such framebuffers and provide them to user-space. Early +user-space can use it to draw boot-splashs, disk-encryption prompts and more. +Once all hardware has been probed, real graphics drivers may take over. + +This document describes which firmware framebuffers are currently supported and +how the handover works. + +2. Supported Drivers +~~~~~~~~~~~~~~~~~~~~ +There are fbdev and DRM drivers which can make use of firmware framebuffers. +This currently includes: + + fbdev: + - vesafb: Uses VBE/VESA graphics mode + - efifb: Uses EFI UGA/GOP + - simplefb: Binds to custom platform-devices (eg., via DT) + - offb: Binds to custom platform-devices via DT + - vga16: Uses x86 VGA mode + DRM: + - SimpleDRM: Binds to custom platform-devices (eg., via DT) + +Furthermore, other miscellaneous drivers make use of firmware-framebuffers or +their properties. Their effect is discussed at the end of this document (this +includes vgacon and friends). + +3. Underlying Devices +~~~~~~~~~~~~~~~~~~~~~ +Firmware-framebuffer drivers use different techniques to detect devices and bind +to them. Some of these are compatible, some not. This section describes the +different device types. + +3.1 simple-framebuffer +~~~~~~~~~~~~~~~~~~~~~~ +The newest and most compatible way to represent firmware-fbs is to create a +"simple-framebuffer" platform-device. Early boot code in arch/ should create +such devices from device-tree data or other means of input (BIOS queries or boot +parameters). Such devices are picked up by simplefb or SimpleDRM and provided to +user-space as single raw framebuffer. + +Currently, the following ways exist to create such fbs: + - device-tree: + See: Documentation/devicetree/bindings/video/simple-framebuffer.txt + An example device-tree binding is: + framebuffer { + compatible = "simple-framebuffer"; + reg = <0x1d385000 (1600 * 1200 * 2)>; + width = <1600>; + height = <1200>; + stride = <(1600 * 2)>; + format = "r5g6b5"; + }; + - platform-data: + You can create platform-devices in arch/ setup code and set the platform-data + to "struct simplefb_platform_data". It is defined in: + include/linux/platform_data/simplefb.h + It contains the width, height, stride and format of the framebuffer. Base + address and size should be passed as primary IORESOURCE_MEM resource. + +Supported pixel-formats are listed in: + include/linux/platform_data/simplefb.h + +All new code should use either method to advertise firmware-fbs. Other means are +deprecated and may conflict with simple-framebuffers. If the simple-framebuffer +method is not suitable, it should be extended to fulfil your needs. If that's +not possible, you still should register your framebuffer with the device-model +so it can be properly detected and driver-binding is well defined. +See below (3.2 platform-devices) for other examples. + +3.2 platform-devices +~~~~~~~~~~~~~~~~~~~~ +There are a bunch of legacy device-types that are incompatible to the +"simple-framebuffer" platform-device or supported for backwards-compatibility. +All these devices are represented as a "struct platform_device" similar to +simple-framebuffers but with a different device-name. + + - "vesa-framebuffer": + On x86, a "vesa-framebuffer" platform-device is created if a VESA framebuffer + is detected during boot. The platform-data contains a pointer to the + "struct screen_info" related to the device. + Currently, only the vesafb driver binds to such devices. + - "efi-framebuffer": + On EFI systems, a "efi-framebuffer" platform-device is created if an EFI + framebuffer is provided by the firmware. Similar to vesa-framebuffers, the + platform-data contains a pointer to the "struct screen_info" related to the + device. + Currently, only the efifb driver binds to such devices. + +3.3 open-firmware: +~~~~~~~~~~~~~~~~~~ +There are several open-firmware based framebuffers that are supported by the +"offb.c" driver. These are all very similar to the simple-framebuffer +device-tree format and supported for compatibility reasons. See the offb.c +driver source for more information on the exact format. +Note that these are specific to the offb.c driver. They are *not* registered as +platform-device (or any other device) and don't integrate at all with the +device-model. Instead, only the fbdev device itself is registered as char-dev. +The underlying un-typed firmware-framebuffer is not represented by a +"struct device". + +3.4 "struct screen_info": +~~~~~~~~~~~~~~~~~~~~~~~~~ +The legacy mode to register firmware-fbs on x86 was to initialize a global +instance of type "struct screen_info". Drivers can access this object directly +via its name "screen_info". +This structure is defined in include/uapi/linux/screen_info.h and contains +pixel-mode information, base-address and size of the framebuffer. Drivers simply +use the information in this structure. There is no synchronization between those +drivers and no-one prevents multiple of these to bind to the same device. + +The screen_info.orig_video_isVGA field defines the hw-mode during bootup. It may +indicate a graphics or text-mode (see below 3.5 VGA for text-mode). This +structure is *not* modified if the mode changes during runtime. Thus, such +drivers will break if hotplugged after another driver was already loaded. + +vesafb and efifb have been converted to not use the global "screen_info" object +but instead bind to platform-devices. All other drivers that use "screen_info" +are deprecated and may not work well with hw-handover to real graphics drivers. +Note that some platform-devices contain a "struct screen_info" as platform-data, +which is fine! The platform-device itself provides synchronization and +driver-binding. It's only the drivers that rely on the global "screen_info" +object that will likely break during hw-takeover. + +3.5 VGA +~~~~~~~ +On x86, drivers may use VGA I/O registers directly to test for text-mode or +basic vga-graphics mode. These drivers usually verify that the system runs in a +compatible VGA-mode by reading the global "screen_info" object. + +VGA drivers suffer from the same problem as screen_info drivers (see 3.4). +No-one prevents multiple drivers from accessing the same device and there is no +sane hand-over to real hw-drivers. + +VGA drivers should be used with care (best: not used at all!) if hw-handover is +required. If someone cares for VGA/text-mode and hw-handover, they should add +"vga-framebuffer" platform-devices and bind to them in the drivers (similar to +vesa-framebuffer and efi-framebuffer devices). This would allow removing these +devices on hw-handover and prevent further access from VGA drivers. + +4. Hand-over +~~~~~~~~~~~~ +Many graphics devices support much more features than a single framebuffer. +Therefore, linux allows real hw-drivers to take over control (eg., radeon-drm +taking over from efifb). + +To support hand-over, we need to unload the previous driver before loading the +new driver. Furthermore, we must prevent any firmware-driver from loading again +later. Multiple hand-over helpers exist and are described below. + +4.1 sysfb +~~~~~~~~~ +The sysfb-handover is the newest of all helpers and should be used by new code. +Currently, only x86 uses it (arch/x86/kernel/sysfb.c). sysfb is quite simple and +provides a single hand-over layer. + +Architecture setup must register all firmware-framebuffers via sysfb_register() +instead of calling platform_device_register() directly. Currently sysfb supports +only a single firmware-fb at a time, but could be extended to allow multiple fbs +(once such systems occur in the wild). +sysfb_register() remembers the device and calls platform_device_register(). +Generic firmware-fb drivers can now bind to the firmware devices. Once these +devices are removed from the system, the generic firmware-fb drivers are +automatically unbound. + +Any real hw video-driver that binds to a device *must* call sysfb_claim() +before using the device. sysfb_claim() will check whether the given resource +is used by any firmware-fb and remove any conflicting platform-device. Removing +the platform-device will unbind the related platform-driver. Thus, the real hw +driver can now be sure that there is no other driver accessing any firmware-fb +based on its hardware. +sysfb_claim() also makes sure that no following call to sysfb_register() +will succeed, thus, preventing any new firmware-fb on the given device. + +Currently, remove_conflicting_framebuffers() (see below at 4.2) and DRM drivers +call sysfb_claim() to remove conflicting firmware-fbs. + +See drivers/video/sysfb.c for a thorough API description of sysfb. + +4.2 fbdev +~~~~~~~~~ +The fbdev layer provides a single helper called +remove_conflicting_framebuffers(). This is implicitly called before any fbdev +driver is registered and explicitly called by all affected DRM drivers. This +helper is supposed to remove any existing framebuffer device that conflicts with +the new device. Note that it does *not* prevent any new device from re-occuring. +So loading a firmware-fb driver *after* the real hw-driver will break. + +Furthermore, this is limited to fbdev. If CONFIG_FB is disabled, it is not +available. + +5. vgacon +~~~~~~~~~ +The vgacon driver is similar to the vga-fbdev drivers (see above at 3.5). It +does not register any "struct device" and thus there's no simple way to prevent +multiple drivers from accessing vga registers simultaneously. + +The vgacon driver is created by early-arch-setup and marked as default VT +console. Once the VT layer is started, it binds vgacon to all VTs. If VTs or +VGACON are disabled, all this obviously does not apply. Same is true if the +system is not booted in VGA/text-mode. vgacon only takes over if "screen_info" +tells it that the system is booted in VGA/text-mode. + +vgacon then accesses VGA I/O registers directly to print the VT console. If a +real-hw driver takes over, it cannot unregister vgacon directly. Instead, it +needs to register another VT console and call do_take_over_console() (or you may +call it with dummy_con). Obviously, vgacon must not be registered *after* the +hw-driver is probed, otherwise, vgacon will take over unconditionally. This, +however, seems to be no problem as vgacon is only probed by early arch-setup +code. + +Currently, fbdev and DRM drivers register fbdev drivers, which are then picked +up by fbcon which calls do_take_over_console() and removes vgacon. However, once +the hw-driver is unloaded, fbcon is unbound, too. Therefore, vgacon will take +over again (and fail horribly if the driver didn't restore VGA registers!). +Running a system without fbdev but with vgacon+DRM will break, too. There's +no-one who unloads vgacon when DRM starts up. + +6. Early Consoles +~~~~~~~~~~~~~~~~~ +Architecture setup-code can register early-consoles. These may include consoles +that access firmware-framebuffers. Such consoles are automatically removed from +the system when the first real console-driver is loaded. However, you can +disable this on the kernel-command line. Therefore, you're highly discouraged to +enable early-boot consoles by default. You should only enable them for +debugging. Especially on systems without VTs but DRM enabled, chances are high +that no real console-driver will be available so no-one will ever remove +early-boot consoles. + +---------------------------------------------------------------------------- + Written 2013-2014 by David Herrmann <[email protected]>
arch/x86/Kconfig +1 -0
@@ -2300,6 +2300,7 @@ source "drivers/rapidio/Kconfig" config X86_SYSFB bool "Mark VGA/VBE/EFI FB as generic system framebuffer" depends on FB_SIMPLE + select SYSFB help Firmwares often provide initial graphics framebuffers so the BIOS, bootloader or kernel can show basic video-output during boot for
arch/x86/include/asm/sysfb.h +0 -5
@@ -59,11 +59,6 @@ struct efifb_dmi_info {int flags; }; -int __init sysfb_register (const char *name,int id, -const struct resource *res,unsigned int res_num, -const void *data,size_t data_size); -void sysfb_unregister (const struct apertures_struct *apert,bool primary); -#ifdef CONFIG_EFI extern struct efifb_dmi_info efifb_dmi_list[];
arch/x86/kernel/sysfb.c +0 -64
70 lines not on this page · raw message
arch/x86/kernel/sysfb_simplefb.c +24 -2
@@ -22,6 +22,7 @@#include <linux/platform_data/simplefb.h> #include <linux/platform_device.h> #include <linux/screen_info.h> +#include <linux/sysfb.h> #include <asm/sysfb.h> static const char simplefb_resname[] ="BOOTFB" ;
@@ -86,7 +87,9 @@ __init bool parse_mode(const struct screen_info *si,__init int create_simplefb (const struct simplefb_platform_data *mode) {const struct apertures_struct *apert = (void *)mode->apert_buf; +struct platform_device *dev;struct resource res; +int ret;/* setup IORESOURCE_MEM as framebuffer memory */ memset (&res,0 ,sizeof (res));
@@ -97,6 +100,25 @@ __init int create_simplefb(const struct simplefb_platform_data *mode)if (res.end <= res.start)return -EINVAL ; -return sysfb_register ("simple-framebuffer" ,0 , &res,1 , mode, -sizeof (*mode)); + dev =platform_device_alloc ("simple-framebuffer" ,0 ); +if (!dev) +return -ENOMEM ; + + ret =platform_device_add_resources (dev, &res,1 ); +if (ret) + goto err; + + ret =platform_device_add_data (dev, mode,sizeof (*mode)); +if (ret) + goto err; + +/* platform_data is a copy of @mode, so adjust pointers */ + mode = dev->dev.platform_data; + apert = (void *)mode->apert_buf; + +sysfb_register (dev, apert); + +err: +platform_device_put (dev); +return ret; }
drivers/video/Kconfig +3 -0
@@ -39,6 +39,9 @@ config VIDEOMODE_HELPERS config HDMI bool +config SYSFB + bool + menuconfig FB tristate "Support for frame buffer devices" ---help---
drivers/video/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_VGASTATE) += vgastate.o obj-$(CONFIG_HDMI) += hdmi.o +obj-$(CONFIG_SYSFB) += sysfb.o obj-y += fb_notify.o obj-$(CONFIG_FB) += fb.o fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
drivers/video/fbmem.c +14 -10
@@ -35,10 +35,6 @@#include <asm/fb.h> -#ifdef CONFIG_X86_SYSFB -# include <asm/sysfb.h> -#endif -/* * Frame buffer device initialization and setup routines */
@@ -1749,14 +1745,23 @@ int unlink_framebuffer(struct fb_info *fb_info) }EXPORT_SYMBOL (unlink_framebuffer); +static void remove_conflicting_sysfb (struct apertures_struct *apert, +bool primary) +{ +/* We must not call into sysfb_claim() from within ->probe() or +* ->remove() of a sysfb-device, otherwise we dead-lock. Luckily, these +* devices don't have any apertures set (and must never add any), so we +* can just skip it then. */ +if (apert) +sysfb_claim (apert, primary ?SYSFB_CLAIM_SHADOW :0 ); +} +int remove_conflicting_framebuffers (struct apertures_struct *a,const char *name,bool primary) {int ret; -#ifdef CONFIG_X86_SYSFB -sysfb_unregister (a, primary); -#endif +remove_conflicting_sysfb (a, primary);mutex_lock (®istration_lock); ret =do_remove_conflicting_framebuffers (a, name, primary);
@@ -1780,9 +1785,8 @@ register_framebuffer(struct fb_info *fb_info) {int ret; -#ifdef CONFIG_X86_SYSFB -sysfb_unregister (fb_info->apertures,fb_is_primary_device (fb_info)); -#endif +remove_conflicting_sysfb (fb_info->apertures, +fb_is_primary_device (fb_info));mutex_lock (®istration_lock); ret =do_register_framebuffer (fb_info);
drivers/video/sysfb.c new file +348 -0
348 lines not on this page · raw message
include/linux/fb.h +2 -7
@@ -13,6 +13,7 @@#include <linux/list.h> #include <linux/backlight.h> #include <linux/slab.h> +#include <linux/sysfb.h> #include <asm/io.h> struct vm_area_struct ;
@@ -494,13 +495,7 @@ struct fb_info {/* we need the PCI or similar aperture base/size not smem_start/size as smem_start may just be an object allocated inside the aperture so may not actually overlap */ -struct apertures_struct { -unsigned int count; -struct aperture { -resource_size_t base; -resource_size_t size; - } ranges[0 ]; - } *apertures; +struct apertures_struct *apertures;bool skip_vt_switch;/* no VT switch on suspend/resume required */ };
include/linux/platform_data/simplefb.h +1 -0
@@ -15,6 +15,7 @@#include <drm/drm_fourcc.h> #include <linux/fb.h> #include <linux/kernel.h> +#include <linux/sysfb.h> /* format array, use it to initialize a "struct simplefb_format" array */ #define SIMPLEFB_FORMATS \
include/linux/sysfb.h new file +62 -0
62 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH 7/11 drm: mgag200: remove redundant fbdev removal
In reply to David HerrmannWe already call remove_conflicting_framebuffers() on PCI BAR0 during pci-probe, no need to do that again during device loading.
This avoids calling into remove_conflicting_framebuffers() from within DRM ->load() callback, which might deadlock, once we make this call remove DRM-backed sysfb-devices, too.
--- drivers/gpu/drm/mgag200/mgag200_main.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/mgag200/mgag200_main.c +0 -9
@@ -117,20 +117,11 @@ static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem)static int mga_vram_init (struct mga_device *mdev) {void __iomem *mem; -struct apertures_struct *aper =alloc_apertures (1 ); -if (!aper) -return -ENOMEM ;/* BAR 0 is VRAM */ mdev->mc.vram_base =pci_resource_start (mdev->dev->pdev,0 ); mdev->mc.vram_window =pci_resource_len (mdev->dev->pdev,0 ); - aper->ranges[0 ].base = mdev->mc.vram_base; - aper->ranges[0 ].size = mdev->mc.vram_window; - -remove_conflicting_framebuffers (aper,"mgafb" , true); -kfree (aper); -if (!devm_request_mem_region (mdev->dev->dev, mdev->mc.vram_base, mdev->mc.vram_window,"mgadrmfb_vram" )) {DRM_ERROR ("can't reserve VRAM\n" );
Signature · 1 line
1.8.5.3
PATCH 8/11 drm/i915: remove sysfbs early
In reply to David HerrmannOnce we allow DRM drivers for system-framebuffers, we need to evict such devices *before* probing the real driver. A simple call to sysfb_claim() does this and remove_conflicting_framebuffers() implicitly calls this. However, it causes the sysfb device to be unloaded and thus locks drm_global_mutex. remove_conflicting_framebuffers() must be called from outside any ->load() callback to avoid a dead-lock.
All other DRM drivers call this right before probing the pci-device, which is fine. For i915 we need to figure out the apertures before we can evict fw-framebuffers, though. This turns out to be not as easy as you might think, so lets just evict all sysfbs for now before loading i915.
A proper fix would be to make DRM code allow parallel device probing. That's not going to happen soon, so be safe and make i915 evict all sysfbs.
--- drivers/gpu/drm/i915/i915_drv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +6 -0
@@ -838,6 +838,12 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) driver.driver_features &= ~(DRIVER_USE_AGP ); +/* We cannot call remove_conflicting_framebuffers() here as we cannot +* easily figure out the apertures here. So lets just remove all +* system-framebuffers early so we don't deadlock later when calling it +* with drm_global_mutex held. */ +sysfb_claim (NULL ,SYSFB_CLAIM_ALL ); +return drm_get_pci_dev (pdev, ent, &driver); }
Signature · 1 line
1.8.5.3
PATCH 9/11 drm: add SimpleDRM driver
In reply to David HerrmannThe SimpleDRM driver binds to simple-framebuffer devices and provides a DRM/KMS API. It provides only a single CRTC+encoder+connector combination plus one initial mode.
Userspace can create dumb-buffers which can be blit into the real framebuffer similar to UDL. No access to the real framebuffer is allowed (compared to earlier version of this driver) to avoid security issues. Furthermore, this way we can support arbitrary modes as long as we have a convertion-helper.
--- MAINTAINERS | 8 + drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/simpledrm/Kconfig | 18 ++ drivers/gpu/drm/simpledrm/Makefile | 3 + drivers/gpu/drm/simpledrm/simpledrm.c | 252 ++++++++++++++++++ drivers/gpu/drm/simpledrm/simpledrm.h | 100 ++++++++ drivers/gpu/drm/simpledrm/simpledrm_damage.c | 306 ++++++++++++++++++++++ drivers/gpu/drm/simpledrm/simpledrm_gem.c | 282 +++++++++++++++++++++ drivers/gpu/drm/simpledrm/simpledrm_kms.c | 365 +++++++++++++++++++++++++++ 10 files changed, 1337 insertions(+) create mode 100644 drivers/gpu/drm/simpledrm/Kconfig create mode 100644 drivers/gpu/drm/simpledrm/Makefile create mode 100644 drivers/gpu/drm/simpledrm/simpledrm.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm.h create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_damage.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_gem.c create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_kms.c
MAINTAINERS +8 -0
@@ -7725,6 +7725,14 @@ S: Odd Fixes F: drivers/media/platform/sh_vou.c F: include/media/sh_vou.h +SIMPLE DRM DRIVER +M: David Herrmann <[email protected]> +L: [email protected] +T: git git://people.freedesktop.org/~dvdhrm/linux +S: Maintained +F: drivers/gpu/drm/simpledrm +F: include/linux/platform_data/simpledrm.h + SIMPLE FIRMWARE INTERFACE (SFI) M: Len Brown <[email protected]> L: [email protected]
drivers/gpu/drm/Kconfig +2 -0
@@ -199,3 +199,5 @@ source "drivers/gpu/drm/msm/Kconfig" source "drivers/gpu/drm/tegra/Kconfig" source "drivers/gpu/drm/panel/Kconfig" + +source "drivers/gpu/drm/simpledrm/Kconfig"
drivers/gpu/drm/Makefile +1 -0
@@ -61,5 +61,6 @@ obj-$(CONFIG_DRM_QXL) += qxl/ obj-$(CONFIG_DRM_BOCHS) += bochs/ obj-$(CONFIG_DRM_MSM) += msm/ obj-$(CONFIG_DRM_TEGRA) += tegra/ +obj-$(CONFIG_DRM_SIMPLEDRM) += simpledrm/ obj-y += i2c/ obj-y += panel/
drivers/gpu/drm/simpledrm/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +config DRM_SIMPLEDRM + tristate "Simple firmware framebuffer DRM driver" + depends on DRM && (FB_SIMPLE = n) + help + SimpleDRM can run on all systems with pre-initialized graphics + hardware. It uses a framebuffer that was initialized during + firmware boot. No page-flipping, modesetting or other advanced + features are available. However, other DRM drivers can be loaded + later and take over from SimpleDRM if they provide real hardware + support. + + SimpleDRM supports "simple-framebuffer" DeviceTree objects and + compatible platform framebuffers. + + If unsure, say Y. + + To compile this driver as a module, choose M here: the + module will be called simpledrm.
drivers/gpu/drm/simpledrm/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +sdrm-y := simpledrm.o simpledrm_kms.o simpledrm_gem.o simpledrm_damage.o + +obj-$(CONFIG_DRM_SIMPLEDRM) := sdrm.o
drivers/gpu/drm/simpledrm/simpledrm.c new file +252 -0
252 lines not on this page · raw message
drivers/gpu/drm/simpledrm/simpledrm.h new file +100 -0
100 lines not on this page · raw message
drivers/gpu/drm/simpledrm/simpledrm_damage.c new file +306 -0
306 lines not on this page · raw message
drivers/gpu/drm/simpledrm/simpledrm_gem.c new file +282 -0
282 lines not on this page · raw message
drivers/gpu/drm/simpledrm/simpledrm_kms.c new file +365 -0
365 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH 10/11 drm: simpledrm: add fbdev fallback support
In reply to David HerrmannCreate a simple fbdev device during SimpleDRM setup so legacy user-space and fbcon can use it.
--- drivers/gpu/drm/simpledrm/Kconfig | 11 +++ drivers/gpu/drm/simpledrm/Makefile | 1 + drivers/gpu/drm/simpledrm/simpledrm.c | 13 ++- drivers/gpu/drm/simpledrm/simpledrm.h | 22 +++++ drivers/gpu/drm/simpledrm/simpledrm_fbdev.c | 148 ++++++++++++++++++++++++++++ 5 files changed, 194 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/simpledrm/simpledrm_fbdev.c
drivers/gpu/drm/simpledrm/Kconfig +11 -0
@@ -12,7 +12,18 @@ config DRM_SIMPLEDRM SimpleDRM supports "simple-framebuffer" DeviceTree objects and compatible platform framebuffers. + If fbdev support is enabled, this driver will also provide an fbdev + compatibility layer. + If unsure, say Y. To compile this driver as a module, choose M here: the module will be called simpledrm. + +config DRM_SIMPLEDRM_FBDEV + bool + depends on DRM_SIMPLEDRM && FB + default y + select FB_CFB_FILLRECT + select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT
drivers/gpu/drm/simpledrm/Makefile +1 -0
@@ -1,3 +1,4 @@ sdrm-y := simpledrm.o simpledrm_kms.o simpledrm_gem.o simpledrm_damage.o +sdrm-$(CONFIG_DRM_SIMPLEDRM_FBDEV) += simpledrm_fbdev.o obj-$(CONFIG_DRM_SIMPLEDRM) := sdrm.o
drivers/gpu/drm/simpledrm/simpledrm.c +12 -1
@@ -192,7 +192,17 @@ void sdrm_pdev_destroy(struct sdrm_device *sdrm)static int sdrm_simplefb_probe (struct platform_device *pdev) { -return drm_platform_init (&sdrm_drm_driver, pdev); +struct drm_device *ddev; +int r; + + r =drm_platform_init (&sdrm_drm_driver, pdev); +if (r <0 ) +return r; + + ddev =platform_get_drvdata (pdev); +sdrm_fbdev_init (ddev->dev_private); + +return 0 ; }static int sdrm_simplefb_remove (struct platform_device *pdev)
@@ -205,6 +215,7 @@ static int sdrm_simplefb_remove(struct platform_device *pdev)* CPU is currently doing some GEM-bo access in parallel to us. But, eh, * what can we do.. Fixes for that is being worked on. */ +sdrm_fbdev_cleanup (sdrm);drm_connector_unplug_all (ddev);/* protect fb_map removal against sdrm_blit() */
drivers/gpu/drm/simpledrm/simpledrm.h +22 -0
@@ -45,6 +45,9 @@ struct sdrm_device {struct drm_encoder enc;struct drm_connector conn;struct drm_display_mode *mode; + +/* fbdev */ +struct fb_info *fbdev; };int sdrm_drm_load (struct drm_device *ddev,unsigned long flags);
@@ -97,4 +100,23 @@ struct sdrm_framebuffer {#define to_sdrm_fb (x) container_of(x, struct sdrm_framebuffer, base) +/* simpledrm fbdev helpers */ + +#ifdef CONFIG_DRM_SIMPLEDRM_FBDEV + +void sdrm_fbdev_init (struct sdrm_device *sdrm); +void sdrm_fbdev_cleanup (struct sdrm_device *sdrm); + +#else /* CONFIG_DRM_SIMPLEDRM_FBDEV */ + +static inline void sdrm_fbdev_init (struct sdrm_device *sdrm) +{ +} + +static inline void sdrm_fbdev_cleanup (struct sdrm_device *sdrm) +{ +} + +#endif /* CONFIG_DRM_SIMPLEDRM_FBDEV */ +#endif /* SDRM_DRV_H */
drivers/gpu/drm/simpledrm/simpledrm_fbdev.c new file +148 -0
148 lines not on this page · raw message
Signature · 1 line
1.8.5.3
PATCH 11/11 x86/sysfb: allow sysfb+simpledrm combination
In reply to David HerrmannWe used to protect X86_SYSFB by depending on FB_SIMPLE so users don't accidentally end up without a kernel console. Now that DRM_SIMPLEDRM also provides a simple-framebuffer driver, we can whitelist this driver, too.
--- arch/x86/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/Kconfig +1 -1
@@ -2299,7 +2299,7 @@ source "drivers/rapidio/Kconfig" config X86_SYSFB bool "Mark VGA/VBE/EFI FB as generic system framebuffer" - depends on FB_SIMPLE + depends on FB_SIMPLE || DRM_SIMPLEDRM select SYSFB help Firmwares often provide initial graphics framebuffers so the BIOS,
Signature · 1 line
1.8.5.3
Hi
Quoted 18 lines · David Herrmann
Hi
Another round of SimpleDRM patches. I somehow lost track of the last ones and as this is a major rewrite, I'll just start at v1 again.
Some comments up-front:
- @Ingo: Patch #1 and #2 are unchanged from the previous ML discussions. I included them in this series as the other patches depend on them. Could you pick them up for the x86 tree? The other 9 patches won't make it in 3.14 so no reason to put them through the DRM tree.
All mentioned issues should be addressed. If there's still sth missing, please let me know.- The DRM patches depend on my "DRM Anonymous Inode" patches. But it should be trivial to apply them on drm-next (I think only one line needs to be changed:
i_mapping=>dev_mapping).
Quoted 6 lines
- I tested the SimpleDRM fbdev fallback with linux-console+Xorg and it works fine. The DRM backend is only tested with some DRM tests I have locally. I have no idea how to make Xorg pick up a specific
/dev/dri/card0card. It always tells me "no screens found" (as the underlying device is not marked asboot_vga..). If someone knows how to tell Xorg to use card0, I'd gladly test this. But I'm no longer used to writing xorg.confs..
For completeness, I tested this with Xorg+xf86-video-modesetting and it works just fine. The xorg.conf I used can be found below. If this driver gets upstreamed, I will try to make the X11 auto-loader detect it just like any other platform-device.
Thanks
David
Section "ServerLayout"
Identifier "MyLayout"
Screen 0 "MyScreen" 0 0
EndSection
Section "Device"
Identifier "MyDevice"
Driver "modesetting"
BusID "platform:/sys/devices/platform/simple-framebuffer.0"
Screen 0EndSection
Section "Screen"
Identifier "MyScreen"
Device "MyDevice"
EndSection
Quoted 28 lines · David Herrmann
Hi
Quoted 18 lines · David Herrmann
Hi
Another round of SimpleDRM patches. I somehow lost track of the last ones and as this is a major rewrite, I'll just start at v1 again.
Some comments up-front:
- @Ingo: Patch #1 and #2 are unchanged from the previous ML discussions. I included them in this series as the other patches depend on them. Could you pick them up for the x86 tree? The other 9 patches won't make it in 3.14 so no reason to put them through the DRM tree.
All mentioned issues should be addressed. If there's still sth missing, please let me know.- The DRM patches depend on my "DRM Anonymous Inode" patches. But it should be trivial to apply them on drm-next (I think only one line needs to be changed:
i_mapping=>dev_mapping).Quoted 6 lines
- I tested the SimpleDRM fbdev fallback with linux-console+Xorg and it works fine. The DRM backend is only tested with some DRM tests I have locally. I have no idea how to make Xorg pick up a specific
/dev/dri/card0card. It always tells me "no screens found" (as the underlying device is not marked asboot_vga..). If someone knows how to tell Xorg to use card0, I'd gladly test this. But I'm no longer used to writing xorg.confs..
Quoted 4 lines
For completeness, I tested this with Xorg+xf86-video-modesetting and it works just fine. The xorg.conf I used can be found below. If this driver gets upstreamed, I will try to make the X11 auto-loader detect it just like any other platform-device.
I recently posted patches[0] to the xorg-devel mailing list that I think should solve that issue.
Thierry
[0]: http://lists.x.org/archives/xorg-devel/2014-February/040568.html
Hi,
Quoted 44 lines · David Herrmann
Hi
Another round of SimpleDRM patches. I somehow lost track of the last ones and as this is a major rewrite, I'll just start at v1 again.
Some comments up-front:
- @Ingo: Patch #1 and #2 are unchanged from the previous ML discussions. I included them in this series as the other patches depend on them. Could you pick them up for the x86 tree? The other 9 patches won't make it in 3.14 so no reason to put them through the DRM tree.
All mentioned issues should be addressed. If there's still sth missing, please let me know.- The DRM patches depend on my "DRM Anonymous Inode" patches. But it should be trivial to apply them on drm-next (I think only one line needs to be changed:
i_mapping=>dev_mapping).- I tested the SimpleDRM fbdev fallback with linux-console+Xorg and it works fine. The DRM backend is only tested with some DRM tests I have locally. I have no idea how to make Xorg pick up a specific
/dev/dri/card0card. It always tells me "no screens found" (as the underlying device is not marked asboot_vga..). If someone knows how to tell Xorg to use card0, I'd gladly test this. But I'm no longer used to writing xorg.confs..This series introduces two new concepts: sysfb and SimpleDRM
Sysfb is just a generalization of the x86-sysfb concept. It allows to register firmware-framebuffers with the system as platform-devices. This way, drivers can properly bind to these devices and we prevent multiple drivers from accessing the same firmware-framebuffer.
Sysfb also provides hooks to get a safe handover to real hw-drivers (like i915). Please see the "video: sysfb: add generic firmware-fb interface" patch for a thorough description of the API. This patch also adds a rather verbose documentation of all known firmware-fb facilities.As second part, this series introduces SimpleDRM. It's a very basic DRM driver that can replace efifb, vesafb, simplefb and friends. It's 100% compatible to the "udl" DRM driver, so user-space like xf86-video-modesetting can pick them up just fine. User-space that cannot deal with
drmModeDirtyFB()(like weston and friends) currently cannot use SimpleDRM. However, that's also true for all other DRM drivers which provide shadow framebuffers. We could provide something like FB-DEFIO, but that's just useless overhead to paper of lazy user-space.
Quoted 3 lines
I have tested this with all hardware that I have at home, with a lot hand-over combinations (with/without SYSFB, with efifb/vesafb/simplefb, with SimpleDRM, ...) and all worked great so far.
What's the status with this one? Headed for 3.15?
Are the SimpleDRM and sysfb linked somehow? (I.e. do they need to be in the same series?)
And jfyi, the drivers/video/ changes will conflict with the drivers/video/ directory reorganization series, which may be merged for 3.15.
Tomi
Hi
Quoted 51 lines · Tomi Valkeinen
Hi,
Quoted 44 lines · David Herrmann
Hi
Another round of SimpleDRM patches. I somehow lost track of the last ones and as this is a major rewrite, I'll just start at v1 again.
Some comments up-front:
- @Ingo: Patch #1 and #2 are unchanged from the previous ML discussions. I included them in this series as the other patches depend on them. Could you pick them up for the x86 tree? The other 9 patches won't make it in 3.14 so no reason to put them through the DRM tree.
All mentioned issues should be addressed. If there's still sth missing, please let me know.- The DRM patches depend on my "DRM Anonymous Inode" patches. But it should be trivial to apply them on drm-next (I think only one line needs to be changed:
i_mapping=>dev_mapping).- I tested the SimpleDRM fbdev fallback with linux-console+Xorg and it works fine. The DRM backend is only tested with some DRM tests I have locally. I have no idea how to make Xorg pick up a specific
/dev/dri/card0card. It always tells me "no screens found" (as the underlying device is not marked asboot_vga..). If someone knows how to tell Xorg to use card0, I'd gladly test this. But I'm no longer used to writing xorg.confs..This series introduces two new concepts: sysfb and SimpleDRM
Sysfb is just a generalization of the x86-sysfb concept. It allows to register firmware-framebuffers with the system as platform-devices. This way, drivers can properly bind to these devices and we prevent multiple drivers from accessing the same firmware-framebuffer.
Sysfb also provides hooks to get a safe handover to real hw-drivers (like i915). Please see the "video: sysfb: add generic firmware-fb interface" patch for a thorough description of the API. This patch also adds a rather verbose documentation of all known firmware-fb facilities.As second part, this series introduces SimpleDRM. It's a very basic DRM driver that can replace efifb, vesafb, simplefb and friends. It's 100% compatible to the "udl" DRM driver, so user-space like xf86-video-modesetting can pick them up just fine. User-space that cannot deal with
drmModeDirtyFB()(like weston and friends) currently cannot use SimpleDRM. However, that's also true for all other DRM drivers which provide shadow framebuffers. We could provide something like FB-DEFIO, but that's just useless overhead to paper of lazy user-space.Quoted 3 lines
I have tested this with all hardware that I have at home, with a lot hand-over combinations (with/without SYSFB, with efifb/vesafb/simplefb, with SimpleDRM, ...) and all worked great so far.
Quoted 8 lines
What's the status with this one? Headed for 3.15?
Are the SimpleDRM and sysfb linked somehow? (I.e. do they need to be in the same series?)
And jfyi, the
drivers/video/changes will conflict with thedrivers/video/directory reorganization series, which may be merged for 3.15.
If simpledrm is included, then the series needs to be applied as a whole. As Dave considered merging this for 3.15, I'd appreciate it if you could ACK the fbdev related patches (they're really small!):
fbdev: efifb: add dev->remove() callback
fbdev: vesafb: add dev->remove() callback
Thanks
David
Quoted 9 lines · David Herrmann
Quoted 8 lines
What's the status with this one? Headed for 3.15?
Are the SimpleDRM and sysfb linked somehow? (I.e. do they need to be in the same series?)
And jfyi, the
drivers/video/changes will conflict with thedrivers/video/directory reorganization series, which may be merged for 3.15.
Quoted 5 lines
If simpledrm is included, then the series needs to be applied as a whole. As Dave considered merging this for 3.15, I'd appreciate it if you could ACK the fbdev related patches (they're really small!):
fbdev: efifb: adddev->remove()callback
fbdev: vesafb: adddev->remove()callback
Those look fine.
I'm not familiar with x86 fb, so I can't comment much to the series, but what worries me more is the "[PATCH 06/11] video: sysfb: add generic firmware-fb interface", which adds new stuff into drivers/video/. No problem as such, but as said, it'll conflict with the fbdev reorg patches.
So, presuming nobody shoots down the fbdev reorg series, I'd like to have all fbdev patches going through the fbdev tree for 3.15, so that I can handle the (possibly messy) conflicts.
What do you think, would it be possible to keep the sysfb stuff in arch/x86, and still be able to do the rest of the stuff here? And then move the sysfs from arch/x86 to drivers/video later?
Tomi
Hi
Quoted 24 lines · Tomi Valkeinen
Quoted 9 lines · David Herrmann
Quoted 8 lines
What's the status with this one? Headed for 3.15?
Are the SimpleDRM and sysfb linked somehow? (I.e. do they need to be in the same series?)
And jfyi, the
drivers/video/changes will conflict with thedrivers/video/directory reorganization series, which may be merged for 3.15.Quoted 5 lines
If simpledrm is included, then the series needs to be applied as a whole. As Dave considered merging this for 3.15, I'd appreciate it if you could ACK the fbdev related patches (they're really small!):
fbdev: efifb: adddev->remove()callback
fbdev: vesafb: adddev->remove()callbackThose look fine.
I'm not familiar with x86 fb, so I can't comment much to the series, but what worries me more is the "[PATCH 06/11] video: sysfb: add generic firmware-fb interface", which adds new stuff into
drivers/video/. No problem as such, but as said, it'll conflict with the fbdev reorg patches.
Quoted 7 lines
So, presuming nobody shoots down the fbdev reorg series, I'd like to have all fbdev patches going through the fbdev tree for 3.15, so that I can handle the (possibly messy) conflicts.
What do you think, would it be possible to keep the sysfb stuff in
arch/x86, and still be able to do the rest of the stuff here? And then move the sysfs fromarch/x86todrivers/videolater?
I don't think there's any need for that. Linus does conflict resolution all day long, so a short hint in Dave's pull-request (plus an example merge) should be enough. Same is true for -next, I think. And this is really just a mechanical thing, nothing hard to do. But of course, it's your decision. However, keeping the code in x86 is the wrong thing to do. As discussed with Ingo, the patch that extends x86/sysfb is only provided for easier backporting. The followup patch immediately removes it again and adds proper video/sysfb. I'd dislike splitting these just to avoid merge conflicts. I can also maintain a merge-fixup branch in my tree, if anyone wants that.
Thanks for your reviews of the fbdev stuff!
David
Quoted 7 lines · David Herrmann
Quoted 3 lines
What do you think, would it be possible to keep the sysfb stuff in
arch/x86, and still be able to do the rest of the stuff here? And then move the sysfs fromarch/x86todrivers/videolater?I don't think there's any need for that. Linus does conflict resolution all day long, so a short hint in Dave's pull-request (plus an example merge) should be enough. Same is true for -next, I think.
True, but, well, the conflict with this one is not a few lines. "git diff |wc -l" gives 2494 lines for the conflict. It's not really complex to resolve that one, though, as it's really about copying all the stuff into its new place.
So I'm not sure if that makes Linus think "this is simple one, 30 secs and done" or "who the f*** sends me this crap" ;). Especially for two reasons:
- The fb-reogranization is not very critical, and often clean-ups are not worth it (although I think this one is good one, of course).
- Conflicting fbdev changes coming from another tree
Quoted 3 lines
And this is really just a mechanical thing, nothing hard to do. But of course, it's your decision. However, keeping the code in x86 is the wrong thing to do. As discussed with Ingo, the patch that extends
Yes, I didn't mean keeping the code in x86 for good, but just for one kernel version to make merging easier.
Quoted 4 lines
x86/sysfb is only provided for easier backporting. The followup patch immediately removes it again and adds proper video/sysfb. I'd dislike splitting these just to avoid merge conflicts. I can also maintain a merge-fixup branch in my tree, if anyone wants that.
You can have a try at merging. If you think it's trivial, maybe it is and we can just let Linus handle it:
git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git
work/fb-reorder
Tomi
Hi Tomi
Quoted 35 lines · Tomi Valkeinen
Quoted 7 lines · David Herrmann
Quoted 3 lines
What do you think, would it be possible to keep the sysfb stuff in
arch/x86, and still be able to do the rest of the stuff here? And then move the sysfs fromarch/x86todrivers/videolater?I don't think there's any need for that. Linus does conflict resolution all day long, so a short hint in Dave's pull-request (plus an example merge) should be enough. Same is true for -next, I think.
True, but, well, the conflict with this one is not a few lines. "git diff |wc -l" gives 2494 lines for the conflict. It's not really complex to resolve that one, though, as it's really about copying all the stuff into its new place.
So I'm not sure if that makes Linus think "this is simple one, 30 secs and done" or "who the f*** sends me this crap" ;). Especially for two reasons:
- The fb-reogranization is not very critical, and often clean-ups are not worth it (although I think this one is good one, of course).
- Conflicting fbdev changes coming from another treeQuoted 3 lines
And this is really just a mechanical thing, nothing hard to do. But of course, it's your decision. However, keeping the code in x86 is the wrong thing to do. As discussed with Ingo, the patch that extends
Yes, I didn't mean keeping the code in x86 for good, but just for one kernel version to make merging easier.
Quoted 4 lines
x86/sysfb is only provided for easier backporting. The followup patch immediately removes it again and adds proper video/sysfb. I'd dislike splitting these just to avoid merge conflicts. I can also maintain a merge-fixup branch in my tree, if anyone wants that.
Quoted 5 lines
You can have a try at merging. If you think it's trivial, maybe it is and we can just let Linus handle it:
git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git
work/fb-reorder
Ok, I'm fine with delaying this one more merge-window. However, to make things easier, could you pick up the two fbdev cleanups? These are:
fbdev: efifb: add dev->remove() callback
fbdev: vesafb: add dev->remove() callback
They only add ->remove() callbacks which are never triggered currently except with my sysfb series. But I'd like to drop both to make the series smaller.
Thanks
David
Quoted 50 lines · David Herrmann
Hi Tomi
Quoted 35 lines · Tomi Valkeinen
Quoted 7 lines · David Herrmann
Quoted 3 lines
What do you think, would it be possible to keep the sysfb stuff in
arch/x86, and still be able to do the rest of the stuff here? And then move the sysfs fromarch/x86todrivers/videolater?I don't think there's any need for that. Linus does conflict resolution all day long, so a short hint in Dave's pull-request (plus an example merge) should be enough. Same is true for -next, I think.
True, but, well, the conflict with this one is not a few lines. "git diff |wc -l" gives 2494 lines for the conflict. It's not really complex to resolve that one, though, as it's really about copying all the stuff into its new place.
So I'm not sure if that makes Linus think "this is simple one, 30 secs and done" or "who the f*** sends me this crap" ;). Especially for two reasons:
- The fb-reogranization is not very critical, and often clean-ups are not worth it (although I think this one is good one, of course).
- Conflicting fbdev changes coming from another treeQuoted 3 lines
And this is really just a mechanical thing, nothing hard to do. But of course, it's your decision. However, keeping the code in x86 is the wrong thing to do. As discussed with Ingo, the patch that extends
Yes, I didn't mean keeping the code in x86 for good, but just for one kernel version to make merging easier.
Quoted 4 lines
x86/sysfb is only provided for easier backporting. The followup patch immediately removes it again and adds proper video/sysfb. I'd dislike splitting these just to avoid merge conflicts. I can also maintain a merge-fixup branch in my tree, if anyone wants that.
Quoted 5 lines
You can have a try at merging. If you think it's trivial, maybe it is and we can just let Linus handle it:
git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git
work/fb-reorderOk, I'm fine with delaying this one more merge-window. However, to make things easier, could you pick up the two fbdev cleanups? These are:
fbdev: efifb: adddev->remove()callback
fbdev: vesafb: adddev->remove()callback
Quoted 3 lines
They only add ->remove() callbacks which are never triggered currently except with my sysfb series. But I'd like to drop both to make the series smaller.
Yes, I can take them if they work fine without the rest of the patches.
I could also take all the patches up to patch #6 via fbdev tree. Some of the patches are for arch x86, but they seem to be still about framebuffers. But maybe that causes conflicts with x86 tree, then =).
Then again, maybe we should just go forward and let Linus handle the conflict. I'm planning to send the "normal" fbdev changes and the fbdev-reorg separately (just in case Linus doesn't like the reorg), and that already causes conflicts, very similar to what this series causes.
So in any case Linus has to handle that conflict, or use a resolution offered by me. So if fbdev changes and this series are merged in relatively early phase, I can then send the reorg series a bit later and offer a conflict resolution that solves the conflicts for both series.
That way this series doesn't get delayed needlessly in the case that Linus rejects the reorg series.
Tomi
Hi
Quoted 66 lines · Tomi Valkeinen
Quoted 50 lines · David Herrmann
Hi Tomi
Quoted 35 lines · Tomi Valkeinen
Quoted 7 lines · David Herrmann
Quoted 3 lines
What do you think, would it be possible to keep the sysfb stuff in
arch/x86, and still be able to do the rest of the stuff here? And then move the sysfs fromarch/x86todrivers/videolater?I don't think there's any need for that. Linus does conflict resolution all day long, so a short hint in Dave's pull-request (plus an example merge) should be enough. Same is true for -next, I think.
True, but, well, the conflict with this one is not a few lines. "git diff |wc -l" gives 2494 lines for the conflict. It's not really complex to resolve that one, though, as it's really about copying all the stuff into its new place.
So I'm not sure if that makes Linus think "this is simple one, 30 secs and done" or "who the f*** sends me this crap" ;). Especially for two reasons:
- The fb-reogranization is not very critical, and often clean-ups are not worth it (although I think this one is good one, of course).
- Conflicting fbdev changes coming from another treeQuoted 3 lines
And this is really just a mechanical thing, nothing hard to do. But of course, it's your decision. However, keeping the code in x86 is the wrong thing to do. As discussed with Ingo, the patch that extends
Yes, I didn't mean keeping the code in x86 for good, but just for one kernel version to make merging easier.
Quoted 4 lines
x86/sysfb is only provided for easier backporting. The followup patch immediately removes it again and adds proper video/sysfb. I'd dislike splitting these just to avoid merge conflicts. I can also maintain a merge-fixup branch in my tree, if anyone wants that.
Quoted 5 lines
You can have a try at merging. If you think it's trivial, maybe it is and we can just let Linus handle it:
git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux.git
work/fb-reorderOk, I'm fine with delaying this one more merge-window. However, to make things easier, could you pick up the two fbdev cleanups? These are:
fbdev: efifb: adddev->remove()callback
fbdev: vesafb: adddev->remove()callbackQuoted 3 lines
They only add ->remove() callbacks which are never triggered currently except with my sysfb series. But I'd like to drop both to make the series smaller.
Yes, I can take them if they work fine without the rest of the patches.
I could also take all the patches up to patch #6 via fbdev tree. Some of the patches are for arch x86, but they seem to be still about framebuffers. But maybe that causes conflicts with x86 tree, then =).
Then again, maybe we should just go forward and let Linus handle the conflict. I'm planning to send the "normal" fbdev changes and the fbdev-reorg separately (just in case Linus doesn't like the reorg), and that already causes conflicts, very similar to what this series causes.
Quoted 7 lines
So in any case Linus has to handle that conflict, or use a resolution offered by me. So if fbdev changes and this series are merged in relatively early phase, I can then send the reorg series a bit later and offer a conflict resolution that solves the conflicts for both series.
That way this series doesn't get delayed needlessly in the case that Linus rejects the reorg series.
If you can take these two patches, that's fine. They're not strictly needed by the series and I'd be happy to see them upstream. The other sysfb patches should be merged together, so I don't think there's much gain in applying them through fbdev.
The DRM tree is usually merged late, anyway, so I'll see whether we will merge simpledrm through drm-next or not. If not, it'll be 3.16 then. If you can get the fbdev merge in early, that should be enough for us to figure it out and provide a conflict-resolution. Btw., do you want the generic sysfb-helper in drivers/video/ or driver/video/fbdev? It's not limited to fbdev, so I'd put it in drivers/video/.
Thanks
David
Quoted 4 lines · David Herrmann
If you can take these two patches, that's fine. They're not strictly needed by the series and I'd be happy to see them upstream. The other sysfb patches should be merged together, so I don't think there's much gain in applying them through fbdev.
Ok, I've applied them to fbdev tree.
Quoted 7 lines
The DRM tree is usually merged late, anyway, so I'll see whether we will merge simpledrm through drm-next or not. If not, it'll be 3.16 then. If you can get the fbdev merge in early, that should be enough for us to figure it out and provide a conflict-resolution. Btw., do you want the generic sysfb-helper in
drivers/video/or driver/video/fbdev? It's not limited to fbdev, so I'd put it indrivers/video/.
With a quick glance, it doesn't seem to depend on fbdev in any way, right? That makes me think drivers/video/.
Tomi
Hi Tomi
Quoted 8 lines · Tomi Valkeinen
Quoted 4 lines · David Herrmann
If you can take these two patches, that's fine. They're not strictly needed by the series and I'd be happy to see them upstream. The other sysfb patches should be merged together, so I don't think there's much gain in applying them through fbdev.
Ok, I've applied them to fbdev tree.
Thanks!
Quoted 10 lines
Quoted 7 lines
The DRM tree is usually merged late, anyway, so I'll see whether we will merge simpledrm through drm-next or not. If not, it'll be 3.16 then. If you can get the fbdev merge in early, that should be enough for us to figure it out and provide a conflict-resolution. Btw., do you want the generic sysfb-helper in
drivers/video/or driver/video/fbdev? It's not limited to fbdev, so I'd put it indrivers/video/.With a quick glance, it doesn't seem to depend on fbdev in any way, right? That makes me think
drivers/video/.
Right! I will keep them in drivers/video/ then.
Thanks
David