imaadmalik / imame4all

Automatically exported from code.google.com/p/imame4all
0 stars 0 forks source link

Performance observations on the iPad 1 & iPad 2 #32

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I've been doing quite a lot of work (been away on holiday for a while though) 
on performance improvements for the iPad 1 but having recently bought an iPad 2 
(i.e. iPad 3 won't be out soon) most of that work has been made redundant by 
the extra performance the iPad 2 has over the iPad 1. It's not just the extra 
cpu core that helps but appears to be some memory and graphics performance 
improvements. No matter what I did on the iPad 1 I could not get completely 
smooth framerates even though the game speed was well above 200%, for example. 
I tried implementing better vsync drawing using CADisplayLink and sleeping the 
MAME core to free up CPU time (instead of while() wait loops) but still the 
stuttering was there. Not all the time but it would regularly stutter. I was 
assuming the single CPU was being flogged by MAME, the screen drawing and 
background processes causing this. I wouldn't want to say there is a design 
flaw in the iPad 1...

On the iPad 2 everything pretty much works at full speed (as you said) and 
completely smooth frame drawing, no stutter/jitter. In fact the performance 
improvements look to be at least twice as fast, maybe 3x. The MAME app has two 
major threads, MAME core and screen drawing code and I can see one CPU core is 
100% utilised and the other around 25% with the bitmap drawing which frees that 
core up for background and O/S services. It's a real joy to run this on the 
iCade.

I have been working on the Cyclone ARM 68000 core and got quite far (compiled 
and linked) but could not get it to work properly on iOS - has anybody managed 
to do this yet. The iPad 2 now makes that redundant anyway - so I'm not going 
to continue working on that.

It might be an idea to mention the performance differences in the 
documentation, I would have thought the iPad 1 was up to the task of running 
MAME without any issues, but apparently not.

Original issue reported on code.google.com by squid123...@gmail.com on 19 Aug 2011 at 1:51

GoogleCodeExporter commented 8 years ago
Yes i had iPad 1, and a 3g iPhone (awful performace even with private apis like 
core surface). Now I have a iPad 2 (that runs mame perfectly) and iPhone 4 that 
runs mame well for mame classics but it doesn't work well with neo games 
although they are playable with frameskip. 

When i had the iPad 1 I think that the performance was quite well, with some 
few execeptions. Maybe with the new iOS releases or the jailbreak stuff, the 
iPad 1 performance is not so well rigth now. I think like you. With  such a 
high renewal rate (the future iPhone 5 is almost here) working on doing some 
costly  effort optimizations that could jeopardize future builds is something 
that deserves thought to be studied although it seems very interesting your 
CADisplayLink develop and i thought to implement it at some point at the past.

Stuart Cartney (the developer behind iAmiga) has doing some work on 
implementing a asm arm iOS 6800 CPU and he has offer me with a free license. I 
have now working on an Android port of imame4all since i have gift my wife with 
a Samsung Galaxy Tab 10.1 that i like very much so I'm very entertained when my 
two babies leave me time to develop.. ahaha... i prefer to work on that 
directoion so more people could enjoy imame4all on other devices but i doint 
mind to add your improvements if you find relevant.

Said that, not much people has complain about iPad 1 performance. Your are an 
advanced user who know when something  is not right at all, but most people are 
happy with current iPad 1 performance and when they switch to a more modern 
device will be delighted with how well it works with the extra performance.

Original comment by seleuco....@gmail.com on 19 Aug 2011 at 5:22

GoogleCodeExporter commented 8 years ago
Yes, I think you're right about the current state of iMAME4all, it's pretty 
much iOS compliant and hack free for the performance with the "safe drawing" 
code and should work fine on future versions of iOS. It's just a matter of 
letting the hardware catch up with the performance as the iPad 2 performance 
proves your code is correct. I would consider using 3GS as a baseline for the 
compiler as the ARMv7 CPU (from 3GS onwards) has some nice automatic CPU 
optimisations.

My CADisplayLink code was just experimental so isn't fit to give to you, it was 
quite simple but I had problems keeping the two threads (MAME core and iOS 
drawing) in sync as the iOS was triggering the display draw (using the 
CADisplayLink timer). Although looking at the iPad 2 I don't think it will be 
needed as it's 99% in sync (no stutter). 

I have a working XCode 4 project for the jailbroken version if you're 
interested, it should just slot into the base directory of the source code and 
will enable people to easily build with XCode 4. The XCode environment is 
rather nice to develop and debug in.

I would like to tweak the game selection input, i.e. put a delay on the 
joystick movement when selecting games, it can fly off down the list as there's 
currently no delay. I also would like to see a favourites filter - I can help 
with that if you want. I implemented a simple filter in ZodMAME that I think 
would work OK.

Original comment by squid123...@gmail.com on 22 Aug 2011 at 10:24

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
It would be nice to add your xcode project in a mame4all branch. I think that 
the game filter is a good idea... it is one of the things i would like to add. 
I really like a gp2x frontend that let you filter by game type, year, 
manufacturer and so on... all info is in the drivers and it could be parsed in 
some way. i really be very grateful if you add some kind of game filter and i 
publish a version with your changes.

As i said, i not working in the iOS version now but an android version that i 
have already running on my devices :). A honycomb tablet and a htc phone. 
Android is like a kick in he ass.... far better iOS. At first instance i think 
that i couldnt do a such smooth draw as iPad 2 without move to GL ES that i 
dont like since i want to target all kind of hw out there... i have currenly 3 
render paths, synched (legacy phones), threaded (two core phones) and finally a 
hw accelerated for the honycomb tablet. sadly they  havent added 2d hw 
acceleration till android 3.0. incredible ahaha. But finally i have a tablet 
render way nearly as good as the iPad version... <the phone version is really 
good without filters... 60fps synched.

As tou see i am very entertained... so work in the base MAME code... it will 
add to the android version also.

Original comment by seleuco....@gmail.com on 22 Aug 2011 at 11:44

GoogleCodeExporter commented 8 years ago
Seleuco, just to update you on what I'm up to. Been wrestling with the XCode 
debug environment again but have finally got that sorted - I can write a Dev 
document to show how to set it up. So far I've implemented the following code 
changes:
* Use old style iCade controls if using an iPad, otherwise use the new 
icontrolpad layout.
* Added delay on game selection list to make it easier to navigate through the 
games and page up/down.
* Fixes to sound initialisation code.
* Changed hardcoded /var/mobile/Media/ROMs paths in source to preprocessor 
defines (makes it easier to develop on XCode)
* Added ARMv6 and ARMv7 architectures to build, an iOS standard requirement but 
code size is much bigger. Better performance on ARMv7 devices though. 

Please let me know if you update the iOS source so I don't get too out of sync 
with the SVN.

Next I'll look into a filter, I have some ideas that should work quite nicely.

Original comment by squid123...@gmail.com on 27 Aug 2011 at 4:24

GoogleCodeExporter commented 8 years ago
Fine. :)

can you implement a switch buttons in global options to select iPad/iCade 
mapping? it should be easy. Maybe some user with an ipad have an iCade.

I'm n ot working on iOS source. I have made a folder copy named android with OS 
dependant files.

keep the good work.

Original comment by seleuco....@gmail.com on 29 Aug 2011 at 12:12

GoogleCodeExporter commented 8 years ago
Yes, I was assuming someone with an iControlPad would only use it with an 
iPhone and an iCade only with an iPad but people apparently use the iCP with 
iPads too. I'll add an option for it.

Original comment by squid123...@gmail.com on 31 Aug 2011 at 8:22

GoogleCodeExporter commented 8 years ago
Just to update on progress:
* added option to choose iCade or iControlPad layout
* sleep processor between inputs on game select/settings screens, previously 
CPU ran at constantly at 100%, now idles so better battery life.

Original comment by squid123...@gmail.com on 2 Sep 2011 at 2:45

GoogleCodeExporter commented 8 years ago
Good to know. I hope release the first android beta in one week. Twins let me 
few time :)

Original comment by seleuco....@gmail.com on 3 Sep 2011 at 12:34

GoogleCodeExporter commented 8 years ago
Here's a version that looks ready for release. It has the following changes 
which I think are significant enough for a release. I've attached the compiled 
version. This version is bigger as it contains both the ARMv7 and ARMv6 
compilations.  I haven't done the ROM filtering yet, that's next on the list 
but will take some time. 

• key delay on game selection - eases game selection. (Currently only works 
on safe render).
• added option to set Sound defaults
• added option to choose iCade or iControlPad layout
• sleep processor between inputs on game select screen, previously CPU ran at 
constantly at 100%, now idles so better battery life.
• Fixed multiple key presses problem
• sound initialisation fixes
• Added ARMv7 exe for 3GS and later devices, speed boost for some games.

It maybe easier if I can commit the changes directly to the SVN source code, 
but that is up to you.

Original comment by squid123...@gmail.com on 3 Sep 2011 at 2:43

Attachments:

GoogleCodeExporter commented 8 years ago
Nice work. This is a huge executable :) 

is it possible to speed up a litle the game selection delay...?

I have added you as commiter so you can add your changes. Let me know if not 
work.

cheers!

Original comment by seleuco....@gmail.com on 4 Sep 2011 at 10:25

GoogleCodeExporter commented 8 years ago
forget speed up... i think i was a little laggy on iPhone 4... but now i think 
is OK. good work.

Original comment by seleuco....@gmail.com on 4 Sep 2011 at 10:54

GoogleCodeExporter commented 8 years ago
Yes, it's a large exe as it has both code compilations in there. Up to you if 
you only want ARMv6 but including ARMv7 is an easy speed boost. The game 
selection delay may need tweaking, i.e. quickly pressing keys is slow but I 
think it's OK for now. Code for that is simple but a little tricky due to the 
strange output from iCade with quick presses.

I've committed to the SVN most of my changes, still tidying things up before 
confirming it looks OK. I've put the XCode project in there, which uses 
relative paths, so it can be easily compiled from XCode 4. XCode appears to 
require the CFBundleExecutable setting to match the name of the project, i.e. 
"iMAME4all" instead of "mame". Seems to run OK for me if I use "iMAME4all" as 
the exe name.

Original comment by squid123...@gmail.com on 5 Sep 2011 at 12:39

GoogleCodeExporter commented 8 years ago
i cant ldid (fake Pseudo-Signing for 3f arm6) with the universal build.

iPad-2-de-David:/Applications/iMAME4all.app root# ldid -S mame
codesign_allocate: for architecture armv6 object: mame malformed object 
(unknown load command 4)
util/ldid.cpp(582): _assert(0:WEXITSTATUS(status) == 0)
iPad-2-de-David:/Applications/iMAME4all.app root#

i going to package it anyway and post it in touch arcade to see if some 3g user 
can test it.

Thanks for your good work. i'm waiting for the game filtering. :) can i tag the 
svn version?

Original comment by seleuco....@gmail.com on 5 Sep 2011 at 6:04