media/gpu/vaapi: make VA-API lock configurable [chromium/src : main]

317 views
Skip to first unread message

Jianhui J Dai (Gerrit)

unread,
Apr 9, 2021, 3:41:12 AM4/9/21
to acourbo...@chromium.org, feature-me...@chromium.org, hiroh...@chromium.org, media-cro...@chromium.org, poscia...@chromium.org, vaapi-...@chromium.org, Sushma Venkatesh Reddy, Miguel Casas, Sreerenj Balachandran, Stéphane Marchesin, Andres Calderon Jaramillo, Hirokazu Honda, David Staessens, Kuang-che Wu, Pawel Osciak

Attention is currently required from: Pawel Osciak, David Staessens, Hirokazu Honda, Andres Calderon Jaramillo, Stéphane Marchesin, Kuang-che Wu, Miguel Casas, Sreerenj Balachandran.

Jianhui J Dai has uploaded this change for review.

View Change

media/gpu/vaapi: make VA-API lock configurable

All threads in GPU process acquire a common lock whenever calling VA-API
functions, because VA-API didn't ensure thread safety.

The statement of thread safety has been added since libva 2.10.0 [1].
However, the thread-safety of libva depends on backend implementation.

This CL introduces |optional_va_lock_| in VADisplayState, a simple
wrapper of |va_lock_|. It checks the implementation type to perform
locking or no-op if switch |kVaapiNoLock| allows it. |optional_va_lock_|
is valid between Initialize() and Deinitialize().

Current default value of the switch is DISABLED, this CL doesn't change
the lock behavior in VA-API. Instead of removing the locks at once, we
are going to experiment disabling the lock via a finch experiment with
the switch.

The benefits are:
- It will reduce the latency as avoiding cpu lock
- It will reduce the gpu power as converging jobs for gpu parallel
execution
- It will optimize the throughput for gpu which has multiple hw
decoder/encoder instances

Intel iHD driver is thread safe, allowing parallel VA-API calls.

[1] https://github.com/intel/libva/pull/347

Bug:1123429, b:182008564
Change-Id: I9fea19ec3085e22ab6b182eb664bdb1d7fcc1c5f
Co-Authored-By: hi...@chromium.org
---
M media/base/media_switches.cc
M media/base/media_switches.h
M media/gpu/vaapi/BUILD.gn
A media/gpu/vaapi/vaapi_lock.h
M media/gpu/vaapi/vaapi_unittest.cc
M media/gpu/vaapi/vaapi_utils.cc
M media/gpu/vaapi/vaapi_utils.h
M media/gpu/vaapi/vaapi_utils_unittest.cc
M media/gpu/vaapi/vaapi_wrapper.cc
M media/gpu/vaapi/vaapi_wrapper.h
10 files changed, 178 insertions(+), 80 deletions(-)


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

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9fea19ec3085e22ab6b182eb664bdb1d7fcc1c5f
Gerrit-Change-Number: 2384545
Gerrit-PatchSet: 10
Gerrit-Owner: Jianhui J Dai <jianhu...@intel.com>
Gerrit-Reviewer: Andres Calderon Jaramillo <andr...@chromium.org>
Gerrit-Reviewer: David Staessens <dstae...@chromium.org>
Gerrit-Reviewer: Hirokazu Honda <hi...@chromium.org>
Gerrit-Reviewer: Kuang-che Wu <kc...@chromium.org>
Gerrit-Reviewer: Miguel Casas <mca...@chromium.org>
Gerrit-Reviewer: Pawel Osciak <pos...@chromium.org>
Gerrit-Reviewer: Sreerenj Balachandran <sreerenj.b...@intel.com>
Gerrit-Reviewer: Stéphane Marchesin <mar...@chromium.org>
Gerrit-CC: Andres Calderon Jaramillo <andr...@google.com>
Gerrit-CC: Jianhui Dai <jianhu...@intel.corp-partner.google.com>
Gerrit-CC: Sushma Venkatesh Reddy <sushma.venk...@intel.com>
Gerrit-Attention: Pawel Osciak <pos...@chromium.org>
Gerrit-Attention: David Staessens <dstae...@chromium.org>
Gerrit-Attention: Hirokazu Honda <hi...@chromium.org>
Gerrit-Attention: Andres Calderon Jaramillo <andr...@chromium.org>
Gerrit-Attention: Stéphane Marchesin <mar...@chromium.org>
Gerrit-Attention: Kuang-che Wu <kc...@chromium.org>
Gerrit-Attention: Miguel Casas <mca...@chromium.org>
Gerrit-Attention: Sreerenj Balachandran <sreerenj.b...@intel.com>
Gerrit-MessageType: newchange

Jianhui J Dai (Gerrit)

unread,
Apr 9, 2021, 3:44:39 AM4/9/21
to acourbo...@chromium.org, feature-me...@chromium.org, hiroh...@chromium.org, media-cro...@chromium.org, poscia...@chromium.org, vaapi-...@chromium.org, Sushma Venkatesh Reddy, Andres Calderon Jaramillo, Chromium LUCI CQ, Miguel Casas, Sreerenj Balachandran, Jianhui Dai, Stéphane Marchesin, Andres Calderon Jaramillo, Hirokazu Honda, David Staessens, Kuang-che Wu, Pawel Osciak, chromium...@chromium.org

Attention is currently required from: Pawel Osciak, David Staessens, Hirokazu Honda, Andres Calderon Jaramillo, Stéphane Marchesin, Kuang-che Wu, Miguel Casas, Sreerenj Balachandran.

View Change

Gerrit-Comment-Date: Fri, 09 Apr 2021 07:44:27 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

Jianhui J Dai (Gerrit)

unread,
Dec 30, 2021, 8:19:30 PM12/30/21
to acourbo...@chromium.org, feature-me...@chromium.org, hiroh...@chromium.org, media-cro...@chromium.org, poscia...@chromium.org, vaapi-...@chromium.org, Sushma Venkatesh Reddy, Andres Calderon Jaramillo, Chromium LUCI CQ, Miguel Casas-Sanchez, Sreerenj Balachandran, Jianhui Dai, Stéphane Marchesin, Andres Calderon Jaramillo, Hirokazu Honda, David Staessens, Kuang-che Wu, Pawel Osciak, chromium...@chromium.org

Jianhui J Dai abandoned this change.

View Change

Abandoned

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

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I9fea19ec3085e22ab6b182eb664bdb1d7fcc1c5f
Gerrit-Change-Number: 2384545
Gerrit-PatchSet: 10
Gerrit-Owner: Jianhui J Dai <jianhu...@intel.com>
Gerrit-Reviewer: Andres Calderon Jaramillo <andr...@chromium.org>
Gerrit-Reviewer: David Staessens <dstae...@chromium.org>
Gerrit-Reviewer: Hirokazu Honda <hi...@chromium.org>
Gerrit-Reviewer: Kuang-che Wu <kc...@chromium.org>
Gerrit-Reviewer: Miguel Casas-Sanchez <mca...@chromium.org>
Gerrit-Reviewer: Pawel Osciak <pos...@chromium.org>
Gerrit-Reviewer: Sreerenj Balachandran <sreerenj.b...@intel.com>
Gerrit-Reviewer: Stéphane Marchesin <mar...@chromium.org>
Gerrit-CC: Andres Calderon Jaramillo <andr...@google.com>
Gerrit-CC: Jianhui Dai <jianhu...@intel.corp-partner.google.com>
Gerrit-CC: Sushma Venkatesh Reddy <sushma.venk...@intel.com>
Gerrit-MessageType: abandon
Reply all
Reply to author
Forward
0 new messages