Enabling VSync should take care of tearing; I think the VESA spec has a way to 
enable that feature internally without you writing code for it.

Also, proper double buffering will go a long way towards eliminating tear and 
flicker.

Sent from ProtonMail mobile

-------- Original Message --------
On Jul 3, 2018, 10:56 AM, TK Chia wrote:

> Hello Mr. Bertho,
>
> Thanks for the tips. However, I suspect that knowing when exactly
> vertical retraces occur is still relevant to modern monitors (and OSes),
> where one needs to prevent "screen tearing" and other nasty artefacts.
> So I would think it is still useful to know how to do it right.
>
> Thank you!
> --
> https://github.com/tkchia
>
> On 07/01/2018 09:45 PM, Bertho Grandpied via Freedos-devel wrote:
>> On Sat, 30 Jun 2018 ,David McMackins wrote :
>>
>> > Anyway, I'm figuring out VGA and VESA graphics programming, but one
>> > thing I can't find is how to wait for an interrupt to tell me when the
>> > vblank period starts so that I can vsync.
>>
>> The vertical interrupt was indeed part of IBM's
>> original video systems for the PC (MDA,CGA,
>> EGA), up to and including the original VGA for
>> the PS/2, but don't count on it on any modern
>> VGA,SVGA, etc (in-)compatibles ! The main use
>> for monitoring that interrupt (where available) was
>> in order to avoid so-called "snow" effects, but that
>> would be before fast, dual-ported "VRAM" were
>> introduced. There is no need to coordinate
>> video memory accesses to/from CPU and the
>> video adapter any more; the only remaining use
>> for hooking vertical retrace I can think of is
>> in order to measure vertical retrace frequencies,
>> and that doesn't require the interrupt - simply poll
>> the V-retrace bit = bit 3 at input port 3DAh
>> (or 3BA in B/W mono).
>>
>> Anyway... if your, presumably very old, VGA card
>> did support the Vertical interrupt, it should be routed
>> as IRQ 9, interrupt #71h, on an AT-compatible (IRQ 2
>> on an original PC or PC/XT). On the EGA/VGA, you'd
>> have to ENABLE that V-retrace interrupt explicitly,
>> by REsetting bit 5 of the CRTC register #11h, and
>> then hook the HW interrupt in your programme, of
>> course.
>>
>> In any case you are welcome to try your HW for
>> generating that interrupt, using the preceding indications,
>> there are no risks in testing IMHO : but there is
>> also very little chance of success on any PC video
>> system less than 25 yrs old :=)
>>
>> HTH anyway, and happy hackings
>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Freedos-devel mailing list
> Freedos-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/freedos-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to