Commit 5641d193 by Julien Isorce Committed by Commit Bot

Move generic code from rx::DisplayAndroid/Ozone to rx::DisplayEGL

This CL is intended to move and factorize code only. Move DisplayAndroid::generateConfigs to DisplayEGL::generateConfigs because the code is generic and not Android specific. It will be useful later to provide a default implementation of rx::DisplayEGL. Same for createWindowSurface and createPbufferSurface, they have been moved without changes from DisplayAndroid to DisplayEGL. Unimplemented functions in DisplayOzone and DisplayAndroid have been moved to DisplayEGL. Bug: angleproject:4328 Change-Id: Ibbd36f99ea457cbd69391beb4a83f23403bc40fb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2038286 Commit-Queue: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com>
parent a44d96dc
......@@ -197,17 +197,13 @@ if (_use_copy_compiler_dll) {
exec_script("scripts/file_exists.py", [ _old_compiler ], "value")
copy("copy_compiler_dll") {
sources = [
"$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll",
]
sources = [ "$windows_sdk_path/Redist/D3D/$target_cpu/d3dcompiler_47.dll" ]
if (_has_old_compiler) {
sources += [ _old_compiler ]
}
outputs = [
"$root_out_dir/{{source_file_part}}",
]
outputs = [ "$root_out_dir/{{source_file_part}}" ]
}
}
......@@ -263,12 +259,8 @@ angle_source_set("xxhash") {
if (angle_has_build) {
fuzzer_test("xxhash_fuzzer") {
sources = [
"src/common/third_party/xxhash/xxhash_fuzzer.cpp",
]
deps = [
":xxhash",
]
sources = [ "src/common/third_party/xxhash/xxhash_fuzzer.cpp" ]
deps = [ ":xxhash" ]
}
}
......@@ -280,9 +272,7 @@ angle_static_library("angle_common") {
":debug_annotations_config",
]
deps = [
":xxhash",
]
deps = [ ":xxhash" ]
public_deps = [
":angle_system_utils",
......@@ -304,17 +294,13 @@ config("angle_image_util_config") {
angle_source_set("angle_image_util_headers") {
sources = libangle_image_util_headers
public_deps = [
":angle_common",
]
public_deps = [ ":angle_common" ]
}
angle_static_library("angle_image_util") {
sources = libangle_image_util_sources
public_configs += [ ":angle_image_util_config" ]
public_deps = [
":angle_image_util_headers",
]
public_deps = [ ":angle_image_util_headers" ]
}
config("angle_gl_visibility_config") {
......@@ -343,9 +329,7 @@ angle_static_library("angle_gpu_info_util") {
":angle_gpu_info_util_config",
":angle_backend_config",
]
public_deps = [
":angle_common",
]
public_deps = [ ":angle_common" ]
sources = libangle_gpu_info_util_sources
deps = []
libs = []
......@@ -407,9 +391,7 @@ angle_static_library("angle_gpu_info_util") {
angle_source_set("angle_translator_headers") {
sources = angle_translator_exported_headers
public_deps = [
":includes",
]
public_deps = [ ":includes" ]
}
angle_static_library("translator") {
......@@ -469,18 +451,14 @@ angle_static_library("translator") {
}
angle_source_set("translator_fuzzer") {
sources = [
"src/compiler/fuzz/translator_fuzzer.cpp",
]
sources = [ "src/compiler/fuzz/translator_fuzzer.cpp" ]
include_dirs = [
"include",
"src",
]
deps = [
":translator",
]
deps = [ ":translator" ]
}
config("commit_id_config") {
......@@ -492,14 +470,10 @@ commit_id_output_file = "$root_gen_dir/angle/id/commit.h"
if (angle_use_commit_id) {
action("commit_id") {
script = "src/commit_id.py"
outputs = [
commit_id_output_file,
]
outputs = [ commit_id_output_file ]
# commit id should depend on angle's HEAD revision
inputs = [
".git/HEAD",
]
inputs = [ ".git/HEAD" ]
args = [
"gen",
......@@ -511,23 +485,15 @@ if (angle_use_commit_id) {
}
} else {
copy("commit_id") {
sources = [
"src/commit.h",
]
outputs = [
commit_id_output_file,
]
sources = [ "src/commit.h" ]
outputs = [ commit_id_output_file ]
public_configs = [ ":commit_id_config" ]
}
}
angle_source_set("angle_version") {
sources = [
"src/common/version.h",
]
public_deps = [
":commit_id",
]
sources = [ "src/common/version.h" ]
public_deps = [ ":commit_id" ]
}
config("angle_backend_config") {
......@@ -571,7 +537,8 @@ config("libANGLE_config") {
defines += [ "LIBANGLE_IMPLEMENTATION" ]
if (is_win) {
cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics are not enabled.
cflags += [ "/wd4530" ] # C++ exception handler used, but unwind semantics
# are not enabled.
}
if (is_android && (angle_enable_gl || angle_enable_vulkan)) {
......@@ -723,12 +690,14 @@ angle_source_set("libANGLE_base") {
sources += libangle_gl_egl_dl_sources
sources += libangle_gl_egl_android_sources
}
if (is_linux) {
sources += libangle_gl_egl_sources
sources += libangle_gl_egl_dl_sources
}
if (ozone_platform_gbm) {
configs += [ ":libdrm" ]
defines += [ "ANGLE_USE_OZONE" ]
deps += [ "//third_party/minigbm" ]
sources += libangle_gl_egl_sources
sources += libangle_gl_egl_dl_sources
sources += libangle_gl_ozone_sources
}
}
......@@ -754,9 +723,7 @@ angle_source_set("libANGLE_base") {
# Windows ARM64 is available since 10.0.16299 so no need to copy
# d3dcompiler_47.dll because this file is available as inbox.
if (_use_copy_compiler_dll) {
data_deps = [
":copy_compiler_dll",
]
data_deps = [ ":copy_compiler_dll" ]
}
}
......@@ -769,13 +736,9 @@ config("angle_frame_capture_enabled") {
}
angle_source_set("libANGLE") {
public_deps = [
":libANGLE_base",
]
public_deps = [ ":libANGLE_base" ]
public_configs = [ ":angle_frame_capture_disabled" ]
sources = [
"src/libANGLE/FrameCapture_mock.cpp",
]
sources = [ "src/libANGLE/FrameCapture_mock.cpp" ]
# gl_enum_utils defaults included in with_capture build
deps = []
......@@ -785,9 +748,7 @@ angle_source_set("libANGLE") {
}
angle_source_set("angle_gl_enum_utils") {
public_deps = [
":libANGLE_base",
]
public_deps = [ ":libANGLE_base" ]
sources = [
"src/libANGLE/gl_enum_utils.cpp",
"src/libANGLE/gl_enum_utils_autogen.cpp",
......@@ -795,9 +756,7 @@ angle_source_set("angle_gl_enum_utils") {
}
angle_source_set("libANGLE_with_capture") {
public_deps = [
":libANGLE_base",
]
public_deps = [ ":libANGLE_base" ]
public_configs = [ ":angle_frame_capture_enabled" ]
sources = libangle_capture_sources
}
......@@ -866,35 +825,25 @@ template("angle_libGLESv2") {
deps = invoker.deps + [ ":includes" ]
public_deps = [
":angle_version",
]
public_deps = [ ":angle_version" ]
}
}
angle_libGLESv2("libGLESv2") {
if (angle_with_capture_by_default) {
deps = [
":libANGLE_with_capture",
]
deps = [ ":libANGLE_with_capture" ]
} else {
deps = [
":libANGLE",
]
deps = [ ":libANGLE" ]
}
}
# Output capture lib when `angle_with_capture_by_default` disabled, vice versa.
angle_libGLESv2("libGLESv2_capture_complement") {
if (angle_with_capture_by_default) {
deps = [
":libANGLE",
]
deps = [ ":libANGLE" ]
output_name += "_no_capture"
} else {
deps = [
":libANGLE_with_capture",
]
deps = [ ":libANGLE_with_capture" ]
output_name += "_with_capture"
}
}
......@@ -922,9 +871,7 @@ if (is_win && !angle_is_winuwp) {
":libANGLE",
]
public_deps = [
":angle_version",
]
public_deps = [ ":angle_version" ]
}
}
......@@ -932,12 +879,8 @@ angle_static_library("libGLESv2_static") {
sources = libglesv2_sources
configs += [ ":debug_annotations_config" ]
public_configs += [ ":angle_static" ]
deps = [
":includes",
]
public_deps = [
":libANGLE",
]
deps = [ ":includes" ]
public_deps = [ ":libANGLE" ]
}
angle_shared_library("libGLESv1_CM") {
......@@ -983,9 +926,7 @@ angle_source_set("libEGL_egl_loader") {
":gl_prototypes",
]
deps = [
":includes",
]
deps = [ ":includes" ]
}
angle_shared_library("libEGL") {
......@@ -1015,13 +956,9 @@ angle_shared_library("libEGL") {
":libEGL_egl_loader",
]
public_deps = [
":includes",
]
public_deps = [ ":includes" ]
data_deps = [
":libGLESv2",
]
data_deps = [ ":libGLESv2" ]
}
angle_static_library("libEGL_static") {
......@@ -1045,13 +982,9 @@ angle_static_library("libEGL_static") {
angle_executable("angle_shader_translator") {
testonly = true
sources = [
"samples/shader_translator/shader_translator.cpp",
]
sources = [ "samples/shader_translator/shader_translator.cpp" ]
deps = [
":translator",
]
deps = [ ":translator" ]
}
if (angle_has_build) {
......@@ -1125,9 +1058,7 @@ if (!is_component_build && is_android && symbol_level != 0) {
}
}
outputs = [
"$root_out_dir/lib.compressed/{{source_file_part}}",
]
outputs = [ "$root_out_dir/lib.compressed/{{source_file_part}}" ]
android_nm = "${android_tool_prefix}nm"
android_strip = "${android_tool_prefix}strip"
......@@ -1156,16 +1087,14 @@ if (build_with_chromium && !is_component_build && is_android &&
}
group("angle_apks") {
deps = [
":angle_chromium_apk",
]
deps = [ ":angle_chromium_apk" ]
}
}
group("angle") {
data_deps = [
":libEGL",
":libGLESv1_CM",
":libGLESv2",
":libEGL",
]
}
......@@ -9,6 +9,10 @@
#ifndef LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_
#define LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_
#include <map>
#include <string>
#include <vector>
#include "libANGLE/renderer/gl/DisplayGL.h"
#include "libANGLE/renderer/gl/egl/FunctionsEGL.h"
#include "libANGLE/renderer/gl/egl/egl_utils.h"
......@@ -16,6 +20,7 @@
namespace rx
{
class RendererEGL;
class WorkerContext;
class DisplayEGL : public DisplayGL
......@@ -35,12 +40,43 @@ class DisplayEGL : public DisplayGL
void setBlobCacheFuncs(EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get) override;
virtual void destroyNativeContext(EGLContext context) = 0;
virtual void destroyNativeContext(EGLContext context);
virtual WorkerContext *createWorkerContext(std::string *infoLog,
EGLContext sharedContext,
const native_egl::AttributeVector workerAttribs) = 0;
SurfaceImpl *createWindowSurface(const egl::SurfaceState &state,
EGLNativeWindowType window,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs) override;
egl::ConfigSet generateConfigs() override;
bool testDeviceLost() override;
egl::Error restoreLostDevice(const egl::Display *display) override;
bool isValidNativeWindow(EGLNativeWindowType window) const override;
DeviceImpl *createDevice() override;
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
gl::Version getMaxSupportedESVersion() const override;
void initializeFrontendFeatures(angle::FrontendFeatures *features) const override;
void populateFeatureList(angle::FeatureList *features) override;
protected:
egl::Error initializeContext(EGLContext shareContext,
const egl::AttributeMap &eglAttributes,
......@@ -49,13 +85,30 @@ class DisplayEGL : public DisplayGL
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
egl::Error makeCurrentSurfaceless(gl::Context *context) override;
template <typename T>
void getConfigAttrib(EGLConfig config, EGLint attribute, T *value) const;
template <typename T, typename U>
void getConfigAttribIfExtension(EGLConfig config,
EGLint attribute,
T *value,
const char *extension,
const U &defaultValue) const;
std::shared_ptr<RendererEGL> mRenderer;
FunctionsEGL *mEGL;
EGLConfig mConfig;
egl::AttributeMap mDisplayAttributes;
std::vector<EGLint> mConfigAttribList;
private:
void generateCaps(egl::Caps *outCaps) const override;
std::map<EGLint, EGLint> mConfigIds;
};
} // namespace rx
#endif /* LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_ */
#endif // LIBANGLE_RENDERER_GL_EGL_DISPLAYEGL_H_
......@@ -30,30 +30,12 @@ class DisplayAndroid : public DisplayEGL
egl::Error initialize(egl::Display *display) override;
void terminate() override;
SurfaceImpl *createWindowSurface(const egl::SurfaceState &state,
EGLNativeWindowType window,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs) override;
ContextImpl *createContext(const gl::State &state,
gl::ErrorSet *errorSet,
const egl::Config *configuration,
const gl::Context *shareContext,
const egl::AttributeMap &attribs) override;
egl::ConfigSet generateConfigs() override;
bool testDeviceLost() override;
egl::Error restoreLostDevice(const egl::Display *display) override;
bool isValidNativeWindow(EGLNativeWindowType window) const override;
egl::Error validateImageClientBuffer(const gl::Context *context,
EGLenum target,
......@@ -65,27 +47,16 @@ class DisplayAndroid : public DisplayEGL
EGLClientBuffer buffer,
const egl::AttributeMap &attribs) override;
DeviceImpl *createDevice() override;
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
egl::Error makeCurrent(egl::Surface *drawSurface,
egl::Surface *readSurface,
gl::Context *context) override;
gl::Version getMaxSupportedESVersion() const override;
void destroyNativeContext(EGLContext context) override;
WorkerContext *createWorkerContext(std::string *infoLog,
EGLContext sharedContext,
const native_egl::AttributeVector workerAttribs) override;
void initializeFrontendFeatures(angle::FrontendFeatures *features) const override;
void populateFeatureList(angle::FeatureList *features) override;
private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
......@@ -93,27 +64,10 @@ class DisplayAndroid : public DisplayEGL
bool makeNewContextCurrent,
std::shared_ptr<RendererEGL> *outRenderer);
egl::Error makeCurrentSurfaceless(gl::Context *context) override;
template <typename T>
void getConfigAttrib(EGLConfig config, EGLint attribute, T *value) const;
template <typename T, typename U>
void getConfigAttribIfExtension(EGLConfig config,
EGLint attribute,
T *value,
const char *extension,
const U &defaultValue) const;
bool mVirtualizedContexts;
std::shared_ptr<RendererEGL> mRenderer;
egl::AttributeMap mDisplayAttributes;
bool mSupportsSurfaceless;
std::vector<EGLint> mConfigAttribList;
std::map<EGLint, EGLint> mConfigIds;
EGLSurface mDummyPbuffer;
struct CurrentNativeContext
......
......@@ -351,7 +351,6 @@ bool DisplayOzone::Buffer::createRenderbuffers()
DisplayOzone::DisplayOzone(const egl::DisplayState &state)
: DisplayEGL(state),
mRenderer(nullptr),
mGBM(nullptr),
mConnector(nullptr),
mMode(nullptr),
......@@ -911,23 +910,6 @@ SurfaceImpl *DisplayOzone::createPbufferSurface(const egl::SurfaceState &state,
return new SurfaceOzone(state, buffer);
}
SurfaceImpl *DisplayOzone::createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
SurfaceImpl *DisplayOzone::createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
ContextImpl *DisplayOzone::createContext(const gl::State &state,
gl::ErrorSet *errorSet,
const egl::Config *configuration,
......@@ -938,12 +920,6 @@ ContextImpl *DisplayOzone::createContext(const gl::State &state,
return new ContextEGL(state, errorSet, mRenderer);
}
DeviceImpl *DisplayOzone::createDevice()
{
UNIMPLEMENTED();
return nullptr;
}
egl::ConfigSet DisplayOzone::generateConfigs()
{
egl::ConfigSet configs;
......@@ -965,44 +941,11 @@ egl::ConfigSet DisplayOzone::generateConfigs()
return configs;
}
bool DisplayOzone::testDeviceLost()
{
return false;
}
egl::Error DisplayOzone::restoreLostDevice(const egl::Display *display)
{
UNIMPLEMENTED();
return egl::EglBadDisplay();
}
bool DisplayOzone::isValidNativeWindow(EGLNativeWindowType window) const
{
return true;
}
egl::Error DisplayOzone::waitClient(const gl::Context *context)
{
// TODO(fjhenigman) Implement this.
return egl::NoError();
}
egl::Error DisplayOzone::waitNative(const gl::Context *context, EGLint engine)
{
// TODO(fjhenigman) Implement this.
return egl::NoError();
}
gl::Version DisplayOzone::getMaxSupportedESVersion() const
{
return mRenderer->getMaxSupportedESVersion();
}
void DisplayOzone::destroyNativeContext(EGLContext context)
{
mEGL->destroyContext(context);
}
void DisplayOzone::setSwapInterval(EGLSurface drawable, SwapControlData *data)
{
ASSERT(data != nullptr);
......@@ -1016,12 +959,6 @@ void DisplayOzone::generateExtensions(egl::DisplayExtensions *outExtensions) con
DisplayEGL::generateExtensions(outExtensions);
}
egl::Error DisplayOzone::makeCurrentSurfaceless(gl::Context *context)
{
// Nothing to do, handled in the GL layers
return egl::NoError();
}
class WorkerContextOzone final : public WorkerContext
{
public:
......@@ -1073,14 +1010,4 @@ WorkerContext *DisplayOzone::createWorkerContext(std::string *infoLog,
return new WorkerContextOzone(context, mEGL);
}
void DisplayOzone::initializeFrontendFeatures(angle::FrontendFeatures *features) const
{
mRenderer->initializeFrontendFeatures(features);
}
void DisplayOzone::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getFeatures().populateFeatureList(features);
}
} // namespace rx
......@@ -120,13 +120,6 @@ class DisplayOzone final : public DisplayEGL
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
NativePixmapType nativePixmap,
const egl::AttributeMap &attribs) override;
ContextImpl *createContext(const gl::State &state,
gl::ErrorSet *errorSet,
......@@ -136,20 +129,8 @@ class DisplayOzone final : public DisplayEGL
egl::ConfigSet generateConfigs() override;
bool testDeviceLost() override;
egl::Error restoreLostDevice(const egl::Display *display) override;
bool isValidNativeWindow(EGLNativeWindowType window) const override;
DeviceImpl *createDevice() override;
egl::Error waitClient(const gl::Context *context) override;
egl::Error waitNative(const gl::Context *context, EGLint engine) override;
gl::Version getMaxSupportedESVersion() const override;
void destroyNativeContext(EGLContext context) override;
// TODO(fjhenigman) Implement this.
// Swap interval can be set globally or per drawable.
// This function will make sure the drawable's swap interval is the
......@@ -160,15 +141,9 @@ class DisplayOzone final : public DisplayEGL
EGLContext sharedContext,
const native_egl::AttributeVector workerAttribs) override;
void initializeFrontendFeatures(angle::FrontendFeatures *features) const override;
void populateFeatureList(angle::FeatureList *features) override;
private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
egl::Error makeCurrentSurfaceless(gl::Context *context) override;
GLuint makeShader(GLuint type, const char *src);
void drawBuffer(const gl::Context *context, Buffer *buffer);
void drawWithTexture(const gl::Context *context, Buffer *buffer);
......@@ -182,8 +157,6 @@ class DisplayOzone final : public DisplayEGL
void *data);
void pageFlipHandler(unsigned int sequence, uint64_t tv);
std::shared_ptr<RendererEGL> mRenderer;
gbm_device *mGBM;
drmModeConnectorPtr mConnector;
drmModeModeInfoPtr mMode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment