tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GPUVideoTextureHost.h (3202B)


      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/. */
      6 
      7 #ifndef MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H
      8 #define MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H
      9 
     10 #include "mozilla/layers/TextureHost.h"
     11 
     12 namespace mozilla {
     13 namespace layers {
     14 
     15 class GPUVideoTextureHost final : public TextureHost {
     16 public:
     17  static GPUVideoTextureHost* CreateFromDescriptor(
     18      const dom::ContentParentId& aContentId, TextureFlags aFlags,
     19      const SurfaceDescriptorGPUVideo& aDescriptor);
     20 
     21  virtual ~GPUVideoTextureHost();
     22 
     23  void DeallocateDeviceData() override {}
     24 
     25  gfx::SurfaceFormat GetFormat() const override;
     26 
     27  already_AddRefed<gfx::DataSourceSurface> GetAsSurface(
     28      gfx::DataSourceSurface* aSurface) override {
     29    return nullptr;  // XXX - implement this (for MOZ_DUMP_PAINTING)
     30  }
     31 
     32  gfx::YUVColorSpace GetYUVColorSpace() const override;
     33  gfx::ColorDepth GetColorDepth() const override;
     34  gfx::ColorRange GetColorRange() const override;
     35 
     36  bool NeedsYFlip() const override;
     37 
     38  gfx::IntSize GetSize() const override;
     39 
     40  bool IsValid() override;
     41 
     42 #ifdef MOZ_LAYERS_HAVE_LOG
     43  const char* Name() override { return "GPUVideoTextureHost"; }
     44 #endif
     45 
     46  void CreateRenderTexture(
     47      const wr::ExternalImageId& aExternalImageId) override;
     48 
     49  void MaybeDestroyRenderTexture() override;
     50 
     51  uint32_t NumSubTextures() override;
     52 
     53  void PushResourceUpdates(wr::TransactionBuilder& aResources,
     54                           ResourceUpdateOp aOp,
     55                           const Range<wr::ImageKey>& aImageKeys,
     56                           const wr::ExternalImageId& aExtID) override;
     57 
     58  void PushDisplayItems(wr::DisplayListBuilder& aBuilder,
     59                        const wr::LayoutRect& aBounds,
     60                        const wr::LayoutRect& aClip, wr::ImageRendering aFilter,
     61                        const Range<wr::ImageKey>& aImageKeys,
     62                        PushDisplayItemFlagSet aFlags) override;
     63 
     64  bool SupportsExternalCompositing(WebRenderBackend aBackend) override;
     65 
     66  void UnbindTextureSource() override;
     67 
     68  void NotifyNotUsed() override;
     69 
     70  void SetReadFence(Fence* aReadFence) override;
     71 
     72  BufferTextureHost* AsBufferTextureHost() override;
     73 
     74  DXGITextureHostD3D11* AsDXGITextureHostD3D11() override;
     75 
     76  DXGIYCbCrTextureHostD3D11* AsDXGIYCbCrTextureHostD3D11() override;
     77 
     78  bool IsWrappingSurfaceTextureHost() override;
     79 
     80  TextureHostType GetTextureHostType() override;
     81 
     82  bool NeedsDeferredDeletion() const override;
     83 
     84  const dom::ContentParentId& GetContentId() const { return mContentId; }
     85 
     86 protected:
     87  GPUVideoTextureHost(const dom::ContentParentId& aContentId,
     88                      TextureFlags aFlags,
     89                      const SurfaceDescriptorGPUVideo& aDescriptor);
     90 
     91  TextureHost* EnsureWrappedTextureHost();
     92 
     93  RefPtr<TextureHost> mWrappedTextureHost;
     94  dom::ContentParentId mContentId;
     95  SurfaceDescriptorGPUVideo mDescriptor;
     96 };
     97 
     98 }  // namespace layers
     99 }  // namespace mozilla
    100 
    101 #endif  // MOZILLA_GFX_GPUVIDEOTEXTUREHOST_H