Create D3D12 video decoder [chromium/src : main]

178 views
Skip to first unread message

Zhibo Wang (Gerrit)

unread,
Aug 18, 2023, 2:32:42 AM8/18/23
to Dale Curtis, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Jianlin Qiu

Attention is currently required from: Dale Curtis.

Zhibo Wang would like Dale Curtis to review this change.

View Change

Create D3D12 video decoder

Since the rendering side don't accept a D3D12Resource now, the d3d12 video decoder will use D3D11Texture2D as picture buffer, open it in D3D12 by shared handle, do D3D12 video decoding and close the handle, then let the D3D11Texture2D follow the current rendering pipeline.
In this case, D3D12VideoDecoder inherits D3D11VideoDecoder and reuses most of its methods, only replacing the wrapper with a D3D12 one.

Bug: 1348104
Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
---
M media/base/decoder.cc
M media/base/decoder.h
M media/base/media_switches.cc
M media/base/media_switches.h
M media/gpu/BUILD.gn
M media/gpu/windows/d3d11_h264_accelerator.cc
M media/gpu/windows/d3d11_h264_accelerator.h
M media/gpu/windows/d3d11_h265_accelerator.cc
M media/gpu/windows/d3d11_h265_accelerator.h
M media/gpu/windows/d3d11_video_decoder.cc
M media/gpu/windows/d3d11_video_decoder.h
M media/gpu/windows/d3d11_video_decoder_wrapper.cc
A media/gpu/windows/d3d12_video_decoder.cc
A media/gpu/windows/d3d12_video_decoder.h
A media/gpu/windows/d3d12_video_decoder_wrapper.cc
A media/gpu/windows/d3d12_video_decoder_wrapper.h
M media/gpu/windows/d3d_video_decoder_wrapper.h
M media/gpu/windows/init_guid.cc
M media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
M media/mojo/services/BUILD.gn
M media/mojo/services/gpu_mojo_media_client_win.cc
21 files changed, 1,110 insertions(+), 120 deletions(-)


To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 36
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>

Zhibo Wang (Gerrit)

unread,
Aug 18, 2023, 2:32:47 AM8/18/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis.

View Change

1 comment:

  • Patchset:

    • Patch Set #35:

      Hello, this is our D3D12VideoDecoder implementation, which is now ready for review.
      This patch demonstrates an overall change, and may be split into minor patches.

      Performance: While we are doing D3D11/12 interops, many D3D12 features cannot be fully utilized, and the performance is not as good as pure D3D11 pipeline (about 0.5x).

      Question:

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 36
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Comment-Date: Fri, 18 Aug 2023 06:32:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Dale Curtis (Gerrit)

unread,
Aug 18, 2023, 12:29:40 PM8/18/23
to Frank Liberato, Ted (Chromium) Meyer, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Zhibo Wang

Attention is currently required from: Frank Liberato, Ted (Chromium) Meyer, Zhibo Wang.

Dale Curtis would like Frank Liberato and Ted (Chromium) Meyer to review this change authored by Zhibo Wang.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 36
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>

Dale Curtis (Gerrit)

unread,
Aug 18, 2023, 12:29:46 PM8/18/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Frank Liberato, Ted (Chromium) Meyer, Zhibo Wang.

View Change

6 comments:

  • Patchset:

    • Patch Set #36:

      I think it'd be better if we just rename d3d11_video_decoder to d3d_video_decoder or just otherwise live with the name and let it support d3d12 as well. You probably need to parameterize / change the GetDevice callback then.

      Then instead of having D3D12 inherit from D3D11, we'd move the D3D11 parts into something like `D3D11VideoDecoderCore` first and then you'd add a `D3D12VideoDecoderCore` after the fact.

      @liberato @tmathemeyer do you have thoughts?

  • File media/gpu/windows/d3d11_video_decoder.cc:

  • File media/gpu/windows/d3d12_video_decoder.cc:

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 36
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Fri, 18 Aug 2023 16:29:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Frank Liberato (Gerrit)

unread,
Aug 18, 2023, 5:08:33 PM8/18/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis, Ted (Chromium) Meyer, Zhibo Wang.

View Change

2 comments:

  • Patchset:

    • Patch Set #36:

      I think it'd be better if we just rename d3d11_video_decoder to d3d_video_decoder or just otherwise […]

      that was also my thought. there are a several parts that need to be abstracted away based on 11 vs 12, but having 12 derive from 11 invites having lots of duplicate code (e.g., i commented one such section).

  • File media/gpu/windows/d3d12_video_decoder.cc:

    • Patch Set #36, Line 115: bool D3D12VideoDecoder::ReloadD3DVideoDecoder() {

      this fn has a lot of duplicated code, or nearly so. i think that it can be split up a bit to combine the duplicate parts.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 36
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Fri, 18 Aug 2023 21:08:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>

Zhibo Wang (Gerrit)

unread,
Aug 24, 2023, 4:59:44 AM8/24/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis, Ted (Chromium) Meyer.

View Change

7 comments:

  • Patchset:

    • Patch Set #36:

      The case is, since the rendering side don't support D3D12 yet, the D3D12 video decoder still use D3D11Texture2D as the output picture buffer for better memory management, as is recommended by Microsoft expert. https://bugs.chromium.org/p/chromium/issues/detail?id=1434145#c10

      So in this CL(PS38 now)'s implementation, the D3D12VideoDecoder will
      1. Use D3D11's CreatePictureBuffers logic to create and manage D3D11Texture2D's
      2. Open one in D3D12VideoDecoderWrapper via a shared handle
      3. Do D3D12 decode command and wait for decoding to be done
      4. return to D3D11Texture2D and do the possible video processing

      Apart from 3. being D3D12, the other parts are still identical to D3D11's logic. That is to say current D3D12 video decoding heavily uses D3D11 API.

    • Then instead of having D3D12 inherit from D3D11, we'd move the D3D11 parts into something like D3D11VideoDecoderCore first and then you'd add a D3D12VideoDecoderCore after the fact.

    • there are a several parts that need to be abstracted away based on 11 vs 12, but having 12 derive from 11 invites having lots of duplicate code

      I don't fully get your point. Where should we put the shared D3D11 API calls while not doing inherit-derive?

  • File media/gpu/windows/d3d11_video_decoder.cc:

    • Done

    • Patch Set #36, Line 437: bool D3D11VideoDecoder::ReloadD3DVideoDecoder() {

      `(Recreate|Reset)DecoderAndWrapper` seems clearer.

    • Done

  • File media/gpu/windows/d3d12_video_decoder.cc:

    • Patch Set #36, Line 43: } else if (config.profile() == HEVCPROFILE_REXT) {

      All these non-d3d12 ones seem common and could come from a shared function?

    • Done

    • Done

    • this fn has a lot of duplicated code, or nearly so. […]

      Reused the creation of `decoder_configurator_` and `texture_selector_`.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 38
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Thu, 24 Aug 2023 08:59:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
Comment-In-Reply-To: Frank Liberato <libe...@chromium.org>

Dale Curtis (Gerrit)

unread,
Aug 24, 2023, 1:59:14 PM8/24/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Frank Liberato, Ted (Chromium) Meyer, Zhibo Wang.

View Change

1 comment:

  • Patchset:

    • Patch Set #36:

      The case is, since the rendering side don't support D3D12 yet, the D3D12 video decoder still use D3D […]

      I think Frank and I are just suggesting that instead of creating a new decoder which inherits from D3D11VideoDecoder, you instead have a d3d11 "core" and a d3d12 "core" that the D3D11VideoDecoder (perhaps renamed to D3DVideoDecoder) can use depending on which d3d version level is being targeted.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 38
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Thu, 24 Aug 2023 17:58:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
Comment-In-Reply-To: Zhibo Wang <zhibo...@intel.com>
Comment-In-Reply-To: Frank Liberato <libe...@chromium.org>

Dale Curtis (Gerrit)

unread,
Aug 24, 2023, 2:01:04 PM8/24/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Frank Liberato, Ted (Chromium) Meyer, Zhibo Wang.

View Change

1 comment:

  • Patchset:

    • Patch Set #36:

      I think Frank and I are just suggesting that instead of creating a new decoder which inherits from D […]

      E.g., in terms of CL steps:

      1. First extract the d3d11 core as is in one CL.
      2. Implement a D3d12 core in another CL.
      3. Maybe rename D3D11VideoDecoder to D3DVideoDecoder?
      4. Add code to D3DVideoDecoder to support multiple cores depending on version level.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 38
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Thu, 24 Aug 2023 18:00:50 +0000

Zhibo Wang (Gerrit)

unread,
Aug 28, 2023, 5:06:09 AM8/28/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis, Frank Liberato, Ted (Chromium) Meyer.

View Change

1 comment:

  • Patchset:

    • Patch Set #36:

      E.g., in terms of CL steps: […]

      I realized d3d12_video_decoder.cc almost overridden nothing. After I move the argument preparation for creating ID3D1xVideoDecoder into _wrapper.cc, I managed to get rid of the d3d12_video_decoder.cc file.

      I believe PS42 solve the issues, where there is no inheritance, we don't need 11/12 core since we have nothing to be polymorphic in d3d11_video_decoder.cc, and everything is shared until the creation of the wrapper, then we do #4 in D3D11VideoDecoder::CreateD3DVideoDecoderWrapper().

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 42
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Mon, 28 Aug 2023 09:05:54 +0000

Dale Curtis (Gerrit)

unread,
Aug 28, 2023, 12:50:34 PM8/28/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Frank Liberato, Ted (Chromium) Meyer, Zhibo Wang.

View Change

14 comments:

  • Patchset:

    • Patch Set #42:

      Thanks for reorganizing!

      The number of classes in the wrapper impl is starting to get a bit too high. I think it'd probably be helpful to split these out into their own files with testing so that the wrappers aren't so large and untested.

  • File media/gpu/windows/d3d12_video_decoder_wrapper.h:

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

  • File media/mojo/services/gpu_mojo_media_client_win.cc:

    • Patch Set #42, Line 38: D3D11VideoDecoder::GetD3D12VideoDeviceCB GetD3D12DeviceCallback() {

      Can we just parameterize the existing one with a D3D11/D3D12 enum or boolean?

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 42
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Mon, 28 Aug 2023 16:50:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Frank Liberato (Gerrit)

unread,
Aug 28, 2023, 12:53:31 PM8/28/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Ted (Chromium) Meyer, Zhibo Wang.

View Change

3 comments:

  • File media/gpu/windows/d3d11_video_decoder.cc:

  • File media/gpu/windows/d3d11_video_decoder_wrapper.h:

    • Patch Set #42, Line 26: bool&

      i think that this would be 'bool*' for the chromium style guide, with some hint that it's an out parameter.

      however, it might be better to put a getter on the decoder wrapper base class to return the value.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 42
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Mon, 28 Aug 2023 16:53:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Zhibo Wang (Gerrit)

unread,
Sep 4, 2023, 3:26:37 AM9/4/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis, Frank Liberato, Ted (Chromium) Meyer.

View Change

18 comments:

  • Patchset:

    • Patch Set #36:

      I realized d3d12_video_decoder.cc almost overridden nothing. […]

      Done

  • Patchset:

  • File media/gpu/windows/d3d11_video_decoder.cc:

    • The creation of `ID3D11VideoDecoder` is moved to `CreateD3DVideoDecoderWrapper()`. So it does not do the things as its old name `CreateD3D11Decoder()` indicates. Note that the return type also changed.

      The new method do re-creation of decoder_configurator_, texture_selector_, and create-and-set the wrapper. It is more like a reset to the `media::D3D11VideoDecoder` class.

    • Done

  • File media/gpu/windows/d3d11_video_decoder_wrapper.h:

    • i think that this would be 'bool*' for the chromium style guide, with some hint that it's an out par […]

      Done

  • File media/gpu/windows/d3d12_video_decoder_wrapper.h:

    • Done

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • Done

    • Done

    • Patch Set #42, Line 71: if (index >= size_) {

      I think it's better to just have a single vector with a struct containing these resource elements that

    • The vectors are for `ToD3D12VideoDecodeReferenceFrames()` returning the exact array pointers that D3D12 API expected without any conversion.

    • you can push_back into if you're going to have to resize every time?

    • The indices of the frames coming in are not guaranteed to be incremental. E.g. it would be 0,4,9,13,7,2 instead of 0,1,2,3,4,5,6.

    • Patch Set #42, Line 92: std::vector<D3D12_RESOURCE_BARRIER> TransitionBarriersForAllPlanes(

      `CreateTransitionBarriersForAllPlanes`

    • Done

    • Done

    • Done

    • Done

    • Done

    • Patch Set #42, Line 247: .Size = compressed_bitstream_->GetDesc().Width,

      `Width` only seems a bit odd. Is that correct? A small comment if so.

    • Done

    • Done

    • Patch Set #42, Line 337: class ScopedD3D12MemoryBuffer : public ScopedD3DBuffer {

      Move these above the impl so it's closer to the outer wrapper below.

    • `ScopedD3D12MemoryBuffer::Commit()` will use `D3D12VideoDecoderWrapperImpl->input_stream_arguments_` so it must come after the impl class.

  • File media/mojo/services/gpu_mojo_media_client_win.cc:

    • Patch Set #42, Line 38: D3D11VideoDecoder::GetD3D12VideoDeviceCB GetD3D12DeviceCallback() {

      Can we just parameterize the existing one with a D3D11/D3D12 enum or boolean?

    • Done

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 43
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Mon, 04 Sep 2023 07:26:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Dale Curtis (Gerrit)

unread,
Sep 5, 2023, 4:44:10 PM9/5/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Frank Liberato, Ted (Chromium) Meyer, Zhibo Wang.

View Change

8 comments:

  • File media/gpu/windows/d3d11_h265_accelerator.cc:

    • Patch Set #43, Line 556: video_decoder_wrapper_->GetBitstreamBuffer(current_frame_size_);

      Isn't what we append always smaller than this?

  • File media/gpu/windows/d3d11_video_decoder_wrapper.cc:

    • Patch Set #43, Line 59: CHECK(SUCCEEDED(video_decoder_->GetCreationParameters(&desc, &config)));

      Will this always succeed? Seems like a GPU driver disconnect or similar could cause it to fail?

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • Patch Set #42, Line 71: if (index >= size_) {

      > I think it's better to just have a single vector with a struct containing these resource elements […]

      Acknowledged

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • Patch Set #43, Line 18: #define RETURN_IF_FAILED(message, status_code, hr) \

      Doesn't mf_helpers.h already have these macros?

    • Patch Set #43, Line 54: UINT8 num_planes)

      `int num_planes`

    • Patch Set #43, Line 74: WaitForDecodeComplete();

      Waiting for decode to complete during `Reset()` is a bit surprising, since it will affect seeking performance if we have to wait for completion.

    • Patch Set #43, Line 218: return WaitForSingleObject(fence_event_.get(), INFINITE) == WAIT_OBJECT_0;

      I don't think it's safe to do this on the gpu main thread. Is there a callback interface we can use instead?

  • File media/gpu/windows/d3d_video_decoder_wrapper.h:

    • Patch Set #43, Line 55: // Wait for the submitted decode request to complete.

      This probably isn't going to be okay on the gpu main thread.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 43
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Tue, 05 Sep 2023 20:43:57 +0000

Dale Curtis (Gerrit)

unread,
Sep 5, 2023, 4:45:18 PM9/5/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Frank Liberato, Ted (Chromium) Meyer, Zhibo Wang.

View Change

1 comment:

  • Patchset:

    • Patch Set #43:

      You might consider landing the D3D11 pieces of this first and then the D3D12 pieces in a followup CL.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 43
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Frank Liberato <libe...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Frank Liberato <libe...@chromium.org>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Tue, 05 Sep 2023 20:45:08 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Frank Liberato (Gerrit)

unread,
Sep 5, 2023, 5:05:38 PM9/5/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Ted (Chromium) Meyer, Zhibo Wang.

View Change

1 comment:

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 43
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Tue, 05 Sep 2023 21:05:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

Jianlin Qiu (Gerrit)

unread,
Sep 11, 2023, 8:14:23 PM9/11/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Frank Liberato, Ted (Chromium) Meyer, Dale Curtis, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis, Ted (Chromium) Meyer, Zhibo Wang.

View Change

1 comment:

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • Patch Set #43, Line 218: return WaitForSingleObject(fence_event_.get(), INFINITE) == WAIT_OBJECT_0;

      I don't think it's safe to do this on the gpu main thread. […]

      dalecurtis@, Seems this has to be synchronous. How about changing INFINITE timeout to a limited timeout, i.e, 500ms?

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 43
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Comment-Date: Tue, 12 Sep 2023 00:14:13 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>

Dale Curtis (Gerrit)

unread,
Sep 11, 2023, 8:32:36 PM9/11/23
to Rafael Cintron, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Zhibo Wang, Ted (Chromium) Meyer

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

Dale Curtis would like Rafael Cintron to review this change authored by Zhibo Wang.

View Change

Create D3D12 video decoder

Since the rendering side don't accept a D3D12Resource now, the d3d12 video decoder will use D3D11Texture2D as picture buffer, open it in D3D12 by shared handle, do D3D12 video decoding and close the handle, then let the D3D11Texture2D follow the current rendering pipeline.
In this case, D3D12VideoDecoder inherits D3D11VideoDecoder and reuses most of its methods, only replacing the wrapper with a D3D12 one.

Bug: 1348104
Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
---
M media/base/media_switches.cc
M media/base/media_switches.h
M media/base/win/BUILD.gn
A media/base/win/d3d12_mocks.cc
A media/base/win/d3d12_mocks.h

M media/gpu/BUILD.gn
M media/gpu/windows/d3d11_h264_accelerator.cc
M media/gpu/windows/d3d11_h264_accelerator.h
M media/gpu/windows/d3d11_h265_accelerator.cc
M media/gpu/windows/d3d11_h265_accelerator.h
M media/gpu/windows/d3d11_video_decoder.cc
M media/gpu/windows/d3d11_video_decoder.h
M media/gpu/windows/d3d11_video_decoder_unittest.cc
M media/gpu/windows/d3d11_video_decoder_wrapper.cc
M media/gpu/windows/d3d11_video_decoder_wrapper.h
M media/gpu/windows/d3d11_vp9_accelerator.cc
A media/gpu/windows/d3d12_helpers.cc
A media/gpu/windows/d3d12_helpers.h
A media/gpu/windows/d3d12_helpers_unittest.cc

A media/gpu/windows/d3d12_video_decoder_wrapper.cc
A media/gpu/windows/d3d12_video_decoder_wrapper.h
M media/gpu/windows/d3d_video_decoder_wrapper.h
M media/gpu/windows/init_guid.cc
M media/mojo/services/BUILD.gn
M media/mojo/services/gpu_mojo_media_client_win.cc
25 files changed, 1,343 insertions(+), 155 deletions(-)


To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 43
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>

Dale Curtis (Gerrit)

unread,
Sep 11, 2023, 8:32:43 PM9/11/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

View Change

1 comment:

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • dalecurtis@, Seems this has to be synchronous. […]

      Is it possible to wait on this on a background thread and deliver a callback to the main thread when ready? Timeout of 500ms seems like it could lead to sporadic glitching which is always hard to debug. +rafael in case he has advice.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 43
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Tue, 12 Sep 2023 00:32:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
Comment-In-Reply-To: Jianlin Qiu <jianl...@intel.com>

Jianlin Qiu (Gerrit)

unread,
Sep 11, 2023, 10:30:53 PM9/11/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Dale Curtis, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

View Change

1 comment:

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • Is it possible to wait on this on a background thread and deliver a callback to the main thread when […]

      Yes the event can be wait on another thread. This requires SubmitDecode() to be implemented as async API as well.
      However, I believe as of today D3D11's DecoderEndFrame() does the same(though internally in driver) on main thread waiting for decode to finish, and you don't have a chance to make it async.
      We may need to align d3d11 and d3d12 to both accept a oncecallback param for SubmitDecode() API, though D3D11 invokes it with null callback?

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 43
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Tue, 12 Sep 2023 02:30:44 +0000

Dale Curtis (Gerrit)

unread,
Sep 16, 2023, 5:38:44 PM9/16/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

View Change

1 comment:

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • Yes the event can be wait on another thread. […]

      Ah, I didn't realize this was already happening in the driver; that's unfortunate. It would certainly be better to do an async wait that triggers the callback, but this CL is already fairly complicated, so I don't mind unifying that in a followup before we enable the d3d12 path.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 43
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Sat, 16 Sep 2023 21:38:35 +0000

Zhibo Wang (Gerrit)

unread,
Sep 18, 2023, 4:42:17 AM9/18/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

Zhibo Wang uploaded patch set #44 to this change.

View Change

Create D3D12 video decoder

Since the rendering side don't accept a D3D12Resource now, the d3d12 video decoder will use D3D11Texture2D as picture buffer, open it in D3D12 by shared handle, do D3D12 video decoding and close the handle, then let the D3D11Texture2D follow the current rendering pipeline.
In this case, D3D12VideoDecoder inherits D3D11VideoDecoder and reuses most of its methods, only replacing the wrapper with a D3D12 one.

Bug: 1348104
Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
---
M media/base/media_switches.cc
M media/base/media_switches.h
M media/base/win/BUILD.gn
A media/base/win/d3d12_mocks.cc
A media/base/win/d3d12_mocks.h
M media/gpu/BUILD.gn
M media/gpu/windows/d3d11_h264_accelerator.cc
M media/gpu/windows/d3d11_h264_accelerator.h
M media/gpu/windows/d3d11_h265_accelerator.cc
M media/gpu/windows/d3d11_h265_accelerator.h
M media/gpu/windows/d3d11_status.h

M media/gpu/windows/d3d11_video_decoder.cc
M media/gpu/windows/d3d11_video_decoder.h
M media/gpu/windows/d3d11_video_decoder_unittest.cc
M media/gpu/windows/d3d11_video_decoder_wrapper.cc
M media/gpu/windows/d3d11_video_decoder_wrapper.h
M media/gpu/windows/d3d11_vp9_accelerator.cc
A media/gpu/windows/d3d12_helpers.cc
A media/gpu/windows/d3d12_helpers.h
A media/gpu/windows/d3d12_helpers_unittest.cc
A media/gpu/windows/d3d12_video_decoder_wrapper.cc
A media/gpu/windows/d3d12_video_decoder_wrapper.h
M media/gpu/windows/d3d_video_decoder_wrapper.h
M media/gpu/windows/init_guid.cc
M media/mojo/services/BUILD.gn
M media/mojo/services/gpu_mojo_media_client_win.cc
26 files changed, 1,363 insertions(+), 154 deletions(-)

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 44

Zhibo Wang (Gerrit)

unread,
Sep 18, 2023, 4:49:58 AM9/18/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

View Change

5 comments:

  • File media/gpu/windows/d3d11_h265_accelerator.cc:

    • Patch Set #43, Line 556: video_decoder_wrapper_->GetBitstreamBuffer(current_frame_size_);

      Isn't what we append always smaller than this?

    • Yes. In D3D12 we need to submit the whole bitstream buffer in one go. So we get the size of the stream at below and allocate a buffer of sufficient size (it is harder to get the exact size). In D3D11 this argument has no effect, the driver decides the buffer size, and the bitstream can be chopped.

  • File media/gpu/windows/d3d11_video_decoder_wrapper.cc:

    • Patch Set #43, Line 59: CHECK(SUCCEEDED(video_decoder_->GetCreationParameters(&desc, &config)));

      Will this always succeed? Seems like a GPU driver disconnect or similar could cause it to fail?

    • Done

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • Patch Set #43, Line 18: #define RETURN_IF_FAILED(message, status_code, hr) \

      Doesn't mf_helpers. […]

      mf-helpers version don't use `media_log_`. Do you mean we should reuse that or rename this?

    • Done

    • since it will affect seeking performance

      Could you point out at which position Reset() will be called and the performance is affected? My search only shows it is called in the constructor of H265Decoder where WaitForDecodeComplete() will do nothing, and in the WaitForFrameBegins() below.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 44
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Mon, 18 Sep 2023 08:49:44 +0000

Dale Curtis (Gerrit)

unread,
Sep 19, 2023, 12:59:11 PM9/19/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

View Change

3 comments:

  • File media/gpu/windows/d3d11_h265_accelerator.cc:

    • Yes. In D3D12 we need to submit the whole bitstream buffer in one go. […]

      Acknowledged

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • mf-helpers version don't use `media_log_`. […]

      Ah, right; what you have is fine.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 44
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Tue, 19 Sep 2023 16:59:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
Comment-In-Reply-To: Zhibo Wang <zhibo...@intel.com>

Zhibo Wang (Gerrit)

unread,
Sep 20, 2023, 4:56:53 AM9/20/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

Zhibo Wang uploaded patch set #45 to this change.

View Change

26 files changed, 1,364 insertions(+), 154 deletions(-)

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 45

Zhibo Wang (Gerrit)

unread,
Sep 20, 2023, 4:58:22 AM9/20/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

View Change

1 comment:

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • Patch Set #43, Line 74: WaitForDecodeComplete();

      That call comes from https://source.chromium. […]

      I see. We may need to look deeper to make sure whether the waiting is necessary and when the buffer can be cleared.

      Since we always do synchronized waiting in SubmitDecode(), we can assume the decode is always completed, in the current code (without the cross-thread wait). Removing this line for now.

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 45
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Wed, 20 Sep 2023 08:58:10 +0000

Dale Curtis (Gerrit)

unread,
Sep 20, 2023, 12:33:01 PM9/20/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

View Change

6 comments:

  • Patchset:

  • File media/gpu/windows/d3d11_h264_accelerator.cc:

    • Patch Set #45, Line 385: current_frame_size_ = stream.size();

      If all we need is the frame size, should we just save it on the base class instead of making multiple implementations override this just to get it?

  • File media/gpu/windows/d3d11_video_decoder.cc:

    • Patch Set #45, Line 299: if (!video_decoder_wrapper) {

      This is going to leave us with "use_shared_handle_" if D3D12 fails to create. I think you shouldn't fallback to D3D11 for the purposes of experimenting. It makes it hard to disambiguate issues with the implementation.

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • Patch Set #42, Line 337: class ScopedD3D12MemoryBuffer : public ScopedD3DBuffer {

      `ScopedD3D12MemoryBuffer::Commit()` will use `D3D12VideoDecoderWrapperImpl->input_stream_arguments_` […]

      Acknowledged

  • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

    • I see. […]

      Acknowledged

  • File media/gpu/windows/d3d_video_decoder_wrapper.h:

    • This probably isn't going to be okay on the gpu main thread.

      Can we just remove this for now if nothing is calling it?

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 45
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Wed, 20 Sep 2023 16:32:47 +0000

Zhibo Wang (Gerrit)

unread,
Sep 21, 2023, 3:19:10 AM9/21/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

Zhibo Wang uploaded patch set #46 to this change.

View Change

26 files changed, 1,346 insertions(+), 154 deletions(-)

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 46

Zhibo Wang (Gerrit)

unread,
Sep 21, 2023, 3:21:05 AM9/21/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Dale Curtis, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

View Change

4 comments:

  • File media/gpu/windows/d3d11_h264_accelerator.cc:

    • If all we need is the frame size, should we just save it on the base class instead of making multipl […]

      Do you mean merge the implementations for h264 and h265? No, they don't share a common base class. D3D11H264Accelerator inherits H264Decoder::H264Accelerator while D3D11H265Accelerator inherits H265Decoder::H265Accelerator.

  • File media/gpu/windows/d3d11_video_decoder.cc:

    • This is going to leave us with "use_shared_handle_" if D3D12 fails to create. […]

      Done

  • File media/gpu/windows/d3d_video_decoder_wrapper.h:

    • Can we just remove this for now if nothing is calling it?

      Done

    • Can we just remove this for now if nothing is calling it?

      Done

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 46
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Thu, 21 Sep 2023 07:20:31 +0000

Dale Curtis (Gerrit)

unread,
Sep 21, 2023, 1:36:03 PM9/21/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

Patch set 46:Code-Review +1

View Change

1 comment:

  • File media/gpu/windows/d3d11_h264_accelerator.cc:

    • Do you mean merge the implementations for h264 and h265? No, they don't share a common base class. […]

      Ah right. Nevermind

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 46
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Comment-Date: Thu, 21 Sep 2023 17:35:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

Zhibo Wang (Gerrit)

unread,
Sep 26, 2023, 4:54:46 AM9/26/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

Attention is currently required from: Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

Zhibo Wang uploaded patch set #47 to this change.

View Change

The following approvals got outdated and were removed: Code-Review+1 by Dale Curtis

The change is no longer submittable: Code-Review is unsatisfied now.

M media/mojo/services/gpu_mojo_media_client_win.cc
25 files changed, 1,353 insertions(+), 154 deletions(-)

To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
Gerrit-Change-Number: 4410406
Gerrit-PatchSet: 47
Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
Gerrit-CC: Frank Liberato <libe...@chromium.org>
Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>

Zhibo Wang (Gerrit)

unread,
Sep 26, 2023, 5:03:02 AM9/26/23
to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

Attention is currently required from: Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

Zhibo Wang uploaded patch set #48 to this change.

View Change

Create D3D12 video decoder
Gerrit-PatchSet: 48

Dale Curtis (Gerrit)

unread,
Sep 26, 2023, 1:15:31 PM9/26/23
to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

Patch set 48:Code-Review +1

View Change

    To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
    Gerrit-Change-Number: 4410406
    Gerrit-PatchSet: 48
    Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
    Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
    Gerrit-CC: Frank Liberato <libe...@chromium.org>
    Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
    Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
    Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
    Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Comment-Date: Tue, 26 Sep 2023 17:15:19 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes

    Dale Curtis (Gerrit)

    unread,
    Sep 26, 2023, 1:15:58 PM9/26/23
    to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

    Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

    Patch set 48:-Code-Review

    The change is no longer submittable: Code-Owners and Code-Review are unsatisfied now.

    View Change

    1 comment:

    • Patchset:

      • Patch Set #48:

        "DelayloadsTest.ChromeDllDelayloadsCheck failed." looks legit actually.

    To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
    Gerrit-Change-Number: 4410406
    Gerrit-PatchSet: 48
    Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
    Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
    Gerrit-CC: Frank Liberato <libe...@chromium.org>
    Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
    Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
    Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
    Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
    Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
    Gerrit-Comment-Date: Tue, 26 Sep 2023 17:15:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes

    Zhibo Wang (Gerrit)

    unread,
    Sep 27, 2023, 4:55:59 AM9/27/23
    to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

    Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

    Zhibo Wang uploaded patch set #49 to this change.

    View Change

    Create D3D12 video decoder

    Since the rendering side don't accept a D3D12Resource now, the d3d12 video decoder will use D3D11Texture2D as picture buffer, open it in D3D12 by shared handle, do D3D12 video decoding and close the handle, then let the D3D11Texture2D follow the current rendering pipeline.
    In this case, D3D12VideoDecoder inherits D3D11VideoDecoder and reuses most of its methods, only replacing the wrapper with a D3D12 one.

    Bug: 1348104
    Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
    ---
    M build/config/win/BUILD.gn
    26 files changed, 1,354 insertions(+), 154 deletions(-)

    To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-MessageType: newpatchset
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
    Gerrit-Change-Number: 4410406
    Gerrit-PatchSet: 49

    Zhibo Wang (Gerrit)

    unread,
    Sep 27, 2023, 4:56:29 AM9/27/23
    to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

    Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

    Patch set 49:Auto-Submit +1Commit-Queue +1

    View Change

      To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
      Gerrit-Change-Number: 4410406
      Gerrit-PatchSet: 49
      Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
      Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
      Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
      Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
      Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
      Gerrit-CC: Frank Liberato <libe...@chromium.org>
      Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
      Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
      Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
      Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
      Gerrit-Comment-Date: Wed, 27 Sep 2023 08:56:18 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes

      Zhibo Wang (Gerrit)

      unread,
      Sep 27, 2023, 7:50:53 AM9/27/23
      to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

      Attention is currently required from: Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

      View Change

      1 comment:

      • Patchset:

        • Patch Set #48:

          "DelayloadsTest.ChromeDllDelayloadsCheck failed." looks legit actually.

        • Done

      To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
      Gerrit-Change-Number: 4410406
      Gerrit-PatchSet: 49
      Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
      Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
      Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
      Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
      Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
      Gerrit-CC: Frank Liberato <libe...@chromium.org>
      Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
      Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
      Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
      Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
      Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
      Gerrit-Comment-Date: Wed, 27 Sep 2023 11:50:40 +0000

      Dale Curtis (Gerrit)

      unread,
      Sep 27, 2023, 12:48:09 PM9/27/23
      to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

      Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

      Patch set 49:Code-Review +1Commit-Queue +2

      View Change

        To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
        Gerrit-Change-Number: 4410406
        Gerrit-PatchSet: 49
        Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
        Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
        Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
        Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
        Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
        Gerrit-CC: Frank Liberato <libe...@chromium.org>
        Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
        Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
        Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
        Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
        Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
        Gerrit-Comment-Date: Wed, 27 Sep 2023 16:47:57 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes

        Dale Curtis (Gerrit)

        unread,
        Sep 27, 2023, 12:48:16 PM9/27/23
        to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

        Attention is currently required from: Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

        Patch set 49:Commit-Queue +1

        View Change

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 49
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Wed, 27 Sep 2023 16:48:07 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes

          Rafael Cintron (Gerrit)

          unread,
          Sep 27, 2023, 2:41:35 PM9/27/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Dale Curtis, Jianlin Qiu, Ted (Chromium) Meyer, Zhibo Wang.

          View Change

          1 comment:

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #43, Line 218: return WaitForSingleObject(fence_event_.get(), INFINITE) == WAIT_OBJECT_0;

              Ah, I didn't realize this was already happening in the driver; that's unfortunate. […]

              Drive by comment: Unless I am missing something, we should not need to do this synchronous waiting. If you're trying to use D3D12 resources on the D3D11 implicit queue or vice versa, you can do GPU timeline waits on either queue with fences, which are available with both APIs.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 49
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Comment-Date: Wed, 27 Sep 2023 18:41:18 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
          Comment-In-Reply-To: Jianlin Qiu <jianl...@intel.com>

          Jianlin Qiu (Gerrit)

          unread,
          Sep 27, 2023, 9:27:38 PM9/27/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Dale Curtis, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

          View Change

          1 comment:

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Drive by comment: Unless I am missing something, we should not need to do this synchronous waiting. […]

              rafael.cintron@ Could you elaborate more on this?
              We're waiting for the submitted D3D12 decode command to finish execution on the HW queue. Common practice is to set a completion event on the fence, and wait on that event(that we're doing here). If there is a way to avoid that WaitForSingleObject() call, we'll be happy to experiment with it.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 49
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Thu, 28 Sep 2023 01:27:24 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
          Comment-In-Reply-To: Jianlin Qiu <jianl...@intel.com>
          Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>

          Zhibo Wang (Gerrit)

          unread,
          Sep 28, 2023, 12:51:29 AM9/28/23
          to Arthur Eubanks, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Rafael Cintron, Ted (Chromium) Meyer

          Attention is currently required from: Arthur Eubanks, Rafael Cintron, Ted (Chromium) Meyer.

          Zhibo Wang would like Arthur Eubanks to review this change.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newchange
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 49
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Arthur Eubanks <aeub...@google.com>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Arthur Eubanks <aeub...@google.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>

          Arthur Eubanks (Gerrit)

          unread,
          Sep 28, 2023, 12:03:31 PM9/28/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

          View Change

          1 comment:

          • Patchset:

            • Patch Set #49:

              (removed myself as reviewer, please find somebody with more background on the build/config/win/BUILD.gn change)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 49
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Thu, 28 Sep 2023 16:03:10 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Rafael Cintron (Gerrit)

          unread,
          Sep 29, 2023, 9:55:42 PM9/29/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Dale Curtis, Jianlin Qiu, Ted (Chromium) Meyer, Zhibo Wang.

          View Change

          17 comments:

          • File media/gpu/windows/d3d11_video_decoder.cc:

            • Patch Set #49, Line 275: CHECK(SUCCEEDED(d3d_device.As(&device)));

              To CHECK that a function succeeded, I prefer to use `CHECK_EQ(..., S_OK)`. This way, the logs will tell us what the return value ended up being on failure.

            • Patch Set #49, Line 650:

                    if (!ResetD3DVideoDecoder()) {
              return;
              }

              One problem with attempting to reset an existing object instead of creating a brand new one is the object can end up in a half baked state if initialization the second time around fails part way through. I see several places in the implementation of `ResetD3DVideoDecoder` where we early out on error, leaving the the class with a random assortment of old values and new values.

              To make the reset pattern work, you must be militant about first clearing out all of the old state before creating the new state. When you do create the new state, you need to create it into local variables one by one and only commit them to member variables when the entire initialization process finishes.

              If you can pull it off, a better pattern would be to re-create the whole object when state becomes invalid. That way, you don't have to obsess about which member variables could be valid at any given point when you add new code in the future.

            • Patch Set #49, Line 1097: CHECK(SUCCEEDED(d3d_device.As(&d3d11_device)));

              Similarly here, please do `CHECK_EQ(..., S_OK)` so we can see failure HRESULTs in log files.

          • File media/gpu/windows/d3d12_helpers.h:

            • Patch Set #49, Line 58:

                std::vector<ID3D12Resource*> resources_;
              std::vector<UINT> subresources_;
              std::vector<ID3D12VideoDecoderHeap*> heaps_;

              I worry about storing raw pointers in these members. Who is meant to own these and how sure are we that the caller will not free them out from under this class? Any objections to making these be smart pointers just in case?

          • File media/gpu/windows/d3d12_helpers.cc:

            • Patch Set #49, Line 14: device

              Nit: Since the constructor does not take ownership of `device`, best to pass `ID3D12Device` by raw pointer so we avoid unnecessary AddRef/Release.

            • Patch Set #49, Line 17: handle_(handle)

              Strongly prefer passing `handle` via `ScopedHandle` so that you can `std::move` it to the member variable. Makes the ownership transfer more clear and you don't end up with bugs where you close the handle out from under the caller, leak the handle or double close it. All of these lead to difficult to track down issues.

            • Patch Set #49, Line 18:

              HRESULT hr =
              device->OpenSharedHandle(handle_.get(), IID_PPV_ARGS(&resource_));

              Consider having a static `Create` method which calls `OpenSharedHandle` and, only if it succeeds, creates the class with the object. No objects will half baked state if we do it that way.

            • Patch Set #49, Line 45: &&

              If you pass `SharedResourceD3D12` by value and `std::move` it in the caller, you do not need the double `&&`.

            • Patch Set #49, Line 64: barriers

              To avoid unnecessary re-allocation of vectors, reserve the correct number of entries in `barriers` ahead or time. If the number of planes is always known, use `std::array` to avoid heap allocation altogether.

            • Patch Set #49, Line 69:

              subresource + i * desc.MipLevels *
              desc.DepthOrArraySize,

              Nit: Use `D3D12CalcSubresource` helper instead of doing this math yourself.

              https://learn.microsoft.com/en-us/windows/win32/direct3d12/d3d12calcsubresource.

            • Patch Set #49, Line 122: EnableDebugLayer

              If two components in the process call `EnableDebugLayer`, the device will become removed out from under the other one. This will bite you in the future when those other components (Dawn, WebNN, etc) start to get turned on by default.

              I recommend not doing this unconditionally and, instead, use DXCPL.exe to enable the debug layer locally. The D3D12 debug layer can really slow things down compared to the D3D11 one so it might not be a good idea to enable unconditionally in debug builds for non-graphics people on the team.

              See https://learn.microsoft.com/en-us/windows/win32/api/d3d12sdklayers/nf-d3d12sdklayers-id3d12debug-enabledebuglayer

            • Patch Set #49, Line 131: D3D_FEATURE_LEVEL_12_0

              D3D12 supports feature levels starting with 11_0. Any reason we can't start with 11_0 instead of 12? If not, please add a comment explaining why.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • rafael.cintron@ Could you elaborate more on this? […]

              @Jianlin, is the goal of this work to use the decoded bits on the CPU? If so, your code is fine.

              I presume that you want to display the decoded bits with D3D11 or D3D12? If so, then waiting for the completion event on the CPU ties up the CPU thread until the GPU work completes. A better approach would be to create fences on the D3D11 and D3D12 side, signal the fence on the D3D12 command queue and instruct the D3D11 command queue to wait on the fence. With this approach, no CPU thread waits for work to complete, it's all taken care of by the GPU scheduler.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #49, Line 120:

                  HANDLE handle;
              hr = dxgi_resource->CreateSharedHandle(nullptr, GENERIC_ALL, nullptr,
              &handle);

              Creating a share handle can be expensive since it makes a kernel transition. I know that you cache it in `SharedD3D12Resource` which is cached in `reference_frame_list_` but I don't see code which reduces the size of `reference_frame_list_`. Is that going to appear in a subsequent change? How does caching fit in the overall design of your solution?

            • Patch Set #49, Line 240:

                std::vector<uint8_t> picture_parameters_buffer;
              std::vector<uint8_t> inverse_quantization_matrix_buffer;
              std::vector<uint8_t> slice_control_buffer;

              Nit: Please append `_` to all member variables.

            • Patch Set #49, Line 284: resource

              Nit: Please use `std::move` to avoid unnecessary AddRef/Release

            • Patch Set #49, Line 451:

              media_log, device, command_queue, command_allocator, fence, video_device,
              video_decoder, video_decoder_heap, command_list, format_info.PlaneCount);

              Nit: Please `std::move` all of the smartpointers into the constructor arguments.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 49
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Comment-Date: Sat, 30 Sep 2023 01:55:32 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Dale Curtis (Gerrit)

          unread,
          Oct 2, 2023, 12:11:39 PM10/2/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

          View Change

          1 comment:

          • File media/gpu/windows/d3d12_helpers.cc:

            • Patch Set #49, Line 17: handle_(handle)

              Strongly prefer passing `handle` via `ScopedHandle` so that you can `std::move` it to the member var […]

              Yes +1, I thought I had caught all these, sorry I missed some.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 49
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Mon, 02 Oct 2023 16:11:30 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>

          Zhibo Wang (Gerrit)

          unread,
          Oct 12, 2023, 4:37:53 AM10/12/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Dale Curtis, Jianlin Qiu, Ted (Chromium) Meyer, Zhibo Wang.

          Zhibo Wang uploaded patch set #50 to this change.

          View Change

          The following approvals got outdated and were removed: Code-Review+1 by Dale Curtis

          Create D3D12 video decoder


          Since the rendering side don't accept a D3D12Resource now, the d3d12 video decoder will use D3D11Texture2D as picture buffer, open it in D3D12 by shared handle, do D3D12 video decoding and close the handle, then let the D3D11Texture2D follow the current rendering pipeline.
          In this case, D3D12VideoDecoder inherits D3D11VideoDecoder and reuses most of its methods, only replacing the wrapper with a D3D12 one.

          Bug: 1348104
          Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          ---
          M build/config/win/BUILD.gn
          M media/base/media_switches.cc
          M media/base/media_switches.h
          M media/base/win/BUILD.gn
          A media/base/win/d3d12_mocks.cc
          A media/base/win/d3d12_mocks.h
          M media/gpu/BUILD.gn
          M media/gpu/windows/d3d11_h264_accelerator.cc
          M media/gpu/windows/d3d11_h264_accelerator.h
          M media/gpu/windows/d3d11_h265_accelerator.cc
          M media/gpu/windows/d3d11_h265_accelerator.h
          M media/gpu/windows/d3d11_picture_buffer.cc
          M media/gpu/windows/d3d11_picture_buffer.h

          M media/gpu/windows/d3d11_status.h
          M media/gpu/windows/d3d11_video_decoder.cc
          M media/gpu/windows/d3d11_video_decoder.h
          M media/gpu/windows/d3d11_video_decoder_unittest.cc
          M media/gpu/windows/d3d11_video_decoder_wrapper.cc
          M media/gpu/windows/d3d11_video_decoder_wrapper.h
          M media/gpu/windows/d3d11_vp9_accelerator.cc
          A media/gpu/windows/d3d12_helpers.cc
          A media/gpu/windows/d3d12_helpers.h
          A media/gpu/windows/d3d12_helpers_unittest.cc
          A media/gpu/windows/d3d12_video_decoder_wrapper.cc
          A media/gpu/windows/d3d12_video_decoder_wrapper.h
          M media/gpu/windows/d3d_video_decoder_wrapper.h
          M media/gpu/windows/init_guid.cc
          M media/mojo/services/gpu_mojo_media_client_win.cc
          28 files changed, 1,411 insertions(+), 164 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 50
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>

          Zhibo Wang (Gerrit)

          unread,
          Oct 12, 2023, 4:40:55 AM10/12/23
          to Bruce Dawson, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Rafael Cintron, Ted (Chromium) Meyer

          Attention is currently required from: Bruce Dawson, Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

          Zhibo Wang would like Bruce Dawson to review this change.

          View Change

          Create D3D12 video decoder
          Gerrit-MessageType: newchange
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 50
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>

          Zhibo Wang (Gerrit)

          unread,
          Oct 12, 2023, 4:41:03 AM10/12/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Bruce Dawson, Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

          Patch set 50:Auto-Submit +1

          View Change

          17 comments:

          • File media/gpu/windows/d3d11_video_decoder.cc:

            • To CHECK that a function succeeded, I prefer to use `CHECK_EQ(..., S_OK)`. […]

              Done

            •  create it into local variables one by one and only commit them to member variables when the entire initialization process finishes.

              Done.

            • Patch Set #49, Line 1097: CHECK(SUCCEEDED(d3d_device.As(&d3d11_device)));

              Similarly here, please do `CHECK_EQ(..., S_OK)` so we can see failure HRESULTs in log files.

            • Done

          • File media/gpu/windows/d3d12_helpers.h:

            • Patch Set #49, Line 58:

                std::vector<ID3D12Resource*> resources_;
              std::vector<UINT> subresources_;
              std::vector<ID3D12VideoDecoderHeap*> heaps_;

            • I worry about storing raw pointers in these members. […]

              Their life cycle are now(PS50) managed by D3D11PictureBuffer. If the underlying D3D11PictureBuffer is deleted, the such reference index won't be used by the decoder.

          • File media/gpu/windows/d3d12_helpers.cc:

            • Patch Set #49, Line 14: device

              Nit: Since the constructor does not take ownership of `device`, best to pass `ID3D12Device` by raw p […]

              Done

            • Yes +1, I thought I had caught all these, sorry I missed some.

              Done

            • Consider having a static `Create` method which calls `OpenSharedHandle` and, only if it succeeds, cr […]

              Done

            • If you pass `SharedResourceD3D12` by value and `std::move` it in the caller, you do not need the dou […]

              Done

            • To avoid unnecessary re-allocation of vectors, reserve the correct number of entries in `barriers` a […]

              Done

            • Nit: Use `D3D12CalcSubresource` helper instead of doing this math yourself. […]

              D3D12CalcSubresource is defined in `d3dx12.h`. We don't have it yet.

              @dalec...@chromium.org Shall we include `d3dx12.h`? IIUC it is not in the SDK so we may need to add a header file in the source tree.

            • If two components in the process call `EnableDebugLayer`, the device will become removed out from un […]

              Done

            • D3D12 supports feature levels starting with 11_0. […]

              Done. I didn't realize that.


            • > D3D12 supports feature levels starting with 11_0.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • @Jianlin, is the goal of this work to use the decoded bits on the CPU? If so, your code is fine. […]

              I see. Let me do it in a followup CL.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #49, Line 120:

                  HANDLE handle;
              hr = dxgi_resource->CreateSharedHandle(nullptr, GENERIC_ALL, nullptr,
              &handle);

              Creating a share handle can be expensive since it makes a kernel transition.

            • PS50 makes SharedD3D12Resource live with D3D11PictureBuffer, meaning creating shared handle will only be called once after each picture buffer is created.

            • but I don't see code which reduces the size of `reference_frame_list_`.

            • The items in `reference_frame_list_` will be replaced by pictures in the following gop, the size won't exceed a small fixed number which I guess is 16.

            • Patch Set #49, Line 240:

                std::vector<uint8_t> picture_parameters_buffer;
              std::vector<uint8_t> inverse_quantization_matrix_buffer;
              std::vector<uint8_t> slice_control_buffer;

              Nit: Please append `_` to all member variables.

            • Done

            • Done

            • Patch Set #49, Line 451:

              media_log, device, command_queue, command_allocator, fence, video_device,
              video_decoder, video_decoder_heap, command_list, format_info.PlaneCount);

              Nit: Please `std::move` all of the smartpointers into the constructor arguments.

            • Done

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 50
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Thu, 12 Oct 2023 08:40:52 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes

          Zhibo Wang (Gerrit)

          unread,
          Oct 12, 2023, 4:46:29 AM10/12/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Bruce Dawson, Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

          Zhibo Wang uploaded patch set #51 to this change.

          View Change

          Create D3D12 video decoder

          Since the rendering side don't accept a D3D12Resource now, the d3d12 video decoder will use D3D11Texture2D as picture buffer, open it in D3D12 by shared handle, do D3D12 video decoding and close the handle, then let the D3D11Texture2D follow the current rendering pipeline.
          In this case, the D3D12 video decoder backend reuses most of
          media::D3D11VideoDecoder's methods, only replacing the wrapper with a

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 51

          Zhibo Wang (Gerrit)

          unread,
          Oct 12, 2023, 4:47:33 AM10/12/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Bruce Dawson, Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

          Zhibo Wang uploaded patch set #52 to this change.

          Gerrit-PatchSet: 52

          Bruce Dawson (Gerrit)

          unread,
          Oct 12, 2023, 11:18:14 AM10/12/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

          Patch set 52:Code-Review +1

          View Change

          2 comments:

          • Patchset:

          • Commit Message:

            • Patch Set #52, Line 9: Since the rendering side don't accept a D3D12Resource now, the d3d12

              don't -> won't

              Also, what rendering side are you talking about?

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 52
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Thu, 12 Oct 2023 15:17:59 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes

          Dale Curtis (Gerrit)

          unread,
          Oct 12, 2023, 12:56:04 PM10/12/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Bruce Dawson, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

          View Change

          1 comment:

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 52
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Thu, 12 Oct 2023 16:55:52 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Zhibo Wang (Gerrit)

          unread,
          Oct 13, 2023, 2:26:51 AM10/13/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Bruce Dawson, Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

          Patch set 52:Auto-Submit +1

          View Change

          2 comments:

          • Patchset:

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 52
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Fri, 13 Oct 2023 06:26:29 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
          Comment-In-Reply-To: Bruce Dawson <bruce...@chromium.org>

          Zhibo Wang (Gerrit)

          unread,
          Oct 13, 2023, 2:28:39 AM10/13/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Bruce Dawson, Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer.

          Zhibo Wang uploaded patch set #53 to this change.

          View Change

          Create D3D12 video decoder

          Since the rendering side don't accept a D3D12Resource now, the d3d12
          video decoder will use D3D11Texture2D as picture buffer, open it in
          D3D12 by shared handle, do D3D12 video decoding and close the handle,
          then let the D3D11Texture2D follow the current rendering pipeline.
          In this case, the D3D12 video decoder backend reuses most of
          media::D3D11VideoDecoder's methods, only replacing the wrapper with a
          D3D12 one.

          Bug: 1348104, 1434145

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 53

          Dale Curtis (Gerrit)

          unread,
          Oct 13, 2023, 12:27:40 PM10/13/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Bruce Dawson, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Bruce Dawson, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

          View Change

          1 comment:

            • subresource + i * desc.MipLevels *
              desc.DepthOrArraySize,

            • D3D12CalcSubresource is defined in `d3dx12.h`. We don't have it yet. […]

              Hmm, @bruce...@chromium.org -- I would have thought we'd already have that SDK somewhere in the tree.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 53
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Fri, 13 Oct 2023 16:27:28 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Zhibo Wang <zhibo...@intel.com>
          Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>

          Bruce Dawson (Gerrit)

          unread,
          Oct 13, 2023, 3:19:53 PM10/13/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Dale Curtis, Rafael Cintron, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Dale Curtis, Jianlin Qiu, Rafael Cintron, Ted (Chromium) Meyer, Zhibo Wang.

          Patch set 53:Code-Review +1

          View Change

          1 comment:

          • File media/gpu/windows/d3d12_helpers.cc:

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 53
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Fri, 13 Oct 2023 19:19:37 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>

          Rafael Cintron (Gerrit)

          unread,
          Oct 13, 2023, 5:55:34 PM10/13/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Bruce Dawson, Dale Curtis, Frank Liberato, Ted (Chromium) Meyer, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Bruce Dawson, Dale Curtis, Jianlin Qiu, Ted (Chromium) Meyer, Zhibo Wang.

          View Change

          13 comments:

          • Patchset:

            • Patch Set #53:

              I am not quite finished with my review and will not be in the office next week. But here is what I have so far.

          • File media/gpu/windows/d3d11_h264_accelerator.cc:

            • Patch Set #52, Line 350: video_decoder_wrapper_->GetBitstreamBuffer(current_frame_size_);

              All of the other code I see which calls `GetBitStreamBuffer` uses the return value for something. Do we need to call it here? If so, why?

          • File media/gpu/windows/d3d11_picture_buffer.cc:

            • Patch Set #52, Line 104: Microsoft::WRL::ComPtr<ID3D12Device> device

              Since `ToSharedD3D12Resource` does not take ownership of the SmartPointer, would be better to pass a raw interface pointer. Avoids unnecessary AddRef/Release.

          • File media/gpu/windows/d3d11_picture_buffer.cc:

            • Patch Set #53, Line 121:

               shared_d3d12_resource_ =
              SharedD3D12Resource::Create(device.Get(), std::move(handle_holder));

              If `SharedD3D12Resource::Create` fails, it will return null here. We'll want to propagate the "status" out of the factory method.

              Since we don't need to keep the handle around, consider just storing the ID3D12Resource in the object itself. Less memory consumption than storing a pointer to a SharedD3D12Resource and, in that object, a pointer to the D3D12 resource.

          • File media/gpu/windows/d3d11_video_decoder_wrapper.cc:

            • Patch Set #52, Line 56: bool GetSingleTextureRecommended(bool* is_recommended)

              Militant Chromium reviewers would prefer having `GetSingleTextureRecommended` return `std::optional<bool>`. Less potential for developers to ignore the return value or forget to assign `is_recommended`.

            • Patch Set #52, Line 323: D3D11DecoderConfigurator*

              Can `decoder_configurator` be a const reference?

          • File media/gpu/windows/d3d12_helpers.h:

            • Patch Set #53, Line 45: base::win::ScopedHandle handle_;

              Since you're not going to use the handle for anything other than creating the resource, you can simply keep the ID3D12Resource reference alive. Saves an entry in the process handle table.

            • Patch Set #53, Line 68:

                absl::InlinedVector<ID3D12Resource*, kMaxReferenceFrameListSize> resources_;
              absl::InlinedVector<UINT, kMaxReferenceFrameListSize> subresources_;
              absl::InlinedVector<ID3D12VideoDecoderHeap*, kMaxReferenceFrameListSize>
              heaps_;

              If these cannot exceed `kMaxReferenceFrameListSize`, then `std::array` would be a simpler container to use.

          • File media/gpu/windows/d3d12_helpers.cc:

            • We have the latest Windows SDK (22H2) but apparently that doesn't come with d3dx12.h. […]

              I didn't realize using this helper would involve taking these dependencies. Calculating subresource numbers is not complicated so probably fine to have our own helper for Chromium.

          • File media/gpu/windows/d3d12_helpers.cc:

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #53, Line 85: WaitForFrameBegins

              Unless I am missing something, I not see any "waiting" in this method. Why is it called `WaitForFrameBegins`?

            • Patch Set #53, Line 416:

                Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue;
              D3D12_COMMAND_QUEUE_DESC command_queue_desc{
              D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE};
              hr = device->CreateCommandQueue(&command_queue_desc,
              IID_PPV_ARGS(&command_queue));
              RETURN_IF_FAILED2(hr, "D3D12Device CreateCommandQueue failed");

              Creating a command queue for every single video can be expensive. You'll typically want one per adapter. Can we share these between videos as an optimization down the road? Command queues are thread safe in D3D12 so you can submit work to them from multiple threads with no crashes.

            • Patch Set #53, Line 434: CHECK_EQ(command_list->Close(), S_OK);

              Why are closing a command list you just created?

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 53
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Comment-Date: Fri, 13 Oct 2023 21:55:20 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
          Comment-In-Reply-To: Zhibo Wang <zhibo...@intel.com>
          Comment-In-Reply-To: Bruce Dawson <bruce...@chromium.org>
          Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>

          Zhibo Wang (Gerrit)

          unread,
          Oct 16, 2023, 2:20:45 AM10/16/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Bruce Dawson, Jianlin Qiu, Ted (Chromium) Meyer, Zhibo Wang.

          Zhibo Wang uploaded patch set #54 to this change.

          View Change

          28 files changed, 1,431 insertions(+), 163 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 54
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>

          Zhibo Wang (Gerrit)

          unread,
          Oct 16, 2023, 2:23:35 AM10/16/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron

          Attention is currently required from: Bruce Dawson, Jianlin Qiu.

          Zhibo Wang has uploaded this change for review.

          Gerrit-MessageType: newchange
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 54
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Attention: Bruce Dawson <bruce...@chromium.org>

          Zhibo Wang (Gerrit)

          unread,
          Oct 16, 2023, 2:24:08 AM10/16/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron.

          Patch set 54:Auto-Submit +1

          View Change

          12 comments:

          • File media/gpu/windows/d3d11_h264_accelerator.cc:

            • All of the other code I see which calls `GetBitStreamBuffer` uses the return value for something. […]

              `GetBitstreamBuffer()` will create the buffer if it does not exist with the given size and return the buffer. Calling it here is to make sure it creates one with a large enough size `current_frame_size_`, since

              • D3D12 video decoder don't accept chopped bitstream buffer, so we need to reserve the buffer with the size large enough to contain the whole frame, and
              • the following calls are in the base class who don't know this size.
          • File media/gpu/windows/d3d11_picture_buffer.cc:

            • Since `ToSharedD3D12Resource` does not take ownership of the SmartPointer, would be better to pass a […]

              Done

          • File media/gpu/windows/d3d11_picture_buffer.cc:

            • Patch Set #53, Line 121:

               shared_d3d12_resource_ =
              SharedD3D12Resource::Create(device.Get(), std::move(handle_holder));

              If SharedD3D12Resource::Create fails, it will return null here. We'll want to propagate the "status" out of the factory method.

            • Yes I missed something here.

          • File media/gpu/windows/d3d11_video_decoder_wrapper.cc:

            • Militant Chromium reviewers would prefer having `GetSingleTextureRecommended` return `std::optional< […]

              Done. But still we may get confused that bool(return_value) is whether there is a value instead of the value is true, especially when we use auto.

            • Adding `const`, but I don't see reference(instead of pointer) is commonly used in the code around.

          • File media/gpu/windows/d3d12_helpers.h:

            • Since you're not going to use the handle for anything other than creating the resource, you can simp […]

              My question is when the ID3D12Resource is still alive, can the handle that creates the resource be closed? SharedD3D12Resource here is to make sure the handle get closed after the resource is released.

            • Patch Set #53, Line 68:

                absl::InlinedVector<ID3D12Resource*, kMaxReferenceFrameListSize> resources_;
              absl::InlinedVector<UINT, kMaxReferenceFrameListSize> subresources_;
              absl::InlinedVector<ID3D12VideoDecoderHeap*, kMaxReferenceFrameListSize>
              heaps_;

            • If these cannot exceed `kMaxReferenceFrameListSize`, then `std::array` would be a simpler container […]

              Done

          • File media/gpu/windows/d3d12_helpers.cc:

            • I didn't realize using this helper would involve taking these dependencies. […]

              Done

          • File media/gpu/windows/d3d12_helpers.cc:

            • Done

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Unless I am missing something, I not see any "waiting" in this method. […]

              This is abstracted interface. In D3D11, we call `DecoderBeginFrame()` in loop until it is ready.

            • Patch Set #53, Line 416:

                Microsoft::WRL::ComPtr<ID3D12CommandQueue> command_queue;
              D3D12_COMMAND_QUEUE_DESC command_queue_desc{
              D3D12_COMMAND_LIST_TYPE_VIDEO_DECODE};
              hr = device->CreateCommandQueue(&command_queue_desc,
              IID_PPV_ARGS(&command_queue));
              RETURN_IF_FAILED2(hr, "D3D12Device CreateCommandQueue failed");

            • down the road

              Yes of course. Adding a TODO here.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 54
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Mon, 16 Oct 2023 06:23:56 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes

          Zhibo Wang (Gerrit)

          unread,
          Nov 6, 2023, 1:11:13 AM11/6/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron.

          View Change

          1 comment:

          • Patchset:

            • Patch Set #53:

              I am not quite finished with my review and will not be in the office next week. […]

              Friendly ping in case you missed it. ptal.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 54
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Mon, 06 Nov 2023 06:11:02 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>

          Rafael Cintron (Gerrit)

          unread,
          Nov 9, 2023, 12:45:48 PM11/9/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang.

          View Change

          2 comments:

          • Patchset:

            • Patch Set #54:

              @Zhibo, thank you very much for your patience. Will review today/tomorrow

          • File media/gpu/windows/d3d12_helpers.h:

            • My question is when the ID3D12Resource is still alive, can the handle that creates the resource be c […]

              The handle and ID3D12Resource pointers both keep a strong reference to the texture. Close/Releasing one does not affect the reference count of the other one.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 54
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Comment-Date: Thu, 09 Nov 2023 17:45:30 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Zhibo Wang (Gerrit)

          unread,
          Nov 10, 2023, 12:45:58 AM11/10/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          Zhibo Wang uploaded patch set #55 to this change.

          View Change

          28 files changed, 1,410 insertions(+), 164 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 55
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>

          Zhibo Wang (Gerrit)

          unread,
          Nov 10, 2023, 6:04:16 AM11/10/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron.

          Patch set 55:Auto-Submit +1

          View Change

          2 comments:

          • Patchset:

            • Patch Set #54:

              @Zhibo, thank you very much for your patience. […]

              Good to hear from you. Thanks for taking time reviewing this XL patch.

          • File media/gpu/windows/d3d12_helpers.h:

            • The handle and ID3D12Resource pointers both keep a strong reference to the texture. […]

              I see. In that case I don't even need the SharedD3D12Resource class. Removing it in PS55.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 55
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Fri, 10 Nov 2023 11:04:03 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes

          Rafael Cintron (Gerrit)

          unread,
          Nov 10, 2023, 8:32:07 PM11/10/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang.

          View Change

          11 comments:

          • Patchset:

            • Patch Set #55:

              @Zhibo, thank you for your patience. Here is another round of feedback.

          • File media/gpu/windows/d3d11_picture_buffer.cc:

            • Patch Set #55, Line 107: HRESULT hr = texture_.As(&dxgi_resource);

              Nit: We can `CHECK_EQ(..., S_OK)` QIs from `ID3D11Texture2D` to `IDXGIResource1`.

          • File media/gpu/windows/d3d12_helpers.cc:

            • Patch Set #55, Line 22: ToD3D12VideoDecodeReferenceFrames

              Nit: Can `ToD3D12VideoDecodeReferenceFrames` be const?

            • Patch Set #55, Line 54: SUCCEEDED(temp->GetDesc(&desc)

              Nit: Should be save to `CHECK_EQ(..., S_OK)` for calls to `GetDesc`.

            • Patch Set #55, Line 57: adapter = temp;

              Nit: `adapter = std::move(temp)`

            • Patch Set #55, Line 84: resource

              Nit: Since `CreateD3D12TransitionBarriersForAllPlanes` does not take ownership of the resource, you can save an unnecessary AddRef/Release by just passing as a raw pointer.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #53, Line 434: CHECK_EQ(command_list->Close(), S_OK);

              I am referring to […]

              The comment states that the main loop of the sample app expects the command list to be closed.

              Is that also true for Chromium?

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #55, Line 207: CreateEventEx

              `CreateEventEx` seems overkill for what you want to do. You can simply do `::CreateEvent(nullptr, /*bManualReset*/ TRUE, /*bInitialState*/ FALSE, nullptr)`.

            • Patch Set #55, Line 273: raw_ptr

              For pointers you're assigning in the constructor, favor `raw_ref`.

            • Patch Set #55, Line 319: picture_parameters_buffer_

              If these three data buffers (`picture_parameters_buffer_`, `inverse_quantization_matrix_buffer_` and `slice_control_buffer_`) are mutually exclusive with one another, consider just having one `std::vector` in the class and call it `data_buffer_` or something similar.

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • Patch Set #55, Line 37: CreateD3D12Device(luid)

              I see that the d3d11 device is nice and cached. Can we do the same for the D3D12 one?

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 55
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Comment-Date: Sat, 11 Nov 2023 01:31:54 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Zhibo Wang (Gerrit)

          unread,
          Nov 13, 2023, 12:44:55 AM11/13/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Zhibo Wang.

          Zhibo Wang uploaded patch set #56 to this change.

          View Change

          28 files changed, 1,411 insertions(+), 164 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 56

          Zhibo Wang (Gerrit)

          unread,
          Nov 13, 2023, 1:27:23 AM11/13/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron.

          Patch set 56:Auto-Submit +1

          View Change

          10 comments:

          • File media/gpu/windows/d3d11_picture_buffer.cc:

            • Patch Set #55, Line 107: HRESULT hr = texture_.As(&dxgi_resource);

              Nit: We can `CHECK_EQ(..., S_OK)` QIs from `ID3D11Texture2D` to `IDXGIResource1`.

            • Done

          • File media/gpu/windows/d3d12_helpers.cc:

            • Got compile error:
              ```
              ../../media/gpu/windows/d3d12_helpers.cc(25,23): error: cannot initialize a member subobject of type 'ID3D12Resource **' with an rvalue of type 'const value_type *' (aka 'ID3D12Resource *const *')
              25 | .ppTexture2Ds = resources_.data(),
              | ^~~~~~~~~~~~~~~~~
              ../../media/gpu/windows/d3d12_helpers.cc(26,24): error: cannot initialize a member subobject of type 'UINT *' (aka 'unsigned int *') with an rvalue of type 'const value_type *' (aka 'const unsigned int *')
              26 | .pSubresources = subresources_.data(),
              | ^~~~~~~~~~~~~~~~~~~~
              ../../media/gpu/windows/d3d12_helpers.cc(27,18): error: cannot initialize a member subobject of type 'ID3D12VideoDecoderHeap **' with an rvalue of type 'const value_type *' (aka 'ID3D12VideoDecoderHeap *const *')
              27 | .ppHeaps = heaps_.data(),
              | ^~~~~~~~~~~~~
              ```
            • Patch Set #55, Line 54: SUCCEEDED(temp->GetDesc(&desc)

              Nit: Should be save to `CHECK_EQ(..., S_OK)` for calls to `GetDesc`.

            • Done

            • Done

            • Nit: Since `CreateD3D12TransitionBarriersForAllPlanes` does not take ownership of the resource, you […]

              Done

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • The comment states that the main loop of the sample app expects the command list to be closed. […]

              Yes, in the implementation I also do reset-record-close in the loop, which expects the command list to be initially closed.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • `CreateEventEx` seems overkill for what you want to do. […]

              Done

            • Done

            • If these three data buffers (`picture_parameters_buffer_`, `inverse_quantization_matrix_buffer_` and […]

              No, at least two (possible all three of them) are used at the same time.

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • I see that the d3d11 device is nice and cached. […]

              Now cached inside CreateD3D12Device().

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 56
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Mon, 13 Nov 2023 06:27:13 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes

          Rafael Cintron (Gerrit)

          unread,
          Nov 13, 2023, 8:36:42 PM11/13/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Dale Curtis, Jianlin Qiu, Zhibo Wang.

          View Change

          13 comments:

          • File media/gpu/windows/d3d11_h264_accelerator.cc:

            • `GetBitstreamBuffer()` will create the buffer if it does not exist with the given size and return th […]

              Thank you for the explanation. Please include your reply in the comments for the code.

          • File media/gpu/windows/d3d11_video_decoder.h:

            • Patch Set #56, Line 9:

              #include <d3d12.h>
              #include <d3d12video.h>

              Since you're not using any D3D12 types, you should be able to remove these D3D12-specific includes.

          • File media/gpu/windows/d3d11_video_decoder.cc:

            • Patch Set #56, Line 376:

                // Note that we assume that this is the ANGLE device, since we don't implement
              // texture sharing properly. That also implies that this is the GPU main
              // thread, since we use non-threadsafe properties of the device (e.g., we get
              // the immediate context).
              //
              // Also note that we don't technically have a guarantee that the ANGLE device
              // will use the most recent version of D3D11; it might be configured to use
              // D3D9. In practice, though, it seems to use 11.1 if it's available, unless
              // it's been specifically configured via switch to avoid d3d11.

              These comments could use updating now that we're sometimes using D3D12 for video decoding.

          • File media/gpu/windows/d3d11_video_decoder_wrapper.cc:

            • Adding `const`, but I don't see reference(instead of pointer) is commonly used in the code around.

          • File media/gpu/windows/d3d12_helpers.h:

            • Patch Set #56, Line 16: #include "base/win/scoped_handle.h"

              scoped_handle.h doesn't appear to be used in the header file, please move it to the cc file.

            • Patch Set #56, Line 23: inlined_vector.h"

              inlined_vector.h doesn't appear to be used in the header file, please move it to the cc file.

          • File media/gpu/windows/d3d12_helpers.h:

            • Patch Set #49, Line 58:

                std::vector<ID3D12Resource*> resources_;
              std::vector<UINT> subresources_;
              std::vector<ID3D12VideoDecoderHeap*> heaps_;

            • Their life cycle are now(PS50) managed by D3D11PictureBuffer. […]

              Acknowledged

          • File media/gpu/windows/d3d12_helpers.cc:

            • Got compile error: […]

              I think using `const_cast` here is warranted.

          • File media/gpu/windows/d3d12_helpers.cc:

            • Patch Set #56, Line 49: luid != CHROME_LUID{}

              We've had at least a couple of scenarios where two calls to `EnumAdapters` return different default adapters on multi-adapter systems due to race conditions. These result in hard to repro bugs for end users.

              Unless there is a good reason not to, please force the caller to pass a LUID here. For test code, use `CHECK_IS_TEST` (with a comment) to only allow test code to pass a null LUID.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • I see. Let me do it in a followup CL.

              Acknowledged

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • > Creating a share handle can be expensive since it makes a kernel transition. […]

              Acknowledged

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • This is abstracted interface. In D3D11, we call `DecoderBeginFrame()` in loop until it is ready.

            • Acknowledged

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • Now cached inside CreateD3D12Device().

              Caching them as static variables like you've done in the latest update is not thread safe.

              Is there a reason we can't store/cache the D3D12 device in the same place we do the D3D11 one?

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 56
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Jianlin Qiu <jianl...@intel.com>
          Gerrit-Comment-Date: Tue, 14 Nov 2023 01:36:30 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
          Comment-In-Reply-To: Zhibo Wang <zhibo...@intel.com>

          Zhibo Wang (Gerrit)

          unread,
          Nov 14, 2023, 4:06:29 AM11/14/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Jianlin Qiu, Zhibo Wang.

          Zhibo Wang uploaded patch set #57 to this change.

          View Change

          28 files changed, 1,423 insertions(+), 164 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 57
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>

          Zhibo Wang (Gerrit)

          unread,
          Nov 14, 2023, 4:10:53 AM11/14/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron.

          Patch set 57:Auto-Submit +1

          View Change

          9 comments:

          • File media/gpu/windows/d3d11_h264_accelerator.cc:

            • Thank you for the explanation. Please include your reply in the comments for the code.

              Done

          • File media/gpu/windows/d3d11_video_decoder.h:

            • Patch Set #56, Line 9:

              #include <d3d12.h>
              #include <d3d12video.h>

              Since you're not using any D3D12 types, you should be able to remove these D3D12-specific includes.

            • Done

          • File media/gpu/windows/d3d11_video_decoder.cc:

            • Patch Set #56, Line 376:

                // Note that we assume that this is the ANGLE device, since we don't implement
              // texture sharing properly. That also implies that this is the GPU main
              // thread, since we use non-threadsafe properties of the device (e.g., we get
              // the immediate context).
              //
              // Also note that we don't technically have a guarantee that the ANGLE device
              // will use the most recent version of D3D11; it might be configured to use
              // D3D9. In practice, though, it seems to use 11.1 if it's available, unless
              // it's been specifically configured via switch to avoid d3d11.

              These comments could use updating now that we're sometimes using D3D12 for video decoding.

            • Current D3D12 video decoder implementation still lives with D3D11, as in `d3d11_video_decoder.cc` the code here manages the picture buffers with D3D11.

              How do you expect me update the comments? I think the code here is not changed (I am doing some renaming and refactoring works in this file, but not D3D12-specific) and is functioning as-is. The following code do creates a D3D11 device even when D3D12 backend is used.

          • File media/gpu/windows/d3d11_video_decoder_wrapper.cc:

            • Patch Set #56, Line 16: #include "base/win/scoped_handle.h"

              scoped_handle.h doesn't appear to be used in the header file, please move it to the cc file.

            • The `.cc` is not using it either. Removing.

            • Patch Set #56, Line 23: inlined_vector.h"

              inlined_vector.h doesn't appear to be used in the header file, please move it to the cc file.

            • Around line 64
              ```
              MEDIA_GPU_EXPORT absl::InlinedVector<D3D12_RESOURCE_BARRIER, 2>
              CreateD3D12TransitionBarriersForAllPlanes(ID3D12Resource* resource,
              ...
              ```

          • File media/gpu/windows/d3d12_helpers.cc:

            • We've had at least a couple of scenarios where two calls to `EnumAdapters` return different default […]

              Done

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 57
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Tue, 14 Nov 2023 09:10:41 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Zhibo Wang <zhibo...@intel.com>
          Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>

          Rafael Cintron (Gerrit)

          unread,
          Nov 15, 2023, 10:21:52 PM11/15/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang.

          View Change

          13 comments:

          • Patchset:

            • Patch Set #57:

              @Zhibo, thank you for your patience. I think we're getting close.

          • File media/gpu/windows/d3d11_video_decoder.cc:

            • Patch Set #56, Line 376:

                // Note that we assume that this is the ANGLE device, since we don't implement
              // texture sharing properly. That also implies that this is the GPU main
              // thread, since we use non-threadsafe properties of the device (e.g., we get
              // the immediate context).
              //
              // Also note that we don't technically have a guarantee that the ANGLE device
              // will use the most recent version of D3D11; it might be configured to use
              // D3D9. In practice, though, it seems to use 11.1 if it's available, unless
              // it's been specifically configured via switch to avoid d3d11.

            • Current D3D12 video decoder implementation still lives with D3D11, as in `d3d11_video_decoder. […]

              Apologies. I was confusing this call to `get_d3d_device_cb_.Run` with the one where you grab the D3D12 device.

          • File media/gpu/windows/d3d12_helpers.h:

          • File media/gpu/windows/d3d12_helpers.cc:

            • > Avoid const_cast to remove const […]

              I think the compiler is unhappy with the fact that you're assigning a pointer you're not meant to change `resources_.data()` to `ppTexture2Ds` which is a non-const pointer. The callers does not change these pointers, which is why I suggested to use const_cast.

              I do not feel strongly about this one so feel free to resolve if you wish.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #57, Line 106: if (!(desc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_NTHANDLE))

              Should lack of `D3D11_RESOURCE_MISC_SHARED_NTHANDLE` be `CHECK`-ed? Seems like developer error during setup of the texture ... and kind of late to be doing such error handling here.

            • Patch Set #57, Line 154: NumFrameArguments++

              What code wraps `NumFrameArguments` back to zero? Does code need to call `Reset`?

            • Patch Set #57, Line 234: num_planes_

              Nit: `num_planes_` can be const since you initialize it in the constructor.

            • Patch Set #57, Line 250: ScopedD3D12MemoryBuffer::

              Nit: Since you're already in `ScopedD3D12MemoryBuffer`, this can be simplified to just call `Commit`

            • Patch Set #57, Line 262: NumFrameArguments++

              I see there's a `CHECK_LE(input_stream_arguments_.NumFrameArguments, 3u)` in `SubmitSlice`. We should probably have one here as well.

            • Patch Set #57, Line 274: type_

              Nit: `type_` can be const since it is initialized in the constructor.

            • Patch Set #57, Line 419: TODO:

              Please have a crbug # for this and other TODOs in the CL. CommandQueues are expensive, memorywise. Typically best to have one per kind.

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • > Is there a reason we can't store/cache the D3D12 device in the same place we do the D3D11 one? […]

              If you're always starting with a D3D11 device and a LUID is not always available, then you can QI the D3D11 device for an `IDXGIDevice`, then QI the `IDXGIDevice` for an `IDXGIAdapter` and pass the adapter to `D3D12CreateDevice`.

              We can cache that in a static and initialize it in a threadsafe manner. See `DXGISwapChainTearingSupported` in src\ui\gl\direct_composition_support.cc for an example.

              Hopefully they'll add a `SharedContextState::GetD3D12Device` soon so we don't have to keep local caches in each Chromium component.

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 57
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Comment-Date: Thu, 16 Nov 2023 03:21:40 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Zhibo Wang (Gerrit)

          unread,
          Nov 16, 2023, 1:57:09 AM11/16/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Zhibo Wang.

          Zhibo Wang uploaded patch set #58 to this change.

          View Change

          28 files changed, 1,419 insertions(+), 196 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 58

          Zhibo Wang (Gerrit)

          unread,
          Nov 16, 2023, 1:59:33 AM11/16/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron.

          Patch set 58:Auto-Submit +1

          View Change

          10 comments:

          • File media/gpu/windows/d3d12_helpers.cc:

            • I think the compiler is unhappy with the fact that you're assigning a pointer you're not meant to ch […]

              I think this is the case that ideally it should be const, but in implementation it could not be (due to D3D12_VIDEO_DECODE_REFERENCE_FRAMES having non-const pointers). I would like to keep this non-const to avoid potential bugs if the caller accidentally changed the value.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Should lack of `D3D11_RESOURCE_MISC_SHARED_NTHANDLE` be `CHECK`-ed? Seems like developer error durin […]

              Done

            • In `Reset()`.

              Does code need to call Reset?

              We shouldn't do it here. The arguments is stored but not submitted yet.
              `WaitForFrameBegins()` will call `Reset()`.
            • Done

            • Patch Set #57, Line 250: ScopedD3D12MemoryBuffer::

              Nit: Since you're already in `ScopedD3D12MemoryBuffer`, this can be simplified to just call `Commit`

            • I got an warning if I call virtual method in the destructor. The `ScopedD3D12MemoryBuffer::` is to eliminate the ambiguity.

            • I see there's a `CHECK_LE(input_stream_arguments_.NumFrameArguments, 3u)` in `SubmitSlice`. […]

              `SubmitSlice()` do final submission of the arguments, and it knows there should be at most three arguments. The buffer itself is innocent.

              The `CHECK_LE` in `SubmitSlice()` is the semantics of finishing a slice, not for `NumFrameArguments++`.

            • Done

            • Typically best to have one per kind.

              ```
              typedef
              enum D3D12_COMMAND_QUEUE_FLAGS
              {
              D3D12_COMMAND_QUEUE_FLAG_NONE = 0,
              D3D12_COMMAND_QUEUE_FLAG_DISABLE_GPU_TIMEOUT = 0x1
              } D3D12_COMMAND_QUEUE_FLAGS;

              typedef struct D3D12_COMMAND_QUEUE_DESC
              {
              D3D12_COMMAND_LIST_TYPE Type;
              INT Priority;
              D3D12_COMMAND_QUEUE_FLAGS Flags;
              UINT NodeMask;
              } D3D12_COMMAND_QUEUE_DESC;
              ```

              What if we have different priority/flags/node_mask setting?

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • PS58 cached inside `GetD3DDeviceCallback()` using `gpu_info.active_gpu().luid`, and reverted @jianl...@intel.com 's CL5009578 since passing luid into video decoder seems redundant now.

            • Hopefully they'll add a SharedContextState::GetD3D12Device soon so we don't have to keep local caches in each Chromium component.

            • Done

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 58
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Thu, 16 Nov 2023 06:59:18 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes

          Zhibo Wang (Gerrit)

          unread,
          Nov 16, 2023, 2:16:04 AM11/16/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Rafael Cintron.

          Zhibo Wang uploaded patch set #59 to this change.

          View Change

          28 files changed, 1,423 insertions(+), 196 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 59

          Zhibo Wang (Gerrit)

          unread,
          Nov 16, 2023, 2:16:17 AM11/16/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron.

          Patch set 58:Auto-Submit +1

          View Change

          1 comment:

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #57, Line 262: NumFrameArguments++

              `SubmitSlice()` do final submission of the arguments, and it knows there should be at most three arg […]

              Added checks to ensure the index won't exceed the size of array, which is 10.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 58
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Thu, 16 Nov 2023 07:16:07 +0000

          Rafael Cintron (Gerrit)

          unread,
          Nov 17, 2023, 3:44:05 PM11/17/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang.

          View Change

          4 comments:

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • I got an warning if I call virtual method in the destructor. […]

              Acknowledged

            • > Typically best to have one per kind. […]

              Chromium should never create a queue which disables GPU timeouts since that will negatively affect other applications on the system.

              If we ever use multi-node adapters, then having one queue for each of these is fine.

              We should tread lightly before creating queues of different priorities to avoid higher priority work completely starving low priority work. But that's a challenge for another day.

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • PS58 cached inside `GetD3DDeviceCallback()` using `gpu_info.active_gpu(). […]

              Since you're always starting with a D3D11 device, it's more efficient to obtain the DXGI adapter from it directly and use that to create the D3D12 device. No need to re-enumerate all of the adapters and search for matching LUIDs.

              In practice, when will the weakpointer to the `MediaGpuChannelManager` not resolve?
              Seems like we shouldn't create the D3D12 device if it doesn't exist?

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 59
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Comment-Date: Fri, 17 Nov 2023 20:43:52 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Rafael Cintron (Gerrit)

          unread,
          Nov 17, 2023, 6:09:05 PM11/17/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Zhibo Wang, Bruce Dawson, Dale Curtis

          Attention is currently required from: Zhibo Wang.

          Zhibo Wang has uploaded this change for review.

          View Change

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newchange
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 59
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>

          Rafael Cintron (Gerrit)

          unread,
          Nov 17, 2023, 6:09:11 PM11/17/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang.

          View Change

          1 comment:

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • Patch Set #59, Line 37: Microsoft::WRL::ComPtr<ID3D12Device> device

              You can't really store objects with destructors in statics. Since the destructor is not going to run in practice, should be good to store a raw pointer here or use base::NoDestructor.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 59
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Comment-Date: Fri, 17 Nov 2023 23:09:00 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Zhibo Wang (Gerrit)

          unread,
          Nov 20, 2023, 12:26:33 AM11/20/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Zhibo Wang.

          Zhibo Wang uploaded patch set #60 to this change.

          View Change

          28 files changed, 1,413 insertions(+), 196 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 60

          Zhibo Wang (Gerrit)

          unread,
          Nov 20, 2023, 3:07:46 AM11/20/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Zhibo Wang.

          Zhibo Wang uploaded patch set #61 to this change.

          View Change

          28 files changed, 1,415 insertions(+), 196 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 61

          朱思达 (Gerrit)

          unread,
          Nov 20, 2023, 11:43:06 PM11/20/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang.

          View Change

          1 comment:

          • Patchset:

            • Patch Set #61:

              with PS#61, I got below stack:
              ```
              Received fatal exception EXCEPTION_ACCESS_VIOLATION
              (No symbol) [0x00007FFD7EF28D8E]
              (No symbol) [0x00007FFD7EF28C91]
              D3D11TranslateCreateDevice [0x00007FFC99A9164D+230781]
              (No symbol) [0x0000015919670B68]
              2
              (No symbol) [0x0000015919671000]
              malloc_base [0x00007FFD83011B06+54]
              media::D3D11VideoDecoderWrapper::Create [0x00007FFCA220D5FF+103] (C:\Users\zhusi\Desktop\Projects\chromium\src\media\gpu\windows\d3d11_video_decoder_wrapper.cc:326)
              media::D3D11VideoDecoder::CreateD3DVideoDecoderWrapper [0x00007FFCA2203B65+773] (C:\Users\zhusi\Desktop\Projects\chromium\src\media\gpu\windows\d3d11_video_decoder.cc:299)
              media::D3D11VideoDecoder::ResetD3DVideoDecoder [0x00007FFCA220356D+653] (C:\Users\zhusi\Desktop\Projects\chromium\src\media\gpu\windows\d3d11_video_decoder.cc:252)
              media::D3D11VideoDecoder::Initialize [0x00007FFCA22045DC+1116] (C:\Users\zhusi\Desktop\Projects\chromium\src\media\gpu\windows\d3d11_video_decoder.cc:414)
              ```

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 61
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Comment-Date: Tue, 21 Nov 2023 04:42:54 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Zhibo Wang (Gerrit)

          unread,
          Nov 21, 2023, 12:28:42 AM11/21/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Zhibo Wang.

          Zhibo Wang uploaded patch set #62 to this change.

          View Change

          28 files changed, 1,419 insertions(+), 196 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 62

          Zhibo Wang (Gerrit)

          unread,
          Nov 21, 2023, 2:10:11 AM11/21/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, 朱思达, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, 朱思达.

          Patch set 62:Auto-Submit +1

          View Change

          6 comments:

          • Patchset:

          • Commit Message:

          • File media/gpu/windows/d3d11_video_decoder.cc:

            • Patch Set #42, Line 197: bool D3D11VideoDecoder::ResetD3DVideoDecoder() {

              The creation of `ID3D11VideoDecoder` is moved to `CreateD3DVideoDecoderWrapper()`. […]

              Now reset to `Reset`.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #57, Line 419: TODO:

              Chromium should never create a queue which disables GPU timeouts since that will negatively affect o […]

              Acknowledged and done

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • Since you're always starting with a D3D11 device, it's more efficient to obtain the DXGI adapter fro […]

              Done

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • You can't really store objects with destructors in statics. […]

              Done

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 62
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Attention: 朱思达 <zhu...@bytedance.com>
          Gerrit-Comment-Date: Tue, 21 Nov 2023 07:09:59 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Zhibo Wang <zhibo...@intel.com>
          Comment-In-Reply-To: Frank Liberato <libe...@chromium.org>
          Comment-In-Reply-To: Bruce Dawson <bruce...@chromium.org>
          Comment-In-Reply-To: 朱思达 <zhu...@bytedance.com>
          Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>

          朱思达 (Gerrit)

          unread,
          Nov 21, 2023, 8:14:23 AM11/21/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          View Change

          1 comment:

          • Patchset:

            • Patch Set #62:

              When D3D12 Decoder is enabled and When try to playback a 10bit 420 P010 HEVC video, I got the below message:

              ```
              00:00:00.031 info "D3D11VideoDecoder is using hevc main 10 / 4:2:0"
              00:00:00.031 info "D3D11VideoDecoder producing P010"
              00:00:00.031 info "D3D11VideoDecoder: Selected P016LE"
              00:00:00.031 info "D3D11VideoDecoder output color space: (same as input)"
              00:00:00.031 info "D3D11VideoDecoder is binding textures"
              00:00:00.031 error "D3D12VideoDecoder does not support codec hevc with chroma subsampling format 4:2:0 and bit depth 8"
              00:00:00.031 info "Cannot select D3D11VideoDecoder for video decoding"
              00:00:00.031 info "Cannot select VpxVideoDecoder for video decoding"
              00:00:00.031 info "Cannot select Dav1dVideoDecoder for video decoding"
              00:00:00.031 info "Cannot select FFmpegVideoDecoder for video decoding"
              00:00:00.031 error "video decoder initialization failed"
              00:00:00.031 error {"code":15,"data":{},"group":"PipelineStatus","message":"","stack":[{"file":"media\\renderers\\video_renderer_impl.cc","line":304}]}
              ```

              Seems the bit depth guessing doesn't working and you are using the default 8 bit depth.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 62
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Tue, 21 Nov 2023 13:14:10 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          朱思达 (Gerrit)

          unread,
          Nov 21, 2023, 8:20:53 AM11/21/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          View Change

          1 comment:

          • File media/gpu/windows/d3d11_video_decoder.cc:

            • Patch Set #62, Line 294: media_log_.get(), video_device, config_, bit_depth_, chroma_sampling_);

              I guess, this can always be the default bit depth which cause the problem.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 62
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Tue, 21 Nov 2023 13:20:44 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          朱思达 (Gerrit)

          unread,
          Nov 21, 2023, 8:36:10 AM11/21/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          View Change

          1 comment:

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 62
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Tue, 21 Nov 2023 13:36:00 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: 朱思达 <zhu...@bytedance.com>

          Zhibo Wang (Gerrit)

          unread,
          Nov 22, 2023, 12:37:40 AM11/22/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          Zhibo Wang uploaded patch set #63 to this change.

          View Change

          Create D3D12 video decoder

          Since the rendering side don't accept a D3D12Resource now, the d3d12
          28 files changed, 1,421 insertions(+), 196 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 63

          Zhibo Wang (Gerrit)

          unread,
          Nov 22, 2023, 12:38:32 AM11/22/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, 朱思达, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, 朱思达.

          Patch set 63:Auto-Submit +1

          View Change

          2 comments:

            • Seems the bit depth guessing doesn't working and you are using the default 8 bit depth.

            • Fixed.

            • I cannot open 8k30p, 5.7k60p and several specific video, got HTTP 403 for those files.

            • Is this happening only when one video is playing and one is started but loading? If so, I have observed same issue with D3D11 backend, in that case this should be an existing bug, not being related to this CL.

          • File media/gpu/windows/d3d11_video_decoder.cc:

            • Patch Set #62, Line 294: media_log_.get(), video_device, config_, bit_depth_, chroma_sampling_);

              I guess, this can always be the default bit depth which cause the problem.

            • Done

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 63
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Wed, 22 Nov 2023 05:38:18 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: 朱思达 <zhu...@bytedance.com>

          朱思达 (Gerrit)

          unread,
          Nov 22, 2023, 12:47:07 AM11/22/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          View Change

          1 comment:

          • Patchset:

            • Patch Set #62:

              403 is normal, as CDN may limit the max download file count, I would suggest download the html and all of the mp4 files into your local disk and open the local html.

            • Is this happening only when one video is playing and one is started but loading? If so, I have observed same issue with D3D11 backend, in that case this should be an existing bug, not being related to this CL.

            • I guess you need to download those file to local and try again, it's not something you can reproduce with D3D11 backend, only happening with D3D12 backend.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 63
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Wed, 22 Nov 2023 05:46:56 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Zhibo Wang <zhibo...@intel.com>
          Comment-In-Reply-To: 朱思达 <zhu...@bytedance.com>

          朱思达 (Gerrit)

          unread,
          Nov 22, 2023, 12:49:35 AM11/22/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          View Change

          1 comment:

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 63
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Wed, 22 Nov 2023 05:49:24 +0000

          Zhibo Wang (Gerrit)

          unread,
          Nov 22, 2023, 4:03:35 AM11/22/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, 朱思达, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, 朱思达.

          View Change

          1 comment:

            • I guess you need to download those file to local and try again, it's not something you can reproduce with D3D11 backend, only happening with D3D12 backend.

            • I have checked for another time that D3D12 decoding multiple downloaded local files works fine in my place, A380. Maybe we are talking about different issues, and I cannot reproduce yours. Is that still happening on ps63?

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 63
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Wed, 22 Nov 2023 09:03:21 +0000

          朱思达 (Gerrit)

          unread,
          Nov 22, 2023, 4:24:29 AM11/22/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          View Change

          1 comment:

          • Patchset:

            • Patch Set #62:

              New link works. […]

              My steps to reproduce are to let about 15 videos play at the same time together, and then randomly perform a seek operation on the videos among them. I will retry PS#63 tonight to see if I can reproduce.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 63
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Wed, 22 Nov 2023 09:24:17 +0000

          朱思达 (Gerrit)

          unread,
          Nov 22, 2023, 9:16:46 AM11/22/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          View Change

          1 comment:

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 63
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Wed, 22 Nov 2023 14:16:32 +0000

          朱思达 (Gerrit)

          unread,
          Nov 22, 2023, 9:34:54 AM11/22/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, Zhibo Wang.

          View Change

          1 comment:

          • Patchset:

            • Patch Set #62:

              Still repro with PS#63, see my screen record here: https://lf3-cdn-tos.bytegoofy. […]

              Interesting, I also tested D3D12 decoder on NVIDIA RTX3050 and AMD RX6600:

              1. Intel A380 + 31.0.101.4953 = repro.
              2. NVIDIA RTX3050 + 31.0.15.3758 = no repro, working well.
              3. AMD RX660 + 31.0.22017.3004 = completely not working with below error log.

              ```
              00:00:06.089 info "D3D11VideoDecoder config change: profile: hevc main, chroma_sampling_format: 4:2:0, coded_size: 7680x4320, bit_depth: 8, color_space: {primary=1, transfer=1, matrix=1, range=1}"
              00:00:06.089 info "D3D11VideoDecoder is using hevc main / 4:2:0"
              00:00:06.089 info "D3D11VideoDecoder producing NV12"
              00:00:06.089 info "D3D11VideoDecoder: Selected NV12"
              00:00:06.089 info "D3D11VideoDecoder output color space: (same as input)"
              00:00:06.089 info "D3D11VideoDecoder is binding textures"
              00:00:06.090 info "D3D11VideoDecoder is using D3D12 backend"
              00:00:06.090 info "D3D11VideoDecoder is using single textures"
              00:00:06.102 error "Failed to close command list: 参数错误。 (0x80070057)"
              00:00:06.102 warning "video decoder fallback after initial decode error."
              00:00:06.102 info "Cannot select VpxVideoDecoder for video decoding"
              00:00:06.102 info "Cannot select Dav1dVideoDecoder for video decoding"
              00:00:06.103 info "Cannot select FFmpegVideoDecoder for video decoding"
              00:00:06.123 error {"cause":{"cause":{"code":6,"data":{"VDA Error":0},"group":"D3D11Status","message":"","stack":[{"file":"media\\gpu\\windows\\d3d11_video_decoder.cc","line":675}]},"code":1,"data":{},"group":"DecoderStatus","message":"","stack":[{"file":"media\\gpu\\windows\\d3d11_video_decoder.cc","line":973}]},"code":3,"data":{},"group":"PipelineStatus","message":"","stack":[{"file":"media\\renderers\\video_renderer_impl.cc","line":592}]}
              ```

              Since RTX3050 can working without issue, is this an intel driver bug?

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 63
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Wed, 22 Nov 2023 14:34:39 +0000

          Rafael Cintron (Gerrit)

          unread,
          Nov 22, 2023, 2:18:19 PM11/22/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, 朱思达, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang, 朱思达.

          View Change

          4 comments:

          • Patchset:

            • Patch Set #62:

              Interesting, I also tested D3D12 decoder on NVIDIA RTX3050 and AMD RX6600: […]

              Making this a real issue so we don't lose track of it.

              The string for error code 0x80070057 is "The parameter is incorrect" which is hopefully something we can get to the bottom of by using the D3D debug layer.

              As a followon change, we should consider emitting this error code to the media log using `logging::SystemErrorCodeToString(hr)` so we don't have to look it up.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • Patch Set #62, Line 29: gpu_info

              `gpu_info` is no longer used in the function and can be removed.

            • Patch Set #62, Line 43:

                        Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device;
              CHECK_EQ(d3d11_device.As(&dxgi_device), S_OK);
              Microsoft::WRL::ComPtr<IDXGIAdapter> adapter;
              CHECK_EQ(dxgi_device->GetAdapter(&adapter), S_OK);
              static base::NoDestructor<Microsoft::WRL::ComPtr<ID3D12Device>>
              d3d12_device(CreateD3D12Device(adapter.Get()));
              return *d3d12_device;

              Please make this thread safe by assigning a `d3d12_device` to a function which runs all of the code I've highlighted, or an inline function.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 63
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: 朱思达 <zhu...@bytedance.com>
          Gerrit-Comment-Date: Wed, 22 Nov 2023 19:18:05 +0000

          Zhibo Wang (Gerrit)

          unread,
          Nov 27, 2023, 3:49:04 AM11/27/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org

          Attention is currently required from: Zhibo Wang, 朱思达.

          Zhibo Wang uploaded patch set #64 to this change.

          View Change

          28 files changed, 1,438 insertions(+), 205 deletions(-)

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: newpatchset
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 64

          Zhibo Wang (Gerrit)

          unread,
          Nov 27, 2023, 3:53:38 AM11/27/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, 朱思达, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron, 朱思达.

          Patch set 64:Auto-Submit +1

          View Change

          4 comments:

          • Patchset:

            • Patch Set #62:

              Since RTX3050 can working without issue, is this an intel driver bug?

              I have reported it internally.

            • As a followon change, we should consider emitting this error code to the media log using logging::SystemErrorCodeToString(hr) so we don't have to look it up.

            • I guess that is already media_log?

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • We shouldn't `std::move` it. It will be used again. Passing a raw pointer now.

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • Done

            • Patch Set #62, Line 43:

                        Microsoft::WRL::ComPtr<IDXGIDevice> dxgi_device;
              CHECK_EQ(d3d11_device.As(&dxgi_device), S_OK);
              Microsoft::WRL::ComPtr<IDXGIAdapter> adapter;
              CHECK_EQ(dxgi_device->GetAdapter(&adapter), S_OK);
              static base::NoDestructor<Microsoft::WRL::ComPtr<ID3D12Device>>
              d3d12_device(CreateD3D12Device(adapter.Get()));
              return *d3d12_device;

            • Please make this thread safe by assigning a `d3d12_device` to a function which runs all of the code […]

              Done. I think static variable initialization is already thread safe. Adding an immediately-invoked lambda to avoid re-construction of dxgi_device and adapter.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 64
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Attention: 朱思达 <zhu...@bytedance.com>
          Gerrit-Comment-Date: Mon, 27 Nov 2023 08:53:28 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Zhibo Wang <zhibo...@intel.com>
          Comment-In-Reply-To: Rafael Cintron <rafael....@microsoft.com>
          Comment-In-Reply-To: 朱思达 <zhu...@bytedance.com>

          Rafael Cintron (Gerrit)

          unread,
          Nov 27, 2023, 9:20:27 PM11/27/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, 朱思达, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang, 朱思达.

          View Change

          2 comments:

          • Patchset:

            • Patch Set #62:

              > Since RTX3050 can working without issue, is this an intel driver bug? […]

              If we use `logging::SystemErrorCodeToString(hr)`, we'll get a more helpful error message than "0x80070057", which is what I see in the log output above.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #64, Line 112:

                  if (!d3d12_resource_or_error.has_value()) {
              return false;
              }

              (Apologies for not realizing this earlier)

              The D3D12 `WaitForFrameBegins` implementation takes more raw pointer references than the D3D11 one. We take the texture from the `output_picture` and store it in non-raw_ptr D3D12 structures like `output_stream_arguments_`. We never clear these structures on error or in Reset.

              Are we sure the `output_picture` textures are never going to deleted out from under us? Seems like we should at least `std::move` `output_stream_arguments_` into a local variable and clear out the member variable in `Reset` in case this call to `ToD3D12Resource` fails.

              Please test with `dxcaps.exe -forcetdr` to ensure device removed is handled without crashing.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 64
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Attention: 朱思达 <zhu...@bytedance.com>
          Gerrit-Comment-Date: Tue, 28 Nov 2023 02:20:15 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No

          Zhibo Wang (Gerrit)

          unread,
          Nov 29, 2023, 12:28:13 AM11/29/23
          to chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, 朱思达, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Rafael Cintron.

          View Change

          2 comments:

          • Patchset:

            • Patch Set #62:

              00:00:06.102 error "Failed to close command list: 参数错误。 (0x80070057)"

              "参数错误。" is the localized helpful message, which is "The parameter is incorrect" in Chinese. `logging::SystemErrorCodeToString()` is using system language.

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • and store it in non-raw_ptr D3D12 structures like output_stream_arguments_.

              `output_stream_arguments_.pOutputTexture2D` is raw pointer.

              ```
              typedef struct D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS
              {
              ID3D12Resource *pOutputTexture2D;
              UINT OutputSubresource;
              D3D12_VIDEO_DECODE_CONVERSION_ARGUMENTS ConversionArguments;
              } D3D12_VIDEO_DECODE_OUTPUT_STREAM_ARGUMENTS;
              ```
            • We never clear these structures on error or in Reset.
              Are we sure the output_picture textures are never going to deleted out from under us?

            • The `output_picture` is get from `D3D11VideoDecoder::picture_buffers_`, which is created once and repeatedly used by the frames in the decoding procedure.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 64
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Comment-Date: Wed, 29 Nov 2023 05:28:03 +0000

          Rafael Cintron (Gerrit)

          unread,
          Nov 29, 2023, 2:42:55 PM11/29/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, 朱思达, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Dale Curtis, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang.

          View Change

          3 comments:

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • output_stream_arguments_.pOutputTexture2D is raw pointer.

              Apologies for being unclear. What I meant by my statement is that we're storing pointers to D3D textures into raw pointers instead of using `raw_ptr`. We're, of course, forced to use these structures so we can pass them to D3D but it means we have to be extra careful about not letting these ever point to freed memory.

              The output_picture is get from D3D11VideoDecoder::picture_buffers_, which is created once and repeatedly used by the frames in the decoding procedure.

              What about things like config changes? Are the pointers cleared out then? If so, then many we'll be OK but I'll defer to Chromium media experts on the code review.

            • Patch Set #64, Line 257: written_size

              Please add a CHECK that `written_size` is less than `data_.size()`.

            • Patch Set #64, Line 301: written_size

              Please add a CHECK that `written_size` is less than `data_.size()`.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 64
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Comment-Date: Wed, 29 Nov 2023 19:42:43 +0000

          Dale Curtis (Gerrit)

          unread,
          Dec 4, 2023, 2:23:21 PM12/4/23
          to Zhibo Wang, chromeos-gfx-...@google.com, feature-me...@chromium.org, media-cro...@chromium.org, media-wi...@chromium.org, poscia...@chromium.org, 朱思达, Peng Huang, Sunny Sachanandani, Ted (Chromium) Meyer, Bruce Dawson, Rafael Cintron, Frank Liberato, Jianlin Qiu, Chromium LUCI CQ, chromium...@chromium.org

          Attention is currently required from: Zhibo Wang.

          View Change

          14 comments:

          • File media/base/media_switches.h:

          • File media/base/media_switches.cc:

          • File media/gpu/windows/d3d11_picture_buffer.cc:

          • File media/gpu/windows/d3d11_video_decoder.cc:

          • File media/gpu/windows/d3d11_video_decoder_wrapper.cc:

            • Patch Set #64, Line 349: // DXVA HEVC, VP9, and AV1 specifications say ConfigBitstreamRaw

              Comment should go at l.345 now.

            • Patch Set #64, Line 357: // ConfigBitstreamRaw == 2 means the decoder uses DXVA_Slice_H264_Short.

              Put at l.355 and consider flipping order to be the same as above (check ConfigBitstreamRaw first)

          • File media/gpu/windows/d3d12_helpers.h:

            • Patch Set #64, Line 51: std::array<ID3D12Resource*, kMaxSize> resources_;

              The Chromium side c++ structures should either be using ComPtr or raw_ptr if this is held across call stacks.

              Consider replacing `ToD3D12VideoDecodeReferenceFrames()` with `WriteTo(D3D12_VIDEO_DECODE_REFERENCE_FRAMES* dest)` given its usage.

          • File media/gpu/windows/d3d12_helpers.cc:

          • File media/gpu/windows/d3d12_video_decoder_wrapper.cc:

            • Patch Set #64, Line 374: #if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)

              No need to check the build flag here, it should already be checked in GetD3D12VideoDecodeGUID?

          • File media/gpu/windows/d3d_video_decoder_wrapper.h:

            • Patch Set #64, Line 38: virtual absl::optional<bool> GetSingleTextureRecommended() const = 0;

              Just `UseSingleTexture` or `ShouldUseSingleTexture`

          • File media/mojo/services/gpu_mojo_media_client_win.cc:

            • Patch Set #64, Line 41: static base::NoDestructor<Microsoft::WRL::ComPtr<ID3D12Device>>

              Is this right? It seems like this could change / be invalidated? I guess it might be tied to GPU process life time, but probably safer not store it unless we really have to.

          To view, visit change 4410406. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: I8d9b5274197195242aed320e9fb33a9746e8cf55
          Gerrit-Change-Number: 4410406
          Gerrit-PatchSet: 64
          Gerrit-Owner: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Reviewer: Bruce Dawson <bruce...@chromium.org>
          Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
          Gerrit-Reviewer: Rafael Cintron <rafael....@microsoft.com>
          Gerrit-Reviewer: Zhibo Wang <zhibo...@intel.com>
          Gerrit-CC: Frank Liberato <libe...@chromium.org>
          Gerrit-CC: Jianlin Qiu <jianl...@intel.com>
          Gerrit-CC: Peng Huang <peng...@chromium.org>
          Gerrit-CC: Sunny Sachanandani <sun...@chromium.org>
          Gerrit-CC: Ted (Chromium) Meyer <tmath...@chromium.org>
          Gerrit-CC: 朱思达 <zhu...@bytedance.com>
          Gerrit-Attention: Zhibo Wang <zhibo...@intel.com>
          Gerrit-Comment-Date: Mon, 04 Dec 2023 19:23:09 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          It is loading more messages.
          0 new messages