Reland "Remove GLX usage from Chrome."
This is a reland of commit 4ffecda482581167c156211ae4a774345a907466
Original change's description:
> Remove GLX usage from Chrome.
>
> Remaining references are in VisualPickerGlx which selects visuals for
> Chrome windows that can support GL. This must remain in Chrome for now
> because visual selection must happen before ANGLE is initialized.
>
> If VisualPickerGlx is removed, we can also remove generation of the glx
> protocols in ui/gl/x.
>
> Bug: chromium:1158195
> Change-Id: I63fe224ca7d98780686dbb0b763ae319c2ca7432
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4055451
> Reviewed-by: Kenneth Russell <kbr@chromium.org>
> Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
> Reviewed-by: Andres Calderon Jaramillo <andrescj@chromium.org>
> Commit-Queue: Geoff Lang <geofflang@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1078574}
Bug: chromium:1158195
Change-Id: I2de4965bd8ebd40bf2b7add9550bc1c81f6fc772
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4079269
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Kenneth Russell <kbr@chromium.org>
Reviewed-by: Andres Calderon Jaramillo <andrescj@chromium.org>
Auto-Submit: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1081698}
diff --git a/media/gpu/vaapi/BUILD.gn b/media/gpu/vaapi/BUILD.gn
index ca9bf5c3..d549e9a 100644
--- a/media/gpu/vaapi/BUILD.gn
+++ b/media/gpu/vaapi/BUILD.gn
@@ -143,8 +143,6 @@
sources += [
"vaapi_picture_native_pixmap_angle.cc",
"vaapi_picture_native_pixmap_angle.h",
- "vaapi_picture_tfp.cc",
- "vaapi_picture_tfp.h",
]
}
@@ -408,7 +406,6 @@
]
}
-
deps = [
":libva_stubs",
"//base",
diff --git a/media/gpu/vaapi/vaapi_picture_factory.cc b/media/gpu/vaapi/vaapi_picture_factory.cc
index 7f44de0..5dadd7c 100644
--- a/media/gpu/vaapi/vaapi_picture_factory.cc
+++ b/media/gpu/vaapi/vaapi_picture_factory.cc
@@ -15,7 +15,6 @@
#endif // BUILDFLAG(IS_OZONE)
#if BUILDFLAG(USE_VAAPI_X11)
#include "media/gpu/vaapi/vaapi_picture_native_pixmap_angle.h"
-#include "media/gpu/vaapi/vaapi_picture_tfp.h"
#endif // BUILDFLAG(USE_VAAPI_X11)
#if defined(USE_EGL)
#include "media/gpu/vaapi/vaapi_picture_native_pixmap_egl.h"
@@ -50,9 +49,6 @@
vaapi_impl_pairs_.insert(
std::make_pair(gl::kGLImplementationEGLANGLE,
VaapiPictureFactory::kVaapiImplementationAngle));
- vaapi_impl_pairs_.insert(
- std::make_pair(gl::kGLImplementationDesktopGL,
- VaapiPictureFactory::kVaapiImplementationX11));
#elif BUILDFLAG(IS_OZONE)
vaapi_impl_pairs_.insert(
std::make_pair(gl::kGLImplementationEGLANGLE,
@@ -84,7 +80,6 @@
? picture_buffer.service_texture_ids()[0]
: 0;
- // Select DRM(egl) / TFP(glx) at runtime with --use-gl=egl / --use-gl=desktop
return CreateVaapiPictureNative(vaapi_wrapper, make_context_current_cb,
bind_image_cb, picture_buffer, visible_size,
client_texture_id, service_texture_id);
@@ -124,12 +119,6 @@
break;
#endif // BUILDFLAG(IS_OZONE)
#if BUILDFLAG(USE_VAAPI_X11)
- case kVaapiImplementationX11:
- create_picture_cb_ =
- base::BindRepeating(&CreateVaapiPictureNativeImpl<VaapiTFPPicture>);
- // Neither VaapiTFPPicture or VaapiPictureNativePixmapAngle needs the VPP.
- needs_vpp_for_downloading_ = false;
- break;
case kVaapiImplementationAngle:
create_picture_cb_ = base::BindRepeating(
&CreateVaapiPictureNativeImpl<VaapiPictureNativePixmapAngle>);
diff --git a/media/gpu/vaapi/vaapi_picture_factory.h b/media/gpu/vaapi/vaapi_picture_factory.h
index 410541e..213c030 100644
--- a/media/gpu/vaapi/vaapi_picture_factory.h
+++ b/media/gpu/vaapi/vaapi_picture_factory.h
@@ -32,7 +32,6 @@
enum VaapiImplementation {
kVaapiImplementationNone = 0,
kVaapiImplementationDrm,
- kVaapiImplementationX11,
kVaapiImplementationAngle,
};
diff --git a/media/gpu/vaapi/vaapi_picture_tfp.cc b/media/gpu/vaapi/vaapi_picture_tfp.cc
deleted file mode 100644
index 87c9b91..0000000
--- a/media/gpu/vaapi/vaapi_picture_tfp.cc
+++ /dev/null
@@ -1,133 +0,0 @@
-// Copyright 2014 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "media/gpu/vaapi/vaapi_picture_tfp.h"
-
-#include "media/gpu/vaapi/va_surface.h"
-#include "media/gpu/vaapi/vaapi_status.h"
-#include "media/gpu/vaapi/vaapi_wrapper.h"
-#include "ui/gfx/x/connection.h"
-#include "ui/gfx/x/future.h"
-#include "ui/gl/gl_bindings.h"
-#include "ui/gl/gl_image_glx.h"
-#include "ui/gl/scoped_binders.h"
-
-namespace media {
-
-VaapiTFPPicture::VaapiTFPPicture(
- scoped_refptr<VaapiWrapper> vaapi_wrapper,
- const MakeGLContextCurrentCallback& make_context_current_cb,
- const BindGLImageCallback& bind_image_cb,
- int32_t picture_buffer_id,
- const gfx::Size& size,
- const gfx::Size& visible_size,
- uint32_t texture_id,
- uint32_t client_texture_id,
- uint32_t texture_target)
- : VaapiPicture(std::move(vaapi_wrapper),
- make_context_current_cb,
- bind_image_cb,
- picture_buffer_id,
- size,
- visible_size,
- texture_id,
- client_texture_id,
- texture_target),
- connection_(x11::Connection::Get()),
- x_pixmap_(x11::Pixmap::None) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- DCHECK(texture_id);
- DCHECK(client_texture_id);
-}
-
-VaapiTFPPicture::~VaapiTFPPicture() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (glx_image_.get() && make_context_current_cb_.Run()) {
- glx_image_->ReleaseTexImage(texture_target_);
- DCHECK_EQ(glGetError(), static_cast<GLenum>(GL_NO_ERROR));
- }
-
- if (x_pixmap_ != x11::Pixmap::None)
- connection_->FreePixmap({x_pixmap_});
-}
-
-VaapiStatus VaapiTFPPicture::Initialize() {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- DCHECK_NE(x_pixmap_, x11::Pixmap::None);
-
- if (make_context_current_cb_ && !make_context_current_cb_.Run())
- return VaapiStatus::Codes::kBadContext;
-
- glx_image_ = new gl::GLImageGLX(size_, gfx::BufferFormat::BGRX_8888);
- if (!glx_image_->Initialize(x_pixmap_)) {
- // x_pixmap_ will be freed in the destructor.
- DLOG(ERROR) << "Failed creating a GLX Pixmap for TFP";
- return VaapiStatus::Codes::kFailedToInitializeImage;
- }
-
- gl::ScopedTextureBinder texture_binder(texture_target_, texture_id_);
- if (!glx_image_->BindTexImage(texture_target_)) {
- DLOG(ERROR) << "Failed to bind texture to glx image";
- return VaapiStatus::Codes::kFailedToBindTexture;
- }
-
- return VaapiStatus::Codes::kOk;
-}
-
-VaapiStatus VaapiTFPPicture::Allocate(gfx::BufferFormat format) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- if (format != gfx::BufferFormat::BGRX_8888 &&
- format != gfx::BufferFormat::BGRA_8888 &&
- format != gfx::BufferFormat::RGBX_8888) {
- DLOG(ERROR) << "Unsupported format";
- return VaapiStatus::Codes::kUnsupportedFormat;
- }
-
- if (!connection_->Ready())
- return VaapiStatus::Codes::kNoPixmap;
-
- auto root = connection_->default_root();
-
- uint8_t depth = 0;
- if (auto reply = connection_->GetGeometry(root).Sync())
- depth = reply->depth;
- else
- return VaapiStatus::Codes::kNoPixmap;
-
- // TODO(posciak): pass the depth required by libva, not the RootWindow's
- // depth
- auto pixmap = connection_->GenerateId<x11::Pixmap>();
- uint16_t pixmap_width, pixmap_height;
- if (!base::CheckedNumeric<int>(size_.width()).AssignIfValid(&pixmap_width) ||
- !base::CheckedNumeric<int>(size_.height())
- .AssignIfValid(&pixmap_height)) {
- return VaapiStatus::Codes::kNoPixmap;
- }
- auto req = connection_->CreatePixmap(
- {depth, pixmap, root, pixmap_width, pixmap_height});
- if (req.Sync().error) {
- DLOG(ERROR) << "Failed creating an X Pixmap for TFP";
- return VaapiStatus::Codes::kNoPixmap;
- } else {
- x_pixmap_ = pixmap;
- }
-
- return Initialize();
-}
-
-bool VaapiTFPPicture::ImportGpuMemoryBufferHandle(
- gfx::BufferFormat format,
- gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- NOTIMPLEMENTED() << "GpuMemoryBufferHandle import not implemented";
- return false;
-}
-
-bool VaapiTFPPicture::DownloadFromSurface(scoped_refptr<VASurface> va_surface) {
- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- return vaapi_wrapper_->PutSurfaceIntoPixmap(va_surface->id(), x_pixmap_,
- va_surface->size());
-}
-
-} // namespace media
diff --git a/media/gpu/vaapi/vaapi_picture_tfp.h b/media/gpu/vaapi/vaapi_picture_tfp.h
deleted file mode 100644
index f4884587..0000000
--- a/media/gpu/vaapi/vaapi_picture_tfp.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2014 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MEDIA_GPU_VAAPI_VAAPI_PICTURE_TFP_H_
-#define MEDIA_GPU_VAAPI_VAAPI_PICTURE_TFP_H_
-
-#include <stdint.h>
-
-#include "base/memory/raw_ptr.h"
-#include "base/memory/scoped_refptr.h"
-#include "media/gpu/vaapi/vaapi_picture.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/x/connection.h"
-#include "ui/gl/gl_bindings.h"
-
-namespace gl {
-class GLImageGLX;
-}
-
-namespace media {
-
-class VaapiWrapper;
-
-// Implementation of VaapiPicture for the X11 backends with Texture-From-Pixmap
-// extension.
-class VaapiTFPPicture : public VaapiPicture {
- public:
- VaapiTFPPicture(scoped_refptr<VaapiWrapper> vaapi_wrapper,
- const MakeGLContextCurrentCallback& make_context_current_cb,
- const BindGLImageCallback& bind_image_cb,
- int32_t picture_buffer_id,
- const gfx::Size& size,
- const gfx::Size& visible_size,
- uint32_t texture_id,
- uint32_t client_texture_id,
- uint32_t texture_target);
-
- VaapiTFPPicture(const VaapiTFPPicture&) = delete;
- VaapiTFPPicture& operator=(const VaapiTFPPicture&) = delete;
-
- ~VaapiTFPPicture() override;
-
- // VaapiPicture implementation.
- VaapiStatus Allocate(gfx::BufferFormat format) override;
- bool ImportGpuMemoryBufferHandle(
- gfx::BufferFormat format,
- gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) override;
- bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) override;
-
- private:
- VaapiStatus Initialize();
-
- const raw_ptr<x11::Connection> connection_;
-
- x11::Pixmap x_pixmap_;
- scoped_refptr<gl::GLImageGLX> glx_image_;
-};
-
-} // namespace media
-
-#endif // MEDIA_GPU_VAAPI_VAAPI_PICTURE_TFP_H_
diff --git a/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc b/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc
index f5bae85..976daf1 100644
--- a/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc
+++ b/media/gpu/vaapi/vaapi_video_decode_accelerator_unittest.cc
@@ -414,7 +414,6 @@
base::WeakPtrFactory<VaapiVideoDecodeAcceleratorTest> weak_ptr_factory_;
};
-// Verify that it is possible to select DRM(egl) and TFP(glx) at runtime.
TEST_P(VaapiVideoDecodeAcceleratorTest, SupportedPlatforms) {
EXPECT_EQ(VaapiPictureFactory::kVaapiImplementationNone,
mock_vaapi_picture_factory_->GetVaapiImplementation(
@@ -427,9 +426,6 @@
EXPECT_EQ(VaapiPictureFactory::kVaapiImplementationAngle,
mock_vaapi_picture_factory_->GetVaapiImplementation(
gl::kGLImplementationEGLANGLE));
- EXPECT_EQ(VaapiPictureFactory::kVaapiImplementationX11,
- mock_vaapi_picture_factory_->GetVaapiImplementation(
- gl::kGLImplementationDesktopGL));
#elif BUILDFLAG(IS_OZONE)
EXPECT_EQ(VaapiPictureFactory::kVaapiImplementationDrm,
mock_vaapi_picture_factory_->GetVaapiImplementation(
diff --git a/media/gpu/vaapi/vaapi_wrapper.cc b/media/gpu/vaapi/vaapi_wrapper.cc
index e33383d..77e0216 100644
--- a/media/gpu/vaapi/vaapi_wrapper.cc
+++ b/media/gpu/vaapi/vaapi_wrapper.cc
@@ -790,9 +790,7 @@
case gl::kGLImplementationEGLGLES2:
return vaGetDisplayDRM(drm_fd.get());
- case gl::kGLImplementationNone:
-
- case gl::kGLImplementationDesktopGL: {
+ case gl::kGLImplementationNone: {
VADisplay display =
vaGetDisplay(x11::Connection::Get()->GetXlibDisplay());
if (vaDisplayIsValid(display))
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn
index 7f06e99..07a20288 100644
--- a/ui/gl/BUILD.gn
+++ b/ui/gl/BUILD.gn
@@ -21,8 +21,6 @@
enable_gpu_service_logging = false
}
-use_glx = ozone_platform_x11
-
if (is_android) {
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
@@ -41,12 +39,6 @@
config("gl_config") {
defines = []
- if (use_glx) {
- defines += [
- "GL_GLEXT_PROTOTYPES",
- "USE_GLX",
- ]
- }
if (use_egl) {
defines += [ "USE_EGL" ]
}
@@ -282,8 +274,6 @@
"gl_surface_egl_x11.h",
"gl_surface_egl_x11_gles2.cc",
"gl_surface_egl_x11_gles2.h",
- "gl_surface_glx_x11.cc",
- "gl_surface_glx_x11.h",
]
deps += [
@@ -302,29 +292,6 @@
data_deps += [ "//third_party/vulkan-deps/vulkan-loader/src:libvulkan" ]
}
}
- if (use_glx) {
- sources += [
- "gl_bindings_autogen_glx.cc",
- "gl_bindings_autogen_glx.h",
- "gl_context_glx.cc",
- "gl_context_glx.h",
- "gl_glx_api_implementation.cc",
- "gl_glx_api_implementation.h",
- "gl_image_glx.cc",
- "gl_image_glx.h",
- "gl_image_glx_native_pixmap.cc",
- "gl_image_glx_native_pixmap.h",
- "gl_surface_glx.cc",
- "gl_surface_glx.h",
- "glx_util.cc",
- "glx_util.h",
- ]
-
- deps += [
- "//ui/base/x",
- "//ui/gfx/x",
- ]
- }
if (is_win) {
sources += [
@@ -593,10 +560,6 @@
]
}
- if (use_glx) {
- sources += [ "glx_api_unittest.cc" ]
- }
-
if (is_win) {
sources += [
"dcomp_presenter_unittest.cc",
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py
index 55a5971e..ddad77b 100755
--- a/ui/gl/generate_bindings.py
+++ b/ui/gl/generate_bindings.py
@@ -2881,169 +2881,6 @@
'EGL_NOK_texture_from_pixmap',
]
-GLX_FUNCTIONS = [
-{ 'return_type': 'void',
- 'names': ['glXBindTexImageEXT'],
- 'arguments':
- 'Display* dpy, GLXDrawable drawable, int buffer, int* attribList', },
-{ 'return_type': 'GLXFBConfig*',
- 'names': ['glXChooseFBConfig'],
- 'arguments':
- 'Display* dpy, int screen, const int* attribList, int* nitems', },
-{ 'return_type': 'XVisualInfo*',
- 'names': ['glXChooseVisual'],
- 'arguments': 'Display* dpy, int screen, int* attribList', },
-{ 'return_type': 'void',
- 'names': ['glXCopyContext'],
- 'arguments':
- 'Display* dpy, GLXContext src, GLXContext dst, unsigned long mask', },
-{ 'return_type': 'void',
- 'names': ['glXCopySubBufferMESA'],
- 'arguments': 'Display* dpy, GLXDrawable drawable, '
- 'int x, int y, int width, int height', },
-{ 'return_type': 'GLXContext',
- 'names': ['glXCreateContext'],
- 'arguments':
- 'Display* dpy, XVisualInfo* vis, GLXContext shareList, int direct', },
-{ 'return_type': 'GLXContext',
- 'names': ['glXCreateContextAttribsARB'],
- 'arguments':
- 'Display* dpy, GLXFBConfig config, GLXContext share_context, int direct, '
- 'const int* attrib_list', },
-{ 'return_type': 'GLXPixmap',
- 'names': ['glXCreateGLXPixmap'],
- 'arguments': 'Display* dpy, XVisualInfo* visual, Pixmap pixmap', },
-{ 'return_type': 'GLXContext',
- 'names': ['glXCreateNewContext'],
- 'arguments': 'Display* dpy, GLXFBConfig config, int renderType, '
- 'GLXContext shareList, int direct', },
-{ 'return_type': 'GLXPbuffer',
- 'names': ['glXCreatePbuffer'],
- 'arguments': 'Display* dpy, GLXFBConfig config, const int* attribList', },
-{ 'return_type': 'GLXPixmap',
- 'names': ['glXCreatePixmap'],
- 'arguments': 'Display* dpy, GLXFBConfig config, '
- 'Pixmap pixmap, const int* attribList', },
-{ 'return_type': 'GLXWindow',
- 'names': ['glXCreateWindow'],
- 'arguments':
- 'Display* dpy, GLXFBConfig config, Window win, const int* attribList', },
-{ 'return_type': 'void',
- 'names': ['glXDestroyContext'],
- 'arguments': 'Display* dpy, GLXContext ctx', },
-{ 'return_type': 'void',
- 'names': ['glXDestroyGLXPixmap'],
- 'arguments': 'Display* dpy, GLXPixmap pixmap', },
-{ 'return_type': 'void',
- 'names': ['glXDestroyPbuffer'],
- 'arguments': 'Display* dpy, GLXPbuffer pbuf', },
-{ 'return_type': 'void',
- 'names': ['glXDestroyPixmap'],
- 'arguments': 'Display* dpy, GLXPixmap pixmap', },
-{ 'return_type': 'void',
- 'names': ['glXDestroyWindow'],
- 'arguments': 'Display* dpy, GLXWindow window', },
-{ 'return_type': 'const char*',
- 'names': ['glXGetClientString'],
- 'arguments': 'Display* dpy, int name', },
-{ 'return_type': 'int',
- 'names': ['glXGetConfig'],
- 'arguments': 'Display* dpy, XVisualInfo* visual, int attrib, int* value', },
-{ 'return_type': 'GLXContext',
- 'names': ['glXGetCurrentContext'],
- 'arguments': 'void', },
-{ 'return_type': 'Display*',
- 'names': ['glXGetCurrentDisplay'],
- 'arguments': 'void', },
-{ 'return_type': 'GLXDrawable',
- 'names': ['glXGetCurrentDrawable'],
- 'arguments': 'void', },
-{ 'return_type': 'GLXDrawable',
- 'names': ['glXGetCurrentReadDrawable'],
- 'arguments': 'void', },
-{ 'return_type': 'int',
- 'names': ['glXGetFBConfigAttrib'],
- 'arguments': 'Display* dpy, GLXFBConfig config, int attribute, int* value', },
-{ 'return_type': 'GLXFBConfig',
- 'names': ['glXGetFBConfigFromVisualSGIX'],
- 'arguments': 'Display* dpy, XVisualInfo* visualInfo', },
-{ 'return_type': 'GLXFBConfig*',
- 'names': ['glXGetFBConfigs'],
- 'arguments': 'Display* dpy, int screen, int* nelements', },
-{ 'return_type': 'bool',
- 'names': ['glXGetMscRateOML'],
- 'arguments':
- 'Display* dpy, GLXDrawable drawable, int32_t* numerator, '
- 'int32_t* denominator' },
-{ 'return_type': 'void',
- 'names': ['glXGetSelectedEvent'],
- 'arguments': 'Display* dpy, GLXDrawable drawable, unsigned long* mask', },
-{ 'return_type': 'bool',
- 'names': ['glXGetSyncValuesOML'],
- 'arguments':
- 'Display* dpy, GLXDrawable drawable, int64_t* ust, int64_t* msc, '
- 'int64_t* sbc' },
-{ 'return_type': 'XVisualInfo*',
- 'names': ['glXGetVisualFromFBConfig'],
- 'arguments': 'Display* dpy, GLXFBConfig config', },
-{ 'return_type': 'int',
- 'names': ['glXIsDirect'],
- 'arguments': 'Display* dpy, GLXContext ctx', },
-{ 'return_type': 'int',
- 'names': ['glXMakeContextCurrent'],
- 'arguments':
- 'Display* dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx', },
-{ 'return_type': 'int',
- 'names': ['glXMakeCurrent'],
- 'arguments': 'Display* dpy, GLXDrawable drawable, GLXContext ctx', },
-{ 'return_type': 'int',
- 'names': ['glXQueryContext'],
- 'arguments': 'Display* dpy, GLXContext ctx, int attribute, int* value', },
-{ 'return_type': 'void',
- 'names': ['glXQueryDrawable'],
- 'arguments':
- 'Display* dpy, GLXDrawable draw, int attribute, unsigned int* value', },
-{ 'return_type': 'int',
- 'names': ['glXQueryExtension'],
- 'arguments': 'Display* dpy, int* errorb, int* event', },
-{ 'return_type': 'const char*',
- 'names': ['glXQueryExtensionsString'],
- 'arguments': 'Display* dpy, int screen', },
-{ 'return_type': 'const char*',
- 'names': ['glXQueryServerString'],
- 'arguments': 'Display* dpy, int screen, int name', },
-{ 'return_type': 'int',
- 'names': ['glXQueryVersion'],
- 'arguments': 'Display* dpy, int* maj, int* min', },
-{ 'return_type': 'void',
- 'names': ['glXReleaseTexImageEXT'],
- 'arguments': 'Display* dpy, GLXDrawable drawable, int buffer', },
-{ 'return_type': 'void',
- 'names': ['glXSelectEvent'],
- 'arguments': 'Display* dpy, GLXDrawable drawable, unsigned long mask', },
-{ 'return_type': 'void',
- 'names': ['glXSwapBuffers'],
- 'arguments': 'Display* dpy, GLXDrawable drawable', },
-{ 'return_type': 'void',
- 'names': ['glXSwapIntervalEXT'],
- 'arguments': 'Display* dpy, GLXDrawable drawable, int interval', },
-{ 'return_type': 'void',
- 'names': ['glXSwapIntervalMESA'],
- 'arguments': 'unsigned int interval', },
-{ 'return_type': 'void',
- 'names': ['glXUseXFont'],
- 'arguments': 'Font font, int first, int count, int list', },
-{ 'return_type': 'void',
- 'names': ['glXWaitGL'],
- 'arguments': 'void', },
-{ 'return_type': 'int',
- 'names': ['glXWaitVideoSyncSGI'],
- 'arguments': 'int divisor, int remainder, unsigned int* count', },
-{ 'return_type': 'void',
- 'names': ['glXWaitX'],
- 'arguments': 'void', },
-]
-
FUNCTION_SETS = [
[GL_FUNCTIONS, 'gl', [
'GL/gl.h',
@@ -3073,7 +2910,6 @@
'EGL_ANGLE_surface_d3d_texture_2d_share_handle',
],
],
- [GLX_FUNCTIONS, 'glx', ['GL/glx.h', 'noninclude/GL/glxext.h'], []],
]
GLES2_HEADERS_WITH_ENUMS = [
@@ -3911,7 +3747,7 @@
version_start = re.compile(
r'#ifndef GL_(ES_|)VERSION((?:_[0-9])+)$')
extension_start = re.compile(
- r'#ifndef ((?:GL|EGL|GLX)_[A-Z]+_[a-zA-Z]\w+)')
+ r'#ifndef ((?:GL|EGL)_[A-Z]+_[a-zA-Z]\w+)')
extension_function = re.compile(r'.+\s+([a-z]+\w+)\s*\(')
typedef = re.compile(r'typedef .*')
macro_start = re.compile(r'^#(if|ifdef|ifndef).*')
diff --git a/ui/gl/gl_bindings.h b/ui/gl/gl_bindings.h
index 5017d81..ff0374b 100644
--- a/ui/gl/gl_bindings.h
+++ b/ui/gl/gl_bindings.h
@@ -37,7 +37,7 @@
#include <GL/wglext.h>
#elif BUILDFLAG(IS_APPLE)
#include <OpenGL/OpenGL.h>
-#elif defined(USE_GLX)
+#elif BUILDFLAG(IS_LINUX)
using Display = struct _XDisplay;
using Bool = int;
using Status = int;
@@ -46,18 +46,6 @@
using Font = XID;
using Pixmap = XID;
using Window = XID;
-using GLXPixmap = XID;
-using GLXWindow = XID;
-using GLXDrawable = XID;
-using GLXPbuffer = XID;
-using GLXContextID = XID;
-using GLXContext = struct __GLXcontextRec*;
-using GLXFBConfig = struct __GLXFBConfigRec*;
-struct XVisualInfo;
-
-
-#include <GL/glxext.h>
-#include <GL/glxtokens.h>
#endif
// GLES2 defines not part of Desktop GL
diff --git a/ui/gl/gl_bindings_api_autogen_glx.h b/ui/gl/gl_bindings_api_autogen_glx.h
deleted file mode 100644
index 1705662..0000000
--- a/ui/gl/gl_bindings_api_autogen_glx.h
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2016 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file is auto-generated from
-// ui/gl/generate_bindings.py
-// It's formatted by clang-format using chromium coding style:
-// clang-format -i -style=chromium filename
-// DO NOT EDIT!
-
-// Silence presubmit and Tricium warnings about include guards
-// no-include-guard-because-multiply-included
-// NOLINT(build/header_guard)
-
-void glXBindTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer,
- int* attribList) override;
-GLXFBConfig* glXChooseFBConfigFn(Display* dpy,
- int screen,
- const int* attribList,
- int* nitems) override;
-XVisualInfo* glXChooseVisualFn(Display* dpy,
- int screen,
- int* attribList) override;
-void glXCopyContextFn(Display* dpy,
- GLXContext src,
- GLXContext dst,
- unsigned long mask) override;
-void glXCopySubBufferMESAFn(Display* dpy,
- GLXDrawable drawable,
- int x,
- int y,
- int width,
- int height) override;
-GLXContext glXCreateContextFn(Display* dpy,
- XVisualInfo* vis,
- GLXContext shareList,
- int direct) override;
-GLXContext glXCreateContextAttribsARBFn(Display* dpy,
- GLXFBConfig config,
- GLXContext share_context,
- int direct,
- const int* attrib_list) override;
-GLXPixmap glXCreateGLXPixmapFn(Display* dpy,
- XVisualInfo* visual,
- Pixmap pixmap) override;
-GLXContext glXCreateNewContextFn(Display* dpy,
- GLXFBConfig config,
- int renderType,
- GLXContext shareList,
- int direct) override;
-GLXPbuffer glXCreatePbufferFn(Display* dpy,
- GLXFBConfig config,
- const int* attribList) override;
-GLXPixmap glXCreatePixmapFn(Display* dpy,
- GLXFBConfig config,
- Pixmap pixmap,
- const int* attribList) override;
-GLXWindow glXCreateWindowFn(Display* dpy,
- GLXFBConfig config,
- Window win,
- const int* attribList) override;
-void glXDestroyContextFn(Display* dpy, GLXContext ctx) override;
-void glXDestroyGLXPixmapFn(Display* dpy, GLXPixmap pixmap) override;
-void glXDestroyPbufferFn(Display* dpy, GLXPbuffer pbuf) override;
-void glXDestroyPixmapFn(Display* dpy, GLXPixmap pixmap) override;
-void glXDestroyWindowFn(Display* dpy, GLXWindow window) override;
-const char* glXGetClientStringFn(Display* dpy, int name) override;
-int glXGetConfigFn(Display* dpy,
- XVisualInfo* visual,
- int attrib,
- int* value) override;
-GLXContext glXGetCurrentContextFn(void) override;
-Display* glXGetCurrentDisplayFn(void) override;
-GLXDrawable glXGetCurrentDrawableFn(void) override;
-GLXDrawable glXGetCurrentReadDrawableFn(void) override;
-int glXGetFBConfigAttribFn(Display* dpy,
- GLXFBConfig config,
- int attribute,
- int* value) override;
-GLXFBConfig glXGetFBConfigFromVisualSGIXFn(Display* dpy,
- XVisualInfo* visualInfo) override;
-GLXFBConfig* glXGetFBConfigsFn(Display* dpy,
- int screen,
- int* nelements) override;
-bool glXGetMscRateOMLFn(Display* dpy,
- GLXDrawable drawable,
- int32_t* numerator,
- int32_t* denominator) override;
-void glXGetSelectedEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long* mask) override;
-bool glXGetSyncValuesOMLFn(Display* dpy,
- GLXDrawable drawable,
- int64_t* ust,
- int64_t* msc,
- int64_t* sbc) override;
-XVisualInfo* glXGetVisualFromFBConfigFn(Display* dpy,
- GLXFBConfig config) override;
-int glXIsDirectFn(Display* dpy, GLXContext ctx) override;
-int glXMakeContextCurrentFn(Display* dpy,
- GLXDrawable draw,
- GLXDrawable read,
- GLXContext ctx) override;
-int glXMakeCurrentFn(Display* dpy,
- GLXDrawable drawable,
- GLXContext ctx) override;
-int glXQueryContextFn(Display* dpy,
- GLXContext ctx,
- int attribute,
- int* value) override;
-void glXQueryDrawableFn(Display* dpy,
- GLXDrawable draw,
- int attribute,
- unsigned int* value) override;
-int glXQueryExtensionFn(Display* dpy, int* errorb, int* event) override;
-const char* glXQueryExtensionsStringFn(Display* dpy, int screen) override;
-const char* glXQueryServerStringFn(Display* dpy, int screen, int name) override;
-int glXQueryVersionFn(Display* dpy, int* maj, int* min) override;
-void glXReleaseTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer) override;
-void glXSelectEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long mask) override;
-void glXSwapBuffersFn(Display* dpy, GLXDrawable drawable) override;
-void glXSwapIntervalEXTFn(Display* dpy,
- GLXDrawable drawable,
- int interval) override;
-void glXSwapIntervalMESAFn(unsigned int interval) override;
-void glXUseXFontFn(Font font, int first, int count, int list) override;
-void glXWaitGLFn(void) override;
-int glXWaitVideoSyncSGIFn(int divisor,
- int remainder,
- unsigned int* count) override;
-void glXWaitXFn(void) override;
diff --git a/ui/gl/gl_bindings_autogen_glx.cc b/ui/gl/gl_bindings_autogen_glx.cc
deleted file mode 100644
index 9cacc0c..0000000
--- a/ui/gl/gl_bindings_autogen_glx.cc
+++ /dev/null
@@ -1,1277 +0,0 @@
-// Copyright 2016 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file is auto-generated from
-// ui/gl/generate_bindings.py
-// It's formatted by clang-format using chromium coding style:
-// clang-format -i -style=chromium filename
-// DO NOT EDIT!
-
-#include <string>
-
-#include "base/trace_event/trace_event.h"
-#include "ui/gl/gl_bindings.h"
-#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_enums.h"
-#include "ui/gl/gl_glx_api_implementation.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_version_info.h"
-
-namespace gl {
-
-DriverGLX g_driver_glx; // Exists in .bss
-
-void DriverGLX::InitializeStaticBindings() {
- // Ensure struct has been zero-initialized.
- char* this_bytes = reinterpret_cast<char*>(this);
- DCHECK(this_bytes[0] == 0);
- DCHECK(memcmp(this_bytes, this_bytes + 1, sizeof(*this) - 1) == 0);
-
- fn.glXChooseFBConfigFn = reinterpret_cast<glXChooseFBConfigProc>(
- GetGLProcAddress("glXChooseFBConfig"));
- fn.glXChooseVisualFn = reinterpret_cast<glXChooseVisualProc>(
- GetGLProcAddress("glXChooseVisual"));
- fn.glXCopyContextFn =
- reinterpret_cast<glXCopyContextProc>(GetGLProcAddress("glXCopyContext"));
- fn.glXCreateContextFn = reinterpret_cast<glXCreateContextProc>(
- GetGLProcAddress("glXCreateContext"));
- fn.glXCreateGLXPixmapFn = reinterpret_cast<glXCreateGLXPixmapProc>(
- GetGLProcAddress("glXCreateGLXPixmap"));
- fn.glXCreateNewContextFn = reinterpret_cast<glXCreateNewContextProc>(
- GetGLProcAddress("glXCreateNewContext"));
- fn.glXCreatePbufferFn = reinterpret_cast<glXCreatePbufferProc>(
- GetGLProcAddress("glXCreatePbuffer"));
- fn.glXCreatePixmapFn = reinterpret_cast<glXCreatePixmapProc>(
- GetGLProcAddress("glXCreatePixmap"));
- fn.glXCreateWindowFn = reinterpret_cast<glXCreateWindowProc>(
- GetGLProcAddress("glXCreateWindow"));
- fn.glXDestroyContextFn = reinterpret_cast<glXDestroyContextProc>(
- GetGLProcAddress("glXDestroyContext"));
- fn.glXDestroyGLXPixmapFn = reinterpret_cast<glXDestroyGLXPixmapProc>(
- GetGLProcAddress("glXDestroyGLXPixmap"));
- fn.glXDestroyPbufferFn = reinterpret_cast<glXDestroyPbufferProc>(
- GetGLProcAddress("glXDestroyPbuffer"));
- fn.glXDestroyPixmapFn = reinterpret_cast<glXDestroyPixmapProc>(
- GetGLProcAddress("glXDestroyPixmap"));
- fn.glXDestroyWindowFn = reinterpret_cast<glXDestroyWindowProc>(
- GetGLProcAddress("glXDestroyWindow"));
- fn.glXGetClientStringFn = reinterpret_cast<glXGetClientStringProc>(
- GetGLProcAddress("glXGetClientString"));
- fn.glXGetConfigFn =
- reinterpret_cast<glXGetConfigProc>(GetGLProcAddress("glXGetConfig"));
- fn.glXGetCurrentContextFn = reinterpret_cast<glXGetCurrentContextProc>(
- GetGLProcAddress("glXGetCurrentContext"));
- fn.glXGetCurrentDisplayFn = reinterpret_cast<glXGetCurrentDisplayProc>(
- GetGLProcAddress("glXGetCurrentDisplay"));
- fn.glXGetCurrentDrawableFn = reinterpret_cast<glXGetCurrentDrawableProc>(
- GetGLProcAddress("glXGetCurrentDrawable"));
- fn.glXGetCurrentReadDrawableFn =
- reinterpret_cast<glXGetCurrentReadDrawableProc>(
- GetGLProcAddress("glXGetCurrentReadDrawable"));
- fn.glXGetFBConfigAttribFn = reinterpret_cast<glXGetFBConfigAttribProc>(
- GetGLProcAddress("glXGetFBConfigAttrib"));
- fn.glXGetFBConfigsFn = reinterpret_cast<glXGetFBConfigsProc>(
- GetGLProcAddress("glXGetFBConfigs"));
- fn.glXGetSelectedEventFn = reinterpret_cast<glXGetSelectedEventProc>(
- GetGLProcAddress("glXGetSelectedEvent"));
- fn.glXGetVisualFromFBConfigFn =
- reinterpret_cast<glXGetVisualFromFBConfigProc>(
- GetGLProcAddress("glXGetVisualFromFBConfig"));
- fn.glXIsDirectFn =
- reinterpret_cast<glXIsDirectProc>(GetGLProcAddress("glXIsDirect"));
- fn.glXMakeContextCurrentFn = reinterpret_cast<glXMakeContextCurrentProc>(
- GetGLProcAddress("glXMakeContextCurrent"));
- fn.glXMakeCurrentFn =
- reinterpret_cast<glXMakeCurrentProc>(GetGLProcAddress("glXMakeCurrent"));
- fn.glXQueryContextFn = reinterpret_cast<glXQueryContextProc>(
- GetGLProcAddress("glXQueryContext"));
- fn.glXQueryDrawableFn = reinterpret_cast<glXQueryDrawableProc>(
- GetGLProcAddress("glXQueryDrawable"));
- fn.glXQueryExtensionFn = reinterpret_cast<glXQueryExtensionProc>(
- GetGLProcAddress("glXQueryExtension"));
- fn.glXQueryExtensionsStringFn =
- reinterpret_cast<glXQueryExtensionsStringProc>(
- GetGLProcAddress("glXQueryExtensionsString"));
- fn.glXQueryServerStringFn = reinterpret_cast<glXQueryServerStringProc>(
- GetGLProcAddress("glXQueryServerString"));
- fn.glXQueryVersionFn = reinterpret_cast<glXQueryVersionProc>(
- GetGLProcAddress("glXQueryVersion"));
- fn.glXSelectEventFn =
- reinterpret_cast<glXSelectEventProc>(GetGLProcAddress("glXSelectEvent"));
- fn.glXSwapBuffersFn =
- reinterpret_cast<glXSwapBuffersProc>(GetGLProcAddress("glXSwapBuffers"));
- fn.glXUseXFontFn =
- reinterpret_cast<glXUseXFontProc>(GetGLProcAddress("glXUseXFont"));
- fn.glXWaitGLFn =
- reinterpret_cast<glXWaitGLProc>(GetGLProcAddress("glXWaitGL"));
- fn.glXWaitXFn = reinterpret_cast<glXWaitXProc>(GetGLProcAddress("glXWaitX"));
-}
-
-void DriverGLX::InitializeExtensionBindings() {
- std::string platform_extensions(GetPlatformExtensions());
- [[maybe_unused]] gfx::ExtensionSet extensions(
- gfx::MakeExtensionSet(platform_extensions));
-
- ext.b_GLX_ARB_create_context =
- gfx::HasExtension(extensions, "GLX_ARB_create_context");
- ext.b_GLX_EXT_swap_control =
- gfx::HasExtension(extensions, "GLX_EXT_swap_control");
- ext.b_GLX_EXT_texture_from_pixmap =
- gfx::HasExtension(extensions, "GLX_EXT_texture_from_pixmap");
- ext.b_GLX_MESA_copy_sub_buffer =
- gfx::HasExtension(extensions, "GLX_MESA_copy_sub_buffer");
- ext.b_GLX_MESA_swap_control =
- gfx::HasExtension(extensions, "GLX_MESA_swap_control");
- ext.b_GLX_OML_sync_control =
- gfx::HasExtension(extensions, "GLX_OML_sync_control");
- ext.b_GLX_SGIX_fbconfig = gfx::HasExtension(extensions, "GLX_SGIX_fbconfig");
- ext.b_GLX_SGI_video_sync =
- gfx::HasExtension(extensions, "GLX_SGI_video_sync");
-
- if (ext.b_GLX_EXT_texture_from_pixmap) {
- fn.glXBindTexImageEXTFn = reinterpret_cast<glXBindTexImageEXTProc>(
- GetGLProcAddress("glXBindTexImageEXT"));
- }
-
- if (ext.b_GLX_MESA_copy_sub_buffer) {
- fn.glXCopySubBufferMESAFn = reinterpret_cast<glXCopySubBufferMESAProc>(
- GetGLProcAddress("glXCopySubBufferMESA"));
- }
-
- if (ext.b_GLX_ARB_create_context) {
- fn.glXCreateContextAttribsARBFn =
- reinterpret_cast<glXCreateContextAttribsARBProc>(
- GetGLProcAddress("glXCreateContextAttribsARB"));
- }
-
- if (ext.b_GLX_SGIX_fbconfig) {
- fn.glXGetFBConfigFromVisualSGIXFn =
- reinterpret_cast<glXGetFBConfigFromVisualSGIXProc>(
- GetGLProcAddress("glXGetFBConfigFromVisualSGIX"));
- }
-
- if (ext.b_GLX_OML_sync_control) {
- fn.glXGetMscRateOMLFn = reinterpret_cast<glXGetMscRateOMLProc>(
- GetGLProcAddress("glXGetMscRateOML"));
- }
-
- if (ext.b_GLX_OML_sync_control) {
- fn.glXGetSyncValuesOMLFn = reinterpret_cast<glXGetSyncValuesOMLProc>(
- GetGLProcAddress("glXGetSyncValuesOML"));
- }
-
- if (ext.b_GLX_EXT_texture_from_pixmap) {
- fn.glXReleaseTexImageEXTFn = reinterpret_cast<glXReleaseTexImageEXTProc>(
- GetGLProcAddress("glXReleaseTexImageEXT"));
- }
-
- if (ext.b_GLX_EXT_swap_control) {
- fn.glXSwapIntervalEXTFn = reinterpret_cast<glXSwapIntervalEXTProc>(
- GetGLProcAddress("glXSwapIntervalEXT"));
- }
-
- if (ext.b_GLX_MESA_swap_control) {
- fn.glXSwapIntervalMESAFn = reinterpret_cast<glXSwapIntervalMESAProc>(
- GetGLProcAddress("glXSwapIntervalMESA"));
- }
-
- if (ext.b_GLX_SGI_video_sync) {
- fn.glXWaitVideoSyncSGIFn = reinterpret_cast<glXWaitVideoSyncSGIProc>(
- GetGLProcAddress("glXWaitVideoSyncSGI"));
- }
-}
-
-void DriverGLX::ClearBindings() {
- memset(this, 0, sizeof(*this));
-}
-
-void GLXApiBase::glXBindTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer,
- int* attribList) {
- driver_->fn.glXBindTexImageEXTFn(dpy, drawable, buffer, attribList);
-}
-
-GLXFBConfig* GLXApiBase::glXChooseFBConfigFn(Display* dpy,
- int screen,
- const int* attribList,
- int* nitems) {
- return driver_->fn.glXChooseFBConfigFn(dpy, screen, attribList, nitems);
-}
-
-XVisualInfo* GLXApiBase::glXChooseVisualFn(Display* dpy,
- int screen,
- int* attribList) {
- return driver_->fn.glXChooseVisualFn(dpy, screen, attribList);
-}
-
-void GLXApiBase::glXCopyContextFn(Display* dpy,
- GLXContext src,
- GLXContext dst,
- unsigned long mask) {
- driver_->fn.glXCopyContextFn(dpy, src, dst, mask);
-}
-
-void GLXApiBase::glXCopySubBufferMESAFn(Display* dpy,
- GLXDrawable drawable,
- int x,
- int y,
- int width,
- int height) {
- driver_->fn.glXCopySubBufferMESAFn(dpy, drawable, x, y, width, height);
-}
-
-GLXContext GLXApiBase::glXCreateContextFn(Display* dpy,
- XVisualInfo* vis,
- GLXContext shareList,
- int direct) {
- return driver_->fn.glXCreateContextFn(dpy, vis, shareList, direct);
-}
-
-GLXContext GLXApiBase::glXCreateContextAttribsARBFn(Display* dpy,
- GLXFBConfig config,
- GLXContext share_context,
- int direct,
- const int* attrib_list) {
- return driver_->fn.glXCreateContextAttribsARBFn(dpy, config, share_context,
- direct, attrib_list);
-}
-
-GLXPixmap GLXApiBase::glXCreateGLXPixmapFn(Display* dpy,
- XVisualInfo* visual,
- Pixmap pixmap) {
- return driver_->fn.glXCreateGLXPixmapFn(dpy, visual, pixmap);
-}
-
-GLXContext GLXApiBase::glXCreateNewContextFn(Display* dpy,
- GLXFBConfig config,
- int renderType,
- GLXContext shareList,
- int direct) {
- return driver_->fn.glXCreateNewContextFn(dpy, config, renderType, shareList,
- direct);
-}
-
-GLXPbuffer GLXApiBase::glXCreatePbufferFn(Display* dpy,
- GLXFBConfig config,
- const int* attribList) {
- return driver_->fn.glXCreatePbufferFn(dpy, config, attribList);
-}
-
-GLXPixmap GLXApiBase::glXCreatePixmapFn(Display* dpy,
- GLXFBConfig config,
- Pixmap pixmap,
- const int* attribList) {
- return driver_->fn.glXCreatePixmapFn(dpy, config, pixmap, attribList);
-}
-
-GLXWindow GLXApiBase::glXCreateWindowFn(Display* dpy,
- GLXFBConfig config,
- Window win,
- const int* attribList) {
- return driver_->fn.glXCreateWindowFn(dpy, config, win, attribList);
-}
-
-void GLXApiBase::glXDestroyContextFn(Display* dpy, GLXContext ctx) {
- driver_->fn.glXDestroyContextFn(dpy, ctx);
-}
-
-void GLXApiBase::glXDestroyGLXPixmapFn(Display* dpy, GLXPixmap pixmap) {
- driver_->fn.glXDestroyGLXPixmapFn(dpy, pixmap);
-}
-
-void GLXApiBase::glXDestroyPbufferFn(Display* dpy, GLXPbuffer pbuf) {
- driver_->fn.glXDestroyPbufferFn(dpy, pbuf);
-}
-
-void GLXApiBase::glXDestroyPixmapFn(Display* dpy, GLXPixmap pixmap) {
- driver_->fn.glXDestroyPixmapFn(dpy, pixmap);
-}
-
-void GLXApiBase::glXDestroyWindowFn(Display* dpy, GLXWindow window) {
- driver_->fn.glXDestroyWindowFn(dpy, window);
-}
-
-const char* GLXApiBase::glXGetClientStringFn(Display* dpy, int name) {
- return driver_->fn.glXGetClientStringFn(dpy, name);
-}
-
-int GLXApiBase::glXGetConfigFn(Display* dpy,
- XVisualInfo* visual,
- int attrib,
- int* value) {
- return driver_->fn.glXGetConfigFn(dpy, visual, attrib, value);
-}
-
-GLXContext GLXApiBase::glXGetCurrentContextFn(void) {
- return driver_->fn.glXGetCurrentContextFn();
-}
-
-Display* GLXApiBase::glXGetCurrentDisplayFn(void) {
- return driver_->fn.glXGetCurrentDisplayFn();
-}
-
-GLXDrawable GLXApiBase::glXGetCurrentDrawableFn(void) {
- return driver_->fn.glXGetCurrentDrawableFn();
-}
-
-GLXDrawable GLXApiBase::glXGetCurrentReadDrawableFn(void) {
- return driver_->fn.glXGetCurrentReadDrawableFn();
-}
-
-int GLXApiBase::glXGetFBConfigAttribFn(Display* dpy,
- GLXFBConfig config,
- int attribute,
- int* value) {
- return driver_->fn.glXGetFBConfigAttribFn(dpy, config, attribute, value);
-}
-
-GLXFBConfig GLXApiBase::glXGetFBConfigFromVisualSGIXFn(
- Display* dpy,
- XVisualInfo* visualInfo) {
- return driver_->fn.glXGetFBConfigFromVisualSGIXFn(dpy, visualInfo);
-}
-
-GLXFBConfig* GLXApiBase::glXGetFBConfigsFn(Display* dpy,
- int screen,
- int* nelements) {
- return driver_->fn.glXGetFBConfigsFn(dpy, screen, nelements);
-}
-
-bool GLXApiBase::glXGetMscRateOMLFn(Display* dpy,
- GLXDrawable drawable,
- int32_t* numerator,
- int32_t* denominator) {
- return driver_->fn.glXGetMscRateOMLFn(dpy, drawable, numerator, denominator);
-}
-
-void GLXApiBase::glXGetSelectedEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long* mask) {
- driver_->fn.glXGetSelectedEventFn(dpy, drawable, mask);
-}
-
-bool GLXApiBase::glXGetSyncValuesOMLFn(Display* dpy,
- GLXDrawable drawable,
- int64_t* ust,
- int64_t* msc,
- int64_t* sbc) {
- return driver_->fn.glXGetSyncValuesOMLFn(dpy, drawable, ust, msc, sbc);
-}
-
-XVisualInfo* GLXApiBase::glXGetVisualFromFBConfigFn(Display* dpy,
- GLXFBConfig config) {
- return driver_->fn.glXGetVisualFromFBConfigFn(dpy, config);
-}
-
-int GLXApiBase::glXIsDirectFn(Display* dpy, GLXContext ctx) {
- return driver_->fn.glXIsDirectFn(dpy, ctx);
-}
-
-int GLXApiBase::glXMakeContextCurrentFn(Display* dpy,
- GLXDrawable draw,
- GLXDrawable read,
- GLXContext ctx) {
- return driver_->fn.glXMakeContextCurrentFn(dpy, draw, read, ctx);
-}
-
-int GLXApiBase::glXMakeCurrentFn(Display* dpy,
- GLXDrawable drawable,
- GLXContext ctx) {
- return driver_->fn.glXMakeCurrentFn(dpy, drawable, ctx);
-}
-
-int GLXApiBase::glXQueryContextFn(Display* dpy,
- GLXContext ctx,
- int attribute,
- int* value) {
- return driver_->fn.glXQueryContextFn(dpy, ctx, attribute, value);
-}
-
-void GLXApiBase::glXQueryDrawableFn(Display* dpy,
- GLXDrawable draw,
- int attribute,
- unsigned int* value) {
- driver_->fn.glXQueryDrawableFn(dpy, draw, attribute, value);
-}
-
-int GLXApiBase::glXQueryExtensionFn(Display* dpy, int* errorb, int* event) {
- return driver_->fn.glXQueryExtensionFn(dpy, errorb, event);
-}
-
-const char* GLXApiBase::glXQueryExtensionsStringFn(Display* dpy, int screen) {
- return driver_->fn.glXQueryExtensionsStringFn(dpy, screen);
-}
-
-const char* GLXApiBase::glXQueryServerStringFn(Display* dpy,
- int screen,
- int name) {
- return driver_->fn.glXQueryServerStringFn(dpy, screen, name);
-}
-
-int GLXApiBase::glXQueryVersionFn(Display* dpy, int* maj, int* min) {
- return driver_->fn.glXQueryVersionFn(dpy, maj, min);
-}
-
-void GLXApiBase::glXReleaseTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer) {
- driver_->fn.glXReleaseTexImageEXTFn(dpy, drawable, buffer);
-}
-
-void GLXApiBase::glXSelectEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long mask) {
- driver_->fn.glXSelectEventFn(dpy, drawable, mask);
-}
-
-void GLXApiBase::glXSwapBuffersFn(Display* dpy, GLXDrawable drawable) {
- driver_->fn.glXSwapBuffersFn(dpy, drawable);
-}
-
-void GLXApiBase::glXSwapIntervalEXTFn(Display* dpy,
- GLXDrawable drawable,
- int interval) {
- driver_->fn.glXSwapIntervalEXTFn(dpy, drawable, interval);
-}
-
-void GLXApiBase::glXSwapIntervalMESAFn(unsigned int interval) {
- driver_->fn.glXSwapIntervalMESAFn(interval);
-}
-
-void GLXApiBase::glXUseXFontFn(Font font, int first, int count, int list) {
- driver_->fn.glXUseXFontFn(font, first, count, list);
-}
-
-void GLXApiBase::glXWaitGLFn(void) {
- driver_->fn.glXWaitGLFn();
-}
-
-int GLXApiBase::glXWaitVideoSyncSGIFn(int divisor,
- int remainder,
- unsigned int* count) {
- return driver_->fn.glXWaitVideoSyncSGIFn(divisor, remainder, count);
-}
-
-void GLXApiBase::glXWaitXFn(void) {
- driver_->fn.glXWaitXFn();
-}
-
-void TraceGLXApi::glXBindTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer,
- int* attribList) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXBindTexImageEXT");
- glx_api_->glXBindTexImageEXTFn(dpy, drawable, buffer, attribList);
-}
-
-GLXFBConfig* TraceGLXApi::glXChooseFBConfigFn(Display* dpy,
- int screen,
- const int* attribList,
- int* nitems) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXChooseFBConfig");
- return glx_api_->glXChooseFBConfigFn(dpy, screen, attribList, nitems);
-}
-
-XVisualInfo* TraceGLXApi::glXChooseVisualFn(Display* dpy,
- int screen,
- int* attribList) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXChooseVisual");
- return glx_api_->glXChooseVisualFn(dpy, screen, attribList);
-}
-
-void TraceGLXApi::glXCopyContextFn(Display* dpy,
- GLXContext src,
- GLXContext dst,
- unsigned long mask) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXCopyContext");
- glx_api_->glXCopyContextFn(dpy, src, dst, mask);
-}
-
-void TraceGLXApi::glXCopySubBufferMESAFn(Display* dpy,
- GLXDrawable drawable,
- int x,
- int y,
- int width,
- int height) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXCopySubBufferMESA");
- glx_api_->glXCopySubBufferMESAFn(dpy, drawable, x, y, width, height);
-}
-
-GLXContext TraceGLXApi::glXCreateContextFn(Display* dpy,
- XVisualInfo* vis,
- GLXContext shareList,
- int direct) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXCreateContext");
- return glx_api_->glXCreateContextFn(dpy, vis, shareList, direct);
-}
-
-GLXContext TraceGLXApi::glXCreateContextAttribsARBFn(Display* dpy,
- GLXFBConfig config,
- GLXContext share_context,
- int direct,
- const int* attrib_list) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu",
- "TraceGLXAPI::glXCreateContextAttribsARB");
- return glx_api_->glXCreateContextAttribsARBFn(dpy, config, share_context,
- direct, attrib_list);
-}
-
-GLXPixmap TraceGLXApi::glXCreateGLXPixmapFn(Display* dpy,
- XVisualInfo* visual,
- Pixmap pixmap) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXCreateGLXPixmap");
- return glx_api_->glXCreateGLXPixmapFn(dpy, visual, pixmap);
-}
-
-GLXContext TraceGLXApi::glXCreateNewContextFn(Display* dpy,
- GLXFBConfig config,
- int renderType,
- GLXContext shareList,
- int direct) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXCreateNewContext");
- return glx_api_->glXCreateNewContextFn(dpy, config, renderType, shareList,
- direct);
-}
-
-GLXPbuffer TraceGLXApi::glXCreatePbufferFn(Display* dpy,
- GLXFBConfig config,
- const int* attribList) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXCreatePbuffer");
- return glx_api_->glXCreatePbufferFn(dpy, config, attribList);
-}
-
-GLXPixmap TraceGLXApi::glXCreatePixmapFn(Display* dpy,
- GLXFBConfig config,
- Pixmap pixmap,
- const int* attribList) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXCreatePixmap");
- return glx_api_->glXCreatePixmapFn(dpy, config, pixmap, attribList);
-}
-
-GLXWindow TraceGLXApi::glXCreateWindowFn(Display* dpy,
- GLXFBConfig config,
- Window win,
- const int* attribList) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXCreateWindow");
- return glx_api_->glXCreateWindowFn(dpy, config, win, attribList);
-}
-
-void TraceGLXApi::glXDestroyContextFn(Display* dpy, GLXContext ctx) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXDestroyContext");
- glx_api_->glXDestroyContextFn(dpy, ctx);
-}
-
-void TraceGLXApi::glXDestroyGLXPixmapFn(Display* dpy, GLXPixmap pixmap) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXDestroyGLXPixmap");
- glx_api_->glXDestroyGLXPixmapFn(dpy, pixmap);
-}
-
-void TraceGLXApi::glXDestroyPbufferFn(Display* dpy, GLXPbuffer pbuf) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXDestroyPbuffer");
- glx_api_->glXDestroyPbufferFn(dpy, pbuf);
-}
-
-void TraceGLXApi::glXDestroyPixmapFn(Display* dpy, GLXPixmap pixmap) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXDestroyPixmap");
- glx_api_->glXDestroyPixmapFn(dpy, pixmap);
-}
-
-void TraceGLXApi::glXDestroyWindowFn(Display* dpy, GLXWindow window) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXDestroyWindow");
- glx_api_->glXDestroyWindowFn(dpy, window);
-}
-
-const char* TraceGLXApi::glXGetClientStringFn(Display* dpy, int name) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetClientString");
- return glx_api_->glXGetClientStringFn(dpy, name);
-}
-
-int TraceGLXApi::glXGetConfigFn(Display* dpy,
- XVisualInfo* visual,
- int attrib,
- int* value) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetConfig");
- return glx_api_->glXGetConfigFn(dpy, visual, attrib, value);
-}
-
-GLXContext TraceGLXApi::glXGetCurrentContextFn(void) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetCurrentContext");
- return glx_api_->glXGetCurrentContextFn();
-}
-
-Display* TraceGLXApi::glXGetCurrentDisplayFn(void) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetCurrentDisplay");
- return glx_api_->glXGetCurrentDisplayFn();
-}
-
-GLXDrawable TraceGLXApi::glXGetCurrentDrawableFn(void) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetCurrentDrawable");
- return glx_api_->glXGetCurrentDrawableFn();
-}
-
-GLXDrawable TraceGLXApi::glXGetCurrentReadDrawableFn(void) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu",
- "TraceGLXAPI::glXGetCurrentReadDrawable");
- return glx_api_->glXGetCurrentReadDrawableFn();
-}
-
-int TraceGLXApi::glXGetFBConfigAttribFn(Display* dpy,
- GLXFBConfig config,
- int attribute,
- int* value) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetFBConfigAttrib");
- return glx_api_->glXGetFBConfigAttribFn(dpy, config, attribute, value);
-}
-
-GLXFBConfig TraceGLXApi::glXGetFBConfigFromVisualSGIXFn(
- Display* dpy,
- XVisualInfo* visualInfo) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu",
- "TraceGLXAPI::glXGetFBConfigFromVisualSGIX");
- return glx_api_->glXGetFBConfigFromVisualSGIXFn(dpy, visualInfo);
-}
-
-GLXFBConfig* TraceGLXApi::glXGetFBConfigsFn(Display* dpy,
- int screen,
- int* nelements) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetFBConfigs");
- return glx_api_->glXGetFBConfigsFn(dpy, screen, nelements);
-}
-
-bool TraceGLXApi::glXGetMscRateOMLFn(Display* dpy,
- GLXDrawable drawable,
- int32_t* numerator,
- int32_t* denominator) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetMscRateOML");
- return glx_api_->glXGetMscRateOMLFn(dpy, drawable, numerator, denominator);
-}
-
-void TraceGLXApi::glXGetSelectedEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long* mask) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetSelectedEvent");
- glx_api_->glXGetSelectedEventFn(dpy, drawable, mask);
-}
-
-bool TraceGLXApi::glXGetSyncValuesOMLFn(Display* dpy,
- GLXDrawable drawable,
- int64_t* ust,
- int64_t* msc,
- int64_t* sbc) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetSyncValuesOML");
- return glx_api_->glXGetSyncValuesOMLFn(dpy, drawable, ust, msc, sbc);
-}
-
-XVisualInfo* TraceGLXApi::glXGetVisualFromFBConfigFn(Display* dpy,
- GLXFBConfig config) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXGetVisualFromFBConfig");
- return glx_api_->glXGetVisualFromFBConfigFn(dpy, config);
-}
-
-int TraceGLXApi::glXIsDirectFn(Display* dpy, GLXContext ctx) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXIsDirect");
- return glx_api_->glXIsDirectFn(dpy, ctx);
-}
-
-int TraceGLXApi::glXMakeContextCurrentFn(Display* dpy,
- GLXDrawable draw,
- GLXDrawable read,
- GLXContext ctx) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXMakeContextCurrent");
- return glx_api_->glXMakeContextCurrentFn(dpy, draw, read, ctx);
-}
-
-int TraceGLXApi::glXMakeCurrentFn(Display* dpy,
- GLXDrawable drawable,
- GLXContext ctx) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXMakeCurrent");
- return glx_api_->glXMakeCurrentFn(dpy, drawable, ctx);
-}
-
-int TraceGLXApi::glXQueryContextFn(Display* dpy,
- GLXContext ctx,
- int attribute,
- int* value) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXQueryContext");
- return glx_api_->glXQueryContextFn(dpy, ctx, attribute, value);
-}
-
-void TraceGLXApi::glXQueryDrawableFn(Display* dpy,
- GLXDrawable draw,
- int attribute,
- unsigned int* value) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXQueryDrawable");
- glx_api_->glXQueryDrawableFn(dpy, draw, attribute, value);
-}
-
-int TraceGLXApi::glXQueryExtensionFn(Display* dpy, int* errorb, int* event) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXQueryExtension");
- return glx_api_->glXQueryExtensionFn(dpy, errorb, event);
-}
-
-const char* TraceGLXApi::glXQueryExtensionsStringFn(Display* dpy, int screen) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXQueryExtensionsString");
- return glx_api_->glXQueryExtensionsStringFn(dpy, screen);
-}
-
-const char* TraceGLXApi::glXQueryServerStringFn(Display* dpy,
- int screen,
- int name) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXQueryServerString");
- return glx_api_->glXQueryServerStringFn(dpy, screen, name);
-}
-
-int TraceGLXApi::glXQueryVersionFn(Display* dpy, int* maj, int* min) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXQueryVersion");
- return glx_api_->glXQueryVersionFn(dpy, maj, min);
-}
-
-void TraceGLXApi::glXReleaseTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXReleaseTexImageEXT");
- glx_api_->glXReleaseTexImageEXTFn(dpy, drawable, buffer);
-}
-
-void TraceGLXApi::glXSelectEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long mask) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXSelectEvent");
- glx_api_->glXSelectEventFn(dpy, drawable, mask);
-}
-
-void TraceGLXApi::glXSwapBuffersFn(Display* dpy, GLXDrawable drawable) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXSwapBuffers");
- glx_api_->glXSwapBuffersFn(dpy, drawable);
-}
-
-void TraceGLXApi::glXSwapIntervalEXTFn(Display* dpy,
- GLXDrawable drawable,
- int interval) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXSwapIntervalEXT");
- glx_api_->glXSwapIntervalEXTFn(dpy, drawable, interval);
-}
-
-void TraceGLXApi::glXSwapIntervalMESAFn(unsigned int interval) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXSwapIntervalMESA");
- glx_api_->glXSwapIntervalMESAFn(interval);
-}
-
-void TraceGLXApi::glXUseXFontFn(Font font, int first, int count, int list) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXUseXFont");
- glx_api_->glXUseXFontFn(font, first, count, list);
-}
-
-void TraceGLXApi::glXWaitGLFn(void) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXWaitGL");
- glx_api_->glXWaitGLFn();
-}
-
-int TraceGLXApi::glXWaitVideoSyncSGIFn(int divisor,
- int remainder,
- unsigned int* count) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXWaitVideoSyncSGI");
- return glx_api_->glXWaitVideoSyncSGIFn(divisor, remainder, count);
-}
-
-void TraceGLXApi::glXWaitXFn(void) {
- TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLXAPI::glXWaitX");
- glx_api_->glXWaitXFn();
-}
-
-void LogGLXApi::glXBindTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer,
- int* attribList) {
- GL_SERVICE_LOG("glXBindTexImageEXT"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ", " << buffer << ", "
- << static_cast<const void*>(attribList) << ")");
- glx_api_->glXBindTexImageEXTFn(dpy, drawable, buffer, attribList);
-}
-
-GLXFBConfig* LogGLXApi::glXChooseFBConfigFn(Display* dpy,
- int screen,
- const int* attribList,
- int* nitems) {
- GL_SERVICE_LOG("glXChooseFBConfig"
- << "(" << static_cast<const void*>(dpy) << ", " << screen
- << ", " << static_cast<const void*>(attribList) << ", "
- << static_cast<const void*>(nitems) << ")");
- GLXFBConfig* result =
- glx_api_->glXChooseFBConfigFn(dpy, screen, attribList, nitems);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-XVisualInfo* LogGLXApi::glXChooseVisualFn(Display* dpy,
- int screen,
- int* attribList) {
- GL_SERVICE_LOG("glXChooseVisual"
- << "(" << static_cast<const void*>(dpy) << ", " << screen
- << ", " << static_cast<const void*>(attribList) << ")");
- XVisualInfo* result = glx_api_->glXChooseVisualFn(dpy, screen, attribList);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-void LogGLXApi::glXCopyContextFn(Display* dpy,
- GLXContext src,
- GLXContext dst,
- unsigned long mask) {
- GL_SERVICE_LOG("glXCopyContext"
- << "(" << static_cast<const void*>(dpy) << ", " << src << ", "
- << dst << ", " << mask << ")");
- glx_api_->glXCopyContextFn(dpy, src, dst, mask);
-}
-
-void LogGLXApi::glXCopySubBufferMESAFn(Display* dpy,
- GLXDrawable drawable,
- int x,
- int y,
- int width,
- int height) {
- GL_SERVICE_LOG("glXCopySubBufferMESA"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ", " << x << ", " << y << ", " << width << ", " << height
- << ")");
- glx_api_->glXCopySubBufferMESAFn(dpy, drawable, x, y, width, height);
-}
-
-GLXContext LogGLXApi::glXCreateContextFn(Display* dpy,
- XVisualInfo* vis,
- GLXContext shareList,
- int direct) {
- GL_SERVICE_LOG("glXCreateContext"
- << "(" << static_cast<const void*>(dpy) << ", "
- << static_cast<const void*>(vis) << ", " << shareList << ", "
- << direct << ")");
- GLXContext result = glx_api_->glXCreateContextFn(dpy, vis, shareList, direct);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXContext LogGLXApi::glXCreateContextAttribsARBFn(Display* dpy,
- GLXFBConfig config,
- GLXContext share_context,
- int direct,
- const int* attrib_list) {
- GL_SERVICE_LOG("glXCreateContextAttribsARB"
- << "(" << static_cast<const void*>(dpy) << ", " << config
- << ", " << share_context << ", " << direct << ", "
- << static_cast<const void*>(attrib_list) << ")");
- GLXContext result = glx_api_->glXCreateContextAttribsARBFn(
- dpy, config, share_context, direct, attrib_list);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXPixmap LogGLXApi::glXCreateGLXPixmapFn(Display* dpy,
- XVisualInfo* visual,
- Pixmap pixmap) {
- GL_SERVICE_LOG("glXCreateGLXPixmap"
- << "(" << static_cast<const void*>(dpy) << ", "
- << static_cast<const void*>(visual) << ", " << pixmap << ")");
- GLXPixmap result = glx_api_->glXCreateGLXPixmapFn(dpy, visual, pixmap);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXContext LogGLXApi::glXCreateNewContextFn(Display* dpy,
- GLXFBConfig config,
- int renderType,
- GLXContext shareList,
- int direct) {
- GL_SERVICE_LOG("glXCreateNewContext"
- << "(" << static_cast<const void*>(dpy) << ", " << config
- << ", " << renderType << ", " << shareList << ", " << direct
- << ")");
- GLXContext result = glx_api_->glXCreateNewContextFn(dpy, config, renderType,
- shareList, direct);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXPbuffer LogGLXApi::glXCreatePbufferFn(Display* dpy,
- GLXFBConfig config,
- const int* attribList) {
- GL_SERVICE_LOG("glXCreatePbuffer"
- << "(" << static_cast<const void*>(dpy) << ", " << config
- << ", " << static_cast<const void*>(attribList) << ")");
- GLXPbuffer result = glx_api_->glXCreatePbufferFn(dpy, config, attribList);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXPixmap LogGLXApi::glXCreatePixmapFn(Display* dpy,
- GLXFBConfig config,
- Pixmap pixmap,
- const int* attribList) {
- GL_SERVICE_LOG("glXCreatePixmap"
- << "(" << static_cast<const void*>(dpy) << ", " << config
- << ", " << pixmap << ", "
- << static_cast<const void*>(attribList) << ")");
- GLXPixmap result =
- glx_api_->glXCreatePixmapFn(dpy, config, pixmap, attribList);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXWindow LogGLXApi::glXCreateWindowFn(Display* dpy,
- GLXFBConfig config,
- Window win,
- const int* attribList) {
- GL_SERVICE_LOG("glXCreateWindow"
- << "(" << static_cast<const void*>(dpy) << ", " << config
- << ", " << win << ", " << static_cast<const void*>(attribList)
- << ")");
- GLXWindow result = glx_api_->glXCreateWindowFn(dpy, config, win, attribList);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-void LogGLXApi::glXDestroyContextFn(Display* dpy, GLXContext ctx) {
- GL_SERVICE_LOG("glXDestroyContext"
- << "(" << static_cast<const void*>(dpy) << ", " << ctx << ")");
- glx_api_->glXDestroyContextFn(dpy, ctx);
-}
-
-void LogGLXApi::glXDestroyGLXPixmapFn(Display* dpy, GLXPixmap pixmap) {
- GL_SERVICE_LOG("glXDestroyGLXPixmap"
- << "(" << static_cast<const void*>(dpy) << ", " << pixmap
- << ")");
- glx_api_->glXDestroyGLXPixmapFn(dpy, pixmap);
-}
-
-void LogGLXApi::glXDestroyPbufferFn(Display* dpy, GLXPbuffer pbuf) {
- GL_SERVICE_LOG("glXDestroyPbuffer"
- << "(" << static_cast<const void*>(dpy) << ", " << pbuf
- << ")");
- glx_api_->glXDestroyPbufferFn(dpy, pbuf);
-}
-
-void LogGLXApi::glXDestroyPixmapFn(Display* dpy, GLXPixmap pixmap) {
- GL_SERVICE_LOG("glXDestroyPixmap"
- << "(" << static_cast<const void*>(dpy) << ", " << pixmap
- << ")");
- glx_api_->glXDestroyPixmapFn(dpy, pixmap);
-}
-
-void LogGLXApi::glXDestroyWindowFn(Display* dpy, GLXWindow window) {
- GL_SERVICE_LOG("glXDestroyWindow"
- << "(" << static_cast<const void*>(dpy) << ", " << window
- << ")");
- glx_api_->glXDestroyWindowFn(dpy, window);
-}
-
-const char* LogGLXApi::glXGetClientStringFn(Display* dpy, int name) {
- GL_SERVICE_LOG("glXGetClientString"
- << "(" << static_cast<const void*>(dpy) << ", " << name
- << ")");
- const char* result = glx_api_->glXGetClientStringFn(dpy, name);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-int LogGLXApi::glXGetConfigFn(Display* dpy,
- XVisualInfo* visual,
- int attrib,
- int* value) {
- GL_SERVICE_LOG("glXGetConfig"
- << "(" << static_cast<const void*>(dpy) << ", "
- << static_cast<const void*>(visual) << ", " << attrib << ", "
- << static_cast<const void*>(value) << ")");
- int result = glx_api_->glXGetConfigFn(dpy, visual, attrib, value);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXContext LogGLXApi::glXGetCurrentContextFn(void) {
- GL_SERVICE_LOG("glXGetCurrentContext"
- << "("
- << ")");
- GLXContext result = glx_api_->glXGetCurrentContextFn();
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-Display* LogGLXApi::glXGetCurrentDisplayFn(void) {
- GL_SERVICE_LOG("glXGetCurrentDisplay"
- << "("
- << ")");
- Display* result = glx_api_->glXGetCurrentDisplayFn();
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXDrawable LogGLXApi::glXGetCurrentDrawableFn(void) {
- GL_SERVICE_LOG("glXGetCurrentDrawable"
- << "("
- << ")");
- GLXDrawable result = glx_api_->glXGetCurrentDrawableFn();
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXDrawable LogGLXApi::glXGetCurrentReadDrawableFn(void) {
- GL_SERVICE_LOG("glXGetCurrentReadDrawable"
- << "("
- << ")");
- GLXDrawable result = glx_api_->glXGetCurrentReadDrawableFn();
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-int LogGLXApi::glXGetFBConfigAttribFn(Display* dpy,
- GLXFBConfig config,
- int attribute,
- int* value) {
- GL_SERVICE_LOG("glXGetFBConfigAttrib"
- << "(" << static_cast<const void*>(dpy) << ", " << config
- << ", " << attribute << ", " << static_cast<const void*>(value)
- << ")");
- int result = glx_api_->glXGetFBConfigAttribFn(dpy, config, attribute, value);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXFBConfig LogGLXApi::glXGetFBConfigFromVisualSGIXFn(Display* dpy,
- XVisualInfo* visualInfo) {
- GL_SERVICE_LOG("glXGetFBConfigFromVisualSGIX"
- << "(" << static_cast<const void*>(dpy) << ", "
- << static_cast<const void*>(visualInfo) << ")");
- GLXFBConfig result =
- glx_api_->glXGetFBConfigFromVisualSGIXFn(dpy, visualInfo);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-GLXFBConfig* LogGLXApi::glXGetFBConfigsFn(Display* dpy,
- int screen,
- int* nelements) {
- GL_SERVICE_LOG("glXGetFBConfigs"
- << "(" << static_cast<const void*>(dpy) << ", " << screen
- << ", " << static_cast<const void*>(nelements) << ")");
- GLXFBConfig* result = glx_api_->glXGetFBConfigsFn(dpy, screen, nelements);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-bool LogGLXApi::glXGetMscRateOMLFn(Display* dpy,
- GLXDrawable drawable,
- int32_t* numerator,
- int32_t* denominator) {
- GL_SERVICE_LOG("glXGetMscRateOML"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ", " << static_cast<const void*>(numerator) << ", "
- << static_cast<const void*>(denominator) << ")");
- bool result =
- glx_api_->glXGetMscRateOMLFn(dpy, drawable, numerator, denominator);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-void LogGLXApi::glXGetSelectedEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long* mask) {
- GL_SERVICE_LOG("glXGetSelectedEvent"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ", " << static_cast<const void*>(mask) << ")");
- glx_api_->glXGetSelectedEventFn(dpy, drawable, mask);
-}
-
-bool LogGLXApi::glXGetSyncValuesOMLFn(Display* dpy,
- GLXDrawable drawable,
- int64_t* ust,
- int64_t* msc,
- int64_t* sbc) {
- GL_SERVICE_LOG("glXGetSyncValuesOML"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ", " << static_cast<const void*>(ust) << ", "
- << static_cast<const void*>(msc) << ", "
- << static_cast<const void*>(sbc) << ")");
- bool result = glx_api_->glXGetSyncValuesOMLFn(dpy, drawable, ust, msc, sbc);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-XVisualInfo* LogGLXApi::glXGetVisualFromFBConfigFn(Display* dpy,
- GLXFBConfig config) {
- GL_SERVICE_LOG("glXGetVisualFromFBConfig"
- << "(" << static_cast<const void*>(dpy) << ", " << config
- << ")");
- XVisualInfo* result = glx_api_->glXGetVisualFromFBConfigFn(dpy, config);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-int LogGLXApi::glXIsDirectFn(Display* dpy, GLXContext ctx) {
- GL_SERVICE_LOG("glXIsDirect"
- << "(" << static_cast<const void*>(dpy) << ", " << ctx << ")");
- int result = glx_api_->glXIsDirectFn(dpy, ctx);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-int LogGLXApi::glXMakeContextCurrentFn(Display* dpy,
- GLXDrawable draw,
- GLXDrawable read,
- GLXContext ctx) {
- GL_SERVICE_LOG("glXMakeContextCurrent"
- << "(" << static_cast<const void*>(dpy) << ", " << draw << ", "
- << read << ", " << ctx << ")");
- int result = glx_api_->glXMakeContextCurrentFn(dpy, draw, read, ctx);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-int LogGLXApi::glXMakeCurrentFn(Display* dpy,
- GLXDrawable drawable,
- GLXContext ctx) {
- GL_SERVICE_LOG("glXMakeCurrent"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ", " << ctx << ")");
- int result = glx_api_->glXMakeCurrentFn(dpy, drawable, ctx);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-int LogGLXApi::glXQueryContextFn(Display* dpy,
- GLXContext ctx,
- int attribute,
- int* value) {
- GL_SERVICE_LOG("glXQueryContext"
- << "(" << static_cast<const void*>(dpy) << ", " << ctx << ", "
- << attribute << ", " << static_cast<const void*>(value)
- << ")");
- int result = glx_api_->glXQueryContextFn(dpy, ctx, attribute, value);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-void LogGLXApi::glXQueryDrawableFn(Display* dpy,
- GLXDrawable draw,
- int attribute,
- unsigned int* value) {
- GL_SERVICE_LOG("glXQueryDrawable"
- << "(" << static_cast<const void*>(dpy) << ", " << draw << ", "
- << attribute << ", " << static_cast<const void*>(value)
- << ")");
- glx_api_->glXQueryDrawableFn(dpy, draw, attribute, value);
-}
-
-int LogGLXApi::glXQueryExtensionFn(Display* dpy, int* errorb, int* event) {
- GL_SERVICE_LOG("glXQueryExtension"
- << "(" << static_cast<const void*>(dpy) << ", "
- << static_cast<const void*>(errorb) << ", "
- << static_cast<const void*>(event) << ")");
- int result = glx_api_->glXQueryExtensionFn(dpy, errorb, event);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-const char* LogGLXApi::glXQueryExtensionsStringFn(Display* dpy, int screen) {
- GL_SERVICE_LOG("glXQueryExtensionsString"
- << "(" << static_cast<const void*>(dpy) << ", " << screen
- << ")");
- const char* result = glx_api_->glXQueryExtensionsStringFn(dpy, screen);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-const char* LogGLXApi::glXQueryServerStringFn(Display* dpy,
- int screen,
- int name) {
- GL_SERVICE_LOG("glXQueryServerString"
- << "(" << static_cast<const void*>(dpy) << ", " << screen
- << ", " << name << ")");
- const char* result = glx_api_->glXQueryServerStringFn(dpy, screen, name);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-int LogGLXApi::glXQueryVersionFn(Display* dpy, int* maj, int* min) {
- GL_SERVICE_LOG("glXQueryVersion"
- << "(" << static_cast<const void*>(dpy) << ", "
- << static_cast<const void*>(maj) << ", "
- << static_cast<const void*>(min) << ")");
- int result = glx_api_->glXQueryVersionFn(dpy, maj, min);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-void LogGLXApi::glXReleaseTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer) {
- GL_SERVICE_LOG("glXReleaseTexImageEXT"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ", " << buffer << ")");
- glx_api_->glXReleaseTexImageEXTFn(dpy, drawable, buffer);
-}
-
-void LogGLXApi::glXSelectEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long mask) {
- GL_SERVICE_LOG("glXSelectEvent"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ", " << mask << ")");
- glx_api_->glXSelectEventFn(dpy, drawable, mask);
-}
-
-void LogGLXApi::glXSwapBuffersFn(Display* dpy, GLXDrawable drawable) {
- GL_SERVICE_LOG("glXSwapBuffers"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ")");
- glx_api_->glXSwapBuffersFn(dpy, drawable);
-}
-
-void LogGLXApi::glXSwapIntervalEXTFn(Display* dpy,
- GLXDrawable drawable,
- int interval) {
- GL_SERVICE_LOG("glXSwapIntervalEXT"
- << "(" << static_cast<const void*>(dpy) << ", " << drawable
- << ", " << interval << ")");
- glx_api_->glXSwapIntervalEXTFn(dpy, drawable, interval);
-}
-
-void LogGLXApi::glXSwapIntervalMESAFn(unsigned int interval) {
- GL_SERVICE_LOG("glXSwapIntervalMESA"
- << "(" << interval << ")");
- glx_api_->glXSwapIntervalMESAFn(interval);
-}
-
-void LogGLXApi::glXUseXFontFn(Font font, int first, int count, int list) {
- GL_SERVICE_LOG("glXUseXFont"
- << "(" << font << ", " << first << ", " << count << ", "
- << list << ")");
- glx_api_->glXUseXFontFn(font, first, count, list);
-}
-
-void LogGLXApi::glXWaitGLFn(void) {
- GL_SERVICE_LOG("glXWaitGL"
- << "("
- << ")");
- glx_api_->glXWaitGLFn();
-}
-
-int LogGLXApi::glXWaitVideoSyncSGIFn(int divisor,
- int remainder,
- unsigned int* count) {
- GL_SERVICE_LOG("glXWaitVideoSyncSGI"
- << "(" << divisor << ", " << remainder << ", "
- << static_cast<const void*>(count) << ")");
- int result = glx_api_->glXWaitVideoSyncSGIFn(divisor, remainder, count);
- GL_SERVICE_LOG("GL_RESULT: " << result);
- return result;
-}
-
-void LogGLXApi::glXWaitXFn(void) {
- GL_SERVICE_LOG("glXWaitX"
- << "("
- << ")");
- glx_api_->glXWaitXFn();
-}
-
-} // namespace gl
diff --git a/ui/gl/gl_bindings_autogen_glx.h b/ui/gl/gl_bindings_autogen_glx.h
deleted file mode 100644
index d99af7a..0000000
--- a/ui/gl/gl_bindings_autogen_glx.h
+++ /dev/null
@@ -1,423 +0,0 @@
-// Copyright 2016 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// This file is auto-generated from
-// ui/gl/generate_bindings.py
-// It's formatted by clang-format using chromium coding style:
-// clang-format -i -style=chromium filename
-// DO NOT EDIT!
-
-#ifndef UI_GL_GL_BINDINGS_AUTOGEN_GLX_H_
-#define UI_GL_GL_BINDINGS_AUTOGEN_GLX_H_
-
-#include <string>
-
-namespace gl {
-
-class GLContext;
-
-typedef void(GL_BINDING_CALL* glXBindTexImageEXTProc)(Display* dpy,
- GLXDrawable drawable,
- int buffer,
- int* attribList);
-typedef GLXFBConfig*(GL_BINDING_CALL* glXChooseFBConfigProc)(
- Display* dpy,
- int screen,
- const int* attribList,
- int* nitems);
-typedef XVisualInfo*(GL_BINDING_CALL* glXChooseVisualProc)(Display* dpy,
- int screen,
- int* attribList);
-typedef void(GL_BINDING_CALL* glXCopyContextProc)(Display* dpy,
- GLXContext src,
- GLXContext dst,
- unsigned long mask);
-typedef void(GL_BINDING_CALL* glXCopySubBufferMESAProc)(Display* dpy,
- GLXDrawable drawable,
- int x,
- int y,
- int width,
- int height);
-typedef GLXContext(GL_BINDING_CALL* glXCreateContextProc)(Display* dpy,
- XVisualInfo* vis,
- GLXContext shareList,
- int direct);
-typedef GLXContext(GL_BINDING_CALL* glXCreateContextAttribsARBProc)(
- Display* dpy,
- GLXFBConfig config,
- GLXContext share_context,
- int direct,
- const int* attrib_list);
-typedef GLXPixmap(GL_BINDING_CALL* glXCreateGLXPixmapProc)(Display* dpy,
- XVisualInfo* visual,
- Pixmap pixmap);
-typedef GLXContext(GL_BINDING_CALL* glXCreateNewContextProc)(
- Display* dpy,
- GLXFBConfig config,
- int renderType,
- GLXContext shareList,
- int direct);
-typedef GLXPbuffer(GL_BINDING_CALL* glXCreatePbufferProc)(
- Display* dpy,
- GLXFBConfig config,
- const int* attribList);
-typedef GLXPixmap(GL_BINDING_CALL* glXCreatePixmapProc)(Display* dpy,
- GLXFBConfig config,
- Pixmap pixmap,
- const int* attribList);
-typedef GLXWindow(GL_BINDING_CALL* glXCreateWindowProc)(Display* dpy,
- GLXFBConfig config,
- Window win,
- const int* attribList);
-typedef void(GL_BINDING_CALL* glXDestroyContextProc)(Display* dpy,
- GLXContext ctx);
-typedef void(GL_BINDING_CALL* glXDestroyGLXPixmapProc)(Display* dpy,
- GLXPixmap pixmap);
-typedef void(GL_BINDING_CALL* glXDestroyPbufferProc)(Display* dpy,
- GLXPbuffer pbuf);
-typedef void(GL_BINDING_CALL* glXDestroyPixmapProc)(Display* dpy,
- GLXPixmap pixmap);
-typedef void(GL_BINDING_CALL* glXDestroyWindowProc)(Display* dpy,
- GLXWindow window);
-typedef const char*(GL_BINDING_CALL* glXGetClientStringProc)(Display* dpy,
- int name);
-typedef int(GL_BINDING_CALL* glXGetConfigProc)(Display* dpy,
- XVisualInfo* visual,
- int attrib,
- int* value);
-typedef GLXContext(GL_BINDING_CALL* glXGetCurrentContextProc)(void);
-typedef Display*(GL_BINDING_CALL* glXGetCurrentDisplayProc)(void);
-typedef GLXDrawable(GL_BINDING_CALL* glXGetCurrentDrawableProc)(void);
-typedef GLXDrawable(GL_BINDING_CALL* glXGetCurrentReadDrawableProc)(void);
-typedef int(GL_BINDING_CALL* glXGetFBConfigAttribProc)(Display* dpy,
- GLXFBConfig config,
- int attribute,
- int* value);
-typedef GLXFBConfig(GL_BINDING_CALL* glXGetFBConfigFromVisualSGIXProc)(
- Display* dpy,
- XVisualInfo* visualInfo);
-typedef GLXFBConfig*(GL_BINDING_CALL* glXGetFBConfigsProc)(Display* dpy,
- int screen,
- int* nelements);
-typedef bool(GL_BINDING_CALL* glXGetMscRateOMLProc)(Display* dpy,
- GLXDrawable drawable,
- int32_t* numerator,
- int32_t* denominator);
-typedef void(GL_BINDING_CALL* glXGetSelectedEventProc)(Display* dpy,
- GLXDrawable drawable,
- unsigned long* mask);
-typedef bool(GL_BINDING_CALL* glXGetSyncValuesOMLProc)(Display* dpy,
- GLXDrawable drawable,
- int64_t* ust,
- int64_t* msc,
- int64_t* sbc);
-typedef XVisualInfo*(GL_BINDING_CALL* glXGetVisualFromFBConfigProc)(
- Display* dpy,
- GLXFBConfig config);
-typedef int(GL_BINDING_CALL* glXIsDirectProc)(Display* dpy, GLXContext ctx);
-typedef int(GL_BINDING_CALL* glXMakeContextCurrentProc)(Display* dpy,
- GLXDrawable draw,
- GLXDrawable read,
- GLXContext ctx);
-typedef int(GL_BINDING_CALL* glXMakeCurrentProc)(Display* dpy,
- GLXDrawable drawable,
- GLXContext ctx);
-typedef int(GL_BINDING_CALL* glXQueryContextProc)(Display* dpy,
- GLXContext ctx,
- int attribute,
- int* value);
-typedef void(GL_BINDING_CALL* glXQueryDrawableProc)(Display* dpy,
- GLXDrawable draw,
- int attribute,
- unsigned int* value);
-typedef int(GL_BINDING_CALL* glXQueryExtensionProc)(Display* dpy,
- int* errorb,
- int* event);
-typedef const char*(GL_BINDING_CALL* glXQueryExtensionsStringProc)(Display* dpy,
- int screen);
-typedef const char*(GL_BINDING_CALL* glXQueryServerStringProc)(Display* dpy,
- int screen,
- int name);
-typedef int(GL_BINDING_CALL* glXQueryVersionProc)(Display* dpy,
- int* maj,
- int* min);
-typedef void(GL_BINDING_CALL* glXReleaseTexImageEXTProc)(Display* dpy,
- GLXDrawable drawable,
- int buffer);
-typedef void(GL_BINDING_CALL* glXSelectEventProc)(Display* dpy,
- GLXDrawable drawable,
- unsigned long mask);
-typedef void(GL_BINDING_CALL* glXSwapBuffersProc)(Display* dpy,
- GLXDrawable drawable);
-typedef void(GL_BINDING_CALL* glXSwapIntervalEXTProc)(Display* dpy,
- GLXDrawable drawable,
- int interval);
-typedef void(GL_BINDING_CALL* glXSwapIntervalMESAProc)(unsigned int interval);
-typedef void(GL_BINDING_CALL* glXUseXFontProc)(Font font,
- int first,
- int count,
- int list);
-typedef void(GL_BINDING_CALL* glXWaitGLProc)(void);
-typedef int(GL_BINDING_CALL* glXWaitVideoSyncSGIProc)(int divisor,
- int remainder,
- unsigned int* count);
-typedef void(GL_BINDING_CALL* glXWaitXProc)(void);
-
-struct ExtensionsGLX {
- bool b_GLX_ARB_create_context;
- bool b_GLX_EXT_swap_control;
- bool b_GLX_EXT_texture_from_pixmap;
- bool b_GLX_MESA_copy_sub_buffer;
- bool b_GLX_MESA_swap_control;
- bool b_GLX_OML_sync_control;
- bool b_GLX_SGIX_fbconfig;
- bool b_GLX_SGI_video_sync;
-};
-
-struct ProcsGLX {
- glXBindTexImageEXTProc glXBindTexImageEXTFn;
- glXChooseFBConfigProc glXChooseFBConfigFn;
- glXChooseVisualProc glXChooseVisualFn;
- glXCopyContextProc glXCopyContextFn;
- glXCopySubBufferMESAProc glXCopySubBufferMESAFn;
- glXCreateContextProc glXCreateContextFn;
- glXCreateContextAttribsARBProc glXCreateContextAttribsARBFn;
- glXCreateGLXPixmapProc glXCreateGLXPixmapFn;
- glXCreateNewContextProc glXCreateNewContextFn;
- glXCreatePbufferProc glXCreatePbufferFn;
- glXCreatePixmapProc glXCreatePixmapFn;
- glXCreateWindowProc glXCreateWindowFn;
- glXDestroyContextProc glXDestroyContextFn;
- glXDestroyGLXPixmapProc glXDestroyGLXPixmapFn;
- glXDestroyPbufferProc glXDestroyPbufferFn;
- glXDestroyPixmapProc glXDestroyPixmapFn;
- glXDestroyWindowProc glXDestroyWindowFn;
- glXGetClientStringProc glXGetClientStringFn;
- glXGetConfigProc glXGetConfigFn;
- glXGetCurrentContextProc glXGetCurrentContextFn;
- glXGetCurrentDisplayProc glXGetCurrentDisplayFn;
- glXGetCurrentDrawableProc glXGetCurrentDrawableFn;
- glXGetCurrentReadDrawableProc glXGetCurrentReadDrawableFn;
- glXGetFBConfigAttribProc glXGetFBConfigAttribFn;
- glXGetFBConfigFromVisualSGIXProc glXGetFBConfigFromVisualSGIXFn;
- glXGetFBConfigsProc glXGetFBConfigsFn;
- glXGetMscRateOMLProc glXGetMscRateOMLFn;
- glXGetSelectedEventProc glXGetSelectedEventFn;
- glXGetSyncValuesOMLProc glXGetSyncValuesOMLFn;
- glXGetVisualFromFBConfigProc glXGetVisualFromFBConfigFn;
- glXIsDirectProc glXIsDirectFn;
- glXMakeContextCurrentProc glXMakeContextCurrentFn;
- glXMakeCurrentProc glXMakeCurrentFn;
- glXQueryContextProc glXQueryContextFn;
- glXQueryDrawableProc glXQueryDrawableFn;
- glXQueryExtensionProc glXQueryExtensionFn;
- glXQueryExtensionsStringProc glXQueryExtensionsStringFn;
- glXQueryServerStringProc glXQueryServerStringFn;
- glXQueryVersionProc glXQueryVersionFn;
- glXReleaseTexImageEXTProc glXReleaseTexImageEXTFn;
- glXSelectEventProc glXSelectEventFn;
- glXSwapBuffersProc glXSwapBuffersFn;
- glXSwapIntervalEXTProc glXSwapIntervalEXTFn;
- glXSwapIntervalMESAProc glXSwapIntervalMESAFn;
- glXUseXFontProc glXUseXFontFn;
- glXWaitGLProc glXWaitGLFn;
- glXWaitVideoSyncSGIProc glXWaitVideoSyncSGIFn;
- glXWaitXProc glXWaitXFn;
-};
-
-class GL_EXPORT GLXApi {
- public:
- GLXApi();
- virtual ~GLXApi();
-
- virtual void SetDisabledExtensions(const std::string& disabled_extensions) {}
-
- virtual void glXBindTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer,
- int* attribList) = 0;
- virtual GLXFBConfig* glXChooseFBConfigFn(Display* dpy,
- int screen,
- const int* attribList,
- int* nitems) = 0;
- virtual XVisualInfo* glXChooseVisualFn(Display* dpy,
- int screen,
- int* attribList) = 0;
- virtual void glXCopyContextFn(Display* dpy,
- GLXContext src,
- GLXContext dst,
- unsigned long mask) = 0;
- virtual void glXCopySubBufferMESAFn(Display* dpy,
- GLXDrawable drawable,
- int x,
- int y,
- int width,
- int height) = 0;
- virtual GLXContext glXCreateContextFn(Display* dpy,
- XVisualInfo* vis,
- GLXContext shareList,
- int direct) = 0;
- virtual GLXContext glXCreateContextAttribsARBFn(Display* dpy,
- GLXFBConfig config,
- GLXContext share_context,
- int direct,
- const int* attrib_list) = 0;
- virtual GLXPixmap glXCreateGLXPixmapFn(Display* dpy,
- XVisualInfo* visual,
- Pixmap pixmap) = 0;
- virtual GLXContext glXCreateNewContextFn(Display* dpy,
- GLXFBConfig config,
- int renderType,
- GLXContext shareList,
- int direct) = 0;
- virtual GLXPbuffer glXCreatePbufferFn(Display* dpy,
- GLXFBConfig config,
- const int* attribList) = 0;
- virtual GLXPixmap glXCreatePixmapFn(Display* dpy,
- GLXFBConfig config,
- Pixmap pixmap,
- const int* attribList) = 0;
- virtual GLXWindow glXCreateWindowFn(Display* dpy,
- GLXFBConfig config,
- Window win,
- const int* attribList) = 0;
- virtual void glXDestroyContextFn(Display* dpy, GLXContext ctx) = 0;
- virtual void glXDestroyGLXPixmapFn(Display* dpy, GLXPixmap pixmap) = 0;
- virtual void glXDestroyPbufferFn(Display* dpy, GLXPbuffer pbuf) = 0;
- virtual void glXDestroyPixmapFn(Display* dpy, GLXPixmap pixmap) = 0;
- virtual void glXDestroyWindowFn(Display* dpy, GLXWindow window) = 0;
- virtual const char* glXGetClientStringFn(Display* dpy, int name) = 0;
- virtual int glXGetConfigFn(Display* dpy,
- XVisualInfo* visual,
- int attrib,
- int* value) = 0;
- virtual GLXContext glXGetCurrentContextFn(void) = 0;
- virtual Display* glXGetCurrentDisplayFn(void) = 0;
- virtual GLXDrawable glXGetCurrentDrawableFn(void) = 0;
- virtual GLXDrawable glXGetCurrentReadDrawableFn(void) = 0;
- virtual int glXGetFBConfigAttribFn(Display* dpy,
- GLXFBConfig config,
- int attribute,
- int* value) = 0;
- virtual GLXFBConfig glXGetFBConfigFromVisualSGIXFn(
- Display* dpy,
- XVisualInfo* visualInfo) = 0;
- virtual GLXFBConfig* glXGetFBConfigsFn(Display* dpy,
- int screen,
- int* nelements) = 0;
- virtual bool glXGetMscRateOMLFn(Display* dpy,
- GLXDrawable drawable,
- int32_t* numerator,
- int32_t* denominator) = 0;
- virtual void glXGetSelectedEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long* mask) = 0;
- virtual bool glXGetSyncValuesOMLFn(Display* dpy,
- GLXDrawable drawable,
- int64_t* ust,
- int64_t* msc,
- int64_t* sbc) = 0;
- virtual XVisualInfo* glXGetVisualFromFBConfigFn(Display* dpy,
- GLXFBConfig config) = 0;
- virtual int glXIsDirectFn(Display* dpy, GLXContext ctx) = 0;
- virtual int glXMakeContextCurrentFn(Display* dpy,
- GLXDrawable draw,
- GLXDrawable read,
- GLXContext ctx) = 0;
- virtual int glXMakeCurrentFn(Display* dpy,
- GLXDrawable drawable,
- GLXContext ctx) = 0;
- virtual int glXQueryContextFn(Display* dpy,
- GLXContext ctx,
- int attribute,
- int* value) = 0;
- virtual void glXQueryDrawableFn(Display* dpy,
- GLXDrawable draw,
- int attribute,
- unsigned int* value) = 0;
- virtual int glXQueryExtensionFn(Display* dpy, int* errorb, int* event) = 0;
- virtual const char* glXQueryExtensionsStringFn(Display* dpy, int screen) = 0;
- virtual const char* glXQueryServerStringFn(Display* dpy,
- int screen,
- int name) = 0;
- virtual int glXQueryVersionFn(Display* dpy, int* maj, int* min) = 0;
- virtual void glXReleaseTexImageEXTFn(Display* dpy,
- GLXDrawable drawable,
- int buffer) = 0;
- virtual void glXSelectEventFn(Display* dpy,
- GLXDrawable drawable,
- unsigned long mask) = 0;
- virtual void glXSwapBuffersFn(Display* dpy, GLXDrawable drawable) = 0;
- virtual void glXSwapIntervalEXTFn(Display* dpy,
- GLXDrawable drawable,
- int interval) = 0;
- virtual void glXSwapIntervalMESAFn(unsigned int interval) = 0;
- virtual void glXUseXFontFn(Font font, int first, int count, int list) = 0;
- virtual void glXWaitGLFn(void) = 0;
- virtual int glXWaitVideoSyncSGIFn(int divisor,
- int remainder,
- unsigned int* count) = 0;
- virtual void glXWaitXFn(void) = 0;
-};
-
-} // namespace gl
-
-#define glXBindTexImageEXT ::gl::g_current_glx_context->glXBindTexImageEXTFn
-#define glXChooseFBConfig ::gl::g_current_glx_context->glXChooseFBConfigFn
-#define glXChooseVisual ::gl::g_current_glx_context->glXChooseVisualFn
-#define glXCopyContext ::gl::g_current_glx_context->glXCopyContextFn
-#define glXCopySubBufferMESA ::gl::g_current_glx_context->glXCopySubBufferMESAFn
-#define glXCreateContext ::gl::g_current_glx_context->glXCreateContextFn
-#define glXCreateContextAttribsARB \
- ::gl::g_current_glx_context->glXCreateContextAttribsARBFn
-#define glXCreateGLXPixmap ::gl::g_current_glx_context->glXCreateGLXPixmapFn
-#define glXCreateNewContext ::gl::g_current_glx_context->glXCreateNewContextFn
-#define glXCreatePbuffer ::gl::g_current_glx_context->glXCreatePbufferFn
-#define glXCreatePixmap ::gl::g_current_glx_context->glXCreatePixmapFn
-#define glXCreateWindow ::gl::g_current_glx_context->glXCreateWindowFn
-#define glXDestroyContext ::gl::g_current_glx_context->glXDestroyContextFn
-#define glXDestroyGLXPixmap ::gl::g_current_glx_context->glXDestroyGLXPixmapFn
-#define glXDestroyPbuffer ::gl::g_current_glx_context->glXDestroyPbufferFn
-#define glXDestroyPixmap ::gl::g_current_glx_context->glXDestroyPixmapFn
-#define glXDestroyWindow ::gl::g_current_glx_context->glXDestroyWindowFn
-#define glXGetClientString ::gl::g_current_glx_context->glXGetClientStringFn
-#define glXGetConfig ::gl::g_current_glx_context->glXGetConfigFn
-#define glXGetCurrentContext ::gl::g_current_glx_context->glXGetCurrentContextFn
-#define glXGetCurrentDisplay ::gl::g_current_glx_context->glXGetCurrentDisplayFn
-#define glXGetCurrentDrawable \
- ::gl::g_current_glx_context->glXGetCurrentDrawableFn
-#define glXGetCurrentReadDrawable \
- ::gl::g_current_glx_context->glXGetCurrentReadDrawableFn
-#define glXGetFBConfigAttrib ::gl::g_current_glx_context->glXGetFBConfigAttribFn
-#define glXGetFBConfigFromVisualSGIX \
- ::gl::g_current_glx_context->glXGetFBConfigFromVisualSGIXFn
-#define glXGetFBConfigs ::gl::g_current_glx_context->glXGetFBConfigsFn
-#define glXGetMscRateOML ::gl::g_current_glx_context->glXGetMscRateOMLFn
-#define glXGetSelectedEvent ::gl::g_current_glx_context->glXGetSelectedEventFn
-#define glXGetSyncValuesOML ::gl::g_current_glx_context->glXGetSyncValuesOMLFn
-#define glXGetVisualFromFBConfig \
- ::gl::g_current_glx_context->glXGetVisualFromFBConfigFn
-#define glXIsDirect ::gl::g_current_glx_context->glXIsDirectFn
-#define glXMakeContextCurrent \
- ::gl::g_current_glx_context->glXMakeContextCurrentFn
-#define glXMakeCurrent ::gl::g_current_glx_context->glXMakeCurrentFn
-#define glXQueryContext ::gl::g_current_glx_context->glXQueryContextFn
-#define glXQueryDrawable ::gl::g_current_glx_context->glXQueryDrawableFn
-#define glXQueryExtension ::gl::g_current_glx_context->glXQueryExtensionFn
-#define glXQueryExtensionsString \
- ::gl::g_current_glx_context->glXQueryExtensionsStringFn
-#define glXQueryServerString ::gl::g_current_glx_context->glXQueryServerStringFn
-#define glXQueryVersion ::gl::g_current_glx_context->glXQueryVersionFn
-#define glXReleaseTexImageEXT \
- ::gl::g_current_glx_context->glXReleaseTexImageEXTFn
-#define glXSelectEvent ::gl::g_current_glx_context->glXSelectEventFn
-#define glXSwapBuffers ::gl::g_current_glx_context->glXSwapBuffersFn
-#define glXSwapIntervalEXT ::gl::g_current_glx_context->glXSwapIntervalEXTFn
-#define glXSwapIntervalMESA ::gl::g_current_glx_context->glXSwapIntervalMESAFn
-#define glXUseXFont ::gl::g_current_glx_context->glXUseXFontFn
-#define glXWaitGL ::gl::g_current_glx_context->glXWaitGLFn
-#define glXWaitVideoSyncSGI ::gl::g_current_glx_context->glXWaitVideoSyncSGIFn
-#define glXWaitX ::gl::g_current_glx_context->glXWaitXFn
-
-#endif // UI_GL_GL_BINDINGS_AUTOGEN_GLX_H_
diff --git a/ui/gl/gl_context_glx.cc b/ui/gl/gl_context_glx.cc
deleted file mode 100644
index f5ddf30..0000000
--- a/ui/gl/gl_context_glx.cc
+++ /dev/null
@@ -1,298 +0,0 @@
-// Copyright 2012 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gl/gl_context_glx.h"
-
-#include <memory>
-
-#include "base/command_line.h"
-#include "base/logging.h"
-#include "base/numerics/safe_conversions.h"
-#include "base/trace_event/trace_event.h"
-#include "ui/gfx/x/connection.h"
-#include "ui/gl/GL/glextchromium.h"
-#include "ui/gl/gl_bindings.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_surface_glx.h"
-
-#ifndef GLX_NV_robustness_video_memory_purge
-#define GLX_NV_robustness_video_memory_purge 1
-#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7
-#endif /* GLX_NV_robustness_video_memory_purge */
-
-namespace gl {
-
-namespace {
-
-using GLVersion = std::pair<int, int>;
-
-GLXContext CreateContextAttribs(x11::Connection* connection,
- GLXFBConfig config,
- GLXContext share,
- GLVersion version,
- int profile_mask) {
- std::vector<int> attribs;
-
- if (GLSurfaceGLX::IsCreateContextRobustnessSupported()) {
- attribs.push_back(GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB);
- attribs.push_back(GLX_LOSE_CONTEXT_ON_RESET_ARB);
-
- if (GLSurfaceGLX::IsRobustnessVideoMemoryPurgeSupported()) {
- attribs.push_back(GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV);
- attribs.push_back(GL_TRUE);
- }
- }
-
- if (version.first != 0 || version.second != 0) {
- attribs.push_back(GLX_CONTEXT_MAJOR_VERSION_ARB);
- attribs.push_back(version.first);
-
- attribs.push_back(GLX_CONTEXT_MINOR_VERSION_ARB);
- attribs.push_back(version.second);
- }
-
- if (profile_mask != 0 && GLSurfaceGLX::IsCreateContextProfileSupported()) {
- attribs.push_back(GLX_CONTEXT_PROFILE_MASK_ARB);
- attribs.push_back(profile_mask);
- }
-
- attribs.push_back(0);
-
- GLXContext context = glXCreateContextAttribsARB(
- connection->GetXlibDisplay(x11::XlibDisplayType::kSyncing), config, share,
- true, attribs.data());
-
- return context;
-}
-
-GLXContext CreateHighestVersionContext(x11::Connection* connection,
- GLXFBConfig config,
- GLXContext share) {
- // The only way to get a core profile context of the highest version using
- // glXCreateContextAttrib is to try creationg contexts in decreasing version
- // numbers. It might look that asking for a core context of version (0, 0)
- // works on some driver but it create a _compatibility_ context of the highest
- // version instead. The cost of failing a context creation is small (< 0.1 ms)
- // on Mesa but is unfortunately a bit expensive on the Nvidia driver (~3ms).
-
- // Also try to get any Desktop GL context, but if that fails fallback to
- // asking for OpenGL ES contexts.
-
- std::string client_vendor =
- glXGetClientString(connection->GetXlibDisplay(), GLX_VENDOR);
- bool is_mesa = client_vendor.find("Mesa") != std::string::npos;
-
- struct ContextCreationInfo {
- ContextCreationInfo(int profileFlag, GLVersion version)
- : profileFlag(profileFlag), version(version) {}
- int profileFlag;
- GLVersion version;
- };
-
- std::vector<ContextCreationInfo> contexts_to_try;
- contexts_to_try.emplace_back(GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
- GLVersion(4, 5));
- contexts_to_try.emplace_back(GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
- GLVersion(4, 4));
- contexts_to_try.emplace_back(GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
- GLVersion(4, 3));
- contexts_to_try.emplace_back(GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
- GLVersion(4, 2));
- contexts_to_try.emplace_back(GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
- GLVersion(4, 1));
- contexts_to_try.emplace_back(GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
- GLVersion(4, 0));
- contexts_to_try.emplace_back(GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
- GLVersion(3, 3));
-
- // On Mesa, do not try to create OpenGL context versions between 3.0 and
- // 3.2 because of compatibility problems. See crbug.com/659030
- if (!is_mesa) {
- contexts_to_try.emplace_back(0, GLVersion(3, 2));
- contexts_to_try.emplace_back(0, GLVersion(3, 1));
- contexts_to_try.emplace_back(0, GLVersion(3, 0));
- }
-
- contexts_to_try.emplace_back(0, GLVersion(2, 1));
- contexts_to_try.emplace_back(0, GLVersion(2, 0));
- contexts_to_try.emplace_back(0, GLVersion(1, 5));
- contexts_to_try.emplace_back(0, GLVersion(1, 4));
- contexts_to_try.emplace_back(0, GLVersion(1, 3));
- contexts_to_try.emplace_back(0, GLVersion(1, 2));
- contexts_to_try.emplace_back(0, GLVersion(1, 1));
- contexts_to_try.emplace_back(0, GLVersion(1, 0));
- contexts_to_try.emplace_back(GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
- GLVersion(3, 2));
- contexts_to_try.emplace_back(GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
- GLVersion(3, 1));
- contexts_to_try.emplace_back(GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
- GLVersion(3, 0));
- contexts_to_try.emplace_back(GLX_CONTEXT_ES2_PROFILE_BIT_EXT,
- GLVersion(2, 0));
-
- for (const auto& info : contexts_to_try) {
- if (!GLSurfaceGLX::IsCreateContextES2ProfileSupported() &&
- info.profileFlag == GLX_CONTEXT_ES2_PROFILE_BIT_EXT) {
- continue;
- }
- GLXContext context = CreateContextAttribs(connection, config, share,
- info.version, info.profileFlag);
- if (context != nullptr) {
- return context;
- }
- }
-
- return nullptr;
-}
-
-} // namespace
-
-GLContextGLX::GLContextGLX(GLShareGroup* share_group)
- : GLContextReal(share_group) {}
-
-bool GLContextGLX::Initialize(GLSurface* compatible_surface,
- const GLContextAttribs& attribs) {
- // webgl_compatibility_context and disabling bind_generates_resource are not
- // supported.
- DCHECK(!attribs.webgl_compatibility_context &&
- attribs.bind_generates_resource);
-
- connection_ = x11::Connection::Get();
-
- GLXContext share_handle = static_cast<GLXContext>(
- share_group() ? share_group()->GetHandle() : nullptr);
-
- if (GLSurfaceGLX::IsCreateContextSupported()) {
- DVLOG(1) << "GLX_ARB_create_context supported.";
- context_ = CreateHighestVersionContext(
- connection_, static_cast<GLXFBConfig>(compatible_surface->GetConfig()),
- share_handle);
- if (!context_) {
- LOG(ERROR) << "Failed to create GL context with "
- << "glXCreateContextAttribsARB.";
- return false;
- }
- } else {
- DVLOG(1) << "GLX_ARB_create_context not supported.";
- context_ = glXCreateNewContext(
- connection_->GetXlibDisplay(x11::XlibDisplayType::kSyncing),
- static_cast<GLXFBConfig>(compatible_surface->GetConfig()),
- GLX_RGBA_TYPE, share_handle, true);
- if (!context_) {
- LOG(ERROR) << "Failed to create GL context with glXCreateNewContext.";
- return false;
- }
- }
- DCHECK(context_);
- DVLOG(1) << " Successfully allocated "
- << (compatible_surface->IsOffscreen() ? "offscreen" : "onscreen")
- << " GL context with LOSE_CONTEXT_ON_RESET_ARB";
-
- DVLOG(1) << (compatible_surface->IsOffscreen() ? "Offscreen" : "Onscreen")
- << " context was "
- << (glXIsDirect(connection_->GetXlibDisplay(),
- static_cast<GLXContext>(context_))
- ? "direct"
- : "indirect")
- << ".";
-
- return true;
-}
-
-void GLContextGLX::Destroy() {
- if (context_) {
- glXDestroyContext(
- connection_->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- static_cast<GLXContext>(context_));
- context_ = nullptr;
- }
-}
-
-bool GLContextGLX::MakeCurrentImpl(GLSurface* surface) {
- DCHECK(context_);
- if (IsCurrent(surface))
- return true;
-
- ScopedReleaseCurrent release_current;
- TRACE_EVENT0("gpu", "GLContextGLX::MakeCurrent");
- if (!glXMakeContextCurrent(
- connection_->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- reinterpret_cast<GLXDrawable>(surface->GetHandle()),
- reinterpret_cast<GLXDrawable>(surface->GetHandle()),
- static_cast<GLXContext>(context_))) {
- LOG(ERROR) << "Couldn't make context current with X drawable.";
- return false;
- }
-
- // Set this as soon as the context is current, since we might call into GL.
- BindGLApi();
-
- SetCurrent(surface);
- InitializeDynamicBindings();
-
- if (!surface->OnMakeCurrent(this)) {
- LOG(ERROR) << "Could not make current.";
- return false;
- }
-
- release_current.Cancel();
- return true;
-}
-
-void GLContextGLX::ReleaseCurrent(GLSurface* surface) {
- if (!IsCurrent(surface))
- return;
-
- SetCurrent(nullptr);
- if (!glXMakeContextCurrent(
- connection_->GetXlibDisplay(x11::XlibDisplayType::kFlushing), 0, 0,
- nullptr)) {
- LOG(ERROR) << "glXMakeCurrent failed in ReleaseCurrent";
- }
-}
-
-bool GLContextGLX::IsCurrent(GLSurface* surface) {
- bool native_context_is_current =
- glXGetCurrentContext() == static_cast<GLXContext>(context_);
-
- // If our context is current then our notion of which GLContext is
- // current must be correct. On the other hand, third-party code
- // using OpenGL might change the current context.
- DCHECK(!native_context_is_current || (GetRealCurrent() == this));
-
- if (!native_context_is_current)
- return false;
-
- if (surface) {
- if (glXGetCurrentDrawable() !=
- reinterpret_cast<GLXDrawable>(surface->GetHandle())) {
- return false;
- }
- }
-
- return true;
-}
-
-void* GLContextGLX::GetHandle() {
- return context_;
-}
-
-unsigned int GLContextGLX::CheckStickyGraphicsResetStatusImpl() {
- DCHECK(IsCurrent(nullptr));
- DCHECK(g_current_gl_driver);
- const ExtensionsGL& ext = g_current_gl_driver->ext;
- if ((graphics_reset_status_ == GL_NO_ERROR) &&
- GLSurfaceGLX::IsCreateContextRobustnessSupported() &&
- (ext.b_GL_KHR_robustness || ext.b_GL_EXT_robustness ||
- ext.b_GL_ARB_robustness)) {
- graphics_reset_status_ = glGetGraphicsResetStatusARB();
- }
- return graphics_reset_status_;
-}
-
-GLContextGLX::~GLContextGLX() {
- Destroy();
-}
-
-} // namespace gl
diff --git a/ui/gl/gl_context_glx.h b/ui/gl/gl_context_glx.h
deleted file mode 100644
index 881426d5..0000000
--- a/ui/gl/gl_context_glx.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2012 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_GL_GL_CONTEXT_GLX_H_
-#define UI_GL_GL_CONTEXT_GLX_H_
-
-#include "base/memory/raw_ptr.h"
-#include "ui/gfx/x/connection.h"
-#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_export.h"
-
-namespace gl {
-
-class GLSurface;
-
-// Encapsulates a GLX OpenGL context.
-class GL_EXPORT GLContextGLX : public GLContextReal {
- public:
- explicit GLContextGLX(GLShareGroup* share_group);
-
- GLContextGLX(const GLContextGLX&) = delete;
- GLContextGLX& operator=(const GLContextGLX&) = delete;
-
- // Implement GLContext.
- bool Initialize(GLSurface* compatible_surface,
- const GLContextAttribs& attribs) override;
- bool MakeCurrentImpl(GLSurface* surface) override;
- void ReleaseCurrent(GLSurface* surface) override;
- bool IsCurrent(GLSurface* surface) override;
- void* GetHandle() override;
- unsigned int CheckStickyGraphicsResetStatusImpl() override;
-
- protected:
- ~GLContextGLX() override;
-
- private:
- void Destroy();
-
- raw_ptr<void> context_ = nullptr;
- raw_ptr<x11::Connection> connection_ = nullptr;
- unsigned int graphics_reset_status_ = 0; // GL_NO_ERROR
-};
-
-} // namespace gl
-
-#endif // UI_GL_GL_CONTEXT_GLX_H_
diff --git a/ui/gl/gl_display.cc b/ui/gl/gl_display.cc
index 98370fc..846d968 100644
--- a/ui/gl/gl_display.cc
+++ b/ui/gl/gl_display.cc
@@ -27,10 +27,6 @@
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_surface.h"
-#if defined(USE_GLX)
-#include "ui/gl/glx_util.h"
-#endif // defined(USE_GLX)
-
#if BUILDFLAG(IS_OZONE)
#include "ui/ozone/buildflags.h"
#endif // BUILDFLAG(IS_OZONE)
@@ -688,12 +684,6 @@
type_checked = std::is_same<GLDisplayPlatform, GLDisplayEGL>::value;
#endif // defined(USE_EGL)
break;
-
- case X11:
-#if defined(USE_GLX)
- type_checked = std::is_same<GLDisplayPlatform, GLDisplayX11>::value;
-#endif // defined(USE_GLX)
- break;
}
if (type_checked)
return static_cast<GLDisplayPlatform*>(this);
@@ -706,11 +696,6 @@
GLDisplayEGL* GLDisplay::GetAs<GLDisplayEGL>();
#endif // defined(USE_EGL)
-#if defined(USE_GLX)
-template EXPORT_TEMPLATE_DEFINE(GL_EXPORT)
- GLDisplayX11* GLDisplay::GetAs<GLDisplayX11>();
-#endif // defined(USE_GLX)
-
#if defined(USE_EGL)
GLDisplayEGL::EGLGpuSwitchingObserver::EGLGpuSwitchingObserver(
EGLDisplay display)
@@ -1033,21 +1018,4 @@
}
#endif // defined(USE_EGL)
-#if defined(USE_GLX)
-GLDisplayX11::GLDisplayX11(uint64_t system_device_id)
- : GLDisplay(system_device_id, X11) {}
-
-GLDisplayX11::~GLDisplayX11() = default;
-
-void* GLDisplayX11::GetDisplay() const {
- return x11::Connection::Get()->GetXlibDisplay();
-}
-
-void GLDisplayX11::Shutdown() {}
-
-bool GLDisplayX11::IsInitialized() const {
- return true;
-}
-#endif // defined(USE_GLX)
-
} // namespace gl
diff --git a/ui/gl/gl_display.h b/ui/gl/gl_display.h
index c781127..42dd29c 100644
--- a/ui/gl/gl_display.h
+++ b/ui/gl/gl_display.h
@@ -78,7 +78,6 @@
enum DisplayPlatform {
NONE = 0,
EGL = 1,
- X11 = 2,
};
GL_EXPORT void GetEGLInitDisplaysForTesting(
@@ -194,25 +193,6 @@
};
#endif // defined(USE_EGL)
-#if defined(USE_GLX)
-class GL_EXPORT GLDisplayX11 : public GLDisplay {
- public:
- GLDisplayX11(const GLDisplayX11&) = delete;
- GLDisplayX11& operator=(const GLDisplayX11&) = delete;
-
- ~GLDisplayX11() override;
-
- void* GetDisplay() const override;
- void Shutdown() override;
- bool IsInitialized() const override;
-
- private:
- friend class GLDisplayManager<GLDisplayX11>;
-
- explicit GLDisplayX11(uint64_t system_device_id);
-};
-#endif // defined(USE_GLX)
-
} // namespace gl
#endif // UI_GL_GL_DISPLAY_H_
diff --git a/ui/gl/gl_glx_api_implementation.cc b/ui/gl/gl_glx_api_implementation.cc
deleted file mode 100644
index 7cfe05f..0000000
--- a/ui/gl/gl_glx_api_implementation.cc
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright 2012 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gl/gl_glx_api_implementation.h"
-
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "ui/gfx/x/connection.h"
-#include "ui/gfx/x/future.h"
-#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_implementation_wrapper.h"
-#include "ui/gl/gl_surface_glx.h"
-#include "ui/gl/gl_version_info.h"
-
-namespace gl {
-
-GL_IMPL_WRAPPER_TYPE(GLX) * g_glx_wrapper = nullptr;
-
-void InitializeStaticGLBindingsGLX() {
- g_driver_glx.InitializeStaticBindings();
- if (!g_glx_wrapper) {
- auto real_api = std::make_unique<RealGLXApi>();
- real_api->Initialize(&g_driver_glx);
- g_glx_wrapper = new GL_IMPL_WRAPPER_TYPE(GLX)(std::move(real_api));
- }
-
- g_current_glx_context = g_glx_wrapper->api();
-}
-
-void ClearBindingsGLX() {
- delete g_glx_wrapper;
- g_glx_wrapper = nullptr;
-
- g_current_glx_context = nullptr;
- g_driver_glx.ClearBindings();
-}
-
-GLXApi::GLXApi() = default;
-
-GLXApi::~GLXApi() = default;
-
-GLXApiBase::GLXApiBase() : driver_(nullptr) {}
-
-GLXApiBase::~GLXApiBase() = default;
-
-void GLXApiBase::InitializeBase(DriverGLX* driver) {
- driver_ = driver;
-}
-
-RealGLXApi::RealGLXApi() = default;
-
-RealGLXApi::~RealGLXApi() = default;
-
-void RealGLXApi::Initialize(DriverGLX* driver) {
- InitializeBase(driver);
-}
-
-void RealGLXApi::SetDisabledExtensions(const std::string& disabled_extensions) {
- disabled_exts_.clear();
- filtered_exts_ = "";
- if (!disabled_extensions.empty()) {
- disabled_exts_ =
- base::SplitString(disabled_extensions, ", ;", base::KEEP_WHITESPACE,
- base::SPLIT_WANT_NONEMPTY);
- }
-}
-
-const char* RealGLXApi::glXQueryExtensionsStringFn(Display* dpy, int screen) {
- if (filtered_exts_.size())
- return filtered_exts_.c_str();
-
- if (!driver_->fn.glXQueryExtensionsStringFn)
- return nullptr;
- const char* str = GLXApiBase::glXQueryExtensionsStringFn(dpy, screen);
- if (!str)
- return nullptr;
-
- filtered_exts_ = FilterGLExtensionList(str, disabled_exts_);
- return filtered_exts_.c_str();
-}
-
-LogGLXApi::LogGLXApi(GLXApi* glx_api) : glx_api_(glx_api) {}
-
-LogGLXApi::~LogGLXApi() = default;
-
-void LogGLXApi::SetDisabledExtensions(const std::string& disabled_extensions) {
- if (glx_api_) {
- glx_api_->SetDisabledExtensions(disabled_extensions);
- }
-}
-
-TraceGLXApi::~TraceGLXApi() = default;
-
-void TraceGLXApi::SetDisabledExtensions(
- const std::string& disabled_extensions) {
- if (glx_api_) {
- glx_api_->SetDisabledExtensions(disabled_extensions);
- }
-}
-
-bool GetGLWindowSystemBindingInfoGLX(const GLVersionInfo& gl_info,
- GLWindowSystemBindingInfo* info) {
- auto* connection = x11::Connection::Get();
- auto* display = connection->GetXlibDisplay().display();
- const int screen = connection->DefaultScreenId();
- const char* vendor = glXQueryServerString(display, screen, GLX_VENDOR);
- const char* version = glXQueryServerString(display, screen, GLX_VERSION);
- const char* extensions = glXQueryExtensionsString(display, screen);
- *info = GLWindowSystemBindingInfo();
- if (vendor)
- info->vendor = vendor;
- if (version)
- info->version = version;
- if (extensions)
- info->extensions = extensions;
- if (glXIsDirect(display, glXGetCurrentContext())) {
- info->direct_rendering_version = "2";
- bool using_mesa = gl_info.driver_vendor.find("Mesa") != std::string::npos ||
- gl_info.driver_version.find("Mesa") != std::string::npos;
- if (using_mesa) {
- std::vector<std::string> split_version =
- base::SplitString(gl_info.driver_version, ".", base::TRIM_WHITESPACE,
- base::SPLIT_WANT_ALL);
- unsigned major_num = 0;
- base::StringToUint(split_version[0], &major_num);
- // Mesa after version 17 will reliably use DRI3 when available.
-
- if (major_num >= 17 && connection->QueryExtension("DRI3").Sync())
- info->direct_rendering_version = "2.3";
- else if (connection->QueryExtension("DRI2").Sync())
- info->direct_rendering_version = "2.2";
- else if (connection->QueryExtension("DRI").Sync())
- info->direct_rendering_version = "2.1";
- }
- } else {
- info->direct_rendering_version = "1";
- }
- return true;
-}
-
-void SetDisabledExtensionsGLX(const std::string& disabled_extensions) {
- DCHECK(g_current_glx_context);
- DCHECK(GLContext::TotalGLContexts() == 0);
- g_current_glx_context->SetDisabledExtensions(disabled_extensions);
-}
-
-bool InitializeExtensionSettingsOneOffGLX() {
- return GLSurfaceGLX::InitializeExtensionSettingsOneOff();
-}
-
-} // namespace gl
diff --git a/ui/gl/gl_glx_api_implementation.h b/ui/gl/gl_glx_api_implementation.h
deleted file mode 100644
index 4fa41d74..0000000
--- a/ui/gl/gl_glx_api_implementation.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2012 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_GL_GL_GLX_API_IMPLEMENTATION_H_
-#define UI_GL_GL_GLX_API_IMPLEMENTATION_H_
-
-#include <string>
-#include <vector>
-
-#include "base/memory/raw_ptr.h"
-#include "gl_bindings.h"
-#include "ui/gl/gl_export.h"
-
-namespace gl {
-
-struct GLVersionInfo;
-struct GLWindowSystemBindingInfo;
-
-GL_EXPORT void InitializeStaticGLBindingsGLX();
-GL_EXPORT void ClearBindingsGLX();
-GL_EXPORT bool GetGLWindowSystemBindingInfoGLX(const GLVersionInfo& gl_info,
- GLWindowSystemBindingInfo* info);
-GL_EXPORT void SetDisabledExtensionsGLX(const std::string& disabled_extensions);
-GL_EXPORT bool InitializeExtensionSettingsOneOffGLX();
-
-class GL_EXPORT GLXApiBase : public GLXApi {
- public:
- // Include the auto-generated part of this class. We split this because
- // it means we can easily edit the non-auto generated parts right here in
- // this file instead of having to edit some template or the code generator.
- #include "gl_bindings_api_autogen_glx.h"
-
- protected:
- GLXApiBase();
- ~GLXApiBase() override;
- void InitializeBase(DriverGLX* driver);
-
- raw_ptr<DriverGLX> driver_;
-};
-
-class GL_EXPORT RealGLXApi : public GLXApiBase {
- public:
- RealGLXApi();
- ~RealGLXApi() override;
- void Initialize(DriverGLX* driver);
- void SetDisabledExtensions(const std::string& disabled_extensions) override;
-
- const char* glXQueryExtensionsStringFn(Display* dpy, int screen) override;
- private:
-
- std::vector<std::string> disabled_exts_;
- std::string filtered_exts_;
-};
-
-// Logs debug information for every GLX call.
-class GL_EXPORT LogGLXApi : public GLXApi {
- public:
- LogGLXApi(GLXApi* glx_api);
- ~LogGLXApi() override;
-
- void SetDisabledExtensions(const std::string& disabled_extensions) override;
-
- // Include the auto-generated part of this class. We split this because
- // it means we can easily edit the non-auto generated parts right here in
- // this file instead of having to edit some template or the code generator.
- #include "gl_bindings_api_autogen_glx.h"
-
- private:
- raw_ptr<GLXApi> glx_api_;
-};
-
-// Inserts a TRACE for every GLX call.
-class GL_EXPORT TraceGLXApi : public GLXApi {
- public:
- TraceGLXApi(GLXApi* glx_api) : glx_api_(glx_api) { }
- ~TraceGLXApi() override;
-
- void SetDisabledExtensions(const std::string& disabled_extensions) override;
-
- // Include the auto-generated part of this class. We split this because
- // it means we can easily edit the non-auto generated parts right here in
- // this file instead of having to edit some template or the code generator.
- #include "gl_bindings_api_autogen_glx.h"
-
- private:
- raw_ptr<GLXApi> glx_api_;
-};
-
-} // namespace gl
-
-#endif // UI_GL_GL_GLX_API_IMPLEMENTATION_H_
diff --git a/ui/gl/gl_image_egl_pixmap.cc b/ui/gl/gl_image_egl_pixmap.cc
index 3d2f1c6a..337ed14 100644
--- a/ui/gl/gl_image_egl_pixmap.cc
+++ b/ui/gl/gl_image_egl_pixmap.cc
@@ -9,7 +9,6 @@
#include "ui/gfx/x/connection.h"
#include "ui/gl/buffer_format_utils.h"
#include "ui/gl/gl_bindings.h"
-#include "ui/gl/gl_surface_glx.h"
namespace gl {
@@ -63,7 +62,7 @@
EGL_TEXTURE_TARGET, EGL_TEXTURE_2D, EGL_NONE};
surface_ = eglCreatePixmapSurface(
- display_, config, static_cast<::Pixmap>(pixmap), attrs.data());
+ display_, config, static_cast<EGLNativePixmapType>(pixmap), attrs.data());
return surface_ != EGL_NO_SURFACE;
}
diff --git a/ui/gl/gl_image_glx.cc b/ui/gl/gl_image_glx.cc
deleted file mode 100644
index f74f4c7..0000000
--- a/ui/gl/gl_image_glx.cc
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright 2012 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <dlfcn.h>
-
-#include <memory>
-
-#include "base/logging.h"
-#include "ui/base/x/visual_picker_glx.h"
-#include "ui/gl/buffer_format_utils.h"
-#include "ui/gl/gl_bindings.h"
-#include "ui/gl/gl_image_glx.h"
-#include "ui/gl/gl_surface_glx.h"
-#include "ui/gl/glx_util.h"
-
-namespace gl {
-namespace {
-
-int TextureFormat(gfx::BufferFormat format) {
- switch (format) {
- case gfx::BufferFormat::BGR_565:
- case gfx::BufferFormat::BGRX_8888:
- case gfx::BufferFormat::BGRA_1010102:
- return GLX_TEXTURE_FORMAT_RGB_EXT;
- case gfx::BufferFormat::BGRA_8888:
- return GLX_TEXTURE_FORMAT_RGBA_EXT;
- default:
- NOTREACHED();
- return 0;
- }
-}
-
-} // namespace
-
-GLImageGLX::GLImageGLX(const gfx::Size& size, gfx::BufferFormat format)
- : glx_pixmap_(0), size_(size), format_(format) {}
-
-GLImageGLX::~GLImageGLX() {
- if (glx_pixmap_) {
- glXDestroyGLXPixmap(
- x11::Connection::Get()->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- glx_pixmap_);
- }
-}
-
-bool GLImageGLX::Initialize(x11::Pixmap pixmap) {
- auto fbconfig_id =
- ui::VisualPickerGlx::GetInstance()->GetFbConfigForFormat(format_);
-
- auto* connection = x11::Connection::Get();
- GLXFBConfig config = GetGlxFbConfigForXProtoFbConfig(connection, fbconfig_id);
- if (!config)
- return false;
-
- int pixmap_attribs[] = {GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
- GLX_TEXTURE_FORMAT_EXT, TextureFormat(format_), 0};
- glx_pixmap_ = glXCreatePixmap(
- x11::Connection::Get()->GetXlibDisplay(x11::XlibDisplayType::kSyncing),
- config, static_cast<::Pixmap>(pixmap), pixmap_attribs);
- if (!glx_pixmap_) {
- DVLOG(0) << "glXCreatePixmap failed.";
- return false;
- }
-
- return true;
-}
-
-gfx::Size GLImageGLX::GetSize() {
- return size_;
-}
-
-unsigned GLImageGLX::GetInternalFormat() {
- return gl::BufferFormatToGLInternalFormat(format_);
-}
-
-unsigned GLImageGLX::GetDataType() {
- return GL_UNSIGNED_BYTE;
-}
-
-GLImageGLX::BindOrCopy GLImageGLX::ShouldBindOrCopy() {
- return BIND;
-}
-
-bool GLImageGLX::BindTexImage(unsigned target) {
- if (!glx_pixmap_)
- return false;
-
- // Requires TEXTURE_2D target.
- if (target != GL_TEXTURE_2D)
- return false;
-
- glXBindTexImageEXT(
- x11::Connection::Get()->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- glx_pixmap_, GLX_FRONT_LEFT_EXT, nullptr);
- return true;
-}
-
-void GLImageGLX::ReleaseTexImage(unsigned target) {
- DCHECK_NE(0u, glx_pixmap_);
- DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), target);
-
- glXReleaseTexImageEXT(
- x11::Connection::Get()->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- glx_pixmap_, GLX_FRONT_LEFT_EXT);
-}
-
-bool GLImageGLX::CopyTexImage(unsigned target) {
- NOTREACHED();
- return false;
-}
-
-bool GLImageGLX::CopyTexSubImage(unsigned target,
- const gfx::Point& offset,
- const gfx::Rect& rect) {
- return false;
-}
-
-void GLImageGLX::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
- uint64_t process_tracing_id,
- const std::string& dump_name) {
- // TODO(ericrk): Implement GLImage OnMemoryDump. crbug.com/514914
-}
-
-} // namespace gl
diff --git a/ui/gl/gl_image_glx.h b/ui/gl/gl_image_glx.h
deleted file mode 100644
index 12b1d45..0000000
--- a/ui/gl/gl_image_glx.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2012 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_GL_GL_IMAGE_GLX_H_
-#define UI_GL_GL_IMAGE_GLX_H_
-
-#include <stdint.h>
-
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/x/glx.h"
-#include "ui/gl/gl_export.h"
-#include "ui/gl/gl_image.h"
-
-namespace gl {
-
-class GL_EXPORT GLImageGLX : public GLImage {
- public:
- GLImageGLX(const gfx::Size& size, gfx::BufferFormat format);
-
- GLImageGLX(const GLImageGLX&) = delete;
- GLImageGLX& operator=(const GLImageGLX&) = delete;
-
- bool Initialize(x11::Pixmap pixmap);
-
- // Overridden from GLImage:
- gfx::Size GetSize() override;
- unsigned GetInternalFormat() override;
- unsigned GetDataType() override;
- BindOrCopy ShouldBindOrCopy() override;
- bool BindTexImage(unsigned target) override;
- void ReleaseTexImage(unsigned target) override;
- bool CopyTexImage(unsigned target) override;
- bool CopyTexSubImage(unsigned target,
- const gfx::Point& offset,
- const gfx::Rect& rect) override;
- void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
- uint64_t process_tracing_id,
- const std::string& dump_name) override;
-
- protected:
- ~GLImageGLX() override;
-
- gfx::BufferFormat format() const { return format_; }
-
- private:
- uint32_t glx_pixmap_;
- const gfx::Size size_;
- gfx::BufferFormat format_;
-};
-
-} // namespace gl
-
-#endif // UI_GL_GL_IMAGE_GLX_H_
diff --git a/ui/gl/gl_image_glx_native_pixmap.cc b/ui/gl/gl_image_glx_native_pixmap.cc
deleted file mode 100644
index e0d0fdd8..0000000
--- a/ui/gl/gl_image_glx_native_pixmap.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2020 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gl/gl_image_glx_native_pixmap.h"
-
-#include "ui/gfx/buffer_types.h"
-#include "ui/gfx/linux/native_pixmap_dmabuf.h"
-#include "ui/gfx/x/connection.h"
-#include "ui/gfx/x/dri3.h"
-#include "ui/gfx/x/glx.h"
-#include "ui/gl/buffer_format_utils.h"
-#include "ui/gl/glx_util.h"
-
-namespace gl {
-
-GLImageGLXNativePixmap::GLImageGLXNativePixmap(const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferPlane plane)
- : GLImageGLX(size, format) {
- DCHECK_EQ(plane, gfx::BufferPlane::DEFAULT);
-}
-
-GLImageGLXNativePixmap::~GLImageGLXNativePixmap() = default;
-
-bool GLImageGLXNativePixmap::Initialize(
- scoped_refptr<gfx::NativePixmap> pixmap) {
- native_pixmap_ = pixmap;
-
- return GLImageGLX::Initialize(XPixmapFromNativePixmap(
- *static_cast<gfx::NativePixmapDmaBuf*>(native_pixmap_.get()), format()));
-}
-
-bool GLImageGLXNativePixmap::CanImportNativePixmap() {
- auto* conn = x11::Connection::Get();
- return conn->dri3().present() && conn->glx().present();
-}
-
-} // namespace gl
diff --git a/ui/gl/gl_image_glx_native_pixmap.h b/ui/gl/gl_image_glx_native_pixmap.h
deleted file mode 100644
index 7287b81..0000000
--- a/ui/gl/gl_image_glx_native_pixmap.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2020 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_GL_GL_IMAGE_GLX_NATIVE_PIXMAP_H_
-#define UI_GL_GL_IMAGE_GLX_NATIVE_PIXMAP_H_
-
-#include "base/memory/scoped_refptr.h"
-#include "ui/gfx/buffer_types.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/native_pixmap.h"
-#include "ui/gl/gl_export.h"
-#include "ui/gl/gl_image_glx.h"
-
-namespace gl {
-
-class GL_EXPORT GLImageGLXNativePixmap : public GLImageGLX {
- public:
- GLImageGLXNativePixmap(const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferPlane plane = gfx::BufferPlane::DEFAULT);
-
- GLImageGLXNativePixmap(const GLImageGLXNativePixmap&) = delete;
- GLImageGLXNativePixmap& operator=(const GLImageGLXNativePixmap&) = delete;
-
- bool Initialize(scoped_refptr<gfx::NativePixmap> pixmap);
-
- static bool CanImportNativePixmap();
-
- protected:
- ~GLImageGLXNativePixmap() override;
-
- private:
- scoped_refptr<gfx::NativePixmap> native_pixmap_;
-};
-
-} // namespace gl
-
-#endif // UI_GL_GL_IMAGE_GLX_NATIVE_PIXMAP_H_
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
deleted file mode 100644
index f31cd81..0000000
--- a/ui/gl/gl_surface_glx.cc
+++ /dev/null
@@ -1,924 +0,0 @@
-// Copyright 2012 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gl/gl_surface_glx.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/lazy_instance.h"
-#include "base/logging.h"
-#include "base/memory/raw_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "base/no_destructor.h"
-#include "base/synchronization/atomic_flag.h"
-#include "base/synchronization/lock.h"
-#include "base/task/single_thread_task_runner.h"
-#include "base/threading/thread.h"
-#include "base/threading/thread_checker.h"
-#include "base/time/time.h"
-#include "base/trace_event/trace_event.h"
-#include "build/build_config.h"
-#include "ui/base/x/visual_picker_glx.h"
-#include "ui/base/x/x11_display_util.h"
-#include "ui/base/x/x11_util.h"
-#include "ui/base/x/x11_xrandr_interval_only_vsync_provider.h"
-#include "ui/events/platform/platform_event_source.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/x/xproto_util.h"
-#include "ui/gl/gl_bindings.h"
-#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_display.h"
-#include "ui/gl/gl_display_manager.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_surface_presentation_helper.h"
-#include "ui/gl/glx_util.h"
-#include "ui/gl/sync_control_vsync_provider.h"
-
-namespace gl {
-
-namespace {
-
-bool g_glx_context_create = false;
-bool g_glx_create_context_robustness_supported = false;
-bool g_glx_robustness_video_memory_purge_supported = false;
-bool g_glx_create_context_profile_supported = false;
-bool g_glx_create_context_profile_es2_supported = false;
-bool g_glx_texture_from_pixmap_supported = false;
-bool g_glx_oml_sync_control_supported = false;
-
-// Track support of glXGetMscRateOML separately from GLX_OML_sync_control as a
-// whole since on some platforms (e.g. crosbug.com/34585), glXGetMscRateOML
-// always fails even though GLX_OML_sync_control is reported as being supported.
-bool g_glx_get_msc_rate_oml_supported = false;
-bool g_glx_ext_swap_control_supported = false;
-bool g_glx_mesa_swap_control_supported = false;
-bool g_glx_sgi_video_sync_supported = false;
-
-// A 24-bit RGB visual and colormap to use when creating offscreen surfaces.
-x11::VisualId g_visual{};
-int g_depth = static_cast<int>(x11::WindowClass::CopyFromParent);
-x11::ColorMap g_colormap{};
-
-bool CreateDummyWindow(x11::Connection* conn) {
- DCHECK(conn);
- auto parent_window = conn->default_root();
- auto window = conn->GenerateId<x11::Window>();
- auto create_window = conn->CreateWindow(x11::CreateWindowRequest{
- .wid = window,
- .parent = parent_window,
- .width = 1,
- .height = 1,
- .c_class = x11::WindowClass::InputOutput,
- });
- if (create_window.Sync().error) {
- LOG(ERROR) << "Failed to create window";
- return false;
- }
- GLXFBConfig config = GetFbConfigForWindow(conn, window);
- if (!config) {
- LOG(ERROR) << "Failed to get GLXConfig";
- conn->DestroyWindow({window});
- return false;
- }
-
- GLXWindow glx_window = glXCreateWindow(
- conn->GetXlibDisplay(), config, static_cast<uint32_t>(window), nullptr);
- if (!glx_window) {
- LOG(ERROR) << "glXCreateWindow failed";
- conn->DestroyWindow({window});
- return false;
- }
- glXDestroyWindow(conn->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- glx_window);
- conn->DestroyWindow({window});
- return true;
-}
-
-class OMLSyncControlVSyncProvider : public SyncControlVSyncProvider {
- public:
- explicit OMLSyncControlVSyncProvider(GLXWindow glx_window)
- : SyncControlVSyncProvider(), glx_window_(glx_window) {}
-
- OMLSyncControlVSyncProvider(const OMLSyncControlVSyncProvider&) = delete;
- OMLSyncControlVSyncProvider& operator=(const OMLSyncControlVSyncProvider&) =
- delete;
-
- ~OMLSyncControlVSyncProvider() override = default;
-
- protected:
- bool GetSyncValues(int64_t* system_time,
- int64_t* media_stream_counter,
- int64_t* swap_buffer_counter) override {
- x11::Connection::Get()->Flush();
- return glXGetSyncValuesOML(x11::Connection::Get()->GetXlibDisplay(),
- glx_window_, system_time, media_stream_counter,
- swap_buffer_counter);
- }
-
- bool GetMscRate(int32_t* numerator, int32_t* denominator) override {
- if (!g_glx_get_msc_rate_oml_supported)
- return false;
-
- if (!glXGetMscRateOML(x11::Connection::Get()->GetXlibDisplay(), glx_window_,
- numerator, denominator)) {
- // Once glXGetMscRateOML has been found to fail, don't try again,
- // since each failing call may spew an error message.
- g_glx_get_msc_rate_oml_supported = false;
- return false;
- }
-
- return true;
- }
-
- bool IsHWClock() const override { return true; }
-
- private:
- GLXWindow glx_window_;
-};
-
-class SGIVideoSyncThread : public base::Thread,
- public base::RefCounted<SGIVideoSyncThread> {
- public:
- // Create a connection to the X server for use on g_video_sync_thread before
- // the sandbox starts.
- static bool InitializeBeforeSandboxStarts() {
- auto* connection = GetConnectionImpl();
- if (!connection || !connection->Ready())
- return false;
-
- if (!CreateDummyWindow(connection)) {
- LOG(ERROR) << "CreateDummyWindow(display) failed";
- return false;
- }
- connection->DetachFromSequence();
- return true;
- }
-
- static scoped_refptr<SGIVideoSyncThread> Create() {
- if (!g_video_sync_thread) {
- g_video_sync_thread = new SGIVideoSyncThread();
- g_video_sync_thread->Start();
- }
- return g_video_sync_thread;
- }
-
- SGIVideoSyncThread(const SGIVideoSyncThread&) = delete;
- SGIVideoSyncThread& operator=(const SGIVideoSyncThread&) = delete;
-
- x11::Connection* GetConnection() {
- DCHECK(task_runner()->BelongsToCurrentThread());
- return GetConnectionImpl();
- }
-
- void MaybeCreateGLXContext(GLXFBConfig config) {
- DCHECK(task_runner()->BelongsToCurrentThread());
- if (!context_) {
- context_ = glXCreateNewContext(
- GetConnection()->GetXlibDisplay(x11::XlibDisplayType::kSyncing),
- config, GLX_RGBA_TYPE, nullptr, true);
- }
- LOG_IF(ERROR, !context_) << "video_sync: glXCreateNewContext failed";
- }
-
- // Destroy |context_| on the thread where it is used.
- void CleanUp() override {
- DCHECK(task_runner()->BelongsToCurrentThread());
- if (context_)
- glXDestroyContext(
- GetConnection()->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- context_);
- // Release the connection from this thread's sequence so that a new
- // SGIVideoSyncThread can reuse the connection. The connection must be
- // reused since it can only be created before sandbox initialization.
- GetConnection()->DetachFromSequence();
- }
-
- GLXContext GetGLXContext() {
- DCHECK(task_runner()->BelongsToCurrentThread());
- return context_;
- }
-
- private:
- friend class base::RefCounted<SGIVideoSyncThread>;
-
- SGIVideoSyncThread() : base::Thread("SGI_video_sync") {
- DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
- }
-
- ~SGIVideoSyncThread() override {
- DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
- g_video_sync_thread = nullptr;
- Stop();
- }
-
- static x11::Connection* GetConnectionImpl() {
- if (!g_connection)
- g_connection = x11::Connection::Get()->Clone().release();
- return g_connection;
- }
-
- static SGIVideoSyncThread* g_video_sync_thread;
- static x11::Connection* g_connection;
- GLXContext context_ = nullptr;
-
- THREAD_CHECKER(thread_checker_);
-};
-
-class SGIVideoSyncProviderThreadShim {
- public:
- SGIVideoSyncProviderThreadShim(gfx::AcceleratedWidget parent_window,
- SGIVideoSyncThread* vsync_thread)
- : parent_window_(parent_window),
- vsync_thread_(vsync_thread),
- glx_window_(0),
- task_runner_(base::SingleThreadTaskRunner::GetCurrentDefault()),
- cancel_vsync_flag_(),
- vsync_lock_() {
- // This ensures that creation of |parent_window_| has occured when this shim
- // is executing in the same thread as the call to create |parent_window_|.
- x11::Connection::Get()->Sync();
- }
-
- SGIVideoSyncProviderThreadShim(const SGIVideoSyncProviderThreadShim&) =
- delete;
- SGIVideoSyncProviderThreadShim& operator=(
- const SGIVideoSyncProviderThreadShim&) = delete;
-
- ~SGIVideoSyncProviderThreadShim() {
- auto* connection = vsync_thread_->GetConnection();
- if (glx_window_) {
- glXDestroyWindow(
- connection->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- glx_window_);
- }
-
- if (window_ != x11::Window::None)
- connection->DestroyWindow({window_});
- }
-
- base::AtomicFlag* cancel_vsync_flag() { return &cancel_vsync_flag_; }
-
- base::Lock* vsync_lock() { return &vsync_lock_; }
-
- void Initialize() {
- auto* connection = vsync_thread_->GetConnection();
- DCHECK(connection);
-
- auto window = connection->GenerateId<x11::Window>();
- auto req = connection->CreateWindow(x11::CreateWindowRequest{
- .wid = window,
- .parent = static_cast<x11::Window>(parent_window_),
- .width = 1,
- .height = 1,
- .c_class = x11::WindowClass::InputOutput,
- });
- if (req.Sync().error) {
- LOG(ERROR) << "video_sync: XCreateWindow failed";
- return;
- }
- window_ = window;
-
- GLXFBConfig config = GetFbConfigForWindow(connection, window_);
- if (!config) {
- LOG(ERROR) << "video_sync: Failed to get GLXConfig";
- return;
- }
-
- glx_window_ = glXCreateWindow(
- connection->GetXlibDisplay(x11::XlibDisplayType::kSyncing), config,
- static_cast<uint32_t>(window_), nullptr);
- if (!glx_window_) {
- LOG(ERROR) << "video_sync: glXCreateWindow failed";
- return;
- }
-
- vsync_thread_->MaybeCreateGLXContext(config);
- }
-
- void GetVSyncParameters(gfx::VSyncProvider::UpdateVSyncCallback callback) {
- // Don't allow |window_| destruction while we're probing vsync.
- base::AutoLock locked(vsync_lock_);
-
- if (!vsync_thread_->GetGLXContext() || cancel_vsync_flag_.IsSet())
- return;
-
- base::TimeDelta interval = ui::GetPrimaryDisplayRefreshIntervalFromXrandr();
-
- auto* connection = vsync_thread_->GetConnection();
- glXMakeContextCurrent(
- connection->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- glx_window_, glx_window_, vsync_thread_->GetGLXContext());
-
- unsigned int retrace_count = 0;
- if (glXWaitVideoSyncSGI(1, 0, &retrace_count) != 0)
- return;
-
- base::TimeTicks now = base::TimeTicks::Now();
- TRACE_EVENT_INSTANT0("gpu", "vblank", TRACE_EVENT_SCOPE_THREAD);
-
- glXMakeContextCurrent(
- connection->GetXlibDisplay(x11::XlibDisplayType::kFlushing), 0, 0,
- nullptr);
-
- task_runner_->PostTask(FROM_HERE,
- base::BindOnce(std::move(callback), now, interval));
- }
-
- private:
- gfx::AcceleratedWidget parent_window_;
- raw_ptr<SGIVideoSyncThread> vsync_thread_;
- x11::Window window_ = x11::Window::None;
- GLXWindow glx_window_;
-
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-
- base::AtomicFlag cancel_vsync_flag_;
- base::Lock vsync_lock_;
-};
-
-class SGIVideoSyncVSyncProvider
- : public gfx::VSyncProvider,
- public base::SupportsWeakPtr<SGIVideoSyncVSyncProvider> {
- public:
- explicit SGIVideoSyncVSyncProvider(gfx::AcceleratedWidget parent_window)
- : vsync_thread_(SGIVideoSyncThread::Create()),
- shim_(new SGIVideoSyncProviderThreadShim(parent_window,
- vsync_thread_.get())),
- cancel_vsync_flag_(shim_->cancel_vsync_flag()),
- vsync_lock_(shim_->vsync_lock()) {
- vsync_thread_->task_runner()->PostTask(
- FROM_HERE, base::BindOnce(&SGIVideoSyncProviderThreadShim::Initialize,
- base::Unretained(shim_.get())));
- }
-
- SGIVideoSyncVSyncProvider(const SGIVideoSyncVSyncProvider&) = delete;
- SGIVideoSyncVSyncProvider& operator=(const SGIVideoSyncVSyncProvider&) =
- delete;
-
- ~SGIVideoSyncVSyncProvider() override {
- {
- base::AutoLock locked(*vsync_lock_);
- cancel_vsync_flag_->Set();
- }
-
- // Hand-off |shim_| to be deleted on the |vsync_thread_|.
- vsync_thread_->task_runner()->DeleteSoon(FROM_HERE, shim_.release());
- }
-
- void GetVSyncParameters(
- gfx::VSyncProvider::UpdateVSyncCallback callback) override {
- // Only one outstanding request per surface.
- if (!pending_callback_) {
- DCHECK(callback);
- pending_callback_ = std::move(callback);
- vsync_thread_->task_runner()->PostTask(
- FROM_HERE,
- base::BindOnce(&SGIVideoSyncProviderThreadShim::GetVSyncParameters,
- base::Unretained(shim_.get()),
- base::BindRepeating(
- &SGIVideoSyncVSyncProvider::PendingCallbackRunner,
- AsWeakPtr())));
- }
- }
-
- bool GetVSyncParametersIfAvailable(base::TimeTicks* timebase,
- base::TimeDelta* interval) override {
- return false;
- }
-
- bool SupportGetVSyncParametersIfAvailable() const override { return false; }
- bool IsHWClock() const override { return false; }
-
- private:
- void PendingCallbackRunner(const base::TimeTicks timebase,
- const base::TimeDelta interval) {
- DCHECK(pending_callback_);
- std::move(pending_callback_).Run(timebase, interval);
- }
-
- scoped_refptr<SGIVideoSyncThread> vsync_thread_;
-
- // Thread shim through which the sync provider is accessed on |vsync_thread_|.
- std::unique_ptr<SGIVideoSyncProviderThreadShim> shim_;
-
- gfx::VSyncProvider::UpdateVSyncCallback pending_callback_;
-
- // Raw pointers to sync primitives owned by the shim_.
- // These will only be referenced before we post a task to destroy
- // the shim_, so they are safe to access.
- raw_ptr<base::AtomicFlag> cancel_vsync_flag_;
- raw_ptr<base::Lock> vsync_lock_;
-};
-
-SGIVideoSyncThread* SGIVideoSyncThread::g_video_sync_thread = nullptr;
-x11::Connection* SGIVideoSyncThread::g_connection = nullptr;
-
-} // namespace
-
-bool GLSurfaceGLX::initialized_ = false;
-
-GLSurfaceGLX::GLSurfaceGLX() {
- display_ =
- GLDisplayManagerX11::GetInstance()->GetDisplay(GpuPreference::kDefault);
-}
-
-bool GLSurfaceGLX::InitializeOneOff() {
- if (initialized_)
- return true;
-
- // http://crbug.com/245466
- setenv("force_s3tc_enable", "true", 1);
-
- if (!x11::Connection::Get()->Ready()) {
- LOG(ERROR) << "Could not open X11 connection.";
- return false;
- }
-
- int major = 0, minor = 0;
- if (!glXQueryVersion(x11::Connection::Get()->GetXlibDisplay(), &major,
- &minor)) {
- LOG(ERROR) << "glxQueryVersion failed";
- return false;
- }
-
- if (major == 1 && minor < 3) {
- LOG(ERROR) << "GLX 1.3 or later is required.";
- return false;
- }
-
- auto* visual_picker = ui::VisualPickerGlx::GetInstance();
- auto visual_id = visual_picker->rgba_visual();
- if (visual_id == x11::VisualId{})
- visual_id = visual_picker->system_visual();
- g_visual = visual_id;
- auto* connection = x11::Connection::Get();
- g_depth = connection->GetVisualInfoFromId(visual_id)->format->depth;
- g_colormap = connection->GenerateId<x11::ColorMap>();
- connection->CreateColormap({x11::ColormapAlloc::None, g_colormap,
- connection->default_root(), g_visual});
- // We create a dummy unmapped window for both the main Display and the video
- // sync Display so that the Nvidia driver can initialize itself before the
- // sandbox is set up.
- // Unfortunately some fds e.g. /dev/nvidia0 are cached per thread and because
- // we can't start threads before the sandbox is set up, these are accessed
- // through the broker process. See GpuProcessPolicy::InitGpuBrokerProcess.
- if (!CreateDummyWindow(x11::Connection::Get())) {
- LOG(ERROR) << "CreateDummyWindow() failed";
- return false;
- }
-
- initialized_ = true;
- return true;
-}
-
-// static
-bool GLSurfaceGLX::InitializeExtensionSettingsOneOff() {
- if (!initialized_)
- return false;
-
- g_driver_glx.InitializeExtensionBindings();
-
- g_glx_context_create = HasGLXExtension("GLX_ARB_create_context");
- g_glx_create_context_robustness_supported =
- HasGLXExtension("GLX_ARB_create_context_robustness");
- g_glx_robustness_video_memory_purge_supported =
- HasGLXExtension("GLX_NV_robustness_video_memory_purge");
- g_glx_create_context_profile_supported =
- HasGLXExtension("GLX_ARB_create_context_profile");
- g_glx_create_context_profile_es2_supported =
- HasGLXExtension("GLX_ARB_create_context_es2_profile");
- g_glx_texture_from_pixmap_supported =
- HasGLXExtension("GLX_EXT_texture_from_pixmap");
- g_glx_oml_sync_control_supported = HasGLXExtension("GLX_OML_sync_control");
- g_glx_get_msc_rate_oml_supported = g_glx_oml_sync_control_supported;
- g_glx_ext_swap_control_supported = HasGLXExtension("GLX_EXT_swap_control");
- g_glx_mesa_swap_control_supported = HasGLXExtension("GLX_MESA_swap_control");
- g_glx_sgi_video_sync_supported = HasGLXExtension("GLX_SGI_video_sync");
-
- if (!g_glx_get_msc_rate_oml_supported && g_glx_sgi_video_sync_supported) {
- if (!SGIVideoSyncThread::InitializeBeforeSandboxStarts())
- return false;
- }
- return true;
-}
-
-// static
-void GLSurfaceGLX::ShutdownOneOff() {
- initialized_ = false;
- g_glx_context_create = false;
- g_glx_create_context_robustness_supported = false;
- g_glx_robustness_video_memory_purge_supported = false;
- g_glx_create_context_profile_supported = false;
- g_glx_create_context_profile_es2_supported = false;
- g_glx_texture_from_pixmap_supported = false;
- g_glx_oml_sync_control_supported = false;
-
- g_glx_get_msc_rate_oml_supported = false;
- g_glx_ext_swap_control_supported = false;
- g_glx_mesa_swap_control_supported = false;
- g_glx_sgi_video_sync_supported = false;
-
- g_visual = {};
- g_depth = static_cast<int>(x11::WindowClass::CopyFromParent);
- g_colormap = {};
-}
-
-// static
-std::string GLSurfaceGLX::QueryGLXExtensions() {
- auto* connection = x11::Connection::Get();
- const int screen = connection ? connection->DefaultScreenId() : 0;
- const char* extensions =
- glXQueryExtensionsString(connection->GetXlibDisplay(), screen);
- if (extensions)
- return std::string(extensions);
- return "";
-}
-
-// static
-const char* GLSurfaceGLX::GetGLXExtensions() {
- static base::NoDestructor<std::string> glx_extensions("");
- if (glx_extensions->empty()) {
- *glx_extensions = QueryGLXExtensions();
- }
- return glx_extensions->c_str();
-}
-
-// static
-bool GLSurfaceGLX::HasGLXExtension(const char* name) {
- return ExtensionsContain(GetGLXExtensions(), name);
-}
-
-// static
-bool GLSurfaceGLX::IsCreateContextSupported() {
- return g_glx_context_create;
-}
-
-// static
-bool GLSurfaceGLX::IsCreateContextRobustnessSupported() {
- return g_glx_create_context_robustness_supported;
-}
-
-// static
-bool GLSurfaceGLX::IsRobustnessVideoMemoryPurgeSupported() {
- return g_glx_robustness_video_memory_purge_supported;
-}
-
-// static
-bool GLSurfaceGLX::IsCreateContextProfileSupported() {
- return g_glx_create_context_profile_supported;
-}
-
-// static
-bool GLSurfaceGLX::IsCreateContextES2ProfileSupported() {
- return g_glx_create_context_profile_es2_supported;
-}
-
-// static
-bool GLSurfaceGLX::IsTextureFromPixmapSupported() {
- return g_glx_texture_from_pixmap_supported;
-}
-
-// static
-bool GLSurfaceGLX::IsEXTSwapControlSupported() {
- return g_glx_ext_swap_control_supported;
-}
-
-// static
-bool GLSurfaceGLX::IsMESASwapControlSupported() {
- return g_glx_mesa_swap_control_supported;
-}
-
-// static
-bool GLSurfaceGLX::IsOMLSyncControlSupported() {
- return g_glx_oml_sync_control_supported;
-}
-
-GLDisplay* GLSurfaceGLX::GetGLDisplay() {
- return display_;
-}
-
-GLSurfaceGLX::~GLSurfaceGLX() = default;
-
-NativeViewGLSurfaceGLX::NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window)
- : parent_window_(window),
- window_(x11::Window::None),
- glx_window_(),
- config_(nullptr),
- has_swapped_buffers_(false) {}
-
-bool NativeViewGLSurfaceGLX::Initialize(GLSurfaceFormat format) {
- auto* conn = x11::Connection::Get();
-
- auto parent = static_cast<x11::Window>(parent_window_);
- auto attributes_req = conn->GetWindowAttributes({parent});
- auto geometry_req = conn->GetGeometry(parent);
- conn->Flush();
- auto attributes = attributes_req.Sync();
- auto geometry = geometry_req.Sync();
-
- if (!attributes || !geometry) {
- LOG(ERROR) << "GetGeometry/GetWindowAttribues failed for window "
- << static_cast<uint32_t>(parent_window_) << ".";
- return false;
- }
- size_ = gfx::Size(geometry->width, geometry->height);
-
- window_ = conn->GenerateId<x11::Window>();
- x11::CreateWindowRequest req{
- .depth = static_cast<uint8_t>(g_depth),
- .wid = window_,
- .parent = static_cast<x11::Window>(parent_window_),
- .width = static_cast<uint16_t>(size_.width()),
- .height = static_cast<uint16_t>(size_.height()),
- .c_class = x11::WindowClass::InputOutput,
- .visual = g_visual,
- .background_pixmap = x11::Pixmap::None,
- .border_pixel = 0,
- .bit_gravity = x11::Gravity::NorthWest,
- .colormap = g_colormap,
- };
- if (ui::IsCompositingManagerPresent() && attributes->visual == g_visual) {
- // When parent and child are using the same visual, the back buffer will be
- // shared between parent and child. If WM compositing is enabled, we set
- // child's background pixel to ARGB(0,0,0,0), so ARGB(0,0,0,0) will be
- // filled to the shared buffer, when the child window is mapped. It can
- // avoid an annoying flash when the child window is mapped below.
- // If WM compositing is disabled, we don't set the background pixel, so
- // nothing will be draw when the child window is mapped.
- req.background_pixel = 0; // ARGB(0,0,0,0) for compositing WM
- }
- conn->CreateWindow(req);
- conn->MapWindow({window_});
-
- RegisterEvents();
- conn->Sync();
-
- GetConfig();
- if (!config_) {
- LOG(ERROR) << "Failed to get GLXConfig";
- return false;
- }
- glx_window_ = static_cast<x11::Glx::Window>(
- glXCreateWindow(conn->GetXlibDisplay(x11::XlibDisplayType::kSyncing),
- config_, static_cast<uint32_t>(window_), nullptr));
- if (!GetDrawableHandle()) {
- LOG(ERROR) << "glXCreateWindow failed";
- return false;
- }
-
- if (g_glx_oml_sync_control_supported) {
- vsync_provider_ = std::make_unique<OMLSyncControlVSyncProvider>(
- static_cast<GLXWindow>(glx_window_));
- presentation_helper_ =
- std::make_unique<GLSurfacePresentationHelper>(vsync_provider_.get());
- } else if (g_glx_sgi_video_sync_supported) {
- vsync_provider_ =
- std::make_unique<SGIVideoSyncVSyncProvider>(parent_window_);
- presentation_helper_ =
- std::make_unique<GLSurfacePresentationHelper>(vsync_provider_.get());
- } else {
- vsync_provider_ = std::make_unique<ui::XrandrIntervalOnlyVSyncProvider>();
- presentation_helper_ = std::make_unique<GLSurfacePresentationHelper>(
- base::TimeTicks(), ui::GetPrimaryDisplayRefreshIntervalFromXrandr());
- }
-
- return true;
-}
-
-void NativeViewGLSurfaceGLX::Destroy() {
- presentation_helper_ = nullptr;
- vsync_provider_ = nullptr;
- if (GetDrawableHandle()) {
- glXDestroyWindow(
- x11::Connection::Get()->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- GetDrawableHandle());
- glx_window_ = {};
- }
- if (window_ != x11::Window::None) {
- UnregisterEvents();
- x11::Connection::Get()->DestroyWindow({window_});
- window_ = x11::Window::None;
- x11::Connection::Get()->Flush();
- }
-}
-
-bool NativeViewGLSurfaceGLX::Resize(const gfx::Size& size,
- float scale_factor,
- const gfx::ColorSpace& color_space,
- bool has_alpha) {
- size_ = size;
- glXWaitGL();
- x11::Connection::Get()->ConfigureWindow(
- {.window = window_, .width = size.width(), .height = size.height()});
- glXWaitX();
- return true;
-}
-
-bool NativeViewGLSurfaceGLX::IsOffscreen() {
- return false;
-}
-
-gfx::SwapResult NativeViewGLSurfaceGLX::SwapBuffers(
- PresentationCallback callback,
- FrameData data) {
- TRACE_EVENT2("gpu", "NativeViewGLSurfaceGLX:RealSwapBuffers", "width",
- GetSize().width(), "height", GetSize().height());
- GLSurfacePresentationHelper::ScopedSwapBuffers scoped_swap_buffers(
- presentation_helper_.get(), std::move(callback));
-
- auto* connection = x11::Connection::Get();
- glXSwapBuffers(connection->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- GetDrawableHandle());
-
- // We need to restore the background pixel that we set to WhitePixel on
- // views::DesktopWindowTreeHostX11::InitX11Window back to None for the
- // XWindow associated to this surface after the first SwapBuffers has
- // happened, to avoid showing a weird white background while resizing.
- if (!has_swapped_buffers_) {
- connection->ChangeWindowAttributes({
- .window = static_cast<x11::Window>(parent_window_),
- .background_pixmap = x11::Pixmap::None,
- });
- has_swapped_buffers_ = true;
- }
-
- return scoped_swap_buffers.result();
-}
-
-gfx::Size NativeViewGLSurfaceGLX::GetSize() {
- return size_;
-}
-
-void* NativeViewGLSurfaceGLX::GetHandle() {
- return reinterpret_cast<void*>(GetDrawableHandle());
-}
-
-bool NativeViewGLSurfaceGLX::SupportsPostSubBuffer() {
- return g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer;
-}
-
-void* NativeViewGLSurfaceGLX::GetConfig() {
- if (!config_)
- config_ = GetFbConfigForWindow(x11::Connection::Get(), window_);
- return config_;
-}
-
-GLSurfaceFormat NativeViewGLSurfaceGLX::GetFormat() {
- return GLSurfaceFormat();
-}
-
-gfx::SwapResult NativeViewGLSurfaceGLX::PostSubBuffer(
- int x,
- int y,
- int width,
- int height,
- PresentationCallback callback,
- FrameData data) {
- DCHECK(g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer);
-
- GLSurfacePresentationHelper::ScopedSwapBuffers scoped_swap_buffers(
- presentation_helper_.get(), std::move(callback));
- glXCopySubBufferMESA(
- x11::Connection::Get()->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- GetDrawableHandle(), x, y, width, height);
- return scoped_swap_buffers.result();
-}
-
-bool NativeViewGLSurfaceGLX::OnMakeCurrent(GLContext* context) {
- presentation_helper_->OnMakeCurrent(context, this);
- return GLSurfaceGLX::OnMakeCurrent(context);
-}
-
-gfx::VSyncProvider* NativeViewGLSurfaceGLX::GetVSyncProvider() {
- return vsync_provider_.get();
-}
-
-void NativeViewGLSurfaceGLX::SetVSyncEnabled(bool enabled) {
- DCHECK(GLContext::GetCurrent() && GLContext::GetCurrent()->IsCurrent(this));
- int interval = enabled ? 1 : 0;
- if (GLSurfaceGLX::IsEXTSwapControlSupported()) {
- glXSwapIntervalEXT(
- x11::Connection::Get()->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- GetDrawableHandle(), interval);
- } else if (GLSurfaceGLX::IsMESASwapControlSupported()) {
- glXSwapIntervalMESA(interval);
- } else if (interval == 0) {
- LOG(WARNING)
- << "Could not disable vsync: driver does not support swap control";
- }
-}
-
-NativeViewGLSurfaceGLX::~NativeViewGLSurfaceGLX() {
- Destroy();
-}
-
-void NativeViewGLSurfaceGLX::ForwardExposeEvent(const x11::Event& event) {
- auto forwarded_event = *event.As<x11::ExposeEvent>();
- auto window = static_cast<x11::Window>(parent_window_);
- forwarded_event.window = window;
- x11::SendEvent(forwarded_event, window, x11::EventMask::Exposure);
- x11::Connection::Get()->Flush();
-}
-
-bool NativeViewGLSurfaceGLX::CanHandleEvent(const x11::Event& x11_event) {
- auto* expose = x11_event.As<x11::ExposeEvent>();
- return expose && expose->window == static_cast<x11::Window>(window_);
-}
-
-uint32_t NativeViewGLSurfaceGLX::GetDrawableHandle() const {
- return static_cast<uint32_t>(glx_window_);
-}
-
-UnmappedNativeViewGLSurfaceGLX::UnmappedNativeViewGLSurfaceGLX(
- const gfx::Size& size)
- : size_(size), config_(nullptr), window_(x11::Window::None), glx_window_() {
- // Ensure that we don't create a window with zero size.
- if (size_.GetArea() == 0)
- size_.SetSize(1, 1);
-}
-
-bool UnmappedNativeViewGLSurfaceGLX::Initialize(GLSurfaceFormat format) {
- DCHECK_EQ(window_, x11::Window::None);
-
- auto parent_window = ui::GetX11RootWindow();
-
- auto* conn = x11::Connection::Get();
- window_ = conn->GenerateId<x11::Window>();
- conn->CreateWindow(x11::CreateWindowRequest{
- .depth = static_cast<uint8_t>(g_depth),
- .wid = window_,
- .parent = parent_window,
- .width = static_cast<uint16_t>(size_.width()),
- .height = static_cast<uint16_t>(size_.height()),
- .c_class = x11::WindowClass::InputOutput,
- .visual = g_visual,
- .border_pixel = 0,
- .colormap = g_colormap,
- })
- .Sync();
- GetConfig();
- if (!config_) {
- LOG(ERROR) << "Failed to get GLXConfig";
- return false;
- }
- glx_window_ = static_cast<x11::Glx::Window>(
- glXCreateWindow(conn->GetXlibDisplay(x11::XlibDisplayType::kSyncing),
- config_, static_cast<uint32_t>(window_), nullptr));
- if (glx_window_ == x11::Glx::Window{}) {
- LOG(ERROR) << "glXCreateWindow failed";
- return false;
- }
- return true;
-}
-
-void UnmappedNativeViewGLSurfaceGLX::Destroy() {
- config_ = nullptr;
- if (glx_window_ != x11::Glx::Window{}) {
- glXDestroyWindow(
- x11::Connection::Get()->GetXlibDisplay(x11::XlibDisplayType::kFlushing),
- static_cast<uint32_t>(glx_window_));
- glx_window_ = {};
- }
- if (window_ != x11::Window::None) {
- x11::Connection::Get()->DestroyWindow({window_});
- window_ = x11::Window::None;
- }
-}
-
-bool UnmappedNativeViewGLSurfaceGLX::IsOffscreen() {
- return true;
-}
-
-gfx::SwapResult UnmappedNativeViewGLSurfaceGLX::SwapBuffers(
- PresentationCallback callback,
- FrameData data) {
- NOTREACHED() << "Attempted to call SwapBuffers on an unmapped window.";
- return gfx::SwapResult::SWAP_FAILED;
-}
-
-gfx::Size UnmappedNativeViewGLSurfaceGLX::GetSize() {
- return size_;
-}
-
-void* UnmappedNativeViewGLSurfaceGLX::GetHandle() {
- return reinterpret_cast<void*>(glx_window_);
-}
-
-void* UnmappedNativeViewGLSurfaceGLX::GetConfig() {
- if (!config_)
- config_ = GetFbConfigForWindow(x11::Connection::Get(), window_);
- return config_;
-}
-
-GLSurfaceFormat UnmappedNativeViewGLSurfaceGLX::GetFormat() {
- return GLSurfaceFormat();
-}
-
-UnmappedNativeViewGLSurfaceGLX::~UnmappedNativeViewGLSurfaceGLX() {
- Destroy();
-}
-
-} // namespace gl
diff --git a/ui/gl/gl_surface_glx.h b/ui/gl/gl_surface_glx.h
deleted file mode 100644
index f3de286..0000000
--- a/ui/gl/gl_surface_glx.h
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright 2012 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_GL_GL_SURFACE_GLX_H_
-#define UI_GL_GL_SURFACE_GLX_H_
-
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-
-#include "base/memory/raw_ptr.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/x/event.h"
-#include "ui/gfx/x/glx.h"
-#include "ui/gl/gl_export.h"
-#include "ui/gl/gl_surface.h"
-
-using GLXFBConfig = struct __GLXFBConfigRec*;
-
-namespace gfx {
-class VSyncProvider;
-}
-
-namespace gl {
-
-class GLSurfacePresentationHelper;
-
-// Base class for GLX surfaces.
-class GL_EXPORT GLSurfaceGLX : public GLSurface {
- public:
- GLSurfaceGLX();
-
- GLSurfaceGLX(const GLSurfaceGLX&) = delete;
- GLSurfaceGLX& operator=(const GLSurfaceGLX&) = delete;
-
- static bool InitializeOneOff();
- static bool InitializeExtensionSettingsOneOff();
- static void ShutdownOneOff();
-
- // These aren't particularly tied to surfaces, but since we already
- // have the static InitializeOneOff here, it's easiest to reuse its
- // initialization guards.
- static std::string QueryGLXExtensions();
- static const char* GetGLXExtensions();
- static bool HasGLXExtension(const char* name);
- static bool IsCreateContextSupported();
- static bool IsCreateContextRobustnessSupported();
- static bool IsRobustnessVideoMemoryPurgeSupported();
- static bool IsCreateContextProfileSupported();
- static bool IsCreateContextES2ProfileSupported();
- static bool IsTextureFromPixmapSupported();
- static bool IsOMLSyncControlSupported();
- static bool IsEXTSwapControlSupported();
- static bool IsMESASwapControlSupported();
-
- GLDisplay* GetGLDisplay() override;
-
- // Get the FB config that the surface was created with or NULL if it is not
- // a GLX drawable.
- void* GetConfig() override = 0;
-
- protected:
- ~GLSurfaceGLX() override;
-
- private:
- static bool initialized_;
- raw_ptr<GLDisplayX11> display_;
-};
-
-// A surface used to render to a view.
-class GL_EXPORT NativeViewGLSurfaceGLX : public GLSurfaceGLX {
- public:
- explicit NativeViewGLSurfaceGLX(gfx::AcceleratedWidget window);
-
- NativeViewGLSurfaceGLX(const NativeViewGLSurfaceGLX&) = delete;
- NativeViewGLSurfaceGLX& operator=(const NativeViewGLSurfaceGLX&) = delete;
-
- // Implement GLSurfaceGLX.
- bool Initialize(GLSurfaceFormat format) override;
- void Destroy() override;
- bool Resize(const gfx::Size& size,
- float scale_factor,
- const gfx::ColorSpace& color_space,
- bool has_alpha) override;
- bool IsOffscreen() override;
- gfx::SwapResult SwapBuffers(PresentationCallback callback,
- FrameData data) override;
- gfx::Size GetSize() override;
- void* GetHandle() override;
- bool SupportsPostSubBuffer() override;
- void* GetConfig() override;
- GLSurfaceFormat GetFormat() override;
- gfx::SwapResult PostSubBuffer(int x,
- int y,
- int width,
- int height,
- PresentationCallback callback,
- FrameData data) override;
- bool OnMakeCurrent(GLContext* context) override;
- gfx::VSyncProvider* GetVSyncProvider() override;
- void SetVSyncEnabled(bool enabled) override;
-
- protected:
- ~NativeViewGLSurfaceGLX() override;
-
- // Handle registering and unregistering for Expose events.
- virtual void RegisterEvents() = 0;
- virtual void UnregisterEvents() = 0;
-
- // Forwards Expose event to child window.
- void ForwardExposeEvent(const x11::Event& xevent);
-
- // Checks if event is Expose for child window.
- bool CanHandleEvent(const x11::Event& xevent);
-
- gfx::AcceleratedWidget window() const {
- return static_cast<gfx::AcceleratedWidget>(window_);
- }
-
- private:
- // The handle for the drawable to make current or swap.
- uint32_t GetDrawableHandle() const;
-
- // Window passed in at creation. Always valid.
- gfx::AcceleratedWidget parent_window_;
-
- // Child window, used to control resizes so that they're in-order with GL.
- x11::Window window_;
-
- // GLXDrawable for the window.
- x11::Glx::Window glx_window_;
-
- GLXFBConfig config_;
- gfx::Size size_;
-
- bool has_swapped_buffers_;
-
- std::unique_ptr<gfx::VSyncProvider> vsync_provider_;
-
- std::unique_ptr<GLSurfacePresentationHelper> presentation_helper_;
-};
-
-// A surface used to render to an offscreen pbuffer.
-class GL_EXPORT UnmappedNativeViewGLSurfaceGLX : public GLSurfaceGLX {
- public:
- explicit UnmappedNativeViewGLSurfaceGLX(const gfx::Size& size);
-
- UnmappedNativeViewGLSurfaceGLX(const UnmappedNativeViewGLSurfaceGLX&) =
- delete;
- UnmappedNativeViewGLSurfaceGLX& operator=(
- const UnmappedNativeViewGLSurfaceGLX&) = delete;
-
- // Implement GLSurfaceGLX.
- bool Initialize(GLSurfaceFormat format) override;
- void Destroy() override;
- bool IsOffscreen() override;
- gfx::SwapResult SwapBuffers(PresentationCallback callback,
- FrameData data) override;
- gfx::Size GetSize() override;
- void* GetHandle() override;
- void* GetConfig() override;
- GLSurfaceFormat GetFormat() override;
-
- protected:
- ~UnmappedNativeViewGLSurfaceGLX() override;
-
- private:
- gfx::Size size_;
- GLXFBConfig config_;
- // Unmapped dummy window, used to provide a compatible surface.
- x11::Window window_;
-
- // GLXDrawable for the window.
- x11::Glx::Window glx_window_;
-};
-
-} // namespace gl
-
-#endif // UI_GL_GL_SURFACE_GLX_H_
diff --git a/ui/gl/gl_surface_glx_x11.cc b/ui/gl/gl_surface_glx_x11.cc
deleted file mode 100644
index baa46a4..0000000
--- a/ui/gl/gl_surface_glx_x11.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2016 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gl/gl_surface_glx_x11.h"
-
-#include "ui/gfx/x/future.h"
-
-namespace gl {
-
-GLSurfaceGLXX11::GLSurfaceGLXX11(gfx::AcceleratedWidget window)
- : NativeViewGLSurfaceGLX(window) {}
-
-GLSurfaceGLXX11::~GLSurfaceGLXX11() {
- Destroy();
-}
-
-void GLSurfaceGLXX11::RegisterEvents() {
- // Can be null in tests, when we don't care about Exposes.
- auto* connection = x11::Connection::Get();
-
- connection->ChangeWindowAttributes(x11::ChangeWindowAttributesRequest{
- .window = static_cast<x11::Window>(window()),
- .event_mask = x11::EventMask::Exposure});
-
- connection->AddEventObserver(this);
-}
-
-void GLSurfaceGLXX11::UnregisterEvents() {
- x11::Connection::Get()->RemoveEventObserver(this);
-}
-
-void GLSurfaceGLXX11::OnEvent(const x11::Event& event) {
- if (CanHandleEvent(event))
- ForwardExposeEvent(event);
-}
-
-} // namespace gl
diff --git a/ui/gl/gl_surface_glx_x11.h b/ui/gl/gl_surface_glx_x11.h
deleted file mode 100644
index 444bc4bc..0000000
--- a/ui/gl/gl_surface_glx_x11.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2016 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_GL_GL_SURFACE_GLX_X11_H_
-#define UI_GL_GL_SURFACE_GLX_X11_H_
-
-#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/x/connection.h"
-#include "ui/gfx/x/event.h"
-#include "ui/gl/gl_export.h"
-#include "ui/gl/gl_surface_glx.h"
-
-namespace gl {
-
-// X11 specific implementation of GLX surface. Registers as a
-// PlatformEventDispatcher to handle XEvents.
-class GL_EXPORT GLSurfaceGLXX11 : public NativeViewGLSurfaceGLX,
- public x11::EventObserver {
- public:
- explicit GLSurfaceGLXX11(gfx::AcceleratedWidget window);
-
- GLSurfaceGLXX11(const GLSurfaceGLXX11&) = delete;
- GLSurfaceGLXX11& operator=(const GLSurfaceGLXX11&) = delete;
-
- protected:
- ~GLSurfaceGLXX11() override;
-
- // NativeViewGLSurfaceGLX:
- void RegisterEvents() override;
- void UnregisterEvents() override;
-
- // x11::EventObserver:
- void OnEvent(const x11::Event& event) override;
-};
-
-} // namespace gl
-
-#endif // UI_GL_GL_SURFACE_GLX_X11_H_
diff --git a/ui/gl/glx_api_unittest.cc b/ui/gl/glx_api_unittest.cc
deleted file mode 100644
index 102cfc7..0000000
--- a/ui/gl/glx_api_unittest.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2015 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <memory>
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gl/gl_glx_api_implementation.h"
-#include "ui/gl/gl_implementation.h"
-
-namespace gl {
-
-class GLXApiTest : public testing::Test {
- public:
- void SetUp() override {
- fake_extension_string_ = "";
-
- g_driver_glx.ClearBindings();
- g_driver_glx.fn.glXQueryExtensionsStringFn = &FakeQueryExtensionsString;
- SetGLImplementation(kGLImplementationMockGL);
- SetGLGetProcAddressProc(
- static_cast<GLGetProcAddressProc>(&FakeGLGetProcAddress));
- }
-
- void TearDown() override {
- g_current_glx_context = nullptr;
- api_.reset(nullptr);
- g_driver_glx.ClearBindings();
-
- fake_extension_string_ = "";
- }
-
- void InitializeAPI(const char* disabled_extensions) {
- api_ = std::make_unique<RealGLXApi>();
- g_current_glx_context = api_.get();
- api_->Initialize(&g_driver_glx);
- if (disabled_extensions) {
- SetDisabledExtensionsGLX(disabled_extensions);
- }
- g_driver_glx.InitializeExtensionBindings();
- }
-
- void SetFakeExtensionString(const char* fake_string) {
- fake_extension_string_ = fake_string;
- }
-
- const char* GetExtensions() {
- return api_->glXQueryExtensionsStringFn(reinterpret_cast<Display*>(0x1), 0);
- }
-
- static GLXContext FakeCreateContextAttribsARB(Display* dpy,
- GLXFBConfig config,
- GLXContext share_context,
- int direct,
- const int* attrib_list) {
- return static_cast<GLXContext>(nullptr);
- }
-
- static GLFunctionPointerType GL_BINDING_CALL
- FakeGLGetProcAddress(const char* proc) {
- if (!strcmp("glXCreateContextAttribsARB", proc)) {
- return reinterpret_cast<GLFunctionPointerType>(
- &FakeCreateContextAttribsARB);
- }
- return NULL;
- }
-
- static const char* GL_BINDING_CALL FakeQueryExtensionsString(Display* dpy,
- int screen) {
- return fake_extension_string_;
- }
-
- protected:
- static const char* fake_extension_string_;
-
- std::unique_ptr<RealGLXApi> api_;
-};
-
-const char* GLXApiTest::fake_extension_string_ = "";
-
-TEST_F(GLXApiTest, DisabledExtensionBitTest) {
- static const char* kFakeExtensions = "GLX_ARB_create_context";
- static const char* kFakeDisabledExtensions = "GLX_ARB_create_context";
-
- SetFakeExtensionString(kFakeExtensions);
- InitializeAPI(nullptr);
-
- EXPECT_TRUE(g_driver_glx.ext.b_GLX_ARB_create_context);
-
- InitializeAPI(kFakeDisabledExtensions);
-
- EXPECT_FALSE(g_driver_glx.ext.b_GLX_ARB_create_context);
-}
-
-TEST_F(GLXApiTest, DisabledExtensionStringTest) {
- static const char* kFakeExtensions = "EGL_EXT_1 EGL_EXT_2"
- " EGL_EXT_3 EGL_EXT_4";
- static const char* kFakeDisabledExtensions =
- "EGL_EXT_1,EGL_EXT_2,EGL_FAKE";
- static const char* kFilteredExtensions = "EGL_EXT_3 EGL_EXT_4";
-
- SetFakeExtensionString(kFakeExtensions);
- InitializeAPI(nullptr);
-
- EXPECT_STREQ(kFakeExtensions, GetExtensions());
-
- InitializeAPI(kFakeDisabledExtensions);
-
- EXPECT_STREQ(kFilteredExtensions, GetExtensions());
-}
-
-} // namespace gl
diff --git a/ui/gl/glx_util.cc b/ui/gl/glx_util.cc
deleted file mode 100644
index 366758a..0000000
--- a/ui/gl/glx_util.cc
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright 2020 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gl/glx_util.h"
-
-#include <unistd.h>
-
-#include "base/compiler_specific.h"
-#include "base/logging.h"
-#include "base/posix/eintr_wrapper.h"
-#include "ui/gfx/linux/native_pixmap_dmabuf.h"
-#include "ui/gfx/x/dri3.h"
-#include "ui/gfx/x/future.h"
-#include "ui/gfx/x/glx.h"
-#include "ui/gl/gl_bindings.h"
-
-namespace gl {
-
-namespace {
-
-x11::Glx::FbConfig GetConfigForWindow(x11::Connection* conn,
- x11::Window window) {
- x11::VisualId visual;
- if (auto attrs = conn->GetWindowAttributes({window}).Sync()) {
- visual = attrs->visual;
- } else {
- LOG(ERROR) << "GetWindowAttributes failed for window "
- << static_cast<uint32_t>(window) << ".";
- return {};
- }
-
- if (auto configs =
- conn->glx()
- .GetFBConfigs({static_cast<uint32_t>(conn->DefaultScreenId())})
- .Sync()) {
- // The returned property_list is a table consisting of
- // 2 * num_FB_configs * num_properties uint32_t's. Each entry in the table
- // is a key-value pair. For example, if we have 2 FB configs and 3
- // properties, then the table would be laid out as such:
- //
- // k(c, p) = key for c'th config of p'th property
- // v(c, p) = value for c'th config of p'th property
- //
- // | k(1, 1) | v(1, 1) | k(1, 2) | v(1, 2) | k(1, 3) | v(1, 3) |
- // | k(2, 1) | v(2, 1) | k(2, 2) | v(2, 2) | k(2, 3) | v(2, 3) |
- auto cfgs = configs->num_FB_configs;
- auto props = configs->num_properties;
- for (size_t cfg = 0; cfg < cfgs; cfg++) {
- x11::Glx::FbConfig fb_config{};
- bool found = false;
- for (size_t prop = 0; prop < props; prop++) {
- size_t i = 2 * cfg * props + 2 * prop;
- auto key = configs->property_list[i];
- auto value = configs->property_list[i + 1];
- if (key == GLX_VISUAL_ID && value == static_cast<uint32_t>(visual))
- found = true;
- else if (key == GLX_FBCONFIG_ID)
- fb_config = static_cast<x11::Glx::FbConfig>(value);
- }
- if (found)
- return fb_config;
- }
- } else {
- LOG(ERROR) << "GetFBConfigs failed.";
- return {};
- }
- return {};
-}
-
-int Depth(gfx::BufferFormat format) {
- switch (format) {
- case gfx::BufferFormat::BGR_565:
- return 16;
- case gfx::BufferFormat::BGRX_8888:
- return 24;
- case gfx::BufferFormat::BGRA_1010102:
- case gfx::BufferFormat::BGRA_8888:
- return 32;
- default:
- NOTREACHED();
- return 0;
- }
-}
-
-int Bpp(gfx::BufferFormat format) {
- switch (format) {
- case gfx::BufferFormat::BGR_565:
- return 16;
- case gfx::BufferFormat::BGRX_8888:
- case gfx::BufferFormat::BGRA_1010102:
- case gfx::BufferFormat::BGRA_8888:
- return 32;
- default:
- NOTREACHED();
- return 0;
- }
-}
-
-} // namespace
-
-x11::Pixmap XPixmapFromNativePixmap(
- const gfx::NativePixmapDmaBuf& native_pixmap,
- gfx::BufferFormat buffer_format) {
- int depth = Depth(buffer_format);
- int bpp = Bpp(buffer_format);
- auto fd = HANDLE_EINTR(dup(native_pixmap.GetDmaBufFd(0)));
- if (fd < 0)
- return x11::Pixmap::None;
- x11::RefCountedFD ref_counted_fd(fd);
-
- auto* connection = x11::Connection::Get();
- x11::Pixmap pixmap_id = connection->GenerateId<x11::Pixmap>();
- // This should be synced. Otherwise, glXCreatePixmap may fail on ChromeOS
- // with "failed to create a drawable" error.
- connection->dri3()
- .PixmapFromBuffer(pixmap_id, connection->default_root(),
- native_pixmap.GetDmaBufPlaneSize(0),
- native_pixmap.GetBufferSize().width(),
- native_pixmap.GetBufferSize().height(),
- native_pixmap.GetDmaBufPitch(0), depth, bpp,
- ref_counted_fd)
- .Sync();
- return pixmap_id;
-}
-
-GLXFBConfig GetFbConfigForWindow(x11::Connection* connection,
- x11::Window window) {
- return GetGlxFbConfigForXProtoFbConfig(
- connection, GetConfigForWindow(connection, window));
-}
-
-GLXFBConfig GetGlxFbConfigForXProtoFbConfig(x11::Connection* connection,
- x11::Glx::FbConfig xproto_config) {
- if (xproto_config == x11::Glx::FbConfig{})
- return nullptr;
- int attrib_list[] = {GLX_FBCONFIG_ID, static_cast<int>(xproto_config), 0};
- int nitems = 0;
- GLXFBConfig* glx_configs =
- glXChooseFBConfig(connection->GetXlibDisplay(),
- connection->DefaultScreenId(), attrib_list, &nitems);
- if (!glx_configs)
- return nullptr;
- GLXFBConfig glx_config = glx_configs[0];
- x11::XlibFree(glx_configs);
- return glx_config;
-}
-
-} // namespace gl
diff --git a/ui/gl/glx_util.h b/ui/gl/glx_util.h
deleted file mode 100644
index 9a15e72..0000000
--- a/ui/gl/glx_util.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2020 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_GL_GLX_UTIL_H_
-#define UI_GL_GLX_UTIL_H_
-
-#include "ui/gfx/x/connection.h"
-#include "ui/gfx/x/glx.h"
-#include "ui/gl/gl_export.h"
-
-using GLXFBConfig = struct __GLXFBConfigRec*;
-
-namespace gfx {
-class NativePixmapDmaBuf;
-enum class BufferFormat;
-} // namespace gfx
-
-namespace gl {
-
-GL_EXPORT GLXFBConfig GetFbConfigForWindow(x11::Connection* connection,
- x11::Window window);
-
-GL_EXPORT GLXFBConfig
-GetGlxFbConfigForXProtoFbConfig(x11::Connection* connection,
- x11::Glx::FbConfig xproto_config);
-
-GL_EXPORT x11::Pixmap XPixmapFromNativePixmap(
- const gfx::NativePixmapDmaBuf& native_pixmap,
- gfx::BufferFormat buffer_format);
-
-} // namespace gl
-
-#endif // UI_GL_GLX_UTIL_H_
diff --git a/ui/ozone/platform/x11/BUILD.gn b/ui/ozone/platform/x11/BUILD.gn
index bd3c0c8..7689ed2 100644
--- a/ui/ozone/platform/x11/BUILD.gn
+++ b/ui/ozone/platform/x11/BUILD.gn
@@ -22,8 +22,6 @@
"hit_test_x11.h",
"native_pixmap_egl_x11_binding.cc",
"native_pixmap_egl_x11_binding.h",
- "native_pixmap_glx_binding.cc",
- "native_pixmap_glx_binding.h",
"os_exchange_data_provider_x11.cc",
"os_exchange_data_provider_x11.h",
"ozone_platform_x11.cc",
diff --git a/ui/ozone/platform/x11/gl_egl_utility_x11.cc b/ui/ozone/platform/x11/gl_egl_utility_x11.cc
index 83901df..58c7fe6 100644
--- a/ui/ozone/platform/x11/gl_egl_utility_x11.cc
+++ b/ui/ozone/platform/x11/gl_egl_utility_x11.cc
@@ -41,23 +41,7 @@
ui::GpuMemoryBufferSupportX11::GetInstance()->supported_configs();
}
- if (gl::GetGLImplementation() == gl::kGLImplementationDesktopGL) {
- // Create the VisualPickerGlx singleton now while the GbmSupportX11
- // singleton is busy being created on another thread.
- auto* visual_picker = ui::VisualPickerGlx::GetInstance();
-
- // With GLX, only BGR(A) buffer formats are supported. EGL does not have
- // this restriction.
- gpu_extra_info.gpu_memory_buffer_support_x11.erase(
- std::remove_if(gpu_extra_info.gpu_memory_buffer_support_x11.begin(),
- gpu_extra_info.gpu_memory_buffer_support_x11.end(),
- [&](gfx::BufferUsageAndFormat usage_and_format) {
- return visual_picker->GetFbConfigForFormat(
- usage_and_format.format) ==
- x11::Glx::FbConfig{};
- }),
- gpu_extra_info.gpu_memory_buffer_support_x11.end());
- } else if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE) {
+ if (gl::GetGLImplementation() == gl::kGLImplementationEGLANGLE) {
// ANGLE does not yet support EGL_EXT_image_dma_buf_import[_modifiers].
gpu_extra_info.gpu_memory_buffer_support_x11.clear();
}
diff --git a/ui/ozone/platform/x11/native_pixmap_egl_x11_binding.cc b/ui/ozone/platform/x11/native_pixmap_egl_x11_binding.cc
index 1f7ba07..73ee3d3d 100644
--- a/ui/ozone/platform/x11/native_pixmap_egl_x11_binding.cc
+++ b/ui/ozone/platform/x11/native_pixmap_egl_x11_binding.cc
@@ -4,11 +4,74 @@
#include "ui/ozone/platform/x11/native_pixmap_egl_x11_binding.h"
+#include <unistd.h>
+
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
+#include "base/posix/eintr_wrapper.h"
#include "ui/gfx/linux/native_pixmap_dmabuf.h"
+#include "ui/gfx/x/connection.h"
+#include "ui/gfx/x/dri3.h"
+#include "ui/gfx/x/future.h"
#include "ui/gl/gl_image_egl_pixmap.h"
-#include "ui/gl/glx_util.h"
+
+namespace gl {
+
+namespace {
+int Depth(gfx::BufferFormat format) {
+ switch (format) {
+ case gfx::BufferFormat::BGR_565:
+ return 16;
+ case gfx::BufferFormat::BGRX_8888:
+ return 24;
+ case gfx::BufferFormat::BGRA_1010102:
+ case gfx::BufferFormat::BGRA_8888:
+ return 32;
+ default:
+ NOTREACHED();
+ return 0;
+ }
+}
+int Bpp(gfx::BufferFormat format) {
+ switch (format) {
+ case gfx::BufferFormat::BGR_565:
+ return 16;
+ case gfx::BufferFormat::BGRX_8888:
+ case gfx::BufferFormat::BGRA_1010102:
+ case gfx::BufferFormat::BGRA_8888:
+ return 32;
+ default:
+ NOTREACHED();
+ return 0;
+ }
+}
+x11::Pixmap XPixmapFromNativePixmap(
+ const gfx::NativePixmapDmaBuf& native_pixmap,
+ gfx::BufferFormat buffer_format) {
+ int depth = Depth(buffer_format);
+ int bpp = Bpp(buffer_format);
+ auto fd = HANDLE_EINTR(dup(native_pixmap.GetDmaBufFd(0)));
+ if (fd < 0)
+ return x11::Pixmap::None;
+ x11::RefCountedFD ref_counted_fd(fd);
+
+ auto* connection = x11::Connection::Get();
+ x11::Pixmap pixmap_id = connection->GenerateId<x11::Pixmap>();
+ // This should be synced. Otherwise, glXCreatePixmap may fail on ChromeOS
+ // with "failed to create a drawable" error.
+ connection->dri3()
+ .PixmapFromBuffer(pixmap_id, connection->default_root(),
+ native_pixmap.GetDmaBufPlaneSize(0),
+ native_pixmap.GetBufferSize().width(),
+ native_pixmap.GetBufferSize().height(),
+ native_pixmap.GetDmaBufPitch(0), depth, bpp,
+ ref_counted_fd)
+ .Sync();
+ return pixmap_id;
+}
+} // namespace
+
+} // namespace gl
namespace ui {
diff --git a/ui/ozone/platform/x11/native_pixmap_glx_binding.cc b/ui/ozone/platform/x11/native_pixmap_glx_binding.cc
deleted file mode 100644
index 20074a2..0000000
--- a/ui/ozone/platform/x11/native_pixmap_glx_binding.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2022 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/ozone/platform/x11/native_pixmap_glx_binding.h"
-
-#include "base/logging.h"
-#include "base/memory/scoped_refptr.h"
-#include "ui/gl/gl_image_glx_native_pixmap.h"
-
-namespace ui {
-
-NativePixmapGLXBinding::NativePixmapGLXBinding() = default;
-NativePixmapGLXBinding::~NativePixmapGLXBinding() = default;
-
-// static
-std::unique_ptr<NativePixmapGLBinding> NativePixmapGLXBinding::Create(
- scoped_refptr<gfx::NativePixmap> pixmap,
- gfx::BufferFormat plane_format,
- gfx::BufferPlane plane,
- gfx::Size plane_size,
- GLenum target,
- GLuint texture_id) {
- auto gl_image = base::MakeRefCounted<gl::GLImageGLXNativePixmap>(
- plane_size, plane_format, plane);
-
- // Initialize the image using glXCreatePixmap.
- if (!gl_image->Initialize(std::move(pixmap))) {
- LOG(ERROR) << "Unable to initialize GL image from pixmap";
- return nullptr;
- }
-
- auto binding = std::make_unique<NativePixmapGLXBinding>();
- if (!binding->BindTexture(std::move(gl_image), target, texture_id)) {
- return nullptr;
- }
-
- return binding;
-}
-
-} // namespace ui
diff --git a/ui/ozone/platform/x11/native_pixmap_glx_binding.h b/ui/ozone/platform/x11/native_pixmap_glx_binding.h
deleted file mode 100644
index 3b6e4c5..0000000
--- a/ui/ozone/platform/x11/native_pixmap_glx_binding.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2022 The Chromium Authors
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_OZONE_PLATFORM_X11_NATIVE_PIXMAP_GLX_BINDING_H_
-#define UI_OZONE_PLATFORM_X11_NATIVE_PIXMAP_GLX_BINDING_H_
-
-#include "ui/ozone/public/native_pixmap_gl_binding.h"
-
-namespace ui {
-
-// A binding maintained between GLImageGLXNativePixmap and GL Textures in Ozone.
-// This binding is used for ChromeOS-on-Linux and for Linux/Ozone/X11 with
-// Drm/Kms.
-class NativePixmapGLXBinding : public NativePixmapGLBinding {
- public:
- NativePixmapGLXBinding();
- ~NativePixmapGLXBinding() override;
-
- static std::unique_ptr<NativePixmapGLBinding> Create(
- scoped_refptr<gfx::NativePixmap> pixmap,
- gfx::BufferFormat plane_format,
- gfx::BufferPlane plane,
- gfx::Size plane_size,
- GLenum target,
- GLuint texture_id);
-};
-
-} // namespace ui
-
-#endif // UI_OZONE_PLATFORM_X11C_NATIVE_PIXMAP_GLX_BINDING_H_