Commit 11d8aa54 authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

Vaapi: Remove |va_surfaces| from VaapiWrapper::CreateContext and vaCreateContext

This CL changes the call to vaCreateContext() to use a set of dummy
VASurfaceIDs and removes the then unnecessary parameter from CreateContext().

Bug: None
Change-Id: Ibe64deb21ff2f9fabf351740389a60eb44ff1636
Reviewed-on: https://chromium-review.googlesource.com/c/1351747
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611983}
parent 1b420fdb
...@@ -639,8 +639,7 @@ void VaapiVideoDecodeAccelerator::AssignPictureBuffers( ...@@ -639,8 +639,7 @@ void VaapiVideoDecodeAccelerator::AssignPictureBuffers(
// |vaapi_wrapper_| to allocate them for us. // |vaapi_wrapper_| to allocate them for us.
if (decode_using_client_picture_buffers_) { if (decode_using_client_picture_buffers_) {
RETURN_AND_NOTIFY_ON_FAILURE( RETURN_AND_NOTIFY_ON_FAILURE(
vaapi_wrapper_->CreateContext(va_format, requested_pic_size_, vaapi_wrapper_->CreateContext(va_format, requested_pic_size_),
va_surface_ids),
"Failed creating VA Context", PLATFORM_FAILURE, ); "Failed creating VA Context", PLATFORM_FAILURE, );
} else { } else {
va_surface_ids.clear(); va_surface_ids.clear();
......
...@@ -908,7 +908,7 @@ bool VaapiWrapper::CreateSurfaces(unsigned int va_format, ...@@ -908,7 +908,7 @@ bool VaapiWrapper::CreateSurfaces(unsigned int va_format,
} }
// And create a context associated with them. // And create a context associated with them.
const bool success = CreateContext(va_format, size, va_surface_ids_); const bool success = CreateContext(va_format, size);
if (success) if (success)
*va_surfaces = va_surface_ids_; *va_surfaces = va_surface_ids_;
else else
...@@ -917,11 +917,17 @@ bool VaapiWrapper::CreateSurfaces(unsigned int va_format, ...@@ -917,11 +917,17 @@ bool VaapiWrapper::CreateSurfaces(unsigned int va_format,
} }
bool VaapiWrapper::CreateContext(unsigned int va_format, bool VaapiWrapper::CreateContext(unsigned int va_format,
const gfx::Size& size, const gfx::Size& size) {
const std::vector<VASurfaceID>& va_surfaces) { // vaCreateContext() doesn't really need an array of VASurfaceIDs (see
VAStatus va_res = vaCreateContext( // https://lists.01.org/pipermail/intel-vaapi-media/2017-July/000052.html and
va_display_, va_config_id_, size.width(), size.height(), VA_PROGRESSIVE, // https://github.com/intel/libva/issues/251); pass a dummy list of valid
&va_surface_ids_[0], va_surface_ids_.size(), &va_context_id_); // (non-null) IDs until the signature gets updated.
constexpr VASurfaceID* empty_va_surfaces_ids_pointer = nullptr;
constexpr size_t empty_va_surfaces_ids_size = 0u;
const VAStatus va_res =
vaCreateContext(va_display_, va_config_id_, size.width(), size.height(),
VA_PROGRESSIVE, empty_va_surfaces_ids_pointer,
empty_va_surfaces_ids_size, &va_context_id_);
VA_LOG_ON_ERROR(va_res, "vaCreateContext failed"); VA_LOG_ON_ERROR(va_res, "vaCreateContext failed");
if (va_res == VA_STATUS_SUCCESS) if (va_res == VA_STATUS_SUCCESS)
......
...@@ -107,10 +107,8 @@ class MEDIA_GPU_EXPORT VaapiWrapper ...@@ -107,10 +107,8 @@ class MEDIA_GPU_EXPORT VaapiWrapper
size_t num_surfaces, size_t num_surfaces,
std::vector<VASurfaceID>* va_surfaces); std::vector<VASurfaceID>* va_surfaces);
// Creates a VA Context associated with the set of |va_surfaces| of |size|. // Creates a VA Context associated with |format| and |size|.
bool CreateContext(unsigned int va_format, bool CreateContext(unsigned int va_format, const gfx::Size& size);
const gfx::Size& size,
const std::vector<VASurfaceID>& va_surfaces);
// Frees all memory allocated in CreateSurfaces. // Frees all memory allocated in CreateSurfaces.
virtual void DestroySurfaces(); virtual void DestroySurfaces();
......
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