m68k SuperVidel patches
Subsystems (4)
v3 cover m68k SuperVidel patches
Version 3 of Miro Kropacek's patches for Atari SuperVidel.
Patch 1 is a bugfix for the Atari mouse input device driver (miscompiled since v6.2 with use of -funsigned_char). Geert's suggestion to change the mouse interrupt function signature adopted (generates equivalent code as seen by inspection and testing on my 030 Falcon).
Patches 2-4 are fbdev hardware support patches for the SuperVidel blitter hardware. Patch 2 has been replaced by a version addressing the root cause of the missing parent device (i.e. atafb failing to use framebuffer_alloc()). Patches 3 and 4 have been updated to reflect changes introduced by patch 2.
Patch 5 is adding support to make use of the ethoc hardware also in the SuperVidel. Platform device register error handling (reported by Geert) hopefully fixed.
Cheers,
Michael
PATCH v3 1/5 m68k: Fix atari mouse movement
From: Miro Kropacek <[email protected]>
Kernels are built with -funsigned-char since version 6.2, resulting in signed mouse position deltas getting misinterpreted as unsigned.
Cast deltas passed in (unsigned) scancode buffer to correctly interpret sign.
---
Changes in v2:
- change atamouse_interrupt function signature to signed char *, drop signed casts (Geert)
--- arch/m68k/atari/atakeyb.c | 2 +- arch/m68k/include/asm/atarikb.h | 2 +- drivers/input/mouse/atarimouse.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
arch/m68k/atari/atakeyb.c +1 -1
@@ -39,7 +39,7 @@ void (*atari_MIDI_interrupt_hook) (void);/* Hook for keyboard inputdev driver */ void (*atari_input_keyboard_interrupt_hook) (unsigned char ,char );/* Hook for mouse inputdev driver */ -void (*atari_input_mouse_interrupt_hook) (char *); +void (*atari_input_mouse_interrupt_hook)(signed char *buf);EXPORT_SYMBOL (atari_input_keyboard_interrupt_hook);EXPORT_SYMBOL (atari_input_mouse_interrupt_hook);
arch/m68k/include/asm/atarikb.h +1 -1
@@ -37,7 +37,7 @@ extern void (*atari_MIDI_interrupt_hook) (void);/* Hook for keyboard inputdev driver */ extern void (*atari_input_keyboard_interrupt_hook) (unsigned char ,char );/* Hook for mouse inputdev driver */ -extern void (*atari_input_mouse_interrupt_hook) (char *); +extern void (*atari_input_mouse_interrupt_hook)(signed char *buf);int atari_keyb_init (void );
drivers/input/mouse/atarimouse.c +1 -1
@@ -60,7 +60,7 @@ extern int atari_mouse_buttons;static struct input_dev *atamouse_dev; -static void atamouse_interrupt (char *buf) +static void atamouse_interrupt (signed char *buf) {int buttons, dx, dy;
Signature · 1 line
2.17.1
PATCH v4 1/1 m68k: Fix atari mouse movement
Kernels are built with -funsigned-char since version 6.2, resulting in the signed 8-bit position deltas reported by the IKBD being misinterpreted as unsigned.
Carry the sign in the type of the mouse interrupt hook. The scancode buffer is shared with the keyboard and joystick paths, where unsigned is correct, so it stays unsigned and is cast at the single call site that passes it to the mouse driver.
---
Changes in v4:
- cast at the atakeyb.c call site, so the signed hook no longer produces a -Wpointer-sign warning there
The functional change was tested on an Atari Falcon030 with CT60 in its v3 form; v4 only adds the cast at the call site.
Note that the original version of this patch, which cast the two deltas inside atamouse_interrupt() and left the hook as char *, produced no warning at all. The signature change was your suggestion, Geert - if you prefer the earlier form, say so and I will send that instead.
arch/m68k/atari/atakeyb.c | 5 +++-- arch/m68k/include/asm/atarikb.h | 2 +- drivers/input/mouse/atarimouse.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
arch/m68k/atari/atakeyb.c +3 -2
@@ -39,7 +39,7 @@ void (*atari_MIDI_interrupt_hook) (void);/* Hook for keyboard inputdev driver */ void (*atari_input_keyboard_interrupt_hook) (unsigned char ,char );/* Hook for mouse inputdev driver */ -void (*atari_input_mouse_interrupt_hook) (char *); +void (*atari_input_mouse_interrupt_hook)(signed char *buf);EXPORT_SYMBOL (atari_input_keyboard_interrupt_hook);EXPORT_SYMBOL (atari_input_mouse_interrupt_hook);
@@ -260,7 +260,8 @@ static irqreturn_t atari_keyboard_interrupt(int irq, void *dummy)if (kb_state.len ==3 ) { kb_state.state =KEYBOARD ;if (atari_input_mouse_interrupt_hook) -atari_input_mouse_interrupt_hook (kb_state.buf); +atari_input_mouse_interrupt_hook ( + (signed char *)kb_state.buf); }break ;
arch/m68k/include/asm/atarikb.h +1 -1
@@ -37,7 +37,7 @@ extern void (*atari_MIDI_interrupt_hook) (void);/* Hook for keyboard inputdev driver */ extern void (*atari_input_keyboard_interrupt_hook) (unsigned char ,char );/* Hook for mouse inputdev driver */ -extern void (*atari_input_mouse_interrupt_hook) (char *); +extern void (*atari_input_mouse_interrupt_hook)(signed char *buf);int atari_keyb_init (void );
drivers/input/mouse/atarimouse.c +1 -1
@@ -60,7 +60,7 @@ extern int atari_mouse_buttons;static struct input_dev *atamouse_dev; -static void atamouse_interrupt (char *buf) +static void atamouse_interrupt (signed char *buf) {int buttons, dx, dy;
Signature · 1 line
2.43.0
Dmitry Torokhov
maintainerRe: [PATCH v4] m68k: Fix atari mouse movement
Hi Miro,
Quoted 8 lines · Miro Kropacek
Kernels are built with -funsigned-char since version 6.2, resulting in the signed 8-bit position deltas reported by the IKBD being misinterpreted as unsigned.
Carry the sign in the type of the mouse interrupt hook. The scancode buffer is shared with the keyboard and joystick paths, where unsigned is correct, so it stays unsigned and is cast at the single call site that passes it to the mouse driver.
The hook receives the byte stream, so I would rather have it accept u8* and then do signed cast for displacement values (and only them).
Thanks.
Signature · 1 line
Dmitry
PATCH v5 1/1 m68k: Fix atari mouse movement
In reply to Miro KropacekKernels are built with -funsigned-char since version 6.2, resulting in the signed 8-bit position deltas reported by the IKBD being misinterpreted as unsigned.
The hook is handed a raw IKBD packet, so take it as a byte stream and apply the sign to the two displacement values alone.
---
Changes in v5:
- take the packet as u8 * and cast only the two displacement values, as suggested; this drops the call-site cast v4 needed, and with it the -Wpointer-sign warning
- add the types include atarikb.h now relies on
The same cast of the two displacement values was tested on an Atari Falcon030 with CT60 in v1 of this patch; v5 differs from it only in the type of the hook argument.
Michael's Reviewed-by from v3 is dropped, as the approach has changed twice since.
arch/m68k/atari/atakeyb.c | 2 +- arch/m68k/include/asm/atarikb.h | 4 +++- drivers/input/mouse/atarimouse.c | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-)
arch/m68k/atari/atakeyb.c +1 -1
@@ -39,7 +39,7 @@ void (*atari_MIDI_interrupt_hook) (void);/* Hook for keyboard inputdev driver */ void (*atari_input_keyboard_interrupt_hook) (unsigned char ,char );/* Hook for mouse inputdev driver */ -void (*atari_input_mouse_interrupt_hook) (char *); +void (*atari_input_mouse_interrupt_hook)(u8 *buf);EXPORT_SYMBOL (atari_input_keyboard_interrupt_hook);EXPORT_SYMBOL (atari_input_mouse_interrupt_hook);
arch/m68k/include/asm/atarikb.h +3 -1
@@ -15,6 +15,8 @@#ifndef _LINUX_ATARIKB_H#define _LINUX_ATARIKB_H +#include <linux/types.h> +void ikbd_write (const char *,int );void ikbd_mouse_button_action (int mode);void ikbd_mouse_rel_pos (void );
@@ -37,7 +39,7 @@ extern void (*atari_MIDI_interrupt_hook) (void);/* Hook for keyboard inputdev driver */ extern void (*atari_input_keyboard_interrupt_hook) (unsigned char ,char );/* Hook for mouse inputdev driver */ -extern void (*atari_input_mouse_interrupt_hook) (char *); +extern void (*atari_input_mouse_interrupt_hook)(u8 *buf);int atari_keyb_init (void );
drivers/input/mouse/atarimouse.c +3 -3
@@ -60,7 +60,7 @@ extern int atari_mouse_buttons;static struct input_dev *atamouse_dev; -static void atamouse_interrupt (char *buf) +static void atamouse_interrupt (u8 *buf) {int buttons, dx, dy;
@@ -71,8 +71,8 @@ static void atamouse_interrupt(char *buf)#endif /* only relative events get here */ - dx = buf[1 ]; - dy = buf[2 ]; + dx = (s8 )buf[1 ]; + dy = (s8 )buf[2 ];input_report_rel (atamouse_dev,REL_X , dx);input_report_rel (atamouse_dev,REL_Y , dy);
Signature · 1 line
2.43.0
Re: [PATCH v5] m68k: Fix atari mouse movement
Hi Miro,
Am 21.10.2026 um 15:23 schrieb Miro Kropacek:
Quoted 21 lines
Kernels are built with -funsigned-char since version 6.2, resulting in the signed 8-bit position deltas reported by the IKBD being misinterpreted as unsigned.
The hook is handed a raw IKBD packet, so take it as a byte stream and apply the sign to the two displacement values alone.
Fixes 3bc753c06dd02a35 ("kbuild: treat char as always unsigned")Suggested-by Dmitry Torokhov <[email protected]>Signed-off-by Miro Kropacek <[email protected]>Cc linux-input <[email protected]>---
Changes in v5:
- take the packet as u8 * and cast only the two displacement values, as suggested; this drops the call-site cast v4 needed, and with it the -Wpointer-sign warning
- add the types includeatarikb.hnow relies on
Quoted 6 lines
The same cast of the two displacement values was tested on an Atari Falcon030 with CT60 in v1 of this patch; v5 differs from it only in the type of the hook argument.
Michael's Reviewed-by from v3 is dropped, as the approach has changed twice since.
Dmitry's reasoning makes sense to me, so we're back on v1 with no change in functionality.
Looks good to me, feel free to add my Reviewed-by if it helps get this merged.
Cheers,
Michael
Quoted 66 lines
arch/m68k/atari/atakeyb.c | 2 +- arch/m68k/include/asm/atarikb.h | 4 +++- drivers/input/mouse/atarimouse.c | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-)arch/m68k/atari/atakeyb.c +1
-1@@ -39,7 +39,7 @@ void (*atari_MIDI_interrupt_hook) (void);/* Hook for keyboard inputdev driver */ void (*atari_input_keyboard_interrupt_hook) (unsigned char ,char );/* Hook for mouse inputdev driver */ -void (*atari_input_mouse_interrupt_hook) (char *); +void (*atari_input_mouse_interrupt_hook)(u8 *buf);EXPORT_SYMBOL (atari_input_keyboard_interrupt_hook);EXPORT_SYMBOL (atari_input_mouse_interrupt_hook);arch/m68k/include/asm/atarikb.h +3
-1@@ -15,6 +15,8 @@#ifndef _LINUX_ATARIKB_H#define _LINUX_ATARIKB_H +#include <linux/types.h> +void ikbd_write (const char *,int );void ikbd_mouse_button_action (int mode);void ikbd_mouse_rel_pos (void );@@ -37,7 +39,7 @@ extern void (*atari_MIDI_interrupt_hook) (void);/* Hook for keyboard inputdev driver */ extern void (*atari_input_keyboard_interrupt_hook) (unsigned char ,char );/* Hook for mouse inputdev driver */ -extern void (*atari_input_mouse_interrupt_hook) (char *); +extern void (*atari_input_mouse_interrupt_hook)(u8 *buf);int atari_keyb_init (void );drivers/input/mouse/atarimouse.c +3
-3@@ -60,7 +60,7 @@ extern int atari_mouse_buttons;static struct input_dev *atamouse_dev; -static void atamouse_interrupt (char *buf) +static void atamouse_interrupt (u8 *buf) {int buttons, dx, dy;@@ -71,8 +71,8 @@ static void atamouse_interrupt(char *buf)#endif /* only relative events get here */ - dx = buf[1 ]; - dy = buf[2 ]; + dx = (s8 )buf[1 ]; + dy = (s8 )buf[2 ];input_report_rel (atamouse_dev,REL_X , dx);input_report_rel (atamouse_dev,REL_Y , dy);
Re: [PATCH v5] m68k: Fix atari mouse movement
Quoted 26 lines · Michael Schmitz
Am 21.10.2026 um 15:23 schrieb Miro Kropacek:
Quoted 25 lines
Kernels are built with -funsigned-char since version 6.2, resulting in the signed 8-bit position deltas reported by the IKBD being misinterpreted as unsigned.
The hook is handed a raw IKBD packet, so take it as a byte stream and apply the sign to the two displacement values alone.
Fixes 3bc753c06dd02a35 ("kbuild: treat char as always unsigned")Suggested-by Dmitry Torokhov <[email protected]>Signed-off-by Miro Kropacek <[email protected]>Cc linux-input <[email protected]>---
Changes in v5:
- take the packet as u8 * and cast only the two displacement values, as suggested; this drops the call-site cast v4 needed, and with it the -Wpointer-sign warning
- add the types includeatarikb.hnow relies onThe same cast of the two displacement values was tested on an Atari Falcon030 with CT60 in v1 of this patch; v5 differs from it only in the type of the hook argument.
Quoted 5 lines
Quoted 2 lines
Michael's Reviewed-by from v3 is dropped, as the approach has changed twice since.
Dmitry's reasoning makes sense to me, so we're back on v1 with no change in functionality.
If it's just a byte stream, one might not bother doing s/char/u8/, as both are the same type anyway... and then we're really back at v1.
Quoted 2 lines
Looks good to me, feel free to add my Reviewed-by if it helps get this merged.
for the arch/m68k files:
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 Torvalds
Dmitry Torokhov
maintainerRe: [PATCH v5] m68k: Fix atari mouse movement
Quoted 27 lines · Geert Uytterhoeven
Quoted 26 lines · Michael Schmitz
Am 21.10.2026 um 15:23 schrieb Miro Kropacek:
Quoted 25 lines
Kernels are built with -funsigned-char since version 6.2, resulting in the signed 8-bit position deltas reported by the IKBD being misinterpreted as unsigned.
The hook is handed a raw IKBD packet, so take it as a byte stream and apply the sign to the two displacement values alone.
Fixes 3bc753c06dd02a35 ("kbuild: treat char as always unsigned")Suggested-by Dmitry Torokhov <[email protected]>Signed-off-by Miro Kropacek <[email protected]>Cc linux-input <[email protected]>---
Changes in v5:
- take the packet as u8 * and cast only the two displacement values, as suggested; this drops the call-site cast v4 needed, and with it the -Wpointer-sign warning
- add the types includeatarikb.hnow relies onThe same cast of the two displacement values was tested on an Atari Falcon030 with CT60 in v1 of this patch; v5 differs from it only in the type of the hook argument.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Michael's Reviewed-by from v3 is dropped, as the approach has changed twice since.
Dmitry's reasoning makes sense to me, so we're back on v1 with no change in functionality.
If it's just a byte stream, one might not bother doing s/char/u8/, as both are the same type anyway... and then we're really back at v1.
I'd prefer to have u8 at least in input.
Quoted 7 lines
Quoted 3 lines
Looks good to me, feel free to add my Reviewed-by if it helps get this merged.
Reviewed-by Geert Uytterhoeven <[email protected]>for the
arch/m68kfiles:
Could you please re-post v1? Can;t seem to find it.
Thanks.
Signature · 1 line
Dmitry
Re: [PATCH v5] m68k: Fix atari mouse movement
Hi Dmitry,
Quoted 1 line · Dmitry Torokhov
Could you please re-post v1? Can't seem to find it.
v1 went to linux-m68k only, without linux-input:
https://lore.kernel.org/linux-m68k/[email protected]/
It touched only atarimouse.c, keeping char * and casting the two deltas to s8. v5 is the same two casts with u8 instead of char. The u8 can't stay in input alone though: a char * hook doesn't accept a u8 * handler (-Werror=incompatible-pointer-types), so the arch side has to follow.
Signature · 1 line
http://mikro.atari.org
Re: [PATCH v5] m68k: Fix atari mouse movement
Hi Dmitry,
Just wondering if there is anything I can do to get this merged? Geert gave his Reviewed-by on v5, plus his Acked-by for the arch/m68k files, and Michael is fine with adding his Reviewed-by.
Would you take v5 as it is through the input tree, or would you rather I re-send it as a standalone patch with the tags collected?
It is basically the last patch to be merged from my "atari stream".
Quoted 17 lines · Miro Kropáček
Hi Dmitry,
Quoted 1 line · Dmitry Torokhov
Could you please re-post v1? Can't seem to find it.
v1 went to linux-m68k only, without linux-input:
https://lore.kernel.org/linux-m68k/[email protected]/It touched only
atarimouse.c, keeping char * and casting the two deltas to s8. v5 is the same two casts with u8 instead of char. The u8 can't stay in input alone though: a char * hook doesn't accept a u8 * handler (-Werror=incompatible-pointer-types), so the arch side has to follow.
Signature · 1 line
http://mikro.atari.org
Re: [PATCH v5] m68k: Fix atari mouse movement
In reply to Miro KropacekQuoted 4 lines · Miro Kropacek
Kernels are built with -funsigned-char since version 6.2, resulting in the signed 8-bit position deltas reported by the IKBD being misinterpreted as unsigned.
Quoted 8 lines
The hook is handed a raw IKBD packet, so take it as a byte stream and apply the sign to the two displacement values alone.
Fixes 3bc753c06dd02a35 ("kbuild: treat char as always unsigned")Suggested-by Dmitry Torokhov <[email protected]>Signed-off-by Miro Kropacek <[email protected]>Cc linux-input <[email protected]>
Applied, thank you.
Signature · 1 line
Dmitry
PATCH v3 2/5 fbdev: Give atafb proper parent
In reply to Michael SchmitzFrom: Miro Kropacek <[email protected]>
The atafb fb device registers no parent, causing a missing symlink (/sys/class/graphics/fb0/device). Xorg fbdevhw driver looks for that symlink when scanning for devices, so add a parent node for atafb.
The proper way to do that is use of framebuffer_alloc(), which requries refactoring atafb to move from static fb_info to allocation of fb_info by framebuffer_alloc().
About the only location where a fb_info pointer cannot be passed is monspec setup in atafb_setup(). Store static monspecs there and copy into place after framebuffer_alloc().
Pass fb_info everywhere it's needed (detect, decode_var and do_fb_set_var functions), and remove the static fb_info struct.
---
Changes in v3:
- fbdev: refactor atafb fb_info use to allow use of framebuffer_alloc() (Thomas Zimmermann)
--- drivers/video/fbdev/atafb.c | 174 +++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 82 deletions(-)
drivers/video/fbdev/atafb.c +92 -82
@@ -158,14 +158,6 @@ static int DontCalcRes = 0;#define VMO_PREMASK 0x0c#endif -static struct fb_info fb_info = { - .fix = { - .id ="Atari " , - .visual =FB_VISUAL_PSEUDOCOLOR , - .accel =FB_ACCEL_NONE , - } -}; -static void *screen_base;/* base address of screen */ static unsigned long phys_screen_base;/* (only for Overscan) */
@@ -175,6 +167,12 @@ static int current_par_valid;static int mono_moni; +/* monspecs passed by user */ + +static __u32 mcap_hmin;/* hfreq lower limit (Hz) */ +static __u32 mcap_hmax;/* hfreq upper limit (Hz) */ +static __u16 mcap_vmin;/* vfreq lower limit (Hz) */ +static __u16 mcap_vmax;/* vfreq upper limit (Hz) */ #ifdef ATAFB_EXT
@@ -299,7 +297,7 @@ static int *MV300_reg = MV300_reg_8bit;/* ++roman: This structure abstracts from the underlying hardware (ST(e), * TT, or Falcon. * -* int (*detect)(void) +* int (*detect)(*fb_info) * This function should detect the current video mode settings and * store them in atafb_predefined[0] for later reference by the * user. Return the index+1 of an equivalent predefined mode or 0
@@ -311,7 +309,7 @@ static int *MV300_reg = MV300_reg_8bit;* values in the 'par' structure. * !!! Obsolete, perhaps !!! * -* int (*decode_var)(struct fb_var_screeninfo *var, +* int (*decode_var)(struct fb_info *info, struct fb_var_screeninfo *var, * struct atafb_par *par) * Get the video params out of 'var'. If a value doesn't fit, round * it up, if it's too big, return EINVAL.
@@ -345,10 +343,10 @@ static int *MV300_reg = MV300_reg_8bit;*/ static struct fb_hwswitch { - int (*detect)(void); + int (*detect)(struct fb_info *info); int (*encode_fix)(struct fb_fix_screeninfo *fix, struct atafb_par *par); - int (*decode_var)(struct fb_var_screeninfo *var, + int (*decode_var)(struct fb_info *info, struct fb_var_screeninfo *var, struct atafb_par *par); int (*encode_var)(struct fb_var_screeninfo *var, struct atafb_par *par);
@@ -576,7 +574,7 @@ static int tt_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par)return 0 ; } -static int tt_decode_var (struct fb_var_screeninfo *var,struct atafb_par *par) +static int tt_decode_var (struct fb_info *info,struct fb_var_screeninfo *var,struct atafb_par *par) {int xres = var->xres;int yres = var->yres;
@@ -782,7 +780,7 @@ static int tt_setcolreg(unsigned int regno, unsigned int red,return 0 ; } -static int tt_detect (void ) +static int tt_detect (struct fb_info *info) {struct atafb_par par;
@@ -877,7 +875,7 @@ static int falcon_encode_fix(struct fb_fix_screeninfo *fix,return 0 ; } -static int falcon_decode_var (struct fb_var_screeninfo *var, +static int falcon_decode_var (struct fb_info *info,struct fb_var_screeninfo *var,struct atafb_par *par) {int bpp = var->bits_per_pixel;
@@ -1069,13 +1067,13 @@ static int falcon_decode_var(struct fb_var_screeninfo *var,/* Choose master pixelclock depending on hor. timing */ plen =1 * xstretch;if ((plen * xres + f25.right + f25.hsync + f25.left) * - fb_info.monspecs.hfmin < f25.f) + info->monspecs.hfmin < f25.f) pclock = &f25;else if ((plen * xres + f32.right + f32.hsync + - f32.left) * fb_info.monspecs.hfmin < f32.f) + f32.left) * info->monspecs.hfmin < f32.f) pclock = &f32;else if ((plen * xres + fext.right + fext.hsync + - fext.left) * fb_info.monspecs.hfmin < fext.f && + fext.left) * info->monspecs.hfmin < fext.f && fext.f) pclock = &fext;else
@@ -1245,14 +1243,14 @@ static int falcon_decode_var(struct fb_var_screeninfo *var,/* check hor. frequency */ hfreq = pclock->f / ((par->HHT +2 ) * prescale *2 ); -if (hfreq > fb_info.monspecs.hfmax && mon_type !=F_MON_VGA ) { +if (hfreq > info->monspecs.hfmax && mon_type !=F_MON_VGA ) {/* ++guenther: ^^^^^^^^^^^^^^^^^^^ can't remember why I did this */ /* Too high -> enlarge margin */ left_margin +=1 ; right_margin +=1 ; goto again; } -if (hfreq > fb_info.monspecs.hfmax || hfreq < fb_info.monspecs.hfmin) +if (hfreq > info->monspecs.hfmax || hfreq < info->monspecs.hfmin)return -EINVAL ;/* Vxx-registers */
@@ -1283,50 +1281,50 @@ static int falcon_decode_var(struct fb_var_screeninfo *var,/* V-frequency check, hope I didn't create any loop here. */ /* Interlace and doubleline are mutually exclusive. */ vfreq = (hfreq *2 ) / (par->VFT +1 ); -if (vfreq > fb_info.monspecs.vfmax && !doubleline && !interlace) { +if (vfreq > info->monspecs.vfmax && !doubleline && !interlace) {/* Too high -> try again with doubleline */ doubleline =1 ; goto again; - }else if (vfreq < fb_info.monspecs.vfmin && !interlace && !doubleline) { + }else if (vfreq < info->monspecs.vfmin && !interlace && !doubleline) {/* Too low -> try again with interlace */ interlace =1 ; goto again; - }else if (vfreq < fb_info.monspecs.vfmin && doubleline) { + }else if (vfreq < info->monspecs.vfmin && doubleline) {/* Doubleline too low -> clear doubleline and enlarge margins */ int lines; doubleline =0 ;for (lines =0 ; (hfreq *2 ) / (par->VFT +1 +4 * lines -2 * yres) > - fb_info.monspecs.vfmax; + info->monspecs.vfmax; lines++) ; upper_margin += lines; lower_margin += lines; goto again; - }else if (vfreq > fb_info.monspecs.vfmax && doubleline) { + }else if (vfreq > info->monspecs.vfmax && doubleline) {/* Doubleline too high -> enlarge margins */ int lines;for (lines =0 ; (hfreq *2 ) / (par->VFT +1 +4 * lines) > - fb_info.monspecs.vfmax; + info->monspecs.vfmax; lines +=2 ) ; upper_margin += lines; lower_margin += lines; goto again; - }else if (vfreq > fb_info.monspecs.vfmax && interlace) { + }else if (vfreq > info->monspecs.vfmax && interlace) {/* Interlace, too high -> enlarge margins */ int lines;for (lines =0 ; (hfreq *2 ) / (par->VFT +1 +4 * lines) > - fb_info.monspecs.vfmax; + info->monspecs.vfmax; lines++) ; upper_margin += lines; lower_margin += lines; goto again; - }else if (vfreq < fb_info.monspecs.vfmin || - vfreq > fb_info.monspecs.vfmax) + }else if (vfreq < info->monspecs.vfmin || + vfreq > info->monspecs.vfmax)return -EINVAL ; set_screen_base:
@@ -1720,7 +1718,7 @@ static int falcon_blank(int blank_mode)return 0 ; } -static int falcon_detect (void ) +static int falcon_detect (struct fb_info *info) {struct atafb_par par;unsigned char fhw;
@@ -1732,18 +1730,18 @@ static int falcon_detect(void) f030_bus_width = fhw <<6 &0x80 ;switch (mon_type) {case F_MON_SM : - fb_info.monspecs.vfmin =70 ; - fb_info.monspecs.vfmax =72 ; - fb_info.monspecs.hfmin =35713 ; - fb_info.monspecs.hfmax =35715 ; + info->monspecs.vfmin =70 ; + info->monspecs.vfmax =72 ; + info->monspecs.hfmin =35713 ; + info->monspecs.hfmax =35715 ;break ;case F_MON_SC :case F_MON_TV :/* PAL...NTSC */ - fb_info.monspecs.vfmin =49 ;/* not 50, since TOS defaults to 49.9x Hz */ - fb_info.monspecs.vfmax =60 ; - fb_info.monspecs.hfmin =15620 ; - fb_info.monspecs.hfmax =15755 ; + info->monspecs.vfmin =49 ;/* not 50, since TOS defaults to 49.9x Hz */ + info->monspecs.vfmax =60 ; + info->monspecs.hfmin =15620 ; + info->monspecs.hfmax =15755 ;break ; }/* initialize hsync-len */
@@ -1795,7 +1793,7 @@ static int stste_encode_fix(struct fb_fix_screeninfo *fix,return 0 ; } -static int stste_decode_var (struct fb_var_screeninfo *var, +static int stste_decode_var (struct fb_info *info,struct fb_var_screeninfo *var,struct atafb_par *par) {int xres = var->xres;
@@ -1971,7 +1969,7 @@ static int stste_setcolreg(unsigned int regno, unsigned int red,return 0 ; } -static int stste_detect (void ) +static int stste_detect (struct fb_info *info) {struct atafb_par par;
@@ -2112,7 +2110,8 @@ static int ext_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par)return 0 ; } -static int ext_decode_var (struct fb_var_screeninfo *var,struct atafb_par *par) +static int ext_decode_var (struct fb_info *info,struct fb_var_screeninfo *var, +struct atafb_par *par) {struct fb_var_screeninfo *myvar = &atafb_predefined[0 ];
@@ -2226,7 +2225,7 @@ static int ext_setcolreg(unsigned int regno, unsigned int red, } } -static int ext_detect (void ) +static int ext_detect (struct fb_info *info) {struct fb_var_screeninfo *myvar = &atafb_predefined[0 ];struct atafb_par dummy_par;
@@ -2344,12 +2343,12 @@ static void ata_set_par(struct atafb_par *par)/* used for hardware scrolling */ -static int do_fb_set_var (struct fb_var_screeninfo *var,int isactive) +static int do_fb_set_var (struct fb_info *info,struct fb_var_screeninfo *var,int isactive) {int err, activate;struct atafb_par par; - err = fbhw->decode_var (var, &par); + err = fbhw->decode_var (info, var, &par);if (err)return err; activate = var->activate;
@@ -2368,7 +2367,7 @@ static int atafb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info)struct atafb_par par;int err;// Get fix directly (case con == -1 before)?? - err = fbhw->decode_var (&info->var, &par); + err = fbhw->decode_var (info, &info->var, &par);if (err)return err;memset (fix,0 ,sizeof (struct fb_fix_screeninfo ));
@@ -2635,7 +2634,7 @@ static int atafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)/* Validate wanted screen parameters */ // if ((err = ata_decode_var(var, &par))) - err = fbhw->decode_var (var, &par); + err = fbhw->decode_var (info, var, &par);if (err)return err;
@@ -2651,7 +2650,7 @@ static int atafb_set_par(struct fb_info *info)struct atafb_par *par = info->par;/* Decode wanted screen parameters */ - fbhw->decode_var (&info->var, par); + fbhw->decode_var (info, &info->var, par);mutex_lock (&info->mm_lock); fbhw->encode_fix (&info->fix, par);mutex_unlock (&info->mm_lock);
@@ -2677,7 +2676,7 @@ static struct fb_ops atafb_ops = { __FB_DEFAULT_IOMEM_OPS_MMAP, }; -static void check_default_par (int detected_mode) +static void check_default_par (struct fb_info *info,int detected_mode) {char default_name[10 ];int i;
@@ -2688,14 +2687,14 @@ static void check_default_par(int detected_mode)if (default_par) { var = atafb_predefined[default_par -1 ]; var.activate =FB_ACTIVATE_TEST ; -if (do_fb_set_var (&var,1 )) +if (do_fb_set_var (info, &var,1 )) default_par =0 ;/* failed */ }/* Next is the autodetected one */ if (!default_par) { var = atafb_predefined[detected_mode -1 ];/* autodetect */ var.activate =FB_ACTIVATE_TEST ; -if (!do_fb_set_var (&var,1 )) +if (!do_fb_set_var (info, &var,1 )) default_par = detected_mode; }/* If that also failed, try some default modes... */
@@ -2708,7 +2707,7 @@ static void check_default_par(int detected_mode)panic ("can't set default video mode" ); var = atafb_predefined[default_par -1 ]; var.activate =FB_ACTIVATE_TEST ; -if (!do_fb_set_var (&var,1 )) +if (!do_fb_set_var (info, &var,1 ))break ;/* ok */ } }
@@ -2901,10 +2900,10 @@ static void __init atafb_setup_mcap(char *spec)if (hmax <=0 || hmax <= hmin)return ; - fb_info.monspecs.vfmin = vmin; - fb_info.monspecs.vfmax = vmax; - fb_info.monspecs.hfmin = hmin; - fb_info.monspecs.hfmax = hmax; + mcap_vmin = vmin; + mcap_vmax = vmax; + mcap_hmin = hmin; + mcap_hmax = hmax; }#endif /* ATAFB_FALCON */
@@ -2991,12 +2990,19 @@ static int __init atafb_probe(struct platform_device *pdev)unsigned int defmode =0 ;unsigned long mem_req;char *option =NULL ; +struct fb_info *fb_info;if (fb_get_options ("atafb" , &option))return -ENODEV ;atafb_setup (option);dev_dbg (&pdev->dev,"%s: start\n" , __func__); + fb_info =framebuffer_alloc (sizeof (struct atafb_par ), &pdev->dev); + +strscpy (fb_info->fix.id,"Atari " ); + fb_info->fix.visual =FB_VISUAL_PSEUDOCOLOR ; + fb_info->fix.accel =FB_ACCEL_NONE ; + do { #ifdef ATAFB_EXT if (external_addr) {
@@ -3052,15 +3058,20 @@ static int __init atafb_probe(struct platform_device *pdev)/* Multisync monitor capabilities */ /* Atari-TOS defaults if no boot option present */ -if (fb_info.monspecs.hfmin ==0 ) { - fb_info.monspecs.hfmin =31000 ; - fb_info.monspecs.hfmax =32000 ; - fb_info.monspecs.vfmin =58 ; - fb_info.monspecs.vfmax =62 ; +if (mcap_hmin ==0 ) { + fb_info->monspecs.hfmin =31000 ; + fb_info->monspecs.hfmax =32000 ; + fb_info->monspecs.vfmin =58 ; + fb_info->monspecs.vfmax =62 ; + }else { + fb_info->monspecs.vfmin = mcap_vmin; + fb_info->monspecs.vfmax = mcap_vmax; + fb_info->monspecs.hfmin = mcap_hmin; + fb_info->monspecs.hfmax = mcap_hmax; } - detected_mode = fbhw->detect (); -check_default_par (detected_mode); + detected_mode = fbhw->detect (fb_info); +check_default_par (fb_info, detected_mode);#ifdef ATAFB_EXT if (!external_addr) {#endif /* ATAFB_EXT */
@@ -3100,43 +3111,42 @@ static int __init atafb_probe(struct platform_device *pdev) }#endif /* ATAFB_EXT */ -// strcpy(fb_info.mode->name, "Atari Builtin "); - fb_info.fbops = &atafb_ops; +// strcpy(fb_info->mode->name, "Atari Builtin "); + fb_info->fbops = &atafb_ops;// try to set default (detected; requested) var -do_fb_set_var (&atafb_predefined[default_par -1 ],1 ); +do_fb_set_var (fb_info, &atafb_predefined[default_par -1 ],1 );// reads hw state into current par, which may not be sane yet ata_get_par (¤t_par); - fb_info.par = ¤t_par; + fb_info->par = ¤t_par;// tries to read from HW which may not be initialized yet // so set sane var first, then call atafb_set_par -atafb_get_var (&fb_info.var, &fb_info); +atafb_get_var (&(fb_info->var), fb_info);#ifdef ATAFB_FALCON - fb_info.pseudo_palette = current_par.hw.falcon.pseudo_palette; + fb_info->pseudo_palette = current_par.hw.falcon.pseudo_palette;#endif -if (!fb_find_mode (&fb_info.var, &fb_info, mode_option, atafb_modedb, +if (!fb_find_mode (&(fb_info->var), fb_info, mode_option, atafb_modedb,NUM_TOTAL_MODES , &atafb_modedb[defmode], - fb_info.var.bits_per_pixel)) { + fb_info->var.bits_per_pixel)) {return -EINVAL ; }fb_videomode_to_modelist (atafb_modedb,NUM_TOTAL_MODES , - &fb_info.modelist); - -atafb_set_disp (&fb_info); + &(fb_info->modelist)); -fb_alloc_cmap (&(fb_info.cmap),1 << fb_info.var.bits_per_pixel,0 ); +atafb_set_disp (fb_info); +fb_alloc_cmap (&(fb_info->cmap),1 << fb_info->var.bits_per_pixel,0 ); -dev_info (&pdev->dev,"Determined %dx%d, depth %d\n" , fb_info.var.xres, - fb_info.var.yres, fb_info.var.bits_per_pixel); -if ((fb_info.var.xres != fb_info.var.xres_virtual) || - (fb_info.var.yres != fb_info.var.yres_virtual)) +dev_info (&pdev->dev,"Determined %dx%d, depth %d\n" , fb_info->var.xres, + fb_info->var.yres, fb_info->var.bits_per_pixel); +if ((fb_info->var.xres != fb_info->var.xres_virtual) || + (fb_info->var.yres != fb_info->var.yres_virtual))dev_info (&pdev->dev," virtual %dx%d\n" , - fb_info.var.xres_virtual, fb_info.var.yres_virtual); + fb_info->var.xres_virtual, fb_info->var.yres_virtual); -if (register_framebuffer (&fb_info) <0 ) { +if (register_framebuffer (fb_info) <0 ) {#ifdef ATAFB_EXT if (external_addr) {iounmap (external_screen_base);
@@ -3150,7 +3160,7 @@ static int __init atafb_probe(struct platform_device *pdev)return -EINVAL ; } -fb_info (&fb_info,"frame buffer device, using %dK of video memory\n" , +fb_info (fb_info,"frame buffer device, using %dK of video memory\n" , screen_len >>10 );/* TODO: This driver cannot be unloaded yet */
Signature · 1 line
2.17.1
Helge Deller
maintainerRe: [PATCH v3 2/5] fbdev: Give atafb proper parent
Quoted 65 lines · Michael Schmitz
From: Miro Kropacek <[email protected]>
The atafb fb device registers no parent, causing a missing symlink (
/sys/class/graphics/fb0/device). Xorg fbdevhw driver looks for that symlink when scanning for devices, so add a parent node for atafb.The proper way to do that is use of
framebuffer_alloc(), which requries refactoring atafb to move from staticfb_infoto allocation offb_infobyframebuffer_alloc().
About the only location where afb_infopointer cannot be passed is monspec setup inatafb_setup(). Store static monspecs there and copy into place afterframebuffer_alloc().Pass
fb_infoeverywhere it's needed (detect,decode_varanddo_fb_set_varfunctions), and remove the staticfb_infostruct.Signed-off-by Miro Kropacek <[email protected]>Reviewed-by Michael Schmitz <[email protected]>Signed-off-by Michael Schmitz <[email protected]>Cc <[email protected]>---
Changes in v3:
- fbdev: refactor atafb
fb_infouse to allow use offramebuffer_alloc()(Thomas Zimmermann)--- drivers/video/fbdev/atafb.c | 174 +++++++++++++++++++----------------- 1 file changed, 92 insertions(+), 82 deletions(-)drivers/video/fbdev/atafb.c +6
-8@@ -158,14 +158,6 @@ static int DontCalcRes = 0;#define VMO_PREMASK 0x0c#endif -static struct fb_info fb_info = { - .fix = { - .id ="Atari " , - .visual =FB_VISUAL_PSEUDOCOLOR , - .accel =FB_ACCEL_NONE , - } -}; -static void *screen_base;/* base address of screen */ static unsigned long phys_screen_base;/* (only for Overscan) */ @@ -175,6 +167,12 @@ static int current_par_valid;static int mono_moni; +/* monspecs passed by user */ + +static __u32 mcap_hmin;/* hfreq lower limit (Hz) */ +static __u32 mcap_hmax;/* hfreq upper limit (Hz) */ +static __u16 mcap_vmin;/* vfreq lower limit (Hz) */ +static __u16 mcap_vmax;/* vfreq upper limit (Hz) */ #ifdef ATAFB_EXT
drivers/video/fbdev/atafb.c static int *MV300_reg = MV300_reg_8bit; · line 300
Quoted 5 lines
drivers/video/fbdev/atafb.c +1
-1@@ -299,7 +297,7 @@ static int *MV300_reg = MV300_reg_8bit;/* ++roman: This structure abstracts from the underlying hardware (ST(e), * TT, or Falcon. * -* int (*detect)(void) +* int (*detect)(*fb_info)
I fixed this comment up to become:
+ * int (*detect)(struct fb_info *info)
Other than that I've replaced the latest patch series by this series in the fbdev for-next git tree.
Thanks!
Helge
Re: [PATCH v3 2/5] fbdev: Give atafb proper parent
Thanks Helge,
Quoted 69 lines · Helge Deller
Quoted 57 lines · Michael Schmitz
From: Miro Kropacek <[email protected]>
The atafb fb device registers no parent, causing a missing symlink (
/sys/class/graphics/fb0/device). Xorg fbdevhw driver looks for that symlink when scanning for devices, so add a parent node for atafb.The proper way to do that is use of
framebuffer_alloc(), which requries refactoring atafb to move from staticfb_infoto allocation offb_infobyframebuffer_alloc().
About the only location where afb_infopointer cannot be passed is monspec setup inatafb_setup(). Store static monspecs there and copy into place afterframebuffer_alloc().Pass
fb_infoeverywhere it's needed (detect,decode_varanddo_fb_set_varfunctions), and remove the staticfb_infostruct.Signed-off-by Miro Kropacek <[email protected]>Reviewed-by Michael Schmitz <[email protected]>Signed-off-by Michael Schmitz <[email protected]>Cc <[email protected]>---
Changes in v3:
- fbdev: refactor atafb
fb_infouse to allow use offramebuffer_alloc()(Thomas Zimmermann)
---
drivers/video/fbdev/atafb.c| 174 +++++++++++++++++++-----------------1 file changed, 92 insertions(+), 82 deletions(-)drivers/video/fbdev/atafb.c +0
-7@@ -158,14 +158,6 @@ static int DontCalcRes = 0; #define VMO_PREMASK 0x0c #endif -static struct fb_info fb_info = { - .fix = { - .id = "Atari ", - .visual = FB_VISUAL_PSEUDOCOLOR, - .accel = FB_ACCEL_NONE, - } -}; -static void *screen_base; /* base address of screen */ static unsigned long phys_screen_base; /* (only for Overscan) */ @@ -175,6 +167,12 @@ static int
current_par_valid; static intmono_moni;
+/* monspecs passed by user */drivers/video/fbdev/atafb.c +5
-0+ +static __u32 mcap_hmin; /* hfreq lower limit (Hz) */ +static __u32 mcap_hmax; /* hfreq upper limit (Hz) */ +static __u16 mcap_vmin; /* vfreq lower limit (Hz) */ +static __u16 mcap_vmax; /* vfreq upper limit (Hz) */Quoted 7 lines
#ifdef
ATAFB_EXT
@@ -299,7 +297,7 @@ static int*MV300_reg=MV300_reg_8bit; /* ++roman: This structure abstracts from the underlying hardware (ST(e),
* TT, or Falcon.
*
- * int (*detect)(void)
+ * int (*detect)(*fb_info)I fixed this comment up to become:
+ * int (*detect)(structfb_info*info)
Quoted 2 lines
Other than that I've replaced the latest patch series by this series in the fbdev for-next git tree.
Appreciate the fast work - I'm working on another patch for atafb to update error handling in atafb_probe() (just calling panic() when something goes wrong is a little rough these days). Will take a little longer to test though.
Cheers,
Michael
Quoted 3 lines
Thanks!
Helge
Re: [PATCH v3 2/5] fbdev: Give atafb proper parent
In reply to Helge DellerHi Helge, hi Michael,
Quoted 5 lines · Helge Deller
I fixed this comment up to become:
+ * int (*detect)(structfb_info*info)Other than that I've replaced the latest patch series by this series in the fbdev for-next git tree.
I ran the reworked version on a Falcon (CT60, SuperVidel). The console comes up on the external path at 1920x1080 in 16bpp and 32bpp, /sys/class/graphics/fb0/device is there and Xorg fbdev starts, so no regression here.
Signature · 1 line
http://mikro.atari.org
PATCH v3 3/5 fbdev: Add support for further video bit depths on atafb:external
In reply to Michael SchmitzFrom: Miro Kropacek <[email protected]>
Supervidel offers additional video bit depths (8-bit chunky, 16-bit RGB565 (also on the originaln Videl) and ARGB888.
Add code to support these bit depths.
---
Changes in v3:
- adapt patch to fb_info -> *fb_info rewrite (in patch 2)
--- drivers/video/fbdev/atafb.c | 89 ++++++++++++++++++++++++++++++++++--- 1 file changed, 82 insertions(+), 7 deletions(-)
drivers/video/fbdev/atafb.c +82 -7
@@ -2079,8 +2079,12 @@ static int ext_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par) external_pmode == FB_TYPE_PACKED_PIXELS) ?FB_VISUAL_MONO10 :FB_VISUAL_MONO01 ; }else { -/* Use STATIC if we don't know how to access color registers */ -int visual = external_vgaiobase ? +/* Use STATIC if we don't know how to access color registers; +* SuperVidel 8bpp chunky (fb in SV RAM) uses the Falcon palette +*/ +int visual = (external_vgaiobase || + (external_depth ==8 && + external_addr >=0xa0000000 )) ?FB_VISUAL_PSEUDOCOLOR :FB_VISUAL_STATIC_PSEUDOCOLOR ;switch (external_pmode) {
@@ -2158,6 +2162,35 @@ static int ext_encode_var(struct fb_var_screeninfo *var, struct atafb_par *par) var->transp.offset =0 ; var->transp.length =0 ; var->transp.msb_right =0 ; +if (external_pmode ==-1 && external_depth ==16 ) { +/* RGB565 truecolor (e.g. SuperVidel native mode) */ + var->red.offset =11 ; + var->red.length =5 ; + var->green.offset =5 ; + var->green.length =6 ; + var->blue.offset =0 ; + var->blue.length =5 ; + }else if (external_pmode ==-1 && external_depth ==32 ) { +/* ARGB8888 truecolor (e.g. SuperVidel native mode) */ + var->red.offset =16 ; + var->red.length =8 ; + var->green.offset =8 ; + var->green.length =8 ; + var->blue.offset =0 ; + var->blue.length =8 ; + var->transp.offset =24 ; + var->transp.length =8 ; + }else if (external_pmode ==FB_TYPE_PACKED_PIXELS && + external_depth ==8 && external_addr >=0xa0000000 ) { +/* SuperVidel 8bpp chunky: palette has 8 bits per channel. +* Without this, fb_get_color_depth() sees length 0 and +* fbcon falls back to its 2-color palette — the console +* text (color 7) stays black on black. +*/ + var->red.length =8 ; + var->green.length =8 ; + var->blue.length =8 ; + } var->yres_virtual = var->yres; var->xoffset =0 ; var->yoffset =0 ;
@@ -2192,6 +2225,38 @@ static int ext_setcolreg(unsigned int regno, unsigned int red, {unsigned char colmask = (1 << external_bitspercol) -1 ; +if (external_pmode ==-1 && external_depth ==16 ) { +/* truecolor: only the pseudo palette for fbcon is needed */ +if (regno >15 ) +return 1 ; + ((u32 *)info->pseudo_palette)[regno] = (red &0xf800 ) | + ((green &0xfc00 ) >>5 ) | + ((blue &0xf800 ) >>11 ); +return 0 ; + } +if (external_pmode ==-1 && external_depth ==32 ) { +/* ARGB8888, alpha forced opaque */ +if (regno >15 ) +return 1 ; + ((u32 *)info->pseudo_palette)[regno] =0xff000000 | + ((red &0xff00 ) <<8 ) | + (green &0xff00 ) | + ((blue &0xff00 ) >>8 ); +return 0 ; + } +if (external_pmode ==FB_TYPE_PACKED_PIXELS && external_depth ==8 && + external_addr >=0xa0000000 ) { +/* SuperVidel native 8bpp chunky scans out via the Falcon +* palette registers, honoring all 8 bits per channel +*/ +if (regno >255 ) +return 1 ; + f030_col[regno] = ((red &0xff00 ) <<16 ) | + ((green &0xff00 ) <<8 ) | + ((blue &0xff00 ) >>8 ); +return 0 ; + } +if (!external_vgaiobase)return 1 ;
@@ -2421,7 +2486,9 @@ static void atafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)return ;#ifdef ATAFB_FALCON -if (info->var.bits_per_pixel ==16 ) { +/* chunky modes (Falcon hicolor, external packed/truecolor) */ +if (info->fix.type ==FB_TYPE_PACKED_PIXELS && + info->var.bits_per_pixel >1 ) {cfb_fillrect (info, rect);return ; }
@@ -2462,7 +2529,9 @@ static void atafb_copyarea(struct fb_info *info, const struct fb_copyarea *area)int rev_copy =0 ;#ifdef ATAFB_FALCON -if (info->var.bits_per_pixel ==16 ) { +/* chunky modes (Falcon hicolor, external packed/truecolor) */ +if (info->fix.type ==FB_TYPE_PACKED_PIXELS && + info->var.bits_per_pixel >1 ) {cfb_copyarea (info, area);return ; }
@@ -2516,7 +2585,9 @@ static void atafb_imageblit(struct fb_info *info, const struct fb_image *image)u32 dx, dy, width, height, pitch;#ifdef ATAFB_FALCON -if (info->var.bits_per_pixel ==16 ) { +/* chunky modes (Falcon hicolor, external packed/truecolor) */ +if (info->fix.type ==FB_TYPE_PACKED_PIXELS && + info->var.bits_per_pixel >1 ) {cfb_imageblit (info, image);return ; }
@@ -2752,7 +2823,7 @@ static void __init atafb_setup_ext(char *spec)return ; depth =simple_strtoul (p,NULL ,10 );if (depth !=1 && depth !=2 && depth !=4 && depth !=8 && - depth !=16 && depth !=24 ) + depth !=16 && depth !=24 && depth !=32 )return ; p =strsep (&spec,";" );
@@ -3137,7 +3208,11 @@ static int __init atafb_probe(struct platform_device *pdev)atafb_set_disp (fb_info); -fb_alloc_cmap (&(fb_info->cmap),1 << fb_info->var.bits_per_pixel,0 ); +/* truecolor visuals only need the 16-entry console palette; this +* also avoids 1 << 32 overflowing at 32bpp +*/ +fb_alloc_cmap (&(fb_info->cmap), fb_info->var.bits_per_pixel >8 ? +16 :1 << fb_info->var.bits_per_pixel,0 );dev_info (&pdev->dev,"Determined %dx%d, depth %d\n" , fb_info->var.xres, fb_info->var.yres, fb_info->var.bits_per_pixel);
Signature · 1 line
2.17.1
PATCH v3 4/5 fbdev: Add support for SuperVidel's SuperBlitter
In reply to Michael SchmitzFrom: Miro Kropacek <[email protected]>
The SuperVidel graphics FPGA includes a hardware blitter (bit block transfer engine) operating within the SuperVidel DDR2 video RAM.
Two versions of this blitter exist. Later versions (>= 9) of the SuperVidel firmware support an asynchronous command FIFO, older versions must be polled for command completion.
Add hardware-accelerated copyarea, fillrect and imageblit fb operations (falling back to the non-accelerated versions for anything that exceeds blitter capabilities).
---
Changes in v3:
- adapt patch to fb_info -> *fb_info rewrite (in patch 2)
--- drivers/video/fbdev/atafb.c | 197 ++++++++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+)
drivers/video/fbdev/atafb.c +197 -0
@@ -2303,6 +2303,185 @@ static int ext_detect(struct fb_info *info) return 1; } +/* ------------------- SuperVidel SuperBlitter ---------------------- */ + +/* +* Hardware blitter in the SuperVidel FPGA, operating within SV DDR2 RAM. +* FW revision >= 9 provides a command FIFO (async operation); older +* revisions are programmed directly with busy-polling. +*/ +#define SVBLIT_REGS_PHYS 0x80010000 +#define SVBLIT_SRC1 0x58/* bits 26:0 */ +#define SVBLIT_SRC2 0x5c +#define SVBLIT_DST 0x60 +#define SVBLIT_COUNT 0x64/* bytes per line - 1 */ +#define SVBLIT_SRC1_OFFSET 0x68/* line start to next line start */ +#define SVBLIT_SRC2_OFFSET 0x6c +#define SVBLIT_DST_OFFSET 0x70 +#define SVBLIT_MASK_AND_LINES 0x74/* bits 11:0: number of lines */ +#define SVBLIT_CONTROL 0x78/* bit 0: busy/start, bits 4:1: mode */ +#define SVBLIT_VERSION 0x7c/* bits 9:0: FW revision */ +#define SVBLIT_FIFO 0x80/* wr: data; rd: bit 0 empty, bit 1 full */ + +/* +* SuperBlitter bug: Instead of declared 2048 bytes, 2032 is the real maximum. +*/ +#define SVBLIT_MAX_SPAN 2032 + +static void __iomem *svblit_regs; +static int svblit_fw; + +static inline u32 svblit_rd (unsigned int reg) +{ +return __raw_readl (svblit_regs + reg); +} + +static inline void svblit_wr (unsigned int reg,u32 val) +{ +__raw_writel (val, svblit_regs + reg); +} + +/* wait until all queued blits have finished */ +static void svblit_wait (void ) +{ +if (svblit_fw >=9 ) +/* FIFO empty flag = fewer than 9 longwords queued */ +while (!(svblit_rd (SVBLIT_FIFO ) &1 )) +cpu_relax (); +while (svblit_rd (SVBLIT_CONTROL ) &1 ) +cpu_relax (); +} + +/* +* FW >= 9 queues commands through the 512-longword FIFO: a command is +* 9 longwords (registers 0x58..0x78 in order), executed whenever >= 9 +* words are queued and the blitter is idle. The full flag rises at +* >= 500 queued words, so below it there is always room for a whole +* command — one flag check per command prevents overflow (dropped +* words would desync the 9-word framing until an SV reinit, which is +* exactly what overflowing did before this guard existed). Older FW +* is programmed directly with busy-polling. +* +* The line byte count field is 11 bits but see SVBLIT_MAX_SPAN. +*/ +static void svblit_copy (u32 src,u32 dst,u32 nbytes,u32 src_offset, +u32 dst_offset,u32 lines) +{ +while (nbytes) { +u32 chunk =min (nbytes,SVBLIT_MAX_SPAN ); + +if (svblit_fw >=9 ) { +while (svblit_rd (SVBLIT_FIFO ) &2 ) +cpu_relax (); +svblit_wr (SVBLIT_FIFO , src); +svblit_wr (SVBLIT_FIFO ,0 ); +svblit_wr (SVBLIT_FIFO , dst); +svblit_wr (SVBLIT_FIFO , chunk -1 ); +svblit_wr (SVBLIT_FIFO , src_offset); +svblit_wr (SVBLIT_FIFO ,0 ); +svblit_wr (SVBLIT_FIFO , dst_offset); +svblit_wr (SVBLIT_FIFO , lines); +svblit_wr (SVBLIT_FIFO ,0x01 ); + }else { +while (svblit_rd (SVBLIT_CONTROL ) &1 ) +cpu_relax (); +svblit_wr (SVBLIT_SRC1 , src); +svblit_wr (SVBLIT_SRC2 ,0 ); +svblit_wr (SVBLIT_DST , dst); +svblit_wr (SVBLIT_COUNT , chunk -1 ); +svblit_wr (SVBLIT_SRC1_OFFSET , src_offset); +svblit_wr (SVBLIT_SRC2_OFFSET ,0 ); +svblit_wr (SVBLIT_DST_OFFSET , dst_offset); +svblit_wr (SVBLIT_MASK_AND_LINES , lines); +svblit_wr (SVBLIT_CONTROL ,0x01 ); + } + + src += chunk; + dst += chunk; + nbytes -= chunk; + } +} + +static int svblit_sync (struct fb_info *info) +{ +svblit_wait (); +return 0 ; +} + +static void svblit_copyarea (struct fb_info *info, +const struct fb_copyarea *area) +{ +u32 bytespp = info->var.bits_per_pixel /8 ; +u32 pitch = info->fix.line_length; + +/* +* The blitter walks lines in ascending order, so overlapping +* moves down/right would read already overwritten data. Those +* are rare for fbcon (scrolling backwards); leave them and +* oversized areas to the CPU. +*/ +if (area->height >4095 || + area->dy > area->sy || + (area->dy == area->sy && area->dx > area->sx)) { +svblit_wait (); +cfb_copyarea (info, area); +return ; + } + +svblit_copy (external_addr + area->sy * pitch + area->sx * bytespp, + external_addr + area->dy * pitch + area->dx * bytespp, + area->width * bytespp, pitch, pitch, area->height); +/* async: every CPU access to the fb goes through svblit_wait() */ +} + +static void svblit_fillrect (struct fb_info *info, +const struct fb_fillrect *rect) +{ +u32 bytespp = info->var.bits_per_pixel /8 ; +u32 pitch = info->fix.line_length; +u8 *line; +u32 pix; + +svblit_wait ();/* the CPU is about to touch the fb */ + +if (rect->rop !=ROP_COPY || rect->height <=1 || + rect->height >4096 ) { +cfb_fillrect (info, rect); +return ; + } + + pix = (info->fix.visual ==FB_VISUAL_TRUECOLOR ) ? + ((u32 *)info->pseudo_palette)[rect->color] : rect->color; + +/* draw the first line with the CPU ... */ + line = (u8 *)info->screen_base + rect->dy * pitch + + rect->dx * bytespp; +switch (bytespp) { +case 1 : +memset (line, pix, rect->width); +break ; +case 2 : +memset16 ((u16 *)line, pix, rect->width); +break ; +default : +memset32 ((u32 *)line, pix, rect->width); +break ; + } + +/* ... and let the blitter replicate it into the other lines */ +svblit_copy (external_addr + rect->dy * pitch + rect->dx * bytespp, + external_addr + (rect->dy +1 ) * pitch + + rect->dx * bytespp, + rect->width * bytespp,0 , pitch, rect->height -1 ); +} + +static void svblit_imageblit (struct fb_info *info, +const struct fb_image *image) +{ +svblit_wait ();/* CPU rendering must not race queued blits */ +cfb_imageblit (info, image); +} +#endif /* ATAFB_EXT */ /* ------ This is the same for most hardware types -------- */
@@ -3179,6 +3358,24 @@ static int __init atafb_probe(struct platform_device *pdev) phys_screen_base = external_addr; screen_len = external_len &PAGE_MASK ;memset (screen_base,0 , external_len); + +/* framebuffer in SV RAM: enable the SuperBlitter */ +if (external_addr >=0xa0000000 ) { + svblit_regs =ioremap (SVBLIT_REGS_PHYS ,0x100 ); +if (svblit_regs) { + svblit_fw =svblit_rd (SVBLIT_VERSION ) &0x1ff ; + atafb_ops.fb_fillrect = svblit_fillrect; + atafb_ops.fb_copyarea = svblit_copyarea; + atafb_ops.fb_imageblit = svblit_imageblit; + atafb_ops.fb_sync = svblit_sync; + fb_info->flags |=FBINFO_HWACCEL_COPYAREA | +FBINFO_HWACCEL_FILLRECT ; +dev_info (&pdev->dev, +"SuperBlitter enabled, FW revision %d (%s)\n" , + svblit_fw, svblit_fw >=9 ? +"async FIFO" :"sync" ); + } + } }#endif /* ATAFB_EXT */
Signature · 1 line
2.17.1
PATCH v3 5/5 m68k: Add support for Svethlana
In reply to Michael SchmitzFrom: Miro Kropacek <[email protected]>
The SuperVidel FPGA contains an OpenCore ethernet package. Add platform device data and other necessary definitions to support this device on Atari.
The ethoc module must be enabled separately by the user.
---
Changes in v2:
- fix svethlana platform register error handling (Geert)
Changes in v3:
- fix mistake introduced in error handling (Geert)
--- arch/m68k/Kconfig.devices | 12 +++++ arch/m68k/atari/config.c | 75 +++++++++++++++++++++++++++++++ arch/m68k/include/asm/atariints.h | 2 +- arch/m68k/include/asm/irq.h | 6 +-- 4 files changed, 91 insertions(+), 4 deletions(-)
arch/m68k/Kconfig.devices +12 -0
@@ -67,6 +67,18 @@ config ATARI_ETHERNAT To compile the actual ethernet driver, choose Y or M for the SMC91X option in the network device section; the module will be called smc91x. +config ATARI_SVETHLANA + bool "Atari SuperVidel SVEthlana Ethernet support" + depends on ATARI + help + Say Y to include support for the SVEthlana network adapter built + into the SuperVidel FPGA. SuperVidel firmware version 10 or newer + is required (older firmware lacks the Ethernet DMA). + + To compile the actual ethernet driver, choose Y or M for the ETHOC + option in the network device section; the module will be called + ethoc. + config ATARI_ETHERNEC bool "Atari EtherNEC Ethernet support" depends on ATARI_ROM_ISA
arch/m68k/atari/config.c +75 -0
93 lines not on this page · raw message
arch/m68k/include/asm/atariints.h +1 -1
@@ -32,7 +32,7 @@#define VME_SOURCE_BASE 56#define VME_MAX_SOURCES 16 -#define NUM_ATARI_SOURCES 141 +#define NUM_ATARI_SOURCES 142/* convert vector number to int source number */ #define IRQ_VECTOR_TO_SOURCE (v) ((v) - ((v) < 0x20 ? 0x18 : (0x40-8)))
arch/m68k/include/asm/irq.h +3 -3
@@ -10,8 +10,8 @@* different m68k hosts compiled into the kernel. * Currently the Atari has 72 and the Amiga 24, but if both are * supported in the kernel it is better to make room for 72. -* With EtherNAT add-on card on Atari, the highest interrupt -* number is 140 so NR_IRQS needs to be 141. +* With the SVEthlana adapter in the SuperVidel on Atari, the highest +* interrupt number is 141 so NR_IRQS needs to be 142. */ #if defined(CONFIG_COLDFIRE )#define NR_IRQS 256
@@ -19,7 +19,7 @@ defined(CONFIG_SUN3X) || defined(CONFIG_VIRT)#define NR_IRQS 200#elif defined(CONFIG_ATARI ) -#define NR_IRQS 141 +#define NR_IRQS 142#elif defined(CONFIG_MAC )#define NR_IRQS 72#elif defined(CONFIG_Q40 )
Signature · 1 line
2.17.1
Re: [PATCH v3 5/5] m68k: Add support for Svethlana
Quoted 8 lines · Michael Schmitz
From: Miro Kropacek <[email protected]>
The SuperVidel FPGA contains an OpenCore ethernet package. Add platform device data and other necessary definitions to support this device on Atari.
The ethoc module must be enabled separately by the user.
Quoted 8 lines
Signed-off-by Miro Kropacek <[email protected]>Reviewed-by Michael Schmitz <[email protected]>Signed-off-by Michael Schmitz <[email protected]>---
Changes in v2:- fix svethlana platform register error handling (Geert)
i.e. will queue in the m68k tree for v7.4.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
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 Torvalds