What are the problems with the display output? (NES focus)

Moderators: mdrjr, odroid

What are the problems with the display output? (NES focus)

Unread postby bluesceada » Wed Sep 05, 2018 2:15 am

I am slightly disappointed on the screen refresh performance. It happens at least in the NES emulator. Sometimes you can get some ugly tearing-like effects, but which is a diagonal break between two frames. So not like hsync/vsync issues. Currently I don't understand why this would happen.

I just gave the code a quick look, focussed on the NES emulator screen draw function. I could check further some time, but maybe someone knows more about it.

What I understood so far, please correct anything that is wrong:
vidQueue (a FreeRTOS queue) is used to transmit pointers to a full frame buffer to videoTask. The videoTask uses a screen draw function ili9341_write_frame_nes, which applies some palette and write it into line-buffers that you somehow get from an SPI task? This part gets somehow confusing to me, and I didn't go into the SPI code from IDF yet.... Nevertheless, here I don't understand where this "diagonal tearing" would come from. Maybe it is actually NES-rendering specific (about which I know nothing)? Otherwise it could be a problem with the SPI transmissions to the display?

I am not an expert at all on the ESP32, but also wonder a few other things in general:
  • Could we add some double buffering to improve the situation, is there enough memory left, or wouldn't it solve the problem anyway?
  • Is the effect I am seeing actually a frame-drop effect? So actually the frame is canceled to be drawn, since the next frame needs to be drawn already? And you decide to rather display just part of the frame instead of dropping it entirely? But why is it cut diagonal then? Is it something like a memcpy that writes memory in a strange order?
  • Everything I have seen so far seems to be pinned to the App CPU, right? Couldn't we separate video/audio/spi tasks from the emulator?

Not a fair comparison, but my single-core Pentium 1 with 200MHz, within Windows 95/98, could run a NES emulator fine ;-)

Thanks for shedding some light!
bluesceada
 
Posts: 5
Joined: Tue Sep 04, 2018 11:44 pm
languages_spoken: english,german
ODROIDs: odroid-go

Re: What are the problems with the display output? (NES focu

Unread postby crashoverride » Wed Sep 05, 2018 2:36 am

crashoverride
 
Posts: 3993
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1

Re: What are the problems with the display output? (NES focu

Unread postby bluesceada » Wed Sep 05, 2018 4:43 pm

Thanks for pointing it out, I should have probably looked there before writing here :roll:
bluesceada
 
Posts: 5
Joined: Tue Sep 04, 2018 11:44 pm
languages_spoken: english,german
ODROIDs: odroid-go

Re: What are the problems with the display output? (NES focu

Unread postby deerwings » Tue Oct 09, 2018 3:06 am

I have discovered that NES games seem to run pretty well except for vertical scrolling, there seems to be some issue where it seems to try to process an extra line that isn't supposed to be there. Horizontal seems to work fine so games like Super Mario Bros doesn't really show this issue as much, but games like Chrysalis and Super Mario Bros 3 do occasionally show this extra line. Doesn't affect gameplay but it does corrupt the display a bit.
deerwings
 
Posts: 6
Joined: Mon Oct 08, 2018 9:11 am
languages_spoken: english
ODROIDs: Odroid Go

Re: What are the problems with the display output? (NES focu

Unread postby odroid » Tue Oct 09, 2018 9:53 am

deerwings wrote:I have discovered that NES games seem to run pretty well except for vertical scrolling, there seems to be some issue where it seems to try to process an extra line that isn't supposed to be there. Horizontal seems to work fine so games like Super Mario Bros doesn't really show this issue as much, but games like Chrysalis and Super Mario Bros 3 do occasionally show this extra line. Doesn't affect gameplay but it does corrupt the display a bit.


Try 256x240 NES's native resolution mode instead of the stretched 320x240 mode. Press and hold "Start" button and press "Right" direction to change the display mode.
The native resolution mode will significantly reduce the tearing issue.

320x240 full screen mode
NES_full_screen.jpg
NES_full_screen.jpg (138.53 KiB) Viewed 316 times


256x240 native mode (pixel-perfect?)
NES_org_screen.jpg
NES_org_screen.jpg (125.24 KiB) Viewed 316 times
User avatar
odroid
Site Admin
 
Posts: 28718
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: What are the problems with the display output? (NES focu

Unread postby deerwings » Wed Oct 10, 2018 12:44 am

Actually, I didn't even think of that. I'm so used to the screen going as tiny as a postage stamp when playing Gameboy Games I didn't realize that the NES would only be a small resizing. Is this a hardware scaler or a software one that could be tweaked?
deerwings
 
Posts: 6
Joined: Mon Oct 08, 2018 9:11 am
languages_spoken: english
ODROIDs: Odroid Go

Re: What are the problems with the display output? (NES focu

Unread postby odroid » Wed Oct 10, 2018 9:29 am

There is no hardware graphics accelerator in this IoT oriented MCU.
User avatar
odroid
Site Admin
 
Posts: 28718
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: What are the problems with the display output? (NES focu

Unread postby deerwings » Wed Oct 10, 2018 11:14 am

Hmm, then does that indicate it is something that could be potentially fixable in a future update or is it a hard known issue? I'm not versed enough in the software that runs on this yet so most of this is curiosity.
deerwings
 
Posts: 6
Joined: Mon Oct 08, 2018 9:11 am
languages_spoken: english
ODROIDs: Odroid Go

Re: What are the problems with the display output? (NES focu

Unread postby odroid » Wed Oct 10, 2018 11:36 am

It seems to be very hard.
Refer this thread to know the reason.
viewtopic.php?f=158&t=31745
User avatar
odroid
Site Admin
 
Posts: 28718
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID


Return to Game Emulators

Who is online

Users browsing this forum: No registered users and 2 guests