• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2015 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 // WindowSurfaceGLX.h: GLX implementation of egl::Surface for windows
8 
9 #ifndef LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_
10 #define LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_
11 
12 #include "libANGLE/renderer/gl/glx/DisplayGLX.h"
13 #include "libANGLE/renderer/gl/glx/SurfaceGLX.h"
14 #include "libANGLE/renderer/gl/glx/platform_glx.h"
15 #include "libANGLE/renderer/gl/renderergl_utils.h"
16 
17 namespace rx
18 {
19 
20 class DisplayGLX;
21 class FunctionsGLX;
22 
23 class WindowSurfaceGLX : public SurfaceGLX
24 {
25   public:
26     WindowSurfaceGLX(const egl::SurfaceState &state,
27                      const FunctionsGLX &glx,
28                      DisplayGLX *glxDisplay,
29                      Window window,
30                      Display *display,
31                      glx::FBConfig fbConfig);
32     ~WindowSurfaceGLX() override;
33 
34     egl::Error initialize(const egl::Display *display) override;
35     egl::Error makeCurrent(const gl::Context *context) override;
36 
37     egl::Error swap(const gl::Context *context) override;
38     egl::Error postSubBuffer(const gl::Context *context,
39                              EGLint x,
40                              EGLint y,
41                              EGLint width,
42                              EGLint height) override;
43     egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
44     egl::Error bindTexImage(const gl::Context *context,
45                             gl::Texture *texture,
46                             EGLint buffer) override;
47     egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
48     void setSwapInterval(EGLint interval) override;
49 
50     EGLint getWidth() const override;
51     EGLint getHeight() const override;
52 
53     EGLint isPostSubBufferSupported() const override;
54     EGLint getSwapBehavior() const override;
55 
56     egl::Error checkForResize() override;
57     glx::Drawable getDrawable() const override;
58 
59     egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
60     egl::Error getMscRate(EGLint *numerator, EGLint *denominator) override;
61 
62   private:
63     bool getWindowDimensions(Window window, unsigned int *width, unsigned int *height) const;
64 
65     Window mParent;
66     unsigned int mParentWidth, mParentHeight;
67     Window mWindow;
68     Display *mDisplay;
69 
70     const FunctionsGLX &mGLX;
71     DisplayGLX *mGLXDisplay;
72 
73     glx::FBConfig mFBConfig;
74     glx::Window mGLXWindow;
75 
76     SwapControlData mSwapControl;
77 };
78 
79 }  // namespace rx
80 
81 #endif  // LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_
82