Commit 5de42fbf authored by Chih-Yu Huang's avatar Chih-Yu Huang Committed by Commit Bot

media/gpu/vaapi_wrapper: Remove "const scoped_refptr<T>&" at BlitSurface()

The Chromium smart pointer guidelines [1] says "don't pass or return a
smart pointer by reference". This CL removes
"const scoped_refptr<T>&" at VaapiWrapper::BlitSurface().

[1] https://www.chromium.org/developers/smart-pointer-guidelines

Bug: 1020668
Test: run vda_tests on octopus

Change-Id: Ic9e042e066c7dbe3257d973a5c03586ea3f05766
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975491
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726734}
parent d883f715
...@@ -181,9 +181,9 @@ void VaapiImageProcessor::Process(scoped_refptr<VideoFrame> input_frame, ...@@ -181,9 +181,9 @@ void VaapiImageProcessor::Process(scoped_refptr<VideoFrame> input_frame,
return; return;
} }
// VA-API performs pixel format conversion and scaling without any filters. // VA-API performs pixel format conversion and scaling without any filters.
if (vaapi_wrapper_->BlitSurface( if (vaapi_wrapper_->BlitSurface(*src_va_surface, *dst_va_surface,
std::move(src_va_surface), std::move(dst_va_surface), input_frame->visible_rect(),
input_frame->visible_rect(), output_frame->visible_rect())) { output_frame->visible_rect())) {
// Failed to execute BlitSurface(). Since VaapiWrapper has invoked // Failed to execute BlitSurface(). Since VaapiWrapper has invoked
// ReportToUMA(), calling error_cb_ here is not needed. // ReportToUMA(), calling error_cb_ here is not needed.
return; return;
......
...@@ -181,7 +181,7 @@ void VaapiJpegEncodeAccelerator::Encoder::EncodeWithDmaBufTask( ...@@ -181,7 +181,7 @@ void VaapiJpegEncodeAccelerator::Encoder::EncodeWithDmaBufTask(
auto blit_surface = auto blit_surface =
base::MakeRefCounted<VASurface>(va_surface_id_, input_size, va_format, base::MakeRefCounted<VASurface>(va_surface_id_, input_size, va_format,
base::DoNothing() /* release_cb */); base::DoNothing() /* release_cb */);
if (!vpp_vaapi_wrapper_->BlitSurface(input_surface, blit_surface)) { if (!vpp_vaapi_wrapper_->BlitSurface(*input_surface, *blit_surface)) {
VLOGF(1) << "Failed to blit surfaces"; VLOGF(1) << "Failed to blit surfaces";
notify_error_cb_.Run(task_id, PLATFORM_FAILURE); notify_error_cb_.Run(task_id, PLATFORM_FAILURE);
return; return;
......
...@@ -384,7 +384,7 @@ bool VaapiMjpegDecodeAccelerator::OutputPictureVppOnTaskRunner( ...@@ -384,7 +384,7 @@ bool VaapiMjpegDecodeAccelerator::OutputPictureVppOnTaskRunner(
VLOGF(1) << "Cannot sync VPP input surface"; VLOGF(1) << "Cannot sync VPP input surface";
return false; return false;
} }
if (!vpp_vaapi_wrapper_->BlitSurface(src_surface, dst_surface)) { if (!vpp_vaapi_wrapper_->BlitSurface(*src_surface, *dst_surface)) {
VLOGF(1) << "Cannot convert decoded image into output buffer"; VLOGF(1) << "Cannot convert decoded image into output buffer";
return false; return false;
} }
......
...@@ -38,7 +38,7 @@ VaapiPictureNativePixmap::~VaapiPictureNativePixmap() = default; ...@@ -38,7 +38,7 @@ VaapiPictureNativePixmap::~VaapiPictureNativePixmap() = default;
bool VaapiPictureNativePixmap::DownloadFromSurface( bool VaapiPictureNativePixmap::DownloadFromSurface(
scoped_refptr<VASurface> va_surface) { scoped_refptr<VASurface> va_surface) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return vaapi_wrapper_->BlitSurface(std::move(va_surface), va_surface_); return vaapi_wrapper_->BlitSurface(*va_surface, *va_surface_);
} }
bool VaapiPictureNativePixmap::AllowOverlay() const { bool VaapiPictureNativePixmap::AllowOverlay() const {
......
...@@ -657,7 +657,7 @@ std::unique_ptr<VaapiEncodeJob> VaapiVideoEncodeAccelerator::CreateEncodeJob( ...@@ -657,7 +657,7 @@ std::unique_ptr<VaapiEncodeJob> VaapiVideoEncodeAccelerator::CreateEncodeJob(
kVaSurfaceFormat, base::BindOnce(vpp_va_surface_release_cb_)); kVaSurfaceFormat, base::BindOnce(vpp_va_surface_release_cb_));
available_vpp_va_surface_ids_.pop_back(); available_vpp_va_surface_ids_.pop_back();
// Crop/Scale the visible area of |frame| -> |blit_visible_rect|. // Crop/Scale the visible area of |frame| -> |blit_visible_rect|.
if (!vpp_vaapi_wrapper_->BlitSurface(input_surface, blit_surface, if (!vpp_vaapi_wrapper_->BlitSurface(*input_surface, *blit_surface,
frame->visible_rect(), frame->visible_rect(),
blit_visible_rect_)) { blit_visible_rect_)) {
NOTIFY_ERROR( NOTIFY_ERROR(
......
...@@ -1923,8 +1923,8 @@ void VaapiWrapper::DestroyVABuffers() { ...@@ -1923,8 +1923,8 @@ void VaapiWrapper::DestroyVABuffers() {
va_buffers_.clear(); va_buffers_.clear();
} }
bool VaapiWrapper::BlitSurface(const scoped_refptr<VASurface>& va_surface_src, bool VaapiWrapper::BlitSurface(const VASurface& va_surface_src,
const scoped_refptr<VASurface>& va_surface_dest, const VASurface& va_surface_dest,
base::Optional<gfx::Rect> src_rect, base::Optional<gfx::Rect> src_rect,
base::Optional<gfx::Rect> dest_rect) { base::Optional<gfx::Rect> dest_rect) {
base::AutoLock auto_lock(*va_lock_); base::AutoLock auto_lock(*va_lock_);
...@@ -1952,9 +1952,9 @@ bool VaapiWrapper::BlitSurface(const scoped_refptr<VASurface>& va_surface_src, ...@@ -1952,9 +1952,9 @@ bool VaapiWrapper::BlitSurface(const scoped_refptr<VASurface>& va_surface_src,
memset(pipeline_param, 0, sizeof *pipeline_param); memset(pipeline_param, 0, sizeof *pipeline_param);
if (!src_rect) if (!src_rect)
src_rect.emplace(gfx::Rect(va_surface_src->size())); src_rect.emplace(gfx::Rect(va_surface_src.size()));
if (!dest_rect) if (!dest_rect)
dest_rect.emplace(gfx::Rect(va_surface_dest->size())); dest_rect.emplace(gfx::Rect(va_surface_dest.size()));
VARectangle input_region; VARectangle input_region;
input_region.x = src_rect->x(); input_region.x = src_rect->x();
...@@ -1962,7 +1962,7 @@ bool VaapiWrapper::BlitSurface(const scoped_refptr<VASurface>& va_surface_src, ...@@ -1962,7 +1962,7 @@ bool VaapiWrapper::BlitSurface(const scoped_refptr<VASurface>& va_surface_src,
input_region.width = src_rect->width(); input_region.width = src_rect->width();
input_region.height = src_rect->height(); input_region.height = src_rect->height();
pipeline_param->surface_region = &input_region; pipeline_param->surface_region = &input_region;
pipeline_param->surface = va_surface_src->id(); pipeline_param->surface = va_surface_src.id();
pipeline_param->surface_color_standard = VAProcColorStandardNone; pipeline_param->surface_color_standard = VAProcColorStandardNone;
VARectangle output_region; VARectangle output_region;
...@@ -1979,7 +1979,7 @@ bool VaapiWrapper::BlitSurface(const scoped_refptr<VASurface>& va_surface_src, ...@@ -1979,7 +1979,7 @@ bool VaapiWrapper::BlitSurface(const scoped_refptr<VASurface>& va_surface_src,
} }
VA_SUCCESS_OR_RETURN( VA_SUCCESS_OR_RETURN(
vaBeginPicture(va_display_, va_context_id_, va_surface_dest->id()), vaBeginPicture(va_display_, va_context_id_, va_surface_dest.id()),
"vaBeginPicture", false); "vaBeginPicture", false);
VA_SUCCESS_OR_RETURN( VA_SUCCESS_OR_RETURN(
......
...@@ -379,8 +379,8 @@ class MEDIA_GPU_EXPORT VaapiWrapper ...@@ -379,8 +379,8 @@ class MEDIA_GPU_EXPORT VaapiWrapper
// |va_surface_dest| applying pixel format conversion, cropping and scaling // |va_surface_dest| applying pixel format conversion, cropping and scaling
// if needed. |src_rect| and |dest_rect| are optional. They can be used to // if needed. |src_rect| and |dest_rect| are optional. They can be used to
// specify the area used in the blit. // specify the area used in the blit.
bool BlitSurface(const scoped_refptr<VASurface>& va_surface_src, bool BlitSurface(const VASurface& va_surface_src,
const scoped_refptr<VASurface>& va_surface_dest, const VASurface& va_surface_dest,
base::Optional<gfx::Rect> src_rect = base::nullopt, base::Optional<gfx::Rect> src_rect = base::nullopt,
base::Optional<gfx::Rect> dest_rect = base::nullopt); base::Optional<gfx::Rect> dest_rect = base::nullopt);
......
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