[MPlayer-dev-eng] Update to vo_direct3d - saves ~2% CPU time

Georgi Petrov gogothebee at gmail.com
Thu Nov 20 23:07:39 CET 2008


Thanks Jim, I'll take a look at your patch. Everyone - please note
that I may no be home this weekend, so I may not answer to your mails
in the following two days.

I had plans to modify myself big parts of the drawing code, because
it's far from optimal right now. Those include the surface locking,
scene begin/end, the needless stretchrects in draw_slice() and many
other things. I'll see what you have already done when I can.


>> I've optimized away some begin_scene and end_scene
>> combos as they are only needed for actual rendering, not the locking.

Are you sure? I understood that they are needed exactly when locking...

>From useless MSDN:

There should be at most one
IDirect3DDevice9::BeginScene/IDirect3DDevice9::EndScene pair between
any successive calls to present (either IDirect3DDevice9::Present or
IDirect3DSwapChain9::Present). IDirect3DDevice9::BeginScene should be
called once before any rendering is performed, and
IDirect3DDevice9::EndScene should be called once after all rendering
for a frame has been submitted to the runtime. To enable maximal
parallelism between the CPU and the graphics accelerator, it is
advantageous to call IDirect3DDevice9::EndScene as far ahead of
calling present as possible.

I understand that "rendering" means locking and stretchrect. See the
last sentance: it is advantageous to call IDirect3DDevice9::EndScene
as far ahead of calling present as possible. This means that EndScene
should be called when the rendering is done (stretchrect), so we can
execute Present afterward.



More information about the MPlayer-dev-eng mailing list