vdpau: flush the context before exporting the surface v2
vdpau: flush the context before exporting the surface v2

Bugzilla (bug needs XBMC changes as well):
https://bugs.freedesktop.org/show_bug.cgi?id=73191

When VL uploads vertex buffers, it uses PIPE_TRANSFER_DONTBLOCK, which always
flushes the context in the winsys if the buffer being mapped is busy. Since
I added handling of DISCARD_RANGE, DONTBLOCK has had no effect when combined
with DISCARD_RANGE and I think the context isn't flushed anywhere else,
so no commands are submitted to the GPU until the IB is full, which takes
a lot of frames.

Using DISCARD_RANGE is not the only way to trigger this bug. The other way
is to reallocate the vertex buffer before every upload.

BTW, I'm not sure if this is the right place for flushing, but it does fix
the bug.

v2 (chk): move the flush to the right place.

Signed-off-by: Christian König <c7ea837d7a46effe4232b086213468b8b31643bf@amd.com>
Tested-by: db8938f3943d6a5672256287a55180be3a9ee3ca@strangenoises.org)

jbarczak/glsl-optimizer,dellis1972/glsl-optimizer,dellis1972/glsl-optimizer,dellis1972/glsl-optimizer,wolf96/glsl-optimizer,metora/MesaGLSLCompiler,zz85/glsl-optimizer,mcanthony/glsl-optimizer,djreep81/glsl-optimizer,zeux/glsl-optimizer,bkaradzic/glsl-optimizer,zeux/glsl-optimizer,tokyovigilante/glsl-optimizer,zz85/glsl-optimizer,benaadams/glsl-optimizer,jbarczak/glsl-optimizer,benaadams/glsl-optimizer,benaadams/glsl-optimizer,benaadams/glsl-optimizer,jbarczak/glsl-optimizer,jbarczak/glsl-optimizer,dellis1972/glsl-optimizer,zeux/glsl-optimizer,metora/MesaGLSLCompiler,zz85/glsl-optimizer,bkaradzic/glsl-optimizer,bkaradzic/glsl-optimizer,benaadams/glsl-optimizer,djreep81/glsl-optimizer,tokyovigilante/glsl-optimizer,tokyovigilante/glsl-optimizer,zeux/glsl-optimizer,bkaradzic/glsl-optimizer,mapbox/glsl-optimizer,tokyovigilante/glsl-optimizer,wolf96/glsl-optimizer,bkaradzic/glsl-optimizer,jbarczak/glsl-optimizer,zz85/glsl-optimizer,wolf96/glsl-optimizer,djreep81/glsl-optimizer,mapbox/glsl-optimizer,mcanthony/glsl-optimizer,mapbox/glsl-optimizer,mcanthony/glsl-optimizer,mapbox/glsl-optimizer,djreep81/glsl-optimizer,djreep81/glsl-optimizer,wolf96/glsl-optimizer,zz85/glsl-optimizer,tokyovigilante/glsl-optimizer,mcanthony/glsl-optimizer,mapbox/glsl-optimizer,mcanthony/glsl-optimizer,zeux/glsl-optimizer,wolf96/glsl-optimizer,benaadams/glsl-optimizer,dellis1972/glsl-optimizer,metora/MesaGLSLCompiler,zz85/glsl-optimizer