Hash :
a392a81d
Author :
Date :
2021-01-06T12:26:44
GLX: Avoid creating child window when X visual ID is specified. ANGLE's GLX backend creates a child ID because the visual of the X window must match that of the GLX window, and we can't always be certain. EGL_ANGLE_x11_visual allows applications to specify the visual ID of the window passed to ANGLE via EGL_X11_VISUAL_ID_ANGLE. When this is the case, we don't need to make a child window. Since Chrome always passes this information, this may help optimize ANGLE's GLX usage in Chrome, because we don't have to poll the parent window to manage the child window's properties. Bug: chromium:1132827 Change-Id: If8082d2d07469905afffab01dde2ec9fca8d4eb9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2611556 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
//
// Copyright 2015 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// WindowSurfaceGLX.h: GLX implementation of egl::Surface for windows
#ifndef LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_
#define LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_
#include "libANGLE/renderer/gl/glx/DisplayGLX.h"
#include "libANGLE/renderer/gl/glx/SurfaceGLX.h"
#include "libANGLE/renderer/gl/glx/platform_glx.h"
#include "libANGLE/renderer/gl/renderergl_utils.h"
namespace rx
{
class DisplayGLX;
class FunctionsGLX;
class WindowSurfaceGLX : public SurfaceGLX
{
public:
WindowSurfaceGLX(const egl::SurfaceState &state,
const FunctionsGLX &glx,
DisplayGLX *glxDisplay,
Window window,
Display *display,
glx::FBConfig fbConfig);
~WindowSurfaceGLX() override;
egl::Error initialize(const egl::Display *display) override;
egl::Error makeCurrent(const gl::Context *context) override;
egl::Error swap(const gl::Context *context) override;
egl::Error postSubBuffer(const gl::Context *context,
EGLint x,
EGLint y,
EGLint width,
EGLint height) override;
egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override;
egl::Error bindTexImage(const gl::Context *context,
gl::Texture *texture,
EGLint buffer) override;
egl::Error releaseTexImage(const gl::Context *context, EGLint buffer) override;
void setSwapInterval(EGLint interval) override;
EGLint getWidth() const override;
EGLint getHeight() const override;
EGLint isPostSubBufferSupported() const override;
EGLint getSwapBehavior() const override;
egl::Error checkForResize() override;
glx::Drawable getDrawable() const override;
egl::Error getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc) override;
egl::Error getMscRate(EGLint *numerator, EGLint *denominator) override;
private:
bool getWindowDimensions(Window window, unsigned int *width, unsigned int *height) const;
Window mParent;
Window mWindow;
Display *mDisplay;
bool mUseChildWindow;
// Only updated when mUseChildWindow is true
unsigned int mParentWidth, mParentHeight;
const FunctionsGLX &mGLX;
DisplayGLX *mGLXDisplay;
glx::FBConfig mFBConfig;
glx::Window mGLXWindow;
SwapControlData mSwapControl;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_GL_GLX_WINDOWSURFACEGLX_H_