Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / gfx / gl / GLContextProviderLinux.cpp
blob72054493872483546c5ee4a7b77a7368699c84a6
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 #include "prenv.h"
8 #include "GLContextProvider.h"
9 #include "mozilla/gfx/gfxVars.h"
11 namespace mozilla::gl {
13 using namespace mozilla::gfx;
14 using namespace mozilla::widget;
16 #ifdef MOZ_X11
17 static class GLContextProviderGLX sGLContextProviderGLX;
18 #endif
19 static class GLContextProviderEGL sGLContextProviderEGL;
21 already_AddRefed<GLContext> GLContextProviderLinux::CreateForCompositorWidget(
22 CompositorWidget* aCompositorWidget, bool aHardwareWebRender,
23 bool aForceAccelerated) {
24 if (gfxVars::UseEGL()) {
25 return sGLContextProviderEGL.CreateForCompositorWidget(
26 aCompositorWidget, aHardwareWebRender, aForceAccelerated);
27 #ifdef MOZ_X11
28 } else {
29 return sGLContextProviderGLX.CreateForCompositorWidget(
30 aCompositorWidget, aHardwareWebRender, aForceAccelerated);
31 #endif
35 /*static*/
36 already_AddRefed<GLContext> GLContextProviderLinux::CreateHeadless(
37 const GLContextCreateDesc& desc, nsACString* const out_failureId) {
38 if (gfxVars::UseEGL()) {
39 return sGLContextProviderEGL.CreateHeadless(desc, out_failureId);
40 #ifdef MOZ_X11
41 } else {
42 return sGLContextProviderGLX.CreateHeadless(desc, out_failureId);
43 #endif
47 /*static*/
48 GLContext* GLContextProviderLinux::GetGlobalContext() {
49 if (gfxVars::UseEGL()) {
50 return sGLContextProviderEGL.GetGlobalContext();
51 #ifdef MOZ_X11
52 } else {
53 return sGLContextProviderGLX.GetGlobalContext();
54 #endif
58 /*static*/
59 void GLContextProviderLinux::Shutdown() {
60 if (gfxVars::UseEGL()) {
61 sGLContextProviderEGL.Shutdown();
62 #ifdef MOZ_X11
63 } else {
64 sGLContextProviderGLX.Shutdown();
65 #endif
69 } // namespace mozilla::gl