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

Issue 725303 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocked on:
issue 728885

Blocking:
issue 695135



Sign in to add a comment

Clear ShaderTranslatorCache when Chrome goes to background on low-end devices

Project Member Reported by ssid@chromium.org, May 23 2017

Issue description

We found that the shader translation cache can grow upto 1MB on Android in  issue 695135 . We should clear the cache when Chrome goes to background or on memory pressure.
 

Comment 1 by ssid@chromium.org, May 23 2017

Owner: zmo@chromium.org
zmo, do you have time to look at this issue?

Comment 2 by zmo@chromium.org, May 23 2017

Cc: kainino@chromium.org
Owner: ----
Status: Available (was: Untriaged)
Sorry I am focusing on another task, and won't be able to work on this soon.

If you need this now, it's better to find another owner. I can definitely provide some tips on where to look.

Comment 3 by kbr@chromium.org, May 23 2017

Blocking: 695135
Blockedon: 728885
Project Member

Comment 5 by bugdroid1@chromium.org, Jun 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/620bb1e36c3e115f91473d366035acf7dc933ec4

commit 620bb1e36c3e115f91473d366035acf7dc933ec4
Author: aelias <aelias@chromium.org>
Date: Fri Jun 02 18:55:54 2017

Call glReleaseShaderCompiler when GLRenderer loses visibility.

This call is a hint that the driver should release RAM caches that it
may have built to optimize shader compilation from strings.  We should
call it to save RAM when we expect that we will not be compiling any
shaders anytime soon.  The browser going into background is a simple,
deterministic time where we can establish that.

Notes:
- On Android, visibility loss results in GLRenderer (and
Display) destruction instead of a SetVisibility call, so also add a
call in CleanupSharedObjects().
- I plan to hook up ANGLE ShaderTranslatorCache clearing to this signal
in a later patch, as mentioned in the TODO in shader_translator_cache.h.

BUG= 725306 , 725303 
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2916263002
Cr-Commit-Position: refs/heads/master@{#476740}

[modify] https://crrev.com/620bb1e36c3e115f91473d366035acf7dc933ec4/cc/output/gl_renderer.cc

Project Member

Comment 6 by bugdroid1@chromium.org, Jun 8 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/49b5badc7cb27ac9e9c0f65ca6ce04a0b82800e2

commit 49b5badc7cb27ac9e9c0f65ca6ce04a0b82800e2
Author: ssid <ssid@chromium.org>
Date: Thu Jun 08 20:49:38 2017

GLES ProgramCache listens to memory pressure

Change the size limit of gl program cache for android and clear the
cache on memory pressure situations.

BUG= 725303 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2921653005
Cr-Commit-Position: refs/heads/master@{#478080}

[modify] https://crrev.com/49b5badc7cb27ac9e9c0f65ca6ce04a0b82800e2/gpu/command_buffer/common/constants.h
[modify] https://crrev.com/49b5badc7cb27ac9e9c0f65ca6ce04a0b82800e2/gpu/command_buffer/service/gpu_preferences.cc
[modify] https://crrev.com/49b5badc7cb27ac9e9c0f65ca6ce04a0b82800e2/gpu/command_buffer/service/memory_program_cache.cc
[modify] https://crrev.com/49b5badc7cb27ac9e9c0f65ca6ce04a0b82800e2/gpu/command_buffer/service/memory_program_cache.h
[modify] https://crrev.com/49b5badc7cb27ac9e9c0f65ca6ce04a0b82800e2/tools/metrics/histograms/histograms.xml

Comment 7 by ssid@chromium.org, Jul 11 2017

Labels: -Pri-2 Pri-3
Owner: ssid@chromium.org
The shader translator cache does not go away from memory in background because after clearing the GL contexts, the channel gets re-established because of renderer sending in a CreateCommandBuffer message after clearing. This is merely because the SetVisible(false) on the command buffer on renderer side reaches later than the clearing context on browser side.
the only effect of this is the translator cache lives in background (400KB of memory).

The program cache is cleared in background which accounts for most of the gpu memory in this CL:
https://chromium-review.googlesource.com/538076

Discussed with Eric about how to fix this and came up with 2 solutions:
1. OnCreateCommandBuffer returns false from browser / gpu process when in background. We should find the side effect of this if the renderer will stop trying to create command buffer once we go to foreground.

2. Delay the clearing of GL contexts till we send the SetVisibility messages to renderer.

Project Member

Comment 8 by bugdroid1@chromium.org, Jul 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/79fb9f2dadacc419da6ca36c2760a1aaae8fc415

commit 79fb9f2dadacc419da6ca36c2760a1aaae8fc415
Author: Siddhartha <ssid@chromium.org>
Date: Tue Jul 18 18:48:41 2017

Add a delay to clear GL context when app is backgrounded

A common behavior on Android is for the user to press home or recents
button accidently and get back to the app. This behavior would cause
Chrome to clear the contexts and recreate which is a waste of time. So,
add a 5 second delay before clearing the context.
As a side effect, this delay also considerably lowers the risk of the
renderers initializing the GPU command buffer after clearing since they
usually receive the "not-visible" message within 5 seconds.

BUG= 725303 

Change-Id: I7d2655c75b66cf073b82c270baa3f1f3b27b3a8a
Reviewed-on: https://chromium-review.googlesource.com/571294
Commit-Queue: Siddhartha S <ssid@chromium.org>
Reviewed-by: Maria Khomenko <mariakhomenko@chromium.org>
Reviewed-by: Eric Karl <ericrk@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487539}
[modify] https://crrev.com/79fb9f2dadacc419da6ca36c2760a1aaae8fc415/gpu/ipc/service/gpu_channel_manager.cc
[modify] https://crrev.com/79fb9f2dadacc419da6ca36c2760a1aaae8fc415/gpu/ipc/service/gpu_channel_manager.h
[modify] https://crrev.com/79fb9f2dadacc419da6ca36c2760a1aaae8fc415/gpu/ipc/service/gpu_channel_manager_unittest.cc

Comment 9 by ssid@chromium.org, Jul 18 2017

Cc: ericrk@chromium.org
Status: Fixed (was: Available)
Labels: -OS-Android OS-All
The memory-pressure improvements also affect desktop OSes.

Sign in to add a comment