BlitterStudio / amiberry

Optimized Amiga emulator for Linux/macOS
https://amiberry.com
GNU General Public License v3.0
635 stars 85 forks source link

Possible to add more RTG Memory? #265

Closed CypherXG closed 6 years ago

CypherXG commented 6 years ago

My Question is: Is it possible to add more RTG Memory than 16MB?

I'll tried this in my own Versions before and it work perfectly with max 128 MB RTG Memory. In the actually Version of Amiberry it will not start with a Videomem greater than 16MB. But when i start with another Config, load than the 128MB Config, the Emulator will reset perfectly with 128MB and these are shown in the System like Sysinfo etc. The Config is correct and the Memory is the same that i saved with Amiberry. Can you modify Amiberry to add max Memory for RTG? This would be nice.

midwan commented 6 years ago

@CypherXG Is the only modification you made in the config file? If so, could you please attach such a config file for reference?

I will try adding more from the GUI, if it doesn't cause any problems we can keep it.

CypherXG commented 6 years ago

In the Config there is the Row with gfxcard_size=128 gfxcard_type=ZorroIII

Next modification was that i added in PanelRam.cpp some rows like the RTGMEM etc:

static const char* RTGFastMem_list[] = { "Deaktiviert", "1.0 MB RTG VRam", "2.0 MB RTG VRam", "4.0 MB RTG VRam", "8.0 MB RTG VRam", "16 MB RTG VRam", "32 MB RTG VRam", "64 MB RTG VRam", "128 MB RTG VRam" }; static unsigned int RTGFastMem_values[] = { 0x000000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000 };

sldGfxmem = new gcn::Slider(0, 8);

for (i = 0; i < 9; ++i) { if (changed_prefs.rtgboards[0].rtgmem_size == RTGFastMem_values[i]) { sldGfxmem->setValue(i); lblGfxsize->setCaption(RTGFastMem_list[i]); break; } } sldGfxmem->setEnabled(!changed_prefs.address_space_24);

to get the 128MB Slider.

In Main.cpp i modified these rows:

for (auto & rtgboard : p->rtgboards) { //0x8000000 für 128MB const auto rbc = &rtgboard; if (rbc->rtgmem_size > 0x2000000 && rbc->rtgmem_type == GFXBOARD_UAE_Z3) { error_log(_T("Graphics card memory size %d (0x%x) larger than maximum reserved %d (0x%x)."), rbc->rtgmem_size, rbc->rtgmem_size, 0x2000000, 0x2000000); rbc->rtgmem_size = 0x8000000; err = 1; } I changed the rtgmem_size to 0x8000000 That was all. It works with the older Versions of Amiberry. It work with the new one too but it won't start with an 128mb config.

CypherXG commented 6 years ago

dsc_0200 dsc_0201 dsc_0202 dsc_0203 Here you see the 128 MB are working, but the Emulator wont start with a config greater than 16MB

midwan commented 6 years ago

@CypherXG Thanks for the details.

Why do you need 128MB of RTG Memory anyway? What scenario are you using that requires that amount?

CypherXG commented 6 years ago

Videoplaying and Videoediting. A Simple Videplayer need with Workbench in a goog Resolution more than 75% RTG Mem. For Videoediting i need more Memory because Chipmem is not used and it is too slow.

midwan commented 6 years ago

Fixed in the dev branch

CypherXG commented 6 years ago

Sry, doesn't work. If i save a config with 128 MB RTG Mem i can not start Amiberry with that config. It only works if i start Amiberry with another config, load the 128mb RTG config in the config panel and make a reset. Then the 128MB would be allocated for the RTG.

midwan commented 6 years ago

Hmm, I didn't try saving a config so it's possible that I missed something there. I tested it by loading a config I had, changing the RAM options to give 128MB RTG to it, then start it. It worked that way at least.

midwan commented 6 years ago

@CypherXG This works for me...

(The config was set to Hide the GUI, so it booted directly).

Could you please try recreating a config from scratch, in case the problem is in that?

CypherXG commented 6 years ago

` config_description=test config_hardware=true config_host=true config_version=3.6.0 -use_gui=no kickstart_rom_file_id=FC24AE0D,KS ROM v3.1 (A500,A600,A2000) pandora.rom_path=/opt/retropie/emulators/uae4arm/kickstarts/ pandora.floppy_path=/opt/retropie/emulators/uae4arm/disks/ pandora.hardfile_path=/opt/retropie/emulators/uae4arm/ pandora.cd_path=/opt/retropie/emulators/uae4arm/cd32/ pandora.cpu_speed=0 pandora.hide_idle_led=0 pandora.tap_delay=10 pandora.custom_controls=1 pandora.custom_up=0 pandora.custom_down=0 pandora.custom_left=0 pandora.custom_right=0 pandora.custom_a=32 pandora.custom_b=32 pandora.custom_x=-3 pandora.custom_y=-3 pandora.custom_l=0 pandora.custom_r=0 pandora.move_x=0 pandora.move_y=0 synchronize_clock=true key_for_menu=292 key_for_quit=0 button_for_menu=-1 button_for_quit=-1 gfx_correct_aspect=0 gfx_fullscreen_ratio=100 kbd_led_num=0 kbd_led_scr=-1 kbd_led_cap=-1 amiberry.rom_path=/opt/retropie/emulators/uae4arm/kickstarts/ amiberry.floppy_path=/opt/retropie/emulators/uae4arm/disks/ amiberry.hardfile_path=/opt/retropie/emulators/uae4arm/ amiberry.cd_path=/opt/retropie/emulators/uae4arm/cd32/ ; ; Controller/Input Configuration ; joyport0=mouse joyport0_autofire=none joyport0_friendlyname=Mouse joyport0_name=MOUSE0 ; joyport1=joy0 joyport1_autofire=none joyport1_mode=djoy joyport1_friendlyname=RetroArch Keyboard as Joystick [Input #1] joyport1_name=JOY0 ; ; ; input.joymouse_speed_analog=30 input.joymouse_speed_digital=10 input.joymouse_deadzone=33 input.joystick_deadzone=33 input.analog_joystick_multiplier=15 input.analog_joystick_offset=-1 input.mouse_speed=100 input.autofire_speed=0 kbd_lang=us ; ; Host-Specific ; amiberry.vertical_offset=0 amiberry.hide_idle_led=0 amiberry.gfx_correct_aspect=0 amiberry.kbd_led_num=-1 amiberry.kbd_led_scr=-1 amiberry.scaling_method=-1 amiberry.use_analogue_remap=false amiberry.use_retroarch_quit=true amiberry.use_retroarch_menu=true amiberry.use_retroarch_reset=false ; ; Common / Paths ; use_gui=no show_leds=true kickstart_rom_file=/home/pi/RetroPie/BIOS/Amiga/Amiga Kickstart Roms/Amiga Kickstart 3.1 (40.063) (A600) (Commodore) (1993).rom kickstart_rom_file_id=FC24AE0D,Amiga Kickstart ROM v3.1 (A500,A600,A2000) kickstart_ext_rom_file= ide_mb_rom_file=:ENABLED flash_file= cart_file= ; ; Floppy Drives ; floppy0= floppy1= floppy2= floppy2type=0 floppy3= floppy3type=0 cdimage0=/home/pi/RetroPie/roms/amiga/HDF/AmigaSYS 4 AGA Amiga 1200-4000 for Advanced users ISO Image.iso,disabled nr_floppies=4 floppy_speed=800 ; ; Hard Drives ; ; ; CD / CD32 ; cd_speed=100 ; ; Display / Screen Setup ; gfx_framerate=0 gfx_width=768 gfx_height=262 gfx_refreshrate=50 gfx_refreshrate_rtg=50 gfx_lores=false gfx_resolution=hires gfx_linemode=none gfx_fullscreen_amiga=false gfx_fullscreen_picasso=false ntsc=false ; ; CPU options ; cpu_speed=max cpu_type=68040 cpu_model=68040 fpu_model=68040 cpu_compatible=false cpu_24bit_addressing=false fpu_strict=false compfpu=true cachesize=8192 ; ; Memory ; chipmem_size=16 z3mapping=real fastmem_size=0 a3000mem_size=0 mbresmem_size=0 z3mem_size=128 z3mem_start=0x40000000 bogomem_size=0 gfxcard_size=128 gfxcard_type=ZorroIII rtg_modes=0x502 ; ; Chipset ; chipset=aga chipset_refreshrate=50.000000 collision_level=full chipset_compatible=Generic fatgary=0 ramsey=15 immediate_blits=false waiting_blits=automatic fast_copper=false ; ; Sound Options ; sound_output=normal sound_channels=stereo sound_stereo_separation=7 sound_stereo_mixing_delay=0 sound_frequency=44100 sound_interpol=none sound_filter=off sound_filter_type=standard sound_volume_cd=20 ; ; Misc. Options ; bsdsocket_emu=true

`

That is a config from me that doesnt startup with 128MB

midwan commented 6 years ago

@CypherXG It's certainly an older config, all those pandora* options are obsolete. Please try to recreate it starting with a Quickstart option, then test with that. I suspect it will work as expected then.

CypherXG commented 6 years ago

So. i tried with a Quickstart config. Blanc A4000 Config and saved directly. Tried 128MB RTG and saved it. Loads perfectly. Tried 128MB RTG and 128 MB Z3 Fast...Crash Tried 128MB RTG and 64 MB Z3 Fast...Crash Tried 128MB RTG and 32 MB Z3 Fast...Crash Tried 128MB RTG and 16 MB Z3 Fast...WORKS !! So. a4000-configs.zip

Here i add for you my configs a4000-1.uae = 128MB RTG and 16 MB Z3 Fast...WORKS a4000-2.uae = 128MB RTG and 32 MB Z3 Fast...Crash a4000-3.uae = 128MB RTG and 128 MB Z3 Fast...Crash

It looks like that amiberry couldn't allocate enough ram or somthing else. When my Pi boots up i have over 650 MB free for Programs.

midwan commented 6 years ago

@CypherXG Are you booting into a desktop, or just the console? If there's not enough RAM on the Pi to allocate what you asked for, you might run into trouble. It does work for me, with allocating 128MB Z3 RAM, 128MB RTG RAM, 2MB Chip, but I boot into the console directly and run the emulator from there (no desktop in the background).

Also, how much RAM have you allocated to the GPU in the Pi settings?

CypherXG commented 6 years ago

Always console. Give the GPU 256MB Mem

midwan commented 6 years ago

@CypherXG I just tested your configs:

I tried setting a config from scratch:

I also tried the above with 64MB Z3 RAM just in case, it still works here.

However, setting Z3 RAM to 32MB (while keeping the rest the same) caused a crash for some reason.

Note: I'm using the current dev branch for these tests.

CypherXG commented 6 years ago

I use the dev also. I tried your seetings. When i press start it works. When i save the config and i want to start from console with loading the config without GUI it crashed. The Kickstart 1.3 is also a bug. I select a 3.1 Kickstart but in the config it would be regonized as a 1.3 Kickstart. Also happend when i quickstart a cd32. In the Kickstart Panel it shows both cd32 roms. Kick + ext. thats ok. When i save the config File it shows me kickstart_rom_File_id=FC24AE0D, KS ROM v3.1 (A500,1000,2000) some rows down it shows me the Kickstart rom id 1E63D4A5,CD32 KS ROM v3.1 kickstart_rom_File_id is a double here in config. I dont know from where Amiberry is taking the first ID info. cd32x.zip

P.S. Same is in the a4000 configs.

midwan commented 6 years ago

Your a4000-3.uae config still contains obsolete entries, so it wasn't a "clean" config to begin with. If you create a proper one by starting from the Quickstart panel, then save that as a new config, it should work correctly regarding ROMs.

Also, I noticed that your paths point to /opt/retropie/emulators/uae4arm/ which would also mean that the adfdir.conf file is picked up from there. Old configs from uae4arm are different from Amiberry's, so it's recommended to keep them separate (or recreate them in Amiberry) to avoid such issues.

CypherXG commented 6 years ago

This is correct. But the a4000 Config Files where created by the Quickstart Option with amiberry and directly saved. But i try it. Start with a clean folder

CypherXG commented 6 years ago

So i try it now. Raspi Mem 64MB Clean Amiberry dir (All files i move in an empty Retropie/uae4arm dir) Start Emu, rescan roms, make a Quickstart option with A4000, set config, removed Mainboard Mem, add 128 Z3 Mem, add 128RTG Mem, add 8MB Chipmem. Save as default uaeconfig. Start with command line...crash Start normal and make a double click on config....crash Start normal and load it from config Panel, click reset....crash Config+adfdir.zip

midwan commented 6 years ago

@CypherXG Interesting...

Your config works for me, after I changed a few things for my environment:

Everything else I left the same. I started the emulator, loaded the config, and clicked start: it worked

Then I tested also changing the use_gui option from yes to no, to boot directly into emulation. I started the emulator from the command line using -conf conf/<filename>.uae: it worked

That would indicate that something is wrong either in the Kickstart ROMs themselves, or the path they are located in your system, as I didn't change anything else.

I'll see if I can get closer to what you had by testing this on a RetroPie installation as well (this test was made on a normal Raspbian Stretch).

midwan commented 6 years ago

@CypherXG Testing it on RetroPie, I got the crash.

I used the same ROMs as before, just located in the RetroPie paths, recreated the config from scratch and tried to load it: crash If I just started the emulator after modifying a config from Quickstart, it worked.

Weird, as the same exact steps do not crash on Raspbian Stretch, only on RetroPie (Jessie). I wonder what is causing this...

CypherXG commented 6 years ago

:-)

midwan commented 6 years ago

@CypherXG It seems that it's not RetroPie, but rather the SDL1 version that crashes. The SDL2 version does not crash with the same config file...

CypherXG commented 6 years ago

Mhhhh I found a little mini Solution for me. If i gray out from row 75 to 81 in Amiberry_mem.cpp it is possible to start Amiberry with saved 32MB RTG MEM Config. So i think it's only an Memory allocate Problem. // #ifdef AMIBERRY // address returned by valloc() too high for later mmap() calls. Use mmap() also for first area. // regs.natmem_offset = (uae_u8*)mmap(reinterpret_cast<void *>(0x20000000), natmem_size + BARRIER, // PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); //#else regs.natmem_offset = (uae_u8*)valloc(natmem_size + BARRIER); //#endif

midwan commented 6 years ago

@CypherXG It seems that it's indeed related to memory allocation, but I couldn't yet find out why it would crash on SDL1 but not on SDL2, for the 128MB setting. And again, only if you load the config, applying it from the GUI still allowed it to work, even on SDL1.

And on top of all that, the "32MB" setting seems to crash in both SDL1 and SDL2, even though 64MB and 128MB work fine on SDL2.

midwan commented 6 years ago

@CypherXG Found some things that were probably causing this, with the help of TomB. Expect a new update in the dev branch soon :)

CypherXG commented 6 years ago

So. i found the Problem. You must change the ADDITIONAL_MEMSIZE from 128 to 256MB in Row 25 (Old Version) #define ADDITIONAL_MEMSIZE ((256 + 16) * 1024 * 1024) Then you can save and load a config with 128MB RTG Memory with the SDL1 Version. Works now fine :-)

midwan commented 6 years ago

@CypherXG Thanks! But surely that should be #define ADDITIONAL_MEMSIZE ((256 + MAX_RTG_MEM) * 1024 * 1024) ?

midwan commented 6 years ago

@CypherXG Hm, or maybe #define ADDITIONAL_MEMSIZE (((MAX_RTG_MEM*2) + 16) * 1024 * 1024) ?