Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Issue 765533005: Move the DXVA decoder off the GPU thread. (Closed)

Created:
6 years ago by ananta
Modified:
6 years ago
Reviewers:
DaleCurtis
CC:
chromium-reviews, posciak+watch_chromium.org, jam, mcasas+watch_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, piman+watch_chromium.org, wjia+watch_chromium.org, prabhur1
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Move the DXVA decoder off the GPU thread. The DXVA decoder runs on the GPU thread today. When the decoder has enough data to produce an output frame the IMFTransform::ProcessOutput call blocks while waiting for the media foundation threads to produce the output frame. This causes lots of jankiness and dropped frames while playing H.264 videos especially HD 1080P videos. The approach we are taking to resolve this is to move the actual IMFTransform decoding off the GPU thread. This is implemented by creating a worker thread per DXVA decoder instance. The lifetime of this thread is dependent on the lifetime of the DXVAVideoDecodeAccelerator class. The IMFTransform decoder instance is created and destroyed on the main thread. However the calls to ProcessInput/ProcessOutput etc happen on the decoder thread. The decoder state is modified on both the GPU thread and the worker thread. The methods to get and set the state are now thread safe via InterLocked API calls. The copying of the decoded texture to the GPU texture is still done on the main thread. Will work on moving this to the worker thread in a future patch. BUG=426675, 430375, 426707 Committed: https://crrev.com/1dd7d968e3f77ec0c90a80c944cd1ec4da8aab11 Cr-Commit-Position: refs/heads/master@{#306929}

Patch Set 1 #

Total comments: 1

Patch Set 2 : Rebased to tip #

Patch Set 3 : Leaving H264PROFILE_HIGH profiles as disabled for H/W decode for now #

Patch Set 4 : Fixed presubmit #

Total comments: 9

Patch Set 5 : Code review comments #

Total comments: 25

Patch Set 6 : Fixed flush #

Total comments: 1

Patch Set 7 : Removed include #

Patch Set 8 : Fixed alignment #

Total comments: 16

Patch Set 9 : Fix flush #

Total comments: 4

Patch Set 10 : Code review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+269 lines, -140 lines) Patch
M content/common/gpu/media/dxva_video_decode_accelerator.h View 1 2 3 4 5 6 7 8 9 5 chunks +47 lines, -4 lines 0 comments Download
M content/common/gpu/media/dxva_video_decode_accelerator.cc View 1 2 3 4 5 6 7 8 9 25 chunks +222 lines, -136 lines 0 comments Download

Messages

Total messages: 16 (4 generated)
ananta
https://codereview.chromium.org/765533005/diff/1/content/common/gpu/media/dxva_video_decode_accelerator.cc File content/common/gpu/media/dxva_video_decode_accelerator.cc (right): https://codereview.chromium.org/765533005/diff/1/content/common/gpu/media/dxva_video_decode_accelerator.cc#newcode1206 content/common/gpu/media/dxva_video_decode_accelerator.cc:1206: state == kFlushing), We need to allow kFlushing here ...
6 years ago (2014-12-03 00:12:44 UTC) #2
DaleCurtis
Thanks for working on this! However, this doesn't seem thread safe. Both threads can set ...
6 years ago (2014-12-03 01:04:33 UTC) #3
ananta
I changed the SetState call to change the state on the main thread only. Other ...
6 years ago (2014-12-03 04:08:02 UTC) #4
DaleCurtis
I'm not convinced this is thread safe yet; there still seem to be a lot ...
6 years ago (2014-12-03 22:34:42 UTC) #5
ananta
https://codereview.chromium.org/765533005/diff/80001/content/common/gpu/media/dxva_video_decode_accelerator.cc File content/common/gpu/media/dxva_video_decode_accelerator.cc (right): https://codereview.chromium.org/765533005/diff/80001/content/common/gpu/media/dxva_video_decode_accelerator.cc#newcode572 content/common/gpu/media/dxva_video_decode_accelerator.cc:572: DCHECK_EQ(main_thread_task_runner_.get(), On 2014/12/03 22:34:41, DaleCurtis wrote: > Just DCHECK(main_thread_task_runner_->BelongsToCurrentThread()) ...
6 years ago (2014-12-04 00:45:25 UTC) #6
DaleCurtis
https://codereview.chromium.org/765533005/diff/80001/content/common/gpu/media/dxva_video_decode_accelerator.cc File content/common/gpu/media/dxva_video_decode_accelerator.cc (right): https://codereview.chromium.org/765533005/diff/80001/content/common/gpu/media/dxva_video_decode_accelerator.cc#newcode704 content/common/gpu/media/dxva_video_decode_accelerator.cc:704: weak_this_factory_.GetWeakPtr())); On 2014/12/04 00:45:24, ananta wrote: > On 2014/12/03 ...
6 years ago (2014-12-04 01:54:27 UTC) #7
ananta
https://codereview.chromium.org/765533005/diff/140001/content/common/gpu/media/dxva_video_decode_accelerator.cc File content/common/gpu/media/dxva_video_decode_accelerator.cc (right): https://codereview.chromium.org/765533005/diff/140001/content/common/gpu/media/dxva_video_decode_accelerator.cc#newcode1021 content/common/gpu/media/dxva_video_decode_accelerator.cc:1021: decoder_lock_.Acquire(); On 2014/12/04 01:54:27, DaleCurtis wrote: > It's generally ...
6 years ago (2014-12-04 08:04:51 UTC) #8
DaleCurtis
lgtm % q cc:prabhur as an FYI to coordinate QA for testing hardware H264 decoding ...
6 years ago (2014-12-04 19:21:34 UTC) #9
ananta
https://codereview.chromium.org/765533005/diff/140001/content/common/gpu/media/dxva_video_decode_accelerator.cc File content/common/gpu/media/dxva_video_decode_accelerator.cc (right): https://codereview.chromium.org/765533005/diff/140001/content/common/gpu/media/dxva_video_decode_accelerator.cc#newcode1236 content/common/gpu/media/dxva_video_decode_accelerator.cc:1236: // If we are scheduled during a flush operation ...
6 years ago (2014-12-04 19:48:55 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/765533005/180001
6 years ago (2014-12-04 22:19:04 UTC) #14
commit-bot: I haz the power
Committed patchset #10 (id:180001)
6 years ago (2014-12-04 23:24:47 UTC) #15
commit-bot: I haz the power
6 years ago (2014-12-04 23:25:28 UTC) #16
Message was sent while issue was closed.
Patchset 10 (id:??) landed as
https://crrev.com/1dd7d968e3f77ec0c90a80c944cd1ec4da8aab11
Cr-Commit-Position: refs/heads/master@{#306929}

Powered by Google App Engine
This is Rietveld 408576698