Commit 0d36850b authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

media/gpu/vaapi: add a few TRACEs

To help finding performance hotspots.

(This is mostly for tracing the vaCreateBuffer() call -- since it
allocates a BO, it needs to clear it and takes a bit of time; the
question is how much, compared to video decoding in vaEndPicture()).

Bug: b:162962069
Change-Id: Icde7df8f44c36065c04e5e55e2f9866e73197e84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2353015
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarJao-ke Chin-Lee <jchinlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797665}
parent 74915a1f
......@@ -7,6 +7,7 @@
#include <va/va.h>
#include "base/stl_util.h"
#include "base/trace_event/trace_event.h"
#include "media/gpu/decode_surface_handler.h"
#include "media/gpu/h264_dpb.h"
#include "media/gpu/macros.h"
......@@ -67,6 +68,8 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitFrameMetadata(
const H264Picture::Vector& ref_pic_listb1,
scoped_refptr<H264Picture> pic) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
TRACE_EVENT0("media,gpu",
"H264VaapiVideoDecoderDelegate::SubmitFrameMetadata");
VAPictureParameterBufferH264 pic_param;
memset(&pic_param, 0, sizeof(pic_param));
......@@ -183,6 +186,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitSlice(
size_t size,
const std::vector<SubsampleEntry>& subsamples) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
TRACE_EVENT0("media,gpu", "H264VaapiVideoDecoderDelegate::SubmitSlice");
VASliceParameterBufferH264 slice_param;
memset(&slice_param, 0, sizeof(slice_param));
......@@ -282,6 +286,7 @@ DecodeStatus H264VaapiVideoDecoderDelegate::SubmitSlice(
DecodeStatus H264VaapiVideoDecoderDelegate::SubmitDecode(
scoped_refptr<H264Picture> pic) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
TRACE_EVENT0("media,gpu", "H264VaapiVideoDecoderDelegate::SubmitDecode");
const bool success = vaapi_wrapper_->ExecuteAndDestroyPendingBuffers(
pic->AsVaapiH264Picture()->va_surface()->id());
......
......@@ -1692,9 +1692,13 @@ bool VaapiWrapper::SubmitBuffer(VABufferType va_buffer_type,
TRACE_EVENT0("media,gpu", "VaapiWrapper::SubmitBufferLocked");
VABufferID buffer_id;
VAStatus va_res = vaCreateBuffer(va_display_, va_context_id_, va_buffer_type,
size, 1, nullptr, &buffer_id);
VA_SUCCESS_OR_RETURN(va_res, "vaCreateBuffer", false);
{
TRACE_EVENT0("media,gpu", "VaapiWrapper::SubmitBuffer_vaCreateBuffer");
const VAStatus va_res =
vaCreateBuffer(va_display_, va_context_id_, va_buffer_type, size, 1,
nullptr, &buffer_id);
VA_SUCCESS_OR_RETURN(va_res, "vaCreateBuffer", false);
}
ScopedVABufferMapping mapping(
va_lock_, va_display_, buffer_id,
......
......@@ -4,6 +4,7 @@
#include "media/gpu/vaapi/vp8_vaapi_video_decoder_delegate.h"
#include "base/trace_event/trace_event.h"
#include "media/gpu/decode_surface_handler.h"
#include "media/gpu/vaapi/va_surface.h"
#include "media/gpu/vaapi/vaapi_common.h"
......@@ -31,6 +32,7 @@ scoped_refptr<VP8Picture> VP8VaapiVideoDecoderDelegate::CreateVP8Picture() {
bool VP8VaapiVideoDecoderDelegate::SubmitDecode(
scoped_refptr<VP8Picture> pic,
const Vp8ReferenceFrameVector& reference_frames) {
TRACE_EVENT0("media,gpu", "VP8VaapiVideoDecoderDelegate::SubmitDecode");
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
auto va_surface_id = pic->AsVaapiVP8Picture()->va_surface()->id();
......
......@@ -7,6 +7,7 @@
#include <type_traits>
#include "base/stl_util.h"
#include "base/trace_event/trace_event.h"
#include "media/gpu/decode_surface_handler.h"
#include "media/gpu/macros.h"
#include "media/gpu/vaapi/va_surface.h"
......@@ -37,6 +38,7 @@ bool VP9VaapiVideoDecoderDelegate::SubmitDecode(
const Vp9LoopFilterParams& lf,
const Vp9ReferenceFrameVector& ref_frames,
base::OnceClosure done_cb) {
TRACE_EVENT0("media,gpu", "VP9VaapiVideoDecoderDelegate::SubmitDecode");
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// |done_cb| should be null as we return false from IsFrameContextRequired().
DCHECK(!done_cb);
......
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