Bug 1836072 [wpt PR 40324] - Fix scrollbar-width repaint issues on non viewports...
[gecko.git] / gfx / gl / SharedSurfaceDMABUF.h
blob6aaa4d333e2fc89f58a46415349c2bb197740135
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_DMABUF_H_
7 #define SHARED_SURFACE_DMABUF_H_
9 #include "SharedSurface.h"
10 #include "mozilla/widget/DMABufSurface.h"
12 namespace mozilla {
13 namespace gl {
15 class GLContext;
16 class GLLibraryEGL;
18 class SharedSurface_DMABUF final : public SharedSurface {
19 public:
20 const RefPtr<DMABufSurface> mSurface;
22 static UniquePtr<SharedSurface_DMABUF> Create(const SharedSurfaceDesc&);
24 private:
25 SharedSurface_DMABUF(const SharedSurfaceDesc&, UniquePtr<MozFramebuffer>,
26 RefPtr<DMABufSurface>);
28 void UpdateProdTexture(const MutexAutoLock& curAutoLock);
30 public:
31 virtual ~SharedSurface_DMABUF();
33 // Exclusive Content/WebGL lock/unlock of surface for write
34 virtual void LockProdImpl() override {}
35 virtual void UnlockProdImpl() override {}
37 // Non-exclusive Content/WebGL lock/unlock of surface for write
38 virtual void ProducerAcquireImpl() override {}
39 virtual void ProducerReleaseImpl() override;
41 // Non-exclusive Content/WebGL lock/unlock for read from surface
42 virtual void ProducerReadAcquireImpl() override {}
43 virtual void ProducerReadReleaseImpl() override {}
45 Maybe<layers::SurfaceDescriptor> ToSurfaceDescriptor() override;
47 void WaitForBufferOwnership() override;
50 class SurfaceFactory_DMABUF : public SurfaceFactory {
51 public:
52 static UniquePtr<SurfaceFactory_DMABUF> Create(GLContext& gl);
54 explicit SurfaceFactory_DMABUF(GLContext&);
56 public:
57 virtual UniquePtr<SharedSurface> CreateSharedImpl(
58 const SharedSurfaceDesc& desc) override {
59 return SharedSurface_DMABUF::Create(desc);
62 bool CanCreateSurface(GLContext& gl);
65 } // namespace gl
67 } // namespace mozilla
69 #endif /* SHARED_SURFACE_DMABUF_H_ */