Separating this out from issue 737981 to avoid creating too much noise.
The particular metric I'm looking at in this bug in memory:chrome:all_processes:reported_by_chrome:malloc:effective_size.
On my local Pixel 2106, the regression of X is from 38.9M to 50.9M.
If we eliminate the ColorSpaceXformCanvas in RasterSource::PlaybackToCanvas, then the regression entirely disappears.
If we also ensure that all input images be sRGB and that the target of the ColorSpaceXformCanvas be sRGB, the regression still remains.
This is somewhat suspicious, because the ColorSpaceXformCanvas should, at this point, be a no-op, but it's using way more memory.
This regression is coming from how we manage SkImage_Lazy::onMakeColorSpace (see issue 729352 for some background there).
What we should probably do here is:
1. make SkImage_Lazy::onMakeColorSpace wrap the initial SkImage_Lazy, with SkColorSpace
2. pass that SkColorSpace to the call to generate_pixels in SkImage_Lazy.cpp
3. ensure that we use the useXformCanvas path in SkPictureImageGenerator::onGetPixels
This an be accomplished by setting an SkColorSpace on SkPixmap created in SkImage_Lazy::lockAsBitmap, which will then be pulled out by SkPictureImageGenerator::onGetPixels. This can be dangerous, though, because usually setting SkImageInfo::fColorSpace is non-legacy behavior, and we want to ensure legacy behavior here.
It appears that both SkPictureImageGenerator::onGetPixels and DecodingImageGenerator::onGetPixels behave the "way we ant them to" in this instance.
To be a bit more succinct about the problem, the issue is that "SkImage_Lazy::onMakeColorSpace" should return a still-lazy SkImage, rather than evaluating the lazy image (and doing color conversion) at that call.
I took a stab at fixing this in https://skia-review.googlesource.com/c/21605/ ... but I didn't get finished with all of SkImage_Lazy::lockTextureProxy -- it's probably worth having Skia folk take a quick look at the direction there to ensure it's not already off the rails.
Comment 1 by ccameron@chromium.org
, Jul 6 2017