Morphos on Qemu not usable, any chance ?
  • Caterpillar
    Caterpillar
    Barren
    Posts: 39 from 2016/12/29
    Hi, I have an old PowerMac G5 which I still keep for those rare times I still need to use MorphOS, for those 2 or 3 programs, very seldom. But I still need them sometimes. I wanted to eventually get rid of it (it's too bulky and often fails to boot) so I decided to try Qemu.
    I followed this simple tutorial https://amigafun.wordpress.com/2020/12/30/morphos-3-14-and-qemu-5-2/ and I had some luck, despite some inaccuracy in the description I eventually managed to install and run MorphOS 3.18 on my PC.
    Fact is, despite everything seems OK at first glance, the whole thing is far from usable, because of the mouse pointer. It moves jerky, and sometimes it also has hiccups. Also, Qemu grabs the mouse pointer completely, not just when one clicks inside its window as it should be. As a result, you can't even click on your Windows desktop or grab the Qemu window bar anymore. In addition, sometimes you can't move MorphOS pointer over a certain area because the normal Windows pointer resumes moving from that position, still being far within MorphOS screen limits. Well, it seems mouse support is very poor and buggy.
    I don't know if Qemu is really so primitive or there are rather some options to improve mouse handling. I am a total newbie here, I cannot recompile it if needed nor I know anything of Linux/Unix.
    Thx
  • »27.12.24 - 22:10
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    sailor
    Posts: 408 from 2019/5/9
    From: Central Bohemi...
    @Barren
    try to use different video device: -device sm501 and newer qemu according to this Zoltan Balaton guide.
    AmigaOS3: Amiga 1200
    AmigaOS4: Micro A1-C, AmigaOne XE, Pegasos II, Sam440ep, Sam440ep-flex, Sam460LE, AmigaOneX1000
    MorphOS: Efika 5200b, Pegasos I, Sam460LE, Pegasos II, Powerbook G4, Mac Mini, iMac G5, Powermac G5 Quad
  • »27.12.24 - 22:41
    Profile
  • Caterpillar
    Caterpillar
    Barren
    Posts: 39 from 2016/12/29
    Hi Sailor and thanks for your answer, I tried with -device sm501 but there is no difference at all :(
    Also, I am *already* using the latest Windows x64 build of course (9.2.0, Dec 2024).
    The mouse pointer still has severe hiccups.
    I read somewhere that it is likely caused by a sensor.service but I can't work anything useful out of the explanation they give to fix it.

    But what is even worse is how Qemu grabs the mouse pointer movement, preventing to drag its window. Once you click in its window at beginning, it keeps controlling the mouse pointer, but when you click outside its window, it *keeps* intercepting it, which is IMHO a bug (control should return to Windows).
    Also, as I said, you can't move the mouse pointer to the very left of MorphOS screen, because at some point Windows pointer reappears and starts moving in place of MorphOS' one !
    And once I risked and enabled full-screen mode: the only way out was resetting the PC with the reset button !!!

    My question was, more generically, if somebody managed to run MorphOS with Qemu in an "usable" way, considering the preliminary problems with the mouse pointer I am encountering...
  • »28.12.24 - 00:11
    Profile
  • Order of the Butterfly
    Order of the Butterfly
    Minuous
    Posts: 163 from 2010/2/13
    ikill temperature.sensor

    should stop the momentary freezes, you could put that in your s:user-startup. Or you could emulate eg. pegasos2 guest, IIRC the freezing only happens on mac99 guest.

    Frequent use of Ctrl-Alt-G shortcut helps with keeping the pointers in sync, you move the mouse so that the host and guest pointers are at the same position over the QEMU window and then click.

    Ctrl-Alt-Del should still work to bring up Task Manager in any situation, it shouldn't be necessary to ever actually reboot the host.

    The worst problem I have is that most non-trivial applications do not work correctly even though they are OK on the real machine, which makes it useless for testing programs. Presumably some bug in the CPU emulation. At least for the pegasos2 guest on QEMU 7.2.0. Conceivably it might have been fixed in some later version of QEMU, it was 2 years ago that I set it all up.

    [ Edited by Minuous 28.12.2024 - 11:26 ]
  • »28.12.24 - 02:22
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    Tcheko
    Posts: 538 from 2003/2/25
    From: France
    Some tweaks I figured out to make QEmu run Morphos a bit better.

    Mouse accuracy
    -device usb-mouse -device usb-tablet allows a bit better mouse handling
    between the guest and the host. Not perfect but a bit better with.

    Network
    sungem is working better than rtl8139 on my setup (ie: read rtl8139 is
    simply failing)

    Building a somewhat more integrated QEMU (linux)
    ------------------------------------------------

    Using VNC to access the emulated machine can be a bit cumbersome. It is
    possible to build QEMU to use a GTK window for displaying the guest. Do not expect 3D acceleration at all. :)

    You'll need to fetch the QEMU source tree, install GCC and whatever the usual mess for building stuff.

    1. CC tweaking before building QEMU
    CC="gcc -mavx -march=native" CXX="g++ -mavx -march=native" ../configure \
    --target-list=ppc-softmmu \
    --enable-lto \
    --enable-gtk

    -march=native is used to solve an issue with some unsupported atomic16 op
    on my system. Might not be necessary at all for yours.
    -mavx should be set only if your system supports AVX2 extension.

    You'll probably need to install libgtk-3-dev (for debian) before configuring.

    2. Build QEMU

    make

    3. Tweak the qemu starting recipe

    Add "-display gtk" to your qemu starting options

    qemu will now display a window with a perfect mouse matching between
    host and guest. No more VNC needed for accessing the guest.

    Some somewhat usefull options that can be used to improve the UI experience:
    -display gtk,window-close=on|off,fullscreen=on|off,gl=on|off,show-menubar=on|off,zoom-to-fit=on|off

    It is not a fully detailed how to but some rough hint to build an 'improved' QEMU experience for running MorphOS.
    Quelque soit le chemin que tu prendras dans la vie, sache que tu auras des ampoules aux pieds.
    -------
    I need to practice my Kung Fu.
  • »28.12.24 - 11:07
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Barren
    Posts: 39 from 2016/12/29
    Thanks to you both for your help! This improved the situation a lot ! Hiccups are now gone, yes, it was the temperature.sensor :) I have put that line in my user startup.

    Sadly building Qemu is out of discussion for me lol, too complicated, I am not experienced with linux & stuff, maybe some day... :)

    Oh just another simple question. To share files with the host PC, I read I have to use this option:
    -drive if=none,id=ufat,format=raw,file=fat:rw:/dir/to/export -device usb-storage,drive=ufat

    but of course it does not work if used this way literally, it gives error, and I didn't quite understand which part I should substitute, in fat:rw:/dir/to/export... can you offer a working example so I can better figure out the syntax ? Thx !
  • »28.12.24 - 13:32
    Profile
  • Caterpillar
    Caterpillar
    Barren
    Posts: 39 from 2016/12/29
    Sorry, forget it, it was like fat:rw:[PATH], done.
    Rather, still two questions.

    1. If I invoke a reset from Ambient, MorphOS apparently freezes. The same happens if I invoke a reset using Qemu menu, so I have to literally close and relaunch Qemu. What is up ?

    2. I suppose there is no way to squeeze more speed out ? On my i7 6700 3.4 GHz I would have expected a better performance, but MorphOS is much slower than on my real Mac G5 (for example, I tried my ZoneXplorer which works flawlessly but is damn sloooow!!)

    3. (not so important) I get an ugly 4 colors mouse pointer. Is there no way to emulate 32 bits ones as Morphos does ?

    Here is my command line btw (ps I opted for ati-vga VS sm501 because the latter can't apparently go beyond 1280x1024)

    D:\Qemu\qemu-system-ppc.exe -machine mac99,via=pmu -m 2048 -vga none -device ati-vga,guest_hwcursor=true -hda D:\MOS.img -boot d -prom-env "boot-device=hd:,\boot.img" -bios D:\openbios-qemu.elf -serial stdio -device usb-mouse -device usb-tablet -drive if=none,id=ufat,format=raw,file=fat:rw:D:\MosIO -device usb-storage,drive=ufat
  • »28.12.24 - 14:48
    Profile
  • MorphOS Developer
    jacadcaps
    Posts: 3184 from 2003/3/5
    From: Canada
    1. Use shutdown. Qemu does not emulate rebooting correctly.
    2. Your cpu is very old, you’d get more performance from a recent cpu but you won’t get parity with a G5. Especially FPU emulation in Qemu is very slow.
    3. Afaik the emulated ati-vga does not support a full color cursor.
  • »28.12.24 - 15:03
    Profile Visit Website
  • Caterpillar
    Caterpillar
    Barren
    Posts: 39 from 2016/12/29
    Thanks Jacadcaps, actually I bought this PC 3 years ago, I didn't know the i7 6700 was so old, but you are right, I checked and it was released in 2015 :O Actually everything is light-fast on this PC...
    But ok, if QEmu FPU emulation is very slow, then there is nothing one can do :(

    Just one more question. I notice that old programs which were still using Gadtools (like TVPaint or ImageFX) show corrupt graphics instead of text, inside text/button gadgets, thus being unusable.
    On my old Power MAC, which had still MOS 3.9, everything was OK. OTOH I don't think QEmu may have anything to do with font corruption in gadtools (or it has ?), so must I think this problem is rather related to MOS 3.18 ? Perhaps I should revert to 3.9 ? Thx
  • »28.12.24 - 17:47
    Profile
  • Moderator
    Kronos
    Posts: 2384 from 2003/2/24
    Quote:

    Barren wrote:
    OTOH I don't think QEmu may have anything to do with font corruption in gadtools (or it has ?)


    Actually very good chance that something does get mixed up in the emulated GFX system.

    At least I don't remember any such bugs getting reported on real HW and 3.18 has been out for a while.
  • »28.12.24 - 18:17
    Profile
  • Caterpillar
    Caterpillar
    Barren
    Posts: 39 from 2016/12/29
    Nope. It is not usable because of that bug with Gadtools. With ImageFX you can still (not without efforts) change the font with one different than the default Topaz 8 and make text button displaying text again. With the default font only garbage is displayed. But TVPaint does not allow to change the font for the start screen mode list :-/

    Also, it seems that PowerUP support is broken in QEmu. In ImageFX I had a lot of PPC modules, which were made for PowerUP, not for MOS, but everytime one is used, the program freezes.

    These at least are true when emulating a Mac, dunno with a Pegasos, still to try, but I fear it would be the same...
  • »02.01.25 - 00:25
    Profile