video: fbdev: atari: Miscellaneous fixes and cleanups
Subsystems (2)
PATCH 3/10 video: fbdev: atari: Fix inverse handling
In reply to Geert UytterhoevenCurrently, the "inverse" option does not do anything, as it just sets a flag, which is further unused.
Fix this by calling fb_invert_cmaps() instead, like other drivers do. As this only affects the console colormap, this does not affect X. Update the documentation to match the actual behavior.
--- Documentation/m68k/kernel-options.rst | 4 ++-- drivers/video/fbdev/atafb.c | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-)
Documentation/m68k/kernel-options.rst +2 -2
@@ -367,8 +367,8 @@ activated by a "external:" sub-option. 4.1.2) inverse -------------- -Invert the display. This affects both, text (consoles) and graphics -(X) display. Usually, the background is chosen to be black. With this +Invert the display. This affects only text consoles. +Usually, the background is chosen to be black. With this option, you can make the background white. 4.1.3) font
drivers/video/fbdev/atafb.c +1 -3
@@ -236,8 +236,6 @@ static int *MV300_reg = MV300_reg_8bit;#endif /* ATAFB_EXT */ -static int inverse; -/* * struct fb_ops { * * open/release and usage marking
@@ -2971,7 +2969,7 @@ static int __init atafb_setup(char *options) default_par = temp; mode_option = this_opt; }else if (!strcmp (this_opt,"inverse" )) - inverse =1 ; +fb_invert_cmaps ();else if (!strncmp (this_opt,"hwscroll_" ,9 )) { hwscroll =simple_strtoul (this_opt +9 ,NULL ,10 );if (hwscroll <0 )
Signature · 1 line
2.25.1
cover video: fbdev: atari: Miscellaneous fixes and cleanups
Hi all,
This patch series contains miscellaneous fixes and cleanups for the Atari frame buffer device driver, which were identified while working on the Atari DRM driver.
Most of them have been tested on ARAnyM, and should be safe to apply, except perhaps for the last one, which is marked RFC.
Thanks for your comments!
Geert Uytterhoeven (10):
video: fbdev: atari: Simplify atafb_pan_display()
video: fbdev: atari: Remove bogus FB_VMODE_YWRAP flags
video: fbdev: atari: Fix inverse handling
video: fbdev: atari: Fix ext_setcolreg()
video: fbdev: atari: Remove unneeded casts from void *
video: fbdev: atari: Remove unneeded casts to void *
video: fbdev: atari: Fix TT High video mode vertical refresh
video: fbdev: atari: Fix VGA modes
video: fbdev: atari: Remove unused definitions and variables [RFC] video: fbdev: atari: Remove backward bug-compatibility
Documentation/m68k/kernel-options.rst | 4 +- drivers/video/fbdev/atafb.c | 101 +++++++------------------- 2 files changed, 29 insertions(+), 76 deletions(-)
Signature · 12 lines
2.25.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsPATCH 2/10 video: fbdev: atari: Remove bogus FB_VMODE_YWRAP flags
Vertical wrap is not supported (fb_fix_screeninfo.ywrapstep = 0), hence there is no point in setting the FB_VMODE_YWRAP flag in video modes.
--- drivers/video/fbdev/atafb.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/video/fbdev/atafb.c +9 -9
@@ -467,27 +467,27 @@ static struct fb_videomode atafb_modedb[] __initdata = { {/* 320x200, 15 kHz, 60 Hz (ST low) */ "st-low" ,60 ,320 ,200 ,32000 ,32 ,16 ,31 ,14 ,96 ,4 , -0 ,FB_VMODE_NONINTERLACED |FB_VMODE_YWRAP +0 ,FB_VMODE_NONINTERLACED }, {/* 640x200, 15 kHz, 60 Hz (ST medium) */ "st-mid" ,60 ,640 ,200 ,32000 ,32 ,16 ,31 ,14 ,96 ,4 , -0 ,FB_VMODE_NONINTERLACED |FB_VMODE_YWRAP +0 ,FB_VMODE_NONINTERLACED }, {/* 640x400, 30.25 kHz, 63.5 Hz (ST high) */ "st-high" ,63 ,640 ,400 ,32000 ,128 ,0 ,40 ,14 ,128 ,4 , -0 ,FB_VMODE_NONINTERLACED |FB_VMODE_YWRAP +0 ,FB_VMODE_NONINTERLACED }, {/* 320x480, 15 kHz, 60 Hz (TT low) */ "tt-low" ,60 ,320 ,480 ,31041 ,120 ,100 ,8 ,16 ,140 ,30 , -0 ,FB_VMODE_NONINTERLACED |FB_VMODE_YWRAP +0 ,FB_VMODE_NONINTERLACED }, {/* 640x480, 29 kHz, 57 Hz (TT medium) */ "tt-mid" ,60 ,640 ,480 ,31041 ,120 ,100 ,8 ,16 ,140 ,30 , -0 ,FB_VMODE_NONINTERLACED |FB_VMODE_YWRAP +0 ,FB_VMODE_NONINTERLACED }, {/* 1280x960, 72 kHz, 72 Hz (TT high) */ "tt-high" ,57 ,1280 ,960 ,7760 ,260 ,60 ,36 ,4 ,192 ,4 , -0 ,FB_VMODE_NONINTERLACED |FB_VMODE_YWRAP +0 ,FB_VMODE_NONINTERLACED },/*
@@ -497,11 +497,11 @@ static struct fb_videomode atafb_modedb[] __initdata = { {/* 640x480, 31 kHz, 60 Hz (VGA) */ "vga" ,63.5 ,640 ,480 ,32000 ,18 ,42 ,31 ,11 ,96 ,3 , -0 ,FB_VMODE_NONINTERLACED |FB_VMODE_YWRAP +0 ,FB_VMODE_NONINTERLACED }, {/* 640x400, 31 kHz, 70 Hz (VGA) */ "vga70" ,70 ,640 ,400 ,32000 ,18 ,42 ,31 ,11 ,96 ,3 , -FB_SYNC_VERT_HIGH_ACT |FB_SYNC_COMP_HIGH_ACT ,FB_VMODE_NONINTERLACED |FB_VMODE_YWRAP +FB_SYNC_VERT_HIGH_ACT |FB_SYNC_COMP_HIGH_ACT ,FB_VMODE_NONINTERLACED },/*
@@ -511,7 +511,7 @@ static struct fb_videomode atafb_modedb[] __initdata = { {/* 896x608, 31 kHz, 60 Hz (Falcon High) */ "falh" ,60 ,896 ,608 ,32000 ,18 ,42 ,31 ,1 ,96 ,3 , -0 ,FB_VMODE_NONINTERLACED |FB_VMODE_YWRAP +0 ,FB_VMODE_NONINTERLACED }, };
Signature · 1 line
2.25.1
PATCH 1/10 video: fbdev: atari: Simplify atafb_pan_display()
In reply to Geert UytterhoevenThe fb_pan_display() function in the core already takes care of validating the panning parameters before calling the driver's .fb_pan_display() callback, and of updating the panning state afterwards, so there is no need to repeat that in the driver.
Remove the duplicate code.
--- drivers/video/fbdev/atafb.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-)
drivers/video/fbdev/atafb.c +2 -27
@@ -2407,35 +2407,10 @@ static void atafb_set_disp(struct fb_info *info)static int atafb_pan_display (struct fb_var_screeninfo *var,struct fb_info *info) { -int xoffset = var->xoffset; -int yoffset = var->yoffset; -int err; - -if (var->vmode &FB_VMODE_YWRAP ) { -if (yoffset <0 || yoffset >= info->var.yres_virtual || xoffset) -return -EINVAL ; - }else { -if (xoffset + info->var.xres > info->var.xres_virtual || - yoffset + info->var.yres > info->var.yres_virtual) -return -EINVAL ; - } - -if (fbhw->pan_display) { - err = fbhw->pan_display (var, info); -if (err) -return err; - }else +if (!fbhw->pan_display)return -EINVAL ; - info->var.xoffset = xoffset; - info->var.yoffset = yoffset; - -if (var->vmode &FB_VMODE_YWRAP ) - info->var.vmode |=FB_VMODE_YWRAP ; -else - info->var.vmode &= ~FB_VMODE_YWRAP ; - -return 0 ; +return fbhw->pan_display (var, info); }/*
Signature · 1 line
2.25.1
PATCH 4/10 video: fbdev: atari: Fix ext_setcolreg()
In reply to Geert UytterhoevenThe red, green, and blue color values are 16-bit, while the external graphics hardware registers are 8-bit.
Add the missing conversion from 16-bit to 8-bit.
---
Untested due to lack of hardware.
--- drivers/video/fbdev/atafb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/video/fbdev/atafb.c +4 -0
@@ -2206,6 +2206,10 @@ static int ext_setcolreg(unsigned int regno, unsigned int red,if (regno >255 )return 1 ; + red >>=8 ; + green >>=8 ; + blue >>=8 ; +switch (external_card_type) {case IS_VGA :OUTB (0x3c8 , regno);
Signature · 1 line
2.25.1
PATCH 5/10 video: fbdev: atari: Remove unneeded casts from void *
In reply to Geert UytterhoevenThere is no need to cast fb_info.par to "struct atafb_par *", as the former has type "void *".
Remove the casts, as they make it impossible to validate types.
--- drivers/video/fbdev/atafb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/video/fbdev/atafb.c +6 -6
@@ -1639,7 +1639,7 @@ static irqreturn_t falcon_vbl_switcher(int irq, void *dummy)static int falcon_pan_display (struct fb_var_screeninfo *var,struct fb_info *info) { -struct atafb_par *par = (struct atafb_par *)info->par; +struct atafb_par *par = info->par;int xoffset;int bpp = info->var.bits_per_pixel;
@@ -2263,7 +2263,7 @@ static void set_screen_base(void *s_base)static int pan_display (struct fb_var_screeninfo *var,struct fb_info *info) { -struct atafb_par *par = (struct atafb_par *)info->par; +struct atafb_par *par = info->par;if (!fbhw->set_screen_base || (!ATARIHW_PRESENT (EXTD_SHIFTER ) && var->xoffset))
@@ -2432,7 +2432,7 @@ atafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)static void atafb_fillrect (struct fb_info *info,const struct fb_fillrect *rect) { -struct atafb_par *par = (struct atafb_par *)info->par; +struct atafb_par *par = info->par;int x2, y2;u32 width, height;
@@ -2475,7 +2475,7 @@ static void atafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)static void atafb_copyarea (struct fb_info *info,const struct fb_copyarea *area) { -struct atafb_par *par = (struct atafb_par *)info->par; +struct atafb_par *par = info->par;int x2, y2;u32 dx, dy, sx, sy, width, height;int rev_copy =0 ;
@@ -2529,7 +2529,7 @@ static void atafb_copyarea(struct fb_info *info, const struct fb_copyarea *area)static void atafb_imageblit (struct fb_info *info,const struct fb_image *image) { -struct atafb_par *par = (struct atafb_par *)info->par; +struct atafb_par *par = info->par;int x2, y2;unsigned long *dst;int dst_idx;
@@ -2672,7 +2672,7 @@ static int atafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)* hw par just decoded */ static int atafb_set_par (struct fb_info *info) { -struct atafb_par *par = (struct atafb_par *)info->par; +struct atafb_par *par = info->par;/* Decode wanted screen parameters */ fbhw->decode_var (&info->var, par);
Signature · 1 line
2.25.1
RFC PATCH 10/10 video: fbdev: atari: Remove backward bug-compatibility
In reply to Geert UytterhoevenAs of v2.1.0, falcon_decode_var() contains a quirk to fix a rounding error, as explained by Günther Kelleter on Fri, 30 Aug 1996:
This diff removes the now obsolete Falcon video option "pwrsave", and fixes a rounding error that is triggered by the resolution switching X server (those who use the pixel clock value 39722 in their /etc/fb.modes should change it to 39721).
However, this causes the modified video mode returned by falcon_decode_var() to not match the video mode returned by falcon_encode_var(). Fix this by dropping the quirk.
Unfortunately /etc/fb.modes in fbset was never updated, so the "640x480-60" mode still contains the wrong pixclock. Hence this change may introduce a regression.
---
Any comments?
--- drivers/video/fbdev/atafb.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/video/fbdev/atafb.c +0 -4
@@ -1008,10 +1008,6 @@ static int falcon_decode_var(struct fb_var_screeninfo *var,else if (yres_virtual < yres) yres_virtual = yres; -/* backward bug-compatibility */ -if (var->pixclock >1 ) - var->pixclock -=1 ; - par->hw.falcon.line_width = bpp * xres /16 ; par->hw.falcon.line_offset = bpp * (xres_virtual - xres) /16 ;
Signature · 1 line
2.25.1
PATCH 7/10 video: fbdev: atari: Fix TT High video mode vertical refresh
In reply to Geert UytterhoevenThe vertical refresh rate for the TT High video mode (1280x960) is wrong. Fortunately this field is not really used.
--- drivers/video/fbdev/atafb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/atafb.c +1 -1
@@ -484,7 +484,7 @@ static struct fb_videomode atafb_modedb[] __initdata = {0 ,FB_VMODE_NONINTERLACED }, {/* 1280x960, 72 kHz, 72 Hz (TT high) */ -"tt-high" ,57 ,1280 ,960 ,7760 ,260 ,60 ,36 ,4 ,192 ,4 , +"tt-high" ,72 ,1280 ,960 ,7760 ,260 ,60 ,36 ,4 ,192 ,4 ,0 ,FB_VMODE_NONINTERLACED },
Signature · 1 line
2.25.1
PATCH 6/10 video: fbdev: atari: Remove unneeded casts to void *
In reply to Geert UytterhoevenArbitrary pointers can be passed to functions accepting "void *" without casting.
Remove the casts, as they make it impossible to validate types.
--- drivers/video/fbdev/atafb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/atafb.c +2 -2
@@ -2599,14 +2599,14 @@ atafb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)switch (cmd) {#ifdef FBCMD_GET_CURRENTPAR case FBCMD_GET_CURRENTPAR : -if (copy_to_user ((void *)arg, (void *)¤t_par, +if (copy_to_user ((void *)arg, ¤t_par,sizeof (struct atafb_par )))return -EFAULT ;return 0 ;#endif #ifdef FBCMD_SET_CURRENTPAR case FBCMD_SET_CURRENTPAR : -if (copy_from_user ((void *)¤t_par, (void *)arg, +if (copy_from_user (¤t_par, (void *)arg,sizeof (struct atafb_par )))return -EFAULT ;ata_set_par (¤t_par);
Signature · 1 line
2.25.1
PATCH 8/10 video: fbdev: atari: Fix VGA modes
In reply to Geert UytterhoevenThe pixclock values in the vga and vga70 modes are wrong, as they should use the 25.175 MHz clock instead of the 32 MHz clock.
Swap the left and right margins to match f25.{right,left} (struct pixel_clock declares them in a different order), and update the hsync lengths to match what the driver programs by default. Correct the (wrong) floating-point vrefresh value for the vga mode.
--- drivers/video/fbdev/atafb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/atafb.c +2 -2
@@ -494,11 +494,11 @@ static struct fb_videomode atafb_modedb[] __initdata = { {/* 640x480, 31 kHz, 60 Hz (VGA) */ -"vga" ,63.5 ,640 ,480 ,32000 ,18 ,42 ,31 ,11 ,96 ,3 , +"vga" ,60 ,640 ,480 ,39721 ,42 ,18 ,31 ,11 ,100 ,3 ,0 ,FB_VMODE_NONINTERLACED }, {/* 640x400, 31 kHz, 70 Hz (VGA) */ -"vga70" ,70 ,640 ,400 ,32000 ,18 ,42 ,31 ,11 ,96 ,3 , +"vga70" ,70 ,640 ,400 ,39721 ,42 ,18 ,31 ,11 ,100 ,3 ,FB_SYNC_VERT_HIGH_ACT |FB_SYNC_COMP_HIGH_ACT ,FB_VMODE_NONINTERLACED },
Signature · 1 line
2.25.1
PATCH 9/10 video: fbdev: atari: Remove unused definitions and variables
In reply to Geert UytterhoevenSeveral definitions and variables are unused.
Some variables are set but further unused.
Remove them.
--- drivers/video/fbdev/atafb.c | 20 -------------------- 1 file changed, 20 deletions(-)
drivers/video/fbdev/atafb.c +0 -20
@@ -1070,8 +1070,6 @@ static int falcon_decode_var(struct fb_var_screeninfo *var, xstretch =2 ;/* Double pixel width only for hicolor */ /* Default values are used for vert./hor. timing if no pixelclock given. */ if (var->pixclock ==0 ) { -int linesize; -/* Choose master pixelclock depending on hor. timing */ plen =1 * xstretch; if ((plen * xres + f25.right + f25.hsync + f25.left) *
@@ -1090,7 +1088,6 @@ static int falcon_decode_var(struct fb_var_screeninfo *var, left_margin = pclock->left / plen; right_margin = pclock->right / plen; hsync_len = pclock->hsync / plen; - linesize = left_margin + xres + right_margin + hsync_len; upper_margin =31 ; lower_margin =11 ; vsync_len =3 ;
@@ -2419,17 +2416,6 @@ atafb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)* generic drawing routines; imageblit needs updating for image depth > 1 */ -#if BITS_PER_LONG ==32 -#define BYTES_PER_LONG 4 -#define SHIFT_PER_LONG 5 -#elif BITS_PER_LONG ==64 -#define BYTES_PER_LONG 8 -#define SHIFT_PER_LONG 6 -#else -#define Please update me -#endif - -static void atafb_fillrect (struct fb_info *info,const struct fb_fillrect *rect) {struct atafb_par *par = info->par;
@@ -2531,8 +2517,6 @@ static void atafb_imageblit(struct fb_info *info, const struct fb_image *image) {struct atafb_par *par = info->par;int x2, y2; -unsigned long *dst; -int dst_idx;const char *src;u32 dx, dy, width, height, pitch;
@@ -2559,10 +2543,6 @@ static void atafb_imageblit(struct fb_info *info, const struct fb_image *image)if (image->depth ==1 ) {// used for font data - dst = (unsigned long *) - ((unsigned long )info->screen_base & ~(BYTES_PER_LONG -1 )); - dst_idx = ((unsigned long )info->screen_base & (BYTES_PER_LONG -1 )) *8 ; - dst_idx += dy * par->next_line *8 + dx; src = image->data; pitch = (image->width +7 ) /8 ;while (height--) {
Signature · 1 line
2.25.1
Quoted 7 lines · Geert Uytterhoeven
Hi all,
This patch series contains miscellaneous fixes and cleanups for the Atari frame buffer device driver, which were identified while working on the Atari DRM driver.
Most of them have been tested on ARAnyM, and should be safe to apply,
I've applied patches 1-9 to fbdev for-next git tree....
Quoted 1 line
except perhaps for the last one, which is marked RFC.
... and would like to see some thoughts/feedback from others on this one ...
Thanks,
Helge
Quoted 19 lines
Thanks for your comments!
Geert Uytterhoeven (10):
video: fbdev: atari: Simplifyatafb_pan_display()
video: fbdev: atari: Remove bogusFB_VMODE_YWRAPflags
video: fbdev: atari: Fix inverse handling
video: fbdev: atari: Fixext_setcolreg()
video: fbdev: atari: Remove unneeded casts from void *
video: fbdev: atari: Remove unneeded casts to void *
video: fbdev: atari: Fix TT High video mode vertical refresh
video: fbdev: atari: Fix VGA modes
video: fbdev: atari: Remove unused definitions and variables [RFC] video: fbdev: atari: Remove backward bug-compatibilityDocumentation/m68k/kernel-options.rst | 4 +- drivers/video/fbdev/atafb.c | 101 +++++++------------------- 2 files changed, 29 insertions(+), 76 deletions(-)
Hi Geert,
somehow this series slipped into my spam folder ... only saw it now.
Am 12.07.2022 um 03:50 schrieb Geert Uytterhoeven:
Quoted 23 lines
Hi all,
This patch series contains miscellaneous fixes and cleanups for the Atari frame buffer device driver, which were identified while working on the Atari DRM driver.
Most of them have been tested on ARAnyM, and should be safe to apply, except perhaps for the last one, which is marked RFC.
Thanks for your comments!
Geert Uytterhoeven (10):
video: fbdev: atari: Simplifyatafb_pan_display()
video: fbdev: atari: Remove bogusFB_VMODE_YWRAPflags
video: fbdev: atari: Fix inverse handling
video: fbdev: atari: Fixext_setcolreg()
video: fbdev: atari: Remove unneeded casts from void *
video: fbdev: atari: Remove unneeded casts to void *
video: fbdev: atari: Fix TT High video mode vertical refresh
video: fbdev: atari: Fix VGA modes
video: fbdev: atari: Remove unused definitions and variables [RFC] video: fbdev: atari: Remove backward bug-compatibility
Quoted 4 lines
Documentation/m68k/kernel-options.rst | 4 +- drivers/video/fbdev/atafb.c | 101 +++++++------------------- 2 files changed, 29 insertions(+), 76 deletions(-)
Looks good to me. (I'll still try to test it on hardware this weekend.)
I'd suggest the last one be applied as well - if the regression can only be triggered by a X server resolution switch, I doubt it'll matter in practice.
Cheers,
Michael
Hi Geert,
Quoted 23 lines · Geert Uytterhoeven
Hi all,
This patch series contains miscellaneous fixes and cleanups for the Atari frame buffer device driver, which were identified while working on the Atari DRM driver.
Most of them have been tested on ARAnyM, and should be sa<fe to apply, except perhaps for the last one, which is marked RFC.
Thanks for your comments!
Geert Uytterhoeven (10):
video: fbdev: atari: Simplifyatafb_pan_display()
video: fbdev: atari: Remove bogusFB_VMODE_YWRAPflags
video: fbdev: atari: Fix inverse handling
video: fbdev: atari: Fixext_setcolreg()
video: fbdev: atari: Remove unneeded casts from void *
video: fbdev: atari: Remove unneeded casts to void *
video: fbdev: atari: Fix TT High video mode vertical refresh
video: fbdev: atari: Fix VGA modes
video: fbdev: atari: Remove unused definitions and variables [RFC] video: fbdev: atari: Remove backward bug-compatibility
Quoted 4 lines
Documentation/m68k/kernel-options.rst | 4 +- drivers/video/fbdev/atafb.c | 101 +++++++------------------- 2 files changed, 29 insertions(+), 76 deletions(-)
Works OK on my Falcon (except for the falh* modes, but that is not a regression - might be something I miscoded in these modes, ages ago).