0
Commit Graph

9206 Commits

Author SHA1 Message Date
03e25913d9 Fix Dawn ImportShared* Validation Checks
Removes error handling that checks returned objects for nullptr because
nullptr will never be returned.

Bug: chromium:343453602
Change-Id: I19ac8ad368f75172a318ce522c1ba3ceeaa65438
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5896351
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Brandon1 Jones <brandon1.jones@intel.com>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1451571}
2025-04-24 18:02:35 -07:00
79dc12193a Fix more locks on IOSurfaceImageBacking for multithreading support
- Move AutoLock into RetainGLTexture().
- Add Autolock in ~GLTextureIRepresentation() and
  ~SkiaGaneshRepresentation() for deleting IOSurfaceBackingEGLState.
  IOSurfaceImageBacking::IOSurfaceBackingEGLStateBeingDestroyed() has
  AssertLockAcquired() and |lock_| needs to be hold from the caller.

Bug: 405946930
Change-Id: I59360c3f44f7673adfa84dfd1566ddfb4e17eb96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6485629
Commit-Queue: Maggie Chen <magchen@chromium.org>
Reviewed-by: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1451543}
2025-04-24 17:07:53 -07:00
3ddde754d8 Fix a duplicate context dump name when two threads share the same graphite context
DumpBackgroundGraphiteMemoryStatistics() is called from
SharedContextState(). In the new thread safe architecture where two
threads (or two SharedContextStates) share the same graphite context,
CHECK is triggered in CreateAllocatorDump() when a duplicate name is
used for Create. The solution here is to skip the second identical
graphite context dump when an existing MemoryAllocatorDump is detected.

Bug: 407874799
Change-Id: I102d2374eab27396992af734a047e7b629fd3126
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6485454
Commit-Queue: Maggie Chen <magchen@chromium.org>
Reviewed-by: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1451414}
2025-04-24 13:38:27 -07:00
4e9e1d69f9 [gpu] Enable IgnoreAHBVkImageSize graphite dawn toggle for Android
The toggle was enabled for only Samsung devices due to required
texture memory size being larger than AHardwareBuffer allocation size.[1]
This led to SharedTextureMemory creation failure which led to
failures when beginning to read access.

We know that one of the reasons for fallback textures being created
more often with Graphite than Ganesh is FailedBeginReadAccess.[2]

Also from recent crashes in crbug.com/411835797 we see a variety of
devices crashing on same codepath with failure to BeginAccess.
This change enabled the toggle for all devices on Android so the
VkImage size check in Dawn is skipped.

[1] crbug.com/377489264#comment2
[2] https://uma.googleplex.com/p/chrome/timeline_v2?sid=f5e0dcaab32e98d5a1d55c6c8e0f5471

Bug: 383528569, 411835797
Change-Id: I86daf9d3b00e724cf225d231191837b6f5cbfd00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6483711
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1451283}
2025-04-24 10:41:08 -07:00
85bd2305e7 Revert "[gpu] Do not waitUntilScheduled on same Metal device"
This reverts commit 5170aa7c3e.

This reverts part of commit f5a5655498.

Reason for revert: Lack of waitUntilScheduled causes WebGL test
failures.

Changes over a plain revert:

1) Update some comments to say why the original optimization isn't
   possible.

2) Revert the glFlush in CreateMetalSharedEvent that was needed to fix
   issues with the original CL and is now unnecessary.

Bug: 40273077, 412679364

Original change's description:
> [gpu] Do not waitUntilScheduled on same Metal device
>
> Skip waitUntilScheduled calls when waiting on the same MTLDevice as the
> pending flush. In particular, this means that on single GPU systems, we
> will never call waitUntilScheduled except when handing off the IOSurface
> to CoreAnimation.
>
> Bug: 40273077
> Change-Id: I7c3c8ce30f061caf217d8107f12b0bc243b2cb49
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6464979
> Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
> Commit-Queue: Maggie Chen <magchen@chromium.org>
> Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
> Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
> Reviewed-by: Maggie Chen <magchen@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1448456}

Bug: 40273077
Change-Id: Iea0008e00d16e87dc0525b73c824e50128e8f4da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6485450
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1450889}
2025-04-23 17:17:17 -07:00
7801bbd7a5 [gpu] Track IOSurface GL access count separately
For SwANGLE, we need to ReleaseTexImage after the last GL access is done
to copy from Swiftshader's shadow texture memory to the IOSurface. Today
this looks at `num_ongoing_read_accesses_` in the backing, but this is
wrong since it considers all kinds of accesses. It's not necessary that
the last access being dropped is a GL access so it's possible that the
SwANGLE ReleaseTexImage never runs because the last GL access is not
the last read access overall.

This CL fixes that by tracking a separate `num_ongoing_accesses` in the
IOSurfaceBackingEGLState and using that for calling ReleaseTexImage.
Additionally, it makes `num_ongoing_read_accesses` a signed int instead
of unsigned int so that it's possible to assert that is >= 0 always - we
generally want to avoid unsigned types unless it's for serialization or
interop with other systems per the style guide.

Also, clean up some of the surrounding code a bit and remove a legacy
DCHECK from the GLImageBacking days.

Bug: 412679361, 40273077, 412679364
Change-Id: Idd06af0a8eef35338934fbddf1a4c8f8cf1af989
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6480226
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1450750}
2025-04-23 13:02:56 -07:00
014ea3d22a [gpu] Fix caching of Dawn textures in shared image
Found while investigating another issue: we only use the texture base
`usage` as the key in DawnSharedTextureCache - we should also take into
account `internal_usage` and `view_formats` since those can vary between
BeginAccess calls and we don't want to return the same wgpu::Texture if
those change.

This CL makes RemoveWGPUTextureFromCache and DestroyWGPUTextureIfCached
slightly slower since they now scan the entire map for the texture, but
it's not going to be an issue in practice since we only have a handful
of cached textures at most.

Bug: 412679361, 40273077
Change-Id: Ie7824fd52939391bea0a98ddaf0d1c3a4625140d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6483991
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Saifuddin Hitawala <hitawala@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1450685}
2025-04-23 11:30:14 -07:00
f5a5655498 [gpu] Fix ANGLE Metal IOSurface synchronization
After https://crrev.com/c/6464979, we don't call waitUntilScheduled when
the waiting MTLDevice is the same as the WGPUDevice/EGLDisplay that's
pending flush. This seems to have caused some test failures with Ganesh
like Pixel_WebGPUCopyExternalImageWebGPUCanvas which indicates broken
synchronization between ANGLE and Dawn.

One possible issue is that since we don't always flush the GL context
in GL EndAccess, the shared event signal that was just enqueued wouldn't
ever be executed causing the next Dawn BeginAccess to encode a shared
event wait that will never be executed.

This CL attempts to fix that by making GLDisplayEGL always flush the GL
context after it enqueues a shared event signal so that we don't ever
encounter a shared event with an enqueued but not flushed signal value.
This allows us to get rid of the ReleaseTexImage call for Graphite in GL
EndAccess since the only reason for that call was to flush the context.

Bug: 412679361, 40273077
Change-Id: I8f4e838d99185d264e3f40ceea377eaf137ceaac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6480877
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Reviewed-by: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1450625}
2025-04-23 09:54:15 -07:00
a6e5c0cee3 Skip GraphiteSharedContextThreadSafeTest if the Dawn adapter is not available
Instead of retry with OpenGLES Compatibility mode, just skip the
test if the adapter of Core mode is not available. The Dawn
OpenGLES backend is currently not thread-safe.

Tested with the try bot gpu-fyi-try-android-m-nexus-5x-64

Bug: 407874799, 411656649
Change-Id: I228b19b00fbb56c20305189280041ddfd6ecf187
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6480813
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1450172}
2025-04-22 13:35:45 -07:00
f69725887f Reland "Add GraphiteSharedContext thread safe unit tests"
This is a reland of commit a698becfd2

gpu_unittests fails on Android device Nexus 5X with the previous CL. It
could not find a dawn adaptor with the given Vulkan backend type. This
CL will retry with a different backend OpenGLES for old Android
phones if no adapter is found.

Tested with the try bot gpu-fyi-try-android-m-nexus-5x-64

Original change's description:
> Add GraphiteSharedContext thread safe unit tests
>
> GraphiteSharedContext is a wrapper class with AutoLock on top of
> graphite::context. The unit tests test the thread safe functions on
> graphite::context
>
> Bug: 407874799
> Change-Id: I66796392b6a2e3411697b3e4c9fcd30092dfd55d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6465024
> Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
> Commit-Queue: Maggie Chen <magchen@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1448621}

Bug: 407874799, 411656649
Change-Id: I56709d18a71907739be1dbdfb30846df7aaed5d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6476632
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1450028}
2025-04-22 10:18:28 -07:00
6eb18e156b [gpu] Add PurgeMemory support for WebGPU shader cache
As a follow-up to https://crrev.com/c/6457634 which added PurgeMemory
support for shader cache for GraphiteDawn similar to Ganesh, this adds
PurgeMemory support for DawnWebGPU caching backend as well.

Bug: 408234440
Change-Id: I7a8a42034922a4a8ad18462e4284b557886edcfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6479273
Reviewed-by: Peter McNeeley <petermcneeley@google.com>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1449981}
2025-04-22 09:07:28 -07:00
d75c2c7b7f [gpu] Add PurgeMemory support for GraphiteDawn in DawnCachingBackend
Ganesh shader cache purges cache memory on memory pressure that is
currently not implemented for graphite shader cache. This change
adds similar support that should make the functionality equivalent
between the two skia backends. Also, move the common code to helper
method in service utils.

NOTE: This is currently only supported for GraphiteDawn. We can add
support for WebGPU dawn as well in a follow-up.

Bug: 408234440
Change-Id: I3d622f4a9a0ddcf3e665341b6e11e0d99d326363
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6457634
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1449949}
2025-04-22 08:14:57 -07:00
2483e2d951 Move GraphiteSharedContext creation into DawnSharedContext Initialization
When feature kGraphiteContextIsThreadSafe is enabled,
GraphiteSharedContext is shared by all threads and is owned by
DawnSharedContext. Therefore, move the creation into DawnSharedContext
to prevent from being created more than once.

Bug: 407874799
Change-Id: I74737d03cb449710e750c1d35d25c74595f3eca7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471450
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1449929}
2025-04-22 07:54:01 -07:00
02222b9ee2 [Win] Set the gl surface handle to a Child Window when not using DComp
If the Redirection bitmap is removed from the main window, ANGLE can't
render content when not using DComp. The reason being that ANGLE
EGLSurface swap chains use a bitBlit approach. The solution to this
problem is to supply a child hwnd with a Redirection bitmap.

Bug: 400454999
Change-Id: Ib113d37696cef0355ba45c200d94e5c26e72874d
Skip-Clang-Tidy-Checks: modernize-use-nullptr
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6426631
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Sahir Vellani <sahir.vellani@microsoft.com>
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1449042}
2025-04-18 15:45:09 -07:00
dc71e1d9f3 Revert "Add GraphiteSharedContext thread safe unit tests"
This reverts commit a698becfd2.

Reason for revert: causing failures on Nexus 5X - see crbug.com/411656649

Bug: 407874799, 411656649
Original change's description:
> Add GraphiteSharedContext thread safe unit tests
>
> GraphiteSharedContext is a wrapper class with AutoLock on top of
> graphite::context. The unit tests test the thread safe functions on
> graphite::context
>
> Bug: 407874799
> Change-Id: I66796392b6a2e3411697b3e4c9fcd30092dfd55d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6465024
> Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
> Commit-Queue: Maggie Chen <magchen@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1448621}

Bug: 407874799
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I52d14d6bf0243fce6de0610de9c91c461d09fcf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6473388
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1449035}
2025-04-18 15:14:14 -07:00
431375dd3b WebGPU: Add experimental texture-compression-bc-sliced-3d feature
This CL adds the texture-compression-bc-sliced-3d GPU feature behind the
enable-unsafe-webgpu so that we can start writing tests in the CTS.

Bug: 342840940
Change-Id: I3f4dfb3040179e95cc6ef2e094629bd51e4d5d52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6459626
Commit-Queue: Fr <beaufort.francois@gmail.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448802}
2025-04-18 02:40:42 -07:00
15976809da gpu: Zero-init SharedState::states_
Do it tersely rather than with nested loops.

Change-Id: Iba4bb9629d4aebfd4ec7c47d50d652f9357d85be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6467854
Commit-Queue: Kalvin Lee <kdlee@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1448735}
2025-04-17 21:06:54 -07:00
a698becfd2 Add GraphiteSharedContext thread safe unit tests
GraphiteSharedContext is a wrapper class with AutoLock on top of
graphite::context. The unit tests test the thread safe functions on
graphite::context

Bug: 407874799
Change-Id: I66796392b6a2e3411697b3e4c9fcd30092dfd55d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6465024
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448621}
2025-04-17 15:21:28 -07:00
39a6d342c3 spanify: Renewed arrayification (X/43)
This CL is part of the wider spanification / arrayification effort [1]
and does not (intentionally) introduce behavioral change. It applies the
`std::array` rewrite to

gpu/command_buffer/tests

as close as possible to the output directly written by `spanify`, with
no hand-rolled fixes (except where rebasing would require).

This change (and its siblings taken together) is thought not to cause
any measurable perf regressions [2].

[1] https://issues.chromium.org/356643982
[2] https://docs.google.com/document/d/1jughaR6JKn7T-dDjMou10awyNkhE5T-vLY_K2YMqHE4/edit?tab=t.0#heading=h.r2eguxl5lhu7

This CL was uploaded by an experimental version of git cl split
(https://crbug.com/389069356).

Bug: 406029216
Change-Id: I84739ef0e9e990a127a25cba85fcfcccaab2a92f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6433275
Commit-Queue: Alex Gough <ajgo@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Owners-Override: Alex Gough <ajgo@chromium.org>
Auto-Submit: Kalvin Lee <kdlee@chromium.org>
Reviewed-by: Stephen Nusko <nuskos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448493}
2025-04-17 12:15:20 -07:00
5d35a01426 Use graphite_shared_context instead of graphite_context in SharedContextState
- Start to always create and use the wrapper, GraphiteSharedContext (regardless  of the feature flag GraphiteContextIsThreadSafe).
- Now only GraphiteSharedContext can communicate with skgpu::graphite::Context directly. All clients must use GraphiteSharedContext for all skgpu::graphite::Context functions.
- When features::kGraphiteContextIsThreadSafe is enabled, there is only one skgpu::graphite::Context and one wrapper GraphiteSharedContext. They are shared by all threads in the Gpu process. DawnSharedContext owns GraphiteSharedContext.
- When features::kGraphiteContextIsThreadSafe is disabled, each thread has its own skgpu::graphite::Context and GraphiteSharedContext. DawnContextProvider owns GraphiteSharedContext.
- Remove GetGraphiteContext() from SharedContextState, DawnContentProvider and MetalContentProvider.

Bug: 407874799
Change-Id: Ieab98a560d3da8c0f7c05a5d720883bba2de5fc6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6442809
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448463}
2025-04-17 11:35:22 -07:00
5170aa7c3e [gpu] Do not waitUntilScheduled on same Metal device
Skip waitUntilScheduled calls when waiting on the same MTLDevice as the
pending flush. In particular, this means that on single GPU systems, we
will never call waitUntilScheduled except when handing off the IOSurface
to CoreAnimation.

Bug: 40273077
Change-Id: I7c3c8ce30f061caf217d8107f12b0bc243b2cb49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6464979
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448456}
2025-04-17 11:27:37 -07:00
f4df778a7f spanify: Renewed arrayification (X/43)
This CL is part of the wider spanification / arrayification effort [1]
and does not (intentionally) introduce behavioral change. It applies the
`std::array` rewrite to

gpu

as close as possible to the output directly written by `spanify`, with
no hand-rolled fixes (except where rebasing would require).

This change (and its siblings taken together) is thought not to cause
any measurable perf regressions [2].

[1] https://issues.chromium.org/356643982
[2] https://docs.google.com/document/d/1jughaR6JKn7T-dDjMou10awyNkhE5T-vLY_K2YMqHE4/edit?tab=t.0#heading=h.r2eguxl5lhu7

This CL was uploaded by an experimental version of git cl split
(https://crbug.com/389069356).

Bug: 406029216
Change-Id: I9bbe43f8e78a7ece5b32a4bfb24b4da106cbb264
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6433400
Owners-Override: Alex Gough <ajgo@chromium.org>
Commit-Queue: Kalvin Lee <kdlee@chromium.org>
Auto-Submit: Kalvin Lee <kdlee@chromium.org>
Reviewed-by: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448150}
2025-04-16 21:52:32 -07:00
51e6ac4fca Set graphite heap block size
The Dawn/Vulkan allocator uses a heap block size of 8mb by default.
We're seeing significant GPU memory fragmentation with
Graphite/Dawn/Vulkan when compared to Ganesh/Vulkan  which uses 64kb
heap blocks. Previous experiments showed that 256kb results in minimal
additional fragmentation so start with that.

WebGPU dawn devices are unchanged and still using default the heap block
size.

Bug: 407730048
Change-Id: Ib0c380dc9f013812bcff49f9bbbed36157c11d49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6438217
Commit-Queue: Kyle Charbonneau <kylechar@chromium.org>
Reviewed-by: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448113}
2025-04-16 18:33:30 -07:00
9e2c2e8f26 spanify: Renewed arrayification (X/43)
This CL is part of the wider spanification / arrayification effort [1]
and does not (intentionally) introduce behavioral change. It applies the
`std::array` rewrite to

gpu/command_buffer/service

as close as possible to the output directly written by `spanify`, with
no hand-rolled fixes (except where rebasing would require).

This change (and its siblings taken together) is thought not to cause
any measurable perf regressions [2].

[1] https://issues.chromium.org/356643982
[2] https://docs.google.com/document/d/1jughaR6JKn7T-dDjMou10awyNkhE5T-vLY_K2YMqHE4/edit?tab=t.0#heading=h.r2eguxl5lhu7

This CL was uploaded by an experimental version of git cl split
(https://crbug.com/389069356).

Bug: 406029216
Change-Id: I67025af1cd331fd4f99ca7c7f56ef897722be313
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6433401
Owners-Override: Alex Gough <ajgo@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Auto-Submit: Kalvin Lee <kdlee@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448054}
2025-04-16 15:37:42 -07:00
75a28edd5e spanify: Renewed arrayification (X/43)
This CL is part of the wider spanification / arrayification effort [1]
and does not (intentionally) introduce behavioral change. It applies the
`std::array` rewrite to

gpu/command_buffer/client

as close as possible to the output directly written by `spanify`, with
no hand-rolled fixes (except where rebasing would require).

This change (and its siblings taken together) is thought not to cause
any measurable perf regressions [2].

[1] https://issues.chromium.org/356643982
[2] https://docs.google.com/document/d/1jughaR6JKn7T-dDjMou10awyNkhE5T-vLY_K2YMqHE4/edit?tab=t.0#heading=h.r2eguxl5lhu7

This CL was uploaded by an experimental version of git cl split
(https://crbug.com/389069356).

Bug: 406029216
Change-Id: I47857eddef3927ad19e16a0dfb2f2a659faa1da4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6436853
Reviewed-by: Stephen Nusko <nuskos@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Commit-Queue: Alex Gough <ajgo@chromium.org>
Auto-Submit: Kalvin Lee <kdlee@chromium.org>
Owners-Override: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448037}
2025-04-16 15:11:48 -07:00
1bcb0bfffb Add some missing <inttypes.h> includes
Files that use `SCNu32` and `PRIXPTR` should include inttypes.h.

Change-Id: I5cfe3ec12a3ec6b0f43b591b0c86d4b4a5a2cbfe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6451890
Commit-Queue: Lei Zhang <thestig@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1448035}
2025-04-16 15:10:39 -07:00
ed1d1801bc Graphite/D3D11: add an option to skip fence signal in STM's EndAccess
When D3DImageBacking is not shared across devices, we can give Dawn a
hint that fence signaling is not needed in EndAccess. That can reduce
overheads in some cases.

The same for DXGISwapChainImageBacking & DCompSurfaceImageBacking.

Note that this option is currently a no-op in Dawn. But future
optimizations would be possible. For example, Dawn doesn't need to
signal any fence when this flag is false. Its Queue.Submit() could defer
the ID3D11DeviceContext::Flush() call to later or asynchronuously.

Bug: 335003893
Bug: 377716220
Change-Id: I37fb87651b219ea8783649b22820fa5ccce28d5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6448769
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Auto-Submit: Quyen Le <lehoangquyen@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1447583}
2025-04-16 01:50:18 -07:00
166ef930ec [gpu] Remove dcomp texture DumpWithoutCrashing
This was needed for temporary debugging and we have enough reports from
clients to debug and fix the original issue.

Bug: 407302711
Change-Id: I7546d719ff4422728dc1f4693a5e72d7fae9ef6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6442267
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Michael Tang <tangm@microsoft.com>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1447462}
2025-04-15 17:02:53 -07:00
52ede26dfb Add a new feature flag GraphiteContextIsThreadSafe
This feature is not completed and is disabled by default.When this
feature is enabled, the AutoLocks in GraphiteSharedContext ensure thread
safety for graphite::context.

This CL adds the following things.
1) Add a feature flag.
2) Create GraphiteSharedContext, the graphite::context wrapper, in
DownContextProvider and MetalContextProvider.
3) Move GraphiteSharedContext into DawnSharedContext. In the new
architecture, DawnSharedContext owns GraphiteSharedContext.

Bug: 407874799
Change-Id: I1d1ca8a3b79eee5f25fb9a6eed6add52dd27c1ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6442544
Reviewed-by: vikas soni <vikassoni@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1447261}
2025-04-15 11:39:05 -07:00
db5beade17 [gpu] Fix new-delete-type-mismatch in WebGPUDecoderImpl
It is undefined behavior to delete child class without virtual
destructor through parent class' delete operator.

Fixed: 410141959
Change-Id: Ie3164ef7a26c9feecd1768d177bb081ce4208a31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6451759
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1446311}
2025-04-13 08:12:33 -07:00
304adceac6 Reland "Improve encapsulation of shmem and dxgi GpuMemoryBufferHandles"
This is a reland of commit 16a0b272da
The reland fixes a compile error in the ipc fuzzer that was not caught
by the CQ.

Original change's description:
> Improve encapsulation of shmem and dxgi GpuMemoryBufferHandles
>
> This CL attempts to move shared memory and DXGI GpuMemoryBufferHandles
> towards a model that are easier to move into a std::variant. The
> trickiest part of this is updating use of the shared memory region:
> previous refactorings here ignored this by simply dynamically
> dispatching depending on the type of the std::variant. While it is
> possible to continue implementing this behavior, being explicit here
> probably has long-term benefits for code readability...
>
> Summary of changes:
> - Extracting a shared memory regions or DXGI handle from a
>   GpuMemoryBufferHandle is now a consuming operation, i.e. the
>   GpuMemoryBufferHandle becomes an EMPTY_BUFFER.
> - Mutable getters and setters for these two subtypes no longer exist,
>   to make it impossible to have a SHARED_MEMORY_BUFFER with an invalid
>   region.
> - Add overloads for constructing a GpuMemoryBufferHandle from a shared
>   memory region or DXGI handle.
>
> Bug: 40584691
> Change-Id: I580a85be460035e063d1bf65e3c031104cb5410c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6381717
> Reviewed-by: Frank Liberato <liberato@chromium.org>
> Reviewed-by: Piotr Bialecki <bialpio@chromium.org>
> Reviewed-by: Ilya Nikolaevskiy <ilnik@chromium.org>
> Reviewed-by: Colin Blundell <blundell@chromium.org>
> Reviewed-by: vikas soni <vikassoni@chromium.org>
> Commit-Queue: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Min Chen <minch@chromium.org>
> Reviewed-by: Peter McNeeley <petermcneeley@google.com>
> Cr-Commit-Position: refs/heads/main@{#1445133}

Bug: 40584691
Change-Id: I031b616ad43262c95e6e20eb8f0ad7df886ee78f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6448471
Reviewed-by: Frank Liberato <liberato@chromium.org>
Reviewed-by: Eugene Zemtsov <eugene@chromium.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@chromium.org>
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Peter McNeeley <petermcneeley@google.com>
Reviewed-by: Min Chen <minch@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: vikas soni <vikassoni@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1446154}
2025-04-11 17:53:31 -07:00
7aed19d2c8 [gpu] Add max texture size crash key
Add max_texture_size crash key that will help investigate the maximum
size supported for creating NV12 textures when creating D3D textures
fails for NV12 formats due to large sizes.

Bug: 374461672
Change-Id: I0b1377eb6d6f72c5d0d6cfe0a9fc61e9ea3e359a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6447094
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1445370}
2025-04-10 10:28:50 -07:00
acb1ed5b9e Revert "Improve encapsulation of shmem and dxgi GpuMemoryBufferHandles"
This reverts commit 16a0b272da.

Reason for revert: Tree is closed due to "error: no member named 'set_region' in 'gfx::DXGIHandle'" error in https://ci.chromium.org/ui/p/chromium/builders/ci/win32-archive-rel/49415/overview

Original change's description:
> Improve encapsulation of shmem and dxgi GpuMemoryBufferHandles
>
> This CL attempts to move shared memory and DXGI GpuMemoryBufferHandles
> towards a model that are easier to move into a std::variant. The
> trickiest part of this is updating use of the shared memory region:
> previous refactorings here ignored this by simply dynamically
> dispatching depending on the type of the std::variant. While it is
> possible to continue implementing this behavior, being explicit here
> probably has long-term benefits for code readability...
>
> Summary of changes:
> - Extracting a shared memory regions or DXGI handle from a
>   GpuMemoryBufferHandle is now a consuming operation, i.e. the
>   GpuMemoryBufferHandle becomes an EMPTY_BUFFER.
> - Mutable getters and setters for these two subtypes no longer exist,
>   to make it impossible to have a SHARED_MEMORY_BUFFER with an invalid
>   region.
> - Add overloads for constructing a GpuMemoryBufferHandle from a shared
>   memory region or DXGI handle.
>
> Bug: 40584691
> Change-Id: I580a85be460035e063d1bf65e3c031104cb5410c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6381717
> Reviewed-by: Frank Liberato <liberato@chromium.org>
> Reviewed-by: Piotr Bialecki <bialpio@chromium.org>
> Reviewed-by: Ilya Nikolaevskiy <ilnik@chromium.org>
> Reviewed-by: Colin Blundell <blundell@chromium.org>
> Reviewed-by: vikas soni <vikassoni@chromium.org>
> Commit-Queue: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Min Chen <minch@chromium.org>
> Reviewed-by: Peter McNeeley <petermcneeley@google.com>
> Cr-Commit-Position: refs/heads/main@{#1445133}

Bug: 40584691
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I2c0b29869003b6ebd6f96a24c1d207b0b3546d01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6438850
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Owners-Override: Nicola Tommasi <tommasin@chromium.org>
Auto-Submit: Nicola Tommasi <tommasin@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1445159}
2025-04-10 02:14:07 -07:00
16a0b272da Improve encapsulation of shmem and dxgi GpuMemoryBufferHandles
This CL attempts to move shared memory and DXGI GpuMemoryBufferHandles
towards a model that are easier to move into a std::variant. The
trickiest part of this is updating use of the shared memory region:
previous refactorings here ignored this by simply dynamically
dispatching depending on the type of the std::variant. While it is
possible to continue implementing this behavior, being explicit here
probably has long-term benefits for code readability...

Summary of changes:
- Extracting a shared memory regions or DXGI handle from a
  GpuMemoryBufferHandle is now a consuming operation, i.e. the
  GpuMemoryBufferHandle becomes an EMPTY_BUFFER.
- Mutable getters and setters for these two subtypes no longer exist,
  to make it impossible to have a SHARED_MEMORY_BUFFER with an invalid
  region.
- Add overloads for constructing a GpuMemoryBufferHandle from a shared
  memory region or DXGI handle.

Bug: 40584691
Change-Id: I580a85be460035e063d1bf65e3c031104cb5410c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6381717
Reviewed-by: Frank Liberato <liberato@chromium.org>
Reviewed-by: Piotr Bialecki <bialpio@chromium.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Reviewed-by: vikas soni <vikassoni@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Min Chen <minch@chromium.org>
Reviewed-by: Peter McNeeley <petermcneeley@google.com>
Cr-Commit-Position: refs/heads/main@{#1445133}
2025-04-10 00:31:14 -07:00
6a73a13bd2 WebGPU: fix viewFormats validation in GPUContextCanvas.
If the viewFormats passed to GPUCanvasContext.configure() are invalid,
the spec requires that a validation error occur. Subsequent calls to
GPUCanvasContext.getCurrentTexture() must also generate a validation
error.

The SwiftShader path in Chrome uses
SharedImageRepresentationAndAccessSkiaFallback for WebGPU canvas
contents. When GPUCanvasContext.getCurrentTexture() causes
AssociateMailbox() to be called on an invalid context, this causes the
GPUTexture allocation in the SIRAASF constructor to fail. When the
canvas is later garbage collected, DissociateMailbox() calls
SharedImageRepresentationAndAccessSkiaFallback::UploadContentsToSkia(),
which fails on that invalid texture in
GPUCommandEncoder.copyTextureToBuffer(). This can cause validation
errors in unrelated code (leading to the flaky failed tests in the bug).

The fix is to move the texture creation to SIRAASF::Create() and detect
the texture creation failure with a a push/popErrorScope(). If it fails,
return nullptr, causing
WebGPUDecoderImpl::HandleAssociateMailboxImmediate() to create a
ErrorSharedImageRepresentationAndAccess instead, as the other backends
do. This will avoid doing anything with an invalid texture.

However, it turns out that the validation error from CreateTexture is
actually load-bearing, and is the only reason that getCurrentTexture()
generates a validation error at all! Removing it causes the viewFormats
CTS tests to fail, since they don't get a validation error they're
expecting. The fix for that is to explicitly validate the texture
descriptor each time GPUCanvasContext.getCurrentTexture() is called.

Bug: 40853211
Change-Id: I445b0aff0f05efac01e0d95966ade9945876f9fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6435571
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1444466}
2025-04-08 17:07:47 -07:00
5894ef310b Add wrapper functions to class GraphiteSharedContext
These functions mirror the public functions in skgpu::graphite:Context.

When |is_thread_safe| is true, the lock in each wrapper function ensures
calling to the same function in skgpu::graphite:Context is thread safe.
When |is_thread_safe| is false, the lock has no effect.

Bug: 407874799
Change-Id: I3590d4a2ce5f236bceb0732ca2b111b343b6e7d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6440343
Commit-Queue: Maggie Chen <magchen@chromium.org>
Reviewed-by: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1444279}
2025-04-08 12:08:17 -07:00
5915886457 WebGPU: Add a way for Finch to enable/disable Dawn toggles for WebGPU
This is to be used for a WebGPU feature that just got shipped so that
they can be disabled with a killswitch in case something goes really
wrong.

Bug: 406156454
Change-Id: Ic8d5cf95a1fa4f97905f012eede6f27abc3589b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6422216
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Maggie Chen <magchen@chromium.org>
Commit-Queue: Fr <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/main@{#1444087}
2025-04-08 06:26:25 -07:00
c16fc9a490 [tvos] Use kern_return_t for the return type of IOSurface{Lock,Unlock}
This uses `kern_return_t` for the return type of
`IOSurface{Lock,Unlock}`. In the current code base, `IOReturn` is used
for the return type of `IOSurface{Lock, Unlock}` but the return type is
not available for tvOS. According to the function signature,
`IOSurface{Lock, Unlock}` returns `kern_return_t`. So, this change uses
`kern_return_t` and compares the return value with KERN_SUCCESS.

Bug: 391914246
Change-Id: I296c3a8ab77adc9283d3b02911eff5713916b269
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6429008
Reviewed-by: John Rummell <jrummell@chromium.org>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Julie Jeongeun Kim <jkim@igalia.com>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1443779}
2025-04-07 14:48:56 -07:00
0f009ad3b8 Make flow ID masks 64-bits, like they originally were
64-bit constants are 16 hex digits, not 8. Oops.

Bug: 406829393
Change-Id: I401ca1b8590e29ce82ff880b6413ea5465de07c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6432674
Reviewed-by: ccameron chromium <ccameron@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1443648}
2025-04-07 11:34:09 -07:00
615cca20d7 Check for non-null transfer_cache in RasterDecoderImpl::Destroy
If skia failed to initialize or during wierd tear-down ordering, the
transfer cache can be null at raster decoder destruction. Defensively
null check it.

Bug: 408729616
Change-Id: Iae29700f3e7fa294ab338d6e6510ce275a02e065
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6438235
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1443623}
2025-04-07 11:03:45 -07:00
6243f14e3d Add 5 minute reporting of Skia's Graphite Pipeline caching
This will surface the Skia UMA stat:
   Skia.Graphite.PipelineCache.PipelineUsesInEpoch
which reports the number of Pipelines used since the last call to reportPipelineStats(kPipelineCache). We will use this to set Skia's constant:
   kGlobalGraphicsPipelineCacheSizeLimit
which is currently set (somewhat arbitrarily) to 256.

Low-Coverage-Reason: EXPERIMENTAL_CODE Precompilation is not yet enabled
Bug: 358074434
Change-Id: Ic2a37bb0062bfa54553ae232492604f995e2e5d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6426285
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1443500}
2025-04-07 08:30:37 -07:00
c067f90007 Create a new graphite:Context wrapper class GraphiteSharedContext
To support multithreading for graphite::Context, we introduce a new
wrapper class GraphiteSharedContext that uses a lock to ensure
graphite::Context is thread safe.

GraphiteSharedContext in this CL is pretty much empty. More content will
be added later.

Bug: 407874799
Change-Id: I58bd2f3f4f834bbc280ec44b95b015e43676bfca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6425059
Reviewed-by: vikas soni <vikassoni@chromium.org>
Commit-Queue: Maggie Chen <magchen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1442992}
2025-04-04 16:30:06 -07:00
309a671f65 WebGPU: label CommandEncoders created in Chrome.
Add labels for the CommandEncoders used for for buffer-to-texture
and texture-to-buffer copies.  This is super helpful in debugging.

Bug: 408395408
Change-Id: I766bec955d9abc9de90d96f80b5bc5064a36a57d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6431531
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Stephen White <senorblanco@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1442933}
2025-04-04 14:29:53 -07:00
0c971b731b [ios blink] Use Graphite Metal backend by default
We currently try to use the Graphite Dawn Metal backend which fails to
initialize causing fallback to Ganesh GL Metal. Use the Graphite native
Metal backend instead which performs far better than Ganesh GL. We
eventually want to use the Graphite Dawn backend so this is intended to
be temporary.

This CL updates the skia_use_metal GN flags to the new behavior and also
removes the requirement to explicitly pass a command line flag to enable
the Graphite Metal backend on iOS.

Also, update SkiaBackendType to include the GraphiteMetal case.

Cq-Include-Trybots: luci.chromium.try:ios-blink-dbg-fyi
Change-Id: I685d3a5ae497af9550cd572221fa61b2fb36dcba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6409054
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1442882}
2025-04-04 13:20:46 -07:00
e8671376d9 Change flip_y to is_dst_origin_top_left in CopySharedImageToTexture
This clarifies semantic that it's "desired state" rather then action.

Bug: 378688985
Change-Id: I7a20d941535214f50bc59fda41f4fc21b2d745d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6430968
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1442848}
2025-04-04 12:37:52 -07:00
14f9b6824f [graphite] Switch viz Recorder to not require ordered recordings
Bug: 406292843
Change-Id: I1b5506873dc170e11f0b014b6fe5731328a1944d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6432647
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1442747}
2025-04-04 10:40:24 -07:00
45f8e6b57a [gpu] Make GpuInfoCollector toggles in sync with DawnContextProvider
GpuInfoCollector::GetDawnTogglesForSkiaGraphite is currently out of
sync with the toggles enabled/disabled in DawnContextProvider.
Ideally the toggles in GpuInfoCollector should not be a separate list
and also come from DawnContextProvider. But for now, update
GpuInfoCollector to have most of the toggles similar to that in
DawnContextProvider along with TODOs for those that require extra
flags and are platform specific.

Bug: 407497928
Change-Id: Ib687a6f806ba9a846eeb5887bc16b836a373a932
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6416722
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1442700}
2025-04-04 07:21:31 -07:00
17f16c89cb [gpu] Fix texture assignment in WrappedGraphiteBacking::InitWithData
Create `texture_holder_` in WrappedGraphiteBacking::InitializeWithData
so that on backing construction failure, the texture will be deleted
as well.

Bug: 383528569
Change-Id: Ic0f621e69766d42a542787f679cdf0ab6c3e1cff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6430128
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1442381}
2025-04-03 13:14:39 -07:00
42d7d3974a CodeHealth: Clean up WriteMetalShaderCacheToDisk
This removes features and code associated with these two related features:

- WriteMetalShaderCacheToDisk
- UseBuiltInMetalShaderCache

These are two halves of the same functionality, and the combined system has been confirmed obsolete.

Bug: 356625448, 356625491
Change-Id: Ic4ba3439c457c94ad051e5c8be370a722c9ca90a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6416542
Commit-Queue: Christopher Grant <cjgrant@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1441913}
2025-04-02 17:51:36 -07:00
fab7883e9c Support thread safe by adding AutoLock in IOSurfaceImageBacking
- AutoLock is null op when is_thread_safe is false.
- Use class ClearTrackingSharedImageBacking to handle locks in
  IOSurfaceImageBacking clear.
- Add AutoLock for memory Begin/End Read/Write access.
- The base class SharedImageRepresentation has already had a lock in
  place. No duplicate locks are added to ProduceDawn/Overlay/...etc.
- ProduceSkiaGraphite() calls ProduceDawn(). No duplicate locks are
  added.
- No AutoLock is added to IOSurfaceBackingEGLState since it's an
  intermediate layer in memory access calls.
- Tested with Feature "EnableDrDc" enabled and disabled for deadlock.
- Tested with --enable-skia-graphite and --disable-skia-graphite for
  deadlock.

Bug: 405946930
Change-Id: I9a7ace979cdf629b918ef6d3830b9256ffd8886e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6389800
Commit-Queue: Maggie Chen <magchen@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1441887}
2025-04-02 16:58:28 -07:00