#include "media/gpu/chromeos/native_pixmap_frame_resource.h"
#include "atomic"
#include "base/feature_list.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/synchronization/lock.h"
#include "media/base/format_utils.h"
#include "media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.h"
#include "media/gpu/chromeos/platform_video_frame_utils.h"
#include "media/gpu/macros.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/switches.h"
namespace media {
namespace {
gfx::GenericSharedMemoryId GetNextSharedMemoryId() { … }
bool IsValidSize(const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size) { … }
}
scoped_refptr<NativePixmapFrameResource> NativePixmapFrameResource::Create(
media::VideoPixelFormat pixel_format,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
base::TimeDelta timestamp,
gfx::BufferUsage buffer_usage) { … }
scoped_refptr<NativePixmapFrameResource> NativePixmapFrameResource::Create(
const media::VideoFrameLayout& layout,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
std::vector<base::ScopedFD> dmabuf_fds,
base::TimeDelta timestamp) { … }
scoped_refptr<NativePixmapFrameResource> NativePixmapFrameResource::Create(
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
base::TimeDelta timestamp,
gfx::BufferUsage buffer_usage,
scoped_refptr<const gfx::NativePixmapDmaBuf> pixmap) { … }
NativePixmapFrameResource::NativePixmapFrameResource(
const media::VideoFrameLayout& layout,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
base::TimeDelta timestamp,
gfx::BufferFormat buffer_format,
gfx::GenericSharedMemoryId id,
std::optional<gfx::BufferUsage> buffer_usage,
gfx::NativePixmapHandle handle)
: … { … }
NativePixmapFrameResource::NativePixmapFrameResource(
const media::VideoFrameLayout& layout,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
base::TimeDelta timestamp,
gfx::GenericSharedMemoryId id,
std::optional<gfx::BufferUsage> buffer_usage,
scoped_refptr<const gfx::NativePixmapDmaBuf> pixmap)
: … { … }
NativePixmapFrameResource::~NativePixmapFrameResource() { … }
const NativePixmapFrameResource*
NativePixmapFrameResource::AsNativePixmapFrameResource() const { … }
bool NativePixmapFrameResource::IsMappable() const { … }
const uint8_t* NativePixmapFrameResource::data(size_t plane) const { … }
uint8_t* NativePixmapFrameResource::writable_data(size_t plane) { … }
const uint8_t* NativePixmapFrameResource::visible_data(size_t plane) const { … }
uint8_t* NativePixmapFrameResource::GetWritableVisibleData(size_t plane) { … }
size_t NativePixmapFrameResource::NumDmabufFds() const { … }
int NativePixmapFrameResource::GetDmabufFd(size_t i) const { … }
scoped_refptr<const gfx::NativePixmapDmaBuf>
NativePixmapFrameResource::GetNativePixmapDmaBuf() const { … }
gfx::GpuMemoryBufferHandle
NativePixmapFrameResource::CreateGpuMemoryBufferHandle() const { … }
std::unique_ptr<VideoFrame::ScopedMapping>
NativePixmapFrameResource::MapGMBOrSharedImage() const { … }
gfx::GenericSharedMemoryId NativePixmapFrameResource::GetSharedMemoryId()
const { … }
const VideoFrameLayout& NativePixmapFrameResource::layout() const { … }
VideoPixelFormat NativePixmapFrameResource::format() const { … }
int NativePixmapFrameResource::stride(size_t plane) const { … }
VideoFrame::StorageType NativePixmapFrameResource::storage_type() const { … }
int NativePixmapFrameResource::row_bytes(size_t plane) const { … }
const gfx::Size& NativePixmapFrameResource::coded_size() const { … }
const gfx::Rect& NativePixmapFrameResource::visible_rect() const { … }
const gfx::Size& NativePixmapFrameResource::natural_size() const { … }
gfx::ColorSpace NativePixmapFrameResource::ColorSpace() const { … }
void NativePixmapFrameResource::set_color_space(
const gfx::ColorSpace& color_space) { … }
const std::optional<gfx::HDRMetadata>& NativePixmapFrameResource::hdr_metadata()
const { … }
void NativePixmapFrameResource::set_hdr_metadata(
const std::optional<gfx::HDRMetadata>& hdr_metadata) { … }
const VideoFrameMetadata& NativePixmapFrameResource::metadata() const { … }
VideoFrameMetadata& NativePixmapFrameResource::metadata() { … }
void NativePixmapFrameResource::set_metadata(
const VideoFrameMetadata& metadata) { … }
base::TimeDelta NativePixmapFrameResource::timestamp() const { … }
void NativePixmapFrameResource::set_timestamp(base::TimeDelta timestamp) { … }
void NativePixmapFrameResource::AddDestructionObserver(
base::OnceClosure callback) { … }
scoped_refptr<FrameResource> NativePixmapFrameResource::CreateWrappingFrame(
const gfx::Rect& visible_rect,
const gfx::Size& natural_size) { … }
std::string NativePixmapFrameResource::AsHumanReadableString() const { … }
gfx::GpuMemoryBufferHandle
NativePixmapFrameResource::GetGpuMemoryBufferHandleForTesting() const { … }
scoped_refptr<VideoFrame> NativePixmapFrameResource::CreateVideoFrame() const { … }
}