mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1532942 - Use EGLConfig as argument of CreateEGLSurfaceForCompositorWidget() r=jgilbert
EGLConfig could be get from GLContextEGL. It is better to use it than re-creating EGLConfig. Differential Revision: https://phabricator.services.mozilla.com/D22274 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
91d9a90e20
commit
81c5f1f2b3
@ -91,9 +91,9 @@ class GLContextEGL : public GLContext {
|
||||
CreateContextFlags flags, const gfx::IntSize& size,
|
||||
const SurfaceCaps& minCaps, nsACString* const out_FailureId);
|
||||
|
||||
#if defined(MOZ_WAYLAND)
|
||||
#if defined(MOZ_WAYLAND) || defined(MOZ_WIDGET_ANDROID)
|
||||
static EGLSurface CreateEGLSurfaceForCompositorWidget(
|
||||
widget::CompositorWidget* aCompositorWidget, bool aForceAccelerated);
|
||||
widget::CompositorWidget* aCompositorWidget, const EGLConfig aConfig);
|
||||
#endif
|
||||
protected:
|
||||
friend class GLContextProviderEGL;
|
||||
|
@ -296,10 +296,10 @@ already_AddRefed<GLContext> GLContextEGLFactory::Create(
|
||||
return gl.forget();
|
||||
}
|
||||
|
||||
#if defined(MOZ_WAYLAND)
|
||||
#if defined(MOZ_WAYLAND) || defined(MOZ_WIDGET_ANDROID)
|
||||
/* static */
|
||||
EGLSurface GLContextEGL::CreateEGLSurfaceForCompositorWidget(
|
||||
widget::CompositorWidget* aCompositorWidget, bool aForceAccelerated) {
|
||||
widget::CompositorWidget* aCompositorWidget, const EGLConfig aConfig) {
|
||||
nsCString discardFailureId;
|
||||
if (!GLLibraryEGL::EnsureInitialized(false, &discardFailureId)) {
|
||||
gfxCriticalNote << "Failed to load EGL library 6!";
|
||||
@ -313,16 +313,8 @@ EGLSurface GLContextEGL::CreateEGLSurfaceForCompositorWidget(
|
||||
gfxCriticalNote << "window is null";
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
const bool useWebRender =
|
||||
aCompositorWidget->GetCompositorOptions().UseWebRender();
|
||||
|
||||
EGLConfig config;
|
||||
if (!CreateConfig(&config, useWebRender)) {
|
||||
gfxCriticalNote << "Failed to create EGLConfig!";
|
||||
return EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
return mozilla::gl::CreateSurfaceFromNativeWindow(window, config);
|
||||
return mozilla::gl::CreateSurfaceFromNativeWindow(window, aConfig);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -57,12 +57,10 @@ RenderCompositorEGL::CreateGLContext(RefPtr<widget::CompositorWidget> aWidget) {
|
||||
return gl.forget();
|
||||
}
|
||||
|
||||
/* static */
|
||||
EGLSurface RenderCompositorEGL::CreateEGLSurface(
|
||||
widget::CompositorWidget* aWidget) {
|
||||
EGLSurface RenderCompositorEGL::CreateEGLSurface() {
|
||||
EGLSurface surface = EGL_NO_SURFACE;
|
||||
surface = gl::GLContextEGL::CreateEGLSurfaceForCompositorWidget(
|
||||
aWidget, /* aForceAccelerated */ true);
|
||||
mWidget, gl::GLContextEGL::Cast(gl())->mConfig);
|
||||
if (surface == EGL_NO_SURFACE) {
|
||||
gfxCriticalNote << "Failed to create EGLSurface";
|
||||
}
|
||||
@ -84,7 +82,7 @@ bool RenderCompositorEGL::BeginFrame() {
|
||||
mWidget->AsX11()->WaylandRequestsUpdatingEGLSurface()) {
|
||||
// Destroy EGLSurface if it exists.
|
||||
DestroyEGLSurface();
|
||||
mEGLSurface = CreateEGLSurface(mWidget);
|
||||
mEGLSurface = CreateEGLSurface();
|
||||
gl::GLContextEGL::Cast(gl())->SetEGLSurfaceOverride(mEGLSurface);
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class RenderCompositorEGL : public RenderCompositor {
|
||||
protected:
|
||||
static already_AddRefed<gl::GLContext> CreateGLContext(
|
||||
RefPtr<widget::CompositorWidget> aWidget);
|
||||
static EGLSurface CreateEGLSurface(widget::CompositorWidget* aWidget);
|
||||
EGLSurface CreateEGLSurface();
|
||||
|
||||
void DestroyEGLSurface();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user