RetroFE forums

General Category => General Discussion & Help => Topic started by: batodan1911 on December 26, 2019, 11:14:41 AM

Title: coinop getting slow after a while
Post by: batodan1911 on December 26, 2019, 11:14:41 AM
so i put pc in my arcade cabinnet with coinop the latest version
its all running good but if i leave it to run like 6 hours everything because soo slow (mame works fine) but the front end getting so slow and showing the vids on slow with low fps. any way to fix it ?
im using old pc
i dont use the pc - just for the cabbinet. no other using
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on December 26, 2019, 09:19:53 PM
so i put pc in my arcade cabinnet with coinop the latest version
its all running good but if i leave it to run like 6 hours everything because soo slow (mame works fine) but the front end getting so slow and showing the vids on slow with low fps. any way to fix it ?
im using old pc
i dont use the pc - just for the cabbinet. no other using
What kind of hardware are you running it on?

Sent from my SM-G950F using Tapatalk

Title: Re: coinop getting slow after a while
Post by: batodan1911 on December 27, 2019, 12:07:55 PM
e8400
210gt 1gb
4gb ram
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on December 27, 2019, 02:07:08 PM
What exactly happens? It starts out fine, but after (several) hours it slowly slows down or does it suddenly drop a lot in speed? How does the video play exactly? Good sounds with stuttering video or even delayed video?

I've seen similar issues on my HD4400 IGP, where my IGP simply couldn't keep up with the hardware based video decoding, and switched to software in stead. I haven't been able to figure out yet why it happened, though running my IGP at a slightly higher speed helped. Is there a chance your computer switches from your GT to IGP by chance?
Title: Re: coinop getting slow after a while
Post by: batodan1911 on December 28, 2019, 04:51:05 PM
i turn it on before i go to sleep
it was good for at least 30 minutes..
when i wake up in morning i see its very slow.
the vids are bad like its very slow and skip fps
how can i know if its switch to my igp ?
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on December 28, 2019, 05:26:58 PM
By default it's on auto; you could force Windows to always use your GT for RetroFE via the program settings (right click on the icon) to see if that makes a difference.

Sent from my SM-G950F using Tapatalk

Title: Re: coinop getting slow after a while
Post by: batodan1911 on December 29, 2019, 03:12:25 PM
right click on retrofee or  coinop icon?

and then go to prefernce ?
Title: Re: coinop getting slow after a while
Post by: batodan1911 on January 14, 2020, 03:21:01 PM
help  ;D
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on January 14, 2020, 05:44:30 PM
right-click on Coinops; then select "Run with graphics processor"
Title: Re: coinop getting slow after a while
Post by: batodan1911 on January 15, 2020, 09:12:47 PM
im sorry but i dont have this option
im using win10 btw
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on January 17, 2020, 06:51:43 AM
Same here. Odd. Check tour graphics settings then. Perhaps there’s a setting there to always use nvidia.
Title: Re: coinop getting slow after a while
Post by: batodan1911 on February 03, 2020, 09:43:51 AM
I DONT KNOW WHAT TO DO I TRY EVERYTHING
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on February 03, 2020, 10:02:57 PM
It seems I have similar issues on my Linux machine, so I'll see if I can figure out what the issue is. It appears to have to do with Intel's video decoding, but I'll need to look deeper.
Title: Re: coinop getting slow after a while
Post by: DamnedOne on February 10, 2020, 11:59:37 PM
If it helps ... I have tested this issue on a number of systems with different Intel IGPs (4 series i5 to 8 series i7) and Windows 10 1903/1909. All exhibit the video playback issue after about an hour. This then progressively gets worse until the video is playing at around 1 fps.  The only fix is to exit and restart the app.

The issue does not appear on my AMD RX570.
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on February 11, 2020, 08:51:24 PM
It appears to be an issue with the Intel chipset, which worries me. I'm not sure I can fix this to be honest.
Title: Re: coinop getting slow after a while
Post by: walknight on March 11, 2020, 04:23:12 AM
I too had this problem. As I found out, it is what Pieter once mentioned, that the GPU cannot keep up.
The "Worlds" theme from CoinOPS has a ton of artworks and animations that causes high GPU load.
I tested on my laptop with an NVIDIA NVS5200. By default it uses the integrated Intel HD graphics and GPU usage reaches 100% when video starts to play. Then it starts to slow down.
After manually set it to use the NVS5200, GPU usage is still high but hovers around 93%. No slow down this time but the machine runs hot!

I then switched to the Animatic and the RAW theme. Those use a lot less GPU, about 30--60%, and no slow down. But the machine still gets hot after a while.

So I got curious why it requires so much GPU power to play some 640x480 video. I downloaded the code and started to read it...I've been writing C++ for many years but am totally new to this GUI/SDL thing. It took me a while to learn/realize this "render loop" concept that might be the "Hello World" equivalent for game developers. So basically, the program has such a loop:
That "redraw everything" part indeed includes everything, like the background image, logos on the wheel, texts, and of course the next video frame. Every single GUI element gets redrawn no matter it changes or not.
That sure sounds like a lot of GPU operations. But I'm still not sure whether it explains why it uses so much GPU power that a recent year laptop with a dedicated graphics card can barely handle it. It might not be a fair comparison, but even an old machine with integrated graphics should play those videos with ease.
Any thoughts?
Title: Re: coinop getting slow after a while
Post by: walknight on March 12, 2020, 07:03:36 AM
Today I played more with CoinOPS' Worlds layout.
I commented out pretty much everything, then started to enable them one by one to figure out which is which and their impact on GPU usage.
I found video is not the primary cause of high GPU usage. Rather it's those large pictures. For example, a full screen background image with varying alpha values will cause a rather significant increase on GPU load. This seems to make sense as that large picture needs to be redrawn in each frame.

So I spent some time to tweak the theme, trying to retain the essential effects but get rid of large images that only add a minor artistic feel. The result is satisfactory. I'm finally able to run it smoothly on an integrated Intel HD5000.

I do have one question. The following code is to show a full screen background that covers pretty much everything when switching collections.
This has a high GPU usage as the image is large. But I have to have this, otherwise some underneath "parts" will show when switching collections.
I guess for this image, its alpha must be 0 when I stay inside a collection, and only shows up when switching from one collection to another.
So my question is, does the program still draw an object if its alpha is pure 0? If that's the case, is it possible to add that feature (skip if alpha is 0)?

Code: [Select]
    <image src="images/Promo.png" alpha="1" x="0" y="0" height="1080" width="1920" layer="16">
        <onMenuExit menuIndex="1">
            <set duration="0.2">
                <animate type="alpha" to="1"/>
            </set>
        </onMenuExit>
        <onMenuEnter menuIndex="1">
            <set duration="0.4">
                <animate type="alpha" to="0"/>
            </set>
        </onMenuEnter>
        <onHighlightEnter menuIndex="0">
            <set duration="0.25">
                <animate type="alpha" to="1"/>
            </set>
        </onHighlightEnter>
    </image>
Title: Re: coinop getting slow after a while
Post by: walknight on March 13, 2020, 04:49:23 AM
Update:
It seems I can no longer post code in a reply. The post just disappears...
Anyway just want to report that I added a single line like

if alpha is 0 then return.

and that dropped my GPU usage from 100% to 40%!
I briefly played around and did not notice anything wrong.
If this indeed works, it means we can run this fancy theme on many cheap and old hardware. Very excited about it!
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on March 13, 2020, 06:08:56 AM
I’ll add it to the code. Did you add it to sdl.cpp?
Title: Re: coinop getting slow after a while
Post by: walknight on March 13, 2020, 01:51:56 PM
Yes SDL::renderCopy.
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on March 13, 2020, 03:08:35 PM
Does this version solve the issue as well? It includes the other recent fixes, like the one for zero delay encoders.
Title: Re: coinop getting slow after a while
Post by: walknight on March 13, 2020, 11:19:34 PM
Yep it worked. Thanks!

I forgot to mention that I made another change the other day. I dropped the frame rate to 30 fps when the menu is in idle state.
That helped to cut the GPU usage in half without noticeable degradation.

In RetroFE.cpp:
Code: [Select]
-            double sleepTime = 1000.0/60.0 - deltaTime*1000;
+
+            int fps = (state == RETROFE_IDLE ? 30 : 60);
+            double sleepTime = 1000.0/fps - deltaTime*1000;

Maybe make it a configurable option for people with older hardware?
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on March 13, 2020, 11:28:36 PM
Sure, I’ll make FPS programmable with a default of 60.
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on March 15, 2020, 09:41:56 AM
Give this a try; the parameters are fps and fpsIdle, and both default to 60. Let me know if you encounter any problems.
Title: Re: coinop getting slow after a while
Post by: walknight on March 15, 2020, 11:06:40 PM
Tested good. Thanks!

BTW Pieter can you share your Windows build command line? I'm using VS2019 but my executable is a little bit larger than yours. Speed-wise it's about the same though.

Also I saw you worked on the rpi build a while back. I'm interested in building this for the Rockchip RK3328 which is used in the AtGames Legend Ultimate cab. Could you give me any pointers on setting up the cross compiler?


Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on March 16, 2020, 10:48:27 AM
Tested good. Thanks!

BTW Pieter can you share your Windows build command line? I'm using VS2019 but my executable is a little bit larger than yours. Speed-wise it's about the same though.

Also I saw you worked on the rpi build a while back. I'm interested in building this for the Rockchip RK3328 which is used in the AtGames Legend Ultimate cab. Could you give me any pointers on setting up the cross compiler?

My Windows build command isn't any different from what the README describes to be honest. Perhaps it's because I still use VS2017 for my builds or are you compiling for 64 bits in stead?

I've never done cross compiling of RetroFE to be honest; I compiled my Pi executable directly on the Pi using the standard Linux compile instructions.
Title: Re: coinop getting slow after a while
Post by: walknight on March 16, 2020, 03:26:08 PM
I see. I'm completely new to cross compiling too so looks like lots to learn.
Title: Re: coinop getting slow after a while
Post by: batodan1911 on March 19, 2020, 02:37:39 PM
did u find a way to fix slow vids ?
Title: Re: coinop getting slow after a while
Post by: Pieter Hulshoff on March 19, 2020, 02:38:39 PM
Yes, just grab the latest build from http://retrofe.nl/SMF/index.php?topic=7.msg3865#msg3865
Consider setting fps and fpsIdle to 30 in your settings.conf file.
Title: Re: coinop getting slow after a while
Post by: walknight on March 19, 2020, 06:51:43 PM
In addition to the code changes, attached is a modified version of the Worlds theme with minimal usage of large sized (size on screen not file size) pictures.
As mentioned before large pictures are the primary cause of high GPU usage.
Just make a backup of your layouts/Worlds folder and extract the zip on top of it.
In the layout.xml file you can find my comments regarding what does what.

I've also derived a theme from this for the Arcade1UP cab (5:4 ratio) if anyone is interested.
Title: Re: coinop getting slow after a while
Post by: BritneysPAIRS on March 20, 2020, 07:01:06 AM
This will break stuff....come on though to the coinops discord im working this now
Title: Re: coinop getting slow after a while
Post by: JonahUK on March 20, 2020, 09:41:40 PM
In addition to the code changes, attached is a modified version of the Worlds theme with minimal usage of large sized (size on screen not file size) pictures.
As mentioned before large pictures are the primary cause of high GPU usage.
Just make a backup of your layouts/Worlds folder and extract the zip on top of it.
In the layout.xml file you can find my comments regarding what does what.

I've also derived a theme from this for the Arcade1UP cab (5:4 ratio) if anyone is interested.

Good job :)
Title: Re: coinop getting slow after a while
Post by: mala on March 31, 2020, 06:27:35 PM
Ok thank you I will try this if it's not slowing down videos anymore after a while.

Can any one have a worlds them next in 4:3?

Thank you in advance.