зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1733094 - Assume UseWebRender for FindVisual, r=stransky,emilio
`gfxVars::UseWebRender()` now always returns `true` thus stop passing it around as argument. At the same time, WR does not require a depth buffer any more, thus stop requesting it when choosing a matching XVisual. While on it, also stop requesting an alpha channel were it shouldn't be needed. This point will require some regression testing, making this patch 95 material. Differential Revision: https://phabricator.services.mozilla.com/D126922
This commit is contained in:
Родитель
41fd1abba4
Коммит
d7319e8f22
|
@ -113,8 +113,7 @@ class GLContextEGL final : public GLContext {
|
|||
widget::CompositorWidget* aCompositorWidget, const EGLConfig aConfig);
|
||||
|
||||
#ifdef MOZ_X11
|
||||
static bool FindVisual(bool aUseWebRender, bool useAlpha,
|
||||
int* const out_visualId);
|
||||
static bool FindVisual(bool useAlpha, int* const out_visualId);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
|
|
@ -24,8 +24,8 @@ class GLContextGLX : public GLContext {
|
|||
GLXDrawable drawable, GLXFBConfig cfg, bool deleteDrawable,
|
||||
gfxXlibSurface* pixmap);
|
||||
|
||||
static bool FindVisual(Display* display, int screen, bool useWebRender,
|
||||
bool useAlpha, int* const out_visualId);
|
||||
static bool FindVisual(Display* display, int screen, bool useAlpha,
|
||||
int* const out_visualId);
|
||||
|
||||
// Finds a GLXFBConfig compatible with the provided window.
|
||||
static bool FindFBConfigForWindow(
|
||||
|
|
|
@ -1110,8 +1110,7 @@ static EGLConfig ChooseConfig(EglDisplay& egl, const GLContextCreateDesc& desc,
|
|||
|
||||
#ifdef MOZ_X11
|
||||
/* static */
|
||||
bool GLContextEGL::FindVisual(bool aUseWebRender, bool useAlpha,
|
||||
int* const out_visualId) {
|
||||
bool GLContextEGL::FindVisual(bool useAlpha, int* const out_visualId) {
|
||||
nsCString discardFailureId;
|
||||
const auto egl = DefaultEglDisplay(&discardFailureId);
|
||||
if (!egl) {
|
||||
|
@ -1122,7 +1121,8 @@ bool GLContextEGL::FindVisual(bool aUseWebRender, bool useAlpha,
|
|||
|
||||
EGLConfig config;
|
||||
const int bpp = useAlpha ? 32 : 24;
|
||||
if (!CreateConfig(*egl, &config, bpp, aUseWebRender, /* aUseGles */ false)) {
|
||||
if (!CreateConfig(*egl, &config, bpp, /* aEnableDepthBuffer */ false,
|
||||
/* aUseGles */ false)) {
|
||||
gfxCriticalNote
|
||||
<< "GLContextEGL::FindVisual(): Failed to create EGLConfig!";
|
||||
return false;
|
||||
|
|
|
@ -700,8 +700,8 @@ static bool ChooseConfig(GLXLibrary* glx, Display* display, int screen,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool GLContextGLX::FindVisual(Display* display, int screen, bool useWebRender,
|
||||
bool useAlpha, int* const out_visualId) {
|
||||
bool GLContextGLX::FindVisual(Display* display, int screen, bool useAlpha,
|
||||
int* const out_visualId) {
|
||||
if (!sGLXLibrary.EnsureInitialized(display)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -738,7 +738,6 @@ bool GLContextGLX::FindVisual(Display* display, int screen, bool useWebRender,
|
|||
|
||||
const int bpp = useAlpha ? 32 : 24;
|
||||
const int alphaSize = useAlpha ? 8 : 0;
|
||||
const int depthSize = useWebRender ? 24 : 0;
|
||||
|
||||
for (auto& cur : visualInfos) {
|
||||
const auto fnConfigMatches = [&](const int pname, const int expected) {
|
||||
|
@ -761,7 +760,7 @@ bool GLContextGLX::FindVisual(Display* display, int screen, bool useWebRender,
|
|||
fnConfigMatches(LOCAL_GLX_GREEN_SIZE, 8) &&
|
||||
fnConfigMatches(LOCAL_GLX_BLUE_SIZE, 8) &&
|
||||
fnConfigMatches(LOCAL_GLX_ALPHA_SIZE, alphaSize) &&
|
||||
fnConfigMatches(LOCAL_GLX_DEPTH_SIZE, depthSize)) {
|
||||
fnConfigMatches(LOCAL_GLX_DEPTH_SIZE, 0)) {
|
||||
*out_visualId = cur.visualid;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -5143,17 +5143,12 @@ static GdkWindow* CreateGdkWindow(GdkWindow* parent, GtkWidget* widget) {
|
|||
return window;
|
||||
}
|
||||
|
||||
// Configure GL visual on X11. We add alpha silently
|
||||
// if we use WebRender to workaround NVIDIA specific Bug 1663273.
|
||||
// Configure GL visual on X11.
|
||||
bool nsWindow::ConfigureX11GLVisual(bool aUseAlpha) {
|
||||
if (!GdkIsX11Display()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If using WebRender on X11, we need to select a visual with a depth
|
||||
// buffer, as well as an alpha channel if transparency is requested. This
|
||||
// must be done before the widget is realized.
|
||||
bool useWebRender = gfx::gfxVars::UseWebRender();
|
||||
auto* screen = gtk_widget_get_screen(mShell);
|
||||
int visualId = 0;
|
||||
bool haveVisual;
|
||||
|
@ -5170,11 +5165,10 @@ bool nsWindow::ConfigureX11GLVisual(bool aUseAlpha) {
|
|||
if (!gfxVars::UseEGL() || isMesa) {
|
||||
auto* display = GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(mShell));
|
||||
int screenNumber = GDK_SCREEN_XNUMBER(screen);
|
||||
haveVisual = GLContextGLX::FindVisual(display, screenNumber, useWebRender,
|
||||
aUseAlpha || useWebRender, &visualId);
|
||||
haveVisual =
|
||||
GLContextGLX::FindVisual(display, screenNumber, aUseAlpha, &visualId);
|
||||
} else {
|
||||
haveVisual = GLContextEGL::FindVisual(useWebRender,
|
||||
aUseAlpha || useWebRender, &visualId);
|
||||
haveVisual = GLContextEGL::FindVisual(aUseAlpha, &visualId);
|
||||
}
|
||||
|
||||
GdkVisual* gdkVisual = nullptr;
|
||||
|
@ -5185,7 +5179,7 @@ bool nsWindow::ConfigureX11GLVisual(bool aUseAlpha) {
|
|||
}
|
||||
if (!gdkVisual) {
|
||||
NS_WARNING("We're missing X11 Visual!");
|
||||
if (aUseAlpha || useWebRender) {
|
||||
if (aUseAlpha) {
|
||||
// We try to use a fallback alpha visual
|
||||
GdkScreen* screen = gtk_widget_get_screen(mShell);
|
||||
gdkVisual = gdk_screen_get_rgba_visual(screen);
|
||||
|
|
Загрузка…
Ссылка в новой задаче