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_RENDERDMABUFTEXTUREHOST_H
8 #define MOZILLA_GFX_RENDERDMABUFTEXTUREHOST_H
10 #include "mozilla/layers/TextureHostOGL.h"
11 #include "RenderTextureHost.h"
12 #include "mozilla/widget/DMABufSurface.h"
17 class SurfaceDescriptorDMABuf
;
22 class RenderDMABUFTextureHost final
: public RenderTextureHost
{
24 explicit RenderDMABUFTextureHost(DMABufSurface
* aSurface
);
26 wr::WrExternalImage
Lock(uint8_t aChannelIndex
, gl::GLContext
* aGL
) override
;
27 void Unlock() override
;
28 void ClearCachedResources() override
;
30 size_t Bytes() override
{
31 return mSurface
->GetWidth() * mSurface
->GetHeight() *
32 BytesPerPixel(mSurface
->GetFormat());
36 virtual ~RenderDMABUFTextureHost();
37 void DeleteTextureHandle();
39 RefPtr
<DMABufSurface
> mSurface
;
40 RefPtr
<gl::GLContext
> mGL
;
44 } // namespace mozilla
46 #endif // MOZILLA_GFX_RENDERDMABUFTEXTUREHOST_H