Convert 11tex to 12resource, give it to dawn and dcomp [chromium/src : main]

0 views
Skip to first unread message

Rafael Cintron (Gerrit)

unread,
Aug 15, 2025, 5:00:02 PM8/15/25
to Sahir Vellani, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Sahir Vellani

Rafael Cintron added 11 comments

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 86, Patchset 5 (Latest): d3d11on12_device->ReleaseWrappedResources(nullptr, 0);
Rafael Cintron . unresolved

Since you're passing nullptr to ReleaseWrappedResources, this call is a no-op.

Line 92, Patchset 5 (Latest): ID3D11DeviceContext* device_context;
Rafael Cintron . unresolved

Use a `ComPtr` for `device_context`.

Line 127, Patchset 5 (Latest): Microsoft::WRL::ComPtr<ID3D11Texture2D> d3d11_texture) {
Rafael Cintron . unresolved

`ID3D11Texture2D` inherits from `ID3D11DeviceChild`. `ID3D11DeviceChild` has a `GetDevice` method you can use to get the D3D11 device which created it.

Line 152, Patchset 5 (Latest): d3d11on12_device2->ReturnUnderlyingResource(d3d11_texture.Get(), 1,
&fence_value, &fence_ptr);
Rafael Cintron . unresolved

The D3D12 command queue Dawn uses is the same as Chromium uses, correct? If so, there shouldn't be a need to pass fences here. You might be able to use ReleaseWrappedResource to accomplish the same thing and save yourself from having to pass fences.

Line 1531, Patchset 5 (Latest): d3d12_resource_ =
UnwrapUnderlyingResource(context_state_.get(), d3d11_texture_.Get());
Rafael Cintron . unresolved

This is very counterintuitive. If someone wants to `BeginAccessD3D11`, it means they want to use D3D11, not D3D12. Hence, we shouldn't unwrap to D3D12.

Since `BeginAccessD3D11` is paired with `EndAccessD3D11`, it means we call methods to wait on D3D11 objects while things are unwrapped to D3D12, further comingling things in surprising ways.

As part of your work, we should go back to the callers of `BeginAccessD3D11` and, if they need D3D11 for now, prepare the D3D11 texture and have a plan to move them to D3D12. For callers that support D3D12, we should add `BeginAccessD3D12` and call `UnwrapUnderlyingResource`

Line 1546, Patchset 5 (Latest): ? static_cast<IUnknown*>(d3d12_resource_.Get())
Rafael Cintron . unresolved

When you call `ReturnUnderlyingResource`, the next time you call `UnwrapUnderlyingResource`, you might get back a different D3D12 resource due to potential resource rename operations. Hence, we need to clear out the DComp texture on an unwrap operation ... or detect whether we get the same resource back as an optimization down the road.

Line 1661, Patchset 5 (Latest): Microsoft::WRL::ComPtr<ID3D12Device> d3d12_device;
Rafael Cintron . unresolved

(No longer relevant given my earlier comment about passing nullptr to `CreateFromD3D12Fence`)

`ID3D12Fence` inherits from `ID3D12DeviceChild`. `ID3D12DeviceChild` has a `GetDevice` method you can call to get the D3D12 device.

Line 1666, Patchset 5 (Latest): d3d12_device, std::move(d3d12_fence), fence_value);
Rafael Cintron . unresolved

Since the signaling device is the DComp device, Chromium's device, you need to pass nullptr for the first parameter of `CreateFromD3D12Fence` like we do on in the `CreateFromD3D11Fence` call below.

Line 1698, Patchset 5 (Latest): dcomp_texture_->Release();
Rafael Cintron . unresolved
```suggestion
dcomp_texture_->Reset();
```

Use Reset so that the ptr_ member variable is cleared.

Line 1870, Patchset 5 (Latest): d3d12_resource_->Release();
Rafael Cintron . unresolved
```suggestion
d3d12_resource_->Reset();
```
Use "Reset" so that the underlying `ptr_` inside of the ComPtr is set to nullptr.
File ui/gl/dc_layer_tree.cc
Line 1052, Patchset 5 (Latest): ::CloseHandle(fence_event);
Rafael Cintron . unresolved

This appears to be test code but in the future, use `base::win::ScopedHandle` to prevent memory leaks.

Open in Gerrit

Related details

Attention is currently required from:
  • Sahir Vellani
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 5
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Comment-Date: Fri, 15 Aug 2025 20:59:53 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Sahir Vellani (Gerrit)

unread,
Sep 2, 2025, 1:51:01 PM9/2/25
to AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Rafael Cintron

Sahir Vellani added 19 comments

File gpu/command_buffer/service/dawn_context_provider.cc
Line 469, Patchset 4: d3d12_device.As(&d3d11_device);
Rafael Cintron . resolved

Please "CHECK_EQ(..., S_OK)" the return value of `As`.

Sahir Vellani

Done

File gpu/command_buffer/service/shared_image/d3d_image_backing.h
Line 421, Patchset 4: HANDLE d3d12_event_handle_;
Rafael Cintron . resolved

I know that `d3d12_event_handle_` is temporary and will not be checked in. For future reference, however, please use `base::win::ScopedHandle` to ensure handles do not get leaked.

Sahir Vellani

Acknowledged

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 86, Patchset 5: d3d11on12_device->ReleaseWrappedResources(nullptr, 0);
Rafael Cintron . resolved

Since you're passing nullptr to ReleaseWrappedResources, this call is a no-op.

Sahir Vellani

Acknowledged

Line 92, Patchset 5: ID3D11DeviceContext* device_context;
Rafael Cintron . resolved

Use a `ComPtr` for `device_context`.

Sahir Vellani

Done

Line 112, Patchset 4: }
Rafael Cintron . resolved

Please either early return from GetD3D11Device or use "else if"

Sahir Vellani

Done

Line 127, Patchset 5: Microsoft::WRL::ComPtr<ID3D11Texture2D> d3d11_texture) {
Rafael Cintron . resolved

`ID3D11Texture2D` inherits from `ID3D11DeviceChild`. `ID3D11DeviceChild` has a `GetDevice` method you can use to get the D3D11 device which created it.

Sahir Vellani

Done

Line 128, Patchset 4: IUnknown* comp_texture_resource,
Rafael Cintron . resolved
```suggestion
IUnknown* d3d_resource,
```
Sahir Vellani

Done

Line 152, Patchset 5: d3d11on12_device2->ReturnUnderlyingResource(d3d11_texture.Get(), 1,
&fence_value, &fence_ptr);
Rafael Cintron . resolved

The D3D12 command queue Dawn uses is the same as Chromium uses, correct? If so, there shouldn't be a need to pass fences here. You might be able to use ReleaseWrappedResource to accomplish the same thing and save yourself from having to pass fences.

Sahir Vellani

Acknowledged

Line 561, Patchset 4: GetD3D11Device(context_state->dawn_context_provider()->GetDevice(),
Rafael Cintron . resolved

Why can this call context_state->GetD3D11Device()?

Sahir Vellani

Acknowledged

Line 1464, Patchset 4: if (d3d12_resource_ && base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDCompD3D12)) {
Rafael Cintron . resolved

Instead of checking flags, can we do the work in this if statement based on whether d3d12_resource is nullptr or not?

Sahir Vellani

Done

Line 1531, Patchset 5: d3d12_resource_ =
UnwrapUnderlyingResource(context_state_.get(), d3d11_texture_.Get());
Rafael Cintron . resolved

This is very counterintuitive. If someone wants to `BeginAccessD3D11`, it means they want to use D3D11, not D3D12. Hence, we shouldn't unwrap to D3D12.

Since `BeginAccessD3D11` is paired with `EndAccessD3D11`, it means we call methods to wait on D3D11 objects while things are unwrapped to D3D12, further comingling things in surprising ways.

As part of your work, we should go back to the callers of `BeginAccessD3D11` and, if they need D3D11 for now, prepare the D3D11 texture and have a plan to move them to D3D12. For callers that support D3D12, we should add `BeginAccessD3D12` and call `UnwrapUnderlyingResource`

Sahir Vellani

Done

Line 1546, Patchset 5: ? static_cast<IUnknown*>(d3d12_resource_.Get())
Rafael Cintron . resolved

When you call `ReturnUnderlyingResource`, the next time you call `UnwrapUnderlyingResource`, you might get back a different D3D12 resource due to potential resource rename operations. Hence, we need to clear out the DComp texture on an unwrap operation ... or detect whether we get the same resource back as an optimization down the road.

Sahir Vellani

Done

Line 1661, Patchset 5: Microsoft::WRL::ComPtr<ID3D12Device> d3d12_device;
Rafael Cintron . resolved

(No longer relevant given my earlier comment about passing nullptr to `CreateFromD3D12Fence`)

`ID3D12Fence` inherits from `ID3D12DeviceChild`. `ID3D12DeviceChild` has a `GetDevice` method you can call to get the D3D12 device.

Sahir Vellani

Acknowledged

Line 1666, Patchset 5: d3d12_device, std::move(d3d12_fence), fence_value);
Rafael Cintron . resolved

Since the signaling device is the DComp device, Chromium's device, you need to pass nullptr for the first parameter of `CreateFromD3D12Fence` like we do on in the `CreateFromD3D11Fence` call below.

Sahir Vellani

Acknowledged

Line 1698, Patchset 5: dcomp_texture_->Release();
Rafael Cintron . resolved
```suggestion
dcomp_texture_->Reset();
```

Use Reset so that the ptr_ member variable is cleared.

Sahir Vellani

Done

Line 1870, Patchset 5: d3d12_resource_->Release();
Rafael Cintron . resolved
```suggestion
d3d12_resource_->Reset();
```
Use "Reset" so that the underlying `ptr_` inside of the ComPtr is set to nullptr.
Sahir Vellani

Done

File gpu/command_buffer/service/shared_image/d3d_image_backing_factory.cc
Line 36, Patchset 4: ID3D11Texture2D* d3d11_texture) {
Rafael Cintron . resolved

ID3D11Texture2D objects have a GetDevice method they inherit from their base class. You should be able to QI that for the 11on12 device to then call UnwrapUnderlyingResource.

Sahir Vellani

Acknowledged

File ui/gl/dc_layer_tree.cc
Line 1052, Patchset 5: ::CloseHandle(fence_event);
Rafael Cintron . resolved

This appears to be test code but in the future, use `base::win::ScopedHandle` to prevent memory leaks.

Sahir Vellani

Done

File ui/gl/direct_composition_support.cc
Line 1192, Patchset 4 (Parent): if (SUCCEEDED(d3d11_device.As(&d3d11on12_device))) {
Rafael Cintron . resolved

Since we need ID3D11on12Device2, here is a good place to QI for that interface and return false if the QI fails.

Same goes for `D3DImageBackingFactory::IsD3DSharedImageSupported`.

Sahir Vellani

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Rafael Cintron
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 7
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Tue, 02 Sep 2025 17:50:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Rafael Cintron (Gerrit)

unread,
Sep 4, 2025, 10:36:10 AM9/4/25
to Sahir Vellani, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Sahir Vellani

Rafael Cintron added 14 comments

Patchset-level comments
File-level comment, Patchset 10 (Latest):
Rafael Cintron . resolved

Need to continue reviewing the L but here is what I have so far.

File cc/trees/layer_tree_host_impl.cc
Line 5538, Patchset 10 (Latest): "LayerTreeHostUIResourceSoftware"});
Rafael Cintron . unresolved

The improvements to the existing labels should be upstreamed as a separate CL.

File gpu/command_buffer/service/dawn_context_provider.cc
Line 471, Patchset 10 (Latest): switches::kDCompD3D12)) {
Rafael Cintron . unresolved

To aid in running experiments, please make this be its own feature flag or add it as a parameter of the existing SkiaGraphite feature flag.

Line 475, Patchset 10 (Latest): dawn::native::d3d12::GetD3D11On12Device(device_.Get());
Rafael Cintron . unresolved

ID3D11On12Device1 does not exist on all versions of Windows that Chromium supports. We need to limit our support of the feature to only those where the QI for ID3D11On12Device1 returns S_OK. For all others, we need to gracefully fallback to single swap chain like we have today.

File gpu/command_buffer/service/shared_image/d3d_image_backing.h
Line 20, Patchset 10 (Latest):#include "base/containers/span.h"
Rafael Cintron . unresolved

Unless I am missing something, we shouldn't need this include of span in `d3d_image_backing.h`

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 101, Patchset 10 (Latest): hr = d3d12_device->CreateCommandQueue(&command_queue_desc,
Rafael Cintron . unresolved

Creating a command queue every time we call PrepareTextureForD3D12 will be costly. Please cache the queue in the context.

Line 699, Patchset 10 (Latest): texture_d3d11_device_ = GetD3D11Device(
Rafael Cintron . unresolved

The device to use should come from the passed in texture not from a global place.

Line 992, Patchset 10 (Latest): d3d12_event_handle_ = CreateEventHandle();
Rafael Cintron . unresolved

I opened a previous issue about needing to get rid of this event handle. Please do so.

If you need it for prototyping purposes while you make progress, please manage its lifetime a bit better. I see multiple places where the handle is unconditionally assigned to and never cleaned up, thus leaking the handle and bloating the process handle table.

Line 1817, Patchset 10 (Latest): hr = d3d12_fence->SetEventOnCompletion(fence_value, d3d12_event_handle_);
CHECK_EQ(hr, S_OK);
::WaitForSingleObject(d3d12_event_handle_, 10000);
Rafael Cintron . unresolved

Can you please see what it would take to remove this hack? We should be able to go down the same path for fences that we do for D3D11.

Line 2101, Patchset 10 (Latest): dcomp_texture_.Reset();
Rafael Cintron . unresolved

Creating and destroying DComp textures repeatedly is a known source of performance regressions. Please find a way to only release/re-create it when the underlying DirectX resource actually needs to be changed.

File gpu/command_buffer/service/shared_image/d3d_image_representation.cc
Line 334, Patchset 10 (Latest): if (!d3d_image_backing->BeginAccessD3D(d3d11_device_,
Rafael Cintron . unresolved

Why does D3D12VideoImageRepresentation need to exist? Is this for the case where we use D3D12 to do video? Or where Video is on a separate D3D11 device from the rest of Chromium? The answers to these questions will guide whether this class should call BeginAccessD3D11 or BeginAccessD3D12.

File ui/gl/dc_layer_tree.cc
Line 1036, Patchset 10 (Latest): Microsoft::WRL::ComPtr<EXPERIMENTAL_IDCompositionDevice6> dcomp_device6;
HRESULT hr = dc_layer_tree_->dcomp_device_.As(&dcomp_device6);
Rafael Cintron . unresolved

Please have `DCLayerTree` store the `IDCompositionDevice6` as a member variable and set it in its Initialize method if the QI succeeds. No need to check the command line switch in `DClayerTree.`

File ui/gl/dcomp_presenter.cc
Line 7, Patchset 10 (Latest):#include <dawn/native/D3D12Backend.h>
Rafael Cintron . unresolved

Does `dcomp_presenter.cc` still need to `include dawn/native/D3D12Backend.h`?

File ui/gl/direct_composition_support.cc
Line 1145, Patchset 10 (Latest): // if (g_direct_composition_texture_supported.has_value()) {
// return g_direct_composition_texture_supported.value();
// }
Rafael Cintron . unresolved

Placeholder issue to uncomment this code and implement `DirectCompositionTextureSupported` correctly.

Open in Gerrit

Related details

Attention is currently required from:
  • Sahir Vellani
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 10
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Comment-Date: Thu, 04 Sep 2025 14:36:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Rafael Cintron (Gerrit)

unread,
Sep 4, 2025, 6:30:50 PM9/4/25
to Sahir Vellani, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Sahir Vellani

Rafael Cintron added 3 comments

File gpu/command_buffer/service/shared_image/d3d_image_backing.h
Line 442, Patchset 10 (Latest): SkAlphaType alpha_type_;
Rafael Cintron . unresolved
```suggestion
const SkAlphaType alpha_type_;
```
Line 439, Patchset 10 (Latest): bool want_dcomp_texture_;
Rafael Cintron . unresolved
```suggestion
const bool want_dcomp_texture_;
```
File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 680, Patchset 10 (Latest): context_state_(std::move(context_state)),
Rafael Cintron . unresolved

What would it take to avoid passing context state to `D3DImageBacking` and, instead, determine what to do based on whether the device of `d3d11_texture` is an 11on12 device?

Open in Gerrit

Related details

Attention is currently required from:
  • Sahir Vellani
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 10
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Comment-Date: Thu, 04 Sep 2025 22:30:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Michael Tang (Gerrit)

unread,
Sep 5, 2025, 5:41:47 PM9/5/25
to Sahir Vellani, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Sahir Vellani

Michael Tang added 16 comments

Patchset-level comments
Michael Tang . resolved

I've left some comments, as with Rafael, I will continue to review this. Apologies for any dupe comments w/ rafael.

Please split out unrelated changes (logging, etc) to make this easier to review!

File components/viz/service/display_embedder/skia_output_device_dcomp.cc
Line 63, Patchset 9: if (Microsoft::WRL::ComPtr<PREVIEW_IDCompositionDevice5> dcomp_device5;
SUCCEEDED(dcomp_device.As(&dcomp_device5))) {
return OutputSurface::DCSupportLevel::kDCompDynamicTexture;
}
Michael Tang . unresolved
```suggestion
if (Microsoft::WRL::ComPtr<PREVIEW_IDCompositionDevice6> dcomp_device6;
SUCCEEDED(dcomp_device.As(&dcomp_device6))) {
return OutputSurface::DCSupportLevel::kDCompTextureD3D12;
}
    if (Microsoft::WRL::ComPtr<PREVIEW_IDCompositionDevice5> dcomp_device5;
SUCCEEDED(dcomp_device.As(&dcomp_device5))) {
return OutputSurface::DCSupportLevel::kDCompDynamicTexture;
}
```

When you clean up this CL, this will be useful to gate your feature on API support. This can possibly replace `kDCompD3D12`.

Line 203, Patchset 4: presenter_->SetCommandQueue(std::move(command_queue));
Michael Tang . unresolved

In practice, can the command queue change frame to frame? It not, we should initialize `DCLayerTree` with the command queue instead of passing it down every frame.

File gpu/command_buffer/service/shared_image/d3d_image_backing.h
Line 466, Patchset 10 (Latest): // Used to track D3D12 fence completion. Only a bandaid solution to get the
// prototype working.
Michael Tang . unresolved

What is the intended solution?

Line 441, Patchset 10 (Latest): const gfx::ColorSpace color_space_;
SkAlphaType alpha_type_;
Line 439, Patchset 10 (Latest): bool want_dcomp_texture_;
Michael Tang . unresolved
```suggestion
const bool want_dcomp_texture_;
```
Line 303, Patchset 10 (Latest): return dcomp_texture_ || (dxgi_shared_handle_state_ &&
Michael Tang . unresolved

Is this only needed for dx12 comp textures?

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 244, Patchset 9: LOG(INFO) << "GLTextureHolder::GLTextureHolder";
Michael Tang . unresolved

If these logs are useful for posterity, we can do something like to check it in.

```suggestion
DVLOG(3) << "GLTextureHolder::GLTextureHolder"; // or __func__ << " " << this;
```
Line 679, Patchset 9: context_state_(std::move(context_state)),
Michael Tang . unresolved

Can we extract the D3D11 device and simply bail (e.g. `want_dcomp_texture = false`) if the backend type is not correct?

I recall being told that we want to avoid passing the `SharedContextState` around, preferring to extract the specific stuff we need from it (since it's kind of an "everything" object that adds unnessecary dependencies).

Line 699, Patchset 10 (Latest): texture_d3d11_device_ = GetD3D11Device(
Rafael Cintron . unresolved

The device to use should come from the passed in texture not from a global place.

Michael Tang

Is this not already set a couple lines up?

Line 1190, Patchset 10 (Latest): if (context_state_->dawn_context_provider()->backend_type() ==
Michael Tang . unresolved

Do you know why `ProduceDawn` is provided with a `backend_type` instead of reading it off the `shared_context_state_` like you are here? I wonder if `ProduceVideo` isn't supposed to know about this detail-- if not, is there another signal for us to branch on here?

Line 2101, Patchset 10 (Latest): dcomp_texture_.Reset();
Rafael Cintron . unresolved

Creating and destroying DComp textures repeatedly is a known source of performance regressions. Please find a way to only release/re-create it when the underlying DirectX resource actually needs to be changed.

Michael Tang

I believe the dcomp texture also needs to stay alive

File gpu/command_buffer/service/shared_image/d3d_image_representation.cc
Line 320, Patchset 10 (Latest):D3D12VideoImageRepresentation::D3D12VideoImageRepresentation(
Michael Tang . unresolved

This seems to be pretty similar to `D3D11VideoImageRepresentation`, should the latter just be renamed to `D3DVideoImageRepresentation`?

File gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc
Line 55, Patchset 10 (Parent): case wgpu::BackendType::D3D12:
Michael Tang . unresolved

Will this still be needed when we don't support dcomp textures, but want d3d12?

File ui/gl/dcomp_presenter.h
Line 145, Patchset 10 (Latest): Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue_;
Michael Tang . unresolved

if we can initialize DCompPresenter with the command queue, then we can just have this field live on DCLayerTree.

File ui/gl/direct_composition_support.cc
Line 1196, Patchset 10 (Latest): if (FAILED(d3d11_device.As(&d3d11on12_device))) {
Michael Tang . unresolved

This needs to be something like "if SUCCEEDED(qi to 11on12) AND we do not support dx12 comp textures"

Open in Gerrit

Related details

Attention is currently required from:
  • Sahir Vellani
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 10
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-CC: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Comment-Date: Fri, 05 Sep 2025 21:41:38 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Sahir Vellani (Gerrit)

unread,
Sep 5, 2025, 6:08:52 PM9/5/25
to Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Michael Tang and Rafael Cintron

Sahir Vellani added 13 comments

File gpu/command_buffer/service/dawn_context_provider.cc
Line 471, Patchset 10: switches::kDCompD3D12)) {
Rafael Cintron . resolved

To aid in running experiments, please make this be its own feature flag or add it as a parameter of the existing SkiaGraphite feature flag.

Sahir Vellani

Done

File gpu/command_buffer/service/shared_image/d3d_image_backing.h
Line 442, Patchset 10: SkAlphaType alpha_type_;
Rafael Cintron . resolved
```suggestion
const SkAlphaType alpha_type_;
```
Sahir Vellani

Done

Line 439, Patchset 10: bool want_dcomp_texture_;
Rafael Cintron . resolved
```suggestion
const bool want_dcomp_texture_;
```
Sahir Vellani

Done

Line 20, Patchset 10:#include "base/containers/span.h"
Rafael Cintron . resolved

Unless I am missing something, we shouldn't need this include of span in `d3d_image_backing.h`

Sahir Vellani

Relic of some experimentation.

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 101, Patchset 10: hr = d3d12_device->CreateCommandQueue(&command_queue_desc,
Rafael Cintron . resolved

Creating a command queue every time we call PrepareTextureForD3D12 will be costly. Please cache the queue in the context.

Sahir Vellani

Done

Line 699, Patchset 10: texture_d3d11_device_ = GetD3D11Device(
Rafael Cintron . resolved

The device to use should come from the passed in texture not from a global place.

Sahir Vellani

Done

Line 992, Patchset 10: d3d12_event_handle_ = CreateEventHandle();
Rafael Cintron . resolved

I opened a previous issue about needing to get rid of this event handle. Please do so.

If you need it for prototyping purposes while you make progress, please manage its lifetime a bit better. I see multiple places where the handle is unconditionally assigned to and never cleaned up, thus leaking the handle and bloating the process handle table.

Sahir Vellani

Done

Line 1817, Patchset 10: hr = d3d12_fence->SetEventOnCompletion(fence_value, d3d12_event_handle_);
CHECK_EQ(hr, S_OK);
::WaitForSingleObject(d3d12_event_handle_, 10000);
Rafael Cintron . resolved

Can you please see what it would take to remove this hack? We should be able to go down the same path for fences that we do for D3D11.

Sahir Vellani

Done

Line 2101, Patchset 10: dcomp_texture_.Reset();
Rafael Cintron . resolved

Creating and destroying DComp textures repeatedly is a known source of performance regressions. Please find a way to only release/re-create it when the underlying DirectX resource actually needs to be changed.

Sahir Vellani

Done

File gpu/command_buffer/service/shared_image/d3d_image_representation.cc
Line 334, Patchset 10: if (!d3d_image_backing->BeginAccessD3D(d3d11_device_,
Rafael Cintron . resolved

Why does D3D12VideoImageRepresentation need to exist? Is this for the case where we use D3D12 to do video? Or where Video is on a separate D3D11 device from the rest of Chromium? The answers to these questions will guide whether this class should call BeginAccessD3D11 or BeginAccessD3D12.

Sahir Vellani

Oversight on my part. We don't need both image representations, whether we use 11 or 12 can be an implementation detail of BeginAccessD3D. Actually, we don't really need the D3D11VideoImageRepresentation at all when the backend type is D3D12. The D3D11 texture is currently used in situations that allow for it to be unwrapped.

File ui/gl/dc_layer_tree.cc
Line 1036, Patchset 10: Microsoft::WRL::ComPtr<EXPERIMENTAL_IDCompositionDevice6> dcomp_device6;

HRESULT hr = dc_layer_tree_->dcomp_device_.As(&dcomp_device6);
Rafael Cintron . resolved

Please have `DCLayerTree` store the `IDCompositionDevice6` as a member variable and set it in its Initialize method if the QI succeeds. No need to check the command line switch in `DClayerTree.`

Sahir Vellani

Done

File ui/gl/dcomp_presenter.cc
Line 7, Patchset 10:#include <dawn/native/D3D12Backend.h>
Rafael Cintron . resolved

Does `dcomp_presenter.cc` still need to `include dawn/native/D3D12Backend.h`?

Sahir Vellani

Done

Line 106, Patchset 4:void DCompPresenter::SetCommandQueue(
Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue) {
command_queue_ = std::move(command_queue);
}
Rafael Cintron . resolved

Instead of adhoc ways of passing objects around, let's have the presenter get the command queue at construction time so that it is available.

When gpu_init.cc calls gl::InitializeDirectComposition, it should pass it the command queue to use for presentation.

Sahir Vellani

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Tang
  • Rafael Cintron
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 11
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-CC: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Fri, 05 Sep 2025 22:08:41 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Sahir Vellani (Gerrit)

unread,
Sep 8, 2025, 7:32:43 PM9/8/25
to Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Michael Tang and Rafael Cintron

Sahir Vellani added 12 comments

File gpu/command_buffer/service/shared_image/d3d_image_backing.h
Line 466, Patchset 10: // Used to track D3D12 fence completion. Only a bandaid solution to get the
// prototype working.
Michael Tang . resolved

What is the intended solution?

Sahir Vellani

Add the d3d12 fence to read/write fence sets and let the currently existing logic do its thing. Would've just been harder to debug that way.

Line 441, Patchset 10: const gfx::ColorSpace color_space_;
SkAlphaType alpha_type_;
Michael Tang . resolved
Sahir Vellani

I missed that, thanks.

Line 439, Patchset 10: bool want_dcomp_texture_;
Michael Tang . resolved
```suggestion
const bool want_dcomp_texture_;
```
Sahir Vellani

Done

Line 303, Patchset 10: return dcomp_texture_ || (dxgi_shared_handle_state_ &&
Michael Tang . unresolved

Is this only needed for dx12 comp textures?

Sahir Vellani

Yes

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 244, Patchset 9: LOG(INFO) << "GLTextureHolder::GLTextureHolder";
Michael Tang . resolved

If these logs are useful for posterity, we can do something like to check it in.

```suggestion
DVLOG(3) << "GLTextureHolder::GLTextureHolder"; // or __func__ << " " << this;
```
Sahir Vellani

Good idea, acknowledged.

Line 679, Patchset 9: context_state_(std::move(context_state)),
Michael Tang . resolved

Can we extract the D3D11 device and simply bail (e.g. `want_dcomp_texture = false`) if the backend type is not correct?

I recall being told that we want to avoid passing the `SharedContextState` around, preferring to extract the specific stuff we need from it (since it's kind of an "everything" object that adds unnessecary dependencies).

Sahir Vellani

Removed context_state_.

Line 680, Patchset 10: context_state_(std::move(context_state)),
Rafael Cintron . resolved

What would it take to avoid passing context state to `D3DImageBacking` and, instead, determine what to do based on whether the device of `d3d11_texture` is an 11on12 device?

Sahir Vellani

Not much, apparently.

Line 1190, Patchset 10: if (context_state_->dawn_context_provider()->backend_type() ==
Michael Tang . resolved

Do you know why `ProduceDawn` is provided with a `backend_type` instead of reading it off the `shared_context_state_` like you are here? I wonder if `ProduceVideo` isn't supposed to know about this detail-- if not, is there another signal for us to branch on here?

Sahir Vellani

Acknowledged

File gpu/command_buffer/service/shared_image/d3d_image_representation.cc
Line 320, Patchset 10:D3D12VideoImageRepresentation::D3D12VideoImageRepresentation(
Michael Tang . resolved

This seems to be pretty similar to `D3D11VideoImageRepresentation`, should the latter just be renamed to `D3DVideoImageRepresentation`?

Sahir Vellani

Done

File gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc
Line 55, Patchset 10 (Parent): case wgpu::BackendType::D3D12:
Michael Tang . resolved

Will this still be needed when we don't support dcomp textures, but want d3d12?

Sahir Vellani

Yes, nice catch.

File ui/gl/dcomp_presenter.h
Line 145, Patchset 10: Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue_;
Michael Tang . resolved

if we can initialize DCompPresenter with the command queue, then we can just have this field live on DCLayerTree.

Sahir Vellani

Done

File ui/gl/direct_composition_support.cc
Line 1196, Patchset 10: if (FAILED(d3d11_device.As(&d3d11on12_device))) {
Michael Tang . resolved

This needs to be something like "if SUCCEEDED(qi to 11on12) AND we do not support dx12 comp textures"

Sahir Vellani

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Tang
  • Rafael Cintron
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 13
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-CC: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Mon, 08 Sep 2025 23:32:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Michael Tang <ta...@microsoft.com>
Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Sahir Vellani (Gerrit)

unread,
Sep 9, 2025, 2:31:23 PM9/9/25
to Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Michael Tang and Rafael Cintron

Sahir Vellani added 2 comments

File cc/trees/layer_tree_host_impl.cc
Line 5538, Patchset 10: "LayerTreeHostUIResourceSoftware"});
Rafael Cintron . resolved

The improvements to the existing labels should be upstreamed as a separate CL.

Sahir Vellani

Acknowledged

File components/viz/service/display_embedder/skia_output_device_dcomp.cc
Line 203, Patchset 4: presenter_->SetCommandQueue(std::move(command_queue));
Michael Tang . resolved

In practice, can the command queue change frame to frame? It not, we should initialize `DCLayerTree` with the command queue instead of passing it down every frame.

Sahir Vellani

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Tang
  • Rafael Cintron
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 14
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-CC: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Tue, 09 Sep 2025 18:31:12 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Sahir Vellani (Gerrit)

unread,
Sep 9, 2025, 3:28:53 PM9/9/25
to Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Michael Tang and Rafael Cintron

Sahir Vellani added 2 comments

File gpu/command_buffer/service/dawn_context_provider.cc
Line 475, Patchset 10: dawn::native::d3d12::GetD3D11On12Device(device_.Get());
Rafael Cintron . resolved

ID3D11On12Device1 does not exist on all versions of Windows that Chromium supports. We need to limit our support of the feature to only those where the QI for ID3D11On12Device1 returns S_OK. For all others, we need to gracefully fallback to single swap chain like we have today.

Sahir Vellani

Done

File ui/gl/direct_composition_support.cc
Line 1145, Patchset 10: // if (g_direct_composition_texture_supported.has_value()) {
// return g_direct_composition_texture_supported.value();
// }
Rafael Cintron . resolved

Placeholder issue to uncomment this code and implement `DirectCompositionTextureSupported` correctly.

Sahir Vellani

Done

Gerrit-Comment-Date: Tue, 09 Sep 2025 19:28:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Rafael Cintron (Gerrit)

unread,
Sep 9, 2025, 10:23:48 PM9/9/25
to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Michael Tang and Sahir Vellani

Rafael Cintron added 14 comments

Patchset-level comments
File-level comment, Patchset 15:
Rafael Cintron . resolved

Have not finished with current review but posting what I have so far.

File gpu/command_buffer/service/shared_image/d3d_image_backing.h
Line 461, Patchset 15: bool is_texture_unwrapped_ GUARDED_BY(lock_) = false;
Rafael Cintron . unresolved

Please add a comment to `is_texture_unwrapped_` like the other members in this class have.

Line 439, Patchset 15: const bool want_dcomp_texture_;
Rafael Cintron . unresolved

Please add a comment to `want_dcomp_texture_` like the other members in this class have.

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 79, Patchset 15: LOG(ERROR) << "D3D12 command queue is null";
Rafael Cintron . unresolved

Will the caller ever pass a nullptr command queue. If not, we should just dereference it unconditionally like we already do with `d3d11_texture`.

Line 93, Patchset 15: d3d11on12_device->ReleaseWrappedResources(&d3d11_texture, 1);
Rafael Cintron . unresolved

Might be better to encapsulate this logcin by having the BeginAccessD3D12 and EndAccessD3D12 methods be more explicit about releasing the wrapped resource or unwrapping it based on which one is called. With your current approach, I think you're calling ReleaseWrappedResource when you don't need to.

Did you test the case where media is on a separate device than Chromium?

Line 2286, Patchset 15:D3DImageBacking::GetCommandQueueFor11On12() {
Rafael Cintron . unresolved

Please write a detailed commend why this "11on12" command queue exists.

Line 2286, Patchset 15:D3DImageBacking::GetCommandQueueFor11On12() {
Rafael Cintron . unresolved

```suggestion
D3DImageBacking::GetOrCreateCommandQueueFor11On12() {
```

Line 2287, Patchset 15: if (d3d12_command_queue_) {
Rafael Cintron . unresolved

Please disambiguate the member variable. When I first read the code, I thought this was the command queue where actual work was being being submitted. We should call it (and the accessor) something like "d3d12_none_command_queue."

File ui/gl/dc_layer_tree.h
Line 592, Patchset 15: Microsoft::WRL::ComPtr<EXPERIMENTAL_IDCompositionDevice6> dcomp_device_6_;

Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue_;
Rafael Cintron . unresolved

Please add a comment for these members like the other ones in this class have.

File ui/gl/dc_layer_tree.cc
Line 342, Patchset 15: dcomp_device_6_ = std::move(dcomp_device6);
Rafael Cintron . unresolved

Later in the file, we check for `dcomp_device_6_` and unconditionally dereference `command_queue_` when we call `PresentCompositionTextures`.

If we're running on a machine with `IDCompositionDevice6` but D3D12 mode is disabled or the machine has no D3D12 drivers, you'll get a crash in `BuildTree`.

We should fix this by first calling `GetDirectCompositionD3D12CommandQueue`. If it returns a non-nullptr queue, only then do we set `dcomp_device_6_`. This way both variables are either nullptr or non-nullptr.

File ui/gl/direct_composition_support.h
Line 59, Patchset 15:// Retrieves the global d3d12 command queue used by direct composition.
Rafael Cintron . unresolved

```suggestion
// Retrieves the global d3d12 command queue created by Dawn used by SharedImage code to queue work when it runs in D3D12 mode.
```

File ui/gl/direct_composition_support.cc
Line 150, Patchset 15:// Global d3d12 command queue used by direct composition.
Rafael Cintron . unresolved

```suggestion
// Global d3d12 command queue created by Dawn used by SharedImage code to queue work when it runs in D3D12 mode.
```

Line 766, Patchset 15: if (d3d12_command_queue) {
Rafael Cintron . unresolved

If check of d3d12_command_queue is unnecessary.

File ui/gl/presenter.h
Line 35, Patchset 15:#include <d3d12.h>
#include <wrl/client.h>
Rafael Cintron . unresolved

Are these header files needed in presenter.h?

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Tang
  • Sahir Vellani
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 15
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
Gerrit-CC: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Comment-Date: Wed, 10 Sep 2025 02:23:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Sahir Vellani (Gerrit)

unread,
Sep 10, 2025, 2:23:24 PM9/10/25
to Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Michael Tang and Rafael Cintron

Sahir Vellani added 13 comments

File gpu/command_buffer/service/shared_image/d3d_image_backing.h
Line 461, Patchset 15: bool is_texture_unwrapped_ GUARDED_BY(lock_) = false;
Rafael Cintron . resolved

Please add a comment to `is_texture_unwrapped_` like the other members in this class have.

Sahir Vellani

Done

Line 439, Patchset 15: const bool want_dcomp_texture_;
Rafael Cintron . resolved

Please add a comment to `want_dcomp_texture_` like the other members in this class have.

Sahir Vellani

Done

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 79, Patchset 15: LOG(ERROR) << "D3D12 command queue is null";
Rafael Cintron . resolved

Will the caller ever pass a nullptr command queue. If not, we should just dereference it unconditionally like we already do with `d3d11_texture`.

Sahir Vellani

Yes a null command queue can be passed in.

Line 93, Patchset 15: d3d11on12_device->ReleaseWrappedResources(&d3d11_texture, 1);
Rafael Cintron . unresolved

Might be better to encapsulate this logcin by having the BeginAccessD3D12 and EndAccessD3D12 methods be more explicit about releasing the wrapped resource or unwrapping it based on which one is called. With your current approach, I think you're calling ReleaseWrappedResource when you don't need to.

Did you test the case where media is on a separate device than Chromium?

Sahir Vellani

I think you're right that I'm releasing when I don't have to. We check whether the texture is unwrapped prior to unwrapping anyway.

Line 2286, Patchset 15:D3DImageBacking::GetCommandQueueFor11On12() {
Rafael Cintron . resolved

```suggestion
D3DImageBacking::GetOrCreateCommandQueueFor11On12() {
```

Sahir Vellani

Done

Line 2286, Patchset 15:D3DImageBacking::GetCommandQueueFor11On12() {
Rafael Cintron . resolved

Please write a detailed commend why this "11on12" command queue exists.

Sahir Vellani

Done

Line 2287, Patchset 15: if (d3d12_command_queue_) {
Rafael Cintron . resolved

Please disambiguate the member variable. When I first read the code, I thought this was the command queue where actual work was being being submitted. We should call it (and the accessor) something like "d3d12_none_command_queue."

Sahir Vellani

Done

File ui/gl/dc_layer_tree.h
Line 592, Patchset 15: Microsoft::WRL::ComPtr<EXPERIMENTAL_IDCompositionDevice6> dcomp_device_6_;
Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue_;
Rafael Cintron . resolved

Please add a comment for these members like the other ones in this class have.

Sahir Vellani

Done

File ui/gl/dc_layer_tree.cc
Line 342, Patchset 15: dcomp_device_6_ = std::move(dcomp_device6);
Rafael Cintron . resolved

Later in the file, we check for `dcomp_device_6_` and unconditionally dereference `command_queue_` when we call `PresentCompositionTextures`.

If we're running on a machine with `IDCompositionDevice6` but D3D12 mode is disabled or the machine has no D3D12 drivers, you'll get a crash in `BuildTree`.

We should fix this by first calling `GetDirectCompositionD3D12CommandQueue`. If it returns a non-nullptr queue, only then do we set `dcomp_device_6_`. This way both variables are either nullptr or non-nullptr.

Sahir Vellani

Done

File ui/gl/direct_composition_support.h
Line 59, Patchset 15:// Retrieves the global d3d12 command queue used by direct composition.
Rafael Cintron . resolved

```suggestion
// Retrieves the global d3d12 command queue created by Dawn used by SharedImage code to queue work when it runs in D3D12 mode.
```

Sahir Vellani

Done

File ui/gl/direct_composition_support.cc
Line 150, Patchset 15:// Global d3d12 command queue used by direct composition.
Rafael Cintron . resolved

```suggestion
// Global d3d12 command queue created by Dawn used by SharedImage code to queue work when it runs in D3D12 mode.
```

Sahir Vellani

Done

Line 766, Patchset 15: if (d3d12_command_queue) {
Rafael Cintron . resolved

If check of d3d12_command_queue is unnecessary.

Sahir Vellani

Done

File ui/gl/presenter.h
Line 35, Patchset 15:#include <d3d12.h>
#include <wrl/client.h>
Rafael Cintron . resolved

Are these header files needed in presenter.h?

Sahir Vellani

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Tang
  • Rafael Cintron
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 17
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
Gerrit-CC: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Wed, 10 Sep 2025 18:23:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Sahir Vellani (Gerrit)

unread,
Oct 1, 2025, 6:52:48 PM10/1/25
to Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Michael Tang and Rafael Cintron

Sahir Vellani added 1 comment

Patchset-level comments
Open in Gerrit

Related details

Attention is currently required from:
  • Michael Tang
  • Rafael Cintron
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 22
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
Gerrit-CC: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Attention: Michael Tang <ta...@microsoft.com>
Gerrit-Comment-Date: Wed, 01 Oct 2025 22:52:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Rafael Cintron (Gerrit)

unread,
Oct 1, 2025, 9:58:36 PM10/1/25
to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Michael Tang and Sahir Vellani

Rafael Cintron added 16 comments

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 73, Patchset 22 (Latest): return SUCCEEDED(hr) && !(d3d11_texture_desc.MiscFlags &
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX);
Rafael Cintron . unresolved

Nit: Please provide a comment why keyed mutexes are excluded.

Line 79, Patchset 22 (Latest): Microsoft::WRL::ComPtr<ID3D11Resource> d3d11_texture,
Microsoft::WRL::ComPtr<ID3D12CommandQueue> d3d12_command_queue) {
Rafael Cintron . unresolved

Since PrepareTextureForD3D12 does not take ownership of its parameters, please pass these by bald pointer.

Line 85, Patchset 22 (Latest): Microsoft::WRL::ComPtr<ID3D12Resource> d3d12_resource;
Rafael Cintron . unresolved

Nit: Please declare d3d12_resource closer to where it is used.

Line 90, Patchset 22 (Latest): if (FAILED(hr)) {
LOG(ERROR) << "Failed to get D3D11On12Device2: "
<< logging::SystemErrorCodeToString(hr);
return nullptr;
}
Rafael Cintron . unresolved

Per earlier checks, this QI for ID3D11On12Device2 should always succeed.

Line 107, Patchset 22 (Latest): // Flushing operations.
Rafael Cintron . unresolved

Nit: Please replace this "flushing operations" comment with a comment that describes why we need to flush. Include a link to the MSDN page that talks about why: https://learn.microsoft.com/en-us/windows/win32/api/d3d11on12/nf-d3d11on12-id3d11on12device2-unwrapunderlyingresource

Line 118, Patchset 22 (Latest):void PrepareTextureForD3D11(
Rafael Cintron . unresolved

Since PrepareTextureForD3D11 does not take ownership of its parameters, please pass these by bald pointer.

Line 948, Patchset 22 (Latest): if (!dcomp_texture_) {
dcomp_texture_ =
want_dcomp_texture_ && (d3d11_texture_ || d3d12_resource_)
? CreateDCompTexture(
d3d12_resource_
? static_cast<IUnknown*>(d3d12_resource_.Get())
: static_cast<IUnknown*>(d3d11_texture_.Get()),
alpha_type(), color_space())
: nullptr;
}
Rafael Cintron . unresolved

Why does "ProduceDawn" need to create DComp textures?

Line 1554, Patchset 22 (Latest): ? CreateDCompTexture(static_cast<IUnknown*>(d3d11_texture_.Get()),
Rafael Cintron . unresolved

D3D11 textures inherit from IUnknown. Unless I am missing something, this static cast should not be necessary.

Line 1600, Patchset 22 (Latest): is_texture_unwrapped_
Rafael Cintron . unresolved

If `BeginAccessD3D12` sets `is_texture_unwrapped` to true below and `EndAccessD3D12` always sets it to false, when will it be true here on line 1600?

Line 1604, Patchset 22 (Latest): if (d3d12_resource && d3d12_resource != d3d12_resource_) {
Rafael Cintron . unresolved

If `EndAccessCommon` always clears out `d3d12_resource_`, why are we assuming it is non-nullptr here? Is the `EndAccessCommon` code which clears the D3D resource not necessary?

Line 1604, Patchset 22 (Latest): if (d3d12_resource && d3d12_resource != d3d12_resource_) {
Rafael Cintron . unresolved

If `d3d12_resource` is nullptr, we should clear out `d3d12_resource_` and return false.

Line 1606, Patchset 22 (Latest): d3d12_resource_ = d3d12_resource;
Rafael Cintron . unresolved
```suggestion
d3d12_resource_ = std::move(d3d12_resource);
```
Line 1616, Patchset 22 (Latest): ? CreateDCompTexture(static_cast<IUnknown*>(d3d12_resource_.Get()),
Rafael Cintron . unresolved

Similarly here, D3D12 resources derive from IUnknown so this cast shouldn't be necessary.

Line 1655, Patchset 22 (Latest): d3d11_signal_fence = gfx::D3DSharedFence::CreateForD3D11(d3d11_device);
Rafael Cintron . unresolved

Why can't we rely on existing code in GetPendingWaitFences to add signaled fences to `d3d11_signaled_fence_map_` when needed? Is there a bug in GetPendingWaitFences?

Line 2253, Patchset 22 (Latest): if (FAILED(hr)) {
LOG(ERROR) << "Failed to get D3D11On12Device2: "
<< logging::SystemErrorCodeToString(hr);
return nullptr;
}
Rafael Cintron . unresolved

Per if checks which run earlier, shouldn't this QI for ID3D11on12Device2 always succeed?

Line 2270, Patchset 22 (Latest): CHECK_EQ(hr, S_OK) << ", CreateCommandQueue failed: "
<< logging::SystemErrorCodeToString(hr);
Rafael Cintron . unresolved

CreateCommandQueue, on the other hand, is something we should handle gracefully and not CHECK. If the device has become removed, it will fail.

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Tang
  • Sahir Vellani
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
Gerrit-Change-Number: 6733314
Gerrit-PatchSet: 22
Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
Gerrit-CC: Michael Tang <ta...@microsoft.com>
Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
Gerrit-Attention: Michael Tang <ta...@microsoft.com>
Gerrit-Comment-Date: Thu, 02 Oct 2025 01:58:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Sahir Vellani (Gerrit)

unread,
Oct 2, 2025, 6:50:16 PM10/2/25
to Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
Attention needed from Michael Tang and Rafael Cintron

Sahir Vellani added 16 comments

File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
Line 73, Patchset 22: return SUCCEEDED(hr) && !(d3d11_texture_desc.MiscFlags &
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX);
Rafael Cintron . resolved

Nit: Please provide a comment why keyed mutexes are excluded.

Sahir Vellani

Done

Line 79, Patchset 22: Microsoft::WRL::ComPtr<ID3D11Resource> d3d11_texture,

Microsoft::WRL::ComPtr<ID3D12CommandQueue> d3d12_command_queue) {
Rafael Cintron . resolved

Since PrepareTextureForD3D12 does not take ownership of its parameters, please pass these by bald pointer.

Sahir Vellani

Done

Line 85, Patchset 22: Microsoft::WRL::ComPtr<ID3D12Resource> d3d12_resource;
Rafael Cintron . resolved

Nit: Please declare d3d12_resource closer to where it is used.

Sahir Vellani

Done

Line 90, Patchset 22: if (FAILED(hr)) {

LOG(ERROR) << "Failed to get D3D11On12Device2: "
<< logging::SystemErrorCodeToString(hr);
return nullptr;
}
Rafael Cintron . resolved

Per earlier checks, this QI for ID3D11On12Device2 should always succeed.

Sahir Vellani

Done

Line 107, Patchset 22: // Flushing operations.
Rafael Cintron . resolved

Nit: Please replace this "flushing operations" comment with a comment that describes why we need to flush. Include a link to the MSDN page that talks about why: https://learn.microsoft.com/en-us/windows/win32/api/d3d11on12/nf-d3d11on12-id3d11on12device2-unwrapunderlyingresource

Sahir Vellani

Done

Line 118, Patchset 22:void PrepareTextureForD3D11(
Rafael Cintron . resolved

Since PrepareTextureForD3D11 does not take ownership of its parameters, please pass these by bald pointer.

Sahir Vellani

Done

Line 948, Patchset 22: if (!dcomp_texture_) {

dcomp_texture_ =
want_dcomp_texture_ && (d3d11_texture_ || d3d12_resource_)
? CreateDCompTexture(
d3d12_resource_
? static_cast<IUnknown*>(d3d12_resource_.Get())
: static_cast<IUnknown*>(d3d11_texture_.Get()),
alpha_type(), color_space())
: nullptr;
}
Rafael Cintron . resolved

Why does "ProduceDawn" need to create DComp textures?

Sahir Vellani

Don't think it does. Thanks for the catch.

Line 1554, Patchset 22: ? CreateDCompTexture(static_cast<IUnknown*>(d3d11_texture_.Get()),
Rafael Cintron . resolved

D3D11 textures inherit from IUnknown. Unless I am missing something, this static cast should not be necessary.

Sahir Vellani

Done

Line 1600, Patchset 22: is_texture_unwrapped_
Rafael Cintron . resolved

If `BeginAccessD3D12` sets `is_texture_unwrapped` to true below and `EndAccessD3D12` always sets it to false, when will it be true here on line 1600?

Sahir Vellani

Done

Line 1604, Patchset 22: if (d3d12_resource && d3d12_resource != d3d12_resource_) {
Rafael Cintron . resolved

If `d3d12_resource` is nullptr, we should clear out `d3d12_resource_` and return false.

Sahir Vellani

Done

Line 1604, Patchset 22: if (d3d12_resource && d3d12_resource != d3d12_resource_) {
Rafael Cintron . resolved

If `EndAccessCommon` always clears out `d3d12_resource_`, why are we assuming it is non-nullptr here? Is the `EndAccessCommon` code which clears the D3D resource not necessary?

Sahir Vellani

Done

Line 1606, Patchset 22: d3d12_resource_ = d3d12_resource;
Rafael Cintron . resolved
```suggestion
d3d12_resource_ = std::move(d3d12_resource);
```
Sahir Vellani

Done

Line 1616, Patchset 22: ? CreateDCompTexture(static_cast<IUnknown*>(d3d12_resource_.Get()),
Rafael Cintron . resolved

Similarly here, D3D12 resources derive from IUnknown so this cast shouldn't be necessary.

Sahir Vellani

Done

Line 1655, Patchset 22: d3d11_signal_fence = gfx::D3DSharedFence::CreateForD3D11(d3d11_device);
Rafael Cintron . unresolved

Why can't we rely on existing code in GetPendingWaitFences to add signaled fences to `d3d11_signaled_fence_map_` when needed? Is there a bug in GetPendingWaitFences?

Sahir Vellani

GetPendingWaitFences only creates a fence on the texture's device. When there is WebGL on the page, that fence's value is current because work is being done on the ANGLE device. Here, we create a fence on the device that is being used for the current D3D11 access. I think it could be a bug, but I haven't yet looked into why there are no problems in regular D3D11 mode.

Line 2253, Patchset 22: if (FAILED(hr)) {

LOG(ERROR) << "Failed to get D3D11On12Device2: "
<< logging::SystemErrorCodeToString(hr);
return nullptr;
}
Rafael Cintron . resolved

Per if checks which run earlier, shouldn't this QI for ID3D11on12Device2 always succeed?

Sahir Vellani

No, actually GetOrCreateCommandQueueFor11On12 is called regardless of the mode we're in.

Line 2270, Patchset 22: CHECK_EQ(hr, S_OK) << ", CreateCommandQueue failed: "
<< logging::SystemErrorCodeToString(hr);
Rafael Cintron . resolved

CreateCommandQueue, on the other hand, is something we should handle gracefully and not CHECK. If the device has become removed, it will fail.

Sahir Vellani

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Michael Tang
  • Rafael Cintron
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 24
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Thu, 02 Oct 2025 22:50:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rafael Cintron (Gerrit)

    unread,
    Nov 4, 2025, 10:01:53 PM11/4/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang and Sahir Vellani

    Rafael Cintron added 16 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 144, Patchset 27 (Latest): bool BeginAccessD3D12(Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device,
    bool write_access,
    bool is_overlay_access = false);
    void EndAccessD3D12(Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device,
    bool is_overlay_access = false);
    Rafael Cintron . unresolved

    Will Begin/EndAccessD3D12 ever be called from outside of D3DImageBacking? If not, can we make them private to the class?

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 69, Patchset 27 (Latest):bool ShouldUseD3D12(Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device,
    Rafael Cintron . unresolved

    ```suggestion
    bool ShouldUseD3D12(ID3D11Device* d3d11_device,
    ```

    Line 70, Patchset 27 (Latest): D3D11_TEXTURE2D_DESC d3d11_texture_desc) {
    Rafael Cintron . unresolved
    ```suggestion
    const D3D11_TEXTURE2D_DESC& d3d11_texture_desc) {
    ```
    Line 929, Patchset 27 (Latest): // TODO(savella) Look into why dawn_d3d11_device == texture_d3d11_device_ if
    // the resource has a keyed mutex flag. This happens during copy scenarios
    Rafael Cintron . unresolved

    What were the results of your investigation?

    Line 934, Patchset 27 (Latest): // ProduceDawn can be called during D3D12 access. Therefore if the texture
    // is already unwrapped, use the underlying resource to create shared
    Rafael Cintron . unresolved

    Unless I am missing something, this comment doesn't appear to match what the code is doing. The comment says "use the underlying resource" but the code sets d3d12_resource to nullptr.

    Line 1007, Patchset 27 (Latest): // texture memory for the D3D12 resource. Since it was not already in an
    // unwrapped state, return the resource back to the 11On12 translation
    // layer.
    Rafael Cintron . unresolved

    This code seems counterintuitive to me. Since the purpose of "ProduceDawn" is to prepare to render to the texture (with Dawn) with D3D12, we shouldn't need to give the resource back to 11on12. We just called PrepareTextureForD3D12 earlier in this same function.

    Line 1602, Patchset 27 (Latest): return false;
    Rafael Cintron . unresolved

    Please LOG(ERROR) for this false condition so we can troubleshoot bad rendering with users.

    Line 1597, Patchset 27 (Latest): if (d3d12_resource && d3d12_resource != d3d12_resource_) {
    dcomp_texture_.Reset();
    d3d12_resource_ = std::move(d3d12_resource);
    } else if (!d3d12_resource) {
    d3d12_resource_.Reset();
    return false;
    }
    Rafael Cintron . unresolved
    ```suggestion
    if (d3d12_resource) {
    if (d3d12_resource != d3d12_resource_) {
    dcomp_texture_.Reset();
    d3d12_resource_ = std::move(d3d12_resource);
    }
    } else {
    d3d12_resource_.Reset();
    return false;
    }
    ```
    Line 1639, Patchset 27 (Latest): if (d3d11_signal_fence) {
    if (d3d11_signal_fence->IncrementAndSignalD3D11()) {
    signaled_fence.insert(d3d11_signal_fence);
    } else {
    LOG(ERROR) << "Failed to signal D3D11 device fence on EndAccess";
    }
    } else if (!is_texture_device && in_write_access_) {
    Rafael Cintron . unresolved

    Since the code seems necessary, we should be able to reuse the IncrementAndSignal code instead of copy/pasting it.

    Line 1655, Patchset 22: d3d11_signal_fence = gfx::D3DSharedFence::CreateForD3D11(d3d11_device);
    Rafael Cintron . resolved

    Why can't we rely on existing code in GetPendingWaitFences to add signaled fences to `d3d11_signaled_fence_map_` when needed? Is there a bug in GetPendingWaitFences?

    Sahir Vellani

    GetPendingWaitFences only creates a fence on the texture's device. When there is WebGL on the page, that fence's value is current because work is being done on the ANGLE device. Here, we create a fence on the device that is being used for the current D3D11 access. I think it could be a bug, but I haven't yet looked into why there are no problems in regular D3D11 mode.

    Rafael Cintron

    Acknowledged

    Line 1691, Patchset 27 (Latest): if (d3d11_signal_fence->IncrementAndSignalD3D11()) {
    Rafael Cintron . unresolved

    Does this code (now) need the same treatment you added to EndAccessD3D11 with regard to calling IncrementAndSignal when we're in write access and the devices do not match? Why or why not?

    Line 2023, Patchset 27 (Latest): if (is_texture_unwrapped_) {
    PrepareTextureForD3D11(d3d11_texture_.Get());
    is_texture_unwrapped_ = false;
    }
    Rafael Cintron . unresolved

    Please add a comment that describes why we're not clearing out `d3d12_resource_` after we've prepared for D3D11.

    File ui/gl/dc_layer_tree.cc
    Line 343, Patchset 27 (Latest): dcomp_device_6_ = std::move(dcomp_device6);
    Rafael Cintron . unresolved

    Please improve the code so that we don't end up in a partially initialized state. Suggest that g_d3d12_command_queue is only set when we have IDCompositionDevice6. Then, we can CHECK_EQ(..., S_OK) the QI here.

    Line 1044, Patchset 27 (Latest): CHECK_EQ(hr, S_OK) << "Failed to present composition textures."
    Rafael Cintron . unresolved

    Similar to Commit, PresentCompositionTextures can fail if the device has been removed or we have presentation loss. We want those cases to be handled in the caller. Please add a new "CommitError::Reason" for PresentCompositionTextures.

    Line 1052, Patchset 27 (Latest): CHECK_EQ(hr, S_OK) << "Commit failed with error 0x" << std::hex << hr;
    Rafael Cintron . unresolved

    Since we do FAILED(hr) right above, hr will never be S_OK to satisfy this CHECK.

    Commit can fail if the device has been removed or we have presentation loss. We want those cases to be handled in the caller.

    File ui/gl/direct_composition_support.cc
    Line 794, Patchset 27 (Latest): }
    if (g_d3d12_command_queue) {
    g_d3d12_command_queue->Release();
    g_d3d12_command_queue = nullptr;
    }
    Rafael Cintron . unresolved
    ```suggestion
    if (g_d3d12_command_queue) {
    g_d3d12_command_queue->Release();
    g_d3d12_command_queue = nullptr;
    }
    }
    ```
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Sahir Vellani
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 27
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Wed, 05 Nov 2025 03:01:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sahir Vellani <sahir....@microsoft.com>
    Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Michael Tang (Gerrit)

    unread,
    Nov 7, 2025, 6:28:50 PM11/7/25
    to Sahir Vellani, Chromium LUCI CQ, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Sahir Vellani

    Michael Tang added 22 comments

    Patchset-level comments
    File-level comment, Patchset 28 (Latest):
    Michael Tang . unresolved

    Do you anticipate that D3D12+DComp support will be something that we need to query for? Or is it something that we want to just happen automatically when supported without our knowledge? If the former, please add a `OutputSurface::DCSupportLevel::kDCompTextureD3D12` and set it [in SkiaOutputDeviceDComp](https://source.chromium.org/chromium/chromium/src/+/main:components/viz/service/display_embedder/skia_output_device_dcomp.cc;l=54-68;drc=75786f4af376776d0078a6d500a7134172922e59).

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 459, Patchset 28 (Latest): // True if the backing's texture has been unwrapped for use as a D3D12
    // resource. Used to prevent unwraps of already unwrapped texture.

    bool is_texture_unwrapped_ GUARDED_BY(lock_) = false;
    Michael Tang . unresolved

    Can we add a note that this is referring to `d3d11_texture_` and if `is_texture_unwrapped_ = true` means that the texture _cannot_ be used by D3D11?

    Maybe theres a better name for that that is higher level than the 11on12 terminology?

    Line 360, Patchset 28 (Parent): const Microsoft::WRL::ComPtr<ID3D11Texture2D> d3d11_texture_;
    Michael Tang . unresolved

    Can this be made `const` again? I don't see any places that reset it.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 78, Patchset 28 (Latest):// Unwraps a D3D11 texture to its underlying D3D12 resource.
    Michael Tang . unresolved

    Given the usage, it seems like `UnwrapUnderlyingResource` can return different results on the same input texture. Please add a note in this comment if that's so.

    Line 80, Patchset 28 (Latest): ID3D11Resource* d3d11_texture,
    Michael Tang . unresolved

    Does this texture have to have been created on 11on12? What happens if I call this without D3D12 initialized (or from a non-11on12 texture)?

    Line 89, Patchset 28 (Latest): HRESULT hr = d3d11_device.As(&d3d11on12_device);
    Michael Tang . unresolved

    We're dropping errors from `hr` here.

    Line 102, Patchset 28 (Latest): // UnwrapUnderlyingResource doesn't flush, and it may schedule GPU work. We
    // should therefore flush the D3D11 device context here. See:
    // https://learn.microsoft.com/en-us/windows/win32/api/d3d11on12/nf-d3d11on12-id3d11on12device2-unwrapunderlyingresource
    Michael Tang . unresolved

    Is the reason we need to flush is to ensure that any fence signals get realized _now_?

    Line 173, Patchset 28 (Latest): LOG(ERROR) << "Failed to get D3D11 device from D3D12 device. hr="
    << std::hex << hr;
    Michael Tang . unresolved
    ```suggestion
    LOG(ERROR) << "Failed to get D3D11 device from D3D12 device: "
    << logging::SystemErrorCodeToString(hr);
    ```
    Line 177, Patchset 28 (Latest): }
    Michael Tang . unresolved
    ```suggestion
    } else {
    NOTREACHED();
    }
    ```
    Should we guard against unexpected backend types? Or rename this to something like `TryGetDawnDeviceAsD3D11Device`?
    Line 909, Patchset 28 (Latest): auto d3d12_resource =
    is_texture_unwrapped_
    ? nullptr
    : PrepareTextureForD3D12(d3d11_texture_.Get(),
    GetOrCreateCommandQueueFor11On12());
    Michael Tang . unresolved

    Is there ever a time when `d3d11_texture_` and `d3d12_resource_` are both valid to use at the same time? Could we (reasonably) replace `is_texture_unwrapped_` with a `std::optional<ID3D12Resource>` (or `std::variant`?) to ensure safety in that case?

    Line 928, Patchset 28 (Latest): } else {
    Michael Tang . unresolved

    Should we guard against unexpected dawn backend types?

    Line 1128, Patchset 28 (Parent): CHECK(dawn_d3d11_device);
    Michael Tang . unresolved

    Not sure if intentional, but we are dropping this check. Should it be in `GetD3D11Device`?

    Line 1503, Patchset 28 (Latest): CHECK(!is_texture_unwrapped_) << "Texture is unwrapped";
    Michael Tang . unresolved

    Maybe something with a bit more context: "11on12 texture is unwrapped for D3D12 access"? I'm imagining what it would be like to see this crash message after forgetting about this change 😊

    Line 1548, Patchset 28 (Latest): AutoLock auto_lock(this);

    FlushGraphiteCommandsIfNeeded();

    if (!ValidateBeginAccess(write_access)) {
    return false;
    }

    // Defer clearing fences until later to handle failure to synchronize.
    std::vector<scoped_refptr<gfx::D3DSharedFence>> wait_fences =
    GetPendingWaitFences(d3d11_device, /*dawn_device=*/nullptr, write_access);
    for (auto& wait_fence : wait_fences) {
    if (!wait_fence->WaitD3D11(d3d11_device)) {
    LOG(ERROR) << "Failed to wait for fence";
    return false;
    }
    }
    Michael Tang . unresolved

    Can this be hoisted up into `BeginAccessD3D`?

    Line 1581, Patchset 28 (Latest): if (!dcomp_texture_) {
    CHECK(is_texture_unwrapped_);
    dcomp_texture_ = want_dcomp_texture_
    ? CreateDCompTexture(d3d12_resource_.Get(),
    alpha_type(), color_space())
    : nullptr;
    }

    if (is_overlay_access && dcomp_texture_) {
    CHECK(!write_access);
    BeginDCompTextureAccess();
    }

    // Clear fences and update state iff D3D12 BeginAccess succeeds.
    BeginAccessCommon(write_access);
    return true;
    Michael Tang . unresolved

    Can this be hoisted up into `BeginAccessD3D`?

    Line 1613, Patchset 28 (Latest): // If the accessing device is not the texture's original device, create
    Michael Tang . unresolved

    nit: wording, since the access has finished at this point?

    ```suggestion
    // If the accessing device was not the texture's original device, create
    ```
    Line 1616, Patchset 28 (Latest): if (!d3d11_signal_fence && (!is_texture_device && in_write_access_)) {
    Michael Tang . unresolved

    Could/should we find a way to put the accessing device into `d3d11_signaled_fence_map_` on begin access instead of special casing it here? This map seems to be the general place to sychronize "after D3D11 access".

    Line 1665, Patchset 28 (Latest): if (is_overlay_access && dcomp_texture_) {
    EndDCompTextureAccess();
    }

    if (in_write_access_) {
    NotifyGraphiteAboutInitializedStatus();
    }

    EndAccessCommon(signaled_fence);
    Michael Tang . unresolved

    Can this be hoisted up into `EndAccessD3D`?

    Line 1707, Patchset 28 (Latest): Microsoft::WRL::ComPtr<ID3D12Fence> d3d12_fence;
    if (ShouldUseD3D12(texture_d3d11_device_.Get(), d3d11_texture_desc_)) {
    uint64_t fence_value = 0;
    HRESULT hr = dcomp_texture_->GetAvailableFence(&fence_value,
    IID_PPV_ARGS(&d3d12_fence));
    CHECK_EQ(hr, S_OK) << ", GetAvailableFence failed: "
    << logging::SystemErrorCodeToString(hr);
    CHECK(d3d12_fence) << "Overlay access is still in use by DWM.";

    // If the fence is already passed the wait value, we don't need to wait on
    // it.
    if (d3d12_fence->GetCompletedValue() >= fence_value) {
    return;
    }
    dcomp_texture_available_fence_ = gfx::D3DSharedFence::CreateFromD3D12Fence(
    std::move(d3d12_fence), fence_value);
    return;
    }
    Michael Tang . unresolved

    Theres a lot of duplicated code here vs the D3D11 version-- is there a way to deduplicate, so both versions to have to stay as much in sync? Maybe store off `ShouldUseD3D12` and interleave checks to it?

    File ui/gl/dc_layer_tree.h
    Line 592, Patchset 19: // An extension of composition device interface that enables support of d3d12
    // for composition textures.

    Microsoft::WRL::ComPtr<EXPERIMENTAL_IDCompositionDevice6> dcomp_device_6_;
    // A d3d12 command queue from Dawn that is used to present composition
    // textures prior to DComp commit.

    Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue_;
    Michael Tang . unresolved

    nit: Can we group this with the other `d3d11_device_`, `dcomp_device_`, etc above?

    File ui/gl/dc_layer_tree.cc
    Line 1039, Patchset 13: IUnknown* command_queue_unk = dc_layer_tree_->command_queue_.Get();
    Michael Tang . unresolved

    q: Does this need to be `IUnknown*`? Can it be `ID3D12CommandQueue*` which is converted at the `PresentCompositionTextures` callsite?

    File ui/gl/direct_composition_support.h
    Line 40, Patchset 13:// Initialize direct composition with the given d3d11 device and d3d12 command
    // queue.
    Michael Tang . unresolved

    nit: Can we note that this can be null?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Sahir Vellani
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 28
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Comment-Date: Fri, 07 Nov 2025 23:28:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Nov 11, 2025, 2:18:31 PM11/11/25
    to Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Sahir Vellani voted and added 38 comments

    Votes added by Sahir Vellani

    Commit-Queue+1

    38 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 459, Patchset 28: // True if the backing's texture has been unwrapped for use as a D3D12

    // resource. Used to prevent unwraps of already unwrapped texture.
    bool is_texture_unwrapped_ GUARDED_BY(lock_) = false;
    Michael Tang . resolved

    Can we add a note that this is referring to `d3d11_texture_` and if `is_texture_unwrapped_ = true` means that the texture _cannot_ be used by D3D11?

    Maybe theres a better name for that that is higher level than the 11on12 terminology?

    Sahir Vellani

    Done

    Line 360, Patchset 28 (Parent): const Microsoft::WRL::ComPtr<ID3D11Texture2D> d3d11_texture_;
    Michael Tang . resolved

    Can this be made `const` again? I don't see any places that reset it.

    Sahir Vellani

    Done

    Line 144, Patchset 27: bool BeginAccessD3D12(Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device,

    bool write_access,
    bool is_overlay_access = false);
    void EndAccessD3D12(Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device,
    bool is_overlay_access = false);
    Rafael Cintron . resolved

    Will Begin/EndAccessD3D12 ever be called from outside of D3DImageBacking? If not, can we make them private to the class?

    Sahir Vellani

    We can make them private for now.

    Line 303, Patchset 10: return dcomp_texture_ || (dxgi_shared_handle_state_ &&
    Michael Tang . resolved

    Is this only needed for dx12 comp textures?

    Sahir Vellani

    Yes

    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 69, Patchset 27:bool ShouldUseD3D12(Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device,
    Rafael Cintron . resolved

    ```suggestion
    bool ShouldUseD3D12(ID3D11Device* d3d11_device,
    ```

    Sahir Vellani

    Done

    Line 70, Patchset 27: D3D11_TEXTURE2D_DESC d3d11_texture_desc) {
    Rafael Cintron . resolved
    ```suggestion
    const D3D11_TEXTURE2D_DESC& d3d11_texture_desc) {
    ```
    Sahir Vellani

    Done

    Line 78, Patchset 28:// Unwraps a D3D11 texture to its underlying D3D12 resource.
    Michael Tang . resolved

    Given the usage, it seems like `UnwrapUnderlyingResource` can return different results on the same input texture. Please add a note in this comment if that's so.

    Sahir Vellani

    Done

    Line 80, Patchset 28: ID3D11Resource* d3d11_texture,
    Michael Tang . resolved

    Does this texture have to have been created on 11on12? What happens if I call this without D3D12 initialized (or from a non-11on12 texture)?

    Sahir Vellani

    No the texture does not need to be created on 11on12. If this is called without D3D12 initialized, it would be a no-op as the command queue would be null.

    Line 89, Patchset 28: HRESULT hr = d3d11_device.As(&d3d11on12_device);
    Michael Tang . resolved

    We're dropping errors from `hr` here.

    Sahir Vellani

    Done

    Line 93, Patchset 15: d3d11on12_device->ReleaseWrappedResources(&d3d11_texture, 1);
    Rafael Cintron . resolved

    Might be better to encapsulate this logcin by having the BeginAccessD3D12 and EndAccessD3D12 methods be more explicit about releasing the wrapped resource or unwrapping it based on which one is called. With your current approach, I think you're calling ReleaseWrappedResource when you don't need to.

    Did you test the case where media is on a separate device than Chromium?

    Sahir Vellani

    I think you're right that I'm releasing when I don't have to. We check whether the texture is unwrapped prior to unwrapping anyway.

    Sahir Vellani

    Done

    Line 102, Patchset 28: // UnwrapUnderlyingResource doesn't flush, and it may schedule GPU work. We
    Michael Tang . resolved

    Is the reason we need to flush is to ensure that any fence signals get realized _now_?

    Sahir Vellani

    Yes, as UnwrapUnderlyingResource can queue work in the D3D11 context IIUC.

    Line 173, Patchset 28: LOG(ERROR) << "Failed to get D3D11 device from D3D12 device. hr="
    << std::hex << hr;
    Michael Tang . resolved
    ```suggestion
    LOG(ERROR) << "Failed to get D3D11 device from D3D12 device: "
    << logging::SystemErrorCodeToString(hr);
    ```
    Sahir Vellani

    Done

    Line 177, Patchset 28: }
    Michael Tang . resolved
    ```suggestion
    } else {
    NOTREACHED();
    }
    ```
    Should we guard against unexpected backend types? Or rename this to something like `TryGetDawnDeviceAsD3D11Device`?
    Sahir Vellani

    Done

    Line 909, Patchset 28: auto d3d12_resource =

    is_texture_unwrapped_
    ? nullptr
    : PrepareTextureForD3D12(d3d11_texture_.Get(),
    GetOrCreateCommandQueueFor11On12());
    Michael Tang . resolved

    Is there ever a time when `d3d11_texture_` and `d3d12_resource_` are both valid to use at the same time? Could we (reasonably) replace `is_texture_unwrapped_` with a `std::optional<ID3D12Resource>` (or `std::variant`?) to ensure safety in that case?

    Sahir Vellani

    I purposefully don't clear out the D3D12 resource when returning it back to the 11On12 translation layer because I would need to re-create Dawn's shared texture memory. So I'd rather not use an optional for this case.

    Line 928, Patchset 28: } else {
    Michael Tang . resolved

    Should we guard against unexpected dawn backend types?

    Sahir Vellani

    I don't think it's necessary. There's a check earlier in this function.

    Line 929, Patchset 27: // TODO(savella) Look into why dawn_d3d11_device == texture_d3d11_device_ if

    // the resource has a keyed mutex flag. This happens during copy scenarios
    Rafael Cintron . resolved

    What were the results of your investigation?

    Sahir Vellani

    Device that opens the shared handle is the one that is returned by `GetDevice`.

    Line 934, Patchset 27: // ProduceDawn can be called during D3D12 access. Therefore if the texture

    // is already unwrapped, use the underlying resource to create shared
    Rafael Cintron . resolved

    Unless I am missing something, this comment doesn't appear to match what the code is doing. The comment says "use the underlying resource" but the code sets d3d12_resource to nullptr.

    Sahir Vellani

    Done

    Line 1007, Patchset 27: // texture memory for the D3D12 resource. Since it was not already in an

    // unwrapped state, return the resource back to the 11On12 translation
    // layer.
    Rafael Cintron . unresolved

    This code seems counterintuitive to me. Since the purpose of "ProduceDawn" is to prepare to render to the texture (with Dawn) with D3D12, we shouldn't need to give the resource back to 11on12. We just called PrepareTextureForD3D12 earlier in this same function.

    Sahir Vellani

    We PrepareTextureForD3D12 to get the resource for creating a SharedTextureMemory. My opinion is that we only unwrap when we definitely want to use the resource; and we know that only happens between Begin/End Access. Returning the resource back to D3D11On12 here keeps it in a predictable state.

    Line 1128, Patchset 28 (Parent): CHECK(dawn_d3d11_device);
    Michael Tang . resolved

    Not sure if intentional, but we are dropping this check. Should it be in `GetD3D11Device`?

    Sahir Vellani

    Done

    Line 1503, Patchset 28: CHECK(!is_texture_unwrapped_) << "Texture is unwrapped";
    Michael Tang . resolved

    Maybe something with a bit more context: "11on12 texture is unwrapped for D3D12 access"? I'm imagining what it would be like to see this crash message after forgetting about this change 😊

    Sahir Vellani

    Done

    Line 1548, Patchset 28: AutoLock auto_lock(this);


    FlushGraphiteCommandsIfNeeded();

    if (!ValidateBeginAccess(write_access)) {
    return false;
    }

    // Defer clearing fences until later to handle failure to synchronize.
    std::vector<scoped_refptr<gfx::D3DSharedFence>> wait_fences =
    GetPendingWaitFences(d3d11_device, /*dawn_device=*/nullptr, write_access);
    for (auto& wait_fence : wait_fences) {
    if (!wait_fence->WaitD3D11(d3d11_device)) {
    LOG(ERROR) << "Failed to wait for fence";
    return false;
    }
    }
    Michael Tang . resolved

    Can this be hoisted up into `BeginAccessD3D`?

    Sahir Vellani

    I can do this as a follow-up once I get PersistentDawnAccess working, as we need to invalidate persistent access in D3D11 mode before validating begin access and dealing with the fences.

    Line 1581, Patchset 28: if (!dcomp_texture_) {

    CHECK(is_texture_unwrapped_);
    dcomp_texture_ = want_dcomp_texture_
    ? CreateDCompTexture(d3d12_resource_.Get(),
    alpha_type(), color_space())
    : nullptr;
    }

    if (is_overlay_access && dcomp_texture_) {
    CHECK(!write_access);
    BeginDCompTextureAccess();
    }

    // Clear fences and update state iff D3D12 BeginAccess succeeds.
    BeginAccessCommon(write_access);
    return true;
    Michael Tang . resolved

    Can this be hoisted up into `BeginAccessD3D`?

    Sahir Vellani

    Done

    Line 1602, Patchset 27: return false;
    Rafael Cintron . resolved

    Please LOG(ERROR) for this false condition so we can troubleshoot bad rendering with users.

    Sahir Vellani

    Done

    Line 1597, Patchset 27: if (d3d12_resource && d3d12_resource != d3d12_resource_) {

    dcomp_texture_.Reset();
    d3d12_resource_ = std::move(d3d12_resource);
    } else if (!d3d12_resource) {
    d3d12_resource_.Reset();
    return false;
    }
    Rafael Cintron . resolved
    ```suggestion
    if (d3d12_resource) {
    if (d3d12_resource != d3d12_resource_) {
    dcomp_texture_.Reset();
    d3d12_resource_ = std::move(d3d12_resource);
    }
    } else {
    d3d12_resource_.Reset();
    return false;
    }
    ```
    Sahir Vellani

    Done

    Line 1613, Patchset 28: // If the accessing device is not the texture's original device, create
    Michael Tang . resolved

    nit: wording, since the access has finished at this point?

    ```suggestion
    // If the accessing device was not the texture's original device, create
    ```
    Sahir Vellani

    Done

    Line 1616, Patchset 28: if (!d3d11_signal_fence && (!is_texture_device && in_write_access_)) {
    Michael Tang . resolved

    Could/should we find a way to put the accessing device into `d3d11_signaled_fence_map_` on begin access instead of special casing it here? This map seems to be the general place to sychronize "after D3D11 access".

    Sahir Vellani

    Done

    Line 1639, Patchset 27: if (d3d11_signal_fence) {

    if (d3d11_signal_fence->IncrementAndSignalD3D11()) {
    signaled_fence.insert(d3d11_signal_fence);
    } else {
    LOG(ERROR) << "Failed to signal D3D11 device fence on EndAccess";
    }
    } else if (!is_texture_device && in_write_access_) {
    Rafael Cintron . resolved

    Since the code seems necessary, we should be able to reuse the IncrementAndSignal code instead of copy/pasting it.

    Sahir Vellani

    Done

    Line 1665, Patchset 28: if (is_overlay_access && dcomp_texture_) {

    EndDCompTextureAccess();
    }

    if (in_write_access_) {
    NotifyGraphiteAboutInitializedStatus();
    }

    EndAccessCommon(signaled_fence);
    Michael Tang . resolved

    Can this be hoisted up into `EndAccessD3D`?

    Sahir Vellani

    Done

    Line 1691, Patchset 27: if (d3d11_signal_fence->IncrementAndSignalD3D11()) {
    Rafael Cintron . unresolved

    Does this code (now) need the same treatment you added to EndAccessD3D11 with regard to calling IncrementAndSignal when we're in write access and the devices do not match? Why or why not?

    Sahir Vellani

    I'm not aware of a use case that would require us to wait on the d3d11_device here. The existing application of GetPendingWaitFences() seems sufficient.

    Line 1707, Patchset 28: Microsoft::WRL::ComPtr<ID3D12Fence> d3d12_fence;

    if (ShouldUseD3D12(texture_d3d11_device_.Get(), d3d11_texture_desc_)) {
    uint64_t fence_value = 0;
    HRESULT hr = dcomp_texture_->GetAvailableFence(&fence_value,
    IID_PPV_ARGS(&d3d12_fence));
    CHECK_EQ(hr, S_OK) << ", GetAvailableFence failed: "
    << logging::SystemErrorCodeToString(hr);
    CHECK(d3d12_fence) << "Overlay access is still in use by DWM.";

    // If the fence is already passed the wait value, we don't need to wait on
    // it.
    if (d3d12_fence->GetCompletedValue() >= fence_value) {
    return;
    }
    dcomp_texture_available_fence_ = gfx::D3DSharedFence::CreateFromD3D12Fence(
    std::move(d3d12_fence), fence_value);
    return;
    }
    Michael Tang . resolved

    Theres a lot of duplicated code here vs the D3D11 version-- is there a way to deduplicate, so both versions to have to stay as much in sync? Maybe store off `ShouldUseD3D12` and interleave checks to it?

    Sahir Vellani

    It's a different fence data structure for each version, so we would still have the same amount of code right? My thought is that with the separate block it is easier to read.

    Line 2023, Patchset 27: if (is_texture_unwrapped_) {
    PrepareTextureForD3D11(d3d11_texture_.Get());
    is_texture_unwrapped_ = false;
    }
    Rafael Cintron . resolved

    Please add a comment that describes why we're not clearing out `d3d12_resource_` after we've prepared for D3D11.

    Sahir Vellani

    Done

    File ui/gl/dc_layer_tree.h
    Line 592, Patchset 19: // An extension of composition device interface that enables support of d3d12
    // for composition textures.
    Microsoft::WRL::ComPtr<EXPERIMENTAL_IDCompositionDevice6> dcomp_device_6_;
    // A d3d12 command queue from Dawn that is used to present composition
    // textures prior to DComp commit.
    Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue_;
    Michael Tang . resolved

    nit: Can we group this with the other `d3d11_device_`, `dcomp_device_`, etc above?

    Sahir Vellani

    Done

    File ui/gl/dc_layer_tree.cc
    Line 343, Patchset 27: dcomp_device_6_ = std::move(dcomp_device6);
    Rafael Cintron . resolved

    Please improve the code so that we don't end up in a partially initialized state. Suggest that g_d3d12_command_queue is only set when we have IDCompositionDevice6. Then, we can CHECK_EQ(..., S_OK) the QI here.

    Sahir Vellani

    Done

    Line 1039, Patchset 13: IUnknown* command_queue_unk = dc_layer_tree_->command_queue_.Get();
    Michael Tang . resolved

    q: Does this need to be `IUnknown*`? Can it be `ID3D12CommandQueue*` which is converted at the `PresentCompositionTextures` callsite?

    Sahir Vellani

    Yeah it has to be null. The code fails to compile if an ID3D12CommandQueue* is supplied to PresetCompositionTextures.

    Line 1044, Patchset 27: CHECK_EQ(hr, S_OK) << "Failed to present composition textures."
    Rafael Cintron . resolved

    Similar to Commit, PresentCompositionTextures can fail if the device has been removed or we have presentation loss. We want those cases to be handled in the caller. Please add a new "CommitError::Reason" for PresentCompositionTextures.

    Sahir Vellani

    Done

    Line 1052, Patchset 27: CHECK_EQ(hr, S_OK) << "Commit failed with error 0x" << std::hex << hr;
    Rafael Cintron . resolved

    Since we do FAILED(hr) right above, hr will never be S_OK to satisfy this CHECK.

    Commit can fail if the device has been removed or we have presentation loss. We want those cases to be handled in the caller.

    Sahir Vellani

    This was from a debugging exercise, missed it.

    File ui/gl/direct_composition_support.h
    Line 40, Patchset 13:// Initialize direct composition with the given d3d11 device and d3d12 command
    // queue.
    Michael Tang . resolved

    nit: Can we note that this can be null?

    Sahir Vellani

    Done

    File ui/gl/direct_composition_support.cc

    if (g_d3d12_command_queue) {
    g_d3d12_command_queue->Release();
    g_d3d12_command_queue = nullptr;
    }
    Rafael Cintron . resolved
    ```suggestion
    if (g_d3d12_command_queue) {
    g_d3d12_command_queue->Release();
    g_d3d12_command_queue = nullptr;
    }
    }
    ```
    Sahir Vellani

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Rafael Cintron
    • Sahir Vellani
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 30
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Tue, 11 Nov 2025 19:18:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
    Comment-In-Reply-To: Sahir Vellani <sahir....@microsoft.com>
    Comment-In-Reply-To: Michael Tang <ta...@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 12, 2025, 7:33:23 PM11/12/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Message from chrom...@appspot.gserviceaccount.com

    😿 Job win-11-perf/motionmark1.3.1.crossbench failed.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/13c92f68310000

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Rafael Cintron
    • Sahir Vellani
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 32
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Thu, 13 Nov 2025 00:33:13 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 12, 2025, 7:49:42 PM11/12/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Message from chrom...@appspot.gserviceaccount.com

    📍 Job win-11-perf/motionmark1.3.1.crossbench complete.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/11bff6b0310000

    Gerrit-Comment-Date: Thu, 13 Nov 2025 00:49:32 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 12, 2025, 8:54:36 PM11/12/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Message from chrom...@appspot.gserviceaccount.com

    😿 Job win-11-perf/rendering.desktop failed.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/105e32dfd10000

    Gerrit-Comment-Date: Thu, 13 Nov 2025 01:54:25 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 21, 2025, 2:12:24 AM11/21/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Message from chrom...@appspot.gserviceaccount.com

    😿 Job win-11-perf/rendering.desktop failed.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/105ec9a6310000

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Rafael Cintron
    • Sahir Vellani
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 36
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Fri, 21 Nov 2025 07:12:15 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 21, 2025, 2:19:27 AM11/21/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Message from chrom...@appspot.gserviceaccount.com

    😿 Job win-11-perf/motionmark1.3.1.crossbench failed.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/15e78ade310000

    Gerrit-Comment-Date: Fri, 21 Nov 2025 07:19:17 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 21, 2025, 2:24:37 AM11/21/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Message from chrom...@appspot.gserviceaccount.com

    😿 Job win-11-perf/rendering.desktop failed.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/1163e316310000

    Gerrit-Comment-Date: Fri, 21 Nov 2025 07:24:26 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Nov 21, 2025, 12:52:37 PM11/21/25
    to chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang and Rafael Cintron

    Sahir Vellani added 1 comment

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 1581, Patchset 28: if (!dcomp_texture_) {
    CHECK(is_texture_unwrapped_);
    dcomp_texture_ = want_dcomp_texture_
    ? CreateDCompTexture(d3d12_resource_.Get(),
    alpha_type(), color_space())
    : nullptr;
    }

    if (is_overlay_access && dcomp_texture_) {
    CHECK(!write_access);
    BeginDCompTextureAccess();
    }

    // Clear fences and update state iff D3D12 BeginAccess succeeds.
    BeginAccessCommon(write_access);
    return true;
    Michael Tang . resolved

    Can this be hoisted up into `BeginAccessD3D`?

    Sahir Vellani

    Done

    Sahir Vellani

    Had to undo, because BeginAccessD3D11 is called separately as well; for GLTexturePassthrough ops

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Rafael Cintron
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 36
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Fri, 21 Nov 2025 17:52:28 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 24, 2025, 8:51:50 PM11/24/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Message from chrom...@appspot.gserviceaccount.com

    📍 Job win-11-perf/motionmark1.3.1.crossbench complete.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/17a2efd6310000

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Rafael Cintron
    • Sahir Vellani
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 36
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Tue, 25 Nov 2025 01:51:41 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 24, 2025, 9:04:41 PM11/24/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Message from chrom...@appspot.gserviceaccount.com

    😿 Job win-11-perf/rendering.desktop failed.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/152f6df5310000

    Gerrit-Comment-Date: Tue, 25 Nov 2025 02:04:29 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    chromeperf@appspot.gserviceaccount.com (Gerrit)

    unread,
    Nov 25, 2025, 6:16:32 AM11/25/25
    to Sahir Vellani, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron and Sahir Vellani

    Message from chrom...@appspot.gserviceaccount.com

    📍 Job win-10-perf/system_health.common_desktop complete.

    See results at: https://pinpoint-dot-chromeperf.appspot.com/job/16a322e2310000

    Gerrit-Comment-Date: Tue, 25 Nov 2025 11:16:19 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rafael Cintron (Gerrit)

    unread,
    Nov 25, 2025, 8:36:12 PM11/25/25
    to Sahir Vellani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang and Sahir Vellani

    Rafael Cintron added 20 comments

    File gpu/command_buffer/service/dawn_context_provider.cc
    Line 473, Patchset 36 (Latest): // will bridge the gap in places where code has not been updated to use
    // D3D12 APIs.
    Rafael Cintron . unresolved
    ```suggestion
    // will bridge the gap in places SharedImage code uses D3D11 for
    // internal operations like copying to staging textures. In the
    // future, these places will transition to use Dawn for internal
    // operations.
    ```
    Line 490, Patchset 36 (Latest): if (d3d11on12_device) {
    Rafael Cintron . unresolved

    Since `d3d11on12_device` will only be nullptr when `QueryInterface` fails, no need for this pointer check after the early return.

    Line 492, Patchset 36 (Latest): CHECK_EQ(hr, S_OK) << ", QueryInterface failed: "
    << logging::SystemErrorCodeToString(hr);
    Rafael Cintron . unresolved

    An D3D11on12 device should always QI to D3D11 device. We can skip the additional debug spew here. Please do this for the other places where you QI for an 11 device from an 11on12 device.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 367, Patchset 36 (Latest): // queue is used for interop with D3D11; primarily when the backing unwraps
    // the D3D11 texture for use as a D3D12 resource.
    Rafael Cintron . unresolved
    ```suggestion
    // queue is used for interop with D3D11 when the backing unwraps
    // the D3D11 texture for use as a D3D12 resource.
    ```
    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 921, Patchset 36 (Latest): if (d3d12_resource && d3d12_resource != d3d12_resource_) {
    Rafael Cintron . unresolved

    Please add a comment that `d3d12_resource` may not equal `d3d12_resource_` in the case where D3D11 has decided to allocate a new object for the resource. Example: Developer calls UpdateSubresource to modify a resource that is currently being read or written to by the GPU. We want to avoid churning DCompTextures as much as possible.

    Line 1515, Patchset 36 (Latest): if (!ShouldUseD3D12(d3d11_device.Get(), d3d11_texture_desc_) &&
    Rafael Cintron . unresolved

    `DXGISharedHandleState` has a `has_keyed_mutex` method. Can use use that to determine whether we should call `ReleaseKeyedMutex` instead of `ShouldUseD3D12`?

    Line 1571, Patchset 36 (Latest): if (!dcomp_texture_) {
    dcomp_texture_ = want_dcomp_texture_
    ? CreateDCompTexture(d3d11_texture_.Get(),
    alpha_type(), color_space())
    : nullptr;
    }
    Rafael Cintron . unresolved
    ```suggestion
    if (want_dcomp_texture && !dcomp_texture_) {
    dcomp_texture_ = CreateDCompTexture(d3d11_texture_.Get(),
    alpha_type(), color_space());
    }
    ```
    Line 1622, Patchset 36 (Latest): if (d3d12_resource && d3d12_resource != d3d12_resource_) {
    Rafael Cintron . unresolved

    Similarly here, please add a comment about 11on12 returning a different d3d12 resource than we might have previously saved away.

    Line 1634, Patchset 36 (Latest): CHECK(is_texture_unwrapped_);
    Rafael Cintron . unresolved

    You JUST set `is_texture_unwrapped_` to true two lines above. No need to CHECK it here as well.

    Line 1633, Patchset 36 (Latest): if (!dcomp_texture_) {

    CHECK(is_texture_unwrapped_);
    dcomp_texture_ = want_dcomp_texture_
    ? CreateDCompTexture(d3d12_resource_.Get(),
    alpha_type(), color_space())
    : nullptr;
    }
    Rafael Cintron . unresolved
    ```suggestion
    if (want_dcomp_texture_ && !dcomp_texture_) {
    dcomp_texture_ = CreateDCompTexture(d3d12_resource_.Get(),
    alpha_type(), color_space());
    }
    ```
    Line 1691, Patchset 27: if (d3d11_signal_fence->IncrementAndSignalD3D11()) {
    Rafael Cintron . unresolved

    Does this code (now) need the same treatment you added to EndAccessD3D11 with regard to calling IncrementAndSignal when we're in write access and the devices do not match? Why or why not?

    Sahir Vellani

    I'm not aware of a use case that would require us to wait on the d3d11_device here. The existing application of GetPendingWaitFences() seems sufficient.

    Rafael Cintron

    What about the case where we must wait on the ANGLE device's command queue before composing its output with the Dawn command queue? Or the case where WebGPU's output is to be used as WebGL's input?

    Line 1969, Patchset 36 (Latest): // texture memory. This will prevent the need to create a new shared texture
    // memory on next Dawn access.
    Rafael Cintron . unresolved

    Please add a comment that we do not clear out the D3D12 resource to avoid re-creating the DComp texture as well.

    Line 2205, Patchset 36 (Latest): hr = d3d12_device->CreateCommandQueue(&command_queue_desc,
    Rafael Cintron . unresolved

    Since `CreateCommandQueue` can return an error when the device is removed, please ensure that all callers of `GetOrCreateCommandQueueForD3D12` check for nullptr and bubble up failures so we can exit the process gracefully instead of crashing.

    File gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc
    Line 54, Patchset 36 (Latest): if (!base::FeatureList::IsEnabled(features::kAllowDCompOnD3D12)) {
    Rafael Cintron . unresolved

    Why does DCompOnD3D12 flag impact the supported usage we return from this function?

    File ui/gl/dc_layer_tree.h
    Line 541, Patchset 36 (Latest): // An extension of composition device interface that enables support of d3d12
    // for composition textures.
    Rafael Cintron . unresolved
    ```suggestion
    // IDCompositionDevice6 enables support for D3D12 composition textures.
    ```
    File ui/gl/dc_layer_tree.cc
    Line 1042, Patchset 36 (Latest): // First present composition textures.
    Rafael Cintron . unresolved

    Please expand the comment to state why `PresentCompositionTextures` must be called before `Commit.`

    Line 1048, Patchset 36 (Latest): << logging::SystemErrorCodeToString(hr);
    Rafael Cintron . unresolved

    `logging::SystemErrorCodeToString(hr)` prints a friendly string for the error. So `E_INVALIDARG` turns into something like "Invalid argument". It's weird to concatenate that after the string "0x". The "0x" was a holdover from existing code where the hex value of the error was outputted instead. So E_SOME_ERROR would turn into 0x1123ab or whatever the hex valid was.

    Better would be for this to be "Present failed with error: " << logging:SystemErrorCodeToString(hr)"

    File ui/gl/direct_composition_support.cc
    Line 1216, Patchset 36 (Latest): // IDCompositionTexture is not implemented on an 11on12, even though the
    // device will claim support for it.
    Rafael Cintron . unresolved

    Please add to the comment to explain why 11on12 is allowed when DComp runs on D3D12.

    File ui/gl/gl_features.cc
    Line 129, Patchset 36 (Latest):BASE_FEATURE(kAllowDCompOnD3D12, base::FEATURE_DISABLED_BY_DEFAULT);
    Rafael Cintron . unresolved

    ```suggestion
    BASE_FEATURE(kDCompOnD3D12, base::FEATURE_DISABLED_BY_DEFAULT);
    ```

    Line 129, Patchset 36 (Latest):BASE_FEATURE(kAllowDCompOnD3D12, base::FEATURE_DISABLED_BY_DEFAULT);
    Rafael Cintron . unresolved

    Since this is the entrypoint for all of the code, please provide a multi-sentence explanation for the flag and what it does. In the explanation, please add any additional flags that must also be enabled in order for the flag to work correctly.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Sahir Vellani
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 36
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Wed, 26 Nov 2025 01:36:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sahir Vellani <sahir....@microsoft.com>
    Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Dec 8, 2025, 3:38:17 PM12/8/25
    to chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang and Rafael Cintron

    Sahir Vellani added 21 comments

    File gpu/command_buffer/service/dawn_context_provider.cc
    Line 473, Patchset 36: // will bridge the gap in places where code has not been updated to use
    // D3D12 APIs.
    Rafael Cintron . resolved
    ```suggestion
    // will bridge the gap in places SharedImage code uses D3D11 for
    // internal operations like copying to staging textures. In the
    // future, these places will transition to use Dawn for internal
    // operations.
    ```
    Sahir Vellani

    Done

    Line 490, Patchset 36: if (d3d11on12_device) {
    Rafael Cintron . resolved

    Since `d3d11on12_device` will only be nullptr when `QueryInterface` fails, no need for this pointer check after the early return.

    Sahir Vellani

    Done

    Line 492, Patchset 36: CHECK_EQ(hr, S_OK) << ", QueryInterface failed: "
    << logging::SystemErrorCodeToString(hr);
    Rafael Cintron . resolved

    An D3D11on12 device should always QI to D3D11 device. We can skip the additional debug spew here. Please do this for the other places where you QI for an 11 device from an 11on12 device.

    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 367, Patchset 36: // queue is used for interop with D3D11; primarily when the backing unwraps

    // the D3D11 texture for use as a D3D12 resource.
    Rafael Cintron . resolved
    ```suggestion
    // queue is used for interop with D3D11 when the backing unwraps
    // the D3D11 texture for use as a D3D12 resource.
    ```
    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 921, Patchset 36: if (d3d12_resource && d3d12_resource != d3d12_resource_) {
    Rafael Cintron . resolved

    Please add a comment that `d3d12_resource` may not equal `d3d12_resource_` in the case where D3D11 has decided to allocate a new object for the resource. Example: Developer calls UpdateSubresource to modify a resource that is currently being read or written to by the GPU. We want to avoid churning DCompTextures as much as possible.

    Sahir Vellani

    Done

    Line 1007, Patchset 27: // texture memory for the D3D12 resource. Since it was not already in an
    // unwrapped state, return the resource back to the 11On12 translation
    // layer.
    Rafael Cintron . resolved

    This code seems counterintuitive to me. Since the purpose of "ProduceDawn" is to prepare to render to the texture (with Dawn) with D3D12, we shouldn't need to give the resource back to 11on12. We just called PrepareTextureForD3D12 earlier in this same function.

    Sahir Vellani

    We PrepareTextureForD3D12 to get the resource for creating a SharedTextureMemory. My opinion is that we only unwrap when we definitely want to use the resource; and we know that only happens between Begin/End Access. Returning the resource back to D3D11On12 here keeps it in a predictable state.

    Sahir Vellani

    Done

    Line 1515, Patchset 36: if (!ShouldUseD3D12(d3d11_device.Get(), d3d11_texture_desc_) &&
    Rafael Cintron . resolved

    `DXGISharedHandleState` has a `has_keyed_mutex` method. Can use use that to determine whether we should call `ReleaseKeyedMutex` instead of `ShouldUseD3D12`?

    Sahir Vellani

    Done

    Line 1571, Patchset 36: if (!dcomp_texture_) {

    dcomp_texture_ = want_dcomp_texture_
    ? CreateDCompTexture(d3d11_texture_.Get(),
    alpha_type(), color_space())
    : nullptr;
    }
    Rafael Cintron . resolved
    ```suggestion
    if (want_dcomp_texture && !dcomp_texture_) {
    dcomp_texture_ = CreateDCompTexture(d3d11_texture_.Get(),
    alpha_type(), color_space());
    }
    ```
    Sahir Vellani

    Done

    Line 1622, Patchset 36: if (d3d12_resource && d3d12_resource != d3d12_resource_) {
    Rafael Cintron . resolved

    Similarly here, please add a comment about 11on12 returning a different d3d12 resource than we might have previously saved away.

    Sahir Vellani

    Done

    Line 1634, Patchset 36: CHECK(is_texture_unwrapped_);
    Rafael Cintron . resolved

    You JUST set `is_texture_unwrapped_` to true two lines above. No need to CHECK it here as well.

    Sahir Vellani

    Done

    Line 1633, Patchset 36: if (!dcomp_texture_) {

    CHECK(is_texture_unwrapped_);
    dcomp_texture_ = want_dcomp_texture_
    ? CreateDCompTexture(d3d12_resource_.Get(),
    alpha_type(), color_space())
    : nullptr;
    }
    Rafael Cintron . resolved
    ```suggestion
    if (want_dcomp_texture_ && !dcomp_texture_) {
    dcomp_texture_ = CreateDCompTexture(d3d12_resource_.Get(),
    alpha_type(), color_space());
    }
    ```
    Sahir Vellani

    Done

    Line 1691, Patchset 27: if (d3d11_signal_fence->IncrementAndSignalD3D11()) {
    Rafael Cintron . resolved

    Does this code (now) need the same treatment you added to EndAccessD3D11 with regard to calling IncrementAndSignal when we're in write access and the devices do not match? Why or why not?

    Sahir Vellani

    I'm not aware of a use case that would require us to wait on the d3d11_device here. The existing application of GetPendingWaitFences() seems sufficient.

    Rafael Cintron

    What about the case where we must wait on the ANGLE device's command queue before composing its output with the Dawn command queue? Or the case where WebGPU's output is to be used as WebGL's input?

    Sahir Vellani

    Addressed.

    Line 1969, Patchset 36: // texture memory. This will prevent the need to create a new shared texture

    // memory on next Dawn access.
    Rafael Cintron . resolved

    Please add a comment that we do not clear out the D3D12 resource to avoid re-creating the DComp texture as well.

    Sahir Vellani

    Done

    Line 2205, Patchset 36: hr = d3d12_device->CreateCommandQueue(&command_queue_desc,
    Rafael Cintron . resolved

    Since `CreateCommandQueue` can return an error when the device is removed, please ensure that all callers of `GetOrCreateCommandQueueForD3D12` check for nullptr and bubble up failures so we can exit the process gracefully instead of crashing.

    Sahir Vellani

    Yes it's already handled. `GetOrCreateCommandQueueForD3D12` is used when calling `PrepareTextureForD3D12`. If `GetOrCreateCommandQueueForD3D12` returns nullptr so does `PrepareTextureForD3D12` which is considered in ensuing logic.

    File gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc
    Line 54, Patchset 36: if (!base::FeatureList::IsEnabled(features::kAllowDCompOnD3D12)) {
    Rafael Cintron . resolved

    Why does DCompOnD3D12 flag impact the supported usage we return from this function?

    Sahir Vellani

    If we add the below flags to supported usage, SharedImage opts for a vulkan based backing when rendering webgl, causing a bunch of errors.

    File ui/gl/dc_layer_tree.h
    Line 541, Patchset 36: // An extension of composition device interface that enables support of d3d12
    // for composition textures.
    Rafael Cintron . resolved
    ```suggestion
    // IDCompositionDevice6 enables support for D3D12 composition textures.
    ```
    Sahir Vellani

    Done

    File ui/gl/dc_layer_tree.cc
    Line 1042, Patchset 36: // First present composition textures.
    Rafael Cintron . resolved

    Please expand the comment to state why `PresentCompositionTextures` must be called before `Commit.`

    Sahir Vellani

    Done

    Line 1048, Patchset 36: << logging::SystemErrorCodeToString(hr);
    Rafael Cintron . resolved

    `logging::SystemErrorCodeToString(hr)` prints a friendly string for the error. So `E_INVALIDARG` turns into something like "Invalid argument". It's weird to concatenate that after the string "0x". The "0x" was a holdover from existing code where the hex value of the error was outputted instead. So E_SOME_ERROR would turn into 0x1123ab or whatever the hex valid was.

    Better would be for this to be "Present failed with error: " << logging:SystemErrorCodeToString(hr)"

    Sahir Vellani

    Done

    File ui/gl/direct_composition_support.cc
    Line 1216, Patchset 36: // IDCompositionTexture is not implemented on an 11on12, even though the

    // device will claim support for it.
    Rafael Cintron . resolved

    Please add to the comment to explain why 11on12 is allowed when DComp runs on D3D12.

    Sahir Vellani

    Done

    File ui/gl/gl_features.cc
    Line 129, Patchset 36:BASE_FEATURE(kAllowDCompOnD3D12, base::FEATURE_DISABLED_BY_DEFAULT);
    Rafael Cintron . resolved

    ```suggestion
    BASE_FEATURE(kDCompOnD3D12, base::FEATURE_DISABLED_BY_DEFAULT);
    ```

    Sahir Vellani

    Done

    Line 129, Patchset 36:BASE_FEATURE(kAllowDCompOnD3D12, base::FEATURE_DISABLED_BY_DEFAULT);
    Rafael Cintron . resolved

    Since this is the entrypoint for all of the code, please provide a multi-sentence explanation for the flag and what it does. In the explanation, please add any additional flags that must also be enabled in order for the flag to work correctly.

    Sahir Vellani

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Rafael Cintron
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 38
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Mon, 08 Dec 2025 20:38:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rafael Cintron (Gerrit)

    unread,
    Dec 10, 2025, 7:14:29 PM12/10/25
    to Sahir Vellani, Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Sahir Vellani, Sunny Sachanandani and Vasiliy Telezhnikov

    Rafael Cintron added 6 comments

    Patchset-level comments
    File-level comment, Patchset 38 (Latest):
    Rafael Cintron . resolved

    @Quyen, @Vasiliy and @Sunny, Sahir is still work on getting all of the scenarios to light up but what he has so far should be ready for review. PTAL.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 921, Patchset 38 (Latest): // D3D11 has decided to allocate a new object for the resource. Example:
    Rafael Cintron . unresolved
    ```suggestion
    // D3D11on12 has decided to allocate a new object for the resource. Example:
    ```
    Line 1635, Patchset 38 (Latest): // D3D11 has decided to allocate a new object for the resource. Example:
    Rafael Cintron . unresolved
    ```suggestion
    // D3D11on12 has decided to allocate a new object for the resource. Example:
    ```
    File ui/gl/dc_layer_tree.h
    Line 541, Patchset 38 (Latest): // IDCompositionDevice6 enables support for D3D12 composition textures.
    Rafael Cintron . unresolved
    ```suggestion
    // IDCompositionDevice6 enables support for D3D12 composition textures.
    ```
    File ui/gl/gl_features.cc
    Line 138, Patchset 38 (Latest):// - WebGL and certain SharedImage functionality such as copies to staging
    // textures rely on D3D11 resources. These code paths will continue using
    // D3D11 even when this feature is enabled, with interop handled via
    // D3D11On12.
    Rafael Cintron . unresolved

    The comment is not quite correct.

    WebGL will continue to use the D3D11 runtime backed by D3D11 drivers with ANGLE's D3D11 device. SharedImage (copies to staging textures) on the other hand, will use D3D11on12 which is the D3D11 runtime backed by a special driver that emulates the D3D11 DDI on top of D3D12. I wouldn't combine these scenarios together as "interop is handled by D3D11on12" because that is not the case.

    Line 143, Patchset 38 (Latest):// This feature requires SkiaGraphite with a dawn-d3d12 backend, BufferQueue to
    Rafael Cintron . unresolved

    Please detail the full set of feature flags that need to be enabled so people can easily try it out themselves.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Sahir Vellani
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 38
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Thu, 11 Dec 2025 00:14:18 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Quyen Le (Gerrit)

    unread,
    Dec 12, 2025, 9:05:55 AM12/12/25
    to Sahir Vellani, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Sahir Vellani, Sunny Sachanandani and Vasiliy Telezhnikov

    Quyen Le added 4 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 281, Patchset 38 (Latest): return dcomp_texture_ || (dxgi_shared_handle_state_ &&
    Quyen Le . unresolved

    `use_cross_device_fence_synchronization()` is used to create an additional fence.
    For D3D11, we don't need an additional fence for dcomp. `dcomp_texture_available_fence_` is enough. I don't know if it's needed for D3D11on12 or not. But to avoid regressing existing code's performance, consider use `dcomp_texture_ ` flag here only if D3D11on12 is used.

    We want to avoid fences as much as possible for Graphite/D3D11 and it showed it could improve performance a lot.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 66, Patchset 38 (Latest):bool ShouldUseD3D12(ID3D11Device* d3d11_device,
    Quyen Le . unresolved

    Can this result be cached? Maybe at least we should cache it for the texture's original device.

    Line 1569, Patchset 38 (Latest): auto& d3d11_signal_fence = d3d11_signaled_fence_map_[d3d11_device];
    if (!d3d11_signal_fence &&
    (!(d3d11_device == texture_d3d11_device_) && write_access)) {

    d3d11_signal_fence = gfx::D3DSharedFence::CreateForD3D11(d3d11_device);
    }
    Quyen Le . unresolved

    Isn't this already done in `GetPendingWaitFences`? if the existing code in `GetPendingWaitFences` is not enough, maybe we should update it instead?

    Line 1697, Patchset 38 (Latest): Microsoft::WRL::ComPtr<ID3D12Fence> d3d12_fence;

    uint64_t fence_value = 0;
    HRESULT hr = dcomp_texture_->GetAvailableFence(&fence_value,
    IID_PPV_ARGS(&d3d12_fence));
    CHECK_EQ(hr, S_OK) << ", GetAvailableFence failed: "
    << logging::SystemErrorCodeToString(hr);
    CHECK(d3d12_fence) << "Overlay access is still in use by DWM.";

    // If the fence is already passed the wait value, we don't need to wait on
    // it.
    if (d3d12_fence->GetCompletedValue() >= fence_value) {
    return;
    }
    dcomp_texture_available_fence_ = gfx::D3DSharedFence::CreateFromD3D12Fence(
    std::move(d3d12_fence), fence_value);
    return;
    Quyen Le . unresolved

    This is almost the same as the code below. Maybe we should move it to a template function.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Fri, 12 Dec 2025 14:05:22 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Dec 16, 2025, 1:19:54 PM12/16/25
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani voted and added 10 comments

    Votes added by Sahir Vellani

    Commit-Queue+1

    10 comments

    Patchset-level comments
    File-level comment, Patchset 39:
    Sahir Vellani . resolved

    ut

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 281, Patchset 38: return dcomp_texture_ || (dxgi_shared_handle_state_ &&
    Quyen Le . resolved

    `use_cross_device_fence_synchronization()` is used to create an additional fence.
    For D3D11, we don't need an additional fence for dcomp. `dcomp_texture_available_fence_` is enough. I don't know if it's needed for D3D11on12 or not. But to avoid regressing existing code's performance, consider use `dcomp_texture_ ` flag here only if D3D11on12 is used.

    We want to avoid fences as much as possible for Graphite/D3D11 and it showed it could improve performance a lot.

    Sahir Vellani

    I think this change can be eliminated entirely for now. The already existing check for `dcomp_texture_` in `D3DImageBacking::GetPendingWaitFences` is good enough.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 66, Patchset 38:bool ShouldUseD3D12(ID3D11Device* d3d11_device,
    Quyen Le . resolved

    Can this result be cached? Maybe at least we should cache it for the texture's original device.

    Sahir Vellani

    Caching it for the texture's original device.

    Line 921, Patchset 38: // D3D11 has decided to allocate a new object for the resource. Example:
    Rafael Cintron . resolved
    ```suggestion
    // D3D11on12 has decided to allocate a new object for the resource. Example:
    ```
    Sahir Vellani

    Done

    Line 1569, Patchset 38: auto& d3d11_signal_fence = d3d11_signaled_fence_map_[d3d11_device];

    if (!d3d11_signal_fence &&
    (!(d3d11_device == texture_d3d11_device_) && write_access)) {
    d3d11_signal_fence = gfx::D3DSharedFence::CreateForD3D11(d3d11_device);
    }
    Quyen Le . resolved

    Isn't this already done in `GetPendingWaitFences`? if the existing code in `GetPendingWaitFences` is not enough, maybe we should update it instead?

    Sahir Vellani

    Done

    Line 1635, Patchset 38: // D3D11 has decided to allocate a new object for the resource. Example:
    Rafael Cintron . resolved
    ```suggestion
    // D3D11on12 has decided to allocate a new object for the resource. Example:
    ```
    Sahir Vellani

    Done

    Line 1697, Patchset 38: Microsoft::WRL::ComPtr<ID3D12Fence> d3d12_fence;

    uint64_t fence_value = 0;
    HRESULT hr = dcomp_texture_->GetAvailableFence(&fence_value,
    IID_PPV_ARGS(&d3d12_fence));
    CHECK_EQ(hr, S_OK) << ", GetAvailableFence failed: "
    << logging::SystemErrorCodeToString(hr);
    CHECK(d3d12_fence) << "Overlay access is still in use by DWM.";

    // If the fence is already passed the wait value, we don't need to wait on
    // it.
    if (d3d12_fence->GetCompletedValue() >= fence_value) {
    return;
    }
    dcomp_texture_available_fence_ = gfx::D3DSharedFence::CreateFromD3D12Fence(
    std::move(d3d12_fence), fence_value);
    return;
    Quyen Le . resolved

    This is almost the same as the code below. Maybe we should move it to a template function.

    Sahir Vellani

    I've abstracted most of the highlighted code into a template function.

    File ui/gl/dc_layer_tree.h
    Line 541, Patchset 38: // IDCompositionDevice6 enables support for D3D12 composition textures.
    Rafael Cintron . resolved
    ```suggestion
    // IDCompositionDevice6 enables support for D3D12 composition textures.
    ```
    Sahir Vellani

    Done

    File ui/gl/gl_features.cc
    Line 138, Patchset 38:// - WebGL and certain SharedImage functionality such as copies to staging

    // textures rely on D3D11 resources. These code paths will continue using
    // D3D11 even when this feature is enabled, with interop handled via
    // D3D11On12.
    Rafael Cintron . resolved

    The comment is not quite correct.

    WebGL will continue to use the D3D11 runtime backed by D3D11 drivers with ANGLE's D3D11 device. SharedImage (copies to staging textures) on the other hand, will use D3D11on12 which is the D3D11 runtime backed by a special driver that emulates the D3D11 DDI on top of D3D12. I wouldn't combine these scenarios together as "interop is handled by D3D11on12" because that is not the case.

    Sahir Vellani

    Done

    Line 143, Patchset 38:// This feature requires SkiaGraphite with a dawn-d3d12 backend, BufferQueue to
    Rafael Cintron . resolved

    Please detail the full set of feature flags that need to be enabled so people can easily try it out themselves.

    Sahir Vellani

    I've included example command line flags

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 40
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Tue, 16 Dec 2025 18:19:43 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
    Comment-In-Reply-To: Quyen Le <lehoan...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Quyen Le (Gerrit)

    unread,
    Dec 23, 2025, 12:22:32 AM12/23/25
    to Sahir Vellani, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron, Sahir Vellani, Sunny Sachanandani and Vasiliy Telezhnikov

    Quyen Le added 6 comments

    Patchset-level comments
    File-level comment, Patchset 41 (Latest):
    Quyen Le . unresolved

    Can you add some tests to `gpu/command_buffer/service/shared_image/d3d_image_backing_factory_unittest.cc` to verify the new D3D11on12 path works correctly.

    File gpu/command_buffer/service/dawn_context_provider.cc
    Line 471, Patchset 41 (Latest): // internal operations like copying to staging textures. In the

    // future, these places will transition to use Dawn for internal
    // operations.
    Quyen Le . unresolved

    nit: This should be placed in a TODO.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 401, Patchset 41 (Latest): bool texture_device_can_use_d3d12_ = false;
    Quyen Le . unresolved

    nit: this can be const since it's initialized in the constructor.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 1153, Patchset 41 (Latest): auto& d3d11_signal_fence = d3d11_signaled_fence_map_[wait_d3d11_device];
    if (!d3d11_signal_fence && wait_d3d11_device &&
    (wait_d3d11_device != texture_d3d11_device_) && write_access) {
    d3d11_signal_fence = gfx::D3DSharedFence::CreateForD3D11(wait_d3d11_device);
    }
    Quyen Le . unresolved

    This seems good to me but we might need to wait for Sunny's review on this part.

    Line 1594, Patchset 41 (Latest): if (want_dcomp_texture_ && !dcomp_texture_) {
    dcomp_texture_ =
    CreateDCompTexture(d3d11_texture_.Get(), alpha_type(), color_space());
    }
    Quyen Le . unresolved

    You might need to move this to before calling `GetPendingWaitFences`. Because `GetPendingWaitFences` checks whether dcomp_texture_ is null or not to decide whether to early return.

    Line 1661, Patchset 41 (Latest): CreateDCompTexture(d3d12_resource_.Get(), alpha_type(), color_space());
    Quyen Le . unresolved

    ditto

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Rafael Cintron
    • Sahir Vellani
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 41
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Tue, 23 Dec 2025 05:22:00 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Jan 1, 2026, 11:31:08 PMJan 1
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 6 comments

    Patchset-level comments
    Quyen Le . unresolved

    Can you add some tests to `gpu/command_buffer/service/shared_image/d3d_image_backing_factory_unittest.cc` to verify the new D3D11on12 path works correctly.

    Sahir Vellani

    Are you comfortable with the tests being added in a follow-up dependent change? The draft CL is in the relation chain.

    File gpu/command_buffer/service/dawn_context_provider.cc
    Line 471, Patchset 41: // internal operations like copying to staging textures. In the

    // future, these places will transition to use Dawn for internal
    // operations.
    Quyen Le . resolved

    nit: This should be placed in a TODO.

    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 401, Patchset 41: bool texture_device_can_use_d3d12_ = false;
    Quyen Le . resolved

    nit: this can be const since it's initialized in the constructor.

    Sahir Vellani

    The texture device and its descriptor are obtained in the constructor body, so I think we need to keep it non-const so that the member can be assigned a value in the constructor body.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 1153, Patchset 41: auto& d3d11_signal_fence = d3d11_signaled_fence_map_[wait_d3d11_device];

    if (!d3d11_signal_fence && wait_d3d11_device &&
    (wait_d3d11_device != texture_d3d11_device_) && write_access) {
    d3d11_signal_fence = gfx::D3DSharedFence::CreateForD3D11(wait_d3d11_device);
    }
    Quyen Le . unresolved

    This seems good to me but we might need to wait for Sunny's review on this part.

    Sahir Vellani

    Sounds good. @sun...@chromium.org Tagging you for visibility.

    Line 1594, Patchset 41: if (want_dcomp_texture_ && !dcomp_texture_) {

    dcomp_texture_ =
    CreateDCompTexture(d3d11_texture_.Get(), alpha_type(), color_space());
    }
    Quyen Le . resolved

    You might need to move this to before calling `GetPendingWaitFences`. Because `GetPendingWaitFences` checks whether dcomp_texture_ is null or not to decide whether to early return.

    Sahir Vellani

    Done

    Line 1661, Patchset 41: CreateDCompTexture(d3d12_resource_.Get(), alpha_type(), color_space());
    Quyen Le . resolved

    ditto

    Sahir Vellani

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 42
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Fri, 02 Jan 2026 04:31:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Quyen Le <lehoan...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sunny Sachanandani (Gerrit)

    unread,
    Jan 6, 2026, 7:30:28 PMJan 6
    to Sahir Vellani, Quyen Le, Vasiliy Telezhnikov, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sahir Vellani and Vasiliy Telezhnikov

    Sunny Sachanandani added 10 comments

    Patchset-level comments
    File-level comment, Patchset 42 (Latest):
    Sunny Sachanandani . resolved

    Apologies for the delay - just back from vacation this week.

    I'm still working through reviewing d3d_image_backing.h/cc which is really the bulk of the CL.

    File gpu/command_buffer/service/dawn_context_provider.cc
    Line 477, Patchset 42 (Latest): auto d3d11on12_device =
    Sunny Sachanandani . unresolved

    nit: explicitly list the type here

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 70, Patchset 42 (Latest): // Keyed mutex resources can not be unwrapped by D3D11On12.
    Sunny Sachanandani . unresolved

    Are we sure about this? Because we unwrap and use keyed mutex D3D11 resources (from camera capture process) in Dawn and it works: https://source.chromium.org/chromium/chromium/src/+/main:third_party/dawn/src/dawn/native/d3d12/DeviceD3D12.cpp;l=641

    In fact, Dawn interop used to exclusively rely on keyed mutex synchronization until around 2022 or so. The code in question has been around for a long time (it was removed and reintroduced in an identical form in a different place).

    Line 93, Patchset 42 (Latest): // TODO: Get command queue from Dawn once the 11On12 bug is fixed.
    Sunny Sachanandani . unresolved

    nit: link the TODO to a bug

    Line 222, Patchset 42 (Latest): T& fence,
    Sunny Sachanandani . unresolved

    nit: d3d_fence

    Line 1275, Patchset 42 (Latest): GetD3D11Device(device, backend_type);
    Sunny Sachanandani . unresolved

    nit: move this call to inside the if block below

    File gpu/command_buffer/service/shared_image/dcomp_image_backing_factory_unittest.cc
    Line 82, Patchset 42 (Latest): gl::InitializeDirectComposition(d3d11_device_, nullptr);
    Sunny Sachanandani . unresolved

    nit: `/*d3d12_command_queue=*/nullptr`

    File gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc
    Line 54, Patchset 42 (Latest): if (!base::FeatureList::IsEnabled(features::kDCompOnD3D12)) {
    Sunny Sachanandani . unresolved

    I think we still want to support D3D12 even if we're not using DComp with it. It's useful for testing the D3D12 backend with Graphite.

    File ui/gl/dc_layer_tree.h
    Line 545, Patchset 42 (Latest): Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue_;
    Sunny Sachanandani . unresolved

    nit: d3d12_command_queue_

    File ui/gl/dcomp_presenter_unittest.cc
    Line 376, Patchset 42 (Latest): InitializeDirectComposition(d3d11_device.Get(), nullptr);
    Sunny Sachanandani . unresolved

    nit: `/*d3d12_command_queue=*/nullptr`

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sahir Vellani
    • Vasiliy Telezhnikov
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Wed, 07 Jan 2026 00:30:17 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Jan 9, 2026, 1:47:12 PMJan 9
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani voted and added 9 comments

    Votes added by Sahir Vellani

    Commit-Queue+1

    9 comments

    File gpu/command_buffer/service/dawn_context_provider.cc
    Line 477, Patchset 42: auto d3d11on12_device =
    Sunny Sachanandani . resolved

    nit: explicitly list the type here

    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 70, Patchset 42: // Keyed mutex resources can not be unwrapped by D3D11On12.
    Sunny Sachanandani . resolved

    Are we sure about this? Because we unwrap and use keyed mutex D3D11 resources (from camera capture process) in Dawn and it works: https://source.chromium.org/chromium/chromium/src/+/main:third_party/dawn/src/dawn/native/d3d12/DeviceD3D12.cpp;l=641

    In fact, Dawn interop used to exclusively rely on keyed mutex synchronization until around 2022 or so. The code in question has been around for a long time (it was removed and reintroduced in an identical form in a different place).

    Sahir Vellani

    Yeah I'm sure. 11On12 throws an error when unwrapping a d3d11 texture that's marked as a keyed mutex. However, it does not seem to have problems with wrapping a D3D12 resource into a keyed mutex D3D11 texture, which it looks like that's all Dawn does. I've specified the comment a bit more to state that we can't go from d3d11 to d3d12 if the d3d11 resource is a keyed mutex.

    Here's some info: https://learn.microsoft.com/en-us/windows/win32/api/d3d11on12/nf-d3d11on12-id3d11on12device2-unwrapunderlyingresource

    Line 93, Patchset 42: // TODO: Get command queue from Dawn once the 11On12 bug is fixed.
    Sunny Sachanandani . resolved

    nit: link the TODO to a bug

    Sahir Vellani

    Done

    Line 222, Patchset 42: T& fence,
    Sunny Sachanandani . resolved

    nit: d3d_fence

    Sahir Vellani

    Done

    Line 1275, Patchset 42: GetD3D11Device(device, backend_type);
    Sunny Sachanandani . resolved

    nit: move this call to inside the if block below

    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/dcomp_image_backing_factory_unittest.cc
    Line 82, Patchset 42: gl::InitializeDirectComposition(d3d11_device_, nullptr);
    Sunny Sachanandani . resolved

    nit: `/*d3d12_command_queue=*/nullptr`

    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/wrapped_sk_image_backing_factory.cc
    Line 54, Patchset 42: if (!base::FeatureList::IsEnabled(features::kDCompOnD3D12)) {
    Sunny Sachanandani . resolved

    I think we still want to support D3D12 even if we're not using DComp with it. It's useful for testing the D3D12 backend with Graphite.

    Sahir Vellani

    Done

    File ui/gl/dc_layer_tree.h
    Line 545, Patchset 42: Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue_;
    Sunny Sachanandani . resolved

    nit: d3d12_command_queue_

    Sahir Vellani

    Done

    File ui/gl/dcomp_presenter_unittest.cc
    Line 376, Patchset 42: InitializeDirectComposition(d3d11_device.Get(), nullptr);
    Sunny Sachanandani . resolved

    nit: `/*d3d12_command_queue=*/nullptr`

    Sahir Vellani

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 43
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Fri, 09 Jan 2026 18:46:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Sunny Sachanandani <sun...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Jan 14, 2026, 2:24:05 PMJan 14
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 1 comment

    Patchset-level comments
    File-level comment, Patchset 43 (Latest):
    Sahir Vellani . resolved

    Hi @sun...@chromium.org, just checking in to see if you had a chance to look at d3d_image_backing.cc :) Any thoughts?

    Gerrit-Comment-Date: Wed, 14 Jan 2026 19:23:54 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sunny Sachanandani (Gerrit)

    unread,
    Jan 23, 2026, 7:43:53 PMJan 23
    to Sahir Vellani, Quyen Le, Vasiliy Telezhnikov, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sahir Vellani and Vasiliy Telezhnikov

    Sunny Sachanandani added 14 comments

    Patchset-level comments
    Sunny Sachanandani . resolved

    Still reviewing the fence logic, but I thought there was sufficient feedback to send out.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 462, Patchset 43 (Latest): bool is_texture_unwrapped_ GUARDED_BY(lock_) = false;
    Sunny Sachanandani . unresolved

    nit: `is_texture_unwrapped_for_d3d12_`?

    Line 376, Patchset 43 (Latest): Microsoft::WRL::ComPtr<ID3D12CommandQueue> d3d12_none_command_queue_;
    Sunny Sachanandani . unresolved

    nit: `d3d12_texture_unwrap_command_queue_`?

    Line 293, Patchset 43 (Latest): bool BeginAccessD3D12(Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device,
    Sunny Sachanandani . unresolved

    nit: `d3d11on12_device` maybe?

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 77, Patchset 43 (Latest):// Unwraps a D3D11 texture to its underlying D3D12 resource. Note that
    Sunny Sachanandani . unresolved

    ```suggestion
    // Unwraps a D3D11on12 texture to its underlying D3D12 resource. Note that
    ```

    Line 80, Patchset 43 (Latest):Microsoft::WRL::ComPtr<ID3D12Resource> PrepareTextureForD3D12(
    Sunny Sachanandani . unresolved

    nit: `PrepareD3D11on12TextureForD3D12` maybe? Or maybe `UnwrapD3D11on12TextureForD3D12`? Naming is hard so I'll leave it up to you (this is a nit after all).

    Line 95, Patchset 43 (Latest): // TODO(crbug.com/474325209): Get command queue from Dawn once the 11On12 bug
    // is fixed.
    Sunny Sachanandani . unresolved

    nit: maybe this TODO should be at the call-site of `PrepareTextureForD3D12` since that's where we pass it it the non-Dawn command queue, right?

    Line 118, Patchset 43 (Latest):// Returns the D3D11 texture back to the 11On12 layer.
    Sunny Sachanandani . unresolved

    ```suggestion
    // Returns the D3D11on12 texture back to the 11On12 layer.
    ```

    Line 119, Patchset 43 (Latest):void PrepareTextureForD3D11(ID3D11Resource* d3d11_texture) {
    Sunny Sachanandani . unresolved

    nit: `PrepareD3D11on12TextureForD3D11` or perhaps `ReturnD3D11on12TextureToD3D11`? Naming is hard so I'll leave it up to you (this is a nit after all).

    Line 928, Patchset 43 (Latest): GetD3D11Device(device, backend_type);
    Sunny Sachanandani . unresolved

    This will cause the 11on12 device to be unnecessarily created on all WebGPU D3D12 devices when the `DCompOnD3D12` feature is enabled.

    I think we only want the 11on12 logic for the Graphite Dawn D3D12 device so we should make it conditional on `is_graphite_device` somehow.

    Line 960, Patchset 43 (Latest): shared_texture_memory =
    CreateDawnSharedTextureMemory(device, d3d12_resource_);
    Sunny Sachanandani . unresolved

    This caches the `SharedTextureMemory` on the first access, but we don't want that since a new `d3d12_resource_` could be set after every `UnwrapUnderlyingResource` call, right?

    I'm starting to think that the D3D12 resource unwrapping and returning should be moved to Dawn's `SharedTextureMemory` `Begin/EndAccess` implementation. The rationale is that the only user of the texture via D3D12 is Dawn. This would be done by making a variant of `SharedTextureMemory` on the D3D12 backend that takes a D3D11 texture which Dawn assumes is a D3D11on12 texture from the same device. Then Dawn can handle the unwrapping and returning internally (including the special unwrap command queue). Dawn validation can even assert that the texture doesn't have a keyed mutex.

    Line 1011, Patchset 43 (Latest): if (!is_texture_unwrapped_ && d3d12_resource_) {
    // The D3D11 texture had to be unwrapped in order to create a shared

    // texture memory for the D3D12 resource. Since it was not already in an
    // unwrapped state, return the resource back to the 11On12 translation
    // layer.
    PrepareTextureForD3D11(d3d11_texture_.Get());
    }
    Sunny Sachanandani . unresolved

    Is this correct? The texture was unwrapped for D3D12 usage by Dawn which will happen soon after `ProduceDawn` in `BeginAccessDawn`. Do we somehow recreate the `SharedTextureMemory` there or signal to Dawn the new `d3d12_resource_` in some other way?

    File gpu/command_buffer/service/shared_image/d3d_image_representation.cc
    Line 81, Patchset 43 (Latest): if (!d3d_image_backing->BeginAccessD3D11(d3d11_device_, write_access)) {
    Sunny Sachanandani . unresolved

    I believe this is one of the two remaining callers of `BeginAccessD3D11`. We could instead call `BeginAccessD3D` here and it should dispatch to `BeginAccessD3D11` internally. After that, we can make `BeginAccessD3D11` private to `D3DImageBacking`.

    Line 403, Patchset 43 (Latest): if (!d3d_backing->BeginAccessD3D11(texture_device, /*write_access=*/false,
    Sunny Sachanandani . unresolved

    This is the other one.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sahir Vellani
    • Vasiliy Telezhnikov
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Sat, 24 Jan 2026 00:43:43 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rafael Cintron (Gerrit)

    unread,
    Jan 26, 2026, 5:30:59 PMJan 26
    to Sahir Vellani, Quyen Le, Vasiliy Telezhnikov, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Sahir Vellani and Vasiliy Telezhnikov

    Rafael Cintron added 1 comment

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 960, Patchset 43 (Latest): shared_texture_memory =
    CreateDawnSharedTextureMemory(device, d3d12_resource_);
    Sunny Sachanandani . unresolved

    This caches the `SharedTextureMemory` on the first access, but we don't want that since a new `d3d12_resource_` could be set after every `UnwrapUnderlyingResource` call, right?

    I'm starting to think that the D3D12 resource unwrapping and returning should be moved to Dawn's `SharedTextureMemory` `Begin/EndAccess` implementation. The rationale is that the only user of the texture via D3D12 is Dawn. This would be done by making a variant of `SharedTextureMemory` on the D3D12 backend that takes a D3D11 texture which Dawn assumes is a D3D11on12 texture from the same device. Then Dawn can handle the unwrapping and returning internally (including the special unwrap command queue). Dawn validation can even assert that the texture doesn't have a keyed mutex.

    Rafael Cintron

    @sun...@chromium.org, code in SharedImage submits its own D3D11 work via various helpers in `d3d_image_backing.cc` for creating creating staging textures, copying texture and calling UpdateSubresource. If Dawn manages the transition as you suggest, would that code continue to work?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Sahir Vellani
    • Vasiliy Telezhnikov
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Mon, 26 Jan 2026 22:30:49 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sunny Sachanandani <sun...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Jan 27, 2026, 4:17:56 PMJan 27
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani voted and added 13 comments

    Votes added by Sahir Vellani

    Commit-Queue+1

    13 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 462, Patchset 43: bool is_texture_unwrapped_ GUARDED_BY(lock_) = false;
    Sunny Sachanandani . resolved

    nit: `is_texture_unwrapped_for_d3d12_`?

    Sahir Vellani

    Done

    Line 376, Patchset 43: Microsoft::WRL::ComPtr<ID3D12CommandQueue> d3d12_none_command_queue_;
    Sunny Sachanandani . resolved

    nit: `d3d12_texture_unwrap_command_queue_`?

    Sahir Vellani

    Done

    Line 293, Patchset 43: bool BeginAccessD3D12(Microsoft::WRL::ComPtr<ID3D11Device> d3d11_device,
    Sunny Sachanandani . resolved

    nit: `d3d11on12_device` maybe?

    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 77, Patchset 43:// Unwraps a D3D11 texture to its underlying D3D12 resource. Note that
    Sunny Sachanandani . resolved

    ```suggestion
    // Unwraps a D3D11on12 texture to its underlying D3D12 resource. Note that
    ```

    Sahir Vellani

    Done

    Line 80, Patchset 43:Microsoft::WRL::ComPtr<ID3D12Resource> PrepareTextureForD3D12(
    Sunny Sachanandani . resolved

    nit: `PrepareD3D11on12TextureForD3D12` maybe? Or maybe `UnwrapD3D11on12TextureForD3D12`? Naming is hard so I'll leave it up to you (this is a nit after all).

    Sahir Vellani

    Done

    Line 95, Patchset 43: // TODO(crbug.com/474325209): Get command queue from Dawn once the 11On12 bug
    // is fixed.
    Sunny Sachanandani . resolved

    nit: maybe this TODO should be at the call-site of `PrepareTextureForD3D12` since that's where we pass it it the non-Dawn command queue, right?

    Sahir Vellani

    I'm moved it to the declaration of GetOrCreateCommandQueueFor11On12

    Line 118, Patchset 43:// Returns the D3D11 texture back to the 11On12 layer.
    Sunny Sachanandani . resolved

    ```suggestion
    // Returns the D3D11on12 texture back to the 11On12 layer.
    ```

    Sahir Vellani

    Done

    Line 119, Patchset 43:void PrepareTextureForD3D11(ID3D11Resource* d3d11_texture) {
    Sunny Sachanandani . resolved

    nit: `PrepareD3D11on12TextureForD3D11` or perhaps `ReturnD3D11on12TextureToD3D11`? Naming is hard so I'll leave it up to you (this is a nit after all).

    Sahir Vellani

    Done

    Line 928, Patchset 43: GetD3D11Device(device, backend_type);
    Sunny Sachanandani . unresolved

    This will cause the 11on12 device to be unnecessarily created on all WebGPU D3D12 devices when the `DCompOnD3D12` feature is enabled.

    I think we only want the 11on12 logic for the Graphite Dawn D3D12 device so we should make it conditional on `is_graphite_device` somehow.

    Sahir Vellani

    This function is also called in `BeginAccessDawn`. To address this comment, I've added the `SharedContextState` to D3DImageRepresentation so that it is accessible during `BeginAccessDawn`. Should this be done in a follow-up change?

    Line 960, Patchset 43: shared_texture_memory =
    CreateDawnSharedTextureMemory(device, d3d12_resource_);
    Sunny Sachanandani . resolved

    This caches the `SharedTextureMemory` on the first access, but we don't want that since a new `d3d12_resource_` could be set after every `UnwrapUnderlyingResource` call, right?

    I'm starting to think that the D3D12 resource unwrapping and returning should be moved to Dawn's `SharedTextureMemory` `Begin/EndAccess` implementation. The rationale is that the only user of the texture via D3D12 is Dawn. This would be done by making a variant of `SharedTextureMemory` on the D3D12 backend that takes a D3D11 texture which Dawn assumes is a D3D11on12 texture from the same device. Then Dawn can handle the unwrapping and returning internally (including the special unwrap command queue). Dawn validation can even assert that the texture doesn't have a keyed mutex.

    Sahir Vellani

    The DComp texture also uses the unwrapped resource, so we would need to still do the unwrapping in shared image code. It is a good idea though, and would make the code cleaner. I'm hoping this is a temporary thing and can be removed once we can propagate the 12 resource throughout Chromium. In order to address your concern, I have made the change to unwrap the D3D11on12 texture in BeginAccessDawn (if it isn't already unwrapped). If it is a new resource, I erase and then re-create the SharedTextureMemory.

    Line 1011, Patchset 43: if (!is_texture_unwrapped_ && d3d12_resource_) {

    // The D3D11 texture had to be unwrapped in order to create a shared
    // texture memory for the D3D12 resource. Since it was not already in an
    // unwrapped state, return the resource back to the 11On12 translation
    // layer.
    PrepareTextureForD3D11(d3d11_texture_.Get());
    }
    Sunny Sachanandani . resolved

    Is this correct? The texture was unwrapped for D3D12 usage by Dawn which will happen soon after `ProduceDawn` in `BeginAccessDawn`. Do we somehow recreate the `SharedTextureMemory` there or signal to Dawn the new `d3d12_resource_` in some other way?

    Sahir Vellani

    No you're right, this is not necessary. We return the texture in EndAccessCommon.

    File gpu/command_buffer/service/shared_image/d3d_image_representation.cc
    Line 81, Patchset 43: if (!d3d_image_backing->BeginAccessD3D11(d3d11_device_, write_access)) {
    Sunny Sachanandani . resolved

    I believe this is one of the two remaining callers of `BeginAccessD3D11`. We could instead call `BeginAccessD3D` here and it should dispatch to `BeginAccessD3D11` internally. After that, we can make `BeginAccessD3D11` private to `D3DImageBacking`.

    Sahir Vellani

    Done

    Line 403, Patchset 43: if (!d3d_backing->BeginAccessD3D11(texture_device, /*write_access=*/false,
    Sunny Sachanandani . resolved

    This is the other one.

    Sahir Vellani

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 44
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Tue, 27 Jan 2026 21:17:45 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Quyen Le (Gerrit)

    unread,
    Jan 28, 2026, 1:42:39 AMJan 28
    to Sahir Vellani, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Rafael Cintron, Sahir Vellani, Sunny Sachanandani and Vasiliy Telezhnikov

    Quyen Le added 1 comment

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 960, Patchset 43: shared_texture_memory =
    CreateDawnSharedTextureMemory(device, d3d12_resource_);
    Sunny Sachanandani . resolved

    This caches the `SharedTextureMemory` on the first access, but we don't want that since a new `d3d12_resource_` could be set after every `UnwrapUnderlyingResource` call, right?

    I'm starting to think that the D3D12 resource unwrapping and returning should be moved to Dawn's `SharedTextureMemory` `Begin/EndAccess` implementation. The rationale is that the only user of the texture via D3D12 is Dawn. This would be done by making a variant of `SharedTextureMemory` on the D3D12 backend that takes a D3D11 texture which Dawn assumes is a D3D11on12 texture from the same device. Then Dawn can handle the unwrapping and returning internally (including the special unwrap command queue). Dawn validation can even assert that the texture doesn't have a keyed mutex.

    Sahir Vellani

    The DComp texture also uses the unwrapped resource, so we would need to still do the unwrapping in shared image code. It is a good idea though, and would make the code cleaner. I'm hoping this is a temporary thing and can be removed once we can propagate the 12 resource throughout Chromium. In order to address your concern, I have made the change to unwrap the D3D11on12 texture in BeginAccessDawn (if it isn't already unwrapped). If it is a new resource, I erase and then re-create the SharedTextureMemory.

    Quyen Le

    I think if we want to use D3D12 as the main API (for Skia and Dawn), we should create the D3D12 texture and pass them to this backing. Then wrap it in the D3D11 texture. Not passing D3D11 texture and unwrap. I presume Skia/Dawn should use the D3D12 texture more than DComp. If it requires too much work then it's fine to do in follow up CLs. Maybe adding a TODO?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Rafael Cintron
    • Sahir Vellani
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Wed, 28 Jan 2026 06:42:08 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sahir Vellani <sahir....@microsoft.com>
    Comment-In-Reply-To: Sunny Sachanandani <sun...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Feb 17, 2026, 1:47:59 PMFeb 17
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 2 comments

    Patchset-level comments
    File-level comment, Patchset 48 (Latest):
    Sahir Vellani . resolved

    @sun...@chromium.org We reached out to the D3D folks and it turns out that the D3D11 texture can be read from while being checked out for D3D12 use. Regarding the media device however, I think that we should stick to using the D3D12 video decoder when this feature is enabled. A follow up work item would be to bypass the shared handle creation and D3D11-12 resource transfer when the D3D12 video decoder is being created, and directly supply our unwrapped D3D12 resource.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 1153, Patchset 41: auto& d3d11_signal_fence = d3d11_signaled_fence_map_[wait_d3d11_device];
    if (!d3d11_signal_fence && wait_d3d11_device &&
    (wait_d3d11_device != texture_d3d11_device_) && write_access) {
    d3d11_signal_fence = gfx::D3DSharedFence::CreateForD3D11(wait_d3d11_device);
    }
    Quyen Le . resolved

    This seems good to me but we might need to wait for Sunny's review on this part.

    Sahir Vellani

    Sounds good. @sun...@chromium.org Tagging you for visibility.

    Sahir Vellani

    @sun...@chromium.org I've restored this to EndAccessD3D, as discussed offline.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 48
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Tue, 17 Feb 2026 18:47:52 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sahir Vellani <sahir....@microsoft.com>
    Comment-In-Reply-To: Quyen Le <lehoan...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Feb 19, 2026, 1:51:19 PMFeb 19
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 1 comment

    Patchset-level comments
    Sahir Vellani . resolved

    @sun...@chromium.org Gentle ping 😊

    Gerrit-Comment-Date: Thu, 19 Feb 2026 18:51:10 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sunny Sachanandani (Gerrit)

    unread,
    Feb 20, 2026, 8:01:14 PM (13 days ago) Feb 20
    to Sahir Vellani, Quyen Le, Vasiliy Telezhnikov, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sahir Vellani and Vasiliy Telezhnikov

    Sunny Sachanandani added 14 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 452, Patchset 54 (Latest): const bool want_dcomp_texture_;
    Sunny Sachanandani . unresolved
    nit:
    ```suggestion
    const bool want_dcomp_texture_ = false;
    ```
    Line 401, Patchset 54 (Latest): Microsoft::WRL::ComPtr<ID3D12Resource> d3d12_resource_;
    Sunny Sachanandani . unresolved

    nit: can we separate this out from the `d3d12_buffer_` block since otherwise it seems the comment applies to this as well?

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 172, Patchset 54 (Latest): } else if (backend_type == wgpu::BackendType::D3D12 &&
    base::FeatureList::IsEnabled(features::kDCompOnD3D12) &&
    is_graphite_device) {
    Sunny Sachanandani . unresolved
    nit:
    ```suggestion
    } else if (base::FeatureList::IsEnabled(features::kDCompOnD3D12) &&
    backend_type == wgpu::BackendType::D3D12 &&
    is_graphite_device) {
    ```
    Line 680, Patchset 54 (Latest): use_update_subresource1_(false),
    want_dcomp_texture_(false),
    Sunny Sachanandani . unresolved

    nit: unnecessary with the suggested change in the header

    ```suggestion
    use_update_subresource1_(false),
    ```
    Line 938, Patchset 54 (Latest): // Unwrapping is not allowed if the texture is used with a keyed mutex.
    Sunny Sachanandani . unresolved

    nit: can you add a comment about what the plan is for keyed mutex textures e.g. those originating from the camera/capture process or at least a TODO to that effect?

    Line 943, Patchset 54 (Latest): // TODO(481916492) Consider creating a D3D12 resource and wrapping it
    Sunny Sachanandani . unresolved
    nit:
    ```suggestion
    // TODO(crbug.com/481916492) Consider creating a D3D12 resource and wrapping it
    ```
    Line 945, Patchset 54 (Latest): auto d3d12_resource =
    is_texture_unwrapped_for_d3d12_
    ? nullptr
    : PrepareD3D11on12TextureForD3D12(
    d3d11_texture_.Get(), GetOrCreateCommandQueueFor11On12());
    if (d3d12_resource) {
    is_texture_unwrapped_for_d3d12_ = true;
    }
    // We want to avoid churning DCompTextures as much as possible. However,
    // `d3d12_resource` may not equal `d3d12_resource_` in the case where

    // D3D11on12 has decided to allocate a new object for the resource.
    // Example: Developer calls UpdateSubresource to modify a resource that
    // is currently being read or written to by the GPU.

    if (d3d12_resource && d3d12_resource != d3d12_resource_) {
    dcomp_texture_.Reset();
    d3d12_resource_ = d3d12_resource;
    }
    Sunny Sachanandani . unresolved
    ```suggestion
    auto d3d12_resource = d3d12_resource_;
    if (!is_texture_unwrapped_for_d3d12) {
    d3d12_resource = PrepareD3D11on12TextureForD3D12(
    d3d11_texture_.Get(), GetOrCreateCommandQueueFor11On12());
    is_texture_unwrapped_for_d3d12 = !!d3d12_resource;
    }
    // We want to avoid churning DCompTextures as much as possible. However,
    // `d3d12_resource` may not equal `d3d12_resource_` in the case where

    // D3D11on12 has decided to allocate a new object for the resource.
            // Example: Developer calls UpdateSubresource to modify a resource that
    // is currently being read or written to by the GPU.
    if (d3d12_resource != d3d12_resource_) {
    dcomp_texture_.Reset();
    d3d12_resource_ = d3d12_resource;
    }
    ```
    Line 969, Patchset 54 (Latest): if (dawn_d3d11_device == texture_d3d11_device_ && !use_keyed_mutex &&
    backend_type == wgpu::BackendType::D3D12) {
    Sunny Sachanandani . unresolved

    I think this can make the keyed mutex case also work correctly in the sense that it won't be unwrapped into a D3D12 resource but it will still take the shared handle path correctly. WDYT?

    ```suggestion
    if (dawn_d3d11_device == texture_d3d11_device_ && d3d12_resource_ &&
    backend_type == wgpu::BackendType::D3D12) {
    ```
    Line 1031, Patchset 54 (Latest): // backing is created from an existing DXGISharedHandleState. The STM
    // is stored inside DXGISharedHandleState but not in the 2nd backing's
    Sunny Sachanandani . unresolved

    nit: was this unintentional - not that I mind it per se, but I also wouldn't want to break git blame output unnecessarily

    Line 1275, Patchset 54 (Latest): if (backend_type == wgpu::BackendType::D3D11 ||
    (backend_type == wgpu::BackendType::D3D12 &&
    base::FeatureList::IsEnabled(features::kDCompOnD3D12))) {
    auto* dawn_context_provider =
    context_state ? context_state->dawn_context_provider() : nullptr;
    const bool is_graphite_device =
    dawn_context_provider &&
    dawn_context_provider->GetDevice().Get() == device.Get();
    dawn_d3d11_device =
    GetD3D11Device(device, backend_type, is_graphite_device);
    }
    Sunny Sachanandani . unresolved

    I think we can get away without passing in a SharedContextState here by relying on the presence of `d3d12_resource_` with `wgpu::BackendType::D3D12` since that implies `ProduceDawn` took the graphite D3D11on12 path already. WDYT?

    Line 1296, Patchset 54 (Latest): // If `ProduceDawn` was recently invoked, the texture may already be
    // unwrapped. If so, go straight to using `d3d12_resource_` to create
    // shared texture memory. If not, unwrap it.
    auto d3d12_resource =
    is_texture_unwrapped_for_d3d12_
    ? nullptr
    : PrepareD3D11on12TextureForD3D12(
    d3d11_texture_.Get(), GetOrCreateCommandQueueFor11On12());
    if (d3d12_resource) {
    is_texture_unwrapped_for_d3d12_ = true;
    if (d3d12_resource != d3d12_resource_) {
    d3d12_resource_ = d3d12_resource;
    // Erase shared texture memory that would have been created for the
    // previous resource.
    if (dxgi_shared_handle_state_) {
    dxgi_shared_handle_state_->EraseDawnSharedTextureMemory(device);
    auto shared_texture_memory =
    CreateDawnSharedTextureMemory(device, d3d12_resource_);
    dxgi_shared_handle_state_->MaybeCacheSharedTextureMemory(
    device, shared_texture_memory);
    }
    // Reset dcomp texture so that it will be recreated with the new
    // resource.
    dcomp_texture_.Reset();
    }
    }
    Sunny Sachanandani . unresolved

    Can we factor out this code which is basically the same as what's in ProduceDawn: if texture is not unwrapped for D3D12, unwrap it, if the unwrapped texture doesn't match `d3d12_resource_` also reset `dcomp_texture_`, handle errors along the way

    Line 1579, Patchset 54 (Latest): // to be completed on `EndAccess`. This is necessary in the case where DAWN
    // may need to access the backing while WebGL is still using it, and
    // therefore must wait for WebGL's work to be completed before starting the
    // access.
    Sunny Sachanandani . unresolved

    nit:

    ```suggestion
    // to be completed on `EndAccess`. This is necessary in the case where Dawn
    // may need to access the backing after WebGL has accessed it for write, and
    // therefore must wait for WebGL work to be completed.
    ```
    Line 1688, Patchset 54 (Latest): if (d3d12_resource && d3d12_resource != d3d12_resource_) {
    Sunny Sachanandani . unresolved
    nit: redundant check
    ```suggestion
    if (d3d12_resource != d3d12_resource_) {
    ```
    Line 1694, Patchset 54 (Latest): d3d12_resource_.Reset();
    Sunny Sachanandani . unresolved

    Should we also reset the `dcomp_texture_` here?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sahir Vellani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 54
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Sat, 21 Feb 2026 01:01:09 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Feb 23, 2026, 6:58:43 PM (10 days ago) Feb 23
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 15 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 452, Patchset 54: const bool want_dcomp_texture_;
    Sunny Sachanandani . resolved
    nit:
    ```suggestion
    const bool want_dcomp_texture_ = false;
    ```
    Sahir Vellani

    Done

    Line 401, Patchset 54: Microsoft::WRL::ComPtr<ID3D12Resource> d3d12_resource_;
    Sunny Sachanandani . resolved

    nit: can we separate this out from the `d3d12_buffer_` block since otherwise it seems the comment applies to this as well?

    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 172, Patchset 54: } else if (backend_type == wgpu::BackendType::D3D12 &&

    base::FeatureList::IsEnabled(features::kDCompOnD3D12) &&
    is_graphite_device) {
    Sunny Sachanandani . resolved
    nit:
    ```suggestion
    } else if (base::FeatureList::IsEnabled(features::kDCompOnD3D12) &&
    backend_type == wgpu::BackendType::D3D12 &&
    is_graphite_device) {
    ```
    Sahir Vellani

    Done

    Line 680, Patchset 54: use_update_subresource1_(false),
    want_dcomp_texture_(false),
    Sunny Sachanandani . resolved

    nit: unnecessary with the suggested change in the header

    ```suggestion
    use_update_subresource1_(false),
    ```
    Sahir Vellani

    Done

    Line 928, Patchset 43: GetD3D11Device(device, backend_type);
    Sunny Sachanandani . resolved

    This will cause the 11on12 device to be unnecessarily created on all WebGPU D3D12 devices when the `DCompOnD3D12` feature is enabled.

    I think we only want the 11on12 logic for the Graphite Dawn D3D12 device so we should make it conditional on `is_graphite_device` somehow.

    Sahir Vellani

    This function is also called in `BeginAccessDawn`. To address this comment, I've added the `SharedContextState` to D3DImageRepresentation so that it is accessible during `BeginAccessDawn`. Should this be done in a follow-up change?

    Sahir Vellani

    Done

    Line 938, Patchset 54: // Unwrapping is not allowed if the texture is used with a keyed mutex.
    Sunny Sachanandani . resolved

    nit: can you add a comment about what the plan is for keyed mutex textures e.g. those originating from the camera/capture process or at least a TODO to that effect?

    Sahir Vellani

    I've moved the TODO below up to this location. It will solve this problem.

    Line 943, Patchset 54: // TODO(481916492) Consider creating a D3D12 resource and wrapping it
    Sunny Sachanandani . resolved
    nit:
    ```suggestion
    // TODO(crbug.com/481916492) Consider creating a D3D12 resource and wrapping it
    ```
    Sahir Vellani

    Done

    Line 945, Patchset 54: auto d3d12_resource =

    is_texture_unwrapped_for_d3d12_
    ? nullptr
    : PrepareD3D11on12TextureForD3D12(
    d3d11_texture_.Get(), GetOrCreateCommandQueueFor11On12());
    if (d3d12_resource) {
    is_texture_unwrapped_for_d3d12_ = true;
    }
    // We want to avoid churning DCompTextures as much as possible. However,
    // `d3d12_resource` may not equal `d3d12_resource_` in the case where
    // D3D11on12 has decided to allocate a new object for the resource.
    // Example: Developer calls UpdateSubresource to modify a resource that
    // is currently being read or written to by the GPU.
    if (d3d12_resource && d3d12_resource != d3d12_resource_) {
    dcomp_texture_.Reset();
    d3d12_resource_ = d3d12_resource;
    }
    Sunny Sachanandani . resolved
    ```suggestion
    auto d3d12_resource = d3d12_resource_;
    if (!is_texture_unwrapped_for_d3d12) {
    d3d12_resource = PrepareD3D11on12TextureForD3D12(
    d3d11_texture_.Get(), GetOrCreateCommandQueueFor11On12());
    is_texture_unwrapped_for_d3d12 = !!d3d12_resource;
    }
    // We want to avoid churning DCompTextures as much as possible. However,
    // `d3d12_resource` may not equal `d3d12_resource_` in the case where
    // D3D11on12 has decided to allocate a new object for the resource.
    // Example: Developer calls UpdateSubresource to modify a resource that
    // is currently being read or written to by the GPU.
    if (d3d12_resource != d3d12_resource_) {
    dcomp_texture_.Reset();
    d3d12_resource_ = d3d12_resource;
    }
    ```
    Sahir Vellani

    Done

    Line 969, Patchset 54: if (dawn_d3d11_device == texture_d3d11_device_ && !use_keyed_mutex &&

    backend_type == wgpu::BackendType::D3D12) {
    Sunny Sachanandani . resolved

    I think this can make the keyed mutex case also work correctly in the sense that it won't be unwrapped into a D3D12 resource but it will still take the shared handle path correctly. WDYT?

    ```suggestion
    if (dawn_d3d11_device == texture_d3d11_device_ && d3d12_resource_ &&
    backend_type == wgpu::BackendType::D3D12) {
    ```
    Sahir Vellani

    Done

    Line 1031, Patchset 54: // backing is created from an existing DXGISharedHandleState. The STM

    // is stored inside DXGISharedHandleState but not in the 2nd backing's
    Sunny Sachanandani . resolved

    nit: was this unintentional - not that I mind it per se, but I also wouldn't want to break git blame output unnecessarily

    Sahir Vellani

    Unfortunately it is the result of `git cl format`. I don't know how to avoid a presubmit error otherwise.

    Line 1275, Patchset 54: if (backend_type == wgpu::BackendType::D3D11 ||

    (backend_type == wgpu::BackendType::D3D12 &&
    base::FeatureList::IsEnabled(features::kDCompOnD3D12))) {
    auto* dawn_context_provider =
    context_state ? context_state->dawn_context_provider() : nullptr;
    const bool is_graphite_device =
    dawn_context_provider &&
    dawn_context_provider->GetDevice().Get() == device.Get();
    dawn_d3d11_device =
    GetD3D11Device(device, backend_type, is_graphite_device);
    }
    Sunny Sachanandani . resolved

    I think we can get away without passing in a SharedContextState here by relying on the presence of `d3d12_resource_` with `wgpu::BackendType::D3D12` since that implies `ProduceDawn` took the graphite D3D11on12 path already. WDYT?

    Sahir Vellani

    Done

    Line 1296, Patchset 54: // If `ProduceDawn` was recently invoked, the texture may already be

    // unwrapped. If so, go straight to using `d3d12_resource_` to create
    // shared texture memory. If not, unwrap it.
    auto d3d12_resource =
    is_texture_unwrapped_for_d3d12_
    ? nullptr
    : PrepareD3D11on12TextureForD3D12(
    d3d11_texture_.Get(), GetOrCreateCommandQueueFor11On12());
    if (d3d12_resource) {
    is_texture_unwrapped_for_d3d12_ = true;
    if (d3d12_resource != d3d12_resource_) {
    d3d12_resource_ = d3d12_resource;
    // Erase shared texture memory that would have been created for the
    // previous resource.
    if (dxgi_shared_handle_state_) {
    dxgi_shared_handle_state_->EraseDawnSharedTextureMemory(device);
    auto shared_texture_memory =
    CreateDawnSharedTextureMemory(device, d3d12_resource_);
    dxgi_shared_handle_state_->MaybeCacheSharedTextureMemory(
    device, shared_texture_memory);
    }
    // Reset dcomp texture so that it will be recreated with the new
    // resource.
    dcomp_texture_.Reset();
    }
    }
    Sunny Sachanandani . resolved

    Can we factor out this code which is basically the same as what's in ProduceDawn: if texture is not unwrapped for D3D12, unwrap it, if the unwrapped texture doesn't match `d3d12_resource_` also reset `dcomp_texture_`, handle errors along the way

    Sahir Vellani

    Done

    Line 1579, Patchset 54: // to be completed on `EndAccess`. This is necessary in the case where DAWN

    // may need to access the backing while WebGL is still using it, and
    // therefore must wait for WebGL's work to be completed before starting the
    // access.
    Sunny Sachanandani . resolved

    nit:

    ```suggestion
    // to be completed on `EndAccess`. This is necessary in the case where Dawn
    // may need to access the backing after WebGL has accessed it for write, and
    // therefore must wait for WebGL work to be completed.
    ```
    Sahir Vellani

    Done

    Line 1688, Patchset 54: if (d3d12_resource && d3d12_resource != d3d12_resource_) {
    Sunny Sachanandani . resolved
    nit: redundant check
    ```suggestion
    if (d3d12_resource != d3d12_resource_) {
    ```
    Sahir Vellani

    Done

    Line 1694, Patchset 54: d3d12_resource_.Reset();
    Sunny Sachanandani . resolved

    Should we also reset the `dcomp_texture_` here?

    Sahir Vellani

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 55
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Mon, 23 Feb 2026 23:58:37 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sahir Vellani <sahir....@microsoft.com>
    Comment-In-Reply-To: Sunny Sachanandani <sun...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sunny Sachanandani (Gerrit)

    unread,
    Feb 24, 2026, 6:20:06 PM (9 days ago) Feb 24
    to Sahir Vellani, Quyen Le, Vasiliy Telezhnikov, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sahir Vellani and Vasiliy Telezhnikov

    Sunny Sachanandani added 3 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 943, Patchset 55 (Latest): EnsureD3D12Resource();
    Sunny Sachanandani . unresolved

    You should check for success of EnsureD3D12Resource() and early out based on that.

    Line 1004, Patchset 55 (Latest): if (is_graphite_device) {
    Sunny Sachanandani . unresolved

    You might want to skip caching the STM for the D3D11on12 path here - see comment below first.

    Line 1306, Patchset 55 (Latest): dxgi_shared_handle_state_->EraseDawnSharedTextureMemory(device);
    Sunny Sachanandani . unresolved

    Q: do we even have a `dxgi_shared_handle_state_` when we use the D3D11on12 path for a backing?

    We actually might need to clear the cached STM on `dawn_shared_texture_cache_` instead of `dxgi_shared_handle_state_`. You'll need to add a method to `DawnSharedTextureCache` to clear the old entry - there's no existing method to do this because we never remove from the cache currently (it's only used for Graphite's STM which is long lived).

    Alternatively, you could skip caching the STM in `ProduceDawn` with a TODO about adding it back if you prefer that instead.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sahir Vellani
    • Vasiliy Telezhnikov
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Tue, 24 Feb 2026 23:19:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Feb 24, 2026, 9:49:38 PM (9 days ago) Feb 24
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 3 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 943, Patchset 55: EnsureD3D12Resource();
    Sunny Sachanandani . resolved

    You should check for success of EnsureD3D12Resource() and early out based on that.

    Sahir Vellani

    Done

    Line 1004, Patchset 55: if (is_graphite_device) {
    Sunny Sachanandani . resolved

    You might want to skip caching the STM for the D3D11on12 path here - see comment below first.

    Sahir Vellani

    Acknowledged

    Line 1306, Patchset 55: dxgi_shared_handle_state_->EraseDawnSharedTextureMemory(device);
    Sunny Sachanandani . resolved

    Q: do we even have a `dxgi_shared_handle_state_` when we use the D3D11on12 path for a backing?

    We actually might need to clear the cached STM on `dawn_shared_texture_cache_` instead of `dxgi_shared_handle_state_`. You'll need to add a method to `DawnSharedTextureCache` to clear the old entry - there's no existing method to do this because we never remove from the cache currently (it's only used for Graphite's STM which is long lived).

    Alternatively, you could skip caching the STM in `ProduceDawn` with a TODO about adding it back if you prefer that instead.

    Sahir Vellani

    Thanks for catching the mistake. I don't think it would be a common scenario to erase and recreate the STM. Therefore I'd rather address this comment than not have any caching at all. I realized that the resource can change during other accesses and render the STM invalid. I've added a bit that tracks when we need to create a new STM. I thought that might be a bit more memory friendly than maintaining a copy of the backing resource of the old STM.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 56
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Wed, 25 Feb 2026 02:49:31 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sunny Sachanandani <sun...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rafael Cintron (Gerrit)

    unread,
    Feb 25, 2026, 4:08:49 PM (8 days ago) Feb 25
    to Sahir Vellani, Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Sahir Vellani, Sunny Sachanandani and Vasiliy Telezhnikov

    Rafael Cintron added 13 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 117, Patchset 55:void PrepareD3D11on12TextureForD3D11(ID3D11Resource* d3d11_texture) {
    Rafael Cintron . unresolved

    Please add a CHECK at the beginning of the method that `is_texture_unwrapped_for_d3d12_` is false.

    Line 122, Patchset 55: CHECK_EQ(hr, S_OK) << ", QueryInterface failed: "
    << logging::SystemErrorCodeToString(hr);
    Rafael Cintron . unresolved

    By the time you get to this code, QI to `ID3D11On12Device2` should always succeed. No need to waste DLL bytes on this string, or the call to SystemErrorCodeToString.

    Line 178, Patchset 56 (Latest): if (FAILED(hr)) {
    LOG(ERROR) << "Failed to get D3D11 device from D3D12 device. hr="
    << logging::SystemErrorCodeToString(hr);
    return nullptr;
    }
    Rafael Cintron . unresolved

    If Dawn creates an 11on12 device for us, it should always QI to a D3D11 device. Callers should assume all codepaths to this function succeed.

    Line 226, Patchset 56 (Latest): Microsoft::WRL::ComPtr<IDCompositionTexture> dcomp_texture) {
    Rafael Cintron . unresolved

    Since `ShouldWaitForDCompTextureFence` does not take ownership of `dcomp_texture`, please pass by bald pointer to avoid unnecessary AddRef/Release.

    Line 1097, Patchset 56 (Latest): d3d12_shared_texture_memory_is_current_ = false;
    Rafael Cintron . unresolved

    Instead of having `d3d12_shared_texture_memory_is_current_`, why not clear out the shared texture memory here?

    Line 1303, Patchset 56 (Latest): auto old_d3d12_resource = d3d12_resource_;
    Rafael Cintron . unresolved

    Why are we caching `d3d12_resource_` into `old_d3d12_resource`? Please add comment to explain or delete.

    Line 2000, Patchset 56 (Latest): // Do not release the D3D12 resource here since it may back Dawn's shared

    // texture memory. This will prevent the need to create a new shared texture
    // memory on next Dawn access and avoid re-creating the DComp texture as
    // well.
    Rafael Cintron . unresolved
    ```suggestion
    // Do not release the D3D12 resource here since it may back Dawn's shared
    // texture memory or a DComp texture. This will prevent the need to create a
    // new shared texture or DComp texture the next time we need them.
    ```
    Line 2219, Patchset 55: if (FAILED(hr)) {
    LOG(ERROR) << "Failed to get D3D11On12Device2: "
    << logging::SystemErrorCodeToString(hr);
    return nullptr;
    }
    Rafael Cintron . unresolved

    IIUC, this QI should always succeed. Please CHECK_EQ that it is S_OK.

    Line 2238, Patchset 56 (Latest): hr = d3d12_device->CreateCommandQueue(&command_queue_desc,
    IID_PPV_ARGS(&command_queue));
    if (FAILED(hr)) {
    LOG(ERROR) << ", CreateCommandQueue failed: "
    << logging::SystemErrorCodeToString(hr);
    return nullptr;
    }
    Rafael Cintron . unresolved

    D3D dev tells me that calling CreateCommandQueue with "FLAG_NONE" should aways succeed, even if the device has been removed. Should be safe to CHECK_EQ(.., S_OK) here.

    Since the QI above should also always succeed, please remove all of the nullptr error handling in callers of GetOrCreateCommandQueueFor11on12.

    File gpu/command_buffer/service/shared_image/d3d_image_utils.cc
    Line 127, Patchset 55: resource_desc.resource = resource;
    Rafael Cintron . unresolved
    ```suggestion
    resource_desc.resource = std::move(resource);
    ```
    File ui/gl/direct_composition_support.h
    Line 59, Patchset 55:// Retrieves the global d3d12 command queue created by Dawn used by SharedImage
    Rafael Cintron . unresolved

    ```suggestion
    // Retrieves the global d3d12 command queue created by Chromium's Dawn instance and used by SharedImage
    ```

    File ui/gl/direct_composition_support.cc
    Line 151, Patchset 55:// Global d3d12 command queue created by Dawn used by SharedImage code to queue
    Rafael Cintron . unresolved

    ```suggestion
    // Global d3d12 command queue created by Chromium's Dawn instance and used by SharedImage code to queue
    ```

    Line 751, Patchset 55: create_device3_function(dxgi_device.Get(), IID_PPV_ARGS(&desktop_device));
    Rafael Cintron . unresolved

    Passing a device to DCompositionCreateDevice3 is optional. We should factor this code such that InitializeDirectComposition has two overloads, one which takes a D3D11 device and one which takes a D3D12 command queue.

    With the current setup, passing DCompositionCreateDevice3 an 11on12 device sets up a dangerous scenario where you can ask it for DCompSurfaces and give those to 12. Since 12 does not respect the scissor rect imposed by BeginDraw/EndDraw, we could end up with hard to debug issues where content can get jumbled up. By not giving DComp any DXGI device in 12 mode, we prevent it from being able to hand out DCompSurfaces altogether and prevent dangerous scenarios.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Sahir Vellani
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Wed, 25 Feb 2026 21:08:42 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Feb 26, 2026, 2:48:12 PM (7 days ago) Feb 26
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani voted and added 13 comments

    Votes added by Sahir Vellani

    Commit-Queue+1

    13 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 117, Patchset 55:void PrepareD3D11on12TextureForD3D11(ID3D11Resource* d3d11_texture) {
    Rafael Cintron . unresolved

    Please add a CHECK at the beginning of the method that `is_texture_unwrapped_for_d3d12_` is false.

    Sahir Vellani

    It's not a member function. Would you rather it become one to add the CHECK?

    Line 122, Patchset 55: CHECK_EQ(hr, S_OK) << ", QueryInterface failed: "
    << logging::SystemErrorCodeToString(hr);
    Rafael Cintron . resolved

    By the time you get to this code, QI to `ID3D11On12Device2` should always succeed. No need to waste DLL bytes on this string, or the call to SystemErrorCodeToString.

    Sahir Vellani

    Done

    Line 178, Patchset 56: if (FAILED(hr)) {

    LOG(ERROR) << "Failed to get D3D11 device from D3D12 device. hr="
    << logging::SystemErrorCodeToString(hr);
    return nullptr;
    }
    Rafael Cintron . resolved

    If Dawn creates an 11on12 device for us, it should always QI to a D3D11 device. Callers should assume all codepaths to this function succeed.

    Sahir Vellani

    Done

    Line 226, Patchset 56: Microsoft::WRL::ComPtr<IDCompositionTexture> dcomp_texture) {
    Rafael Cintron . resolved

    Since `ShouldWaitForDCompTextureFence` does not take ownership of `dcomp_texture`, please pass by bald pointer to avoid unnecessary AddRef/Release.

    Sahir Vellani

    Done

    Line 1097, Patchset 56: d3d12_shared_texture_memory_is_current_ = false;
    Rafael Cintron . resolved

    Instead of having `d3d12_shared_texture_memory_is_current_`, why not clear out the shared texture memory here?

    Sahir Vellani

    We need the WGPU Device to clear out the STM.

    Line 1303, Patchset 56: auto old_d3d12_resource = d3d12_resource_;
    Rafael Cintron . resolved

    Why are we caching `d3d12_resource_` into `old_d3d12_resource`? Please add comment to explain or delete.

    Sahir Vellani

    Done

    Line 2000, Patchset 56: // Do not release the D3D12 resource here since it may back Dawn's shared

    // texture memory. This will prevent the need to create a new shared texture
    // memory on next Dawn access and avoid re-creating the DComp texture as
    // well.
    Rafael Cintron . resolved
    ```suggestion
    // Do not release the D3D12 resource here since it may back Dawn's shared
    // texture memory or a DComp texture. This will prevent the need to create a
    // new shared texture or DComp texture the next time we need them.
    ```
    Sahir Vellani

    Done

    Line 2219, Patchset 55: if (FAILED(hr)) {
    LOG(ERROR) << "Failed to get D3D11On12Device2: "
    << logging::SystemErrorCodeToString(hr);
    return nullptr;
    }
    Rafael Cintron . resolved

    IIUC, this QI should always succeed. Please CHECK_EQ that it is S_OK.

    Sahir Vellani

    Done

    Line 2238, Patchset 56: hr = d3d12_device->CreateCommandQueue(&command_queue_desc,

    IID_PPV_ARGS(&command_queue));
    if (FAILED(hr)) {
    LOG(ERROR) << ", CreateCommandQueue failed: "
    << logging::SystemErrorCodeToString(hr);
    return nullptr;
    }
    Rafael Cintron . resolved

    D3D dev tells me that calling CreateCommandQueue with "FLAG_NONE" should aways succeed, even if the device has been removed. Should be safe to CHECK_EQ(.., S_OK) here.

    Since the QI above should also always succeed, please remove all of the nullptr error handling in callers of GetOrCreateCommandQueueFor11on12.

    Sahir Vellani

    Done

    File gpu/command_buffer/service/shared_image/d3d_image_utils.cc
    Line 127, Patchset 55: resource_desc.resource = resource;
    Rafael Cintron . resolved
    ```suggestion
    resource_desc.resource = std::move(resource);
    ```
    Sahir Vellani

    Done

    File ui/gl/direct_composition_support.h
    Line 59, Patchset 55:// Retrieves the global d3d12 command queue created by Dawn used by SharedImage
    Rafael Cintron . resolved

    ```suggestion
    // Retrieves the global d3d12 command queue created by Chromium's Dawn instance and used by SharedImage
    ```

    Sahir Vellani

    Done

    File ui/gl/direct_composition_support.cc
    Line 151, Patchset 55:// Global d3d12 command queue created by Dawn used by SharedImage code to queue
    Rafael Cintron . resolved

    ```suggestion
    // Global d3d12 command queue created by Chromium's Dawn instance and used by SharedImage code to queue
    ```

    Sahir Vellani

    Done

    Line 751, Patchset 55: create_device3_function(dxgi_device.Get(), IID_PPV_ARGS(&desktop_device));
    Rafael Cintron . resolved

    Passing a device to DCompositionCreateDevice3 is optional. We should factor this code such that InitializeDirectComposition has two overloads, one which takes a D3D11 device and one which takes a D3D12 command queue.

    With the current setup, passing DCompositionCreateDevice3 an 11on12 device sets up a dangerous scenario where you can ask it for DCompSurfaces and give those to 12. Since 12 does not respect the scissor rect imposed by BeginDraw/EndDraw, we could end up with hard to debug issues where content can get jumbled up. By not giving DComp any DXGI device in 12 mode, we prevent it from being able to hand out DCompSurfaces altogether and prevent dangerous scenarios.

    Sahir Vellani

    I propose that we do this refactor in a separate change. g_d3d11_device is used in other parts of the code; for example in DCompPresenter::Present. I've created a todo.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 57
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Thu, 26 Feb 2026 19:48:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rafael Cintron (Gerrit)

    unread,
    Feb 27, 2026, 8:23:56 PM (6 days ago) Feb 27
    to Sahir Vellani, Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Sahir Vellani, Sunny Sachanandani and Vasiliy Telezhnikov

    Rafael Cintron added 8 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 424, Patchset 57 (Latest): bool d3d12_shared_texture_memory_is_current_ GUARDED_BY(lock_) = false;
    Rafael Cintron . unresolved

    Please declare `texture_device_can_use_d3d12_ ` next to the shared texture memory variables write a comment that clearly describes how the two are kept in sync.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 87, Patchset 57 (Latest): CHECK_EQ(hr, S_OK) << "Failed to retrieve 11On12 device: "
    << logging::SystemErrorCodeToString(hr);
    Rafael Cintron . unresolved

    QI from ID3D11Device to ID3D11On12Device should always succeed. Please remove unused debug output.

    Line 92, Patchset 57 (Latest): hr = d3d11on12_device->UnwrapUnderlyingResource(
    Rafael Cintron . unresolved

    Reading through the 11on12 code, `UnwrapUnderlyingResource` should always return S_OK unless we've passed it invalid arguments. Please CHECK_EQ the return value and fix up the callers to always assume a valid ID3D12Resource is returned.

    Line 117, Patchset 55:void PrepareD3D11on12TextureForD3D11(ID3D11Resource* d3d11_texture) {
    Rafael Cintron . resolved

    Please add a CHECK at the beginning of the method that `is_texture_unwrapped_for_d3d12_` is false.

    Sahir Vellani

    It's not a member function. Would you rather it become one to add the CHECK?

    Rafael Cintron

    Acknowledged

    Line 168, Patchset 57 (Latest): backend_type == wgpu::BackendType::D3D12 && is_graphite_device) {
    Rafael Cintron . unresolved

    Given that this feature requires Graphite to be enabled, shouldn't `is_graphite_device` always be true if the feature flag is set? If so, please remove the parameter.

    Line 1281, Patchset 57 (Latest): GetD3D11Device(device, backend_type, is_graphite_device);
    Rafael Cintron . resolved

    Many of the above checks seem redundant with the checks GetD3D11Device already makes. Can we simplify some of this logic a bit more?

    Line 1615, Patchset 57 (Latest): if (want_dcomp_texture_ && !dcomp_texture_) {

    dcomp_texture_ =
    CreateDCompTexture(d3d11_texture_.Get(), alpha_type(), color_space());
    }
    Rafael Cintron . unresolved

    I think it would be better to move the call to `CreateDCompTexture` until right before `BeginAccessCommon`? This way, we keep the object in a consistent state if we counter errors between here and there.


    if (want_dcomp_texture_ && !dcomp_texture_) {
    dcomp_texture_ =
    CreateDCompTexture(d3d12_resource_.Get(), alpha_type(), color_space());
    }
    Rafael Cintron . unresolved

    Similar to previous feedback, please move the `CreateDCompTexture` call until right before the `BeginAccessCommon` call.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Sahir Vellani
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Sat, 28 Feb 2026 01:23:47 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Sahir Vellani <sahir....@microsoft.com>
    Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Mar 2, 2026, 3:03:01 PM (3 days ago) Mar 2
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 6 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 424, Patchset 57: bool d3d12_shared_texture_memory_is_current_ GUARDED_BY(lock_) = false;
    Rafael Cintron . resolved

    Please declare `texture_device_can_use_d3d12_ ` next to the shared texture memory variables write a comment that clearly describes how the two are kept in sync.

    Sahir Vellani

    I think you meant d3d12_shared_texture_memory_is_current_?

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 87, Patchset 57: CHECK_EQ(hr, S_OK) << "Failed to retrieve 11On12 device: "
    << logging::SystemErrorCodeToString(hr);
    Rafael Cintron . resolved

    QI from ID3D11Device to ID3D11On12Device should always succeed. Please remove unused debug output.

    Sahir Vellani

    Done

    Line 92, Patchset 57: hr = d3d11on12_device->UnwrapUnderlyingResource(
    Rafael Cintron . resolved

    Reading through the 11on12 code, `UnwrapUnderlyingResource` should always return S_OK unless we've passed it invalid arguments. Please CHECK_EQ the return value and fix up the callers to always assume a valid ID3D12Resource is returned.

    Sahir Vellani

    Done

    Line 168, Patchset 57: backend_type == wgpu::BackendType::D3D12 && is_graphite_device) {
    Rafael Cintron . unresolved

    Given that this feature requires Graphite to be enabled, shouldn't `is_graphite_device` always be true if the feature flag is set? If so, please remove the parameter.

    Sahir Vellani

    We only want to run 11On12 logic for the Graphite Dawn D3D12 device. I believe we can run into this codepath from a non graphite device even if Graphite is enabled.

    Line 1615, Patchset 57: if (want_dcomp_texture_ && !dcomp_texture_) {

    dcomp_texture_ =
    CreateDCompTexture(d3d11_texture_.Get(), alpha_type(), color_space());
    }
    Rafael Cintron . resolved

    I think it would be better to move the call to `CreateDCompTexture` until right before `BeginAccessCommon`? This way, we keep the object in a consistent state if we counter errors between here and there.

    Sahir Vellani

    I've moved it to before we call BeginDCompTextureAccess.


    if (want_dcomp_texture_ && !dcomp_texture_) {
    dcomp_texture_ =
    CreateDCompTexture(d3d12_resource_.Get(), alpha_type(), color_space());
    }
    Rafael Cintron . resolved

    Similar to previous feedback, please move the `CreateDCompTexture` call until right before the `BeginAccessCommon` call.

    Sahir Vellani

    Ditto, moved to before BeginDCompTextureAccess.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 58
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 20:02:43 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Mar 2, 2026, 3:18:44 PM (3 days ago) Mar 2
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 1 comment

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 1281, Patchset 57: GetD3D11Device(device, backend_type, is_graphite_device);
    Rafael Cintron . resolved

    Many of the above checks seem redundant with the checks GetD3D11Device already makes. Can we simplify some of this logic a bit more?

    Sahir Vellani

    Yeah good point.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 59
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 20:18:38 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Mar 3, 2026, 5:10:54 PM (2 days ago) Mar 3
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 1 comment

    Patchset-level comments
    Gerrit-Comment-Date: Tue, 03 Mar 2026 22:10:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rafael Cintron (Gerrit)

    unread,
    Mar 3, 2026, 9:04:25 PM (2 days ago) Mar 3
    to Sahir Vellani, Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Sahir Vellani, Sunny Sachanandani and Vasiliy Telezhnikov

    Rafael Cintron added 3 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.h
    Line 424, Patchset 57: bool d3d12_shared_texture_memory_is_current_ GUARDED_BY(lock_) = false;
    Rafael Cintron . resolved

    Please declare `texture_device_can_use_d3d12_ ` next to the shared texture memory variables write a comment that clearly describes how the two are kept in sync.

    Sahir Vellani

    I think you meant d3d12_shared_texture_memory_is_current_?

    Rafael Cintron

    Apologies, yes, I meant `d3d12_shared_texture_memory_is_current_`.

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 168, Patchset 57: backend_type == wgpu::BackendType::D3D12 && is_graphite_device) {
    Rafael Cintron . unresolved

    Given that this feature requires Graphite to be enabled, shouldn't `is_graphite_device` always be true if the feature flag is set? If so, please remove the parameter.

    Sahir Vellani

    We only want to run 11On12 logic for the Graphite Dawn D3D12 device. I believe we can run into this codepath from a non graphite device even if Graphite is enabled.

    Rafael Cintron

    I presume the scenario you're referring to is WebGPU? If so, please add a comment here describing why is_graphite_device is necessary and why we need to check it in the D3D12 else clause but not the if clause. I presume callers handle this being nullptr?

    File ui/gl/dc_layer_tree.cc
    Line 1048, Patchset 59 (Latest): DLOG(ERROR) << "PresentCompositionTextures failed with error: "
    Rafael Cintron . unresolved
    ```suggestion
    LOG(ERROR) << "PresentCompositionTextures failed with error: "
    ```
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Sahir Vellani
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Gerrit-Attention: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Wed, 04 Mar 2026 02:04:16 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    Mar 4, 2026, 2:39:37 PM (yesterday) Mar 4
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Michael Tang, Quyen Le, Rafael Cintron, Sunny Sachanandani and Vasiliy Telezhnikov

    Sahir Vellani added 2 comments

    File gpu/command_buffer/service/shared_image/d3d_image_backing.cc
    Line 168, Patchset 57: backend_type == wgpu::BackendType::D3D12 && is_graphite_device) {
    Rafael Cintron . resolved

    Given that this feature requires Graphite to be enabled, shouldn't `is_graphite_device` always be true if the feature flag is set? If so, please remove the parameter.

    Sahir Vellani

    We only want to run 11On12 logic for the Graphite Dawn D3D12 device. I believe we can run into this codepath from a non graphite device even if Graphite is enabled.

    Rafael Cintron

    I presume the scenario you're referring to is WebGPU? If so, please add a comment here describing why is_graphite_device is necessary and why we need to check it in the D3D12 else clause but not the if clause. I presume callers handle this being nullptr?

    Sahir Vellani

    Yeah, the callers handle this being nullptr.

    File ui/gl/dc_layer_tree.cc
    Line 1048, Patchset 59: DLOG(ERROR) << "PresentCompositionTextures failed with error: "
    Rafael Cintron . resolved
    ```suggestion
    LOG(ERROR) << "PresentCompositionTextures failed with error: "
    ```
    Sahir Vellani

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Tang
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    • Vasiliy Telezhnikov
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
    Gerrit-Change-Number: 6733314
    Gerrit-PatchSet: 60
    Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
    Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-CC: Michael Tang <ta...@microsoft.com>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
    Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
    Gerrit-Attention: Vasiliy Telezhnikov <vas...@chromium.org>
    Gerrit-Attention: Michael Tang <ta...@microsoft.com>
    Gerrit-Comment-Date: Wed, 04 Mar 2026 19:39:30 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
    Comment-In-Reply-To: Sahir Vellani <sahir....@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sahir Vellani (Gerrit)

    unread,
    12:23 PM (4 hours ago) 12:23 PM
    to Quyen Le, Vasiliy Telezhnikov, Sunny Sachanandani, chrom...@appspot.gserviceaccount.com, Chromium LUCI CQ, Michael Tang, AyeAye, Rafael Cintron, chromium...@chromium.org, feature-me...@chromium.org, media-cro...@chromium.org, chromeos-gfx-...@google.com, media-wi...@chromium.org, cc-...@chromium.org, penghu...@chromium.org
    Attention needed from Quyen Le, Rafael Cintron and Sunny Sachanandani

    Sahir Vellani added 4 comments

    Patchset-level comments
    File-level comment, Patchset 28:
    Michael Tang . resolved

    Do you anticipate that D3D12+DComp support will be something that we need to query for? Or is it something that we want to just happen automatically when supported without our knowledge? If the former, please add a `OutputSurface::DCSupportLevel::kDCompTextureD3D12` and set it [in SkiaOutputDeviceDComp](https://source.chromium.org/chromium/chromium/src/+/main:components/viz/service/display_embedder/skia_output_device_dcomp.cc;l=54-68;drc=75786f4af376776d0078a6d500a7134172922e59).

    Sahir Vellani

    Acknowledged

    Can you add some tests to `gpu/command_buffer/service/shared_image/d3d_image_backing_factory_unittest.cc` to verify the new D3D11on12 path works correctly.

    Sahir Vellani

    Are you comfortable with the tests being added in a follow-up dependent change? The draft CL is in the relation chain.

    Sahir Vellani

    Done

    File-level comment, Patchset 60 (Latest):
    Sahir Vellani . resolved

    Resolving stale comments

    File components/viz/service/display_embedder/skia_output_device_dcomp.cc
    Line 63, Patchset 9: if (Microsoft::WRL::ComPtr<PREVIEW_IDCompositionDevice5> dcomp_device5;
    SUCCEEDED(dcomp_device.As(&dcomp_device5))) {
    return OutputSurface::DCSupportLevel::kDCompDynamicTexture;
    }
    Michael Tang . resolved
    ```suggestion
    if (Microsoft::WRL::ComPtr<PREVIEW_IDCompositionDevice6> dcomp_device6;
    SUCCEEDED(dcomp_device.As(&dcomp_device6))) {
    return OutputSurface::DCSupportLevel::kDCompTextureD3D12;
    }
        if (Microsoft::WRL::ComPtr<PREVIEW_IDCompositionDevice5> dcomp_device5;
    SUCCEEDED(dcomp_device.As(&dcomp_device5))) {
    return OutputSurface::DCSupportLevel::kDCompDynamicTexture;
    }
    ```

    When you clean up this CL, this will be useful to gate your feature on API support. This can possibly replace `kDCompD3D12`.

    Sahir Vellani

    Acknowledged

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Quyen Le
    • Rafael Cintron
    • Sunny Sachanandani
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I323c85586daa2687de59c97d0d27f4f0e443fb69
      Gerrit-Change-Number: 6733314
      Gerrit-PatchSet: 60
      Gerrit-Owner: Sahir Vellani <sahir....@microsoft.com>
      Gerrit-Reviewer: Quyen Le <lehoan...@chromium.org>
      Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
      Gerrit-Reviewer: Sahir Vellani <sahir....@microsoft.com>
      Gerrit-Reviewer: Sunny Sachanandani <sun...@chromium.org>
      Gerrit-Reviewer: Vasiliy Telezhnikov <vas...@chromium.org>
      Gerrit-CC: Michael Tang <ta...@microsoft.com>
      Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
      Gerrit-Attention: Sunny Sachanandani <sun...@chromium.org>
      Gerrit-Attention: Quyen Le <lehoan...@chromium.org>
      Gerrit-Comment-Date: Thu, 05 Mar 2026 17:23:11 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Sahir Vellani <sahir....@microsoft.com>
      Comment-In-Reply-To: Quyen Le <lehoan...@chromium.org>
      Comment-In-Reply-To: Michael Tang <ta...@microsoft.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages