Commit d48e007b authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/VaapiWrapper: Create va context with VA_PROGRESSIVE in non VPP mode

After crrev.com/c/1863056, VA context is always created with VA_PROGRESSIVE.
This causes vaCreateContext failure on grunt if the context is used for VPP. We
have to create VA context without VA_PROGRESSIVE in non VPP mode.

TBR=andrescj@chromium.org

Bug: 982201
Test: camera.DecodeAccelJPEG on grunt
Change-Id: I3a0a5fca580ef2e7b1b06544ec039772a83fe111
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1875892Reviewed-by: default avatarRicky Liang <jcliang@chromium.org>
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Auto-Submit: Hirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708918}
parent 016609c1
...@@ -67,7 +67,7 @@ class MockAcceleratedVideoDecoder : public AcceleratedVideoDecoder { ...@@ -67,7 +67,7 @@ class MockAcceleratedVideoDecoder : public AcceleratedVideoDecoder {
class MockVaapiWrapper : public VaapiWrapper { class MockVaapiWrapper : public VaapiWrapper {
public: public:
MockVaapiWrapper() = default; MockVaapiWrapper(CodecMode mode) : VaapiWrapper(mode) {}
MOCK_METHOD5(CreateContextAndSurfaces, MOCK_METHOD5(CreateContextAndSurfaces,
bool(unsigned int, bool(unsigned int,
const gfx::Size&, const gfx::Size&,
...@@ -152,8 +152,8 @@ class VaapiVideoDecodeAcceleratorTest : public TestWithParam<TestParams>, ...@@ -152,8 +152,8 @@ class VaapiVideoDecodeAcceleratorTest : public TestWithParam<TestParams>,
decoder_thread_("VaapiVideoDecodeAcceleratorTestThread"), decoder_thread_("VaapiVideoDecodeAcceleratorTestThread"),
mock_decoder_(new ::testing::StrictMock<MockAcceleratedVideoDecoder>), mock_decoder_(new ::testing::StrictMock<MockAcceleratedVideoDecoder>),
mock_vaapi_picture_factory_(new MockVaapiPictureFactory()), mock_vaapi_picture_factory_(new MockVaapiPictureFactory()),
mock_vaapi_wrapper_(new MockVaapiWrapper()), mock_vaapi_wrapper_(new MockVaapiWrapper(VaapiWrapper::kDecode)),
mock_vpp_vaapi_wrapper_(new MockVaapiWrapper()), mock_vpp_vaapi_wrapper_(new MockVaapiWrapper(VaapiWrapper::kDecode)),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
decoder_thread_.Start(); decoder_thread_.Start();
......
...@@ -1081,7 +1081,7 @@ scoped_refptr<VaapiWrapper> VaapiWrapper::Create( ...@@ -1081,7 +1081,7 @@ scoped_refptr<VaapiWrapper> VaapiWrapper::Create(
return nullptr; return nullptr;
} }
scoped_refptr<VaapiWrapper> vaapi_wrapper(new VaapiWrapper()); scoped_refptr<VaapiWrapper> vaapi_wrapper(new VaapiWrapper(mode));
if (vaapi_wrapper->VaInitialize(report_error_to_uma_cb)) { if (vaapi_wrapper->VaInitialize(report_error_to_uma_cb)) {
if (vaapi_wrapper->Initialize(mode, va_profile)) if (vaapi_wrapper->Initialize(mode, va_profile))
return vaapi_wrapper; return vaapi_wrapper;
...@@ -1412,11 +1412,10 @@ bool VaapiWrapper::CreateContext(const gfx::Size& size) { ...@@ -1412,11 +1412,10 @@ bool VaapiWrapper::CreateContext(const gfx::Size& size) {
// (non-null) IDs until the signature gets updated. // (non-null) IDs until the signature gets updated.
constexpr VASurfaceID* empty_va_surfaces_ids_pointer = nullptr; constexpr VASurfaceID* empty_va_surfaces_ids_pointer = nullptr;
constexpr size_t empty_va_surfaces_ids_size = 0u; constexpr size_t empty_va_surfaces_ids_size = 0u;
// TODO(hiroh): VA_PROGRESSIVE might not ought to be set in VPP case. Think const int flag = mode_ != kVideoProcess ? VA_PROGRESSIVE : 0x0;
// about removing it if something wrong happens or it turns out to be wrong.
const VAStatus va_res = const VAStatus va_res =
vaCreateContext(va_display_, va_config_id_, size.width(), size.height(), vaCreateContext(va_display_, va_config_id_, size.width(), size.height(),
VA_PROGRESSIVE, empty_va_surfaces_ids_pointer, flag, empty_va_surfaces_ids_pointer,
empty_va_surfaces_ids_size, &va_context_id_); empty_va_surfaces_ids_size, &va_context_id_);
VA_LOG_ON_ERROR(va_res, "vaCreateContext failed"); VA_LOG_ON_ERROR(va_res, "vaCreateContext failed");
return va_res == VA_STATUS_SUCCESS; return va_res == VA_STATUS_SUCCESS;
...@@ -2022,8 +2021,9 @@ void VaapiWrapper::PreSandboxInitialization() { ...@@ -2022,8 +2021,9 @@ void VaapiWrapper::PreSandboxInitialization() {
VASupportedProfiles::Get(); VASupportedProfiles::Get();
} }
VaapiWrapper::VaapiWrapper() VaapiWrapper::VaapiWrapper(CodecMode mode)
: va_lock_(VADisplayState::Get()->va_lock()), : mode_(mode),
va_lock_(VADisplayState::Get()->va_lock()),
va_display_(NULL), va_display_(NULL),
va_config_id_(VA_INVALID_ID), va_config_id_(VA_INVALID_ID),
va_context_id_(VA_INVALID_ID) {} va_context_id_(VA_INVALID_ID) {}
......
...@@ -387,7 +387,7 @@ class MEDIA_GPU_EXPORT VaapiWrapper ...@@ -387,7 +387,7 @@ class MEDIA_GPU_EXPORT VaapiWrapper
void DestroySurface(VASurfaceID va_surface_id); void DestroySurface(VASurfaceID va_surface_id);
protected: protected:
VaapiWrapper(); VaapiWrapper(CodecMode mode);
virtual ~VaapiWrapper(); virtual ~VaapiWrapper();
private: private:
...@@ -424,6 +424,8 @@ class MEDIA_GPU_EXPORT VaapiWrapper ...@@ -424,6 +424,8 @@ class MEDIA_GPU_EXPORT VaapiWrapper
// Check low-power encode support for the given profile // Check low-power encode support for the given profile
bool IsLowPowerEncSupported(VAProfile va_profile) const; bool IsLowPowerEncSupported(VAProfile va_profile) const;
const CodecMode mode_;
// Pointer to VADisplayState's member |va_lock_|. Guaranteed to be valid for // Pointer to VADisplayState's member |va_lock_|. Guaranteed to be valid for
// the lifetime of VaapiWrapper. // the lifetime of VaapiWrapper.
base::Lock* va_lock_; base::Lock* va_lock_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment