diff options
Diffstat (limited to 'chromium/media/gpu/windows/d3d11_texture_wrapper.h')
-rw-r--r-- | chromium/media/gpu/windows/d3d11_texture_wrapper.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/chromium/media/gpu/windows/d3d11_texture_wrapper.h b/chromium/media/gpu/windows/d3d11_texture_wrapper.h index 88171c16a82..4d8c95e6ecd 100644 --- a/chromium/media/gpu/windows/d3d11_texture_wrapper.h +++ b/chromium/media/gpu/windows/d3d11_texture_wrapper.h @@ -51,6 +51,14 @@ class MEDIA_GPU_EXPORT Texture2DWrapper { ComD3D11Texture2D texture, size_t array_size) = 0; + // If the |texture| has key mutex, it is important to acquire the key mutex + // before any usage or you'll get an error. This API is required to be called: + // - Before reading or writing to the texture via views on the texture or + // other means. + // - Before calling ProcessTexture. + // And need to call ProcessTexture() to release the key mutex. + virtual Status AcquireKeyedMutexIfNeeded() = 0; + // Import |texture|, |array_slice| and return the mailbox(es) that can be // used to refer to it. virtual Status ProcessTexture(const gfx::ColorSpace& input_color_space, @@ -82,6 +90,8 @@ class MEDIA_GPU_EXPORT DefaultTexture2DWrapper : public Texture2DWrapper { ComD3D11Texture2D in_texture, size_t array_slice) override; + Status AcquireKeyedMutexIfNeeded() override; + Status ProcessTexture(const gfx::ColorSpace& input_color_space, MailboxHolderArray* mailbox_dest, gfx::ColorSpace* output_color_space) override; @@ -104,6 +114,10 @@ class MEDIA_GPU_EXPORT DefaultTexture2DWrapper : public Texture2DWrapper { DXGI_FORMAT dxgi_format, ComD3D11Texture2D texture, size_t array_slice); + + GpuResources(const GpuResources&) = delete; + GpuResources& operator=(const GpuResources&) = delete; + ~GpuResources(); private: @@ -111,8 +125,6 @@ class MEDIA_GPU_EXPORT DefaultTexture2DWrapper : public Texture2DWrapper { std::vector<std::unique_ptr<gpu::SharedImageRepresentationFactoryRef>> shared_images_; - - DISALLOW_COPY_AND_ASSIGN(GpuResources); }; // Receive an error from |gpu_resources_| and store it in |received_error_|. @@ -126,6 +138,9 @@ class MEDIA_GPU_EXPORT DefaultTexture2DWrapper : public Texture2DWrapper { MailboxHolderArray mailbox_holders_; DXGI_FORMAT dxgi_format_; + Microsoft::WRL::ComPtr<IDXGIKeyedMutex> keyed_mutex_; + bool keyed_mutex_acquired_ = false; + base::WeakPtrFactory<DefaultTexture2DWrapper> weak_factory_{this}; }; |