MacViews: Images used by themes are not cached |
|||||
Issue descriptionTo reproduce: 1. Install Morpheon Dark (https://chrome.google.com/webstore/detail/morpheon-dark/mafbdhjdkjnoafhfelkjpchpaepjknad) 2. Enable UI GPU raster --enable-features=ViewsBrowserWindows,UiGpuRasterization - ViewsBrowserWindows may be needed on Mac - UiGpuRasterization is needed on non-Mac 3. Trace opening a tab (with cc, gpu enabled). The trace will look similar to the attached trace. - Starting at 3436.419 ms, we upload a 3840x240 image (in GpuMain) - Then we upload an image of the same size at 3442.840 ms, 3450.659 ms, 3457.856 ms - ... and we continue to upload this same-sized image basically every frame - and each upload costs ~1 ms (some as much as 3 ms) - and jank results
,
Jul 12
It doesn't seem to be coming from CreateFromBitmap (although there are lots of repeats of the same image there, too, just not of this huge image). We seem to be generating lots of new SkImages with new SkImage::uniqueID()s through the following path cc::PaintImage::CreateSkImage() cc::PaintImageBuilder::TakePaintImage() gfx::CreateImageRepShaderForScale(gfx::ImageSkiaRep const&, SkShader::TileMode, SkMatrix const&, float) gfx::CreateImageRepShader(gfx::ImageSkiaRep const&, SkShader::TileMode, SkMatrix const&) gfx::Canvas::InitPaintFlagsForTiling(gfx::ImageSkia const&, int, int, float, float, int, int, cc::PaintFlags*) gfx::Canvas::TileImageInt(gfx::ImageSkia const&, int, int, int, int, int, int, float, cc::PaintFlags*) gfx::Canvas::TileImageInt(gfx::ImageSkia const&, int, int, int, int) BrowserNonClientFrameViewMac::PaintThemedFrame(gfx::Canvas*) BrowserNonClientFrameViewMac::OnPaint(gfx::Canvas*) (this is a copy-paste in case there's something obvious -- still digging in)
,
Jul 12
In CreateImageRepShaderForScale, is there a reason that we do:
return cc::PaintShader::MakeImage(
cc::PaintImageBuilder::WithDefault()
.set_id(cc::PaintImage::GetNextId())
.set_image(SkImage::MakeFromBitmap(image_rep.sk_bitmap()),
cc::PaintImage::GetNextContentId())
.TakePaintImage(),
tile_mode, tile_mode, &shader_scale);
as opposed to
return cc::PaintShader::MakeImage(
image_rep.paint_image(),
tile_mode, tile_mode, &shader_scale);
That seems to do it...
,
Jul 12
Oh. Its just something I missed in the original change then. Looking through SkImage::MakeFromBitmap, I think this is the only remaining use in ui. This should fix it: https://chromium-review.googlesource.com/c/chromium/src/+/1135963
,
Jul 13
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/19049df109a2b8cfabf90392bb7a3962a40aca56 commit 19049df109a2b8cfabf90392bb7a3962a40aca56 Author: Khushal <khushalsagar@chromium.org> Date: Fri Jul 13 01:28:34 2018 ui: Dont re-create PaintImages with the same backing bitmap. R=asvitkine@chromium.org Bug: 863038 Change-Id: I520fac764e1cc1fda499a29a46aff3a663ad9ed1 Reviewed-on: https://chromium-review.googlesource.com/1135963 Commit-Queue: Khushal <khushalsagar@chromium.org> Commit-Queue: ccameron <ccameron@chromium.org> Reviewed-by: ccameron <ccameron@chromium.org> Cr-Commit-Position: refs/heads/master@{#574801} [modify] https://crrev.com/19049df109a2b8cfabf90392bb7a3962a40aca56/ui/gfx/skia_paint_util.cc
,
Jul 13
Fixed?
,
Jul 13
,
Jul 13
I think Chris is still investigating repeated calls to PaintImage::CreateFromBitmap which could indicate the ui is unnecessary re-generating bitmaps which have to be uploaded.
,
Jul 17
Yeah, there may yet be more here. I think it's good enough to call done unless I see something else. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by khushals...@chromium.org
, Jul 12