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

"Scroll Scroll Scroll" demo has tearing during the display of the big scroll #680

Closed
tomcw opened this issue Aug 24, 2019 · 11 comments
Closed
Labels
Milestone

Comments

@tomcw
Copy link
Contributor

tomcw commented Aug 24, 2019

Email from Arnaud on 17/8/2019:

Today while making screenshots of my "old" releases, I noticed a weird issue. On "Scroll Scroll Scroll", there is tearing during the display of the big scroll (the one with GR characters).

I check again the original video I made at the time (with my real hardware), no problem of course (but I was pretty sure of that, otherwise I will not have released! ).
I also check with last version of AIPC, no issue either!

I thought of a regression, so I tested with another AppleWin version. But same issue with older version...
Note that version prior to 1.26 have display problems (but paradoxically, the tearing does not seem to be present).

I send you the DSK file if you want to test by yourself (it's exactly the original version, I did not change anything)...
Do you also see tearing or is it a problem with my PC ?!

@tomcw
Copy link
Contributor Author

tomcw commented Aug 24, 2019

Hi Arnaud,

I've tested this and what I see is not tearing, but juddery / jerky scrolling.

I'm using AIPC 0.1.42.1 and AppleWin both in 60Hz mode. (When I use AIPC in 50Hz, then it's jerky too.)

Also I see similar jerky scrolling (only for AppleWin, not AIPC) for Ansi Story, at the "Turn the disk over!" horizontal scrolling message.

I have seen this jerky (AppleWin) behaviour before, but hadn't raised it as an issue. I guess that AIPC is synchronising with the PC monitor's vsync, so that this jerky (or tearing) visual isn't visible?

NB. My PC monitor's refresh rate is 60Hz.

@tomcw tomcw added the bug label Aug 24, 2019
@tomcw
Copy link
Contributor Author

tomcw commented Aug 24, 2019

Hmm... I've just upgraded to AIPC 0.1.45.1 and I'm now seeing bad tearing for Scroll Scroll Scroll (big GR scroller) in 60Hz mode! (And 50Hz too.)

What version of AIPC are using using? Are you running in 50 or 60Hz?

@Archange427
Copy link

Archange427 commented Aug 24, 2019

Hello Tom, Thanks for your tests.
So I did new tests myself.

AIPC v0.1.45.1 (50Hz and 60Hz) : no tearing but sometimes some jerky scrolling (not all the time... in fact rather infrequently). Not as smooth as on a real machine (in my memories) but OK.

AW v1.28.8.0 (50Hz and 60Hz) : a lot of tearing.
The first line, sometimes the second line (and sometimes more) of the "big letters" are displayed "shifted" compared to the others.
I tried to take screenshots to show a little what I see. This is not systematic all the time and is not regular...
Sometimes the beginning of the scroll is OK and the "tearing" appears later. Sometimes, it's the opposite!

screenshots:
2019-08-25_003357
2019-08-25_003416

Edited: For information, my first monitor's refresh rate is 144Hz. The second is 60Hz.
Same issue with both of them.

@Archange427
Copy link

OK, I have just done other tests on a real machine this time...
(yes! I have one almost complete ... for the moment the image comes from the composite output to my TV and not a monitor) but the display is OK.
And as I thought, the scrolling is smooth, no tearing nor jerking...

@tomcw
Copy link
Contributor Author

tomcw commented Aug 25, 2019

Definitely this is because AppleWin isn't synchronising with the PC monitor's display. So some sort of WaitForVerticalBlank() is required. And maybe GDI double-buffering is needed too.

@tomcw
Copy link
Contributor Author

tomcw commented Aug 25, 2019

Note to self: I added support (currently turned off) in e09cd21 for WaitForVerticalBlank() between the StretchBlt() & the GdiFlush(). This now just gives me the sort of tearing that Arnaud is seeing.

NB. WaitForVerticalBlank() is a heavyweight operation that busy-waits until VBL, so CPU usage is very high. See here where someone's solution is to check the scanline via a timer event every 2ms. He uses the scanline to decide where it's time to draw.

@Archange427
Copy link

NB. WaitForVerticalBlank() is a heavyweight operation that busy-waits until VBL, so CPU usage is very high. See here where someone's solution is to check the scanline via a timer event every 2ms. He uses the scanline to decide where it's time to draw.

Very interesting reading, thank you for sharing the link!
And crazy to see that 16 years later, WaitForVerticalBlank is still so crappy ;)

@tomcw
Copy link
Contributor Author

tomcw commented Aug 26, 2019

To simply prevent the tearing (that you have posted screenshots for) I just need to do the Windows video update during the Apple II VBL.

But this still gives juddery (jerky) scrolling :-/

I quickly tried using that heavyweight WaitForVerticalBlank(), but that didn't make much difference. Probably because I'm not updating the Windows display every 60Hz. I need to do further investigation here.

btw. great to hear you have an Apple II again!! :-)

@tomcw
Copy link
Contributor Author

tomcw commented Nov 4, 2019

NB. I committed 4ad0923 to fix the tearing.

@sicklittlemonkey
Copy link
Contributor

sicklittlemonkey commented Nov 5, 2019 via email

@tomcw
Copy link
Contributor Author

tomcw commented Nov 10, 2019

Tearing fixed, so closing this issue.
Jerky scrolling issue moved to #722.

@tomcw tomcw closed this as completed Nov 10, 2019
@tomcw tomcw added this to the 1.29.5 milestone Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants