obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

libobs: Remove extra gs_flush calls

Open kkartaltepe opened this issue 1 year ago • 3 comments

Description

These calls introduce pipeline stalls in OpenGL on low end machines which can contribute to a fairly significant 10-30% of total rendering time. On average (since not every frame stalls) this is ~5% improvement with gpu time decreasing from 6.3ms to 6.0ms when encoders are active.

The driver already needs to synchronize events within the context so these calls are not needed for correctness for OpenGL.

Motivation and Context

Squeeze out a bit more perf on very low end devices where encoders could go faster if the rendering was faster. It matters more for intel than AMD in my tests but the intel is far weaker than my AMD device.

How Has This Been Tested?

Rendering vaapi and qsv texture encoders on amd and intel devices and I didnt notice any differences in output.

If I'm reading the D3D11 pages correctly for flush it seems it wont even introduce the gpu-gpu sync that it does on OpenGL so these are only trying to submit commands faster in Windows? I would appreciate testing on windows to know if these were providing any significant performance improvements there.

Types of changes

  • Performance enhancement (non-breaking change which improves efficiency)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

kkartaltepe avatar Apr 24 '24 03:04 kkartaltepe

Seems to work fine on Windows as well.

derrod avatar May 04 '24 23:05 derrod

There was another question about vram usage on windows without the flush, so maybe its worth checking that too.

kkartaltepe avatar May 04 '24 23:05 kkartaltepe

I don't see any difference in VRAM usage.

derrod avatar May 04 '24 23:05 derrod