TheElixZammuto / moonlight-xbox

Moonlight port for Xbox One/Series Family of Console
GNU General Public License v3.0
366 stars 25 forks source link

Massive image tearing on Xbox one x #60

Closed chrispable closed 1 year ago

chrispable commented 1 year ago

Note I am using a ONE X NOT a series X.

I have no issue on my series x.

On the one x, I am running into an issue with image tearing. I am assuming it has to do with frame rate. I get the best result with moonlight using 30fps and hevc. The problem is made better if I enable stats. It seems to go away if I enable the log. I am assuming the frame buffer is getting overridden before drawing.

Enabling h264 immediately gets me problems.

In general with the stats, it rendering time goes above 30 ms, the issue is really bad.

Video demonstration: https://youtu.be/PldwSqykP8k

PermaFreez commented 1 year ago

I'm using an xbox one s all digital edition and it too has this problem.

Seketh commented 1 year ago

Same thing here, massive tearing on One X.

TheElixZammuto commented 1 year ago

i took a long time to debug this issue, but using a sleep hack now tearing should be fixed. ~I have this build ready for dev mode, does somebody have Dev Mode to test it too? https://github.com/TheElixZammuto/moonlight-xbox/suites/11959901132/artifacts/627335775~

Version 1.12.0 is now on GitHub and in the MS store in the following hours. I tried with my Xbox One at a 1080p resolution and I haven't found any tearing anymore

chrispable commented 1 year ago

I will test this as soon as I get home next week. Thank you so much! I was actually going to die down and start looking into this myself. I've never done uwp Dev before so I started by getting familiar with moonlight on the wiiu so I would understand the code base at least. I may try my hand at a proper fix if I can get it building.

I was looking at how vlc did it's swap chains https://github.com/videolan/vlc/blob/954b60ff45e28e0d833f107fb018c851cc7d249a/modules/video_output/win32/d3d11_swapchain.cpp

So that was where I was going to start. It's very strange this is only affecting xb1s though. Did you test this with x264 and x265 as well?

TheElixZammuto commented 1 year ago

While the issue seemed to indicate tearing, it was actually a incomplete decoding issue. It seems that on Xbox Ones, the driver does not correctly signals FFMEPG that the decoding operation has been completed. So I addded this hack to wait a bit before copying the texture, so the decoding operation does complete: https://github.com/TheElixZammuto/moonlight-xbox/commit/23f6e0c1d5212f51e19bf43ef36c1be634d948ef

reno911unlocred commented 11 months ago

So this is a limitation only of the xbox one and xbox one s? this is not an issue with xbox one x or xbox series?

TheElixZammuto commented 11 months ago

The hack is used in Xbox One, Xbox One S and Xbox One X The hack is not needed (and it's not used) for Xbox Series S and Xbox Series X