CS DPI Timings

Post Reply
Yawn
Posts: 14
Joined: Tue Mar 05, 2019 2:06 am
Has thanked: 1 time
Been thanked: 7 times

CS DPI Timings

Post by Yawn » Thu Dec 19, 2019 12:57 pm

Hey, I noticed while writing a game for my CS Lite (just for fun), the frame rate for the 320x240 display is actually set to 90Hz, instead of 60Hz.

I don't know if this is on purpose or not, but I think I've been getting a better experience in emulated games since I changed the pixel clock to 2/3 of the default value in config.txt, which gives me a 60Hz refresh.

hdmi_timings=320 1 20 30 38 240 1 4 3 10 0 0 0 60 0 6400000 1

At least I now don't have to try and make my game run at 90 FPS, which was a bit of a stretch on the Pi Zero.

Cheers,
** Yawn **

User avatar
kite
Posts: 972
Joined: Thu May 12, 2016 4:30 am
Location: UK
Has thanked: 246 times
Been thanked: 361 times
Contact:

Re: CS DPI Timings

Post by kite » Fri Dec 20, 2019 2:03 am

The value changed is the pixel clock, but the 'refresh rate' of the output is set to 60 still.

Have you been able to verify any differences for example what linux thinks the output is (e.g. IS it 90Hz or not?).

I haven't verified this, but the pixel clock even if you had it 'double the Hz' for the pixel count, would always be running, but the GPU will only supply new data at 60Hz. Either the pixel clock 'stays running' the whole time, or it is only running for the duration of the information. I suspect it is 'always running' but that the DE, VSYNC and HSYNC only run for the duration needed, then they sleep until the next 60Hz interval (with the pixel clock still spitting out it's frequency which is ignored by the LCD as there is no DE, VSYNC, or HSYNC!)

If you have more information I'd love to hear it, that is my understanding while developing it :)
Stock clearance - CLOSED: viewtopic.php?f=38&t=12064
Kite's Mailing List: https://goo.gl/forms/e97uUvPOfUxPWdz82
Kite's FAQ: https://kiteretro.com/faq/


ImageImageImageImageImage

Yawn
Posts: 14
Joined: Tue Mar 05, 2019 2:06 am
Has thanked: 1 time
Been thanked: 7 times

Re: CS DPI Timings

Post by Yawn » Fri Dec 20, 2019 4:02 am

"tvservice -s" says it's running at 0.0Hz, so that's not too useful. I'm not sure what standard commands might give a true refresh rate.

I'm using OpenGL ES 2.0, directly using the BCM EGL implementation - similar to the samples you find in /opt/vc/src/hello_triangle2. In the main loop, I just count the iterations I get every second, and it's consistently 91 with the default CS Lite timings, and 61 with mine.

Framesync is on by default, but I can turn it off with eglSwapInterval(display, 0); to compare the difference - then I'm running at around 450 frames per second (when there's no particle physics running, at least), so it's not an issue with that.

I guess it's possible that the frame sync is not actually syncing to the screen refresh - I'm trying to imagine what the perceived impact would be in that case. I'm not seeing any tearing or judder at either frame rate - just the game runs 50% faster at 90FPS. I think you'd expect 1/3 of the frames to drop or get a fairly consistent tearing if they were out of sync.

So my guess is the DPI interface settings are ignoring the requested refresh rate, and running straight off the pixel clock. Which I guess means we're overclocking the LCD quite a lot - although the screen is small enough that it's unlikely to put any stress on the components.

User avatar
kite
Posts: 972
Joined: Thu May 12, 2016 4:30 am
Location: UK
Has thanked: 246 times
Been thanked: 361 times
Contact:

Re: CS DPI Timings

Post by kite » Fri Dec 20, 2019 6:15 am

Very interesting! :) that does indeed sound that way, i shall have to give it a go and adjust where required! Originally I couldn't set the pixel clock to the exact amount because it expected only a certain multiplier to do it correctly!

I will also experiment and see what I can come up with, picking some more suitable numbers would be a good idea. There was a reason that i picked 9600000 but can't remember why at this point!

There was a known fix that 'sound ran too fast' on some apps, and reducing the pixel clock to 6400000 fixed it, so i think you're on to something there!
Stock clearance - CLOSED: viewtopic.php?f=38&t=12064
Kite's Mailing List: https://goo.gl/forms/e97uUvPOfUxPWdz82
Kite's FAQ: https://kiteretro.com/faq/


ImageImageImageImageImage

sgtgrumbles
Posts: 28
Joined: Mon Jun 05, 2017 9:53 pm
Has thanked: 3 times
Been thanked: 7 times

Re: CS DPI Timings

Post by sgtgrumbles » Thu Jan 09, 2020 7:58 pm

Just curious -- what was the resolution to this? Should we use 6400000 for the 640x480 screen as well?

User avatar
kite
Posts: 972
Joined: Thu May 12, 2016 4:30 am
Location: UK
Has thanked: 246 times
Been thanked: 361 times
Contact:

Re: CS DPI Timings

Post by kite » Fri Jan 10, 2020 1:55 am

sgtgrumbles wrote:
Thu Jan 09, 2020 7:58 pm
Just curious -- what was the resolution to this? Should we use 6400000 for the 640x480 screen as well?
The 640x480 requires at least >18432000 (that's 18MHz, the 6400000 is 6.4MHz) but will likely be higher because 18MHz doesn't take in to account any blanking lines. You could try the following and see if they work:

19200000 (19.2MHz)
32000000 (32MHz)
38400000 (38.4MHz)

They should work, but I just guessed the multiplier (which is what determines these numbers). The 19.2MHz and 38.4MHz should work though..
Stock clearance - CLOSED: viewtopic.php?f=38&t=12064
Kite's Mailing List: https://goo.gl/forms/e97uUvPOfUxPWdz82
Kite's FAQ: https://kiteretro.com/faq/


ImageImageImageImageImage

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest