summaryrefslogtreecommitdiffstats
path: root/gfx/gl/SharedSurfaceAndroidHardwareBuffer.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/gl/SharedSurfaceAndroidHardwareBuffer.h
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/gl/SharedSurfaceAndroidHardwareBuffer.h')
-rw-r--r--gfx/gl/SharedSurfaceAndroidHardwareBuffer.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/gfx/gl/SharedSurfaceAndroidHardwareBuffer.h b/gfx/gl/SharedSurfaceAndroidHardwareBuffer.h
new file mode 100644
index 0000000000..ef40ad622d
--- /dev/null
+++ b/gfx/gl/SharedSurfaceAndroidHardwareBuffer.h
@@ -0,0 +1,70 @@
+/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 4; -*- */
+/* 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/. */
+
+#ifndef SHARED_SURFACE_ANDROID_HARDWARE_BUFFER_H_
+#define SHARED_SURFACE_ANDROID_HARDWARE_BUFFER_H_
+
+#include "mozilla/Attributes.h"
+#include "mozilla/Mutex.h"
+#include "CompositorTypes.h"
+#include "SharedSurface.h"
+
+namespace mozilla {
+
+namespace layers {
+class AndroidHardwareBuffer;
+} // namespace layers
+
+namespace gl {
+
+class SharedSurface_AndroidHardwareBuffer final : public SharedSurface {
+ public:
+ const UniquePtr<Texture> mTex;
+ const RefPtr<layers::AndroidHardwareBuffer> mAndroidHardwareBuffer;
+ EGLSync mSync = 0;
+
+ static UniquePtr<SharedSurface_AndroidHardwareBuffer> Create(
+ const SharedSurfaceDesc&);
+
+ protected:
+ SharedSurface_AndroidHardwareBuffer(
+ const SharedSurfaceDesc&, UniquePtr<MozFramebuffer>, UniquePtr<Texture>,
+ RefPtr<layers::AndroidHardwareBuffer> buffer);
+
+ public:
+ virtual ~SharedSurface_AndroidHardwareBuffer();
+
+ void LockProdImpl() override {}
+ void UnlockProdImpl() override {}
+
+ void ProducerAcquireImpl() override {}
+ void ProducerReleaseImpl() override;
+
+ Maybe<layers::SurfaceDescriptor> ToSurfaceDescriptor() override;
+
+ void WaitForBufferOwnership() override;
+};
+
+class SurfaceFactory_AndroidHardwareBuffer final : public SurfaceFactory {
+ public:
+ static UniquePtr<SurfaceFactory_AndroidHardwareBuffer> Create(GLContext&);
+
+ private:
+ explicit SurfaceFactory_AndroidHardwareBuffer(
+ const PartialSharedSurfaceDesc& desc)
+ : SurfaceFactory(desc) {}
+
+ public:
+ virtual UniquePtr<SharedSurface> CreateSharedImpl(
+ const SharedSurfaceDesc& desc) override {
+ return SharedSurface_AndroidHardwareBuffer::Create(desc);
+ }
+};
+
+} // namespace gl
+
+} /* namespace mozilla */
+
+#endif /* SHARED_SURFACE_ANDROID_HARDWARE_BUFFER_H_ */