0
Commit Graph

9094 Commits

Author SHA1 Message Date
Jonathan Lee
f8da1eb6b7 [gtest] Consume AssertionResults in gl_ext_blend_func_ext...cc
Wrap each `testing::AssertionResult` in an `EXPECT_TRUE(...)` [0] to
actually check if the assertion passed. The dropped assertion was
revealed by Googletest recently marking `AssertionResult` as
`[[nodiscard]]` [1].

[0]: https://google.github.io/googletest/advanced.html#predicate-assertions-for-better-error-messages
[1]: 3fbe4db9a3%5E%21/

Bug: 398298306
Change-Id: I62113ee2a104409ace4217c2571680cdc7844339
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6293496
Auto-Submit: Jonathan Lee <jonathanjlee@google.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1424733}
2025-02-25 12:49:36 -08:00
Peter McNeeley
79999432f2 Gather all memory planes into a span for shmem
We make the assumption that each plane has a specific size and
precedes in a specific order. It is cleaner to just provide the
entire memory mapping to the shmem.

Change-Id: Id3b6b073b5650a83dfebf82531fdac1c2150de64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6289366
Commit-Queue: Peter McNeeley <petermcneeley@google.com>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1424512}
2025-02-25 07:08:27 -08:00
Kalvin Lee
7dbd7537f8 arrayify: Prefer constexpr
This CL is intended to be trivial. It marks the return from `std::to_array` as
`constexpr`. This CL is a split of a naive textual search-and-replace under:

gpu/command_buffer

This CL was uploaded by git cl split.

Change-Id: I9df0a50e5c9945e81126a4e2173e1d736021ce27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6299473
Auto-Submit: Kalvin Lee <kdlee@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1424420}
2025-02-25 03:04:45 -08:00
Colin Blundell
b399740f6c [//gpu] Add new ClientSharedImage::CreateForTesting() variant
An upcoming change will require a unittest to pass in a
SharedImageUsage. This CL adds that API as well as a general-purpose
API that takes in SharedImageMetadata and that the various convenience
APIs are now all backed by.

Bug: 40064122
Change-Id: I27f55414173e4fb5cbde319aeb19ebfb88fd7e81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6297683
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1424347}
2025-02-24 23:34:11 -08:00
Saifuddin Hitawala
f1626ebfa7 [gpu] Add debug label on SIRepresentation::BeginAccess failures
Add client provided debug labels when logging error logs when
SharedImageRepresentation::BeginAccess failures happen.

Bug: 393314286
Change-Id: I47fac785186da3a085d53e72a35a510544b948d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6292599
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423918}
2025-02-24 08:19:45 -08:00
Saifuddin Hitawala
ae53187242 [media] Use WrapMappableSharedImage in VideoFrame mojom
Update SharedImageVideoFrameData mojom struct to take in
is_mappable_si_enabled passed in by the VideoFrame to check for
mappable shared image support. Based on the flag, use
WrapMappableSharedImage to create a mappable VideoFrame passing in
the ExportedSharedImage that contains the GpuMemoryBufferHandle.

Make this conversion behind a killswitch to guard against rollout
issues.

Bug: 391865297
Change-Id: Iba04429ce1d09bddc21cdb977edf9bd705c03511
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6287668
Commit-Queue: vikas soni <vikassoni@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Eugene Zemtsov <eugene@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423518}
2025-02-21 18:27:39 -08:00
Rafael Cintron
f47b7b4c7a Fix Graphite on D3D12 startup issues
Recent SharedImage changes always assumed the presence of a D3D11
device. When graphite runs with D3D12, no D3D11 device was provided
to the D3DImageBackingFactory constructor, causing it to crash
At the same time, since InitializeDirectComposition is always called
with ANGLE's D3D11 device, it incorrectly, returned true for
IsD3DSharedImageSupported and crashed when the renderer process sent
it scanout images.

The CL rearranges GPU initialization such that DirectComposition is
initialized after the Dawn context provider, thus providing it the
correct D3D11 device, or no D3D11 device if there is none.
IsD3DSharedImageSupport is provided with the SharedContextState so it
can learn the truth about there being no D3D11 device.

With these changes, D3DSharedImageFactory is never created and no
scanout images are requested from the renderer process. Graphite on
D3D12 boots and is able to draw basic web pages.

Future CLs will slowly bring back SharedImage capability when Graphite
runs on D3D12.

Bug: 396312708
Change-Id: I30860ecd523eb158e57b2c65f9be4d6ce246fbcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6288547
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Rafael Cintron <rafael.cintron@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1423478}
2025-02-21 16:21:44 -08:00
Le Hoang Quyen
2ef8ddc2ff Graphite: fix texture leaks in persistent dawn's access
Previously we initialized persistent dawn's access two early,
DawnSharedTextureHolder didn't have a chance to cache the shared texture
memory. Hence the texture wasn't destroyed when the
DawnSharedTextureHolder is deleted. Leading to memory leaks.

Fix by attempting to cache the shared texture memory before initializing
the persistent dawn's access.

Bug: 354942507
Change-Id: I7fd752cfb41d51f5f17e94b6c46b3f8020bdf6c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6290929
Reviewed-by: Sunny Sachanandani <sunnyps@chromium.org>
Auto-Submit: Quyen Le <lehoangquyen@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423378}
2025-02-21 13:17:51 -08:00
Michael Tang
408018ba98 gpu: win: Fix crash in BeginDCompTextureAccess
BeginDCompTextureAccess was added in https://crrev.com/c/6271326, but I
made a mistake in the condition for a sanity check. The condition, as
written, assumes it runs before `num_dcomp_texture_readers_` increments,
but it actually runs after.

Bug: 398147758
Change-Id: Id5585e51057c3c07793cedd0db7cea8ae9636a22
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6288001
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Michael Tang <tangm@microsoft.com>
Auto-Submit: Michael Tang <tangm@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1423347}
2025-02-21 12:28:26 -08:00
Ahmed Yamout
8af42e0515 Fix command_buffer_perftests
DecoderPerfTest.ProgramDraw was failing due to not
waiting for commands to process after each iteration which
would result in the gpu being overwhelmed and running
out of memory as well as skewing iteration timing
since commands would keep piling up.

Fixed issue by forcing each replay to wait for commands execution.

Change-Id: I370b468c09ef1517cb94f3b3c7530d352adc1ac1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6252629
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423209}
2025-02-21 09:23:03 -08:00
Le Hoang Quyen
d806e29edc graphite: Disable persistent dawn's access for dcomp textures.
Previously we checked whether we need to disable persistent dawn's
access if the D3DImageBacking has dxgi_shared_handle_state_. However, if
the backing has a dcomp texture, cross device synchronizations are also
required, thus we need to disable persistent dawn's access as well.

Bug: 354942507
Change-Id: I72a01bfa3d91b850ec5fdde78f806679fb9019ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6289654
Auto-Submit: Quyen Le <lehoangquyen@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Commit-Queue: Quyen Le <lehoangquyen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423074}
2025-02-21 05:36:40 -08:00
Le Hoang Quyen
cc172147ef graphite: Defer Dawn's EndAccess for D3DImageBacking.
When D3DImageBacking is not shared across devices, such as when using
a pure ID3D11Texture2D instead of a shared handle, we don't need any
fence to sync between Graphite & ANGLE because both use the same D3D11
device.
- Hence we can call SharedTextureMemory.BeginAccess once and keep it
open until the backing is destroyed.
- To make graphite's commands visible to ANGLE, we will trigger
Context::submit before we access in ANGLE, this is done at the start
of BeginAccessD3D11.
- After ANGLE modifies the texture's content we need to notify Dawn
that the texture has been initialized. It is to avoid Dawn lazily clears
the texture again. The only way to do this is via SharedTextureMemory's
BeginAccess. However since we keep the access open, we will need to
temporarily end SharedTextureMemory's access and call BeginAccess again.
This is done at the end of EndAccessD3D11.

Bug: 354942507
Change-Id: Ia3a69dbf40f19078777da06c7676927c93ad7364
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6271343
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
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@{#1423003}
2025-02-21 02:08:40 -08:00
Michael Tang
8419107f53 gpu: win: Acquire DComp texture available fence immediately on retiring
This CL changes moves the DComp texture available fence acquisition from
immediately before the subsequent write to immediately after retiring
the texture.

This change moves the possible case of failure to acquire the available
fence to the frame with a problematic DComp commit, rather than a later
rasterization task.

This is valid because DComp commit is not an event that affects the
validity of the available fence, as previously thought. As long as the
DComp texture is not placed back into any visual tree and we do not
release the DComp texture, the available fence remains valid.

Change-Id: I96be19a6271eda6d9f5060baf837059909b63204
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6271326
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Michael Tang <tangm@microsoft.com>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1422796}
2025-02-20 14:08:02 -08:00
Geoff Lang
90abe62085 Remove usage of glGetBooleani_v in the passthrough decoder
This function is ES3.1+ and was used only to query the first draw buffer
when the regular glGetBooleanv already queries that value.

Bug: 397919896
Change-Id: I0162b772e5d969702d6ba25fb1ccc09b64762d30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6287146
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422776}
2025-02-20 13:25:24 -08:00
Saifuddin Hitawala
9a12324134 [gpu] Display SkiaBackendType in about://gpu
Display the plumbed in SkiaBackendType in GpuInfo in about://gpu page.
This information is useful for debugging in cases where the
SkiaGraphite or Vulkan feature information is not enough.

Bug: 364913797
Change-Id: I67ff7a8dd5e100fcfb1dc1f0d0476f85a4cbcef5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6278041
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422712}
2025-02-20 11:45:27 -08:00
Colin Blundell
3f1e04a3e2 [//gpu] Streamline GLTextureImageBackingFactory lack of SCANOUT support
It can just not have this usage in its set of supported usages rather
than having it and then explicitly rejecting in IsSupported(). The
supported usages are passed to the base class [1][2] and used to
early-out here [3] before calling IsSupported() on the subclass.

[1] https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/shared_image/gl_texture_image_backing_factory.cc;l=100;drc=798b98d70313e6a55bcf9cc85bc7ca7d42ca6d23;bpv=1;bpt=1
[2] https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/shared_image/gl_common_image_backing_factory.cc;l=102;drc=798b98d70313e6a55bcf9cc85bc7ca7d42ca6d23
[3] https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/shared_image/shared_image_backing_factory.cc;l=86-89;drc=798b98d70313e6a55bcf9cc85bc7ca7d42ca6d23;bpv=1;bpt=1

Bug: 330865436
Change-Id: Icda38cc74d1b9f8cc99ece051b8967fa486df16d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6281006
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422390}
2025-02-20 00:15:35 -08:00
Colin Blundell
5b2e47de67 [//gpu] Remove SupportScanoutInGLTextureImageBacking reverse killswitch
This reverse-killswitch was introduced disabled in 132 [1], and there
have been no reports of any problems. A followup CL will streamline the
code organization here further.

[1] https://chromiumdash.appspot.com/commit/0f3df2307b4c4c4a696f0afd6326367c7f5f7da5

Bug: 330865436
Change-Id: Ibae641c5aecab338cf3389e8863f1badec6fd4ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6280985
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422389}
2025-02-20 00:15:25 -08:00
Colin Blundell
ab1fcc4062 [//gpu] Remove RestrictExternalVkImageBackingScanoutSupportToFuchsia
The feature was enabled in 131 [1] and the functionality that it guards
was enabled in 132 [2]. There have been no reports of any problems.

[1] https://chromiumdash.appspot.com/commit/6dc18fa1f96f1c5bd724d3c729c815be784f7d0e
[2] https://chromiumdash.appspot.com/commit/db5b1cc5e413ae5fec27fbc54018d945617f00da

Bug: 330865436
Change-Id: I68c3a65fc88be10fb9ebf6dad327f31b1c008563
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6280905
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422380}
2025-02-19 23:51:37 -08:00
Chunbo Hua
50ae3921ac Trace events for swap chain presentations in SharedImageBacking
Also do gl::LabelSwapChainAndBuffers for D3DImageBacking as DXGISwapChainImageBacking.
It can make things easier to know which SII is doing presentation.

Bug: None
Change-Id: I0ce37c78493656fe910e6be6e5aabe2e81b00bc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6268400
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Saifuddin Hitawala <hitawala@chromium.org>
Commit-Queue: Chunbo Hua <chunbo.hua@intel.com>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422290}
2025-02-19 17:03:39 -08:00
Saifuddin Hitawala
5da018371f [gpu] Add SkiaBackendType to GpuInfo
Add SkiaBackendType info to GpuInfo. This moves the SkiaBackendType
from SharedContextState to GpuPreferences so that it can be shared
more easily. Also update the relevant mojom files.

This will be later displayed in chrome://gpu information.

Bug: 364913797
Change-Id: I588652fd8babe17d28061ac39c4df909e6e38ada
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6282205
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422176}
2025-02-19 13:32:02 -08:00
Colin Blundell
e4e85d4591 [//ash] Remove FastInkHostAddScanoutUsageOnlyIfSupportedBySharedImage
This killswitch shipped default-on in 132 [1], and there have been no
reports of any problems.

[1] https://chromiumdash.appspot.com/commit/a295843f6b3779844bba009ad32941c891cbbd66

Bug: 330865436
Change-Id: I649fb47fa96651294219c966073647359e8fc3ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6276099
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421813}
2025-02-19 00:43:08 -08:00
Colin Blundell
a0e426f19f [//ash] Remove RoundedDisplayAddScanoutUsageOnlyIfSupportedBySharedImage
This killswitch shipped default-on in 132 [1], and there have been no
reports of any problems.

[1] https://chromiumdash.appspot.com/commit/b74efb8957cd6119cee05c83470db8e90dbadb73

Bug: 330865436
Change-Id: I166415e290946b1cacba79866ad9164480429731
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6276339
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421812}
2025-02-19 00:42:58 -08:00
Saifuddin Hitawala
7223bef5b7 [gpu] Report SkiaBackendType for gr-context-type crash key
Report SkiaBackendType that contains more information regarding the
dawn backend for gr-context-type crash key.

Bug: 364913797
Change-Id: I0f4d1d5f39ac277d2a7337096b39301a44944dd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6275730
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421626}
2025-02-18 13:39:42 -08:00
Saifuddin Hitawala
3764b285d0 [gpu] Create GpuMemoryBuffer out of ExportSI GMBHandle
Create a GpuMemoryBuffer when creating ClientSharedImage with passed
in ExportedSharedImage info that contains the GpuMemoryBufferHandle.

Bug: 391788839
Change-Id: I78cb24f9900dce9d60ee4089676358b67f1e304c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6276795
Reviewed-by: vikas soni <vikassoni@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421593}
2025-02-18 12:42:59 -08:00
Colin Blundell
d8adb55459 [//ash] Remove ViewTreeHostAddScanoutUsageOnlyIfSupportedBySharedImage
This killswitch shipped default-on in 132 [1], and there have been no
reports of any problems.

[1] https://chromiumdash.appspot.com/commit/6c1ee2b18a108010841179901ebea93e202a3be6

Bug: 330865436
Change-Id: Iefc5bcba67db4874da7f1a29fae16168f7f46917
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6275945
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421255}
2025-02-17 23:47:40 -08:00
Colin Blundell
ff7f871106 [//gpu] Remove SharedImageSupportScanoutOnOzoneOnlyIfOverlaysSupported
This killswitch shipped default-on in 132 [1], and there have been no
reports of any problems.

[1] https://chromiumdash.appspot.com/commit/db5b1cc5e413ae5fec27fbc54018d945617f00da

Bug: 330865436
Change-Id: I8f3270031cdc8806125ccfc65c4e4f4dbd185ccb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6276084
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421254}
2025-02-17 23:45:26 -08:00
Colin Blundell
bcb5e57a2a [//ash] Remove killswitch gating exo::Buffer SCANOUT usage
This killswitch shipped default-on in 132 [1], and there have been no
reports of any problems.

[1] https://chromiumdash.appspot.com/commit/0db4e8429bd78db2ee40feab3d520bc8ea2286a7

Bug: 330865436
Change-Id: I6db6ad67b49ddb415b2d4a9dd03dba1e28792205
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6275126
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421252}
2025-02-17 23:43:35 -08:00
Colin Blundell
d0b2220e83 [//ash] Remove killswitch gating CameraVideoFrameHandler SCANOUT usage
This killswitch shipped default-on in 132 [1], and there have been no
reports of any problems.

[1] https://chromiumdash.appspot.com/commit/6c1ee2b18a108010841179901ebea93e202a3be6

Bug: 330865436
Change-Id: I6bd62a2e79c79c70edb1a663ef1d7e2b4cf18685
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6268490
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420988}
2025-02-17 02:18:55 -08:00
Saifuddin Hitawala
6b47763a31 [gpu] Add BufferUsage to ExportedSharedImage
Add optional BufferUsage param to ExportedSharedImage. Also update the
corresponding mojo.

Update ClientSharedImage ctor to directly take in ExportedSharedImage
instead of the params passed over from it.

Bug: 391788839
Change-Id: I0e1eeca01e61bd440aa42ec77b11be0f11f87a7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6258397
Reviewed-by: vikas soni <vikassoni@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420799}
2025-02-14 16:25:36 -08:00
Saifuddin Hitawala
c440fcc128 [gpu] Add GpuMemoryBufferHandle to ExportedSharedImage
Add an optional GpuMemoryBufferHandle to ExportedSharedImage in
order to be passed over mojo. This change adds optional GMBHandle to
ExportedSharedImage and updates callers of ExportedSharedImage.

It also updates Export, ImportUnowned and ClientSharedImage ctors
based on the ExportedSharedImage with GMBHandle.

NOTE: Creation of GpuMemoryBuffers requires BufferUsage which will
be added in follow-up. We'd also like to add a bool in follow-ups
that specifies if Export() should export a cloned handle or
not based on clients that require it.

Inspired from https://chromium-review.googlesource.com/c/chromium/src/+/5737963
by Vikas.

Bug: 391788839
Change-Id: Iee51901b98fb73a5898ad01cb45412956102d8a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6207476
Reviewed-by: vikas soni <vikassoni@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420769}
2025-02-14 15:16:26 -08:00
Saifuddin Hitawala
c770847423 [gpu] Log gr-context-type crash key only once
There can be cases where a crash happens and chrome can fallback
from Graphite to Ganesh. In such cases the gr-context-type crash key
is overwritten and the crash report can report incorrect information.

This change fixes by logging crash key once when Skia is initialized
the first time.

Bug: 390417678
Change-Id: I65a23a163356f4d9a439e3ecb4f5baefb4c3a676
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6264787
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420579}
2025-02-14 10:06:57 -08:00
Chunbo Hua
a1007a21a1 DXGI swap chain is not required when creating GL texture for D3DImageBacking
Other two redundant parameters of CreateGLTexture are removed as well.

Bug: None
Change-Id: I7204d20878352c770d7575b5a5914ae1a3119818
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6261587
Commit-Queue: Chunbo Hua <chunbo.hua@intel.com>
Reviewed-by: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1420280}
2025-02-13 19:47:32 -08:00
Lokbondo Kung
474f6bd530 [dawn][headers] Use ifdefs for flattening of wgpu::*Limits.
- In preparation for the changes to be landed in:
  https://dawn-review.googlesource.com/c/dawn/+/225294
  use #ifdefs with WGPU_BREAKING_CHANGE_FLATTEN_LIMITS to
  allow flattening of wgpu::RequiredLimits and
  wgpu::SupportedLimits into just wgpu::Limits.

Bug: 374263404
Change-Id: Iaf0e0d828ad1248a23ea977c5c0a9c876049fe01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6241715
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418903}
2025-02-11 13:56:04 -08:00
Saifuddin Hitawala
f2be4ef2f4 [gpu] Remove SII:AddReferenceToSharedImage
Remove SharedImageInterface:AddReferenceToSharedImage as it is no
longer used.

Bug: 391788839
Change-Id: I9ba689d0b1c598bf26348c45fe5393c391eff426
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6249766
Commit-Queue: vikas soni <vikassoni@chromium.org>
Reviewed-by: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418723}
2025-02-11 09:45:44 -08:00
Saifuddin Hitawala
b51b894382 [gpu] Update ClientSharedImage::ImportUnowned ExportedSI param
As part of making ExportedSharedImage move only, update
ClientSharedImage::ImportUnowned to take in ExportedSharedImage
without const ref so that it can be moved over mojo.

Also update SharedImageInterface::ImportSharedImage to do the same.

Bug: 391788839
Change-Id: Iffe41753fe5ac79eb481c3c8f1ee0d64d0b6269f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6244979
Reviewed-by: vikas soni <vikassoni@chromium.org>
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Reviewed-by: Giovanni Ortuno Urquidi <ortuno@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1418247}
2025-02-10 10:40:22 -08:00
Mounir Lamouri
3a5939cd57 ImageReaderGLOwner: fix tests always expecting 3 max images.
When features::IncreaseBufferCountForHighFrameRate() returns true, the
value will be 5 instead of 3. This is fixing the tests to be more
flexible.

Bug: None
Change-Id: Ifbc3c40ac164d52e66cb496ce707e3b86ebd27b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6241994
Commit-Queue: Mounir Lamouri <mounir@meta.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417463}
2025-02-07 11:07:11 -08:00
Saifuddin Hitawala
5c2fe269f5 [gpu] Add ProduceSkiaGanesh support to WrappedGraphiteTexture backing
WrappedGraphiteTexture backing can be used for test scenarios where
IOSurfaceImageBacking cannot be used with Graphite-Swiftshader-Vulkan
backend. One such scenario is PaintCanvasVideoRendererWithGLTest
unittest where the test takes 1-copy path with
CopySharedImageToGLTexture over passthrough command decoder which in
turn calls ProduceSkiaGanesh. Here since Swiftshader-Vulkan backend
is used for testing, WrappedGraphiteTexture backing is picked which
needs to implement ProduceSkiaGanesh for supporting the codepath to be
tested.

In production, the IOSurfaceImageBacking would instead be used as it
would support Scanout/Gles2 usages but WrappedGraphiteTexture backing
does not support such usages (only supported for testing).

Ideally, we should test with IOSurfaceImageBacking itself and something
we should look into.

Test: Tested PaintCanvasVideoRendererWithGLTest locally on M1 mac
with `--enable-skia-graphite` to make sure the test works expectedly.

Bug: 394385381
Change-Id: I97e78ae7861be6b91148489bbcf83402597ff319
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6237666
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417373}
2025-02-07 08:49:18 -08:00
vikas soni
bd1a0207a7 [MappableSI] Add a task_runner to HelperGpuMemoryBufferManager.
Add a SingleThreadTaskRunner to
ClientSharedImage::HelperGpuMemoryBufferManager.

HelperGpuMemoryBufferManager uses this task runner for
CopyGpuMemoryBufferAsync() operations to prevent deadlocks.

Deadlock Scenario:
1. Client thread calls CopyGpuMemoryBufferAsync() with a completion
callback.
2. Client thread blocks, waiting for an event which is often signaled by
the callback.
3. If the copy ran on the client thread, the callback would also need to
run on the *same*, now-blocked thread.
4. The callback can't run, the event isn't signaled, and a deadlock
occurs.

This dedicated task runner ensures the copy and callback execute
independently of the client thread, allowing the callback to signal the
event and prevent the deadlock.

Solution: 
Bug: 40264379
Change-Id: If60083ace9eea92f08a96322d0d57910913e465a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6241072
Reviewed-by: Colin Blundell <blundell@chromium.org>
Auto-Submit: vikas soni <vikassoni@chromium.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@chromium.org>
Commit-Queue: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417336}
2025-02-07 07:34:46 -08:00
Georg Neis
3eb670dda4 gpu: Replace a DUMP_WILL_BE_CHECK with a CHECK
With Lacros gone, it should be safe to make this a CHECK again.

Bug: 332069927, b:354842935
Change-Id: Iad0c35c9d2ded4c6f99024ad26e789babdcac544
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6228223
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417144}
2025-02-06 20:12:49 -08:00
Georg Neis
24b92cc40c gpu: Remove Lacros leftovers
Lacros is gone. Remove IS_CHROMEOS_LACROS and is_chromeos_lacros code
and replace IS_CHROMEOS_ASH and is_chromeos_ash with IS_CHROMEOS and
is_chromeos. Also remove obsolete imports of chromeos_buildflags.h
and chromeos/ui_mode.gni.

Bug: b:354842935
Change-Id: I6cf5a4d9cdc938a40fc9c7793ab1ff59e80645df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6229170
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417143}
2025-02-06 20:11:10 -08:00
Saifuddin Hitawala
9a5cd36ea7 [gpu] Make ExportedSharedImage move only
As part of adding GpuMemoryBufferHandle to ExportedSharedImage we add
move only constructors instead of copy constructors to ExportedSI.
This will allow to move the GMBHandle instead of cloning it when
assigning or copying the ExportedSharedImage.

This change adds a Clone method on ExportedSharedImage that allows
current clients of ExportedSharedImage to continue cloning it while
making the ExportedSharedImage mojo move only. This will allow
future usage with GpuMemoryBufferHandle to be moved around.

Bug: 391788839
Change-Id: I8c778a2dd9c326d0c85c349d10ae781e39cafba9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6237513
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Commit-Queue: vikas soni <vikassoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417141}
2025-02-06 19:47:37 -08:00
Vasiliy Telezhnikov
21de3a615e Introduce OverlayProcessorOzone::PixmapProvider
For more organic testing, so we don't need to make things virtual in
SharedImageManager

Change-Id: Ide575eb801513f3231b7d267d2026cc4388ca8d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6238381
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417071}
2025-02-06 15:53:26 -08:00
Vasiliy Telezhnikov
aefd04f710 Use SharedImageManager in OverlayProcessorOzone
Right now it uses SharedImageInterfaceInProcess which is fully
functional SII, but it needs only GetNativePixmap function that is just
forwarded to SharedImageInterface.

As we already have SharedImageManager around, it's easier to use that
and not create SIIInProcess. This would also allow to simplify few
things, because SkiaRenderer doesn't need to share it's sequence with
SII.

Change-Id: Ib04d5cde150482d86fca0fd02733c6e93c4a2943
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6237717
Reviewed-by: Kyle Charbonneau <kylechar@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417047}
2025-02-06 15:16:01 -08:00
Sunny Sachanandani
9e058b02e0 gpu: Flow trace events for sync token wait and release
Add flow trace events for sync token waits and releases. Make the
callback id a global static atomic so that it can uniquely identify a
sync token wait across all clients, and thus can be used as the flow
trace id.

Bug: 394772735
Change-Id: I54cddbe9903e292384c9bbdf524ff1353783940f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6239164
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Vasiliy Telezhnikov <vasilyt@chromium.org>
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417011}
2025-02-06 14:05:09 -08:00
Sunny Sachanandani
0eefabc86c gpu: Flow trace events for GPU scheduler tasks
Add flow trace events for the entire lifetime of a GPU scheduler task
from scheduling the task, unblocking it from sync token dependencies,
starting the task, continuing it, and finishing the task.

One small change in behavior is that we don't call Wait for a sync token
if it's for exact same sync token and order number. This should have no
effect other than one less no-op callback from being triggered - the
`wait_fences_` in `TaskGraph::Sequence` is a set so only one of the
callbacks will have any effect.

Other minor cleanup included:

1) Replace the front task unblocked callback with a virtual method that
   subclasses can override.

2) Remove unnecessary CreateSequence methods from TaskGraph.

3) Add const qualifiers for some local variables in a couple of places.

Bug: 394772735
Change-Id: Ide719ee72ef66dda3eaf873c94dd5f1c0da9ff1b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6237782
Auto-Submit: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1417007}
2025-02-06 13:58:30 -08:00
Lokbondo Kung
24ac4fdf68 [dawn][headers] Use renamed wgpu::ImageCopy* structures.
The following renames landing Dawn:
  - ImageCopyBuffer   -> TexelCopyBufferInfo
  - ImageCopyTexture  -> TexelCopyTextureInfo
  - TextureDataLayout -> TexelCopyBufferLayout
So update them them here.

Bug: 42240793
Change-Id: I7c36a60268f2e137757f212c24281bdb0f1efde5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6237616
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Loko Kung <lokokung@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416640}
2025-02-06 00:06:59 -08:00
Sunny Sachanandani
3e85d2ce5d graphite: Use allowStorageBinding flag for IOSurface Dawn textures
This newly introduced flag allows skipping MTLTextureUsageShaderWrite on
the MTLTexture that wraps the IOSurface.

Bug: 388872587
Change-Id: I10ef01c6ddf808f51b4260e5da8a92162b678d8c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6197722
Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416391}
2025-02-05 12:35:36 -08:00
Michael Tang
1bded02fde gpu: win: Only check for DComp texture available fence with no readers
This CL relaxes our early CHECK that DWM is no longer reading our comp
texture to only happen when there are no other windows that could
possibly reference it.

This CHECK would previously cause crashes in debug builds in a race if a
window reuses a DComp texture before the retiring window releases it.

Bug: 368305211
Change-Id: I7ad34a7c9f580e14843a9e69b5b9d026f2856156
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6228143
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Michael Tang <tangm@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1416366}
2025-02-05 11:57:47 -08:00
Geoff Lang
ce59a802a1 Use DawnAHardwareBufferImageRepresentation for all dawn backends
Dawn can now supports direct AHardwareBuffer import on all Android
backends (with feature checks).

Changes from original CL: Fall back to EGLImage backing when the SyncFD
feature is not available. A follow-up patch will add new SharedFence
types for this case.

This is a reland of commit f5334a65d6

Bug: 42241435
Change-Id: Ib4bd11e5be4bf5bfdb17902a1a195c8bcaa9a594
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6207253
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416337}
2025-02-05 11:13:33 -08:00
Tom Sepez
7c63fd448c Suppress unsafe libc call warnings in generated gpu files.
Update a python script to add unsafe libc call suppression to a list of
generated files, then run the scripts which use it to regenerate the
files.

This is similar to what was done in the past to suppress unsafe buffers
warnings, and helps prepare us for eventual enforcement of these
stricter warnings.

Bug: 390223051
Change-Id: I29898d1d7f5d9b010481e8b48cb26f37f6b56674
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6230978
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416324}
2025-02-05 11:01:07 -08:00