New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 599250 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

ChromeContentClient::SetActiveUrl is expensive in video playback scenario

Project Member Reported by stanisc@chromium.org, Mar 30 2016

Issue description

This is something I've noticed in a few ETW profiles that I've taken profiling h.264 media playback on Windows 7.

ChromeContentClient::SetActiveUrl is called repeatedly with different urls and ends up taking 9% of GpuCommandBufferStub::OnMessageReceived cost.

OnMessageReceived uses FastSetActiveURL in attempt to optimize this but the url arg seems to be changing every call or every other call so the optimization doesn't help much. The url seems to be cycling through 3 different values. I wonder if there is a better way to optimize this and avoid spending CPU cycles on something that we shouldn't need unless there is a crash.

// FastSetActiveURL will shortcut the expensive call to SetActiveURL when the
// url_hash matches.
void FastSetActiveURL(const GURL& url, size_t url_hash, GpuChannel* channel) {
  // Leave the previously set URL in the empty case -- empty URLs are given by
  // BlinkPlatformImpl::createOffscreenGraphicsContext3DProvider. Hopefully the
  // onscreen context URL was set previously and will show up even when a crash
  // occurs during offscreen command processing.
  if (url.is_empty())
    return;
  static size_t g_last_url_hash = 0;
  if (url_hash != g_last_url_hash) {
    g_last_url_hash = url_hash;
    DCHECK(channel && channel->gpu_channel_manager() &&
           channel->gpu_channel_manager()->delegate());
    channel->gpu_channel_manager()->delegate()->SetActiveURL(url);
  }
}
 
Components: Internals>Media>Hardware
Here are some numbers to illustrate the cost. This is for about 10-12 seconds of 1080p h.264 playback:
GPU process total - 19,024 samples
GpuCommandBufferStub::OnMessageReceived - 6,328 samples
ChromeContentClient::SetActiveUrl - 564 samples
Yeah, I tried to comment out FastSetActiveURL, but unfortunately that didn't seem to help at all with power. The code to save the crash keys seems to be doing a lot of unnecessary sprintfs and memory allocations, so it should be easy to optimize if we feel that it's worth it.
Owner: sande...@chromium.org
Status: Assigned (was: Untriaged)
What does this code do? I had no idea we even set active urls during playback?
This code stores a URL associated with the currently executing GL context to a crash key, so we can determine what web page a person was visiting when the GPU process crashes.
Hmm, I don't think that's even all that useful. Many of the crashes I see in the GPU process for video are stuff like chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d -- since the crash is rarely at the time of call.
Yeah, it used to be more useful when we had a separate context for each compositor (and no browser compositor). It's still nice for webgl and pepper, though. And it's a bit useful to see what type of context it is that crashed.
Project Member

Comment 8 by sheriffbot@chromium.org, Aug 9 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: sande...@chromium.org
Owner: stani@chromium.org
Status: Assigned (was: Untriaged)
I'll take this and investigate if this is still an issue. I remember seeing some changes in that area.
Owner: stanisc@chromium.org
I suggest we remove the code that sets active URL in the GPU code.

I did another round of testing. It looks like there is a difference in power usage although it isn't large - about 0.02 - 0.025 Wt.

Here are some concrete numbers, which I've got using jbauman's python script when running 1080p MP4 video in a small window (to minimize variability of power usage).

With SetActiveURL call in place: 2.71, 2.68, 2.58, 2.65, 2.68, 2.67
Without SetActiveURL call:       2.63, 2.64, 2.65, 2.55, 2.64, 2.65

Considering this Active URL isn't actually a page URL I think it is of a limited use for debugging.
The possible values are:
- chrome://gpu/MusContextFactory
- chrome://gpu/RenderThreadImpl::CreateOffscreenContext/" +
           ui::command_buffer_metrics::ContextTypeToString(type))
- "chrome://gpu/GpuProcessTransportFactory::CreateContextCommon"


Cc: -jbau...@chromium.org kbr@chromium.org
Components: Internals>GPU
+1, that thing is completely useless AFAIK, per c#6. +Internals>GPU, +kbr in case they have different opinions.

Comment 13 by kbr@chromium.org, Oct 17 2017

The URLs are useful for WebGL crashes, where they are valid. See for example crash ID d64a5184eede4443 . Please don't simply remove the mechanism. Instead let's optimize it.

Comment 14 by kbr@chromium.org, Oct 17 2017

For the record, here's a crash database query which filters out most of the non-WebGL crashes for the current Stable channel on Windows:

product.name='Chrome' AND product.version='61.0.3163.100' AND custom_data.ChromeCrashProto.channel='' AND custom_data.ChromeCrashProto.ptype='gpu-process' AND custom_data.ChromeCrashProto.url.raw!='chrome://gpu/RenderThreadImpl::CreateOffscreenContext/Media' AND custom_data.ChromeCrashProto.url.raw!='chrome://gpu/GpuProcessTransportFactory::CreateContextCommon' AND custom_data.ChromeCrashProto.url.raw!='chrome://gpu/RenderThreadImpl::CreateOffscreenContext/RenderWorker' AND custom_data.ChromeCrashProto.url.raw!='chrome://gpu/RenderThreadImpl::CreateOffscreenContext/Offscreen-MainThread'

Comment 17 by piman@chromium.org, Oct 25 2017

I suppose we could land that fix, but we really want to be able to put real URLs in there, to make crashes more actionable, at which point it would regress. I would kind of prefer optimizing the implementation.
Owner: ----
Status: Available (was: Assigned)
Project Member

Comment 19 by sheriffbot@chromium.org, Nov 2

Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: -ericde@chromium.org tmathmeyer@chromium.org liber...@chromium.org zmo@chromium.org sunn...@chromium.org
Would be nice to optimize this if we think it's still an issue, +more recent folks working on gpu stuff
Status: Available (was: Untriaged)

Sign in to add a comment