Welcome to MSDN Blogs Sign in | Join | Help

Perf Debugging Tips: EnableRedrawRegions & a performance bug in VideoBrush

Was chatting with Andy Beaulieu at Remix Boston, and he was commenting that it seems that Silverlight only draws when needed -- it is true, we try to not waste your CPU cycles. For Perf debugging, a way to tell when you are causing a redraw is to turn on the control's EnableRedrawRegions property.

agControl.settings.EnableRedrawRegions = true;

With this feature on, when a section of the plugin causes a draw, that section will draw in a different color. This setting is not for those susceptible to seizures =P

Bug found: With this setting, I investigated a performance issue with VideoBrush. In our 1.0 Silverlight bits, VideoBrush always requests a redraw in the next frame. This is a bug. Unfortunately, if the control framerate is set to the default (60 fps), then any VideoBrush will be redrawn 60 times in a second. In actuality, VideoBrush should draw at the framerate that its media is getting refreshed (eg. 30fps, 15fps, or 0fps if paused), and should not take up so many CPU cycles. We have a fix for this bug in 1.1. If you are blocked by this bug, please let me know and I can pass the info along to our servicing team.

[update] By the way, this bug was fixed in a servicing pack in dec 2007.

A workaround is to set the framerate on your Silverlight control to be the same as the framerate of your video. There are visual artifacts to this workaround, but it is slight

Sys.Silverlight.createObjectEx({

source: "xaml/Scene.xaml",

parentElement: document.getElementById("SilverlightControlHost"),

id: "SilverlightControl",

properties: {

width: "500",

height: "500",

background: "black",

framerate: "30"    //only as much as needed

}

Published Sunday, October 07, 2007 6:50 PM by seemar

Comments

# Techy News Blog » Perf Debugging Tips: EnableRedrawRegions & a performance bug in VideoBrush

# ReMIX07 Boston ReCap

Friday, October 12, 2007 3:17 PM by Bob's Blog

While the main event may be over the conversation continues on-line. You can stay on top of the all the

# Miguel de Icaza: Moonlight at the Boston Remix Conference

Tuesday, October 16, 2007 1:31 PM by 工程師的雞排攤

On Monday I joined Brad on stage at the Boston Remix conference to show a preview of Moonlight . As you

# Tracking Silverlight Performance - Redraw Regions

Friday, January 18, 2008 4:14 PM by POKE 53280,0: Pete Brown's Blog

Seema Ramchandani gave a talk back at ReMIX07 in Boston which conflicted with my "Real World Silverlight"

# Silverlight Cream for 18 January, 2008 -2 -- #174

Friday, January 18, 2008 6:33 PM by Community Blogs

Late Cream for today: Ink Drawing by Julia Lerman, Seema Ramchandani exposes EnableRedrawRegions, and

# Using Windowless Silverlight Controls To Blend HTML and Silverlight Elements

Friday, February 15, 2008 4:00 AM by Jon Galloway

Silverlight 1.0 has no intrinsic controls. Forget about dropdowns and sliders, Silverlight 1.0 doesn

Anonymous comments are disabled
 
Page view tracker