Bug 1882703 [wpt PR 44848] - Update wpt metadata, a=testonly
[gecko.git] / gfx / gl / SharedSurfaceAndroidHardwareBuffer.h
blobef40ad622dc642046f8c1e06b02f4b4e03601ec3
1 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 4; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef SHARED_SURFACE_ANDROID_HARDWARE_BUFFER_H_
7 #define SHARED_SURFACE_ANDROID_HARDWARE_BUFFER_H_
9 #include "mozilla/Attributes.h"
10 #include "mozilla/Mutex.h"
11 #include "CompositorTypes.h"
12 #include "SharedSurface.h"
14 namespace mozilla {
16 namespace layers {
17 class AndroidHardwareBuffer;
18 } // namespace layers
20 namespace gl {
22 class SharedSurface_AndroidHardwareBuffer final : public SharedSurface {
23 public:
24 const UniquePtr<Texture> mTex;
25 const RefPtr<layers::AndroidHardwareBuffer> mAndroidHardwareBuffer;
26 EGLSync mSync = 0;
28 static UniquePtr<SharedSurface_AndroidHardwareBuffer> Create(
29 const SharedSurfaceDesc&);
31 protected:
32 SharedSurface_AndroidHardwareBuffer(
33 const SharedSurfaceDesc&, UniquePtr<MozFramebuffer>, UniquePtr<Texture>,
34 RefPtr<layers::AndroidHardwareBuffer> buffer);
36 public:
37 virtual ~SharedSurface_AndroidHardwareBuffer();
39 void LockProdImpl() override {}
40 void UnlockProdImpl() override {}
42 void ProducerAcquireImpl() override {}
43 void ProducerReleaseImpl() override;
45 Maybe<layers::SurfaceDescriptor> ToSurfaceDescriptor() override;
47 void WaitForBufferOwnership() override;
50 class SurfaceFactory_AndroidHardwareBuffer final : public SurfaceFactory {
51 public:
52 static UniquePtr<SurfaceFactory_AndroidHardwareBuffer> Create(GLContext&);
54 private:
55 explicit SurfaceFactory_AndroidHardwareBuffer(
56 const PartialSharedSurfaceDesc& desc)
57 : SurfaceFactory(desc) {}
59 public:
60 virtual UniquePtr<SharedSurface> CreateSharedImpl(
61 const SharedSurfaceDesc& desc) override {
62 return SharedSurface_AndroidHardwareBuffer::Create(desc);
66 } // namespace gl
68 } /* namespace mozilla */
70 #endif /* SHARED_SURFACE_ANDROID_HARDWARE_BUFFER_H_ */