Author Topic: GDI Vertical blank and vertical retrace test  (Read 18238 times)

felipe

  • Member
  • *****
  • Posts: 1367
Re: GDI Vertical blank and vertical retrace test
« Reply #30 on: April 23, 2018, 08:54:52 AM »
In this second computer with a resolution of 1280x1024 (and windows 8.1):

The format is fine now (no lines overlapping).

average VerticalBlankPeriod: 0.670040437 miliseconds.
average MonitorFrequency:60.018938442hz.
PixelFormat ?? (Type):22 Firts frame, vertical blank 0.667589508 ms, Frame delta 16.656695063 ms.

Btw, i like to see those numbers moving so fast.  :bgrin:

LordAdef

  • Member
  • ****
  • Posts: 669
Re: GDI Vertical blank and vertical retrace test
« Reply #31 on: April 23, 2018, 08:57:25 AM »
Marinus,

I've got an old laptop running XP. If no one tested, I could get it running and I'll test it for yoh

Siekmanski

  • Member
  • *****
  • Posts: 2371
Re: GDI Vertical blank and vertical retrace test
« Reply #32 on: April 23, 2018, 09:09:19 AM »
Marinus,

I've got an old laptop running XP. If no one tested, I could get it running and I'll test it for yoh

I would really appreciate it, many thanks in advance.  :t
XP is not tested yet.
Creative coders use backward thinking techniques as a strategy.

LordAdef

  • Member
  • ****
  • Posts: 669
Re: GDI Vertical blank and vertical retrace test
« Reply #33 on: April 23, 2018, 09:14:47 AM »
I'll do it, no problems!

Lonewolff

  • Member
  • ***
  • Posts: 336
Re: GDI Vertical blank and vertical retrace test
« Reply #34 on: April 23, 2018, 09:58:38 AM »


Windows 10  :t

FORTRANS

  • Member
  • *****
  • Posts: 1110
Re: GDI Vertical blank and vertical retrace test
« Reply #35 on: April 24, 2018, 12:03:06 AM »
Hi Marinus,

Marinus,

I've got an old laptop running XP. If no one tested, I could get it running and I'll test it for yoh

I would really appreciate it, many thanks in advance.  :t
XP is not tested yet.

   My XP laptop said; "GDIVERTI.EXE has encountered a problem
and needs to close.  We are sorry for the inconvenience."  And goes
on like that for quite a bit.

   Do I need to download a DLL or some such?

HTH,

Steve N.

Siekmanski

  • Member
  • *****
  • Posts: 2371
Re: GDI Vertical blank and vertical retrace test
« Reply #36 on: April 24, 2018, 01:08:53 AM »
Hi Steve,

Not that I'm aware of.
The test program continuously polls the Vertical blank signal using all the CPU resources of the thread it is running on. (this will be reduced to 1 poll per screen refresh rate in the final routine)
15 years ago I made an attempt using this same technique, back then there where video cards that didn't support that function too.
I'll see if I can check the capabilities of the video cards and report if it supports polling the Vertical blank signal.

Thanks for the report, almost forgot about this issue.
Creative coders use backward thinking techniques as a strategy.

daydreamer

  • Member
  • *****
  • Posts: 1751
  • building nextdoor
Re: GDI Vertical blank and vertical retrace test
« Reply #37 on: April 25, 2018, 12:26:30 AM »
Hi Steve,

Not that I'm aware of.
The test program continuously polls the Vertical blank signal using all the CPU resources of the thread it is running on. (this will be reduced to 1 poll per screen refresh rate in the final routine)
15 years ago I made an attempt using this same technique, back then there where video cards that didn't support that function too.
I'll see if I can check the capabilities of the video cards and report if it supports polling the Vertical blank signal.

Thanks for the report, almost forgot about this issue.
is it possible to use two cores/two threads and use LOCK prefix to synchronize
or some other way to backbuffer ->screen copy so that it doesnt flicker?
one thread is drawing,second thread is checking Vblank and scanline
maybe start/stop workerthread when vblank/notvblank?

SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

Siekmanski

  • Member
  • *****
  • Posts: 2371
Re: GDI Vertical blank and vertical retrace test
« Reply #38 on: April 25, 2018, 12:56:53 AM »
That's the plan, 1 backbuffer that blits to the front buffer while the drawing starts immediatly at the second backbuffer, using 2 threads each on another core.

http://masm32.com/board/index.php?topic=7075.msg76192#msg76192
Creative coders use backward thinking techniques as a strategy.

FORTRANS

  • Member
  • *****
  • Posts: 1110
Re: GDI Vertical blank and vertical retrace test
« Reply #39 on: April 25, 2018, 02:18:10 AM »
Hi,

   Ran the program on another notebook with WinXP to see if
changing the video chipset makes a difference.  It did not, same
error occurred.  ATI Mobility Radeon in the first, Intel in the second.

Regards,

Steve N.

LordAdef

  • Member
  • ****
  • Posts: 669
Re: GDI Vertical blank and vertical retrace test
« Reply #40 on: April 25, 2018, 04:05:01 AM »
Quote
If I'm right and we own the window (like in DX9), you can paint immediatly using the window hdc and skip BeginPaint and EndPaint. But, blitting to the window must be in sync with the monitors refresh rate, this is the thing to tackle, prevent tearing. ( preventing tearing, I think this is the task for BeginPaint and EndPaint )


Marinus, you don't need BeginPaint/EndPaint. I was cleaning my code logic and spent some time researching this. Game develpers do paint outside ==Paint. It's in fact how I am doing right now. I set my window as OWNED, so we can freely paint to it.

caballero

  • Member
  • *****
  • Posts: 1639
  • Matrix - Noah
    • abre ojos ensamblador
Re: GDI Vertical blank and vertical retrace test
« Reply #41 on: April 25, 2018, 04:35:04 AM »
Quote
If I'm right and we own the window (like in DX9), you can paint immediatly using the window hdc and skip BeginPaint and EndPaint. But, blitting to the window must be in sync with the monitors refresh rate, this is the thing to tackle, prevent tearing. ( preventing tearing, I think this is the task for BeginPaint and EndPaint )


Marinus, you don't need BeginPaint/EndPaint. I was cleaning my code logic and spent some time researching this. Game develpers do paint outside ==Paint. It's in fact how I am doing right now. I set my window as OWNED, so we can freely paint to it.
How interesting, an example, please
The logic of the error is hidden among the most unexpected lines of the program

LordAdef

  • Member
  • ****
  • Posts: 669
Re: GDI Vertical blank and vertical retrace test
« Reply #42 on: April 25, 2018, 04:42:07 AM »
Quote
If I'm right and we own the window (like in DX9), you can paint immediatly using the window hdc and skip BeginPaint and EndPaint. But, blitting to the window must be in sync with the monitors refresh rate, this is the thing to tackle, prevent tearing. ( preventing tearing, I think this is the task for BeginPaint and EndPaint )


Marinus, you don't need BeginPaint/EndPaint. I was cleaning my code logic and spent some time researching this. Game develpers do paint outside ==Paint. It's in fact how I am doing right now. I set my window as OWNED, so we can freely paint to it.
How interesting, an example, please


Sure! but in the mean time, have a look at the link I provided of Casey Moratori's C game (the thread of references I posted here at the gave forum). He is one example, ==PAINT is only used to refresh the gui. the whole game is rendered outside the win message. It's called from the game loop.


I am doing this way and I find the blt to be more steady


Are you in win10? My code is currently broken for win 7. If so, I could post it for you




caballero

  • Member
  • *****
  • Posts: 1639
  • Matrix - Noah
    • abre ojos ensamblador
Re: GDI Vertical blank and vertical retrace test
« Reply #43 on: April 25, 2018, 04:58:00 AM »
W7 here, but you could post it here any way and we may have a look to it.
The logic of the error is hidden among the most unexpected lines of the program

Siekmanski

  • Member
  • *****
  • Posts: 2371
Re: GDI Vertical blank and vertical retrace test
« Reply #44 on: April 25, 2018, 05:10:33 AM »
Own the window,  wc.style, CS_HREDRAW or CS_VREDRAW or CS_OWNDC
Call your routines from the timer and the hdc from the owned window
Don't use WM_PAINT, BeginPaint and EndPaint
Don't use InvalidateRect

I have tested this and it works ( although still without a backbuffer )
Creative coders use backward thinking techniques as a strategy.