Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create GLDisplay class to wrap each display.
To accommodate multiple EGLDisplays in the GPU process, we need to refactor the static functions and objects in gl_surface_egl to depend on each display. This CL creates a GLDisplay class to own each display. Future CLs will give GLSurfaceEGL ownership of one GLDisplay, as well as merge the static functions that query extensions from the display into the GLDisplay class. Bug: 1251724 Change-Id: I56be8f6be57b707427611d53b656c4094737f50c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3507204 Reviewed-by: Zhenyao Mo <zmo@chromium.org> Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Reviewed-by: ccameron chromium <ccameron@chromium.org> Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Cr-Commit-Position: refs/heads/main@{#990026}
- Loading branch information
1 parent
df55cd0
commit cb2b7cf
Showing
21 changed files
with
280 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (c) 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ui/gl/gl_display.h" | ||
#include "base/notreached.h" | ||
|
||
#if defined(USE_GLX) | ||
#include "ui/gl/glx_util.h" | ||
#endif // defined(USE_GLX) | ||
|
||
#if defined(USE_EGL) | ||
#define EGL_NO_DISPLAY 0 | ||
#endif | ||
|
||
namespace gl { | ||
|
||
GLDisplay::GLDisplay() = default; | ||
|
||
GLDisplay::~GLDisplay() = default; | ||
|
||
#if defined(USE_EGL) | ||
GLDisplayEGL::GLDisplayEGL() { | ||
display_ = EGL_NO_DISPLAY; | ||
} | ||
|
||
GLDisplayEGL::GLDisplayEGL(EGLDisplay display) { | ||
display_ = display; | ||
} | ||
|
||
GLDisplayEGL::~GLDisplayEGL() = default; | ||
|
||
EGLDisplay GLDisplayEGL::GetDisplay() { | ||
return display_; | ||
} | ||
|
||
void GLDisplayEGL::SetDisplay(EGLDisplay display) { | ||
display_ = display; | ||
} | ||
|
||
#endif // defined(USE_EGL) | ||
|
||
#if defined(USE_GLX) | ||
GLDisplayX11::GLDisplayX11() = default; | ||
|
||
GLDisplayX11::~GLDisplayX11() = default; | ||
|
||
void* GLDisplayX11::GetDisplay() { | ||
return x11::Connection::Get()->GetXlibDisplay(); | ||
} | ||
#endif // defined(USE_GLX) | ||
|
||
} // namespace gl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef UI_GL_GL_DISPLAY_H_ | ||
#define UI_GL_GL_DISPLAY_H_ | ||
|
||
#include "ui/gl/gl_export.h" | ||
|
||
#if defined(USE_EGL) | ||
typedef void* EGLDisplay; | ||
#endif // defined(USE_EGL) | ||
|
||
namespace gl { | ||
|
||
class GL_EXPORT GLDisplay { | ||
public: | ||
GLDisplay(); | ||
|
||
GLDisplay(const GLDisplay&) = delete; | ||
GLDisplay& operator=(const GLDisplay&) = delete; | ||
|
||
virtual ~GLDisplay(); | ||
|
||
virtual void* GetDisplay() = 0; | ||
}; | ||
|
||
#if defined(USE_EGL) | ||
class GL_EXPORT GLDisplayEGL : public GLDisplay { | ||
public: | ||
GLDisplayEGL(); | ||
explicit GLDisplayEGL(EGLDisplay display); | ||
|
||
GLDisplayEGL(const GLDisplayEGL&) = delete; | ||
GLDisplayEGL& operator=(const GLDisplayEGL&) = delete; | ||
|
||
~GLDisplayEGL() override; | ||
|
||
EGLDisplay GetDisplay() override; | ||
void SetDisplay(EGLDisplay display); | ||
|
||
private: | ||
EGLDisplay display_; | ||
}; | ||
#endif // defined(USE_EGL) | ||
|
||
#if defined(USE_GLX) | ||
class GL_EXPORT GLDisplayX11 : public GLDisplay { | ||
public: | ||
GLDisplayX11(); | ||
|
||
GLDisplayX11(const GLDisplayX11&) = delete; | ||
GLDisplayX11& operator=(const GLDisplayX11&) = delete; | ||
|
||
~GLDisplayX11() override; | ||
|
||
void* GetDisplay() override; | ||
}; | ||
#endif // defined(USE_GLX) | ||
|
||
} // namespace gl | ||
|
||
#endif // UI_GL_GL_DISPLAY_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.