Commit 1008e15f authored by Miguel Casas's avatar Miguel Casas Committed by Commit Bot

GMBVFPool: do not count VFs backed by DmaBufs as unsupported

GMBVFPool counts as unsupported those VideoFrames backed by DmaBufs,
because it only checks HasTextures().  This CL adds a new method
VideoFrame::HasDmaBufs() and uses it to avoid logging those VFrames.

V4L2* creates these VideoFrames calling WrapExternalDmabufs().

Bug: 864145
Change-Id: I340f1f8c2cbbb53de0bed13cc69f868c63b097bd
Reviewed-on: https://chromium-review.googlesource.com/1169823
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582135}
parent 521ddf97
...@@ -413,6 +413,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs( ...@@ -413,6 +413,7 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
sizeof(frame->mailbox_holders_)); sizeof(frame->mailbox_holders_));
frame->mailbox_holders_release_cb_ = ReleaseMailboxCB(); frame->mailbox_holders_release_cb_ = ReleaseMailboxCB();
frame->dmabuf_fds_ = std::move(dmabuf_fds); frame->dmabuf_fds_ = std::move(dmabuf_fds);
DCHECK(frame->HasDmaBufs());
return frame; return frame;
} }
...@@ -863,6 +864,10 @@ std::vector<int> VideoFrame::DmabufFds() const { ...@@ -863,6 +864,10 @@ std::vector<int> VideoFrame::DmabufFds() const {
return ret; return ret;
} }
bool VideoFrame::HasDmaBufs() const {
return !dmabuf_fds_.empty();
}
#endif #endif
void VideoFrame::AddReadOnlySharedMemoryRegion( void VideoFrame::AddReadOnlySharedMemoryRegion(
......
...@@ -425,6 +425,9 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { ...@@ -425,6 +425,9 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
// that the caller shall not close them, or use them after the VideoFrame is // that the caller shall not close them, or use them after the VideoFrame is
// destroyed. // destroyed.
std::vector<int> DmabufFds() const; std::vector<int> DmabufFds() const;
// Returns true if |frame| has DmaBufs.
bool HasDmaBufs() const;
#endif #endif
void AddReadOnlySharedMemoryRegion(base::ReadOnlySharedMemoryRegion* region); void AddReadOnlySharedMemoryRegion(base::ReadOnlySharedMemoryRegion* region);
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_provider.h" #include "base/trace_event/memory_dump_provider.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "gpu/GLES2/gl2extchromium.h" #include "gpu/GLES2/gl2extchromium.h"
#include "gpu/command_buffer/client/gles2_interface.h" #include "gpu/command_buffer/client/gles2_interface.h"
#include "media/base/bind_to_current_loop.h" #include "media/base/bind_to_current_loop.h"
...@@ -561,6 +562,11 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::CreateHardwareFrame( ...@@ -561,6 +562,11 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::CreateHardwareFrame(
gpu_factories_->VideoFrameOutputFormat(video_frame->BitDepth()); gpu_factories_->VideoFrameOutputFormat(video_frame->BitDepth());
} }
bool is_software_backed_video_frame = !video_frame->HasTextures();
#if defined(OS_LINUX)
is_software_backed_video_frame &= !video_frame->HasDmaBufs();
#endif
bool passthrough = false; bool passthrough = false;
if (output_format_ == GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED) if (output_format_ == GpuVideoAcceleratorFactories::OutputFormat::UNDEFINED)
passthrough = true; passthrough = true;
...@@ -594,7 +600,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::CreateHardwareFrame( ...@@ -594,7 +600,7 @@ void GpuMemoryBufferVideoFramePool::PoolImpl::CreateHardwareFrame(
case PIXEL_FORMAT_YUV444P12: case PIXEL_FORMAT_YUV444P12:
case PIXEL_FORMAT_Y16: case PIXEL_FORMAT_Y16:
case PIXEL_FORMAT_UNKNOWN: case PIXEL_FORMAT_UNKNOWN:
if (!video_frame->HasTextures()) { if (is_software_backed_video_frame) {
UMA_HISTOGRAM_ENUMERATION( UMA_HISTOGRAM_ENUMERATION(
"Media.GpuMemoryBufferVideoFramePool.UnsupportedFormat", "Media.GpuMemoryBufferVideoFramePool.UnsupportedFormat",
video_frame->format(), PIXEL_FORMAT_MAX + 1); video_frame->format(), PIXEL_FORMAT_MAX + 1);
......
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