Skip to content

Commit b0180f7

Browse files
committed
Faker: Extend VGL_CHROMEHACK to the GLX interposer
Referring to #264, this allows Chrome to use ANGLE's desktop OpenGL back end, which generally works better with nVidia's drivers than ANGLE's OpenGL ES back end.
1 parent bf99ec6 commit b0180f7

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

server/faker-egl.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (C)2005 Sun Microsystems, Inc.
2-
// Copyright (C)2011, 2014-2015, 2018, 2021-2024 D. R. Commander
2+
// Copyright (C)2011, 2014-2015, 2018, 2021-2025 D. R. Commander
33
//
44
// This library is free software and may be redistributed and/or modified under
55
// the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -122,9 +122,11 @@ static XVisualInfo *getVisualFromConfig(faker::EGLXDisplay *eglxdpy,
122122
&& _eglGetConfigAttrib(eglxdpy->edpy, config, EGL_ALPHA_SIZE, &alphaSize)
123123
&& alphaSize == 8)
124124
{
125-
XVisualInfo *v = glxvisual::getHighestScoringVisual(eglxdpy->x11dpy,
126-
eglxdpy->screen);
127-
if(v) return v;
125+
VisualID bestVisualID =
126+
glxvisual::getHighestScoringVisualID(eglxdpy->x11dpy, eglxdpy->screen);
127+
if(bestVisualID)
128+
return glxvisual::visualFromID(eglxdpy->x11dpy, eglxdpy->screen,
129+
bestVisualID);
128130
}
129131

130132
return getVisual(eglxdpy->x11dpy, eglxdpy->screen, depth, TrueColor);

server/glxvisual.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (C)2004 Landmark Graphics Corporation
22
// Copyright (C)2005 Sun Microsystems, Inc.
3-
// Copyright (C)2009-2016, 2019-2024 D. R. Commander
3+
// Copyright (C)2009-2016, 2019-2025 D. R. Commander
44
//
55
// This library is free software and may be redistributed and/or modified under
66
// the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -607,7 +607,10 @@ static void buildCfgAttribTable(Display *dpy, int screen)
607607

608608
for(int i = 0; i < nConfigs; i++)
609609
{
610-
ca[i].visualID = matchVisual2D(dpy, screen, &ca[i]);
610+
if(fconfig.chromeHack && ca[i].attr.alphaSize == 8)
611+
ca[i].visualID = getHighestScoringVisualID(dpy, screen);
612+
if(!ca[i].visualID)
613+
ca[i].visualID = matchVisual2D(dpy, screen, &ca[i]);
611614
if(fconfig.trace && ca[i].visualID)
612615
vglout.println("[VGL] FB config 0x%.2x has attached visual 0x%.2x",
613616
ca[i].id, (unsigned int)ca[i].visualID);
@@ -1088,9 +1091,9 @@ VGLFBConfig getDefaultFBConfig(Display *dpy, int screen, VisualID vid)
10881091
}
10891092

10901093

1091-
XVisualInfo *getHighestScoringVisual(Display *dpy, int screen)
1094+
VisualID getHighestScoringVisualID(Display *dpy, int screen)
10921095
{
1093-
if(!dpy) return NULL;
1096+
if(!dpy) return 0;
10941097

10951098
int highestScore = -1;
10961099
VisualID bestVisualID =
@@ -1107,8 +1110,7 @@ XVisualInfo *getHighestScoringVisual(Display *dpy, int screen)
11071110
}
11081111
}
11091112

1110-
if(bestVisualID) return visualFromID(dpy, screen, bestVisualID);
1111-
else return NULL;
1113+
return bestVisualID;
11121114
}
11131115

11141116
} // namespace

server/glxvisual.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright (C)2004 Landmark Graphics Corporation
22
// Copyright (C)2005 Sun Microsystems, Inc.
3-
// Copyright (C)2014, 2019-2021, 2024 D. R. Commander
3+
// Copyright (C)2014, 2019-2021, 2024-2025 D. R. Commander
44
//
55
// This library is free software and may be redistributed and/or modified under
66
// the terms of the wxWindows Library License, Version 3.1 or (at your option)
@@ -78,7 +78,7 @@ namespace glxvisual
7878
// in the visual attribute table.
7979
VGLFBConfig getDefaultFBConfig(Display *dpy, int screen, VisualID vid);
8080

81-
XVisualInfo *getHighestScoringVisual(Display *dpy, int screen);
81+
VisualID getHighestScoringVisualID(Display *dpy, int screen);
8282
}
8383

8484

0 commit comments

Comments
 (0)