From 4c0aab31131d742f2343f373c3fbeee685da93fd Mon Sep 17 00:00:00 2001 From: cebix <> Date: Thu, 21 Oct 1999 13:19:27 +0000 Subject: [PATCH] - added fbdev video code and SPARC assembly optimizations --- BasiliskII/ChangeLog | 2 + BasiliskII/README | 3 + BasiliskII/src/Unix/Makefile.in | 2 + BasiliskII/src/Unix/Solaris/sparcasm.h | 610 ++++++++++++++++++++++ BasiliskII/src/Unix/Solaris/which_sparc | 117 +++++ BasiliskII/src/Unix/config.h.in | 6 - BasiliskII/src/Unix/configure | 383 +++++++------- BasiliskII/src/Unix/configure.in | 34 +- BasiliskII/src/Unix/fbdevices | 14 + BasiliskII/src/Unix/user_strings_unix.cpp | 3 + BasiliskII/src/Unix/user_strings_unix.h | 3 + BasiliskII/src/Unix/video_x.cpp | 254 ++++++++- BasiliskII/src/uae_cpu/gencpu.c | 157 +++++- 13 files changed, 1367 insertions(+), 221 deletions(-) create mode 100644 BasiliskII/src/Unix/Solaris/sparcasm.h create mode 100755 BasiliskII/src/Unix/Solaris/which_sparc create mode 100644 BasiliskII/src/Unix/fbdevices diff --git a/BasiliskII/ChangeLog b/BasiliskII/ChangeLog index 809a1f6b..74552e20 100644 --- a/BasiliskII/ChangeLog +++ b/BasiliskII/ChangeLog @@ -16,6 +16,8 @@ V0.7 - [Giacomo Magnini] - Unix: compilation of cpuemu.cpp is now split in 8 parts - Unix: volume list in GTK prefs editor is reorderable + - Unix: added fbdev DGA support and SPARC assembly optimizations to + UAE core [Gwenole Beauchesne] V0.7 (release 0.7-2) - 6.Oct.1999 - Added BasiliskII.spec for making RPMs [with assistance from diff --git a/BasiliskII/README b/BasiliskII/README index 6885c591..d24bf13f 100644 --- a/BasiliskII/README +++ b/BasiliskII/README @@ -607,6 +607,9 @@ Contributions by: - Bill Huey : 15/16 bit DGA and 15/16/32 bit X11 window support - David Lawrence : incremental window refresh code + - Gwenole Beauchesne : SPARC assembly optimizations and + fbdev video code + - and others... Special thanks to: - Bernd Schmidt for letting me use his UAE 68k emulation diff --git a/BasiliskII/src/Unix/Makefile.in b/BasiliskII/src/Unix/Makefile.in index 1a49827d..184d2bfd 100644 --- a/BasiliskII/src/Unix/Makefile.in +++ b/BasiliskII/src/Unix/Makefile.in @@ -67,11 +67,13 @@ install: $(APP) -$(INSTALL_DATA) $(APP).1 $(man1dir)/$(APP).1 $(INSTALL) -d $(datadir)/$(APP) $(INSTALL_DATA) keycodes $(datadir)/$(APP)/keycodes + $(INSTALL_DATA) fbdevices $(datadir)/$(APP)/fbdevices uninstall: rm -f $(bindir)/$(APP) rm -f $(man1dir)/$(APP).1 rm -f $(datadir)/$(APP)/keycodes + rm -f $(datadir)/$(APP)/fbdevices rmdir $(datadir)/$(APP) mostlyclean: diff --git a/BasiliskII/src/Unix/Solaris/sparcasm.h b/BasiliskII/src/Unix/Solaris/sparcasm.h new file mode 100644 index 00000000..5a753bf7 --- /dev/null +++ b/BasiliskII/src/Unix/Solaris/sparcasm.h @@ -0,0 +1,610 @@ +#ifndef SPARC_ASSEMBLY__HEADER +#define SPARC_ASSEMBLY__HEADER + +#ifdef SPARC_V8_ASSEMBLY + +static inline char *str_flags(void) +{ + static char str[8]; + sprintf(str, "%c%c%c%c%c", + GET_XFLG ? 'X' : '-', + GET_NFLG ? 'N' : '-', + GET_ZFLG ? 'Z' : '-', + GET_VFLG ? 'V' : '-', + GET_CFLG ? 'C' : '-' + ); + return str; +} + +static inline uae_u32 sparc_v8_flag_add_8(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " sll %2, 24, %%o0\n" + " sll %3, 24, %%o1\n" + " addcc %%o0, %%o1, %%o0\n" + " addx %%g0, %%g0, %%o1 ! X,C flags\n" + " srl %%o0, 24, %0\n" + " stb %%o1, [%1 + 1]\n" + " bl,a .+8\n" + " or %%o1, 0x08, %%o1 ! N flag\n" + " bz,a .+8\n" + " or %%o1, 0x04, %%o1 ! Z flag\n" + " bvs,a .+8\n" + " or %%o1, 0x02, %%o1 ! V flag\n" + " stb %%o1, [%1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +static inline uae_u32 sparc_v8_flag_add_16(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " sll %2, 16, %%o0\n" + " sll %3, 16, %%o1\n" + " addcc %%o0, %%o1, %%o0\n" + " addx %%g0, %%g0, %%o1 ! X,C flags\n" + " srl %%o0, 16, %0\n" + " stb %%o1, [%1 + 1]\n" + " bl,a .+8\n" + " or %%o1, 0x08, %%o1 ! N flag\n" + " bz,a .+8\n" + " or %%o1, 0x04, %%o1 ! Z flag\n" + " bvs,a .+8\n" + " or %%o1, 0x02, %%o1 ! V flag\n" + " stb %%o1, [%1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +static inline uae_u32 sparc_v8_flag_add_32(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " addcc %2, %3, %0\n" + " addx %%g0, %%g0, %%o0 ! X,C flags\n" + " stb %%o0, [%1 + 1]\n" + " bl,a .+8\n" + " or %%o0, 0x08, %%o0 ! N flag\n" + " bz,a .+8\n" + " or %%o0, 0x04, %%o0 ! Z flag\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0 ! V flag\n" + " stb %%o0, [%1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0" + ); + return value; +} + +static inline uae_u32 sparc_v8_flag_sub_8(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " sll %2, 24, %%o0\n" + " sll %3, 24, %%o1\n" + " subcc %%o0, %%o1, %%o0\n" + " addx %%g0, %%g0, %%o1 ! X,C flags\n" + " srl %%o0, 24, %0\n" + " stb %%o1, [%1 + 1]\n" + " bl,a .+8\n" + " or %%o1, 0x08, %%o1 ! N flag\n" + " bz,a .+8\n" + " or %%o1, 0x04, %%o1 ! Z flag\n" + " bvs,a .+8\n" + " or %%o1, 0x02, %%o1 ! V flag\n" + " stb %%o1, [%1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +static inline uae_u32 sparc_v8_flag_sub_16(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " sll %2, 16, %%o0\n" + " sll %3, 16, %%o1\n" + " subcc %%o0, %%o1, %%o0\n" + " addx %%g0, %%g0, %%o1 ! X,C flags\n" + " srl %%o0, 16, %0\n" + " stb %%o1, [%1 + 1]\n" + " bl,a .+8\n" + " or %%o1, 0x08, %%o1 ! N flag\n" + " bz,a .+8\n" + " or %%o1, 0x04, %%o1 ! Z flag\n" + " bvs,a .+8\n" + " or %%o1, 0x02, %%o1 ! V flag\n" + " stb %%o1, [%1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +static inline uae_u32 sparc_v8_flag_sub_32(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " subcc %2, %3, %0\n" + " addx %%g0, %%g0, %%o0 ! X,C flags\n" + " stb %%o0, [%1 + 1]\n" + " bl,a .+8\n" + " or %%o0, 0x08, %%o0 ! N flag\n" + " bz,a .+8\n" + " or %%o0, 0x04, %%o0 ! Z flag\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0 ! V flag\n" + " stb %%o0, [%1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0" + ); + return value; +} + +static inline void sparc_v8_flag_cmp_8(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + __asm__ ("\n" + " sll %1, 24, %%o0\n" + " sll %2, 24, %%o1\n" + " subcc %%o0, %%o1, %%g0\n" + " addx %%g0, %%g0, %%o0 ! C flag\n" + " bl,a .+8\n" + " or %%o0, 0x08, %%o0 ! N flag\n" + " bz,a .+8\n" + " or %%o0, 0x04, %%o0 ! Z flag\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0 ! V flag\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); +} + +static inline void sparc_v8_flag_cmp_16(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + __asm__ ("\n" + " sll %1, 16, %%o0\n" + " sll %2, 16, %%o1\n" + " subcc %%o0, %%o1, %%g0\n" + " addx %%g0, %%g0, %%o0 ! C flag\n" + " bl,a .+8\n" + " or %%o0, 0x08, %%o0 ! N flag\n" + " bz,a .+8\n" + " or %%o0, 0x04, %%o0 ! Z flag\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0 ! V flag\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); +} + +static inline void sparc_v8_flag_cmp_32(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + __asm__ ("\n" + " subcc %1, %2, %%o1\n" + " srl %%o1, 31, %%o0\n" + " sll %%o0, 3, %%o0\n" + " addx %%o0, %%g0, %%o0\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0\n" + " subcc %%g0, %%o1, %%g0\n" + " addx %%g0, 7, %%o1\n" + " and %%o1, 0x04, %%o1\n" + " or %%o0, %%o1, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); +} + +static inline uae_u32 sparc_v8_flag_addx_8(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " ldub [%1 + 1], %%o1 ! Get the X Flag\n" + " subcc %%g0, %%o1, %%g0 ! Set the SPARC carry flag, if X set\n" + " addxcc %2, %3, %0\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +#if 0 +VERY SLOW... +static inline uae_u32 sparc_v8_flag_addx_8(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " sll %2, 24, %%o0\n" + " sll %3, 24, %%o1\n" + " addcc %%o0, %%o1, %%o0\n" + " addx %%g0, %%g0, %%o1 ! X,C flags\n" + " bvs,a .+8\n" + " or %%o1, 0x02, %%o1 ! V flag\n" + " ldub [%1 + 1], %%o2\n" + " subcc %%g0, %%o2, %%g0\n" + " addx %%g0, %%g0, %%o2\n" + " sll %%o2, 24, %%o2\n" + " addcc %%o0, %%o2, %%o0\n" + " srl %%o0, 24, %0\n" + " addx %%g0, %%g0, %%o2\n" + " or %%o1, %%o2, %%o1 ! update X,C flags\n" + " bl,a .+8\n" + " or %%o1, 0x08, %%o1 ! N flag\n" + " ldub [%1], %%o0 ! retreive the old NZVC flags (XXX)\n" + " bvs,a .+8\n" + " or %%o1, 0x02, %%o1 ! update V flag\n" + " and %%o0, 0x04, %%o0 ! (XXX) but keep only Z flag\n" + " and %%o1, 1, %%o2 ! keep C flag in %%o2\n" + " bnz,a .+8\n" + " or %%g0, %%g0, %%o0 ! Z flag cleared if non-zero result\n" + " stb %%o2, [%1 + 1] ! store the X flag\n" + " or %%o1, %%o0, %%o1\n" + " stb %%o1, [%1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1", "o2" + ); + return value; +} +#endif + +static inline uae_u32 sparc_v8_flag_addx_32(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " ldub [%1 + 1], %%o0 ! Get the X Flag\n" + " subcc %%g0, %%o0, %%g0 ! Set the SPARC carry flag, if X set\n" + " addxcc %2, %3, %0\n" + " ldub [%1], %%o0 ! retreive the old NZVC flags\n" + " and %%o0, 0x04, %%o0 ! but keep only Z flag\n" + " addx %%o0, %%g0, %%o0 ! X,C flags\n" + " bl,a .+8\n" + " or %%o0, 0x08, %%o0 ! N flag\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0 ! V flag\n" + " bnz,a .+8\n" + " and %%o0, 0x0B, %%o0 ! Z flag cleared if result is non-zero\n" + " stb %%o0, [%1]\n" + " stb %%o0, [%1 + 1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0" + ); + return value; +} + +#endif /* SPARC_V8_ASSEMBLY */ + +#ifdef SPARC_V9_ASSEMBLY + +static inline uae_u32 sparc_v9_flag_add_8(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " sll %2, 24, %%o0\n" + " sll %3, 24, %%o1\n" + " addcc %%o0, %%o1, %%o0\n" + " rd %%ccr, %%o1\n" + " srl %%o0, 24, %0\n" + " stb %%o1, [%1]\n" + " stb %%o1, [%1+1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +static inline uae_u32 sparc_v9_flag_add_16(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " sll %2, 16, %%o0\n" + " sll %3, 16, %%o1\n" + " addcc %%o0, %%o1, %%o0\n" + " rd %%ccr, %%o1\n" + " srl %%o0, 16, %0\n" + " stb %%o1, [%1]\n" + " stb %%o1, [%1+1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +static inline uae_u32 sparc_v9_flag_add_32(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " addcc %2, %3, %0\n" + " rd %%ccr, %%o0\n" + " stb %%o0, [%1]\n" + " stb %%o0, [%1+1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0" + ); + return value; +} + +static inline uae_u32 sparc_v9_flag_sub_8(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " sll %2, 24, %%o0\n" + " sll %3, 24, %%o1\n" + " subcc %%o0, %%o1, %%o0\n" + " rd %%ccr, %%o1\n" + " srl %%o0, 24, %0\n" + " stb %%o1, [%1]\n" + " stb %%o1, [%1+1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +static inline uae_u32 sparc_v9_flag_sub_16(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " sll %2, 16, %%o0\n" + " sll %3, 16, %%o1\n" + " subcc %%o0, %%o1, %%o0\n" + " rd %%ccr, %%o1\n" + " srl %%o0, 16, %0\n" + " stb %%o1, [%1]\n" + " stb %%o1, [%1+1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +static inline uae_u32 sparc_v9_flag_sub_32(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " subcc %2, %3, %0\n" + " rd %%ccr, %%o0\n" + " stb %%o0, [%1]\n" + " stb %%o0, [%1+1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0" + ); + return value; +} + +static inline void sparc_v9_flag_cmp_8(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + __asm__ ("\n" + " sll %1, 24, %%o0\n" + " sll %2, 24, %%o1\n" + " subcc %%o0, %%o1, %%g0\n" + " rd %%ccr, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); +} + +static inline void sparc_v9_flag_cmp_16(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + __asm__ ("\n" + " sll %1, 16, %%o0\n" + " sll %2, 16, %%o1\n" + " subcc %%o0, %%o1, %%g0\n" + " rd %%ccr, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); +} + +static inline void sparc_v9_flag_cmp_32(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + __asm__ ("\n" + " subcc %1, %2, %%g0\n" +#if 0 + " subcc %1, %2, %%o1\n" + " srl %%o1, 31, %%o0\n" + " sll %%o0, 3, %%o0\n" + " addx %%o0, %%g0, %%o0\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0\n" + " subcc %%g0, %%o1, %%g0\n" + " addx %%g0, 7, %%o1\n" + " and %%o1, 0x04, %%o1\n" + " or %%o0, %%o1, %%o0\n" +#endif +#if 0 + " subcc %1, %2, %%o1\n" + " srl %%o1, 31, %%o0\n" + " sll %%o0, 3, %%o0\n" + " addx %%o0, %%g0, %%o0\n" + " bvs,pt,a .+8\n" + " or %%o0, 0x02, %%o0\n" + " subcc %%g0, %%o1, %%g0\n" + " addx %%g0, 7, %%o1\n" + " and %%o1, 0x04, %%o1\n" + " or %%o0, %%o1, %%o0\n" + " stb %%o0, [%0]\n" +#endif + " rd %%ccr, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); +} + +#if 1 +static inline void sparc_v9_flag_test_8(flag_struct *flags, uae_u32 val) +{ + __asm__ ("\n" + " sll %1, 24, %%o0\n" + " subcc %%o0, %%g0, %%g0\n" + " rd %%ccr, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (val) + : "cc", "o0" + ); +} + +static inline void sparc_v9_flag_test_16(flag_struct *flags, uae_u32 val) +{ + __asm__ ("\n" + " sll %1, 16, %%o0\n" + " subcc %%o0, %%g0, %%g0\n" + " rd %%ccr, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (val) + : "cc", "o0" + ); +} + +static inline void sparc_v9_flag_test_32(flag_struct *flags, uae_u32 val) +{ + __asm__ ("\n" + " subcc %1, %%g0, %%g0\n" + " rd %%ccr, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (val) + : "cc", "o0" + ); +} +#else +static inline void sparc_v9_flag_test_8(flag_struct *flags, uae_u32 val) +{ + __asm__ ("\n" + " sll %1, 24, %%o0\n" + " subcc %%o0, %%g0, %%o1\n" + " srl %%o1, 31, %%o0\n" + " sll %%o0, 3, %%o0\n" + " addx %%o0, %%g0, %%o0\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0\n" + " subcc %%g0, %%o1, %%g0\n" + " addx %%g0, 7, %%o1\n" + " and %%o1, 0x04, %%o1\n" + " or %%o0, %%o1, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (val) + : "cc", "o0", "o1" + ); +} + +static inline void sparc_v9_flag_test_16(flag_struct *flags, uae_u32 val) +{ + __asm__ ("\n" + " sll %1, 16, %%o0\n" + " subcc %%o0, %%g0, %%o1\n" + " srl %%o1, 31, %%o0\n" + " sll %%o0, 3, %%o0\n" + " addx %%o0, %%g0, %%o0\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0\n" + " subcc %%g0, %%o1, %%g0\n" + " addx %%g0, 7, %%o1\n" + " and %%o1, 0x04, %%o1\n" + " or %%o0, %%o1, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (val) + : "cc", "o0", "o1" + ); +} + +static inline void sparc_v9_flag_test_32(flag_struct *flags, uae_u32 val) +{ + __asm__ ("\n" + " subcc %1, %%g0, %%o1\n" + " srl %%o1, 31, %%o0\n" + " sll %%o0, 3, %%o0\n" + " addx %%o0, %%g0, %%o0\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0\n" + " subcc %%g0, %%o1, %%g0\n" + " addx %%g0, 7, %%o1\n" + " and %%o1, 0x04, %%o1\n" + " or %%o0, %%o1, %%o0\n" + " stb %%o0, [%0]\n" + : /* no outputs */ + : "r" (flags), "r" (val) + : "cc", "o0", "o1" + ); +} +#endif + +static inline uae_u32 sparc_v9_flag_addx_8(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " ldub [%1 + 1], %%o1 ! Get the X Flag\n" + " subcc %%g0, %%o1, %%g0 ! Set the SPARC carry flag, if X set\n" + " addxcc %2, %3, %0\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0", "o1" + ); + return value; +} + +static inline uae_u32 sparc_v9_flag_addx_32(flag_struct *flags, uae_u32 src, uae_u32 dst) +{ + uae_u32 value; + __asm__ ("\n" + " ldub [%1 + 1], %%o0 ! Get the X Flag\n" + " subcc %%g0, %%o0, %%g0 ! Set the SPARC carry flag, if X set\n" + " addxcc %2, %3, %0\n" + " ldub [%1], %%o0 ! retreive the old NZVC flags\n" + " and %%o0, 0x04, %%o0 ! but keep only Z flag\n" + " addx %%o0, %%g0, %%o0 ! X,C flags\n" + " bl,a .+8\n" + " or %%o0, 0x08, %%o0 ! N flag\n" + " bvs,a .+8\n" + " or %%o0, 0x02, %%o0 ! V flag\n" + " bnz,a .+8\n" + " and %%o0, 0x0B, %%o0 ! Z flag cleared if result is non-zero\n" + " stb %%o0, [%1]\n" + " stb %%o0, [%1 + 1]\n" + : "=&r" (value) + : "r" (flags), "r" (dst), "r" (src) + : "cc", "o0" + ); + return value; +} + +#endif /* SPARC_V9_ASSEMBLY */ + +#endif /* SPARC_ASSEMBLY__HEADER */ diff --git a/BasiliskII/src/Unix/Solaris/which_sparc b/BasiliskII/src/Unix/Solaris/which_sparc new file mode 100755 index 00000000..fb386a4f --- /dev/null +++ b/BasiliskII/src/Unix/Solaris/which_sparc @@ -0,0 +1,117 @@ +#!/bin/sh + +# WHICH_SPARC +# +# This script generates a program that tests for a SPARC processor class +# Program returns: +# 0 unknown SPARC processor +# 8 SPARC V8 `compliant' processor (umul instruction is legal) +# 9 SPARC V9 `compliant' processor (popc instruction is legal) +# +# I hope this works for other machines and OS. Tested machines are: +# Sun Ultra 10 (Solaris 7), SPARC Station 5 (Solaris 2.5.1) +# +# Gwenole Beauchesne +# gb@dial.oleane.com + +CC=gcc +PROG=./conftest +SOURCE=./conftest.c + +if [ ! -x $PROG ]; then +echo "Compiling the test program" +cat > $SOURCE << EOF +#include +#include + +typedef unsigned int uint32; +typedef uint32 (*sparc_code_func)(void); + +#define SPARC_UNKNOWN 0 +#define SPARC_V8 8 +#define SPARC_V9 9 + +#define MAX_CODE_SIZE 16 +struct sparc_code_struct { + int version; + uint32 code[MAX_CODE_SIZE]; + struct sparc_code_struct * next; +}; +typedef struct sparc_code_struct sparc_code_struct; + +static sparc_code_struct *current_test_code; + +static sparc_code_struct unknown_sparc_code = +{ + SPARC_UNKNOWN, + { + 0x81C3E008, /* retl */ + 0x01000000 /* nop */ + } +}; + +static sparc_code_struct sparc_v9_code = +{ + SPARC_V9, + { + 0x81C3E008, /* retl */ + 0x81702007 /* popc 7, %g0 */ + } +}; + +static sparc_code_struct sparc_v8_code = +{ + SPARC_V8, + { + 0x90102002, /* mov 2, %o0 */ + 0x81C3E008, /* retl */ + 0x90520008 /* umul %o0, %o0, %o0 */ + } +}; + +static void test_sparc_code(int unused_int) +{ + sparc_code_struct *tested_code = current_test_code; + + if (current_test_code == NULL) + exit(SPARC_UNKNOWN); + + signal(SIGILL, test_sparc_code); + current_test_code = current_test_code->next; + (void) ((sparc_code_func)(tested_code->code))(); + exit(tested_code->version); +} + +int main(void) +{ + sparc_v9_code.next = &sparc_v8_code; + sparc_v8_code.next = &unknown_sparc_code; + unknown_sparc_code.next = NULL; + + signal(SIGILL, test_sparc_code); + current_test_code = &sparc_v9_code; + raise(SIGILL); + + return 0; +} +EOF + +$CC -o $PROG $SOURCE +if [ $? -ne 0 ]; then + echo "Error: could not compile the test program" + exit 1 +fi + +fi + +$PROG +case $? in + 0) echo "unknown SPARC architecture";; + 8) echo "SPARC V8 compliant processor";; + 9) echo "SPARC V9 compliant processor";; +esac + +rm -f $PROG +rm -f $SOURCE + +exit 0 diff --git a/BasiliskII/src/Unix/config.h.in b/BasiliskII/src/Unix/config.h.in index 668e1290..775e15b9 100644 --- a/BasiliskII/src/Unix/config.h.in +++ b/BasiliskII/src/Unix/config.h.in @@ -9,9 +9,6 @@ /* Define to `long' if doesn't define. */ #undef off_t -/* Define to `off_t' if doesn't define. */ -#undef loff_t - /* Define to `unsigned' if doesn't define. */ #undef size_t @@ -61,9 +58,6 @@ /* Define if you have the sem_init function. */ #undef HAVE_SEM_INIT -/* Define if you have the semget function. */ -#undef HAVE_SEMGET - /* Define if you have the strdup function. */ #undef HAVE_STRDUP diff --git a/BasiliskII/src/Unix/configure b/BasiliskII/src/Unix/configure index 82da4796..6894b88a 100755 --- a/BasiliskII/src/Unix/configure +++ b/BasiliskII/src/Unix/configure @@ -12,7 +12,9 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help - --enable-dga use the DGA extension (default)" + --enable-xf86-dga use the XFree86 DGA extension (default)" +ac_help="$ac_help + --enable-fbdev-dga use direct frame buffer access via /dev/fb (default)" ac_help="$ac_help --enable-ui use GTK user interface (default)" ac_help="$ac_help @@ -536,12 +538,19 @@ fi -WANT_DGA=yes +WANT_XF86_DGA=yes +WANT_FBDEV_DGA=yes WANT_UI=yes -# Check whether --enable-dga or --disable-dga was given. -if test "${enable_dga+set}" = set; then - enableval="$enable_dga" - WANT_DGA=$enableval +# Check whether --enable-xf86-dga or --disable-xf86-dga was given. +if test "${enable_xf86_dga+set}" = set; then + enableval="$enable_xf86_dga" + WANT_XF86_DGA=$enableval +fi + +# Check whether --enable-fbdev-dga or --disable-fbdev-dga was given. +if test "${enable_fbdev_dga+set}" = set; then + enableval="$enable_fbdev_dga" + WANT_FBDEV_DGA=$enableval fi # Check whether --enable-ui or --disable-ui was given. @@ -554,7 +563,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:558: checking for $ac_word" >&5 +echo "configure:567: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -584,7 +593,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:588: checking for $ac_word" >&5 +echo "configure:597: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -635,7 +644,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:639: checking for $ac_word" >&5 +echo "configure:648: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -667,7 +676,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:671: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:680: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -678,12 +687,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 682 "configure" +#line 691 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:687: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:696: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -709,12 +718,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:713: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:722: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:718: checking whether we are using GNU C" >&5 +echo "configure:727: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -723,7 +732,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:727: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -742,7 +751,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:746: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:755: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -774,7 +783,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:778: checking how to run the C preprocessor" >&5 +echo "configure:787: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -789,13 +798,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -806,13 +815,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -823,13 +832,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -858,7 +867,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:862: checking for $ac_word" >&5 +echo "configure:871: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -890,7 +899,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:894: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:903: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -901,12 +910,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 905 "configure" +#line 914 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -932,12 +941,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:936: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:945: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:941: checking whether we are using GNU C++" >&5 +echo "configure:950: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -946,7 +955,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -965,7 +974,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:969: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:978: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -997,7 +1006,7 @@ else fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1001: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1010: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1054,7 +1063,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1058: checking for a BSD compatible install" >&5 +echo "configure:1067: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1112,7 +1121,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1116: checking for X" >&5 +echo "configure:1125: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1174,12 +1183,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1183: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1192: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1248,14 +1257,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1268: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -1361,17 +1370,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:1365: checking whether -R must be followed by a space" >&5 +echo "configure:1374: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -1387,14 +1396,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -1426,7 +1435,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:1430: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:1439: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1434,7 +1443,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1467,7 +1476,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:1471: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:1480: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1475,7 +1484,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1515,12 +1524,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:1519: checking for gethostbyname" >&5 +echo "configure:1528: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -1564,7 +1573,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:1568: checking for gethostbyname in -lnsl" >&5 +echo "configure:1577: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1572,7 +1581,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1613,12 +1622,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:1617: checking for connect" >&5 +echo "configure:1626: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -1662,7 +1671,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:1666: checking for connect in -lsocket" >&5 +echo "configure:1675: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1670,7 +1679,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1705,12 +1714,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:1709: checking for remove" >&5 +echo "configure:1718: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -1754,7 +1763,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:1758: checking for remove in -lposix" >&5 +echo "configure:1767: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1762,7 +1771,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1797,12 +1806,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:1801: checking for shmat" >&5 +echo "configure:1810: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -1846,7 +1855,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:1850: checking for shmat in -lipc" >&5 +echo "configure:1859: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1854,7 +1863,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1898,7 +1907,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:1902: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:1911: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1906,7 +1915,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1951,7 +1960,7 @@ LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS" STATICLIBS= echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:1955: checking for pthread_create in -lpthread" >&5 +echo "configure:1964: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1959,7 +1968,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1993,7 +2002,7 @@ fi if [ "x$HAVE_PTHREADS" = "xno" ]; then echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:1997: checking for pthread_create in -lc_r" >&5 +echo "configure:2006: checking for pthread_create in -lc_r" >&5 ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2001,7 +2010,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lc_r $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2035,7 +2044,7 @@ fi if [ "x$HAVE_PTHREADS" = "xno" ]; then echo $ac_n "checking for pthread_create in -lPTL""... $ac_c" 1>&6 -echo "configure:2039: checking for pthread_create in -lPTL" >&5 +echo "configure:2048: checking for pthread_create in -lPTL" >&5 ac_lib_var=`echo PTL'_'pthread_create | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2043,7 +2052,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lPTL $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2089,12 +2098,12 @@ fi for ac_func in pthread_cancel do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2093: checking for $ac_func" >&5 +echo "configure:2102: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2142,9 +2151,9 @@ fi done -if [ "x$WANT_DGA" = "xyes" ]; then +if [ "x$WANT_XF86_DGA" = "xyes" ]; then echo $ac_n "checking for XF86DGAQueryExtension in -lXxf86dga""... $ac_c" 1>&6 -echo "configure:2148: checking for XF86DGAQueryExtension in -lXxf86dga" >&5 +echo "configure:2157: checking for XF86DGAQueryExtension in -lXxf86dga" >&5 ac_lib_var=`echo Xxf86dga'_'XF86DGAQueryExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2152,7 +2161,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lXxf86dga $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2176: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2185,11 +2194,23 @@ HAVE_DGA=no fi if [ "x$HAVE_DGA" = "xno" ]; then - echo "configure: warning: Could not find DGA extension, ignoring --enable-dga." 1>&2 + echo "configure: warning: Could not find XFree86 DGA extension, ignoring --enable-xf86-dga." 1>&2 + DEFINES="$DEFINES -DENABLE_XF86_DGA=0" else - DEFINES="$DEFINES -DENABLE_DGA=1" + DEFINES="$DEFINES -DENABLE_XF86_DGA=1" LIBS="$LIBS -lXxf86dga" + if [ "x$WANT_FBDEV_DGA" = "xyes" ]; then + echo "configure: warning: Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga." 1>&2 + WANT_FBDEV_DGA=no + fi fi +else + DEFINES="$DEFINES -DENABLE_XF86_DGA=0" +fi +if [ "x$WANT_FBDEV_DGA" = "xyes" ]; then + DEFINES="$DEFINES -DENABLE_FBDEV_DGA=1" +else + DEFINES="$DEFINES -DENABLE_FBDEV_DGA=0" fi if [ "x$WANT_UI" = "xyes" ]; then @@ -2234,7 +2255,7 @@ fi # Extract the first word of "gtk-config", so it can be a program name with args. set dummy gtk-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2238: checking for $ac_word" >&5 +echo "configure:2259: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2269,7 +2290,7 @@ fi min_gtk_version=1.2.0 echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6 -echo "configure:2273: checking for GTK - version >= $min_gtk_version" >&5 +echo "configure:2294: checking for GTK - version >= $min_gtk_version" >&5 no_gtk="" if test "$GTK_CONFIG" = "no" ; then no_gtk=yes @@ -2292,7 +2313,7 @@ echo "configure:2273: checking for GTK - version >= $min_gtk_version" >&5 echo $ac_n "cross compiling; assumed OK... $ac_c" else cat > conftest.$ac_ext < @@ -2355,7 +2376,7 @@ main () } EOF -if { (eval echo configure:2359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2389,7 +2410,7 @@ fi CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS" cat > conftest.$ac_ext < @@ -2399,7 +2420,7 @@ int main() { return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ; return 0; } EOF -if { (eval echo configure:2403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding GTK or finding the wrong" @@ -2454,12 +2475,12 @@ SEMSRCS= for ac_func in sem_init do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2458: checking for $ac_func" >&5 +echo "configure:2479: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2508,7 +2529,7 @@ done if [ "x$ac_cv_func_sem_init" = "xno" ]; then echo $ac_n "checking for sem_init in -lposix4""... $ac_c" 1>&6 -echo "configure:2512: checking for sem_init in -lposix4" >&5 +echo "configure:2533: checking for sem_init in -lposix4" >&5 ac_lib_var=`echo posix4'_'sem_init | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2516,7 +2537,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2556,12 +2577,12 @@ fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2560: checking for ANSI C header files" >&5 +echo "configure:2581: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2569,7 +2590,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2573: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2594: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2586,7 +2607,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2604,7 +2625,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2625,7 +2646,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2636,7 +2657,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2663,17 +2684,17 @@ for ac_hdr in unistd.h fcntl.h sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2667: checking for $ac_hdr" >&5 +echo "configure:2688: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2677: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2701,14 +2722,14 @@ done echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:2705: checking whether byte ordering is bigendian" >&5 +echo "configure:2726: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -2719,11 +2740,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2744: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -2734,7 +2755,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:2738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -2754,7 +2775,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -2791,12 +2812,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2795: checking for working const" >&5 +echo "configure:2816: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2870: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2866,21 +2887,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:2870: checking for inline" >&5 +echo "configure:2891: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -2906,7 +2927,7 @@ EOF esac echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:2910: checking size of short" >&5 +echo "configure:2931: checking size of short" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2914,7 +2935,7 @@ else ac_cv_sizeof_short=2 else cat > conftest.$ac_ext < main() @@ -2925,7 +2946,7 @@ main() exit(0); } EOF -if { (eval echo configure:2929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2950: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_short=`cat conftestval` else @@ -2945,7 +2966,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:2949: checking size of int" >&5 +echo "configure:2970: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2953,7 +2974,7 @@ else ac_cv_sizeof_int=4 else cat > conftest.$ac_ext < main() @@ -2964,7 +2985,7 @@ main() exit(0); } EOF -if { (eval echo configure:2968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -2984,7 +3005,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:2988: checking size of long" >&5 +echo "configure:3009: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2992,7 +3013,7 @@ else ac_cv_sizeof_long=4 else cat > conftest.$ac_ext < main() @@ -3003,7 +3024,7 @@ main() exit(0); } EOF -if { (eval echo configure:3007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -3023,7 +3044,7 @@ EOF echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:3027: checking size of long long" >&5 +echo "configure:3048: checking size of long long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3031,7 +3052,7 @@ else ac_cv_sizeof_long_long=8 else cat > conftest.$ac_ext < main() @@ -3042,7 +3063,7 @@ main() exit(0); } EOF -if { (eval echo configure:3046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long_long=`cat conftestval` else @@ -3062,12 +3083,12 @@ EOF echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3066: checking for off_t" >&5 +echo "configure:3087: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3095,12 +3116,12 @@ EOF fi echo $ac_n "checking for loff_t""... $ac_c" 1>&6 -echo "configure:3099: checking for loff_t" >&5 +echo "configure:3120: checking for loff_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_loff_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3128,12 +3149,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:3132: checking for size_t" >&5 +echo "configure:3153: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3161,12 +3182,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3165: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:3186: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3175,7 +3196,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3179: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3196,12 +3217,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:3200: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:3221: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3209,7 +3230,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:3213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -3233,12 +3254,12 @@ fi for ac_func in strdup cfmakeraw do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3237: checking for $ac_func" >&5 +echo "configure:3258: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3288,12 +3309,12 @@ done for ac_func in nanosleep clock_gettime timer_create do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3292: checking for $ac_func" >&5 +echo "configure:3313: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3349,7 +3370,7 @@ if MACHINE=`uname -a 2>/dev/null`; then ;; FreeBSD*3.*) echo $ac_n "checking for cam_open_btl in -lcam""... $ac_c" 1>&6 -echo "configure:3353: checking for cam_open_btl in -lcam" >&5 +echo "configure:3374: checking for cam_open_btl in -lcam" >&5 ac_lib_var=`echo cam'_'cam_open_btl | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3357,7 +3378,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcam $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3394,17 +3415,17 @@ fi else ac_safe=`echo "/sys/cam/cam.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for /sys/cam/cam.h""... $ac_c" 1>&6 -echo "configure:3398: checking for /sys/cam/cam.h" >&5 +echo "configure:3419: checking for /sys/cam/cam.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3408: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3429: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3437,7 +3458,7 @@ fi ;; FreeBSD*) echo $ac_n "checking for scsi_open in -lscsi""... $ac_c" 1>&6 -echo "configure:3441: checking for scsi_open in -lscsi" >&5 +echo "configure:3462: checking for scsi_open in -lscsi" >&5 ac_lib_var=`echo scsi'_'scsi_open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3445,7 +3466,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lscsi $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3481: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3482,17 +3503,17 @@ fi else ac_safe=`echo "scsi.h sys/scsiio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for scsi.h sys/scsiio.h""... $ac_c" 1>&6 -echo "configure:3486: checking for scsi.h sys/scsiio.h" >&5 +echo "configure:3507: checking for scsi.h sys/scsiio.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3496: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3531,11 +3552,11 @@ fi LIBS="$LIBS -lm" ;; esac - if [ "x$WANT_UI" = "xyes" ]; then - SYSSRCS="$SYSSRCS prefs_editor_gtk.cpp" - else - SYSSRCS="$SYSSRCS ../dummy/prefs_editor_dummy.cpp" - fi +fi +if [ "x$WANT_UI" = "xyes" ]; then + SYSSRCS="$SYSSRCS prefs_editor_gtk.cpp" +else + SYSSRCS="$SYSSRCS ../dummy/prefs_editor_dummy.cpp" fi if [ "x$SEMSRCS" != "x" ]; then SYSSRCS="$SYSSRCS $SEMSRCS" @@ -3546,9 +3567,9 @@ CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cp HAVE_I386=no echo $ac_n "checking for x86 target CPU""... $ac_c" 1>&6 -echo "configure:3550: checking for x86 target CPU" >&5 +echo "configure:3571: checking for x86 target CPU" >&5 cat > conftest.$ac_ext <&6 -echo "configure:3573: checking for GAS .p2align feature" >&5 +echo "configure:3594: checking for GAS .p2align feature" >&5 cat >conftest.S << EOF .text .p2align 5 @@ -3579,9 +3600,9 @@ echo "$ac_t""$HAVE_GAS" 1>&6 HAVE_GCC27=no echo $ac_n "checking for GCC 2.7 or higher""... $ac_c" 1>&6 -echo "configure:3583: checking for GCC 2.7 or higher" >&5 +echo "configure:3604: checking for GCC 2.7 or higher" >&5 cat > conftest.$ac_ext < 1 || __GNUC_MINOR__ - 1 > 5 yes diff --git a/BasiliskII/src/Unix/configure.in b/BasiliskII/src/Unix/configure.in index a2bf10ae..cfd70f29 100644 --- a/BasiliskII/src/Unix/configure.in +++ b/BasiliskII/src/Unix/configure.in @@ -6,9 +6,11 @@ AC_PREREQ(2.12) AC_CONFIG_HEADER(config.h) dnl Options. -WANT_DGA=yes +WANT_XF86_DGA=yes +WANT_FBDEV_DGA=yes WANT_UI=yes -AC_ARG_ENABLE(dga, [ --enable-dga use the DGA extension (default)], [WANT_DGA=$enableval], []) +AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension (default)], [WANT_XF86_DGA=$enableval], []) +AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb (default)], [WANT_FBDEV_DGA=$enableval], []) AC_ARG_ENABLE(ui, [ --enable-ui use GTK user interface (default)], [WANT_UI=$enableval], []) dnl Checks for programs. @@ -51,14 +53,26 @@ fi AC_CHECK_FUNCS(pthread_cancel) dnl We use DGA if possible. -if [[ "x$WANT_DGA" = "xyes" ]]; then +if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, HAVE_DGA=yes, HAVE_DGA=no) if [[ "x$HAVE_DGA" = "xno" ]]; then - AC_MSG_WARN([Could not find DGA extension, ignoring --enable-dga.]) + AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.]) + DEFINES="$DEFINES -DENABLE_XF86_DGA=0" else - DEFINES="$DEFINES -DENABLE_DGA=1" + DEFINES="$DEFINES -DENABLE_XF86_DGA=1" LIBS="$LIBS -lXxf86dga" + if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then + AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.]) + WANT_FBDEV_DGA=no + fi fi +else + DEFINES="$DEFINES -DENABLE_XF86_DGA=0" +fi +if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then + DEFINES="$DEFINES -DENABLE_FBDEV_DGA=1" +else + DEFINES="$DEFINES -DENABLE_FBDEV_DGA=0" fi dnl We use GTK+ if possible. @@ -165,11 +179,11 @@ if MACHINE=`uname -a 2>/dev/null`; then LIBS="$LIBS -lm" ;; esac - if [[ "x$WANT_UI" = "xyes" ]]; then - SYSSRCS="$SYSSRCS prefs_editor_gtk.cpp" - else - SYSSRCS="$SYSSRCS ../dummy/prefs_editor_dummy.cpp" - fi +fi +if [[ "x$WANT_UI" = "xyes" ]]; then + SYSSRCS="$SYSSRCS prefs_editor_gtk.cpp" +else + SYSSRCS="$SYSSRCS ../dummy/prefs_editor_dummy.cpp" fi if [[ "x$SEMSRCS" != "x" ]]; then SYSSRCS="$SYSSRCS $SEMSRCS" diff --git a/BasiliskII/src/Unix/fbdevices b/BasiliskII/src/Unix/fbdevices new file mode 100644 index 00000000..beab15cf --- /dev/null +++ b/BasiliskII/src/Unix/fbdevices @@ -0,0 +1,14 @@ +# ------------------------------------------------------------------------------ +# device depth offset for mmap(2) +# ------------------------------------------------------------------------------ + +# Frame buffers known to work +cgsix 8 0x70016000 +tcx 8 0x00000000 + +# Untested frame buffers +cgthree 8 0x04000000 +cgtwo 8 0x00000000 +cgfour 8 0x00000000 +cgeight 24 0x00000000 +tcx 24 0x01000000 diff --git a/BasiliskII/src/Unix/user_strings_unix.cpp b/BasiliskII/src/Unix/user_strings_unix.cpp index ebfc11f2..fab14538 100644 --- a/BasiliskII/src/Unix/user_strings_unix.cpp +++ b/BasiliskII/src/Unix/user_strings_unix.cpp @@ -34,6 +34,9 @@ user_string_def platform_strings[] = { {STR_NO_XSERVER_ERR, "Cannot connect to X server '%s'."}, {STR_NO_XVISUAL_ERR, "Cannot obtain appropriate X visual."}, {STR_UNSUPP_DEPTH_ERR, "Unsupported color depth of screen."}, + {STR_NO_FBDEVICE_FILE_ERR, "Cannot open frame buffer device specification file %s (%s)."}, + {STR_FBDEV_NAME_ERR, "The %s frame buffer is not supported in %d bit mode."}, + {STR_FBDEV_MMAP_ERR, "Cannot mmap() the frame buffer memory (%s)."}, {STR_NO_SHEEP_NET_DRIVER_WARN, "Cannot open %s (%s). Ethernet will not be available."}, {STR_SHEEP_NET_ATTACH_WARN, "Cannot attach to Ethernet card (%s). Ethernet will not be available."}, {STR_SCSI_DEVICE_OPEN_WARN, "Cannot open %s (%s). SCSI Manager access to this device will be disabled."}, diff --git a/BasiliskII/src/Unix/user_strings_unix.h b/BasiliskII/src/Unix/user_strings_unix.h index 6231fab5..c5611c98 100644 --- a/BasiliskII/src/Unix/user_strings_unix.h +++ b/BasiliskII/src/Unix/user_strings_unix.h @@ -25,6 +25,9 @@ enum { STR_NO_XSERVER_ERR = 10000, STR_NO_XVISUAL_ERR, STR_UNSUPP_DEPTH_ERR, + STR_NO_FBDEVICE_FILE_ERR, + STR_FBDEV_NAME_ERR, + STR_FBDEV_MMAP_ERR, STR_NO_SHEEP_NET_DRIVER_WARN, STR_SHEEP_NET_ATTACH_WARN, diff --git a/BasiliskII/src/Unix/video_x.cpp b/BasiliskII/src/Unix/video_x.cpp index 4a4d43b1..a841a20d 100644 --- a/BasiliskII/src/Unix/video_x.cpp +++ b/BasiliskII/src/Unix/video_x.cpp @@ -48,10 +48,15 @@ #define DEBUG 1 #include "debug.h" -#if ENABLE_DGA +#if ENABLE_XF86_DGA #include #endif +#if ENABLE_FBDEV_DGA +#include +#endif + + // Display types enum { @@ -62,6 +67,7 @@ enum { // Constants const char KEYCODE_FILE_NAME[] = DATADIR "/keycodes"; +const char FBDEVICES_FILE_NAME[] = DATADIR "/fbdevices"; // Global variables @@ -115,13 +121,16 @@ static uint8 *the_buffer_copy = NULL; // Copy of Mac frame buffer static uint8 the_cursor[64]; // Cursor image data static bool have_shm = false; // Flag: SHM extensions available -// Variables for DGA mode +// Variables for XF86 DGA mode static int current_dga_cmap; // Number (0 or 1) of currently installed DGA colormap static Window suspend_win; // "Suspend" window static void *fb_save = NULL; // Saved frame buffer for suspend - static pthread_mutex_t frame_buffer_lock = PTHREAD_MUTEX_INITIALIZER; // Mutex to protect frame buffer +// Variables for fbdev DGA mode +const char FBDEVICE_FILE_NAME[] = "/dev/fb"; +static int fbdev_fd; + // Prototypes static void *redraw_func(void *arg); @@ -204,11 +213,13 @@ static bool init_window(int width, int height) wattr.event_mask = eventmask = win_eventmask; wattr.background_pixel = black_pixel; wattr.border_pixel = black_pixel; - wattr.backing_store = NotUseful; + wattr.backing_store = Always; + wattr.backing_planes = xdepth; XSync(x_display, false); the_win = XCreateWindow(x_display, rootwin, 0, 0, width, height, 0, xdepth, - InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel | CWBackingStore, &wattr); + InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel | + CWBackingStore | CWBackingPlanes, &wattr); XSync(x_display, false); XStoreName(x_display, the_win, GetString(STR_WINDOW_TITLE)); XMapRaised(x_display, the_win); @@ -231,7 +242,7 @@ static bool init_window(int width, int height) XSetWMNormalHints(x_display, the_win, hints); XFree((char *)hints); } - + // Try to create and attach SHM image have_shm = false; if (depth != 1 && XShmQueryExtension(x_display)) { @@ -258,7 +269,7 @@ static bool init_window(int width, int height) shmctl(shminfo.shmid, IPC_RMID, 0); } } - + // Create normal X image if SHM doesn't work ("height + 2" for safety) if (!have_shm) { int bytes_per_row = width; @@ -311,6 +322,7 @@ static bool init_window(int width, int height) #else set_video_monitor(width, height, img->bytes_per_line, img->bitmap_bit_order == LSBFirst); #endif + #if REAL_ADDRESSING VideoMonitor.mac_frame_base = (uint32)the_buffer; MacFrameLayout = FLAYOUT_DIRECT; @@ -320,10 +332,152 @@ static bool init_window(int width, int height) return true; } -// Init DGA display -static bool init_dga(int width, int height) +// Init fbdev DGA display +static bool init_fbdev_dga(char *in_fb_name) { -#if ENABLE_DGA +#if ENABLE_FBDEV_DGA + // Find the maximum depth available + int ndepths, max_depth(0); + int *depths = XListDepths(x_display, screen, &ndepths); + if (depths == NULL) { + fprintf(stderr, "Error: could not determine the maximal depth available\n"); + return false; + } else { + while (ndepths-- > 0) { + if (depths[ndepths] > max_depth) + max_depth = depths[ndepths]; + } + } + + // Get fbdevices file path from preferences + const char *fbd_path = PrefsFindString("fbdevices"); + + // Open fbdevices file + FILE *fp = fopen(fbd_path ? fbd_path : FBDEVICES_FILE_NAME, "r"); + if (fp == NULL) { + char str[256]; + sprintf(str, GetString(STR_NO_FBDEVICE_FILE_ERR), fbd_path ? fbd_path : FBDEVICES_FILE_NAME, strerror(errno)); + ErrorAlert(str); + return false; + } + + int fb_depth; // supported depth + uint32 fb_offset; // offset used for mmap(2) + char fb_name[20]; + char line[256]; + bool device_found = false; + while (fgets(line, 255, fp)) { + // Read line + int len = strlen(line); + if (len == 0) + continue; + line[len - 1] = '\0'; + + // Comments begin with "#" or ";" + if ((line[0] == '#') || (line[0] == ';') || (line[0] == '\0')) + continue; + + if ((sscanf(line, "%s %d %x", &fb_name, &fb_depth, &fb_offset) == 3) + && (strcmp(fb_name, in_fb_name) == 0) && (fb_depth == max_depth)) { + device_found = true; + break; + } + } + + // fbdevices file completely read + fclose(fp); + + // Frame buffer name not found ? Then, display warning + if (!device_found) { + char str[256]; + sprintf(str, GetString(STR_FBDEV_NAME_ERR), in_fb_name, max_depth); + ErrorAlert(str); + return false; + } + + int width = DisplayWidth(x_display, screen); + int height = DisplayHeight(x_display, screen); + depth = fb_depth; // max_depth + + // Set relative mouse mode + ADBSetRelMouseMode(false); + + // Create window + XSetWindowAttributes wattr; + wattr.override_redirect = True; + wattr.backing_store = NotUseful; + wattr.background_pixel = white_pixel; + wattr.border_pixel = black_pixel; + wattr.event_mask = eventmask = dga_eventmask; + + XSync(x_display, false); + the_win = XCreateWindow(x_display, rootwin, + 0, 0, width, height, + 0, xdepth, InputOutput, vis, + CWEventMask|CWBackPixel|CWBorderPixel|CWOverrideRedirect|CWBackingStore, + &wattr); + XSync(x_display, false); + XMapRaised(x_display, the_win); + XSync(x_display, false); + + // Grab mouse and keyboard + XGrabKeyboard(x_display, the_win, True, + GrabModeAsync, GrabModeAsync, CurrentTime); + XGrabPointer(x_display, the_win, True, + PointerMotionMask | ButtonPressMask | ButtonReleaseMask, + GrabModeAsync, GrabModeAsync, the_win, None, CurrentTime); + + // Set colormap + if (depth == 8) { + XSetWindowColormap(x_display, the_win, cmap[current_dga_cmap = 0]); + XSetWMColormapWindows(x_display, the_win, &the_win, 1); + } + + // Set VideoMonitor + int bytes_per_row = width; + switch (depth) { + case 1: + bytes_per_row = ((width | 7) & ~7) >> 3; + break; + case 15: + case 16: + bytes_per_row *= 2; + break; + case 24: + case 32: + bytes_per_row *= 4; + break; + } + + if ((the_buffer = (uint8 *) mmap(NULL, height * bytes_per_row, PROT_READ | PROT_WRITE, MAP_PRIVATE, fbdev_fd, fb_offset)) == MAP_FAILED) { + if ((the_buffer = (uint8 *) mmap(NULL, height * bytes_per_row, PROT_READ | PROT_WRITE, MAP_SHARED, fbdev_fd, fb_offset)) == MAP_FAILED) { + char str[256]; + sprintf(str, GetString(STR_FBDEV_MMAP_ERR), strerror(errno)); + ErrorAlert(str); + return false; + } + } + + set_video_monitor(width, height, bytes_per_row, true); +#if REAL_ADDRESSING + VideoMonitor.mac_frame_base = (uint32)the_buffer; + MacFrameLayout = FLAYOUT_DIRECT; +#else + VideoMonitor.mac_frame_base = MacFrameBaseMac; +#endif + + printf("FbDev DGA with %s in %d-bit mode enabled\n", fb_name, fb_depth); + return true; +#else + ErrorAlert("Basilisk II has been compiled with fbdev DGA support disabled."); + return false; +#endif +} + +// Init XF86 DGA display +static bool init_xf86_dga(int width, int height) +{ +#if ENABLE_XF86_DGA // Set relative mouse mode ADBSetRelMouseMode(true); @@ -384,7 +538,7 @@ static bool init_dga(int width, int height) #endif return true; #else - ErrorAlert("Basilisk II has been compiled with DGA support disabled."); + ErrorAlert("Basilisk II has been compiled with XF86 DGA support disabled."); return false; #endif } @@ -462,11 +616,22 @@ bool VideoInit(bool classic) // Find screen and root window screen = XDefaultScreen(x_display); rootwin = XRootWindow(x_display, screen); - + // Get screen depth xdepth = DefaultDepth(x_display, screen); - -#if ENABLE_DGA + +#if ENABLE_FBDEV_DGA + // Frame buffer name + char fb_name[20]; + + // Could do fbdev dga ? + if ((fbdev_fd = open(FBDEVICE_FILE_NAME, O_RDWR)) != -1) + has_dga = true; + else + has_dga = false; +#endif + +#if ENABLE_XF86_DGA // DGA available? int event_base, error_base; if (XF86DGAQueryExtension(x_display, &event_base, &error_base)) { @@ -542,7 +707,11 @@ bool VideoInit(bool classic) if (mode_str) { if (sscanf(mode_str, "win/%d/%d", &width, &height) == 2) display_type = DISPLAY_WINDOW; +#if ENABLE_FBDEV_DGA + else if (has_dga && sscanf(mode_str, "dga/%s", fb_name) == 1) { +#else else if (has_dga && sscanf(mode_str, "dga/%d/%d", &width, &height) == 2) { +#endif display_type = DISPLAY_DGA; if (width > DisplayWidth(x_display, screen)) width = DisplayWidth(x_display, screen); @@ -562,7 +731,11 @@ bool VideoInit(bool classic) return false; break; case DISPLAY_DGA: - if (!init_dga(width, height)) +#if ENABLE_FBDEV_DGA + if (!init_fbdev_dga(fb_name)) +#else + if (!init_xf86_dga(width, height)) +#endif return false; break; } @@ -612,7 +785,7 @@ void VideoExit(void) if (x_display != NULL) { XSync(x_display, false); -#if ENABLE_DGA +#if ENABLE_XF86_DGA if (display_type == DISPLAY_DGA) { XF86DGADirectVideo(x_display, screen, 0); XUngrabPointer(x_display, CurrentTime); @@ -620,6 +793,14 @@ void VideoExit(void) } #endif +#if ENABLE_FBDEV_DGA + if (display_type == DISPLAY_DGA) { + XUngrabPointer(x_display, CurrentTime); + XUngrabKeyboard(x_display, CurrentTime); + close(fbdev_fd); + } +#endif + if (the_buffer_copy) { free(the_buffer_copy); the_buffer_copy = NULL; @@ -692,7 +873,7 @@ void video_set_palette(uint8 *pal) * Suspend/resume emulator */ -#if ENABLE_DGA +#if ENABLE_XF86_DGA || ENABLE_FBDEV_DGA static void suspend_emul(void) { if (display_type == DISPLAY_DGA) { @@ -709,7 +890,9 @@ static void suspend_emul(void) memcpy(fb_save, the_buffer, VideoMonitor.y * VideoMonitor.bytes_per_row); // Close full screen display +#if ENABLE_XF86_DGA XF86DGADirectVideo(x_display, screen, 0); +#endif XUngrabPointer(x_display, CurrentTime); XUngrabKeyboard(x_display, CurrentTime); XUnmapWindow(x_display, the_win); @@ -723,6 +906,7 @@ static void suspend_emul(void) wattr.backing_store = Always; wattr.backing_planes = xdepth; wattr.colormap = DefaultColormap(x_display, screen); + XSync(x_display, false); suspend_win = XCreateWindow(x_display, rootwin, 0, 0, 512, 1, 0, xdepth, InputOutput, vis, CWEventMask | CWBackPixel | CWBorderPixel | @@ -747,8 +931,10 @@ static void resume_emul(void) XSync(x_display, false); XGrabKeyboard(x_display, rootwin, 1, GrabModeAsync, GrabModeAsync, CurrentTime); XGrabPointer(x_display, rootwin, 1, PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime); +#if ENABLE_XF86_DGA XF86DGADirectVideo(x_display, screen, XF86DGADirectGraphics | XF86DGADirectKeyb | XF86DGADirectMouse); XF86DGASetViewPort(x_display, screen, 0, 0); +#endif XSync(x_display, false); // Restore frame buffer @@ -757,8 +943,14 @@ static void resume_emul(void) free(fb_save); fb_save = NULL; } + if (depth == 8) +#if ENABLE_XF86_DGA XF86DGAInstallColormap(x_display, screen, cmap[current_dga_cmap]); +#endif +#if ENABLE_FBDEV_DGA + XSetWindowColormap(x_display, the_win, cmap[current_dga_cmap]); +#endif // Unlock frame buffer (and continue MacOS thread) pthread_mutex_unlock(&frame_buffer_lock); @@ -824,7 +1016,7 @@ static int kc_decode(KeySym ks) case XK_period: case XK_greater: return 0x2f; case XK_slash: case XK_question: return 0x2c; -#if ENABLE_DGA +#if ENABLE_XF86_DGA || ENABLE_FBDEV_DGA case XK_Tab: if (ctrl_down) {suspend_emul(); return -1;} else return 0x30; #else case XK_Tab: return 0x30; @@ -990,7 +1182,7 @@ static void handle_events(void) if (code == 0x36) ctrl_down = true; } else { -#if ENABLE_DGA +#if ENABLE_XF86_DGA || ENABLE_FBDEV_DGA if (code == 0x31) resume_emul(); // Space wakes us up #endif @@ -1032,7 +1224,7 @@ static void update_display(void) // In classic mode, copy the frame buffer from Mac RAM if (classic_mode) memcpy(the_buffer, Mac2HostAddr(0x3fa700), VideoMonitor.bytes_per_row * VideoMonitor.y); - + // Incremental update code int wide = 0, high = 0, x1, x2, y1, y2, i, j; int bytes_per_row = VideoMonitor.bytes_per_row; @@ -1182,7 +1374,7 @@ static void *redraw_func(void *arg) usleep(16667); #endif -#if ENABLE_DGA +#if ENABLE_XF86_DGA // Quit DGA mode if requested if (quit_full_screen) { quit_full_screen = false; @@ -1196,6 +1388,18 @@ static void *redraw_func(void *arg) } #endif +#if ENABLE_FBDEV_DGA + // Quit DGA mode if requested + if (quit_full_screen) { + quit_full_screen = false; + if (display_type == DISPLAY_DGA) { + XUngrabPointer(x_display, CurrentTime); + XUngrabKeyboard(x_display, CurrentTime); + XUnmapWindow(x_display, the_win); + XSync(x_display, false); + } + } +#endif // Handle X events handle_events(); @@ -1206,12 +1410,18 @@ static void *redraw_func(void *arg) if (depth == 8) { XStoreColors(x_display, cmap[0], palette, 256); XStoreColors(x_display, cmap[1], palette, 256); -#if ENABLE_DGA + +#if ENABLE_XF86_DGA if (display_type == DISPLAY_DGA) { current_dga_cmap ^= 1; XF86DGAInstallColormap(x_display, screen, cmap[current_dga_cmap]); } #endif + +#if ENABLE_FBDEV_DGA + if (display_type == DISPLAY_DGA) + XSetWindowColormap(x_display, the_win, cmap[current_dga_cmap]); +#endif } } pthread_mutex_unlock(&palette_lock); diff --git a/BasiliskII/src/uae_cpu/gencpu.c b/BasiliskII/src/uae_cpu/gencpu.c index 5c821539..99a671b5 100644 --- a/BasiliskII/src/uae_cpu/gencpu.c +++ b/BasiliskII/src/uae_cpu/gencpu.c @@ -24,6 +24,10 @@ #include "sysdeps.h" #include "readcpu.h" +#if defined(SPARC_V8_ASSEMBLY) || defined(SPARC_V9_ASSEMBLY) +#define SPARC_ASSEMBLY 0 +#endif + #define BOOL_TYPE "int" static FILE *headerfile; @@ -710,7 +714,156 @@ static void genflags_normal (flagtypes type, wordsizes size, char *value, char * static void genflags (flagtypes type, wordsizes size, char *value, char *src, char *dst) { -#ifdef X86_ASSEMBLY +#ifdef SPARC_V8_ASSEMBLY + switch(type) + { + case flag_add: + start_brace(); + printf("\tuae_u32 %s;\n", value); + switch(size) + { + case sz_byte: + printf("\t%s = sparc_v8_flag_add_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + case sz_word: + printf("\t%s = sparc_v8_flag_add_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + case sz_long: + printf("\t%s = sparc_v8_flag_add_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + } + return; + + case flag_sub: + start_brace(); + printf("\tuae_u32 %s;\n", value); + switch(size) + { + case sz_byte: + printf("\t%s = sparc_v8_flag_sub_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + case sz_word: + printf("\t%s = sparc_v8_flag_sub_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + case sz_long: + printf("\t%s = sparc_v8_flag_sub_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + } + return; + + case flag_cmp: + switch(size) + { + case sz_byte: +// printf("\tsparc_v8_flag_cmp_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst); + break; + case sz_word: +// printf("\tsparc_v8_flag_cmp_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst); + break; + case sz_long: +#if 1 + printf("\tsparc_v8_flag_cmp_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst); + return; +#endif + break; + } +// return; + break; + } +#elif defined(SPARC_V9_ASSEMBLY) + switch(type) + { + case flag_add: + start_brace(); + printf("\tuae_u32 %s;\n", value); + switch(size) + { + case sz_byte: + printf("\t%s = sparc_v9_flag_add_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + case sz_word: + printf("\t%s = sparc_v9_flag_add_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + case sz_long: + printf("\t%s = sparc_v9_flag_add_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + } + return; + + case flag_sub: + start_brace(); + printf("\tuae_u32 %s;\n", value); + switch(size) + { + case sz_byte: + printf("\t%s = sparc_v9_flag_sub_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + case sz_word: + printf("\t%s = sparc_v9_flag_sub_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + case sz_long: + printf("\t%s = sparc_v9_flag_sub_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", value, src, dst); + break; + } + return; + + case flag_cmp: + switch(size) + { + case sz_byte: + printf("\tsparc_v9_flag_cmp_8(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst); + break; + case sz_word: + printf("\tsparc_v9_flag_cmp_16(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst); + break; + case sz_long: + printf("\tsparc_v9_flag_cmp_32(®flags, (uae_u32)(%s), (uae_u32)(%s));\n", src, dst); + break; + } + return; + + case flag_logical: + if (strcmp(value, "0") == 0) { + printf("\tregflags.nzvc = 0x04;\n"); + } else { + switch(size) { + case sz_byte: + printf("\tsparc_v9_flag_test_8(®flags, (uae_u32)(%s));\n", value); + break; + case sz_word: + printf("\tsparc_v9_flag_test_16(®flags, (uae_u32)(%s));\n", value); + break; + case sz_long: + printf("\tsparc_v9_flag_test_32(®flags, (uae_u32)(%s));\n", value); + break; + } + } + return; + +#if 0 + case flag_logical_noclobber: + printf("\t{uae_u32 old_flags = regflags.nzvc & ~0x0C;\n"); + if (strcmp(value, "0") == 0) { + printf("\tregflags.nzvc = old_flags | 0x04;\n"); + } else { + switch(size) { + case sz_byte: + printf("\tsparc_v9_flag_test_8(®flags, (uae_u32)(%s));\n", value); + break; + case sz_word: + printf("\tsparc_v9_flag_test_16(®flags, (uae_u32)(%s));\n", value); + break; + case sz_long: + printf("\tsparc_v9_flag_test_32(®flags, (uae_u32)(%s));\n", value); + break; + } + printf("\tregflags.nzvc |= old_flags;\n"); + } + printf("\t}\n"); + return; +#endif + } +#elif defined(X86_ASSEMBLY) switch (type) { case flag_add: case flag_sub: @@ -2341,6 +2494,7 @@ static void generate_one_opcode (int rp) } fprintf (stblfile, "{ op_%lx_%d, 0, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name); fprintf (headerfile, "extern cpuop_func op_%lx_%d;\n", opcode, postfix); +/* fprintf (headerfile, "extern unsigned long REGPARAM2 op_%lx_%d(uae_u32);\n", opcode, postfix); */ printf ("unsigned long REGPARAM2 op_%lx_%d(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name); switch (table68k[opcode].stype) { @@ -2507,7 +2661,6 @@ static void generate_func (void) fprintf (stblfile, "{ 0, 0, 0 }};\n"); } - } int main (int argc, char **argv)