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() override
{
28 return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
31 gfx::YUVColorSpace
GetYUVColorSpace() const override
;
32 gfx::ColorDepth
GetColorDepth() const override
;
33 gfx::ColorRange
GetColorRange() const override
;
35 gfx::IntSize
GetSize() const override
;
37 bool IsValid() override
;
39 #ifdef MOZ_LAYERS_HAVE_LOG
40 const char* Name() override
{ return "GPUVideoTextureHost"; }
43 void CreateRenderTexture(
44 const wr::ExternalImageId
& aExternalImageId
) override
;
46 void MaybeDestroyRenderTexture() override
;
48 uint32_t NumSubTextures() override
;
50 void PushResourceUpdates(wr::TransactionBuilder
& aResources
,
52 const Range
<wr::ImageKey
>& aImageKeys
,
53 const wr::ExternalImageId
& aExtID
) override
;
55 void PushDisplayItems(wr::DisplayListBuilder
& aBuilder
,
56 const wr::LayoutRect
& aBounds
,
57 const wr::LayoutRect
& aClip
, wr::ImageRendering aFilter
,
58 const Range
<wr::ImageKey
>& aImageKeys
,
59 PushDisplayItemFlagSet aFlags
) override
;
61 bool SupportsExternalCompositing(WebRenderBackend aBackend
) override
;
63 void UnbindTextureSource() override
;
65 void NotifyNotUsed() override
;
67 BufferTextureHost
* AsBufferTextureHost() override
;
69 bool IsWrappingSurfaceTextureHost() override
;
71 TextureHostType
GetTextureHostType() override
;
73 bool NeedsDeferredDeletion() const override
;
75 const dom::ContentParentId
& GetContentId() const { return mContentId
; }
78 GPUVideoTextureHost(const dom::ContentParentId
& aContentId
,
80 const SurfaceDescriptorGPUVideo
& aDescriptor
);
82 TextureHost
* EnsureWrappedTextureHost();
84 RefPtr
<TextureHost
> mWrappedTextureHost
;
85 dom::ContentParentId mContentId
;
86 SurfaceDescriptorGPUVideo mDescriptor
;
90 } // namespace mozilla
92 #endif // MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H