Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Games have FMV's Flickers #1049

Closed
Triticum0 opened this issue Jun 9, 2022 · 10 comments · Fixed by #1168
Closed

Some Games have FMV's Flickers #1049

Triticum0 opened this issue Jun 9, 2022 · 10 comments · Fixed by #1168
Labels
bug Something isn't working

Comments

@Triticum0
Copy link

Triticum0 commented Jun 9, 2022

Bug Description

Some games have FMVs that flicker

Example:

2022-06-09.20-24-25.mp4

Games Affected:
https://xemu.app/titles/5451001d/#Broken-Sword-The-Sleeping-Dragon
https://xemu.app/titles/42560002/#Disney-s-Chicken-Little
https://xemu.app/titles/4947007a/#Dragon-Ball-Z-Sagas
https://xemu.app/titles/544d000d/#Disney-s-The-Haunted-Mansion
https://xemu.app/titles/55530060/#Far-Cry-Instincts-Evolution
https://xemu.app/titles/545100f4/#Nickelodeon-Tak-The-Great-Juju-Challenge

Expected Behavior

Should not flicker

xemu Version

Version: 0.7.29
Branch: master
Commit: 69dcbe9
Date: Wed Jun 8 05:09:16 UTC 2022

System Information

Field Value
OS Windows 10
CPU AMD Ryzen 5 2600 Six-Core Processo
Graphics Device NVIDIA GeForce RTX 3060 Ti/PCIe/SSE2
Graphics Driver 4.0.0 NVIDIA 512.95

Additional Context

No response

@Triticum0 Triticum0 added the bug Something isn't working label Jun 9, 2022
@eternights
Copy link

Final Fight: Streetwise too.

@abaire
Copy link
Contributor

abaire commented Jul 6, 2022

Hey @Triticum0 can you test whether PR #1146 also fixes these games when you have a chance?

@abaire
Copy link
Contributor

abaire commented Jul 6, 2022

Looking at Dragon Ball Z Sagas, I see that the FMV is rendered entirely via PVIDEO with no pgraph activity (so similar to but distinct from #1165).

In renderdoc, I see that pvideo_tex looks reasonable, and that the primary framebuffer texture is stale data (in my test case, it's the boot logo screen). The issue is that pvideo_enable is set to false every few frames, so that stale screen is rendered instead of the video content. When this happens, d->pvideo.regs[NV_PVIDEO_BUFFER] in pgraph_render_display_pvideo_overlay is 0.

If I set a breakpoint in pgraph_render_display_pvideo_overlay and step through, this never happens, so at the moment I suspect there may be a timing issue where NV_PVIDEO_BUFFER is briefly cleared and the xemu UI thread just happens to fetch a frame during that interval.

UPDATE: Confirmed, if I set breakpoints in pvideo_write, the game is alternately setting NV_PVIDEO_BUFFER and NV_PVIDEO_STOP (probably between frames) and when xemu happens to fetch the display buffer during the small interval between it flashes up a frame without the video overlay.

@abaire
Copy link
Contributor

abaire commented Jul 6, 2022

I wrote a test and was able to confirm that xemu's handling of the NV_PVIDEO_STOP is incorrect. Writing to the register only tears down the overlay if the 0th bit is 1. On hardware, setting NV_PVIDEO_STOP = 0 keeps the PVIDEO content displayed, whereas on xemu, any write to the stop register hides the overlay.

abaire added a commit to abaire/xemu that referenced this issue Jul 6, 2022
Interprets the value written to the `NV_PVIDEO_STOP` register in a manner more
consistent with hardware. Specifically, if the low bit of the value is not set,
the PVIDEO overlay should remain active.

Fixes xemu-project#1049

[Test](https://github.com/abaire/nxdk_pgraph_tests/blob/main/src/tests/pvideo_tests.cpp)
Note that, as this is testing video behavior, this test is interactive and
the value passed to the final SetPvideoStop call needs to be mutated and the
behavior observed.
@abaire
Copy link
Contributor

abaire commented Jul 6, 2022

@Triticum0 can you test #1168 to see if it fixes all of these games when you have a chance? I've confirmed it with Dragon Ball Z Sagas.

@Triticum0
Copy link
Author

Triticum0 commented Jul 7, 2022

I tested it with Dragon Ball Z Sagas and it did do anything

It only affects the In-game FMV so you won't see any flicker on the Intro FMV even on masters properly should have made a note in the pr,

2022-07-07.13-26-17.mp4

@abaire
Copy link
Contributor

abaire commented Jul 7, 2022

I tested it with Dragon Ball Z Sagas and it did do anything

It only affects the In-game FMV so you won't see any flicker on the Intro FMV even on masters properly should have made a note in the pr,

On my machine it definitely affects the attract mode FMV (let it sit on the "Press start" screen and it starts playing a movie after a minute or so). This game and that video is what I used to debug the issue and to verify the patch.
I also verified that on master, the intro movie for Tak... flashes but with my PR it no longer does.

@Triticum0 Can you double check that you're using the correct PR artifact? Maybe take a screenshot that captures the titlebar so we can verify the commit hash?

DBZS_master.mp4
DBZS_with_1168.mp4

@Triticum0
Copy link
Author

Triticum0 commented Jul 7, 2022

@abaire Yeah sorry, must of tested the wrong build. It fixed most of the games except for Broken-Sword-The-Sleeping-Dragon and Disney-s-The-Haunted-Mansion

@Triticum0
Copy link
Author

Triticum0 commented Jul 7, 2022

I will make another Issue for those games as there is a separate issue and you can close this issue once the pr has been merged

@abaire
Copy link
Contributor

abaire commented Jul 7, 2022

I will make another Issue for those games as there a seperate issue and you can close this issue once the pr been merged

Sounds good, thanks for double checking!

mborgerson pushed a commit that referenced this issue Jul 18, 2022
Interprets the value written to the `NV_PVIDEO_STOP` register in a manner more
consistent with hardware. Specifically, if the low bit of the value is not set,
the PVIDEO overlay should remain active.

Fixes #1049

[Test](https://github.com/abaire/nxdk_pgraph_tests/blob/main/src/tests/pvideo_tests.cpp)
Note that, as this is testing video behavior, this test is interactive and
the value passed to the final SetPvideoStop call needs to be mutated and the
behavior observed.
ChrisNonyminus pushed a commit to redscientistlabs/xemu-Vanguard that referenced this issue Nov 30, 2022
Interprets the value written to the `NV_PVIDEO_STOP` register in a manner more
consistent with hardware. Specifically, if the low bit of the value is not set,
the PVIDEO overlay should remain active.

Fixes xemu-project#1049

[Test](https://github.com/abaire/nxdk_pgraph_tests/blob/main/src/tests/pvideo_tests.cpp)
Note that, as this is testing video behavior, this test is interactive and
the value passed to the final SetPvideoStop call needs to be mutated and the
behavior observed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants