arch: Consolidate <asm/fb.h>
Subsystems (14)
cover arch: Consolidate <asm/fb.h>
Various architectures provide <arm/fb.h> with helpers for fbdev framebuffer devices. Share the contained code where possible. There is already <asm-generic/fb.h>, which implements generic (as in 'empty') functions of the fbdev helpers. The header was added in commit aafe4dbed0bf ("asm-generic: add generic versions of common headers"), but never used.
Each per-architecture header file declares and/or implements fbdev helpers and defines a preprocessor token for each. The generic header then provides the remaining helpers. It works like the I/O helpers in <asm/io.h>.
For PARISC, the architecture helpers are mixed up with helpers for the system's STI graphics firmware. We first move the STI code to appropriate locations under video/ and then move the architecture helper under arch/parisc.
For Sparc, there's an additional patch that moves the implementation from the header into a source file. This allows to avoid some include statements in the header file.
Built on arm, arm64, m68k, mips, parisc, powerpc, sparc and x86.
Thomas Zimmermann (18):
fbdev: Prepare generic architecture helpers
arch/arc: Implement <asm/fb.h> with generic helpers arch/arm: Implement <asm/fb.h> with generic helpers arch/arm64: Implement <asm/fb.h> with generic helpers arch/ia64: Implement <asm/fb.h> with generic helpers arch/loongarch: Implement <asm/fb.h> with generic helpers arch/m68k: Implement <asm/fb.h> with generic helpers arch/mips: Implement <asm/fb.h> with generic helpers
video: Remove trailing whitespaces
video: Move HP PARISC STI core code to shared location arch/parisc: Remove trailing whitespaces
arch/parisc: Implement fb_is_primary_device() under arch/parisc arch/parisc: Implement <asm/fb.h> with generic helpers arch/powerpc: Implement <asm/fb.h> with generic helpers arch/sh: Implement <asm/fb.h> with generic helpers arch/sparc: Implement fb_is_primary_device() in source file arch/sparc: Implement <asm/fb.h> with generic helpers arch/x86: Implement <asm/fb.h> with generic helpers
arch/arc/include/asm/fb.h | 11 +-
arch/arm/include/asm/fb.h | 10 +-
arch/arm64/include/asm/fb.h | 10 +-
arch/ia64/include/asm/fb.h | 11 +-
arch/loongarch/include/asm/fb.h | 10 +-
arch/m68k/include/asm/fb.h | 10 +-
arch/mips/include/asm/fb.h | 10 +-
arch/parisc/Makefile | 4 +-
arch/parisc/include/asm/fb.h | 17 +-
arch/parisc/video/Makefile | 3 +
arch/parisc/video/fbdev.c | 27 +++
arch/powerpc/include/asm/fb.h | 8 +-
arch/sh/include/asm/fb.h | 10 +-
arch/sparc/Makefile | 1 +
arch/sparc/include/asm/fb.h | 30 ++--
arch/sparc/video/Makefile | 3 +
arch/sparc/video/fbdev.c | 24 +++
arch/x86/include/asm/fb.h | 11 +-
drivers/video/Kconfig | 7 +
drivers/video/Makefile | 1 +
drivers/video/console/Kconfig | 1 +
drivers/video/console/Makefile | 4 +-
drivers/video/console/sticon.c | 6 +-
drivers/video/fbdev/Kconfig | 3 +-
drivers/video/fbdev/stifb.c | 158 +++++++++---------
drivers/video/{console => }/sticore.c | 123 ++++++--------
include/asm-generic/fb.h | 20 ++-
.../video/fbdev => include/video}/sticore.h | 16 +-
28 files changed, 297 insertions(+), 252 deletions(-)
create mode 100644 arch/parisc/video/Makefile
create mode 100644 arch/parisc/video/fbdev.c
create mode 100644 arch/sparc/video/Makefile
create mode 100644 arch/sparc/video/fbdev.c
rename drivers/video/{console => }/sticore.c (95%)
rename {drivers/video/fbdev => include/video}/sticore.h (99%)base-commit: a7180debb9c631375684f4d717466cfb9f238660
Signature · 1 line
2.40.0
PATCH 1/18 fbdev: Prepare generic architecture helpers
Generic implementations of fb_pgprotect() and fb_is_primary_device() have been in the source code for a long time. Prepare the header file to make use of them.
Improve the code by using an inline function for fb_pgprotect() and by removing include statements.
Symbols are protected by preprocessor guards. Architectures that provide a symbol need to define a preprocessor token of the same name and value. Otherwise the header file will provide a generic implementation. This pattern has been taken from <asm/io.h>.
--- include/asm-generic/fb.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
include/asm-generic/fb.h +18 -2
@@ -1,13 +1,29 @@/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_GENERIC_FB_H_#define __ASM_GENERIC_FB_H_ -#include <linux/fb.h> -#define fb_pgprotect (...) do {} while (0) +/* +* Only include this header file from your architecture's <asm/fb.h>. +*/ + +struct fb_info ; +struct file ; +struct vm_area_struct ; + +#ifndef fb_pgprotect +#define fb_pgprotect fb_pgprotect +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma, +unsigned long off) +{ } +#endif +#ifndef fb_is_primary_device +#define fb_is_primary_device fb_is_primary_devicestatic inline int fb_is_primary_device (struct fb_info *info) {return 0 ; } +#endif #endif /* __ASM_GENERIC_FB_H_ */
Signature · 1 line
2.40.0
Arnd Bergmann
maintainerRe: [PATCH 01/18] fbdev: Prepare generic architecture helpers
Quoted 7 lines · Thomas Zimmermann
Generic implementations of
fb_pgprotect()andfb_is_primary_device()have been in the source code for a long time. Prepare the header file to make use of them.Improve the code by using an inline function for
fb_pgprotect()and by removing include statements.
Quoted 6 lines
Symbols are protected by preprocessor guards. Architectures that provide a symbol need to define a preprocessor token of the same name and value. Otherwise the header file will provide a generic implementation. This pattern has been taken from <
asm/io.h>.Signed-off-by Thomas Zimmermann <[email protected]>
Moving this into generic code is good, but I'm not sure about the default for fb_pgprotect():
include/asm-generic/fb.h line 19
Quoted 7 lines
include/asm-generic/fb.h +7
-0+ +#ifndef fb_pgprotect +#define fb_pgprotect fb_pgprotect +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma, +unsigned long off) +{ } +#endif
I think most architectures will want the version we have on arc, arm, arm64, loongarch, and sh already:
static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
unsigned long off)
{
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
}so I'd suggest making that version the default, and treating the empty ones (m68knommu, sparc32) as architecture specific workarounds.
I see that sparc64 and parisc use pgprot_uncached here, but as they don't define a custom pgprot_writecombine, this ends up being the same, and they can use the above definition as well.
mips defines pgprot_writecombine but uses pgprot_noncached in fb_pgprotect(), which is probably a mistake and should have been updated as part of commit 4b050ba7a66c ("MIPS: pgtable.h:
Implement the pgprot_writecombine function for MIPS").
Arnd
Re: [PATCH 01/18] fbdev: Prepare generic architecture helpers
Quoted 31 lines · Arnd Bergmann
Quoted 7 lines · Thomas Zimmermann
Generic implementations of
fb_pgprotect()andfb_is_primary_device()have been in the source code for a long time. Prepare the header file to make use of them.Improve the code by using an inline function for
fb_pgprotect()and by removing include statements.Quoted 6 lines
Symbols are protected by preprocessor guards. Architectures that provide a symbol need to define a preprocessor token of the same name and value. Otherwise the header file will provide a generic implementation. This pattern has been taken from <
asm/io.h>.Signed-off-by Thomas Zimmermann <[email protected]>Moving this into generic code is good, but I'm not sure about the default for
fb_pgprotect():include/asm-generic/fb.h line 19
Quoted 7 lines
include/asm-generic/fb.h +7
-0+ +#ifndef fb_pgprotect +#define fb_pgprotect fb_pgprotect +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma, +unsigned long off) +{ } +#endif I think most architectures will want the version we have on arc, arm, arm64, loongarch, and sh already:
static inline void fb_pgprotect(struct file *file, struct
vm_area_struct*vma,
unsigned long off)
Quoted 7 lines
{ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); }so I'd suggest making that version the default, and treating the empty ones (m68knommu, sparc32) as architecture specific workarounds.
Yeah I was about to type the same suggestion :-)
-Daniel
Quoted 10 lines
I see that sparc64 and parisc use
pgprot_uncachedhere, but as they don't define a custompgprot_writecombine, this ends up being the same, and they can use the above definition as well.mips defines
pgprot_writecombinebut usespgprot_noncachedinfb_pgprotect(), which is probably a mistake and should have been updated as part of commit4b050ba7a66c("MIPS:pgtable.h:
Implement thepgprot_writecombinefunction for MIPS").Arnd
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH 01/18] fbdev: Prepare generic architecture helpers
In reply to Arnd BergmannHi
Am 05.04.23 um 17:53 schrieb Arnd Bergmann:
Quoted 31 lines · Thomas Zimmermann
Quoted 7 lines
Generic implementations of
fb_pgprotect()andfb_is_primary_device()have been in the source code for a long time. Prepare the header file to make use of them.Improve the code by using an inline function for
fb_pgprotect()and by removing include statements.Quoted 6 lines
Symbols are protected by preprocessor guards. Architectures that provide a symbol need to define a preprocessor token of the same name and value. Otherwise the header file will provide a generic implementation. This pattern has been taken from <
asm/io.h>.Signed-off-by Thomas Zimmermann <[email protected]>Moving this into generic code is good, but I'm not sure about the default for
fb_pgprotect():include/asm-generic/fb.h line 19
Quoted 7 lines
include/asm-generic/fb.h +7
-0+ +#ifndef fb_pgprotect +#define fb_pgprotect fb_pgprotect +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma, +unsigned long off) +{ } +#endif I think most architectures will want the version we have on arc, arm, arm64, loongarch, and sh already:
static inline void fb_pgprotect(struct file *file, struct
vm_area_struct*vma,
unsigned long off)
Quoted 7 lines
{ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); }so I'd suggest making that version the default, and treating the empty ones (m68knommu, sparc32) as architecture specific workarounds.
Make sense, thanks for the feedback. I'll send out an update soon.
Best regards
Thomas
Quoted 11 lines
I see that sparc64 and parisc use
pgprot_uncachedhere, but as they don't define a custompgprot_writecombine, this ends up being the same, and they can use the above definition as well.mips defines
pgprot_writecombinebut usespgprot_noncachedinfb_pgprotect(), which is probably a mistake and should have been updated as part of commit4b050ba7a66c("MIPS:pgtable.h:
Implement thepgprot_writecombinefunction for MIPS").Arnd
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Re: [PATCH 01/18] fbdev: Prepare generic architecture helpers
In reply to Arnd BergmannHi
Am 05.04.23 um 17:53 schrieb Arnd Bergmann:
Quoted 39 lines · Thomas Zimmermann
Quoted 7 lines
Generic implementations of
fb_pgprotect()andfb_is_primary_device()have been in the source code for a long time. Prepare the header file to make use of them.Improve the code by using an inline function for
fb_pgprotect()and by removing include statements.Quoted 6 lines
Symbols are protected by preprocessor guards. Architectures that provide a symbol need to define a preprocessor token of the same name and value. Otherwise the header file will provide a generic implementation. This pattern has been taken from <
asm/io.h>.Signed-off-by Thomas Zimmermann <[email protected]>Moving this into generic code is good, but I'm not sure about the default for
fb_pgprotect():include/asm-generic/fb.h line 19
Quoted 7 lines
include/asm-generic/fb.h +7
-0+ +#ifndef fb_pgprotect +#define fb_pgprotect fb_pgprotect +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma, +unsigned long off) +{ } +#endif I think most architectures will want the version we have on arc, arm, arm64, loongarch, and sh already:
static inline void fb_pgprotect(struct file *file, struct
vm_area_struct*vma,
unsigned long off){ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); }so I'd suggest making that version the default, and treating the empty ones (m68knommu, sparc32) as architecture specific workarounds.
Quoted 8 lines
I see that sparc64 and parisc use
pgprot_uncachedhere, but as they don't define a custompgprot_writecombine, this ends up being the same, and they can use the above definition as well.mips defines
pgprot_writecombinebut usespgprot_noncachedinfb_pgprotect(), which is probably a mistake and should have been updated as part of commit4b050ba7a66c("MIPS:pgtable.h:
Implement thepgprot_writecombinefunction for MIPS").
I would not want to change any of the other platform's functions unless the rsp platform maintainers ask me to.
Best regards
Thomas
Quoted 2 lines
Arnd
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
PATCH 2/18 arch/arc: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.
--- arch/arc/include/asm/fb.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
arch/arc/include/asm/fb.h +5 -6
@@ -1,20 +1,19 @@/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_FB_H_#define _ASM_FB_H_ -#include <linux/fb.h> -#include <linux/fs.h> #include <asm/page.h> +struct file ; +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) { vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); } +#define fb_pgprotect fb_pgprotect -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#include <asm-generic/fb.h> #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 3/18 arch/arm: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.
--- arch/arm/include/asm/fb.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/arm/include/asm/fb.h +4 -6
@@ -1,19 +1,17 @@#ifndef _ASM_FB_H_#define _ASM_FB_H_ -#include <linux/fb.h> -#include <linux/fs.h> #include <asm/page.h> +struct file ; +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) { vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot); } +#define fb_pgprotect fb_pgprotect -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#include <asm-generic/fb.h> #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 4/18 arch/arm64: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.
--- arch/arm64/include/asm/fb.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/arm64/include/asm/fb.h +4 -6
@@ -5,19 +5,17 @@#ifndef __ASM_FB_H_#define __ASM_FB_H_ -#include <linux/fb.h> -#include <linux/fs.h> #include <asm/page.h> +struct file ; +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) { vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot); } +#define fb_pgprotect fb_pgprotect -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#include <asm-generic/fb.h> #endif /* __ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 5/18 arch/ia64: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.
--- arch/ia64/include/asm/fb.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
arch/ia64/include/asm/fb.h +5 -6
@@ -2,11 +2,12 @@#ifndef _ASM_FB_H_#define _ASM_FB_H_ -#include <linux/fb.h> -#include <linux/fs.h> #include <linux/efi.h> +#include <asm/page.h> +struct file ; +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) {
@@ -15,10 +16,8 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, else vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); } +#define fb_pgprotect fb_pgprotect -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#include <asm-generic/fb.h> #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 6/18 arch/loongarch: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.
--- arch/loongarch/include/asm/fb.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/loongarch/include/asm/fb.h +4 -6
@@ -5,19 +5,17 @@#ifndef _ASM_FB_H_#define _ASM_FB_H_ -#include <linux/fb.h> -#include <linux/fs.h> #include <asm/page.h> +struct file ; +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) { vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot); } +#define fb_pgprotect fb_pgprotect -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#include <asm-generic/fb.h> #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 7/18 arch/m68k: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes. Also use the generic helper for fb_pgprotect() on systems without MMU.
--- arch/m68k/include/asm/fb.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
arch/m68k/include/asm/fb.h +3 -7
@@ -2,8 +2,8 @@#ifndef _ASM_FB_H_#define _ASM_FB_H_ -#include <linux/fb.h> #include <linux/fs.h> +#include <asm/page.h> #include <asm/setup.h>
@@ -27,13 +27,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, } }#endif /* CONFIG_SUN3 */ -#else -#define fb_pgprotect (...) do {} while (0) +#define fb_pgprotect fb_pgprotect#endif /* CONFIG_MMU */ -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#include <asm-generic/fb.h> #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 8/18 arch/mips: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.
--- arch/mips/include/asm/fb.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/mips/include/asm/fb.h +4 -6
@@ -1,19 +1,17 @@#ifndef _ASM_FB_H_#define _ASM_FB_H_ -#include <linux/fb.h> -#include <linux/fs.h> #include <asm/page.h> +struct file ; +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) { vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); } +#define fb_pgprotect fb_pgprotect -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#include <asm-generic/fb.h> #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 9/18 video: Remove trailing whitespaces
In reply to Thomas ZimmermannFix trailing whitespaces. No functional changes.
--- drivers/video/console/sticon.c | 4 +- drivers/video/console/sticore.c | 102 ++++++++++----------- drivers/video/fbdev/sticore.h | 14 +-- drivers/video/fbdev/stifb.c | 156 ++++++++++++++++---------------- 4 files changed, 138 insertions(+), 138 deletions(-)
drivers/video/console/sticon.c +2 -2
@@ -282,7 +282,7 @@ static void sticon_init(struct vc_data *c, int init) vc_cols =sti_onscreen_x (sti) / sti->font->width; vc_rows =sti_onscreen_y (sti) / sti->font->height; c->vc_can_do_color =1 ; - +if (init) { c->vc_cols = vc_cols; c->vc_rows = vc_rows;
@@ -374,7 +374,7 @@ static const struct consw sti_con = { .con_font_set = sticon_font_set, .con_font_default = sticon_font_default, .con_build_attr = sticon_build_attr, - .con_invert_region = sticon_invert_region, + .con_invert_region = sticon_invert_region, };
drivers/video/console/sticore.c +51 -51
322 lines not on this page · raw message
drivers/video/fbdev/sticore.h +7 -7
@@ -27,11 +27,11 @@* * Probably the best solution to all this is have the generic code manage * the screen buffer and a kernel thread to call STI occasionally. -* +* * Luckily, the frame buffer guys have the same problem so we can just wait * for them to fix it and steal their solution. prumpf */ - +#include <asm/io.h> #define STI_WAIT 1
@@ -56,7 +56,7 @@/* STI function configuration structs */ typedef union region { - struct { + struct { u32 offset : 14; /* offset in 4kbyte page */ u32 sys_only : 1; /* don't map to user space */ u32 cache : 1; /* map to data cache */
@@ -154,7 +154,7 @@ struct sti_conf_inptr { };struct sti_conf_outptr_ext { -u32 crt_config[3 ];/* hardware specific X11/OGL information */ +u32 crt_config[3 ];/* hardware specific X11/OGL information */ u32 crt_hdw[3 ];u32 future_ptr; };
@@ -211,7 +211,7 @@ struct sti_rom {u32 set_cm_entry;u32 dma_ctrl;u8 res040[7 *4 ]; - +u32 init_graph_addr;u32 state_mgmt_addr;u32 font_unp_addr;
@@ -271,7 +271,7 @@ struct sti_font_flags { u32 pad : 30; /* pad to word boundary */u32 future_ptr;/* pointer to future data */ }; - +struct sti_font_outptr {s32 errno;/* error number on failure */ u32 future_ptr;/* pointer to future data */
@@ -338,7 +338,7 @@ struct sti_all_data {struct sti_struct {spinlock_t lock; - +/* char **mon_strings; */ int sti_mem_request;u32 graphics_id[2 ];
drivers/video/fbdev/stifb.c +78 -78
530 lines not on this page · raw message
Signature · 1 line
2.40.0
PATCH 10/18 video: Move HP PARISC STI core code to shared location
In reply to Thomas ZimmermannSTI core files have been located in console and fbdev code. Move the source code and header to the directories for video helpers. Also update the config and build rules such that the code depends on the config symbol CONFIG_STI_CORE, which STI console and STI framebuffer select automatically.
Cleans up the console makefile and prepares PARISC to implement fb_is_primary_device() within the arch/ directory. No functional changes.
---
drivers/video/Kconfig | 7 +++++++
drivers/video/Makefile | 1 +
drivers/video/console/Kconfig | 1 +
drivers/video/console/Makefile | 4 +---
drivers/video/console/sticon.c | 2 +-
drivers/video/fbdev/Kconfig | 3 +--
drivers/video/fbdev/stifb.c | 2 +-
drivers/video/{console => }/sticore.c | 2 +-
{drivers/video/fbdev => include/video}/sticore.h | 0
9 files changed, 14 insertions(+), 8 deletions(-)
rename drivers/video/{console => }/sticore.c (99%)
rename {drivers/video/fbdev => include/video}/sticore.h (100%)drivers/video/Kconfig +7 -0
@@ -11,6 +11,13 @@ config APERTURE_HELPERS Support tracking and hand-over of aperture ownership. Required by graphics drivers for firmware-provided framebuffers. +config STI_CORE + bool + depends on PARISC + help + STI refers to the HP "Standard Text Interface" which is a set of + BIOS routines contained in a ROM chip in HP PA-RISC based machines. + config VIDEO_CMDLINE bool
drivers/video/Makefile +1 -0
@@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_APERTURE_HELPERS) += aperture.o +obj-$(CONFIG_STI_CORE) += sticore.o obj-$(CONFIG_VGASTATE) += vgastate.o obj-$(CONFIG_VIDEO_CMDLINE) += cmdline.o obj-$(CONFIG_VIDEO_NOMODESET) += nomodeset.o
drivers/video/console/Kconfig +1 -0
@@ -141,6 +141,7 @@ config STI_CONSOLE depends on PARISC && HAS_IOMEM select FONT_SUPPORT select CRC32 + select STI_CORE default y help The STI console is the builtin display/keyboard on HP-PARISC
drivers/video/console/Makefile +1 -3
@@ -5,8 +5,6 @@ obj-$(CONFIG_DUMMY_CONSOLE) += dummycon.o obj-$(CONFIG_SGI_NEWPORT_CONSOLE) += newport_con.o -obj-$(CONFIG_STI_CONSOLE) += sticon.o sticore.o +obj-$(CONFIG_STI_CONSOLE) += sticon.o obj-$(CONFIG_VGA_CONSOLE) += vgacon.o obj-$(CONFIG_MDA_CONSOLE) += mdacon.o - -obj-$(CONFIG_FB_STI) += sticore.o
drivers/video/console/sticon.c +1 -1
@@ -50,7 +50,7 @@#include <asm/io.h> -#include "../fbdev/sticore.h" +#include <video/sticore.h> /* switching to graphics mode */ #define BLANK 0
drivers/video/fbdev/Kconfig +1 -2
@@ -551,10 +551,9 @@ config FB_STI select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select STI_CORE default y help - STI refers to the HP "Standard Text Interface" which is a set of - BIOS routines contained in a ROM chip in HP PA-RISC based machines. Enabling this option will implement the linux framebuffer device using calls to the STI BIOS routines for initialisation.
drivers/video/fbdev/stifb.c +1 -1
@@ -69,7 +69,7 @@#include <asm/grfioctl.h> /* for HP-UX compatibility */ #include <linux/uaccess.h> -#include "sticore.h" +#include <video/sticore.h> /* REGION_BASE(fb_info, index) returns the virtual address for region <index> */ #define REGION_BASE (fb_info, index) \
drivers/video/sticore.c renamed from drivers/video/console/sticore.c +1 -1
@@ -32,7 +32,7 @@#include <asm/grfioctl.h> #include <asm/fb.h> -#include "../fbdev/sticore.h" +#include <video/sticore.h> #define STI_DRIVERVERSION "Version 0.9c"
include/video/sticore.h renamed from drivers/video/fbdev/sticore.h +0 -0
Signature · 1 line
2.40.0
PATCH 11/18 arch/parisc: Remove trailing whitespaces
In reply to Thomas ZimmermannFix trailing whitespaces. No functional changes.
--- arch/parisc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/parisc/Makefile +1 -1
@@ -11,7 +11,7 @@ # Copyright (C) 1994 by Linus Torvalds # Portions Copyright (C) 1999 The Puffin Group # -# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries, +# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries, # Mike Shaver, Helge Deller and Martin K. Petersen #
Signature · 1 line
2.40.0
PATCH 12/18 arch/parisc: Implement fb_is_primary_device() under arch/parisc
In reply to Thomas ZimmermannMove PARISC's implementation of fb_is_primary_device() into the architecture directory. This the place of the declaration and where other architectures implement this function. No functional changes.
--- arch/parisc/Makefile | 2 ++ arch/parisc/include/asm/fb.h | 2 +- arch/parisc/video/Makefile | 3 +++ arch/parisc/video/fbdev.c | 27 +++++++++++++++++++++++++++ drivers/video/sticore.c | 19 ------------------- include/video/sticore.h | 2 ++ 6 files changed, 35 insertions(+), 20 deletions(-) create mode 100644 arch/parisc/video/Makefile create mode 100644 arch/parisc/video/fbdev.c
arch/parisc/Makefile +2 -0
@@ -119,6 +119,8 @@ export LIBGCC libs-y += arch/parisc/lib/ $(LIBGCC) +drivers-y += arch/parisc/video/ + boot := arch/parisc/boot PALO := $(shell if (which palo 2>&1); then : ; \
arch/parisc/include/asm/fb.h +1 -1
@@ -12,7 +12,7 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,pgprot_val (vma->vm_page_prot) |= _PAGE_NO_CACHE; } -#if defined(CONFIG_FB_STI ) +#if defined(CONFIG_STI_CORE )int fb_is_primary_device (struct fb_info *info);#else static inline int fb_is_primary_device (struct fb_info *info)
arch/parisc/video/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_STI_CORE) += fbdev.o
arch/parisc/video/fbdev.c new file +27 -0
@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2000 Philipp Rumpf <[email protected]> +* Copyright (C) 2001-2020 Helge Deller <[email protected]> +* Copyright (C) 2001-2002 Thomas Bogendoerfer <[email protected]> +*/ + +#include <linux/module.h> + +#include <asm/fb.h> + +#include <video/sticore.h> + +int fb_is_primary_device (struct fb_info *info) +{ +struct sti_struct *sti; + + sti =sti_get_rom (0 ); + +/* if no built-in graphics card found, allow any fb driver as default */ +if (!sti) +return true; + +/* return true if it's the default built-in framebuffer driver */ +return (sti->info = info); +} +EXPORT_SYMBOL (fb_is_primary_device);
drivers/video/sticore.c +0 -19
@@ -30,7 +30,6 @@#include <asm/pdc.h> #include <asm/cacheflush.h> #include <asm/grfioctl.h> -#include <asm/fb.h> #include <video/sticore.h>
@@ -1148,24 +1147,6 @@ int sti_call(const struct sti_struct *sti, unsigned long func,return ret; } -#if defined(CONFIG_FB_STI ) -/* check if given fb_info is the primary device */ -int fb_is_primary_device (struct fb_info *info) -{ -struct sti_struct *sti; - - sti =sti_get_rom (0 ); - -/* if no built-in graphics card found, allow any fb driver as default */ -if (!sti) -return true; - -/* return true if it's the default built-in framebuffer driver */ -return (sti->info = info); -} -EXPORT_SYMBOL (fb_is_primary_device); -#endif -MODULE_AUTHOR ("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer" );MODULE_DESCRIPTION ("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines" );MODULE_LICENSE ("GPL v2" );
include/video/sticore.h +2 -0
@@ -2,6 +2,8 @@#ifndef STICORE_H #define STICORE_H +struct fb_info ; +/* generic STI structures & functions */ #define MAX_STI_ROMS 4/* max no. of ROMs which this driver handles */
Signature · 1 line
2.40.0
Re: [PATCH 12/18] arch/parisc: Implement fb_is_primary_device() under arch/parisc
Am Mittwoch, 5. April 2023, 17:05:48 CEST schrieb Thomas Zimmermann:
Quoted 16 lines
Move PARISC's implementation of
fb_is_primary_device()into the architecture directory. This the place of the declaration and where other architectures implement this function. No functional changes.arch/parisc/video/fbdev.c new file +5
-0@@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2000 Philipp Rumpf <[email protected]> +* Copyright (C) 2001-2020 Helge Deller <[email protected]> +* Copyright (C) 2001-2002 Thomas Bogendoerfer <[email protected]>
arch/parisc/video/fbdev.c line 15
Quoted 10 lines
arch/parisc/video/fbdev.c new file +10
-0+*/ + +#include <linux/module.h> + +#include <asm/fb.h> + +#include <video/sticore.h> + +int fb_is_primary_device (struct fb_info *info) +{
Looking at this makes me wonder why the argument to all of these functions isn't const? Not your fault, but could be a candidate for patch #19?
Eike
PATCH 13/18 arch/parisc: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h> on systems without CONFIG_STI_CORE. No functional changes.
--- arch/parisc/include/asm/fb.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
arch/parisc/include/asm/fb.h +8 -7
@@ -2,23 +2,24 @@#ifndef _ASM_FB_H_#define _ASM_FB_H_ -#include <linux/fb.h> -#include <linux/fs.h> #include <asm/page.h> +#include <asm/pgtable.h> + +struct fb_info ; +struct file ;static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) {pgprot_val (vma->vm_page_prot) |= _PAGE_NO_CACHE; } +#define fb_pgprotect fb_pgprotect#if defined(CONFIG_STI_CORE )int fb_is_primary_device (struct fb_info *info); -#else -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#define fb_is_primary_device fb_is_primary_device#endif +#include <asm-generic/fb.h> +#endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 14/18 arch/powerpc: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.
--- arch/powerpc/include/asm/fb.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/fb.h +3 -5
@@ -2,8 +2,8 @@#ifndef _ASM_FB_H_#define _ASM_FB_H_ -#include <linux/fb.h> #include <linux/fs.h> +#include <asm/page.h> static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
@@ -13,10 +13,8 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, vma->vm_end - vma->vm_start, vma->vm_page_prot); } +#define fb_pgprotect fb_pgprotect -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#include <asm-generic/fb.h> #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 15/18 arch/sh: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_is_primary_device() with the generic one from <asm-generic/fb.h>. No functional changes.
--- arch/sh/include/asm/fb.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
arch/sh/include/asm/fb.h +4 -6
@@ -2,19 +2,17 @@#ifndef _ASM_FB_H_#define _ASM_FB_H_ -#include <linux/fb.h> -#include <linux/fs.h> #include <asm/page.h> +struct file ; +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) { vma->vm_page_prot =pgprot_writecombine (vma->vm_page_prot); } +#define fb_pgprotect fb_pgprotect -static inline int fb_is_primary_device (struct fb_info *info) -{ -return 0 ; -} +#include <asm-generic/fb.h> #endif /* _ASM_FB_H_ */
Signature · 1 line
2.40.0
PATCH 16/18 arch/sparc: Implement fb_is_primary_device() in source file
In reply to Thomas ZimmermannOther architectures implment fb_is_primary_device() in a source file. Do the same on sparc. No functional changes, but allows to remove several include statement from <asm/fb.h>.
--- arch/sparc/Makefile | 1 + arch/sparc/include/asm/fb.h | 22 +++++----------------- arch/sparc/video/Makefile | 3 +++ arch/sparc/video/fbdev.c | 24 ++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 17 deletions(-) create mode 100644 arch/sparc/video/Makefile create mode 100644 arch/sparc/video/fbdev.c
arch/sparc/Makefile +1 -0
@@ -60,6 +60,7 @@ libs-y += arch/sparc/prom/ libs-y += arch/sparc/lib/ drivers-$(CONFIG_PM) += arch/sparc/power/ +drivers-$(CONFIG_FB) += arch/sparc/video/ boot := arch/sparc/boot
arch/sparc/include/asm/fb.h +5 -17
@@ -1,12 +1,14 @@/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _SPARC_FB_H_#define _SPARC_FB_H_ -#include <linux/console.h> -#include <linux/fb.h> +#include <linux/fs.h> +#include <asm/page.h> #include <asm/prom.h> +struct fb_info ; +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) {
@@ -15,20 +17,6 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, #endif } -static inline int fb_is_primary_device (struct fb_info *info) -{ -struct device *dev = info->device; -struct device_node *node; - -if (console_set_on_cmdline) -return 0 ; - - node = dev->of_node; -if (node && - node = of_console_device) -return 1 ; - -return 0 ; -} +int fb_is_primary_device (struct fb_info *info);#endif /* _SPARC_FB_H_ */
arch/sparc/video/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_FB) += fbdev.o
arch/sparc/video/fbdev.c new file +24 -0
@@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <linux/console.h> +#include <linux/fb.h> +#include <linux/module.h> + +#include <asm/fb.h> +#include <asm/prom.h> + +int fb_is_primary_device (struct fb_info *info) +{ +struct device *dev = info->device; +struct device_node *node; + +if (console_set_on_cmdline) +return 0 ; + + node = dev->of_node; +if (node && node = of_console_device) +return 1 ; + +return 0 ; +} +EXPORT_SYMBOL (fb_is_primary_device);
Signature · 1 line
2.40.0
PATCH 17/18 arch/sparc: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannReplace the architecture's fb_pgprotect() with the generic one from <asm-generic/fb.h> on 32-bit builds. No functional changes.
--- arch/sparc/include/asm/fb.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/sparc/include/asm/fb.h +7 -3
@@ -5,18 +5,22 @@#include <linux/fs.h> #include <asm/page.h> -#include <asm/prom.h> struct fb_info ; +struct file ; +#ifdef CONFIG_SPARC64 static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) { -#ifdef CONFIG_SPARC64 vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); -#endif } +#define fb_pgprotect fb_pgprotect +#endif int fb_is_primary_device (struct fb_info *info); +#define fb_is_primary_device fb_is_primary_device + +#include <asm-generic/fb.h> #endif /* _SPARC_FB_H_ */
Signature · 1 line
2.40.0
PATCH 18/18 arch/x86: Implement <asm/fb.h> with generic helpers
In reply to Thomas ZimmermannInclude <asm-generic/fb.h> and set the required preprocessor tokens correctly. x86 now implements its own set of fb helpers, but still follows the overall pattern.
--- arch/x86/include/asm/fb.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/x86/include/asm/fb.h +8 -3
@@ -2,10 +2,11 @@#ifndef _ASM_X86_FB_H#define _ASM_X86_FB_H -#include <linux/fb.h> -#include <linux/fs.h> #include <asm/page.h> +struct fb_info ; +struct file ; +static inline void fb_pgprotect (struct file *file,struct vm_area_struct *vma,unsigned long off) {
@@ -16,7 +17,11 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, pgprot_val(vma->vm_page_prot) prot | cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS); } +#define fb_pgprotect fb_pgprotect + +int fb_is_primary_device (struct fb_info *info); +#define fb_is_primary_device fb_is_primary_device -extern int fb_is_primary_device (struct fb_info *info); +#include <asm-generic/fb.h> #endif /* _ASM_X86_FB_H */
Signature · 1 line
2.40.0
Am Mittwoch, 5. April 2023, 17:05:36 CEST schrieb Thomas Zimmermann:
Quoted 1 line
Various architectures provide <
arm/fb.h> with helpers for fbdev
^ *lol*
Eike