1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H
8 #define MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H
10 #include "mozilla/layers/TextureHost.h"
15 class GPUVideoTextureHost
: public TextureHost
{
17 static GPUVideoTextureHost
* CreateFromDescriptor(
18 const dom::ContentParentId
& aContentId
, TextureFlags aFlags
,
19 const SurfaceDescriptorGPUVideo
& aDescriptor
);
21 virtual ~GPUVideoTextureHost();
23 void DeallocateDeviceData() override
{}
25 gfx::SurfaceFormat
GetFormat() const override
;
27 already_AddRefed
<gfx::DataSourceSurface
> GetAsSurface(
28 gfx::DataSourceSurface
* aSurface
) override
{
29 return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
32 gfx::YUVColorSpace
GetYUVColorSpace() const override
;
33 gfx::ColorDepth
GetColorDepth() const override
;
34 gfx::ColorRange
GetColorRange() const override
;
36 gfx::IntSize
GetSize() const override
;
38 bool IsValid() override
;
40 #ifdef MOZ_LAYERS_HAVE_LOG
41 const char* Name() override
{ return "GPUVideoTextureHost"; }
44 void CreateRenderTexture(
45 const wr::ExternalImageId
& aExternalImageId
) override
;
47 void MaybeDestroyRenderTexture() override
;
49 uint32_t NumSubTextures() override
;
51 void PushResourceUpdates(wr::TransactionBuilder
& aResources
,
53 const Range
<wr::ImageKey
>& aImageKeys
,
54 const wr::ExternalImageId
& aExtID
) override
;
56 void PushDisplayItems(wr::DisplayListBuilder
& aBuilder
,
57 const wr::LayoutRect
& aBounds
,
58 const wr::LayoutRect
& aClip
, wr::ImageRendering aFilter
,
59 const Range
<wr::ImageKey
>& aImageKeys
,
60 PushDisplayItemFlagSet aFlags
) override
;
62 bool SupportsExternalCompositing(WebRenderBackend aBackend
) override
;
64 void UnbindTextureSource() override
;
66 void NotifyNotUsed() override
;
68 BufferTextureHost
* AsBufferTextureHost() override
;
70 DXGITextureHostD3D11
* AsDXGITextureHostD3D11() override
;
72 bool IsWrappingSurfaceTextureHost() override
;
74 TextureHostType
GetTextureHostType() override
;
76 bool NeedsDeferredDeletion() const override
;
78 const dom::ContentParentId
& GetContentId() const { return mContentId
; }
81 GPUVideoTextureHost(const dom::ContentParentId
& aContentId
,
83 const SurfaceDescriptorGPUVideo
& aDescriptor
);
85 TextureHost
* EnsureWrappedTextureHost();
87 RefPtr
<TextureHost
> mWrappedTextureHost
;
88 dom::ContentParentId mContentId
;
89 SurfaceDescriptorGPUVideo mDescriptor
;
93 } // namespace mozilla
95 #endif // MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H