Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Software rendering resulted in less CPU usage compared to hardware rendering

Tags:

wpf

rendering

I have this WPF app that continuously displays live images from a 5MP digital camera. Images are converted from byte array to bitmapsource first and then displayed in a Image control:

m_imageControl.Source = MyBitMapSource;

While streaming, CPU utilization was about 30-35%. "RenderCapability.Tier >> 16" indicated "Tier 2" so I assume my system should be adequate and WPF will try to utilize hardware rendering as much as possible.

Interestingly, if software rendering was forced by using:

RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;

CPU utilization fell to about 25% and app reported same displayed frame rate (no performance hit).

I am puzzled by this result as I thought hardware render should give better performance (less CPU) than software rendering. Could some one shine some light on this?

My System set-up are:

  • OS: Windows 7 64-bit Utimate
  • CPU: Intel i3 530 Quad-Core 2.93HGhz
  • Video Card: NVIDIA GeForce GT 520 1G dedicated RAM
  • Video Card Driver: NVIDIA 8.17.12.9573 09/02/2012
like image 383
seekingalpha Avatar asked Nov 03 '22 19:11

seekingalpha


1 Answers

Answer from here

Images are converted from byte array to bitmapsource first and then displayed in a Image control:"

When you use hardware rendering, this is forcing it to serialize the new image to your GPU every frame. Normally, the GPU can cache the imagery, so the serialization overhead is smaller than the rendering overhead -but in your case, you're throwing away the image on the GPU constantly, so there's no advantage to pushing it to the GPU and rendering in hardware.

By forcing software rendering, you avoid the push to the GPU every frame, which is why it's actually performing better in this case.

like image 183
Kelly Elton Avatar answered Nov 08 '22 08:11

Kelly Elton