diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/vr/ipc/VRLayerChild.h | |
parent | Initial commit. (diff) | |
download | firefox-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/vr/ipc/VRLayerChild.h')
-rw-r--r-- | gfx/vr/ipc/VRLayerChild.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/gfx/vr/ipc/VRLayerChild.h b/gfx/vr/ipc/VRLayerChild.h new file mode 100644 index 0000000000..de91a46b87 --- /dev/null +++ b/gfx/vr/ipc/VRLayerChild.h @@ -0,0 +1,76 @@ +/* -*- 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/. */ + +#ifndef GFX_VR_LAYERCHILD_H +#define GFX_VR_LAYERCHILD_H + +#include "VRManagerChild.h" + +#include "mozilla/RefPtr.h" +#include "mozilla/gfx/PVRLayerChild.h" +#include "gfxVR.h" + +class nsICanvasRenderingContextInternal; + +namespace mozilla { +class WebGLContext; +class WebGLFramebufferJS; +namespace dom { +class HTMLCanvasElement; +} +namespace layers { +class SharedSurfaceTextureClient; +} +namespace gl { +class SurfaceFactory; +} +namespace gfx { + +class VRLayerChild : public PVRLayerChild { + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRLayerChild) + + public: + static PVRLayerChild* CreateIPDLActor(); + static bool DestroyIPDLActor(PVRLayerChild* actor); + + void Initialize(dom::HTMLCanvasElement* aCanvasElement, + const gfx::Rect& aLeftEyeRect, + const gfx::Rect& aRightEyeRect); + void SetXRFramebuffer(WebGLFramebufferJS*); + void SubmitFrame(const VRDisplayInfo& aDisplayInfo); + bool IsIPCOpen(); + + private: + VRLayerChild(); + virtual ~VRLayerChild(); + void ClearSurfaces(); + virtual void ActorDestroy(ActorDestroyReason aWhy) override; + + RefPtr<dom::HTMLCanvasElement> mCanvasElement; + bool mIPCOpen = false; + + // AddIPDLReference and ReleaseIPDLReference are only to be called by + // CreateIPDLActor and DestroyIPDLActor, respectively. We intentionally make + // them private to prevent misuse. The purpose of these methods is to be aware + // of when the IPC system around this actor goes down: mIPCOpen is then set to + // false. + void AddIPDLReference(); + void ReleaseIPDLReference(); + + gfx::Rect mLeftEyeRect; + gfx::Rect mRightEyeRect; + RefPtr<WebGLFramebufferJS> mFramebuffer; + + Maybe<layers::SurfaceDescriptor> mThisFrameTextureDesc; + Maybe<layers::SurfaceDescriptor> mLastFrameTextureDesc; + + uint64_t mLastSubmittedFrameId = 0; +}; + +} // namespace gfx +} // namespace mozilla + +#endif |