#include "media/capture/video/linux/v4l2_gpu_memory_buffer_tracker.h"
#include <optional>
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "media/capture/video/video_capture_buffer_handle.h"
#include "media/capture/video_capture_types.h"
#include "ui/gfx/geometry/size.h"
namespace media {
namespace {
std::optional<gfx::BufferFormat> ToBufferFormat(VideoPixelFormat pixel_format) { … }
gfx::BufferUsage GetBufferUsage(gfx::BufferFormat format) { … }
}
V4L2GpuMemoryBufferTracker::V4L2GpuMemoryBufferTracker() = default;
V4L2GpuMemoryBufferTracker::~V4L2GpuMemoryBufferTracker() { … }
bool V4L2GpuMemoryBufferTracker::Init(const gfx::Size& dimensions,
VideoPixelFormat format,
const mojom::PlaneStridesPtr& strides) { … }
bool V4L2GpuMemoryBufferTracker::IsReusableForFormat(
const gfx::Size& dimensions,
VideoPixelFormat format,
const mojom::PlaneStridesPtr& strides) { … }
std::unique_ptr<VideoCaptureBufferHandle>
V4L2GpuMemoryBufferTracker::GetMemoryMappedAccess() { … }
base::UnsafeSharedMemoryRegion
V4L2GpuMemoryBufferTracker::DuplicateAsUnsafeRegion() { … }
gfx::GpuMemoryBufferHandle
V4L2GpuMemoryBufferTracker::GetGpuMemoryBufferHandle() { … }
VideoCaptureBufferType V4L2GpuMemoryBufferTracker::GetBufferType() { … }
uint32_t V4L2GpuMemoryBufferTracker::GetMemorySizeInBytes() { … }
void V4L2GpuMemoryBufferTracker::OnContextLost() { … }
}