0

[//gpu][mac] Support multiple concurrent read access in Graphite

We have discovered that the lack of this support is a source of
significant overhead for Graphite vs. Ganesh on at least one perf
benchmark, as this is supported in Ganesh [2].

This function was added here [2]. It's not obvious to me what the
requirements are for it being able to be supported in a given
representation. This CL enables it for
SkiaGraphiteDawnImageRepresentation for Mac. Local testing shows that
it works unproblematically, including on YouTube and WebGPU's demo
pages.

[1] https://source.chromium.org/chromium/chromium/src/+/main:gpu/command_buffer/service/shared_image/iosurface_image_backing.mm;l=373-375;drc=b58207f5aecc39db7d3da766e7d171e5d2c3598e;bpv=1;bpt=1
[2] https://chromium-review.googlesource.com/c/chromium/src/+/1963098

Change-Id: Ie6c182baf69897dd3f8358883cd83489ff3b573b
Bug: 1523517
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5250233
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1260328}
This commit is contained in:
Colin Blundell
2024-02-14 08:10:59 +00:00
committed by Chromium LUCI CQ
parent a36bba3290
commit 271bb588d4
5 changed files with 18 additions and 0 deletions

@ -753,6 +753,7 @@ class IOSurfaceImageBacking::DawnRepresentation final
wgpu::Texture BeginAccess(wgpu::TextureUsage usage) final;
void EndAccess() final;
bool SupportsMultipleConcurrentReadAccess() final;
private:
static constexpr wgpu::TextureUsage kReadOnlyUsage =
@ -897,6 +898,11 @@ void IOSurfaceImageBacking::DawnRepresentation::EndAccess() {
}
#endif // BUILDFLAG(USE_DAWN)
bool IOSurfaceImageBacking::DawnRepresentation::
SupportsMultipleConcurrentReadAccess() {
return true;
}
///////////////////////////////////////////////////////////////////////////////
// IOSurfaceImageBacking

@ -835,6 +835,10 @@ wgpu::Texture DawnImageRepresentation::BeginAccess(
return this->BeginAccess(usage);
}
bool DawnImageRepresentation::SupportsMultipleConcurrentReadAccess() {
return false;
}
///////////////////////////////////////////////////////////////////////////////
// SharedImageRepresentationFactoryRef

@ -779,6 +779,8 @@ class GPU_GLES2_EXPORT DawnImageRepresentation
AllowUnclearedAccess allow_uncleared,
const gfx::Rect& update_rect);
virtual bool SupportsMultipleConcurrentReadAccess();
private:
friend class WrappedDawnCompoundImageRepresentation;

@ -226,4 +226,9 @@ void SkiaGraphiteDawnImageRepresentation::EndReadAccess() {
mode_ = RepresentationAccessMode::kNone;
}
bool SkiaGraphiteDawnImageRepresentation::
SupportsMultipleConcurrentReadAccess() {
return dawn_representation_->SupportsMultipleConcurrentReadAccess();
}
} // namespace gpu

@ -36,6 +36,7 @@ class GPU_GLES2_EXPORT SkiaGraphiteDawnImageRepresentation
std::vector<skgpu::graphite::BackendTexture> BeginReadAccess() override;
void EndReadAccess() override;
bool SupportsMultipleConcurrentReadAccess() override;
private:
SkiaGraphiteDawnImageRepresentation(