0
Commit Graph

14225 Commits

Author SHA1 Message Date
Austin Sullivan
00d34c8c94 Revert "Add memory alignment parameter to gpu::Buffer"
This reverts commit 2b034ff051.

Reason for revert: broke MSAN bots. See https://crbug.com/1434472

Original change's description:
> Add memory alignment parameter to gpu::Buffer
>
> Bug: 1426766
> Change-Id: I0902bf42975ca0a1bb967208fa51e42f4a74392e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4377798
> Commit-Queue: Sergey Pashaev <bioh@yandex-team.ru>
> Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1131990}

Bug: 1426766
Change-Id: I80d49b1f5712cd50e63f041feac79e9415349aad
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4443370
Reviewed-by: Meredith Lane <meredithl@chromium.org>
Auto-Submit: Austin Sullivan <asully@chromium.org>
Owners-Override: Austin Sullivan <asully@chromium.org>
Commit-Queue: Meredith Lane <meredithl@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1132321}
2023-04-19 04:40:11 +00:00
Ian Clelland
ee7d9f52ff Remove two compositor experiment flags.
This cleanup removes both the ReportFCPOnlyOnSuccessfulCommit and
SkipCommitsIfNotSynchronizingCompositorState flags, as they have been
launched to 100% via finch.

Change-Id: Icd54de9c20d4adc1c359c9c59d43fee455cf98b3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4354091
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: David Bokan <bokan@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1132239}
2023-04-18 23:39:32 +00:00
Christopher Cameron
b84b1efc76 blink::JpegDecoder: Add gainmap support
Implement the function JPEGImageDecoder::GetGainmapInfoAndData. This
calls into Skia to extract an SkGainmapInfo and the SkData for the
underlying gainmap image. This has several inefficiencies that are
outlined in TODOs (required before this can ship).

As an incidental clean-up, factor NeedsToneMapping out of
GpuImageDecodeCache. This was suggested in a previous patch, and
indeed one of the redundant in-lines of NeedsToneMapping was buggy.

Do some incidental clean-up in cc::PaintImageBuilder's gainmap
handling (also suggested in previous patches).

Fix a bug where PaintImage::GetContentColorUsage would identify
sRGB images that have gainmaps as not being HDR.

Bug: 1404000
Change-Id: Iec7f4a080eedf3083506a04ef1b34d2af7d9bcfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4430991
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1132201}
2023-04-18 22:31:51 +00:00
Sergey Pashaev
2b034ff051 Add memory alignment parameter to gpu::Buffer
Bug: 1426766
Change-Id: I0902bf42975ca0a1bb967208fa51e42f4a74392e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4377798
Commit-Queue: Sergey Pashaev <bioh@yandex-team.ru>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1131990}
2023-04-18 16:53:37 +00:00
Christopher Cameron
186c6b9886 cc::PaintImage: Plumb SkGainmapInfo
Add plumbing for SkGainmapInfo from the decoder to the transfer
cache via cc::PaintImage.

Bug: 1404000
Change-Id: Ibc09a4033f9f6ae04ee041e5da34938254d495d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4427804
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1131719}
2023-04-18 07:23:09 +00:00
Christopher Cameron
b659c5b3ae cc::GpuImageDecodeCache: Add gainmap support
Change ImageData to have two ImageInfos -- one for the main image and
one for the gainmap.

Change DecodedImageData to have two DecodedAuxImageInfos. Add setters
for this to SetLockedData method, and add an AuxImage parameter to do
the data, and image, and pixmaps methods.

Change GpuImageDecodeCache::DecodeImageIfNecessary to decode both
images, and change UploadImageIfNecessary_TransferCache_SoftwareDecode
to insert both images into the transfer cache. Use a default
SkGainmapInfo, because the plumbing for that hasn't been thought
through yet.

Bug: 1404000
Change-Id: I3eae60f5fcba10af8134546377f798fa1d2d0084
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4403965
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1131673}
2023-04-18 04:46:20 +00:00
Xianzhu Wang
bb165a77e3 Two new main-thread scrolling (repaint) reasons
- kPreferNonCompositedScrolling: This includes
  - RuntimeEnabledFeature::PreferNonCompositedScrollingEnabled;
  - The element is a scrollable select or input.
  Previously main-thread scrolling reasons were not set on the scroll
  node for this reason.
  It doesn't affect user-visible functionality. It affects metrics
  Renderer4.Renderer4.MainThread(Gesture|Wheel)ScrollReason2 by
  reporting some scrolls with this reason instead of "No scrolling
  layer".

- kBackgroundNeedsRepaintOnScroll: This reason will be actually used
  in a followup CL to fix a bug of missing main-thread scrolling
  for a composited scroller with background needing repaint on
  scroll, causing delayed background refresh during composited
  scrolling. It'll be set when
  - A scrolling background is painted in the border-box space;
  or
  - A non-scrolling background is painted in the scrolling contents
    space.
  This reason sometimes overlaps with (but doesn't equal)
  kCantPaintScrollingBackgroundAndLCDText when LCD-text is preferred.

Bug: 1414928
Change-Id: Ieb3b90f7af9feb64f410efe56dc4c8002381222b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4420444
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1130674}
2023-04-14 21:20:50 +00:00
Xiaocheng Hu
298448e06e [anchor-position] Abort main frame commit for scroll-offset-only changes
This patch makes anchor-scroll skip main thread commits by:
- Making kAnchorScroll's change type composited-value only, so that
  we can abort main thread commits
- Make GeometryMapper also consider anchor-scroll, so that it won't
  incorrectly merge layers above and below the anchor-scroll element,
  causing incorrect paint order (and hence incorrect overlap)
- Set `transform_changed` flag in cc TransformNode, so that its
  damage rect is correctly tracked

Fixed: 1385948
Change-Id: Ic82ee09cc8da57342830aa9f6946eb00f7b9fd16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4371260
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1130556}
2023-04-14 18:06:01 +00:00
David Awogbemila
15337d127f Handle nop scroll overscroll-behavior edge case
crrev.com/c/4362538 ensured that nop scrolls on the layout viewport do not
trigger scrollend events on the document. It did not explicitly handle
nop scrolls on all scrollers because it assumed that an inner
scroller that can't consume the delta would bubble the scroll up to the
document but in the case of non-auto overscroll-behvior-{x,y} even if
the scroller can't consume the delta the scroll will not bubble up to the
document/its parent.

This patch also updates
scrollend-event-fired-to-element-with-overscroll-behavior.html not to
expect scrollend when there is no scroll but continues to ensure that we
do not bubble a scroll up to the document for non-auto overscroll
behavior.
This test expectedly failed on wpt.fyi and timed out on the trybots (the
timeout was locally reproducible). With this patch, I no longer see the
timeout so I am removing the TestExpectation entry.
The test file could probably use a better name now that it expects that
scrollend is *not* fired but I am not chaning it so it's easier to see
its pass/fail history.

Bug: 1430947
Change-Id: Ie528cd5a001ece6ed54d6163c536e5774b07c39f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4418186
Reviewed-by: Steve Kobes <skobes@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: David Awogbemila <awogbemila@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1130387}
2023-04-14 12:06:22 +00:00
Christopher Cameron
7b411a6018 cc::GpuImageDecodeCache: Add ImageInfo and DecodedAuxImageData
Merge ImageData's size, SkImageInfo and SkYUVAPixmapInfo into a single
ImageInfo structure.

Add the function ImageData::GetDecodedSize to query the ImageInfo's
size (this will be changed to include the total size of all auxiliary
images soon).

Merge DecodedImageData's SkImages and DiscardableMemory into an
DecodedAuxImageData struct. Note that the SkImages in question are
created from SkPixmaps, and are often converted back to SkPixmaps.
Preserve the original SkPixmaps in DecodedAuxImageData to avoid this
round-tripping.

Bug: 1404000
Change-Id: I025bbc3a158ee60d5a0459f34b4113b07bf8001e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4402267
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1130187}
2023-04-13 23:30:55 +00:00
Joey Arhar
a35e4b350c Revert "Break down the "GenerationToBrowserMain" stage for ScrollUpdate with blocking touch moves."
This patch made several ash_unittests fail. First failing build:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Chromium%20OS%20ASan%20LSan%20Tests%20(1)/50487/overview

I was able to reproduce the failure on my machine, and I bisected it
down to this change.

Change-Id: I32dfd6728d3253a942a1449b1576fe89d6886944
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4425292
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Owners-Override: Joey Arhar <jarhar@google.com>
Commit-Queue: Joey Arhar <jarhar@google.com>
Reviewed-by: Joey Arhar <jarhar@google.com>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1130181}
2023-04-13 23:25:24 +00:00
Ken Rockot
c2e6781675 cc: Introduce LayerContext
This introduces new LayerContext and LayerContextClient abstractions in
cc as well as their corresponding mojom interfaces in Viz.  These types
sit between a client-side LayerTreeHost and a corresponding
LayerTreeHostImpl which may reside in another process. They will be used
to experiment with GPU-side layer trees.

This CL only introduces minimal boilerplate and plumbing for a client to
construct a new client-side VizLayerContext over an established
CompositorFrameSink endpoint, to control a GPU-side LayerTreeHost owned
by that sink within Viz.

Test coverage and actual frame production from a LayerContext are done
in a follow-up CL.

Bug: 1431762
Change-Id: I86e9150aa034fe77300036816c8e2c5ae3999c55
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4418567
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Auto-Submit: Ken Rockot <rockot@google.com>
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Reviewed-by: Will Harris <wfh@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1130132}
2023-04-13 22:01:55 +00:00
Steve Kobes
1ca7c44120 Tick scroll-driven animations after scroll offset animations.
This ensures that the scroll-driven animation uses the updated scroll
offset to calculate its progress.

Bug: 1416223
Change-Id: Ib2b32a89816d4f8791520f9658e0eb7a11a084e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4423710
Reviewed-by: Kevin Ellis <kevers@chromium.org>
Commit-Queue: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1130067}
2023-04-13 20:25:08 +00:00
Ken Rockot
2ab918c786 Move CategorizedWorkerPool to //cc
This class will be used in the GPU process as well as in Blink. Since it
was primarily intended for raster work, and since both Blink and GPU
already depend on //cc, //cc/raster should be a good home for this.

Details of what's changed beyond file and build target moves:

- Namespace change
- Relevant switch moved from Blink to //cc/base
- New Delegate interface to inject Blink-specific behavior
- Minor IWYU fixes

Bug: 1431506
Change-Id: If54561c14c6fa300ba90cb7616605f37e02e45a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4409316
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: Ken Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/main@{#1129966}
2023-04-13 17:53:17 +00:00
Pâris
09f6f0624a mark flaky CQ's dangling pointers 2023‑W14
This marks all the flaky dangling pointers detected on the CQ
during week 14 (2023-04-03 to 2023-04-09 inclusive).
Note that a few dangling pointers detected were also actual failures,
those are not marked here, most are fixed by follow up patch sets.
Detail of the dangling pointers here:
https://docs.google.com/spreadsheets/d/1k12PQOG4y1-UEV9xDfP1F8FSk4cVFywafEYHmzFubJ8/edit?pli=1#gid=0

Bug: 1432570
Change-Id: I9187602a946846f23e576cbcb4e4e870b499c02f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4417689
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Auto-Submit: Pâris Meuleman <pmeuleman@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1129807}
2023-04-13 13:48:24 +00:00
Violetta Fedotova
2723d4648f Break down the "GenerationToBrowserMain" stage for ScrollUpdate with blocking touch moves.
- Adding new stages "TouchRendererProcessing" for scroll events that were created by blocking touch moves.
- Creating a new InputTimestamps structure in the WebInputEvent class. InputTimestamps contains even't timestamps.
- Copying information about blocking touch move's timestamps to a corresponding scroll event happens at the Browser process.

# Result
Screenshot: https://screenshot.googleplex.com/AQBtknHHiim2ron
Trace: https://ui.perfetto.dev/#!/?s=1cff5646c3ac0c44a010c60b09dc76bfc2cbd8549813a6ff4e8ac4298405d164

Bug: b/262676871
Change-Id: Id73975582e5c7c7ecde784d44cc5a1b18f5d051b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4136125
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Violetta Fedotova <violettfaid@google.com>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1129806}
2023-04-13 13:47:29 +00:00
Xianzhu Wang
84269bf5cd Reland "[ScrollUnif.] Distinguish kFailedHitTest and kNonFastScrollableRegion"
This reverts commit 448b49d42a.

The crash still happened after the revert.

Original change's description:
> Revert "[ScrollUnif.] Distinguish kFailedHitTest and kNonFastScrollableRegion"
>
> This reverts commit b47f4549d7.
>
> Reason for revert: Speculative revert for crbug.com/1428374.
>
> Original change's description:
> > [ScrollUnif.] Distinguish kFailedHitTest and kNonFastScrollableRegion
> >
> > Previously in ScrollUnification all main thread hit tests were
> > reported as kFailedHitTest, including hit tests on non-fast scrollable
> > region (reported as kNonFastScrollableRegion in legacy scroll) and
> > non-reliable compositor hit tests (reported as kFailedHitTest in
> > legacy scroll). We want to reduce non-reliable compositor hit tests
> > by letting blink provide more accurate hit test data. This CL makes
> > it possible to measure the result.
> >
> > Bug: 1413877
> > Change-Id: Iaf00021535d167a1fe8ce1d32df156c0d76c2d34
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4363371
> > Reviewed-by: Scott Violet <sky@chromium.org>
> > Reviewed-by: Steve Kobes <skobes@chromium.org>
> > Reviewed-by: Philip Rogers <pdr@chromium.org>
> > Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1121925}
>
> Bug: 1413877, 1428374
> Change-Id: If9c935bb98a6802312fe4ee901bb6e9ced164b8f
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4407898
> Reviewed-by: Philip Rogers <pdr@chromium.org>
> Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org>
> Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1127818}

Bug: 1413877, 1428374
Change-Id: Ia92b21fb643a6a51ba1c985cde0e17f7d4347ceb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4420272
Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org>
Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1129563}
2023-04-12 22:37:42 +00:00
Xianzhu Wang
d582a8bc19 Clean up compositing reasons
- Remove old reasons:
  - kRoot: It was not used in paint properties or debug info. The only
    purpose was to prefer compositing to lcd text for scrollers.
  - k(Opacity|Mask|Filter|Blending)WithCompositedDescendants: They
    were meaningful in pre-CompositeAfterPaint only, but were used
    in cc::Layer debug info for composited layers that can't merge
    into others because of transform compositing boundaries. Now
    PaintArtifactCompositor::UpdateDebugInfo() checks transform
    compositing boundaries for transforms, clip's transform spaces
    and effect's transform spaces.

- Generate short names of compositing reasons automatically.

- The original static_assert checking consistency of
  kCompositingReasonsStringMap and compositing reasons didn't work
  due to an extra '\`. Fix and update the map (now containing
  descriptions only).

- Add more compositing reasons for composited layers containing
  special contents, for debugging.

Change-Id: Ie412567f32836d51fb4a7b5f482c2c60c1e3f997
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4416080
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1129560}
2023-04-12 22:34:17 +00:00
Benoit Lize
b7f20cdf68 [cc] Add locking annotations to GpuImageDecodeCache
This mostly moves from comments and runtime checks to static
annotations. Missing locks are added, in testing getters, and in
OnMemoryDump(), which is triggered in production code.

Change-Id: I2572b909954a2a9440597b71b0cef3835031efe4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4406045
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: Benoit Lize <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1129211}
2023-04-12 13:08:54 +00:00
Sunny Sachanandani
e5205165ef gpu: Rename SkiaDawn test types to SkiaGraphite
Rename cc/viz pixel test enums from kSkiaDawn to kSkiaGraphite - note
that Graphite will run with Dawn by default in Chromium. Also remove
exceptions which were previously present for Ganesh Dawn since those
are likely not relevant any more since Graphite is completely different
from Ganesh and Dawn has also matured quite a bit since when the
exceptions were added. We'll add new exceptions for Graphite as needed.

Bug: 1429361
Change-Id: I6676aa681e5ada2275ced3bdcfd1e8e5fd72250c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4404857
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128770}
2023-04-11 18:09:50 +00:00
Xianzhu Wang
5453328cfb Speculative fix for null scroller layer of scrollbar layer
It seems that the scroller layer for a scrollbar layer can be null.
The cause may be similar to crbug.com/895817.

Bug: 1428374
Change-Id: I81d3e85d9c12c7bce49c658a69c9b389b78187eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4412316
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128716}
2023-04-11 17:11:41 +00:00
Benoit Lize
f312572143 [cc/tiles] Clear GPU resources in GpuImageDecodeCache on memory pressure
For GpuImageDecodeCache, OnMemoryPressure() clears the cache, but this
only adds transfer cache IDs for deletion, without actually flushing the
queue. This CL fixes that, by unifying the code with ReduceCacheUsage()
which runs the enqueued operations when possible.

Bug: 1410541
Change-Id: I039234d965690e17dfc09a079884b0de22936a10
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4406049
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: Benoit Lize <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128654}
2023-04-11 15:21:20 +00:00
Sunny Sachanandani
fb74c17f6c gpu: Skia Graphite build and feature flags
1. Add build and feature flags for Graphite, both disabled by default.
2. Add skia_use_metal buildflag for guarding metal code. This flag is
   only enabled with Graphite on developer builds.
3. Add SkiaGraphiteBackend to GpuPreferences, and parse its value from
   feature and command line flags. Also add a kNone option for Ganesh
   GrContextType for when Graphite is enabled.
4. Cleanup Chromium Skia BUILD.gn - more consistency between the config
   and sources in how we use conditionals. Ensure dawn and metal code is
   only built when Graphite is used, and other miscellaneous cleanup.
5. Remove Ganesh Dawn from Chromium including in blink over WebGPU
   command buffer, so both Dawn and Metal are only used with Graphite.

This doesn't yet rename the cc/viz pixel test enums - that will be a
separate followup change since it would otherwise add a dozen or two
more changed files to this CL.

Bug: 1429361
Change-Id: Ibf129727e03c303bfac85b98c111b08d880f408f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4404275
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128336}
2023-04-10 21:29:17 +00:00
Kevin Lubick
9f27f16e5f Add CHECK to SkImages::GetBackendTextureFromImage and squash NPE
It was noticed in https://chromium-review.googlesource.com/c/chromium/src/+/4401454
that there could be a null dereference (crash) if
SkImages::TextureFromYUVATextures returned false.

One way this can happen is if SkImages::GetBackendTextureFromImage
returns false (and thus the given yuv_texture is invalid).

This makes sure the three textures we get are valid (using CHECK
because they should always be gettable) and a nullness
check for yuva_image.

Bug: skia:13983
Change-Id: Ie5849a8bb56a9f4534cc511ad468e5eb0027b5a8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4402159
Commit-Queue: Kevin Lubick <kjlubick@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128162}
2023-04-10 15:51:29 +00:00
Stephan Hartmann
e80fc92c8a IWYU: add stdint.h for uint32_t in cc::TargetProperty
Change-Id: If8b3a9cdf0d310391aeed3abf303e2ea054697b1
Bug: 957519
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4406545
Reviewed-by: Stefan Zager <szager@chromium.org>
Commit-Queue: Stephan Hartmann <stha09@googlemail.com>
Cr-Commit-Position: refs/heads/main@{#1128159}
2023-04-10 15:44:41 +00:00
Kevin Lubick
9f5c5af1ae Migrate some GPU SkImage methods to static functions
This helps decouple SkImages from our GPU backends. This is a follow-up
to https://skia-review.googlesource.com/c/skia/+/665236
and requires https://skia-review.googlesource.com/c/skia/+/666857
to land and roll into Skia.

Bug: skia:13983
Change-Id: I79a3b90ea234d2a533f3bf54287e4a95a1c8a369
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4401454
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1128136}
2023-04-10 13:44:39 +00:00
Xianzhu Wang
448b49d42a Revert "[ScrollUnif.] Distinguish kFailedHitTest and kNonFastScrollableRegion"
This reverts commit b47f4549d7.

Reason for revert: Speculative revert for crbug.com/1428374.

Original change's description:
> [ScrollUnif.] Distinguish kFailedHitTest and kNonFastScrollableRegion
>
> Previously in ScrollUnification all main thread hit tests were
> reported as kFailedHitTest, including hit tests on non-fast scrollable
> region (reported as kNonFastScrollableRegion in legacy scroll) and
> non-reliable compositor hit tests (reported as kFailedHitTest in
> legacy scroll). We want to reduce non-reliable compositor hit tests
> by letting blink provide more accurate hit test data. This CL makes
> it possible to measure the result.
>
> Bug: 1413877
> Change-Id: Iaf00021535d167a1fe8ce1d32df156c0d76c2d34
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4363371
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Steve Kobes <skobes@chromium.org>
> Reviewed-by: Philip Rogers <pdr@chromium.org>
> Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1121925}

Bug: 1413877, 1428374
Change-Id: If9c935bb98a6802312fe4ee901bb6e9ced164b8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4407898
Reviewed-by: Philip Rogers <pdr@chromium.org>
Owners-Override: Xianzhu Wang <wangxianzhu@chromium.org>
Auto-Submit: Xianzhu Wang <wangxianzhu@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127818}
2023-04-07 22:43:26 +00:00
Saifuddin Hitawala
921c0203c8 Multiplanar: Merge params into SkPixmap for RasterInterface WritePixels
This change merges the SkImageInfo, rowBytes and pixel address into
an SkPixmap for the source data that is written in RasterInterface
WritePixels.

Bug: 1414564
Change-Id: Icac572dbdd55d4616b56134970db286d5644b1be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4400494
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Ian Vollick <vollick@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127270}
2023-04-06 17:42:24 +00:00
Bo Liu
fe5b6213f5 slim: Duplicate flow trace events from cc
Bug: 1408128
Change-Id: Id1f9153a6294d5d55eec0c7048d80ded9925288e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4404442
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Commit-Queue: Bo Liu <boliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127249}
2023-04-06 16:56:28 +00:00
Omar Elmekkawy
233fb1c3e3 Removing number of inputs per frame metric as it's no longer needed.
We are now pushing metrics that better represent what the user sees
on the screen, and number of inputs per frame is no longer needed.

Bug: b/275521300
Change-Id: I8ba0bf8d35f0d59515538780f3212e2ebda50c51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4394669
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Commit-Queue: Omar Elmekkawy <mekk@chromium.org>
Reviewed-by: Stephen Nusko <nuskos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127103}
2023-04-06 10:57:44 +00:00
Benoit Lize
a3c6f8d0b2 [cc/tiles] Report GPU image decode cache memory for transfer cache
For transfer cache images, we do not report anything in the GPU image
decode cache memory dump provider. This CL addresses that. Previously,
GPU image decode cache memory was not reported at all (locally) on
either macOS or Linux.

Bug: 1410541
Change-Id: Ia501ca319d8d91b44640f0c0149243b7057afbd2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4404136
Commit-Queue: Benoit Lize <lizeb@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127061}
2023-04-06 08:11:31 +00:00
Christopher Cameron
52a2972c59 cc:GpuImageDecodeCache: Clean up YUVA decoding
Change the helper function GetYUVADecodeInfo to return the scaled
SkYUVAPixmapInfo for the decoded result. Prior to this, it was changed
to be 4:4:4 when scaling was needed, but the size was left at the
original size.

This gets saved to GpuImageDecodeCache::ImageData::yuva_pixmap_info, which is then used by GpuImageDecodeCache::DecodeImageIfNecessary.

The GpuImageDecodeCache::DecodeImageIfNecessary has a non-paralle
structure between the RGB and YUV paths. The RGB path creates the
result SkPixmap and passes it to DrawAndScaleImageRGB, while the
YUV path relies on DrawAndScaleImageYUV to create the resulting
SkYUVAPixmaps. Now that we have the correct SkYUVAPixmapInfo in
GpuImageDecodeCache::ImageData::yuva_pixmap_info, make the YUV path
be like the RGB path.

In DrawAndScaleImageYUV, clean things up now that we have an explicit
SkYUVAPixmaps parameter. Use for-loops over the planes instead of
tracking Y,U,V planes separately.

Push the merged tracking of Y,U,V in a single array through to
GpuImageDecodeCache::DecodedImageData. This allows us to handle all
YUV formats in UploadImageIfNecessary_TransferCache_SoftwareDecode.
Put a note in UploadImageIfNecessary_GpuCpu_YUVA where we still
only support triplanar Y,U,V. Once we move to OOP-R, then the image
decode cache will support all YUV formats that Skia supports.

The motivation for doing this now is to prepare for adding gainmaps
to GpuImageDecodeCache::DecodedImageData. That will be easier now that
the RGB and YUV paths have been merged into a single images_ member.

Bug: 1404000
Change-Id: I42bfc9dfda258cabbf760311130617655f97ca82
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4395996
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127057}
2023-04-06 08:00:36 +00:00
Christopher Cameron
f48c0514df cc::GpuImageDecodeCache: Preparation for gainmap support
Merge the UploadImageIfNecessary_TransferCache_SoftwareDecode_YUVA and
UploadImageIfNecessary_TransferCache_SoftwareDecode_RGBA functions.
This is needed because we will want to be able to handle the full
cross product of RGBA and YUVA for the default and the gainmap image.

Slightly restructure GpuImageDecodeCache::CreateImageData, so that
the size for the buffer for decoding is a separate step. This will
be helpful when we need to add the size for the default and gainmap
image.

Make ImageData take SkImageInfo as a parameter. Previously it was
re-computing this in GpuImageDecodeCache::DecodeImageIfNecessary
by calling CreateImageInfoForDrawImage.

Change CreateImageInfoForDrawImage to also compute mip level.

Bug: 1404000
Change-Id: I413ead5b48c4540dc5f2955f91ff775c2b06dbde
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4392682
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126827}
2023-04-05 21:11:15 +00:00
Khushal Sagar
ecca4d7411 cc: Ensure rendering remains paused until a new frame is committed.
The notification to resume rendering is dispatched from the main to impl
thread immediately, as opposed to part of the state transferred during
a commit. This means that if there is a impl-side animation running on
the impl thread, it may draw a few frames without main thread updates
that accompany the notification to resume rendering. This is racy
depending on how long the commit + activation takes.

For ViewTransitions, which rely on this paused rendering state, this
means we can have a few frames of an animation from the old View update
before the compositor's content is replaced by pseudo-element animations
(which are part of the main thread updates pushed in the commit).

This change fixes that by ensuring that the impl-side scheduler waits
for at least 1 commit before resuming draws of the active tree. The wait
is until this newly committed tree goes all the way to activation.

R=vmpstr@chromium.org

Fixed: 1425508
Change-Id: I1a6f214d3abbe07657b5d2ab350bbdba2abc8b3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4401111
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Auto-Submit: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126821}
2023-04-05 21:04:51 +00:00
Peter McNeeley
33a4e179d0 Minor optimization of overlay candidate code for Lacros
The |Transform| object is designed in such a way simple operations are
much faster than those on arbitrary matrix.

Bug: 1396122
Change-Id: I76d77759d2b5a856ca0184387983b9c2bb7f066b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4401455
Commit-Queue: Peter McNeeley <petermcneeley@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126818}
2023-04-05 21:01:43 +00:00
Bo Liu
11af941a22 Reland "slim: Delayed scheduler"
This is a reland of commit e4a888661c

Two fixes:
* Null check WindowAndroid is straightforward
* Avoid reentrancy issues in DelayedScheduler. Previously in
  BeginFrameAndResetArgs, calling `client_->DoBeginFrame` could
  recurse back to DelayedScheduler to consume `unused_args_`, which
  leads to sending `DidNotProduceFrame` with invalid args. Avoid this
  by making a copy and resetting args before calling to client.

Original change's description:
> slim: Delayed scheduler
>
> Scheduler specifically optimized for the use case of android browser
> compositor moving the top/bottom browser controls as a result of
> renderer compositor updates.
>
> Bug: 1408128
> Change-Id: I2a82ddc8b2a9fb91e05baf6bba34dc7e60597b25
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4353951
> Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
> Reviewed-by: Jonathan Ross <jonross@chromium.org>
> Commit-Queue: Bo Liu <boliu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1124740}

Bug: 1408128
Change-Id: I8dc6450d2ab4dc2a73c96335492663ee75f26920
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4403837
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Commit-Queue: Bo Liu <boliu@chromium.org>
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126769}
2023-04-05 19:49:39 +00:00
Bo Liu
b1943c4ce7 slim: Store uv points directly
Converting to width and height in gfx::RectF was losing precision.

Bug: 1408128, 1430062
Change-Id: I8748784f7a5d09c3f3db0c8064ce5c3a2b0d972a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4400356
Commit-Queue: Bo Liu <boliu@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126688}
2023-04-05 18:01:32 +00:00
Tom Sepez
39f299eb98 Avoid spurious dangling ptr warning in ~PixelTest()
Since the owned reference in `renderer_` is destroyed during TearDown(),
the unowned reference in `software_renderer_` must be as well and can
not outlive it until test class destruction time.

Bug: 1401495
Change-Id: Ie080308ca748016f2a42fb1f8a7abae61b78ad3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4401817
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126592}
2023-04-05 15:36:03 +00:00
Omar Elmekkawy
5dda5e7660 Adding scroll jank metrics that track scroll prediction performance
* Event.Jank.ScrollUpdate.DroppedFrame.FrameAboveJankyThreshold
Which tracks the intenisty of irregular jumps when a frame is
dropped.

* Event.Jank.ScrollUpdate.NonDroppedFrame.FrameAboveJankyThreshold
Which tracks the intenisty of irregular jumps that happen when no
frames are dropped.
Frames deemed janky by this metric, usually caused by poor scrolling
predictor performance.

* Event.Latency.ScrollUpdate.JankyFramePercentage
Which tracks the number of janky frames per 50 frame sequence, a
frame is deemed janky when it's an intense jump in an irregular
sequence, whether a frame was dropped or not.

Three logic behind added metrics are described in detail in the
following document.
http://doc/1Y0u0Tq5eUZff75nYUzQVw6JxmbZAW9m64pJidmnGWsY.

Bug: b/274578776
Change-Id: Ibbfdd4ee3ed4ccff53ea6fe5b66852e39e96bedf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4381615
Commit-Queue: Omar Elmekkawy <mekk@chromium.org>
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Reviewed-by: Stephen Nusko <nuskos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126477}
2023-04-05 11:16:10 +00:00
Jonathan Ross
085e795b81 Revert "slim: Delayed scheduler"
This reverts commit e4a888661c.

Reason for revert: crbug.com/1429894 and possibly crbug.com/1429963 Seems that both parts of `view_.GetWindowAndroid()->GetCompositor()` access `raw_ptr` leading to a crash

Original change's description:
> slim: Delayed scheduler
>
> Scheduler specifically optimized for the use case of android browser
> compositor moving the top/bottom browser controls as a result of
> renderer compositor updates.
>
> Bug: 1408128
> Change-Id: I2a82ddc8b2a9fb91e05baf6bba34dc7e60597b25
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4353951
> Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
> Reviewed-by: Jonathan Ross <jonross@chromium.org>
> Commit-Queue: Bo Liu <boliu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1124740}

Bug: 1408128
Change-Id: Idf3869844bb6b748ed2594b91d41bbc58d3ecfd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4401190
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126247}
2023-04-04 21:38:32 +00:00
Yotam Hacohen
29f906cb3c add lazy loading of the rtree in DiscardableImageMap.
Since we need the rtree only when searching for discardable images,
don't build the tree when generating the map, only when asked to find
the discardable images.

Bug: 1395845
Change-Id: I8c5909c83211a19571d94bdb8941c7883b2ec9f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4363438
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Yotam Hacohen <yotha@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126155}
2023-04-04 19:06:35 +00:00
Saifuddin Hitawala
3393680bfe Multiplanar: Add plane_index param to RasterInterface::WritePixels
This change updates RasterInterface::WritePixels() to take in a
plane_index. This plane index will later be used to write to the
appropriate SkSurface for a given plane for multiplanar formats through
Raster and Gles Passthrough Decoders.

Here, we pass plane_index as 0 so that the logic remains the same as
earlier.

Bug: 1414564
Change-Id: If6a2da932a441c82ab97938367c3cf97d5fc8ac2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4381473
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Reviewed-by: Ian Vollick <vollick@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126138}
2023-04-04 18:38:44 +00:00
Kevin Lubick
74abb59ed4 Add direct assertion of hasMipmaps in BasicMips tests
I've broken these tests twice in the last 2 weeks and I think
this extra assertion would have made it easier to identify where
the issue was without having to detangle the pointer
equality assertion of image_with_mips == decoded_draw_image.image()

Change-Id: I765ffad202a781e1affe3e8b3233a4b73fe16e63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4395168
Auto-Submit: Kevin Lubick <kjlubick@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1125988}
2023-04-04 15:11:03 +00:00
Benoit Lize
cd366a5dff [cc] Enable MoreAggressiveSolidColorDetection by default
This saves memory without a performance cost, particularly on
macOS. There it saves most of the UI compositor tile memory, for
instance locally on a 14 inch macbook pro, savings are ~24MiB per
browser window.

See details in
https://docs.google.com/document/d/1XwXaNmCUb7VBfEn9C8tBuXnaVol0FLBRickLeJui1_s/edit#heading=h.dcer5bh9q26n
(google internal).

From the stable experiment, savings are as expected:
- macOS: up to >100MiB of GPU process PMF. See
  https://uma.googleplex.com/p/chrome/variations?sid=32b1edf07268cec2d7eda53d36e67af8
  and https://screenshot.googleplex.com/5pBgoHQaHKRAkjD
- Windows: Up to a few 10s of MiB,
  https://uma.googleplex.com/p/chrome/variations?sid=e422d8d6853a033a11e96da90ffed9b1
  and https://screenshot.googleplex.com/7t2rPHhWfiNm9nP
- Android: A few MiB, see
  https://uma.googleplex.com/p/chrome/variations?sid=aa1a8ae81f93ad08887ae989f34827b5
  and https://screenshot.googleplex.com/5WkCd4jNbYTRhMd

On non-macOS platforms, savings are likely coming from web content
having solid colored tiles that were not properly detected as such
previously. On macOS, this is mostly due to UI compositor tiles.

Enabling by default everywhere, as there is no downside, and a large
upside on macOS.

Bug: 1355820
Change-Id: Icc2f6b7f8452437570ed2e42948a8f7153d9c753
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4396384
Commit-Queue: Benoit Lize <lizeb@chromium.org>
Reviewed-by: ccameron chromium <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1125892}
2023-04-04 10:33:08 +00:00
Christopher Cameron
ce5691f8af Fix PaintOpReader::ReadSize and cc::PaintOpWriter::WriteSize alignment
size_t values are serialized and deserialized as uint64_t, but areonly aligned to 4 bytes, which results in ubsan failures due to insufficient
alignment.

Fix these issues by serializing and deserializing two uint32_t values
instead of one uint64_t values.

Take this approach instead of adding padding to avoid the potential
for introducing regressions (e.g, if any of the functions that
serialize size_t values assume that only 8 bytes are written, but
padding would cause 12 bytes to be written).

Bug: 1429994, 1429789, 1429903
Change-Id: I4d94a48f43eb7d46bb0b4465a7fe17829ffa81de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4393965
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1125851}
2023-04-04 08:24:17 +00:00
Maggie Chen
c97609b6bb Fix view transition damage in cc DamageTracker
view_transition_content_surface corresponds to the render surface which produces content drawn by a ViewTransitionContentLayer. Ensure the damage of view_transition_content_surface propagate to the view transition layer's parent surface.


Bug: 1422575, 1427717

Change-Id: I1c3cfab4bac90fe31e8a331fdd551bf9921da569
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4355996
Reviewed-by: Vladimir Levin <vmpstr@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1125554}
2023-04-03 20:31:56 +00:00
Benoit Lize
c7f5491a80 [cc] Enable ReclaimResourcesFlushInBackground by default
From the stable experiment, this saves a lot of memory (up to >100MiB of
GPU process PMF) on desktop and Android, without a performance cost.

See https://screenshot.googleplex.com/AHSnpBdWEfpkA45 for instance on Windows.

Bug: 1355820
Change-Id: I118479092460c7ad0ce58da8ef8dc46152016a52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4394788
Reviewed-by: Jonathan Ross <jonross@chromium.org>
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1125357}
2023-04-03 15:07:18 +00:00
Christopher Cameron
750e787763 cc::PaintImage: Add gainmap image generator
Add a new PaintImageGenerator for the gainmap image to cc::PaintImage.

Add a AuxImage argument to cc::PaintImage's GetSupportedDecodeSize,
Decode, DecodeYuv, GetSkImageInfo, and IsYuv functions. This will
cause the underlying function to use either the default generator,
or the new gainmap image generator.

Add a new GetSize and GetSkISize function to cc::PaintImage. These
functions also take an AuxImage parameter.

Update GpuImageDecodeCache to specify the AuxImage parameter, and to
add the AuxImage parameter to the functions that will need it. Do not
yet update GpuImageDecodeCache to support gainmap decoding.

Bug: 1404000
Change-Id: I93081045391358c199deafb380669ad1d0acca22
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4386456
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Auto-Submit: ccameron chromium <ccameron@chromium.org>
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1125222}
2023-04-03 08:17:59 +00:00
Jonathan Ross
e9f7b6ccd9 Remove *DroppedFrameAfterScrollStart2* Metrics
These metrics ended up not having any useful/normalized data. They've
since expired, and we aren't planning to do further follow ups here. We
have been scrolling metrics now.

Remove them and the code that calculates them.

Bug: 1404506
Change-Id: I7bc08061d8a792f1ce954616f3baa5389e913505
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4384942
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Jonathan Ross <jonross@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1124965}
2023-03-31 23:39:18 +00:00
Christopher Cameron
cf5e3d4d2e ImageTransferCache: Add gainmap support
ClientImageTransferCacheEntry: Add constructor that takes an additional
Image and SkGainmapInfo. Serialize this data.

ServiceImageTransferCacheEntry: Deserialize the gainmap image and
SkGainmapInfo, if provided. Use ColorConversionSkFilterCache to apply
the gainmap in the same place where we apply HDR tone mapping.

PaintOpReader/PaintOpWriter: Add support for SkGainmapInfo.

Tests: Add tests that verify that when an image is serialized with
a gainmap and SkGainmapInfo, the result from deserialization is the
image with the gainmap applied.

This approach -- applying the gainmap (and more generally doing
HDR tone mapping) during deserialization -- is not a good idea, because
it requires re-decoding the image every time that the HDR rendering
parameters change. This will need to be changed eventually.

Bug: 1404000
Change-Id: Id4d5795cd70faad0a60397c3c6e1873b18486ad5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4373641
Reviewed-by: Khushal Sagar <khushalsagar@chromium.org>
Auto-Submit: ccameron chromium <ccameron@chromium.org>
Commit-Queue: Khushal Sagar <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1124784}
2023-03-31 17:05:58 +00:00