2019-10-17 11:28:56 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2020-10-14 07:58:18 +00:00
|
|
|
#ifndef MOZILLA_GFX_RENDERDMABUFTEXTUREHOST_H
|
|
|
|
#define MOZILLA_GFX_RENDERDMABUFTEXTUREHOST_H
|
2019-10-17 11:28:56 +00:00
|
|
|
|
|
|
|
#include "mozilla/layers/TextureHostOGL.h"
|
2020-10-14 07:58:18 +00:00
|
|
|
#include "RenderTextureHost.h"
|
2020-06-21 13:59:17 +00:00
|
|
|
#include "mozilla/widget/DMABufSurface.h"
|
2019-10-17 11:28:56 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
namespace layers {
|
|
|
|
class SurfaceDescriptorDMABuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace wr {
|
|
|
|
|
2020-10-14 07:58:18 +00:00
|
|
|
class RenderDMABUFTextureHost final : public RenderTextureHost {
|
2019-10-17 11:28:56 +00:00
|
|
|
public:
|
2020-10-14 07:58:18 +00:00
|
|
|
explicit RenderDMABUFTextureHost(DMABufSurface* aSurface);
|
2019-10-17 11:28:56 +00:00
|
|
|
|
2022-10-10 19:23:51 +00:00
|
|
|
wr::WrExternalImage Lock(uint8_t aChannelIndex, gl::GLContext* aGL) override;
|
2019-10-17 11:28:56 +00:00
|
|
|
void Unlock() override;
|
2020-12-14 00:26:18 +00:00
|
|
|
void ClearCachedResources() override;
|
2019-10-17 11:28:56 +00:00
|
|
|
|
2020-12-15 15:37:11 +00:00
|
|
|
size_t Bytes() override {
|
2021-01-06 17:17:23 +00:00
|
|
|
return mSurface->GetWidth() * mSurface->GetHeight() *
|
|
|
|
BytesPerPixel(mSurface->GetFormat());
|
2020-12-15 15:37:11 +00:00
|
|
|
}
|
2021-01-06 17:17:23 +00:00
|
|
|
|
2019-10-17 11:28:56 +00:00
|
|
|
private:
|
2020-10-14 07:58:18 +00:00
|
|
|
virtual ~RenderDMABUFTextureHost();
|
2019-10-17 11:28:56 +00:00
|
|
|
void DeleteTextureHandle();
|
|
|
|
|
2020-06-21 13:59:17 +00:00
|
|
|
RefPtr<DMABufSurface> mSurface;
|
2019-10-17 11:28:56 +00:00
|
|
|
RefPtr<gl::GLContext> mGL;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace wr
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2020-10-14 07:58:18 +00:00
|
|
|
#endif // MOZILLA_GFX_RENDERDMABUFTEXTUREHOST_H
|