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

Issue 2543473005: Draw omnibox shadow with a ninebox layer.

Created:
4 years ago by Evan Stade
Modified:
4 years ago
Reviewers:
danakj, sadrul
CC:
chromium-reviews, tfarina, cc-bugs_chromium.org, James Su
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Draw omnibox shadow with a ninebox layer. This will tile the shadow image in hardware rather than software. The visual result is unchanged. BUG= CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Patch Set 1 #

Total comments: 4

Patch Set 2 : (not for commit --- added benchmarking code) #

Unified diffs Side-by-side diffs Delta from patch set Stats (+198 lines, -35 lines) Patch
M cc/layers/nine_patch_layer.h View 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h View 1 4 chunks +7 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc View 1 9 chunks +186 lines, -33 lines 0 comments Download
M ui/compositor/compositor.h View 1 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 15 (4 generated)
Evan Stade
Hi Sadrul, could you take a look? I think this is along the lines of ...
4 years ago (2016-12-01 02:39:02 UTC) #4
Evan Stade
Hi Sadrul, could you take a look? I think this is along the lines of ...
4 years ago (2016-12-01 02:39:02 UTC) #5
Evan Stade
oops, sorry for the double send. I also meant to say +pkasting as FYI for ...
4 years ago (2016-12-01 02:40:08 UTC) #6
Peter Kasting
Does drawing this in hardware get us some power savings (or some other nicety)?
4 years ago (2016-12-01 04:43:47 UTC) #7
Evan Stade
On 2016/12/01 04:43:47, Peter Kasting wrote: > Does drawing this in hardware get us some ...
4 years ago (2016-12-01 17:33:21 UTC) #8
sadrul
[sorry about the late review, I have been out sick for the last few days] ...
4 years ago (2016-12-06 20:05:22 UTC) #10
danakj
On 2016/12/06 20:05:22, sadrul (OOO) wrote: > [sorry about the late review, I have been ...
4 years ago (2016-12-06 21:41:44 UTC) #11
Evan Stade
> So this is slightly complicated and need to think about the whole system. > ...
4 years ago (2016-12-06 23:25:48 UTC) #12
danakj
On Tue, Dec 6, 2016 at 3:25 PM, <estade@chromium.org> wrote: > > So this is ...
4 years ago (2016-12-06 23:32:37 UTC) #13
Evan Stade
On 2016/12/06 23:32:37, danakj wrote: > On Tue, Dec 6, 2016 at 3:25 PM, <mailto:estade@chromium.org> ...
4 years ago (2016-12-07 01:18:33 UTC) #14
danakj
4 years ago (2016-12-07 01:32:50 UTC) #15
On Tue, Dec 6, 2016 at 5:18 PM, <estade@chromium.org> wrote:

> On 2016/12/06 23:32:37, danakj wrote:
>
> > On Tue, Dec 6, 2016 at 3:25 PM, <mailto:estade@chromium.org> wrote:
> >
> > > > So this is slightly complicated and need to think about the whole
> system.
> > > >
> > > > The strength of NinePatchLayer is that it can use UIResources.
> > > >
> > > https://cs.chromium.org/chromium/src/cc/layers/ui_resource_
> > > layer.h?rcl=1481041267&l=33
> > > >
> > > > UIResources are upload-once-use-many things that cc manages for you.
> So
> > > when
> > > you
> > > > have 5 NinePatch layers and they all use the same UIResource, you
> have
> > > memory
> > > > for the bitmap and the texture only once. If, however, you give a
> bitmap
> > > to
> > > > every NinePatch layer (what this patch is doing) it can't tell they
> are
> > > the
> > > same
> > > > and it will upload it for each layer so you get 1 bitmap 5 textures
> > > which is
> > > > worse for memory.
> > > >
> > > > If you use a PictureLayer (ie views painting) it can't share
> anything so
> > > you
> > > get
> > > > 1 bitmap (since we share it as a global here) placed into 5
> recordings,
> > > rastered
> > > > into 5 tilings (1 per layer). That's poor for memory *and* has
> additional
> > > > CPU/GPU overhead to raster the bitmap into a tiling in this case.
> > > >
> > > > So if the # of layers is constant the cost is roughly
> > > > cpu/gpu: PictureLayer/painting > NinePatch with bitmap = NinePatch
> with
> > > > UIResource
> > > > memory: PictureLayer/painting = NinePatch with bitmap > NinePatch
> with
> > > > UIResource
> > > >
> > > > If the number of layers is changing then you have to take into
> account
> > > the
> > > > *overlapping* surface area of the layers, and double count that for
> both
> > > costs.
> > > > There's also some additional computational overhead per layer but
> it's
> > > small
> > > per
> > > > layer (adds up for hundreds of layers).
> > > >
> > > > Does this help?
> > >
> > > yes, thanks. So to be clear, the bitmap we're using for the ninebox is
> > > 1x11px.
> > > Even if we have to upload that for every omnibox layer, that bitmap in
> > > itself
> > > seems like a pretty small memory footprint. The bitmap is tiled many
> times
> > > horizontally (like 1000 times if your screen is 1000px wide). Are you
> > > saying
> > > that this uses up memory proportional to the number of times it's
> tiled?
> > > Before
> > > this patch, i.e. using PictureLayer, I would expect that to be true,
> but I
> > > had
> > > hoped this patch would address that.
> > >
> >
> > With PictureLayer in the UI we will raster it without applying the
> layer's
> > transform. In blink we do differently and raster based on the layer
> > transform. So these should both look and use the same memory WRT layer
> > transform/scaling.
> >
> > However here you're saying tiled, I did not know that UIResourceLayer
> does
> > repeating textures which is how i read that, so I wonder if you mean
> > scaling here or something else. I would expect the shadow to be stretched
> > not tiled (which results in the same output maybe if its 1px wide but
> just
> > so we're speaking the same language).
>
> OK, I guess they're stretched, but tiling and stretching do the same thing
> for a
> properly formatted ninebox, where the top/bottom/left/right tiles should
> always
> be 1px thick. Either way, it seems like ninebox layers should only use as
> much
> memory as the ninebox image itself (in this case, 44 bytes or so). Is that
> not
> the case?
>

Yep that's correct if I'm understanding everything right. You can use
about:tracing to record memory if you want to measure thing btw.
(documented in
https://cs.chromium.org/chromium/src/docs/memory-infra/probe-cc.md?q=/docs/me...
)


>
>
> >
> >
> > >
> > > How would one use a UIResourceLayer? In codesearch, I don't see any
> uses
> > > outside
> > > of tests of UIResourceLayer::SetUIResourceId.
> > >
> >
> > Android uses it which doesn't show up in codesearch easily. LayerTreeHost
> > provides ways to make a UIResource and then u can use it for any layer on
> > that host.
> >
> >
> > >
> > > https://codereview.chromium.org/2543473005/
> > >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-reviews" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> email
> > to mailto:chromium-reviews+unsubscribe@chromium.org.
>
>
>
> https://codereview.chromium.org/2543473005/
>

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698