From 9f0fc191371843c4fc000a226b0a26b6c059aacd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 19:40:19 +0200 Subject: Merging upstream version 6.7.7. Signed-off-by: Daniel Baumann --- drivers/video/console/Kconfig | 11 +- drivers/video/console/dummycon.c | 7 +- drivers/video/console/vgacon.c | 68 +-- drivers/video/fbdev/68328fb.c | 5 +- drivers/video/fbdev/Kconfig | 132 ++--- drivers/video/fbdev/Makefile | 17 +- drivers/video/fbdev/amba-clcd.c | 5 +- drivers/video/fbdev/amifb.c | 15 +- drivers/video/fbdev/arkfb.c | 2 + drivers/video/fbdev/atafb.c | 2 + drivers/video/fbdev/atmel_lcdfb.c | 18 +- drivers/video/fbdev/aty/atyfb_base.c | 3 + drivers/video/fbdev/aty/radeon_base.c | 2 + drivers/video/fbdev/au1100fb.c | 8 +- drivers/video/fbdev/au1200fb.c | 9 - drivers/video/fbdev/bw2.c | 17 +- drivers/video/fbdev/cg14.c | 19 +- drivers/video/fbdev/cg3.c | 17 +- drivers/video/fbdev/cg6.c | 17 +- drivers/video/fbdev/cirrusfb.c | 2 + drivers/video/fbdev/cobalt_lcdfb.c | 2 + drivers/video/fbdev/controlfb.c | 5 +- drivers/video/fbdev/core/Kconfig | 12 + drivers/video/fbdev/core/Makefile | 5 +- drivers/video/fbdev/core/fb_chrdev.c | 3 +- drivers/video/fbdev/core/fb_internal.h | 17 + drivers/video/fbdev/core/fb_io_fops.c | 3 + drivers/video/fbdev/core/fb_logo.c | 508 +++++++++++++++++++ drivers/video/fbdev/core/fbcon.c | 2 + drivers/video/fbdev/core/fbmem.c | 542 +-------------------- drivers/video/fbdev/cyber2000fb.c | 2 + drivers/video/fbdev/dnfb.c | 2 + drivers/video/fbdev/ep93xx-fb.c | 5 +- drivers/video/fbdev/ffb.c | 17 +- drivers/video/fbdev/gbefb.c | 7 +- drivers/video/fbdev/hgafb.c | 2 + drivers/video/fbdev/hitfb.c | 4 +- drivers/video/fbdev/hpfb.c | 2 + drivers/video/fbdev/hyperv_fb.c | 58 +-- drivers/video/fbdev/i810/i810_main.c | 2 + drivers/video/fbdev/imsttfb.c | 2 + drivers/video/fbdev/intelfb/intelfbdrv.c | 4 +- drivers/video/fbdev/leo.c | 19 +- drivers/video/fbdev/matrox/matroxfb_base.c | 2 + drivers/video/fbdev/matrox/matroxfb_crtc2.c | 4 +- drivers/video/fbdev/mmp/fb/mmpfb.c | 7 - drivers/video/fbdev/neofb.c | 2 + drivers/video/fbdev/offb.c | 8 +- drivers/video/fbdev/omap/omapfb_main.c | 28 +- drivers/video/fbdev/omap2/omapfb/Kconfig | 4 +- .../omap2/omapfb/displays/connector-analog-tv.c | 7 +- .../fbdev/omap2/omapfb/displays/connector-dvi.c | 7 +- .../fbdev/omap2/omapfb/displays/connector-hdmi.c | 7 +- .../fbdev/omap2/omapfb/displays/encoder-opa362.c | 7 +- .../fbdev/omap2/omapfb/displays/encoder-tfp410.c | 7 +- .../omap2/omapfb/displays/encoder-tpd12s015.c | 7 +- .../video/fbdev/omap2/omapfb/displays/panel-dpi.c | 7 +- .../fbdev/omap2/omapfb/displays/panel-dsi-cm.c | 7 +- .../omapfb/displays/panel-sharp-ls037v7dw01.c | 7 +- drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 5 +- drivers/video/fbdev/omap2/omapfb/vrfb.c | 9 +- drivers/video/fbdev/p9100.c | 18 +- drivers/video/fbdev/pm2fb.c | 2 + drivers/video/fbdev/pm3fb.c | 2 + drivers/video/fbdev/pvr2fb.c | 14 +- drivers/video/fbdev/s1d13xxxfb.c | 25 +- drivers/video/fbdev/s3fb.c | 2 + drivers/video/fbdev/sa1100fb.c | 5 +- drivers/video/fbdev/savage/savagefb_driver.c | 9 +- drivers/video/fbdev/sbuslib.h | 37 +- drivers/video/fbdev/sis/sis_main.c | 6 +- drivers/video/fbdev/sm501fb.c | 4 + drivers/video/fbdev/sm712fb.c | 5 +- drivers/video/fbdev/smscufx.c | 85 +--- drivers/video/fbdev/stifb.c | 2 + drivers/video/fbdev/sunxvr500.c | 2 + drivers/video/fbdev/tcx.c | 20 +- drivers/video/fbdev/tdfxfb.c | 6 +- drivers/video/fbdev/tgafb.c | 2 + drivers/video/fbdev/tridentfb.c | 2 + drivers/video/fbdev/udlfb.c | 89 +--- drivers/video/fbdev/vermilion/vermilion.c | 5 +- drivers/video/fbdev/vga16fb.c | 11 +- drivers/video/fbdev/via/viafbdev.c | 4 +- drivers/video/fbdev/vt8623fb.c | 2 + 85 files changed, 999 insertions(+), 1093 deletions(-) create mode 100644 drivers/video/fbdev/core/fb_logo.c (limited to 'drivers/video') diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 30577b1d3d..83c2d7329c 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -7,9 +7,9 @@ menu "Console display driver support" config VGA_CONSOLE bool "VGA text console" if EXPERT || !X86 - depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC && !SUPERH && \ - (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \ - !ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML + depends on ALPHA || IA64 || X86 || \ + (ARM && ARCH_FOOTBRIDGE) || \ + (MIPS && (MIPS_MALTA || SIBYTE_BCM112X || SIBYTE_SB1250 || SIBYTE_BCM1x80 || SNI_RM)) select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE) default y help @@ -52,7 +52,7 @@ config DUMMY_CONSOLE config DUMMY_CONSOLE_COLUMNS int "Initial number of console screen columns" - depends on DUMMY_CONSOLE && !ARM + depends on DUMMY_CONSOLE && !ARCH_FOOTBRIDGE default 160 if PARISC default 80 help @@ -62,8 +62,9 @@ config DUMMY_CONSOLE_COLUMNS config DUMMY_CONSOLE_ROWS int "Initial number of console screen rows" - depends on DUMMY_CONSOLE && !ARM + depends on DUMMY_CONSOLE && !ARCH_FOOTBRIDGE default 64 if PARISC + default 30 if ARM default 25 help On PA-RISC, the default value is 64, which should fit a 1280x1024 diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index f1711b2f9f..14af5d9e13 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c @@ -18,9 +18,10 @@ * Dummy console driver */ -#if defined(__arm__) -#define DUMMY_COLUMNS screen_info.orig_video_cols -#define DUMMY_ROWS screen_info.orig_video_lines +#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_VGA_CONSOLE) +#include +#define DUMMY_COLUMNS vgacon_screen_info.orig_video_cols +#define DUMMY_ROWS vgacon_screen_info.orig_video_lines #else /* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */ #define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 7ad047bcae..8ef1579fa5 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -89,6 +89,8 @@ static int vga_video_font_height; static int vga_scan_lines __read_mostly; static unsigned int vga_rolled_over; /* last vc_origin offset before wrap */ +static struct screen_info *vga_si; + static bool vga_hardscroll_enabled; static bool vga_hardscroll_user_enable = true; @@ -153,8 +155,9 @@ static const char *vgacon_startup(void) u16 saved1, saved2; volatile u16 *p; - if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB || - screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) { + if (!vga_si || + vga_si->orig_video_isVGA == VIDEO_TYPE_VLFB || + vga_si->orig_video_isVGA == VIDEO_TYPE_EFI) { no_vga: #ifdef CONFIG_DUMMY_CONSOLE conswitchp = &dummy_con; @@ -164,29 +167,29 @@ static const char *vgacon_startup(void) #endif } - /* boot_params.screen_info reasonably initialized? */ - if ((screen_info.orig_video_lines == 0) || - (screen_info.orig_video_cols == 0)) + /* vga_si reasonably initialized? */ + if ((vga_si->orig_video_lines == 0) || + (vga_si->orig_video_cols == 0)) goto no_vga; /* VGA16 modes are not handled by VGACON */ - if ((screen_info.orig_video_mode == 0x0D) || /* 320x200/4 */ - (screen_info.orig_video_mode == 0x0E) || /* 640x200/4 */ - (screen_info.orig_video_mode == 0x10) || /* 640x350/4 */ - (screen_info.orig_video_mode == 0x12) || /* 640x480/4 */ - (screen_info.orig_video_mode == 0x6A)) /* 800x600/4 (VESA) */ + if ((vga_si->orig_video_mode == 0x0D) || /* 320x200/4 */ + (vga_si->orig_video_mode == 0x0E) || /* 640x200/4 */ + (vga_si->orig_video_mode == 0x10) || /* 640x350/4 */ + (vga_si->orig_video_mode == 0x12) || /* 640x480/4 */ + (vga_si->orig_video_mode == 0x6A)) /* 800x600/4 (VESA) */ goto no_vga; - vga_video_num_lines = screen_info.orig_video_lines; - vga_video_num_columns = screen_info.orig_video_cols; + vga_video_num_lines = vga_si->orig_video_lines; + vga_video_num_columns = vga_si->orig_video_cols; vgastate.vgabase = NULL; - if (screen_info.orig_video_mode == 7) { + if (vga_si->orig_video_mode == 7) { /* Monochrome display */ vga_vram_base = 0xb0000; vga_video_port_reg = VGA_CRT_IM; vga_video_port_val = VGA_CRT_DM; - if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { + if ((vga_si->orig_video_ega_bx & 0xff) != 0x10) { static struct resource ega_console_resource = { .name = "ega", .flags = IORESOURCE_IO, @@ -223,12 +226,12 @@ static const char *vgacon_startup(void) vga_vram_base = 0xb8000; vga_video_port_reg = VGA_CRT_IC; vga_video_port_val = VGA_CRT_DC; - if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { + if ((vga_si->orig_video_ega_bx & 0xff) != 0x10) { int i; vga_vram_size = 0x8000; - if (!screen_info.orig_video_isVGA) { + if (!vga_si->orig_video_isVGA) { static struct resource ega_console_resource = { .name = "ega", .flags = IORESOURCE_IO, @@ -319,14 +322,14 @@ static const char *vgacon_startup(void) || vga_video_type == VIDEO_TYPE_VGAC || vga_video_type == VIDEO_TYPE_EGAM) { vga_hardscroll_enabled = vga_hardscroll_user_enable; - vga_default_font_height = screen_info.orig_video_points; - vga_video_font_height = screen_info.orig_video_points; + vga_default_font_height = vga_si->orig_video_points; + vga_video_font_height = vga_si->orig_video_points; /* This may be suboptimal but is a safe bet - go with it */ vga_scan_lines = vga_video_font_height * vga_video_num_lines; } - vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH; + vgacon_xres = vga_si->orig_video_cols * VGA_FONTWIDTH; vgacon_yres = vga_scan_lines; return display_desc; @@ -371,7 +374,7 @@ static void vgacon_init(struct vc_data *c, int init) /* Only set the default if the user didn't deliberately override it */ if (global_cursor_default == -1) global_cursor_default = - !(screen_info.flags & VIDEO_FLAGS_NOCURSOR); + !(vga_si->flags & VIDEO_FLAGS_NOCURSOR); } static void vgacon_deinit(struct vc_data *c) @@ -589,7 +592,7 @@ static int vgacon_switch(struct vc_data *c) { int x = c->vc_cols * VGA_FONTWIDTH; int y = c->vc_rows * c->vc_cell_height; - int rows = screen_info.orig_video_lines * vga_default_font_height/ + int rows = vga_si->orig_video_lines * vga_default_font_height/ c->vc_cell_height; /* * We need to save screen size here as it's the only way @@ -609,7 +612,7 @@ static int vgacon_switch(struct vc_data *c) if ((vgacon_xres != x || vgacon_yres != y) && (!(vga_video_num_columns % 2) && - vga_video_num_columns <= screen_info.orig_video_cols && + vga_video_num_columns <= vga_si->orig_video_cols && vga_video_num_lines <= rows)) vgacon_doresize(c, c->vc_cols, c->vc_rows); } @@ -1056,13 +1059,13 @@ static int vgacon_resize(struct vc_data *c, unsigned int width, * Ho ho! Someone (svgatextmode, eh?) may have reprogrammed * the video mode! Set the new defaults then and go away. */ - screen_info.orig_video_cols = width; - screen_info.orig_video_lines = height; + vga_si->orig_video_cols = width; + vga_si->orig_video_lines = height; vga_default_font_height = c->vc_cell_height; return 0; } - if (width % 2 || width > screen_info.orig_video_cols || - height > (screen_info.orig_video_lines * vga_default_font_height)/ + if (width % 2 || width > vga_si->orig_video_cols || + height > (vga_si->orig_video_lines * vga_default_font_height)/ c->vc_cell_height) return -EINVAL; @@ -1092,8 +1095,8 @@ static void vgacon_save_screen(struct vc_data *c) * console initialization routines. */ vga_bootup_console = 1; - c->state.x = screen_info.orig_x; - c->state.y = screen_info.orig_y; + c->state.x = vga_si->orig_x; + c->state.y = vga_si->orig_y; } /* We can't copy in more than the size of the video buffer, @@ -1186,4 +1189,13 @@ const struct consw vga_con = { }; EXPORT_SYMBOL(vga_con); +void vgacon_register_screen(struct screen_info *si) +{ + if (!si || vga_si) + return; + + conswitchp = &vga_con; + vga_si = si; +} + MODULE_LICENSE("GPL"); diff --git a/drivers/video/fbdev/68328fb.c b/drivers/video/fbdev/68328fb.c index 956dd2399c..c24156eb3d 100644 --- a/drivers/video/fbdev/68328fb.c +++ b/drivers/video/fbdev/68328fb.c @@ -95,13 +95,12 @@ static int mc68x328fb_mmap(struct fb_info *info, struct vm_area_struct *vma); static const struct fb_ops mc68x328fb_ops = { .owner = THIS_MODULE, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_check_var = mc68x328fb_check_var, .fb_set_par = mc68x328fb_set_par, .fb_setcolreg = mc68x328fb_setcolreg, .fb_pan_display = mc68x328fb_pan_display, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + __FB_DEFAULT_IOMEM_OPS_DRAW, .fb_mmap = mc68x328fb_mmap, }; diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index c29754b65c..53693c826e 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -74,6 +74,7 @@ config FB_CIRRUS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select VIDEO_NOMODESET help This enables support for Cirrus Logic GD542x/543x based boards on @@ -93,6 +94,7 @@ config FB_PM2 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select VIDEO_NOMODESET help This is the frame buffer device driver for cards based on @@ -118,9 +120,7 @@ config FB_ARMCLCD tristate "ARM PrimeCell PL110 support" depends on ARM || ARM64 || COMPILE_TEST depends on FB && ARM_AMBA && HAS_IOMEM - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_IOMEM_HELPERS select FB_MODE_HELPERS if OF select VIDEOMODE_HELPERS if OF select BACKLIGHT_CLASS_DEVICE if OF @@ -159,9 +159,7 @@ config FB_CLPS711X config FB_SA1100 bool "SA-1100 LCD support" depends on (FB = y) && ARM && ARCH_SA1100 - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_IOMEM_HELPERS help This is a framebuffer device for the SA-1100 LCD Controller. See for information on framebuffer @@ -185,6 +183,7 @@ config FB_CYBER2000 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select VIDEO_NOMODESET help This enables support for the Integraphics CyberPro 20x0 and 5000 @@ -217,6 +216,7 @@ config FB_APOLLO default y select FB_CFB_FILLRECT select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS config FB_Q40 bool @@ -227,6 +227,7 @@ config FB_Q40 config FB_AMIGA tristate "Amiga native chipset support" depends on FB && AMIGA + select FB_IOMEM_FOPS help This is the frame buffer device driver for the builtin graphics chipset found in Amigas. @@ -290,6 +291,7 @@ config FB_ATARI select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS help This is the frame buffer device driver for the builtin graphics chipset found in Ataris. @@ -308,9 +310,7 @@ config FB_OF config FB_CONTROL bool "Apple \"control\" display support" depends on (FB = y) && ((PPC_PMAC && PPC32) || COMPILE_TEST) - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_IOMEM_HELPERS select FB_MACMODES help This driver supports a frame buffer for the graphics adapter in the @@ -355,6 +355,7 @@ config FB_IMSTT bool "IMS Twin Turbo display support" depends on (FB = y) && PCI select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select FB_MACMODES if PPC_PMAC select VIDEO_NOMODESET help @@ -363,11 +364,12 @@ config FB_IMSTT config FB_VGA16 tristate "VGA 16-color graphics support" - depends on FB && (X86 || PPC) + depends on FB && X86 select APERTURE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select VGASTATE select FONT_8x16 if FRAMEBUFFER_CONSOLE help @@ -383,6 +385,7 @@ config FB_STI select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select STI_CORE default y help @@ -406,6 +409,7 @@ config FB_HP300 bool depends on (FB = y) && DIO select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS default y config FB_TGA @@ -413,10 +417,11 @@ config FB_TGA depends on FB depends on PCI || TC depends on ALPHA || TC + select BITREVERSE select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT - select BITREVERSE + select FB_IOMEM_FOPS select VIDEO_NOMODESET help This is the frame buffer device driver for generic TGA and SFB+ @@ -463,7 +468,7 @@ config FB_VESA config FB_EFI bool "EFI-based Framebuffer Support" - depends on (FB = y) && !IA64 && EFI + depends on (FB = y) && EFI select APERTURE_HELPERS select DRM_PANEL_ORIENTATION_QUIRKS select FB_IOMEM_HELPERS @@ -484,6 +489,7 @@ config FB_N411 config FB_HGA tristate "Hercules mono graphics support" depends on FB && X86 + select FB_IOMEM_FOPS help Say Y here if you have a Hercules mono graphics card. @@ -497,9 +503,7 @@ config FB_GBE bool "SGI Graphics Backend frame buffer support" depends on (FB = y) && HAS_IOMEM depends on SGI_IP32 || COMPILE_TEST - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_IOMEM_HELPERS help This is the frame buffer device driver for SGI Graphics Backend. This chip is used in SGI O2 and Visual Workstation 320/540. @@ -518,21 +522,23 @@ config FB_SBUS help Say Y if you want support for SBUS or UPA based frame buffer device. +config FB_SBUS_HELPERS + bool + select FB_CFB_COPYAREA + select FB_CFB_FILLRECT + select FB_CFB_IMAGEBLIT + config FB_BW2 bool "BWtwo support" depends on (FB = y) && (SPARC && FB_SBUS) - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the BWtwo frame buffer. config FB_CG3 bool "CGthree support" depends on (FB = y) && (SPARC && FB_SBUS) - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the CGthree frame buffer. @@ -557,9 +563,7 @@ config FB_FFB config FB_TCX bool "TCX (SS4/SS5 only) support" depends on FB_SBUS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the TCX 24/8bit frame buffer. @@ -567,9 +571,7 @@ config FB_TCX config FB_CG14 bool "CGfourteen (SX) support" depends on FB_SBUS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the CGfourteen frame buffer on Desktop SPARCsystems with the SX graphics option. @@ -577,9 +579,7 @@ config FB_CG14 config FB_P9100 bool "P9100 (Sparcbook 3 only) support" depends on FB_SBUS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the P9100 card supported on Sparcbook 3 machines. @@ -587,9 +587,7 @@ config FB_P9100 config FB_LEO bool "Leo (ZX) support" depends on FB_SBUS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_SBUS_HELPERS help This is the frame buffer device driver for the SBUS-based Sun ZX (leo) frame buffer cards. @@ -600,6 +598,7 @@ config FB_XVR500 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select VIDEO_NOMODESET help This is the framebuffer device for the Sun XVR-500 and similar @@ -637,6 +636,7 @@ config FB_PVR2 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select VIDEO_NOMODESET help Say Y here if you have a PowerVR 2 card in your box. If you plan to @@ -673,6 +673,7 @@ config FB_S1D13XXX select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS help Support for S1D13XXX framebuffer device family (currently only working with S1D13806). Product specs at @@ -693,10 +694,10 @@ config FB_NVIDIA tristate "nVidia Framebuffer Support" depends on FB && PCI select FB_BACKLIGHT if FB_NVIDIA_BACKLIGHT - select FB_MODE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select BITREVERSE select VGASTATE select VIDEO_NOMODESET @@ -741,10 +742,11 @@ config FB_RIVA tristate "nVidia Riva support" depends on FB && PCI select FB_BACKLIGHT if FB_RIVA_BACKLIGHT - select FB_MODE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS + select FB_MODE_HELPERS select BITREVERSE select VGASTATE select VIDEO_NOMODESET @@ -798,10 +800,8 @@ config FB_I740 config FB_I810 tristate "Intel 810/815 support" depends on FB && PCI && X86_32 && AGP_INTEL + select FB_IOMEM_FOPS select FB_MODE_HELPERS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT select VGASTATE select VIDEO_NOMODESET help @@ -850,10 +850,8 @@ config FB_I810_I2C config FB_LE80578 tristate "Intel LE80578 (Vermilion) support" depends on FB && PCI && X86 + select FB_IOMEM_HELPERS select FB_MODE_HELPERS - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT select VIDEO_NOMODESET help This driver supports the LE80578 (Vermilion Range) chipset @@ -867,10 +865,11 @@ config FB_CARILLO_RANCH config FB_INTEL tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support" depends on FB && PCI && X86 && AGP_INTEL && EXPERT - select FB_MODE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS + select FB_MODE_HELPERS select BOOT_VESA_SUPPORT if FB_INTEL = y select VIDEO_NOMODESET depends on !DRM_I915 @@ -908,6 +907,7 @@ config FB_MATROX select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select FB_TILEBLITTING select FB_MACMODES if PPC_PMAC select VIDEO_NOMODESET @@ -994,6 +994,7 @@ config FB_MATROX_I2C config FB_MATROX_MAVEN tristate "G400 second head support" depends on FB_MATROX_G && FB_MATROX_I2C + select FB_IOMEM_HELPERS help WARNING !!! This support does not work with G450 !!! @@ -1026,11 +1027,12 @@ config FB_RADEON tristate "ATI Radeon display support" depends on FB && PCI select FB_BACKLIGHT if FB_RADEON_BACKLIGHT - select FB_MODE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select FB_MACMODES if PPC + select FB_MODE_HELPERS select VIDEO_NOMODESET help Choose this option if you want to use an ATI Radeon graphics card as @@ -1092,6 +1094,7 @@ config FB_ATY select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select FB_BACKLIGHT if FB_ATY_BACKLIGHT + select FB_IOMEM_FOPS select FB_MACMODES if PPC select FB_ATY_CT if SPARC64 && PCI select VIDEO_NOMODESET @@ -1142,6 +1145,7 @@ config FB_S3 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select FB_TILEBLITTING select FB_SVGALIB select VGASTATE @@ -1161,10 +1165,11 @@ config FB_S3_DDC config FB_SAVAGE tristate "S3 Savage support" depends on FB && PCI - select FB_MODE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS + select FB_MODE_HELPERS select VGASTATE select VIDEO_NOMODESET help @@ -1200,10 +1205,11 @@ config FB_SAVAGE_ACCEL config FB_SIS tristate "SiS/XGI display support" depends on FB && PCI + select BOOT_VESA_SUPPORT if FB_SIS = y select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT - select BOOT_VESA_SUPPORT if FB_SIS = y + select FB_IOMEM_FOPS select FB_SIS_300 if !FB_SIS_315 select VIDEO_NOMODESET help @@ -1234,6 +1240,7 @@ config FB_VIA select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select I2C_ALGOBIT select VIDEO_NOMODESET help @@ -1270,10 +1277,11 @@ endif config FB_NEOMAGIC tristate "NeoMagic display support" depends on FB && PCI - select FB_MODE_HELPERS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS + select FB_MODE_HELPERS select VGASTATE select VIDEO_NOMODESET help @@ -1298,9 +1306,10 @@ config FB_KYRO config FB_3DFX tristate "3Dfx Banshee/Voodoo3/Voodoo5 display support" depends on FB && PCI - select FB_CFB_IMAGEBLIT select FB_CFB_FILLRECT select FB_CFB_COPYAREA + select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select FB_MODE_HELPERS select VIDEO_NOMODESET help @@ -1350,6 +1359,7 @@ config FB_VT8623 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select FB_TILEBLITTING select FB_SVGALIB select VGASTATE @@ -1366,6 +1376,7 @@ config FB_TRIDENT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT select FB_DDC + select FB_IOMEM_FOPS select FB_MODE_HELPERS select VIDEO_NOMODESET help @@ -1388,6 +1399,7 @@ config FB_ARK select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select FB_TILEBLITTING select FB_SVGALIB select VGASTATE @@ -1403,6 +1415,7 @@ config FB_PM3 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS select VIDEO_NOMODESET help This is the frame buffer device driver for the 3DLabs Permedia3 @@ -1438,9 +1451,7 @@ endchoice config FB_AU1100 bool "Au1100 LCD Driver" depends on (FB = y) && MIPS_ALCHEMY - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_IOMEM_HELPERS help This is the framebuffer driver for the AMD Au1100 SOC. It can drive various panels and CRTs by passing in kernel cmd line option @@ -1496,8 +1507,8 @@ config FB_HIT tristate "HD64461 Frame Buffer support" depends on FB && HD64461 select FB_CFB_FILLRECT - select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS help This is the frame buffer device driver for the Hitachi HD64461 LCD frame buffer card. @@ -1547,9 +1558,7 @@ config FB_G364 config FB_68328 bool "Motorola 68328 native frame buffer support" depends on (FB = y) && (M68328 || M68EZ328 || M68VZ328) - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_IOMEM_HELPERS help Say Y here if you want to support the built-in frame buffer of the Motorola 68328 CPU family. @@ -1664,6 +1673,7 @@ config FB_SM501 select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS help Frame buffer driver for the CRT and LCD controllers in the Silicon Motion SM501. @@ -1759,6 +1769,7 @@ config FB_GOLDFISH config FB_COBALT tristate "Cobalt server LCD frame buffer support" depends on FB && MIPS_COBALT + select FB_IOMEM_HELPERS config FB_SH7760 bool "SH7760/SH7763/SH7720/SH7721 LCDC support" @@ -1872,9 +1883,7 @@ config FB_MB862XX_I2C config FB_EP93XX tristate "EP93XX frame buffer support" depends on FB && ARCH_EP93XX - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_IOMEM_HELPERS help Framebuffer driver for the Cirrus Logic EP93XX series of processors. This driver is also available as a module. The module will be called @@ -1900,11 +1909,8 @@ config FB_BROADSHEET config FB_HYPERV tristate "Microsoft Hyper-V Synthetic Video support" depends on FB && HYPERV - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - select FB_DEFERRED_IO select DMA_CMA if HAVE_DMA_CONTIGUOUS && CMA + select FB_IOMEM_HELPERS_DEFERRED select VIDEO_NOMODESET help This framebuffer driver supports Microsoft Hyper-V Synthetic Video. @@ -1938,9 +1944,7 @@ config FB_SSD1307 config FB_SM712 tristate "Silicon Motion SM712 framebuffer support" depends on FB && PCI - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT + select FB_IOMEM_HELPERS select VIDEO_NOMODESET help Frame buffer driver for the Silicon Motion SM710, SM712, SM721 diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile index 70569f7027..8e15220152 100644 --- a/drivers/video/fbdev/Makefile +++ b/drivers/video/fbdev/Makefile @@ -8,6 +8,7 @@ obj-y += core/ obj-$(CONFIG_FB_MACMODES) += macmodes.o +obj-$(CONFIG_FB_SBUS) += sbuslib.o obj-$(CONFIG_FB_WMT_GE_ROPS) += wmt_ge_rops.o # Hardware specific drivers go first @@ -45,14 +46,14 @@ obj-$(CONFIG_FB_LE80578) += vermilion/ obj-$(CONFIG_FB_S3) += s3fb.o obj-$(CONFIG_FB_ARK) += arkfb.o obj-$(CONFIG_FB_STI) += stifb.o -obj-$(CONFIG_FB_FFB) += ffb.o sbuslib.o -obj-$(CONFIG_FB_CG6) += cg6.o sbuslib.o -obj-$(CONFIG_FB_CG3) += cg3.o sbuslib.o -obj-$(CONFIG_FB_BW2) += bw2.o sbuslib.o -obj-$(CONFIG_FB_CG14) += cg14.o sbuslib.o -obj-$(CONFIG_FB_P9100) += p9100.o sbuslib.o -obj-$(CONFIG_FB_TCX) += tcx.o sbuslib.o -obj-$(CONFIG_FB_LEO) += leo.o sbuslib.o +obj-$(CONFIG_FB_FFB) += ffb.o +obj-$(CONFIG_FB_CG6) += cg6.o +obj-$(CONFIG_FB_CG3) += cg3.o +obj-$(CONFIG_FB_BW2) += bw2.o +obj-$(CONFIG_FB_CG14) += cg14.o +obj-$(CONFIG_FB_P9100) += p9100.o +obj-$(CONFIG_FB_TCX) += tcx.o +obj-$(CONFIG_FB_LEO) += leo.o obj-$(CONFIG_FB_ACORN) += acornfb.o obj-$(CONFIG_FB_ATARI) += atafb.o c2p_iplan2.o atafb_mfb.o \ atafb_iplan2p2.o atafb_iplan2p4.o atafb_iplan2p8.o diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index 24d89e6fb7..0399db369e 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c @@ -412,13 +412,12 @@ static int clcdfb_mmap(struct fb_info *info, static const struct fb_ops clcdfb_ops = { .owner = THIS_MODULE, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_check_var = clcdfb_check_var, .fb_set_par = clcdfb_set_par, .fb_setcolreg = clcdfb_setcolreg, .fb_blank = clcdfb_blank, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + __FB_DEFAULT_IOMEM_OPS_DRAW, .fb_mmap = clcdfb_mmap, }; diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c index 441e7a8dbe..305f396c76 100644 --- a/drivers/video/fbdev/amifb.c +++ b/drivers/video/fbdev/amifb.c @@ -3488,6 +3488,7 @@ static irqreturn_t amifb_interrupt(int irq, void *dev_id) static const struct fb_ops amifb_ops = { .owner = THIS_MODULE, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_check_var = amifb_check_var, .fb_set_par = amifb_set_par, .fb_setcolreg = amifb_setcolreg, @@ -3497,6 +3498,7 @@ static const struct fb_ops amifb_ops = { .fb_copyarea = amifb_copyarea, .fb_imageblit = amifb_imageblit, .fb_ioctl = amifb_ioctl, + __FB_DEFAULT_IOMEM_OPS_MMAP, }; @@ -3750,7 +3752,7 @@ release: } -static int __exit amifb_remove(struct platform_device *pdev) +static void __exit amifb_remove(struct platform_device *pdev) { struct fb_info *info = platform_get_drvdata(pdev); @@ -3763,11 +3765,16 @@ static int __exit amifb_remove(struct platform_device *pdev) chipfree(); framebuffer_release(info); amifb_video_off(); - return 0; } -static struct platform_driver amifb_driver = { - .remove = __exit_p(amifb_remove), +/* + * amifb_remove() lives in .exit.text. For drivers registered via + * module_platform_driver_probe() this ok because they cannot get unboud at + * runtime. The driver needs to be marked with __refdata, otherwise modpost + * triggers a section mismatch warning. + */ +static struct platform_driver amifb_driver __refdata = { + .remove_new = __exit_p(amifb_remove), .driver = { .name = "amiga-video", }, diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c index 60a96fdb5d..dca9c0325b 100644 --- a/drivers/video/fbdev/arkfb.c +++ b/drivers/video/fbdev/arkfb.c @@ -924,6 +924,7 @@ static const struct fb_ops arkfb_ops = { .owner = THIS_MODULE, .fb_open = arkfb_open, .fb_release = arkfb_release, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_check_var = arkfb_check_var, .fb_set_par = arkfb_set_par, .fb_setcolreg = arkfb_setcolreg, @@ -932,6 +933,7 @@ static const struct fb_ops arkfb_ops = { .fb_fillrect = arkfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = arkfb_imageblit, + __FB_DEFAULT_IOMEM_OPS_MMAP, .fb_get_caps = svga_get_caps, }; diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index c4a420b791..b8ed1c5372 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -2665,6 +2665,7 @@ static int atafb_set_par(struct fb_info *info) static struct fb_ops atafb_ops = { .owner = THIS_MODULE, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_check_var = atafb_check_var, .fb_set_par = atafb_set_par, .fb_blank = atafb_blank, @@ -2673,6 +2674,7 @@ static struct fb_ops atafb_ops = { .fb_copyarea = atafb_copyarea, .fb_imageblit = atafb_imageblit, .fb_ioctl = atafb_ioctl, + __FB_DEFAULT_IOMEM_OPS_MMAP, }; static void check_default_par(int detected_mode) diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index a908db2334..9e391e5eaf 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c @@ -220,7 +220,7 @@ static inline void atmel_lcdfb_power_control(struct atmel_lcdfb_info *sinfo, int } } -static const struct fb_fix_screeninfo atmel_lcdfb_fix __initconst = { +static const struct fb_fix_screeninfo atmel_lcdfb_fix = { .type = FB_TYPE_PACKED_PIXELS, .visual = FB_VISUAL_TRUECOLOR, .xpanstep = 0, @@ -841,7 +841,7 @@ static void atmel_lcdfb_task(struct work_struct *work) atmel_lcdfb_reset(sinfo); } -static int __init atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo) +static int atmel_lcdfb_init_fbinfo(struct atmel_lcdfb_info *sinfo) { struct fb_info *info = sinfo->info; int ret = 0; @@ -1017,7 +1017,7 @@ put_display_node: return ret; } -static int __init atmel_lcdfb_probe(struct platform_device *pdev) +static int atmel_lcdfb_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct fb_info *info; @@ -1223,14 +1223,14 @@ out: return ret; } -static int __exit atmel_lcdfb_remove(struct platform_device *pdev) +static void atmel_lcdfb_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct fb_info *info = dev_get_drvdata(dev); struct atmel_lcdfb_info *sinfo; if (!info || !info->par) - return 0; + return; sinfo = info->par; cancel_work_sync(&sinfo->task); @@ -1252,8 +1252,6 @@ static int __exit atmel_lcdfb_remove(struct platform_device *pdev) } framebuffer_release(info); - - return 0; } #ifdef CONFIG_PM @@ -1301,7 +1299,8 @@ static int atmel_lcdfb_resume(struct platform_device *pdev) #endif static struct platform_driver atmel_lcdfb_driver = { - .remove = __exit_p(atmel_lcdfb_remove), + .probe = atmel_lcdfb_probe, + .remove_new = atmel_lcdfb_remove, .suspend = atmel_lcdfb_suspend, .resume = atmel_lcdfb_resume, .driver = { @@ -1309,8 +1308,7 @@ static struct platform_driver atmel_lcdfb_driver = { .of_match_table = atmel_lcdfb_dt_ids, }, }; - -module_platform_driver_probe(atmel_lcdfb_driver, atmel_lcdfb_probe); +module_platform_driver(atmel_lcdfb_driver); MODULE_DESCRIPTION("AT91 LCD Controller framebuffer driver"); MODULE_AUTHOR("Nicolas Ferre "); diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c index 3dcf83f5e7..a6dd1cd271 100644 --- a/drivers/video/fbdev/aty/atyfb_base.c +++ b/drivers/video/fbdev/aty/atyfb_base.c @@ -301,6 +301,7 @@ static struct fb_ops atyfb_ops = { .owner = THIS_MODULE, .fb_open = atyfb_open, .fb_release = atyfb_release, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_check_var = atyfb_check_var, .fb_set_par = atyfb_set_par, .fb_setcolreg = atyfb_setcolreg, @@ -315,6 +316,8 @@ static struct fb_ops atyfb_ops = { .fb_imageblit = atyfb_imageblit, #ifdef __sparc__ .fb_mmap = atyfb_mmap, +#else + __FB_DEFAULT_IOMEM_OPS_MMAP, #endif .fb_sync = atyfb_sync, }; diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c index 93fd177340..36bfb6deb8 100644 --- a/drivers/video/fbdev/aty/radeon_base.c +++ b/drivers/video/fbdev/aty/radeon_base.c @@ -1952,6 +1952,7 @@ static int radeonfb_set_par(struct fb_info *info) static const struct fb_ops radeonfb_ops = { .owner = THIS_MODULE, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_check_var = radeonfb_check_var, .fb_set_par = radeonfb_set_par, .fb_setcolreg = radeonfb_setcolreg, @@ -1963,6 +1964,7 @@ static const struct fb_ops radeonfb_ops = { .fb_fillrect = radeonfb_fillrect, .fb_copyarea = radeonfb_copyarea, .fb_imageblit = radeonfb_imageblit, + __FB_DEFAULT_IOMEM_OPS_MMAP, }; diff --git a/drivers/video/fbdev/au1100fb.c b/drivers/video/fbdev/au1100fb.c index 648d6cac86..a9c8d33a6e 100644 --- a/drivers/video/fbdev/au1100fb.c +++ b/drivers/video/fbdev/au1100fb.c @@ -348,15 +348,13 @@ int au1100fb_fb_mmap(struct fb_info *fbi, struct vm_area_struct *vma) fbdev->fb_len); } -static const struct fb_ops au1100fb_ops = -{ +static const struct fb_ops au1100fb_ops = { .owner = THIS_MODULE, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_setcolreg = au1100fb_fb_setcolreg, .fb_blank = au1100fb_fb_blank, .fb_pan_display = au1100fb_fb_pan_display, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + __FB_DEFAULT_IOMEM_OPS_DRAW, .fb_mmap = au1100fb_fb_mmap, }; diff --git a/drivers/video/fbdev/au1200fb.c b/drivers/video/fbdev/au1200fb.c index c137d6afe4..98afd385c4 100644 --- a/drivers/video/fbdev/au1200fb.c +++ b/drivers/video/fbdev/au1200fb.c @@ -1719,15 +1719,6 @@ static int au1200fb_drv_probe(struct platform_device *dev) } au1200fb_fb_set_par(fbi); - -#if !defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_LOGO) - if (plane == 0) - if (fb_prepare_logo(fbi, FB_ROTATE_UR)) { - /* Start display and show logo on boot */ - fb_set_cmap(&fbi->cmap, fbi); - fb_show_logo(fbi, FB_ROTATE_UR); - } -#endif } /* Now hook interrupt too */ diff --git a/drivers/video/fbdev/bw2.c b/drivers/video/fbdev/bw2.c index de34f1f333..eaab51be74 100644 --- a/drivers/video/fbdev/bw2.c +++ b/drivers/video/fbdev/bw2.c @@ -31,8 +31,8 @@ static int bw2_blank(int, struct fb_info *); -static int bw2_mmap(struct fb_info *, struct vm_area_struct *); -static int bw2_ioctl(struct fb_info *, unsigned int, unsigned long); +static int bw2_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma); +static int bw2_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg); /* * Frame buffer operations @@ -40,15 +40,8 @@ static int bw2_ioctl(struct fb_info *, unsigned int, unsigned long); static const struct fb_ops bw2_ops = { .owner = THIS_MODULE, + FB_DEFAULT_SBUS_OPS(bw2), .fb_blank = bw2_blank, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_mmap = bw2_mmap, - .fb_ioctl = bw2_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif }; /* OBio addresses for the bwtwo registers */ @@ -161,7 +154,7 @@ static struct sbus_mmap_map bw2_mmap_map[] = { { .size = 0 } }; -static int bw2_mmap(struct fb_info *info, struct vm_area_struct *vma) +static int bw2_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma) { struct bw2_par *par = (struct bw2_par *)info->par; @@ -171,7 +164,7 @@ static int bw2_mmap(struct fb_info *info, struct vm_area_struct *vma) vma); } -static int bw2_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) +static int bw2_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) { return sbusfb_ioctl_helper(cmd, arg, info, FBTYPE_SUN2BW, 1, info->fix.smem_len); diff --git a/drivers/video/fbdev/cg14.c b/drivers/video/fbdev/cg14.c index c0336c051c..c161b2af89 100644 --- a/drivers/video/fbdev/cg14.c +++ b/drivers/video/fbdev/cg14.c @@ -31,27 +31,20 @@ static int cg14_setcolreg(unsigned, unsigned, unsigned, unsigned, unsigned, struct fb_info *); - -static int cg14_mmap(struct fb_info *, struct vm_area_struct *); -static int cg14_ioctl(struct fb_info *, unsigned int, unsigned long); static int cg14_pan_display(struct fb_var_screeninfo *, struct fb_info *); +static int cg14_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma); +static int cg14_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg); + /* * Frame buffer operations */ static const struct fb_ops cg14_ops = { .owner = THIS_MODULE, + FB_DEFAULT_SBUS_OPS(cg14), .fb_setcolreg = cg14_setcolreg, .fb_pan_display = cg14_pan_display, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_mmap = cg14_mmap, - .fb_ioctl = cg14_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif }; #define CG14_MCR_INTENABLE_SHIFT 7 @@ -265,7 +258,7 @@ static int cg14_setcolreg(unsigned regno, return 0; } -static int cg14_mmap(struct fb_info *info, struct vm_area_struct *vma) +static int cg14_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma) { struct cg14_par *par = (struct cg14_par *) info->par; @@ -274,7 +267,7 @@ static int cg14_mmap(struct fb_info *info, struct vm_area_struct *vma) par->iospace, vma); } -static int cg14_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) +static int cg14_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) { struct cg14_par *par = (struct cg14_par *) info->par; struct cg14_regs __iomem *regs = par->regs; diff --git a/drivers/video/fbdev/cg3.c b/drivers/video/fbdev/cg3.c index 0a897d5be3..5e1f1b9a81 100644 --- a/drivers/video/fbdev/cg3.c +++ b/drivers/video/fbdev/cg3.c @@ -33,8 +33,8 @@ static int cg3_setcolreg(unsigned, unsigned, unsigned, unsigned, unsigned, struct fb_info *); static int cg3_blank(int, struct fb_info *); -static int cg3_mmap(struct fb_info *, struct vm_area_struct *); -static int cg3_ioctl(struct fb_info *, unsigned int, unsigned long); +static int cg3_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma); +static int cg3_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg); /* * Frame buffer operations @@ -42,16 +42,9 @@ static int cg3_ioctl(struct fb_info *, unsigned int, unsigned long); static const struct fb_ops cg3_ops = { .owner = THIS_MODULE, + FB_DEFAULT_SBUS_OPS(cg3), .fb_setcolreg = cg3_setcolreg, .fb_blank = cg3_blank, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, - .fb_mmap = cg3_mmap, - .fb_ioctl = cg3_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif }; @@ -225,7 +218,7 @@ static struct sbus_mmap_map cg3_mmap_map[] = { { .size = 0 } }; -static int cg3_mmap(struct fb_info *info, struct vm_area_struct *vma) +static int cg3_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma) { struct cg3_par *par = (struct cg3_par *)info->par; @@ -235,7 +228,7 @@ static int cg3_mmap(struct fb_info *info, struct vm_area_struct *vma) vma); } -static int cg3_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) +static int cg3_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) { return sbusfb_ioctl_helper(cmd, arg, info, FBTYPE_SUN3COLOR, 8, info->fix.smem_len); diff --git a/drivers/video/fbdev/cg6.c b/drivers/video/fbdev/cg6.c index 8ef6ac9132..69d3ce5094 100644 --- a/drivers/video/fbdev/cg6.c +++ b/drivers/video/fbdev/cg6.c @@ -37,16 +37,18 @@ static void cg6_imageblit(struct fb_info *, const struct fb_image *); static void cg6_fillrect(struct fb_info *, const struct fb_fillrect *); static void cg6_copyarea(struct fb_info *info, const struct fb_copyarea *area); static int cg6_sync(struct fb_info *); -static int cg6_mmap(struct fb_info *, struct vm_area_struct *); -static int cg6_ioctl(struct fb_info *, unsigned int, unsigned long); static int cg6_pan_display(struct fb_var_screeninfo *, struct fb_info *); +static int cg6_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma); +static int cg6_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg); + /* * Frame buffer operations */ static const struct fb_ops cg6_ops = { .owner = THIS_MODULE, + __FB_DEFAULT_SBUS_OPS_RDWR(cg6), .fb_setcolreg = cg6_setcolreg, .fb_blank = cg6_blank, .fb_pan_display = cg6_pan_display, @@ -54,11 +56,8 @@ static const struct fb_ops cg6_ops = { .fb_copyarea = cg6_copyarea, .fb_imageblit = cg6_imageblit, .fb_sync = cg6_sync, - .fb_mmap = cg6_mmap, - .fb_ioctl = cg6_ioctl, -#ifdef CONFIG_COMPAT - .fb_compat_ioctl = sbusfb_compat_ioctl, -#endif + __FB_DEFAULT_SBUS_OPS_IOCTL(cg6), + __FB_DEFAULT_SBUS_OPS_MMAP(cg6), }; /* Offset of interesting structures in the OBIO space */ @@ -590,7 +589,7 @@ static struct sbus_mmap_map cg6_mmap_map[] = { { .size = 0 } }; -static int cg6_mmap(struct fb_info *info, struct vm_area_struct *vma) +static int cg6_sbusfb_mmap(struct fb_info *info, struct vm_area_struct *vma) { struct cg6_par *par = (struct cg6_par *)info->par; @@ -599,7 +598,7 @@ static int cg6_mmap(struct fb_info *info, struct vm_area_struct *vma) par->which_io, vma); } -static int cg6_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) +static int cg6_sbusfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) { return sbusfb_ioctl_helper(cmd, arg, info, FBTYPE_SUNFAST_COLOR, 8, info->fix.smem_len); diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c index 9d369b6a4d..e29217e476 100644 --- a/drivers/video/fbdev/cirrusfb.c +++ b/drivers/video/fbdev/cirrusfb.c @@ -1961,6 +1961,7 @@ static const struct fb_ops cirrusfb_ops = { .owner = THIS_MODULE, .fb_open = cirrusfb_open, .fb_release = cirrusfb_release, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_setcolreg = cirrusfb_setcolreg, .fb_check_var = cirrusfb_check_var, .fb_set_par = cirrusfb_set_par, @@ -1970,6 +1971,7 @@ static const struct fb_ops cirrusfb_ops = { .fb_copyarea = cirrusfb_copyarea, .fb_sync = cirrusfb_sync, .fb_imageblit = cirrusfb_imageblit, + __FB_DEFAULT_IOMEM_OPS_MMAP, }; static int cirrusfb_set_fbinfo(struct fb_info *info) diff --git a/drivers/video/fbdev/cobalt_lcdfb.c b/drivers/video/fbdev/cobalt_lcdfb.c index b94e7c9726..c2b8f89479 100644 --- a/drivers/video/fbdev/cobalt_lcdfb.c +++ b/drivers/video/fbdev/cobalt_lcdfb.c @@ -280,7 +280,9 @@ static const struct fb_ops cobalt_lcd_fbops = { .fb_read = cobalt_lcdfb_read, .fb_write = cobalt_lcdfb_write, .fb_blank = cobalt_lcdfb_blank, + __FB_DEFAULT_IOMEM_OPS_DRAW, .fb_cursor = cobalt_lcdfb_cursor, + __FB_DEFAULT_IOMEM_OPS_MMAP, }; static int cobalt_lcdfb_probe(struct platform_device *dev) diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index 717134c141..5c5284e8ae 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -755,15 +755,14 @@ static int controlfb_mmap(struct fb_info *info, static const struct fb_ops controlfb_ops = { .owner = THIS_MODULE, + __FB_DEFAULT_IOMEM_OPS_RDWR, .fb_check_var = controlfb_check_var, .fb_set_par = controlfb_set_par, .fb_setcolreg = controlfb_setcolreg, .fb_pan_display = controlfb_pan_display, .fb_blank = controlfb_blank, + __FB_DEFAULT_IOMEM_OPS_DRAW, .fb_mmap = controlfb_mmap, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, }; /* diff --git a/drivers/video/fbdev/core/Kconfig b/drivers/video/fbdev/core/Kconfig index 5ac1b06375..7a3ed13bed 100644 --- a/drivers/video/fbdev/core/Kconfig +++ b/drivers/video/fbdev/core/Kconfig @@ -4,6 +4,7 @@ # config FB_CORE + select FB_IOMEM_FOPS select VIDEO_CMDLINE tristate @@ -144,12 +145,23 @@ config FB_DMAMEM_HELPERS select FB_SYS_FOPS select FB_SYS_IMAGEBLIT +config FB_IOMEM_FOPS + tristate + depends on FB_CORE + config FB_IOMEM_HELPERS bool depends on FB_CORE select FB_CFB_COPYAREA select FB_CFB_FILLRECT select FB_CFB_IMAGEBLIT + select FB_IOMEM_FOPS + +config FB_IOMEM_HELPERS_DEFERRED + bool + depends on FB_CORE + select FB_DEFERRED_IO + select FB_IOMEM_HELPERS config FB_SYSMEM_HELPERS bool diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile index edfde2948e..c1d657601b 100644 --- a/drivers/video/fbdev/core/Makefile +++ b/drivers/video/fbdev/core/Makefile @@ -3,7 +3,7 @@ obj-$(CONFIG_FB_NOTIFY) += fb_notify.o obj-$(CONFIG_FB_CORE) += fb.o fb-y := fb_info.o \ fbmem.o fbcmap.o \ - modedb.o fbcvt.o fb_cmdline.o fb_io_fops.o + modedb.o fbcvt.o fb_cmdline.o ifdef CONFIG_FB fb-y += fb_backlight.o fbmon.o endif @@ -23,9 +23,12 @@ fb-y += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \ endif endif +fb-$(CONFIG_LOGO) += fb_logo.o + obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o +obj-$(CONFIG_FB_IOMEM_FOPS) += fb_io_fops.o obj-$(CONFIG_FB_SYS_FILLRECT) += sysfillrect.o obj-$(CONFIG_FB_SYS_COPYAREA) += syscopyarea.o obj-$(CONFIG_FB_SYS_IMAGEBLIT) += sysimgblt.o diff --git a/drivers/video/fbdev/core/fb_chrdev.c b/drivers/video/fbdev/core/fb_chrdev.c index eadb81f53a..32a7315b4b 100644 --- a/drivers/video/fbdev/core/fb_chrdev.c +++ b/drivers/video/fbdev/core/fb_chrdev.c @@ -365,7 +365,8 @@ static int fb_mmap(struct file *file, struct vm_area_struct *vma) mutex_unlock(&info->mm_lock); vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); - fb_pgprotect(file, vma, start); + vma->vm_page_prot = pgprot_framebuffer(vma->vm_page_prot, vma->vm_start, + vma->vm_end, start); return vm_iomap_memory(vma, start, len); } diff --git a/drivers/video/fbdev/core/fb_internal.h b/drivers/video/fbdev/core/fb_internal.h index 4c8d509a00..613832d335 100644 --- a/drivers/video/fbdev/core/fb_internal.h +++ b/drivers/video/fbdev/core/fb_internal.h @@ -20,6 +20,23 @@ static inline void fb_unregister_chrdev(void) { } #endif +/* fb_logo.c */ +#if defined(CONFIG_LOGO) +extern bool fb_center_logo; +extern int fb_logo_count; +int fb_prepare_logo(struct fb_info *fb_info, int rotate); +int fb_show_logo(struct fb_info *fb_info, int rotate); +#else +static inline int fb_prepare_logo(struct fb_info *info, int rotate) +{ + return 0; +} +static inline int fb_show_logo(struct fb_info *info, int rotate) +{ + return 0; +} +#endif /* CONFIG_LOGO */ + /* fbmem.c */ extern struct class *fb_class; extern struct mutex registration_lock; diff --git a/drivers/video/fbdev/core/fb_io_fops.c b/drivers/video/fbdev/core/fb_io_fops.c index 5985e5e1b0..871b829521 100644 --- a/drivers/video/fbdev/core/fb_io_fops.c +++ b/drivers/video/fbdev/core/fb_io_fops.c @@ -131,3 +131,6 @@ ssize_t fb_io_write(struct fb_info *info, const char __user *buf, size_t count, return (cnt) ? cnt : err; } EXPORT_SYMBOL(fb_io_write); + +MODULE_DESCRIPTION("Fbdev helpers for framebuffers in I/O memory"); +MODULE_LICENSE("GPL"); diff --git a/drivers/video/fbdev/core/fb_logo.c b/drivers/video/fbdev/core/fb_logo.c new file mode 100644 index 0000000000..0bab8352b6 --- /dev/null +++ b/drivers/video/fbdev/core/fb_logo.c @@ -0,0 +1,508 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include + +#include "fb_internal.h" + +bool fb_center_logo __read_mostly; +int fb_logo_count __read_mostly = -1; + +static inline unsigned int safe_shift(unsigned int d, int n) +{ + return n < 0 ? d >> -n : d << n; +} + +static void fb_set_logocmap(struct fb_info *info, + const struct linux_logo *logo) +{ + struct fb_cmap palette_cmap; + u16 palette_green[16]; + u16 palette_blue[16]; + u16 palette_red[16]; + int i, j, n; + const unsigned char *clut = logo->clut; + + palette_cmap.start = 0; + palette_cmap.len = 16; + palette_cmap.red = palette_red; + palette_cmap.green = palette_green; + palette_cmap.blue = palette_blue; + palette_cmap.transp = NULL; + + for (i = 0; i < logo->clutsize; i += n) { + n = logo->clutsize - i; + /* palette_cmap provides space for only 16 colors at once */ + if (n > 16) + n = 16; + palette_cmap.start = 32 + i; + palette_cmap.len = n; + for (j = 0; j < n; ++j) { + palette_cmap.red[j] = clut[0] << 8 | clut[0]; + palette_cmap.green[j] = clut[1] << 8 | clut[1]; + palette_cmap.blue[j] = clut[2] << 8 | clut[2]; + clut += 3; + } + fb_set_cmap(&palette_cmap, info); + } +} + +static void fb_set_logo_truepalette(struct fb_info *info, + const struct linux_logo *logo, + u32 *palette) +{ + static const unsigned char mask[] = { + 0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff + }; + unsigned char redmask, greenmask, bluemask; + int redshift, greenshift, blueshift; + int i; + const unsigned char *clut = logo->clut; + + /* + * We have to create a temporary palette since console palette is only + * 16 colors long. + */ + /* Bug: Doesn't obey msb_right ... (who needs that?) */ + redmask = mask[info->var.red.length < 8 ? info->var.red.length : 8]; + greenmask = mask[info->var.green.length < 8 ? info->var.green.length : 8]; + bluemask = mask[info->var.blue.length < 8 ? info->var.blue.length : 8]; + redshift = info->var.red.offset - (8 - info->var.red.length); + greenshift = info->var.green.offset - (8 - info->var.green.length); + blueshift = info->var.blue.offset - (8 - info->var.blue.length); + + for (i = 0; i < logo->clutsize; i++) { + palette[i+32] = (safe_shift((clut[0] & redmask), redshift) | + safe_shift((clut[1] & greenmask), greenshift) | + safe_shift((clut[2] & bluemask), blueshift)); + clut += 3; + } +} + +static void fb_set_logo_directpalette(struct fb_info *info, + const struct linux_logo *logo, + u32 *palette) +{ + int redshift, greenshift, blueshift; + int i; + + redshift = info->var.red.offset; + greenshift = info->var.green.offset; + blueshift = info->var.blue.offset; + + for (i = 32; i < 32 + logo->clutsize; i++) + palette[i] = i << redshift | i << greenshift | i << blueshift; +} + +static void fb_set_logo(struct fb_info *info, + const struct linux_logo *logo, u8 *dst, + int depth) +{ + int i, j, k; + const u8 *src = logo->data; + u8 xor = (info->fix.visual == FB_VISUAL_MONO01) ? 0xff : 0; + u8 fg = 1, d; + + switch (fb_get_color_depth(&info->var, &info->fix)) { + case 1: + fg = 1; + break; + case 2: + fg = 3; + break; + default: + fg = 7; + break; + } + + if (info->fix.visual == FB_VISUAL_MONO01 || + info->fix.visual == FB_VISUAL_MONO10) + fg = ~((u8) (0xfff << info->var.green.length)); + + switch (depth) { + case 4: + for (i = 0; i < logo->height; i++) + for (j = 0; j < logo->width; src++) { + *dst++ = *src >> 4; + j++; + if (j < logo->width) { + *dst++ = *src & 0x0f; + j++; + } + } + break; + case 1: + for (i = 0; i < logo->height; i++) { + for (j = 0; j < logo->width; src++) { + d = *src ^ xor; + for (k = 7; k >= 0 && j < logo->width; k--) { + *dst++ = ((d >> k) & 1) ? fg : 0; + j++; + } + } + } + break; + } +} + +/* + * Three (3) kinds of logo maps exist. linux_logo_clut224 (>16 colors), + * linux_logo_vga16 (16 colors) and linux_logo_mono (2 colors). Depending on + * the visual format and color depth of the framebuffer, the DAC, the + * pseudo_palette, and the logo data will be adjusted accordingly. + * + * Case 1 - linux_logo_clut224: + * Color exceeds the number of console colors (16), thus we set the hardware DAC + * using fb_set_cmap() appropriately. The "needs_cmapreset" flag will be set. + * + * For visuals that require color info from the pseudo_palette, we also construct + * one for temporary use. The "needs_directpalette" or "needs_truepalette" flags + * will be set. + * + * Case 2 - linux_logo_vga16: + * The number of colors just matches the console colors, thus there is no need + * to set the DAC or the pseudo_palette. However, the bitmap is packed, ie, + * each byte contains color information for two pixels (upper and lower nibble). + * To be consistent with fb_imageblit() usage, we therefore separate the two + * nibbles into separate bytes. The "depth" flag will be set to 4. + * + * Case 3 - linux_logo_mono: + * This is similar with Case 2. Each byte contains information for 8 pixels. + * We isolate each bit and expand each into a byte. The "depth" flag will + * be set to 1. + */ +static struct logo_data { + int depth; + int needs_directpalette; + int needs_truepalette; + int needs_cmapreset; + const struct linux_logo *logo; +} fb_logo __read_mostly; + +static void fb_rotate_logo_ud(const u8 *in, u8 *out, u32 width, u32 height) +{ + u32 size = width * height, i; + + out += size - 1; + + for (i = size; i--; ) + *out-- = *in++; +} + +static void fb_rotate_logo_cw(const u8 *in, u8 *out, u32 width, u32 height) +{ + int i, j, h = height - 1; + + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) + out[height * j + h - i] = *in++; +} + +static void fb_rotate_logo_ccw(const u8 *in, u8 *out, u32 width, u32 height) +{ + int i, j, w = width - 1; + + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) + out[height * (w - j) + i] = *in++; +} + +static void fb_rotate_logo(struct fb_info *info, u8 *dst, + struct fb_image *image, int rotate) +{ + u32 tmp; + + if (rotate == FB_ROTATE_UD) { + fb_rotate_logo_ud(image->data, dst, image->width, + image->height); + image->dx = info->var.xres - image->width - image->dx; + image->dy = info->var.yres - image->height - image->dy; + } else if (rotate == FB_ROTATE_CW) { + fb_rotate_logo_cw(image->data, dst, image->width, + image->height); + swap(image->width, image->height); + tmp = image->dy; + image->dy = image->dx; + image->dx = info->var.xres - image->width - tmp; + } else if (rotate == FB_ROTATE_CCW) { + fb_rotate_logo_ccw(image->data, dst, image->width, + image->height); + swap(image->width, image->height); + tmp = image->dx; + image->dx = image->dy; + image->dy = info->var.yres - image->height - tmp; + } + + image->data = dst; +} + +static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, + int rotate, unsigned int num) +{ + unsigned int x; + + if (image->width > info->var.xres || image->height > info->var.yres) + return; + + if (rotate == FB_ROTATE_UR) { + for (x = 0; + x < num && image->dx + image->width <= info->var.xres; + x++) { + info->fbops->fb_imageblit(info, image); + image->dx += image->width + 8; + } + } else if (rotate == FB_ROTATE_UD) { + u32 dx = image->dx; + + for (x = 0; x < num && image->dx <= dx; x++) { + info->fbops->fb_imageblit(info, image); + image->dx -= image->width + 8; + } + } else if (rotate == FB_ROTATE_CW) { + for (x = 0; + x < num && image->dy + image->height <= info->var.yres; + x++) { + info->fbops->fb_imageblit(info, image); + image->dy += image->height + 8; + } + } else if (rotate == FB_ROTATE_CCW) { + u32 dy = image->dy; + + for (x = 0; x < num && image->dy <= dy; x++) { + info->fbops->fb_imageblit(info, image); + image->dy -= image->height + 8; + } + } +} + +static int fb_show_logo_line(struct fb_info *info, int rotate, + const struct linux_logo *logo, int y, + unsigned int n) +{ + u32 *palette = NULL, *saved_pseudo_palette = NULL; + unsigned char *logo_new = NULL, *logo_rotate = NULL; + struct fb_image image; + + /* Return if the frame buffer is not mapped or suspended */ + if (logo == NULL || info->state != FBINFO_STATE_RUNNING || + info->fbops->owner) + return 0; + + image.depth = 8; + image.data = logo->data; + + if (fb_logo.needs_cmapreset) + fb_set_logocmap(info, logo); + + if (fb_logo.needs_truepalette || + fb_logo.needs_directpalette) { + palette = kmalloc(256 * 4, GFP_KERNEL); + if (palette == NULL) + return 0; + + if (fb_logo.needs_truepalette) + fb_set_logo_truepalette(info, logo, palette); + else + fb_set_logo_directpalette(info, logo, palette); + + saved_pseudo_palette = info->pseudo_palette; + info->pseudo_palette = palette; + } + + if (fb_logo.depth <= 4) { + logo_new = kmalloc_array(logo->width, logo->height, + GFP_KERNEL); + if (logo_new == NULL) { + kfree(palette); + if (saved_pseudo_palette) + info->pseudo_palette = saved_pseudo_palette; + return 0; + } + image.data = logo_new; + fb_set_logo(info, logo, logo_new, fb_logo.depth); + } + + if (fb_center_logo) { + int xres = info->var.xres; + int yres = info->var.yres; + + if (rotate == FB_ROTATE_CW || rotate == FB_ROTATE_CCW) { + xres = info->var.yres; + yres = info->var.xres; + } + + while (n && (n * (logo->width + 8) - 8 > xres)) + --n; + image.dx = (xres - (n * (logo->width + 8) - 8)) / 2; + image.dy = y ?: (yres - logo->height) / 2; + } else { + image.dx = 0; + image.dy = y; + } + + image.width = logo->width; + image.height = logo->height; + + if (rotate) { + logo_rotate = kmalloc_array(logo->width, logo->height, + GFP_KERNEL); + if (logo_rotate) + fb_rotate_logo(info, logo_rotate, &image, rotate); + } + + fb_do_show_logo(info, &image, rotate, n); + + kfree(palette); + if (saved_pseudo_palette != NULL) + info->pseudo_palette = saved_pseudo_palette; + kfree(logo_new); + kfree(logo_rotate); + return image.dy + logo->height; +} + +#ifdef CONFIG_FB_LOGO_EXTRA + +#define FB_LOGO_EX_NUM_MAX 10 +static struct logo_data_extra { + const struct linux_logo *logo; + unsigned int n; +} fb_logo_ex[FB_LOGO_EX_NUM_MAX]; +static unsigned int fb_logo_ex_num; + +void fb_append_extra_logo(const struct linux_logo *logo, unsigned int n) +{ + if (!n || fb_logo_ex_num == FB_LOGO_EX_NUM_MAX) + return; + + fb_logo_ex[fb_logo_ex_num].logo = logo; + fb_logo_ex[fb_logo_ex_num].n = n; + fb_logo_ex_num++; +} + +static int fb_prepare_extra_logos(struct fb_info *info, unsigned int height, + unsigned int yres) +{ + unsigned int i; + + /* FIXME: logo_ex supports only truecolor fb. */ + if (info->fix.visual != FB_VISUAL_TRUECOLOR) + fb_logo_ex_num = 0; + + for (i = 0; i < fb_logo_ex_num; i++) { + if (fb_logo_ex[i].logo->type != fb_logo.logo->type) { + fb_logo_ex[i].logo = NULL; + continue; + } + height += fb_logo_ex[i].logo->height; + if (height > yres) { + height -= fb_logo_ex[i].logo->height; + fb_logo_ex_num = i; + break; + } + } + return height; +} + +static int fb_show_extra_logos(struct fb_info *info, int y, int rotate) +{ + unsigned int i; + + for (i = 0; i < fb_logo_ex_num; i++) + y = fb_show_logo_line(info, rotate, + fb_logo_ex[i].logo, y, fb_logo_ex[i].n); + + return y; +} +#endif /* CONFIG_FB_LOGO_EXTRA */ + +int fb_prepare_logo(struct fb_info *info, int rotate) +{ + int depth = fb_get_color_depth(&info->var, &info->fix); + unsigned int yres; + int height; + + memset(&fb_logo, 0, sizeof(struct logo_data)); + + if (info->flags & FBINFO_MISC_TILEBLITTING || + info->fbops->owner || !fb_logo_count) + return 0; + + if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) { + depth = info->var.blue.length; + if (info->var.red.length < depth) + depth = info->var.red.length; + if (info->var.green.length < depth) + depth = info->var.green.length; + } + + if (info->fix.visual == FB_VISUAL_STATIC_PSEUDOCOLOR && depth > 4) { + /* assume console colormap */ + depth = 4; + } + + /* Return if no suitable logo was found */ + fb_logo.logo = fb_find_logo(depth); + + if (!fb_logo.logo) + return 0; + + if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD) + yres = info->var.yres; + else + yres = info->var.xres; + + if (fb_logo.logo->height > yres) { + fb_logo.logo = NULL; + return 0; + } + + /* What depth we asked for might be different from what we get */ + if (fb_logo.logo->type == LINUX_LOGO_CLUT224) + fb_logo.depth = 8; + else if (fb_logo.logo->type == LINUX_LOGO_VGA16) + fb_logo.depth = 4; + else + fb_logo.depth = 1; + + + if (fb_logo.depth > 4 && depth > 4) { + switch (info->fix.visual) { + case FB_VISUAL_TRUECOLOR: + fb_logo.needs_truepalette = 1; + break; + case FB_VISUAL_DIRECTCOLOR: + fb_logo.needs_directpalette = 1; + fb_logo.needs_cmapreset = 1; + break; + case FB_VISUAL_PSEUDOCOLOR: + fb_logo.needs_cmapreset = 1; + break; + } + } + + height = fb_logo.logo->height; + if (fb_center_logo) + height += (yres - fb_logo.logo->height) / 2; +#ifdef CONFIG_FB_LOGO_EXTRA + height = fb_prepare_extra_logos(info, height, yres); +#endif + + return height; +} + +int fb_show_logo(struct fb_info *info, int rotate) +{ + unsigned int count; + int y; + + if (!fb_logo_count) + return 0; + + count = fb_logo_count < 0 ? num_online_cpus() : fb_logo_count; + y = fb_show_logo_line(info, rotate, fb_logo.logo, 0, count); +#ifdef CONFIG_FB_LOGO_EXTRA + y = fb_show_extra_logos(info, y, rotate); +#endif + + return y; +} diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c index f157a5a1df..63af6ab034 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -472,6 +472,7 @@ static int __init fb_console_setup(char *this_opt) } #endif +#ifdef CONFIG_LOGO if (!strncmp(options, "logo-pos:", 9)) { options += 9; if (!strcmp(options, "center")) @@ -485,6 +486,7 @@ static int __init fb_console_setup(char *this_opt) fb_logo_count = simple_strtol(options, &options, 0); continue; } +#endif } return 1; } diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index ee44a46a66..fc206755f5 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -11,30 +11,12 @@ * for more details. */ -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include +#include #include #include -#include -#include #include