Page 1 of 1

Emulator slow-down issue

Posted: Wed Jan 20, 2021 10:10 pm
by Ender

Maybe I should just make a github issue for this, but I thought I'd see if anyone here has any ideas first.  The emulator has run smoothly for me until recently, when I got a 4k TV as a monitor.  It usually ran at 100% no issues, with minimal occasional audio stuttering.  But since I got the TV it usually runs at around 97% and the audio stutters.  It's still the same resolution window as before, I usually run with "-scale 2".  It's also happening without the "-scale" option.  This is happening for both the emulator release downloaded from the github repo, and one that I've compiled myself.


Emulator slow-down issue

Posted: Wed Jan 20, 2021 10:23 pm
by StephenHorn

Shrug. I'm guessing your PC was only barely capable of running the emulator at full speed before, and asking SDL2 to blit the pixels is pushing it over by some small quantity.

For reference, I comfortably run the emulator at full speed on a 4K display, scale 2, quality nearest, on the following machine specs:


  • Intel Core i7-9700K @ 3.60GHz


  • 32 GB of DDR4-2132 memory


  • GeForce RTX 2080 TI (I doubt this is relevant, but maybe SDL2 is using hardware acceleration to perform the blit).



Emulator slow-down issue

Posted: Thu Jan 21, 2021 12:52 am
by Ender


2 hours ago, StephenHorn said:




Shrug. I'm guessing your PC was only barely capable of running the emulator at full speed before, and asking SDL2 to blit the pixels is pushing it over by some small quantity.



For reference, I comfortably run the emulator at full speed on a 4K display, scale 2, quality nearest, on the following machine specs:




  • Intel Core i7-9700K @ 3.60GHz


  • 32 GB of DDR4-2132 memory


  • GeForce RTX 2080 TI (I doubt this is relevant, but maybe SDL2 is using hardware acceleration to perform the blit).




Seems like it.  I'm just surprised that the resolution of the window doesn't seem to matter.  Also, games seem to still be fine, when running at the same resolutions I played them at before.  It's only the emulator I've had any sort of issue with.  For the record, this PC is a bit old at this point, it definitely can't do games at 4K.  I still only have a GTX 1070 (which I'm planning to upgrade soon) and an Intel Core I7-6700K @ 4.00GHz. However, I'd at least expect things to run like they did before if it's at the same resolution it was at previously.


Emulator slow-down issue

Posted: Thu Jan 21, 2021 9:44 am
by desertfish

Silly question perhaps but does the "try-it-out" in-browser emulator work for you?      Second question: what happens when you dial back the desktop resolution to what you had before?   (as opposed to just running the emulator with the same window size)

(asking this because I think your cpu should be fast enough to run the native emulator just fine...)


Emulator slow-down issue

Posted: Thu Jan 21, 2021 3:50 pm
by Ender


5 hours ago, desertfish said:




Silly question perhaps but does the "try-it-out" in-browser emulator work for you?      Second question: what happens when you dial back the desktop resolution to what you had before?   (as opposed to just running the emulator with the same window size)



(asking this because I think your cpu should be fast enough to run the native emulator just fine...)



The in-browser emulator seems to run fine, no stuttering, I forgot to mention that.  Changing the desktop resolution doesn't seem to matter (which surprised me. what the heck is going on?!).  I even tried turning off HDR since this TV supports it so I had turned it on.  Still no difference.

Edit: OK, so I think I figured it out.  After I got this TV I messed around with my NVIDIA control panel settings, and I had set the max fps to 58 for some reason (since I don't have HDMI 2.1 yet I can only do 60hz refresh rate).  Limiting it in this way seems to have made the emulator run slightly slower than it would.  I don't think I need this since I think it's mainly for G-sync and I have that turned off right now (yet again I'd need HDMI 2.1 for that).  Once I turned that off it seems to be back to normal.


Emulator slow-down issue

Posted: Thu Jan 21, 2021 3:57 pm
by desertfish

Yay glad you found the solution.

I don't understand though how limiting the display frame rate is of any consequence to the speed the application runs, but hey


Emulator slow-down issue

Posted: Thu Jan 21, 2021 4:31 pm
by Ender


45 minutes ago, desertfish said:




Yay glad you found the solution.



I don't understand though how limiting the display frame rate is of any consequence to the speed the application runs, but hey



Looks like the emulator updates at 60fps.


Quote




     if (sdlTicks - last_perf_update > 5000) {

         int32_t frameCount = frames - perf_frame_count;

         int perf = frameCount / 3;

 

         if (perf < 100 || warp_mode) {

             sprintf(window_title, "Commander X16 (%d%%)", perf);

             video_update_title(window_title);

         } else {

             video_update_title("Commander X16");

         }

 

         perf_frame_count = frames;

         last_perf_update = sdlTicks;

     }



That's basically updating the window title every 5 seconds and calculating the percent based on 300 frames having passed (which means 60fps).  So it would make sense that an external factor limiting it to 58 would cause it to be slower than what it expects. 


Emulator slow-down issue

Posted: Thu Jan 21, 2021 4:54 pm
by Cyber


22 minutes ago, Ender said:




Looks like the emulator updates at 60fps.



That's basically updating the window title every 5 seconds and calculating the percent based on 300 frames having passed (which means 60fps).  So it would make sense that an external factor limiting it to 58 would cause it to be slower than what it expects. 



Metrics are so metric. )


Emulator slow-down issue

Posted: Thu Jan 21, 2021 7:40 pm
by StephenHorn

Yes, the emulator expects to flip the buffers and present a new frame every 60fps, which matches the display rate of the final X16. If the system doesn't allow that, then the emulator will run slow.


Emulator slow-down issue

Posted: Fri Apr 02, 2021 6:13 am
by Snickers11001001

For what it's worth, when I started playing with the emulator this week (yes, for the first time... I'm a non-early-adopting dilettante) I had a similar problem. 

In fact, on mine I noticed a slow down when the edge of the window of the emulator was right up against the edge of the screen.   I think Windows 10 has a bug or some sort of "extra" thing it does to deal with windows partially off screen (maybe code that is supposed to do "dual monitor" support is actually getting invoked even without that second monitor attached - effing microsoft).    But when I centered the emulator window on the monitor, with no edge of the display touching any side, the speed jumped back up and was fully on point  after that...

Your mileage may vary.