Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Issue 1808633002: Use preferred format to allocate memory for decoded images (Closed)

Created:
4 years, 9 months ago by bashi
Modified:
4 years, 9 months ago
Reviewers:
vmpstr, reveman, reed2, reed1
CC:
cc-bugs_chromium.org, chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Use preferred format to allocate memory for decoded images We use fixed color format (kN32_SkColorType) to decode images. Since the default preferred format is 16-bit color on low-end devices, we can reduce memory footprint by storing decoded image in 16-bit color format when we use the default settings for the preferred format. This CL makes SoftwareImageDecodeController allocate memory based on the preferred format. I ran memory.blink_memory_mobile 20 times. The results can be found at [1]. I removed SimulateMemoryPressureNotification() so that I can observe memory usage in common patterns (still, memory pressure notifications would be sent if memory usage is high). According to the results, we could reduce ~40% discardable memory on average. Note that Blink still uses fixed 32-bit color for decoding. This means that skia/cc will convert decoded images when we store decoded image in 16-bit color. We might want to make Blink's decoding format configurable in the future. [1] https://drive.google.com/file/d/0B6NYyLPujP4TaWItc3lsZXR6TTg/view?usp=sharing BUG=519146 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Committed: https://crrev.com/0c87a7ea398b77020298f09abe3fd946a0627603 Cr-Commit-Position: refs/heads/master@{#381859}

Patch Set 1 #

Total comments: 2

Patch Set 2 : Addressed comment #

Total comments: 5

Patch Set 3 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+42 lines, -7 lines) Patch
M cc/tiles/software_image_decode_controller.h View 2 chunks +3 lines, -1 line 1 comment Download
M cc/tiles/software_image_decode_controller.cc View 1 2 3 chunks +37 lines, -5 lines 0 comments Download
M cc/trees/layer_tree_host_impl.cc View 1 2 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 20 (7 generated)
bashi
PTAL? Though we might add one extra copy I think this would be worth doing. ...
4 years, 9 months ago (2016-03-16 07:24:22 UTC) #3
haraken
> According to the results, we could reduce ~40% discardable memory on average. !!!
4 years, 9 months ago (2016-03-16 14:07:34 UTC) #4
reveman
https://codereview.chromium.org/1808633002/diff/1/cc/trees/layer_tree_host_impl.cc File cc/trees/layer_tree_host_impl.cc (right): https://codereview.chromium.org/1808633002/diff/1/cc/trees/layer_tree_host_impl.cc#newcode2149 cc/trees/layer_tree_host_impl.cc:2149: settings_.renderer_settings.preferred_tile_format)); What if preferred_tile_format is a compressed format? e.g. ...
4 years, 9 months ago (2016-03-16 14:53:36 UTC) #5
bashi
Thanks for review! https://codereview.chromium.org/1808633002/diff/1/cc/trees/layer_tree_host_impl.cc File cc/trees/layer_tree_host_impl.cc (right): https://codereview.chromium.org/1808633002/diff/1/cc/trees/layer_tree_host_impl.cc#newcode2149 cc/trees/layer_tree_host_impl.cc:2149: settings_.renderer_settings.preferred_tile_format)); On 2016/03/16 14:53:35, reveman wrote: ...
4 years, 9 months ago (2016-03-17 01:52:14 UTC) #6
reveman
+reed to verify that using these SkColorTypes for images is well supported by skia +vmpstr ...
4 years, 9 months ago (2016-03-17 04:31:14 UTC) #8
reed1
lgtm https://codereview.chromium.org/1808633002/diff/20001/cc/tiles/software_image_decode_controller.cc File cc/tiles/software_image_decode_controller.cc (right): https://codereview.chromium.org/1808633002/diff/20001/cc/tiles/software_image_decode_controller.cc#newcode122 cc/tiles/software_image_decode_controller.cc:122: case LUMINANCE_8: kGray_8_SkColorType https://codereview.chromium.org/1808633002/diff/20001/cc/tiles/software_image_decode_controller.cc#newcode125 cc/tiles/software_image_decode_controller.cc:125: case LUMINANCE_F16: BTW ...
4 years, 9 months ago (2016-03-17 14:38:23 UTC) #10
bashi
https://codereview.chromium.org/1808633002/diff/20001/cc/tiles/software_image_decode_controller.cc File cc/tiles/software_image_decode_controller.cc (right): https://codereview.chromium.org/1808633002/diff/20001/cc/tiles/software_image_decode_controller.cc#newcode122 cc/tiles/software_image_decode_controller.cc:122: case LUMINANCE_8: On 2016/03/17 14:38:23, reed1 wrote: > kGray_8_SkColorType ...
4 years, 9 months ago (2016-03-17 23:29:38 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1808633002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1808633002/40001
4 years, 9 months ago (2016-03-17 23:32:22 UTC) #14
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 9 months ago (2016-03-18 01:05:32 UTC) #15
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/0c87a7ea398b77020298f09abe3fd946a0627603 Cr-Commit-Position: refs/heads/master@{#381859}
4 years, 9 months ago (2016-03-18 01:07:31 UTC) #17
vmpstr
https://codereview.chromium.org/1808633002/diff/40001/cc/tiles/software_image_decode_controller.h File cc/tiles/software_image_decode_controller.h (right): https://codereview.chromium.org/1808633002/diff/40001/cc/tiles/software_image_decode_controller.h#newcode99 cc/tiles/software_image_decode_controller.h:99: explicit SoftwareImageDecodeController(ResourceFormat format = RGBA_8888); Default parameters are prohibited ...
4 years, 9 months ago (2016-03-21 20:00:45 UTC) #18
bashi
On 2016/03/21 20:00:45, vmpstr wrote: > https://codereview.chromium.org/1808633002/diff/40001/cc/tiles/software_image_decode_controller.h > File cc/tiles/software_image_decode_controller.h (right): > > https://codereview.chromium.org/1808633002/diff/40001/cc/tiles/software_image_decode_controller.h#newcode99 > ...
4 years, 9 months ago (2016-03-21 23:42:35 UTC) #19
vmpstr
4 years, 9 months ago (2016-03-21 23:59:07 UTC) #20
Message was sent while issue was closed.
On 2016/03/21 23:42:35, bashi1 wrote:
> On 2016/03/21 20:00:45, vmpstr wrote:
> >
>
https://codereview.chromium.org/1808633002/diff/40001/cc/tiles/software_image...
> > File cc/tiles/software_image_decode_controller.h (right):
> > 
> >
>
https://codereview.chromium.org/1808633002/diff/40001/cc/tiles/software_image...
> > cc/tiles/software_image_decode_controller.h:99: explicit
> > SoftwareImageDecodeController(ResourceFormat format = RGBA_8888);
> > Default parameters are prohibited in Chromium.
> 
> Thanks for fixing the style!

:) It's not a big deal, I was just surprised to find that. Thanks for the patch!

Powered by Google App Engine
This is Rietveld 408576698