Hey team,
Here's another small series, removing more code: - drop 14 year old workaround for broken ATI drivers
- drop the RTLD_GLOBAL hack - the respective libs have not been under linked for years
- bumps Xrender requirement to 0.9.1 - distros are shipping 0.9.10 for a while now
Any input, comments and suggestions are greatly apprecaited, Emil
Emil Velikov (3): winex11.drv: stop using RTLD_GLOBAL winex11.drv: remove workaround for ancient ATI drivers winex11.drv: require Xrender 0.9.1
configure.ac | 6 ++---- dlls/winex11.drv/opengl.c | 21 +++------------------ dlls/winex11.drv/x11drv_main.c | 6 +++--- dlls/winex11.drv/xrandr.c | 2 +- dlls/winex11.drv/xrender.c | 20 ++------------------ include/config.h.in | 6 ------ 6 files changed, 11 insertions(+), 50 deletions(-)
The flag was required to promote internal symbols into the global name space. That was required since a few of the libraries were under-linked.
The last one being Mesa's libGL and dri drivers.
In there, older versions of Mesa were missing the libglapi symbols, which were resolved via RTLD_GLOBAL hack(s).
That hasn't no been an issue for over 5 years, so drop these workarounds.
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- I would wager that other in-tree RTLD_GLOBAL users are similar in nature. Yet I lack the specific knowledge - hence I've left them as-is. --- dlls/winex11.drv/opengl.c | 2 +- dlls/winex11.drv/x11drv_main.c | 6 +++--- dlls/winex11.drv/xrandr.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 791787cfd3a..6741daa42fb 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -551,7 +551,7 @@ static BOOL WINAPI init_opengl( INIT_ONCE *once, void *param, void **context )
/* No need to load any other libraries as according to the ABI, libGL should be self-sufficient and include all dependencies */ - opengl_handle = dlopen( SONAME_LIBGL, RTLD_NOW | RTLD_GLOBAL ); + opengl_handle = dlopen( SONAME_LIBGL, RTLD_NOW ); if (opengl_handle == NULL) { ERR( "Failed to load libGL: %s\n", dlerror() ); diff --git a/dlls/winex11.drv/x11drv_main.c b/dlls/winex11.drv/x11drv_main.c index e8b273d055e..b8b557e3546 100644 --- a/dlls/winex11.drv/x11drv_main.c +++ b/dlls/winex11.drv/x11drv_main.c @@ -474,7 +474,7 @@ static int xcomp_error_base;
static void X11DRV_XComposite_Init(void) { - void *xcomposite_handle = dlopen(SONAME_LIBXCOMPOSITE, RTLD_NOW); + void *xcomposite_handle = dlopen(SONAME_LIBXCOMPOSITE, RTLD_NOW ); if (!xcomposite_handle) { TRACE("Unable to open %s, XComposite disabled\n", SONAME_LIBXCOMPOSITE); @@ -573,7 +573,7 @@ static void init_visuals( Display *display, int screen ) static BOOL process_attach(void) { Display *display; - void *libx11 = dlopen( SONAME_LIBX11, RTLD_NOW|RTLD_GLOBAL ); + void *libx11 = dlopen( SONAME_LIBX11, RTLD_NOW );
if (!libx11) { @@ -583,7 +583,7 @@ static BOOL process_attach(void) pXGetEventData = dlsym( libx11, "XGetEventData" ); pXFreeEventData = dlsym( libx11, "XFreeEventData" ); #ifdef SONAME_LIBXEXT - dlopen( SONAME_LIBXEXT, RTLD_NOW|RTLD_GLOBAL ); + dlopen( SONAME_LIBXEXT, RTLD_NOW ); #endif
setup_options(); diff --git a/dlls/winex11.drv/xrandr.c b/dlls/winex11.drv/xrandr.c index 8faece9023a..3c9ef27ff5f 100644 --- a/dlls/winex11.drv/xrandr.c +++ b/dlls/winex11.drv/xrandr.c @@ -88,7 +88,7 @@ static int load_xrandr(void) { int r = 0;
- if (dlopen(SONAME_LIBXRENDER, RTLD_NOW|RTLD_GLOBAL) && + if (dlopen(SONAME_LIBXRENDER, RTLD_NOW) && (xrandr_handle = dlopen(SONAME_LIBXRANDR, RTLD_NOW))) {
Remove the UseFastTls workaround. It was added in 2007 and should no longer be required.
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- dlls/winex11.drv/opengl.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 6741daa42fb..ea2912837d2 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -439,24 +439,9 @@ static BOOL X11DRV_WineGL_InitOpenglInfo(void) attr.border_pixel = 0;
vis = pglXChooseVisual(gdi_display, screen, attribList); - if (vis) { -#ifdef __i386__ - WORD old_fs, new_fs; - __asm__( "mov %%fs,%0" : "=r" (old_fs) ); - /* Create a GLX Context. Without one we can't query GL information */ + if (vis) ctx = pglXCreateContext(gdi_display, vis, None, GL_TRUE); - __asm__( "mov %%fs,%0" : "=r" (new_fs) ); - __asm__( "mov %0,%%fs" :: "r" (old_fs) ); - if (old_fs != new_fs) - { - ERR( "%%fs register corrupted, probably broken ATI driver, disabling OpenGL.\n" ); - ERR( "You need to set the "UseFastTls" option to "2" in your X config file.\n" ); - goto done; - } -#else - ctx = pglXCreateContext(gdi_display, vis, None, GL_TRUE); -#endif - } + if (!ctx) goto done;
root = RootWindow( gdi_display, vis->screen );
Bump the requirement to 0.9.1, released over 10 years ago. Even older distributions ship much newer version. For example:
Debian 10 (Buster) oldstable - 0.9.10 Ubuntu 18.04 (Bionic) - 0.9.10
Signed-off-by: Emil Velikov emil.l.velikov@gmail.com --- configure.ac | 6 ++---- dlls/winex11.drv/xrender.c | 20 ++------------------ include/config.h.in | 6 ------ 3 files changed, 4 insertions(+), 28 deletions(-)
diff --git a/configure.ac b/configure.ac index 530785c0033..b8dbf8dfb38 100644 --- a/configure.ac +++ b/configure.ac @@ -1167,11 +1167,9 @@ then then WINE_CHECK_SONAME(Xrender,XRenderQueryExtension, [AC_CHECK_LIB(Xrender,XRenderSetPictureTransform, - [AC_DEFINE(HAVE_XRENDERSETPICTURETRANSFORM, 1, - [Define if Xrender has the XRenderSetPictureTransform function])],,[$X_LIBS $X_EXTRA_LIBS]) + ,[AC_MSG_ERROR([Xrender library too old, missing XRenderSetPictureTransform])],[$X_LIBS $X_EXTRA_LIBS]) AC_CHECK_LIB(Xrender,XRenderCreateLinearGradient, - [AC_DEFINE(HAVE_XRENDERCREATELINEARGRADIENT, 1, - [Define if Xrender has the XRenderCreateLinearGradient function])],,[$X_LIBS $X_EXTRA_LIBS])],,[$X_LIBS $X_EXTRA_LIBS]) + ,[AC_MSG_ERROR([Xrender library too old, missing XRenderCreateLinearGradient])],[$X_LIBS $X_EXTRA_LIBS])],,[$X_LIBS $X_EXTRA_LIBS])
fi WINE_WARNING_WITH(xrender,[test "x$ac_cv_lib_soname_Xrender" = "x"], diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index ac19af79e10..20f9d42cf01 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -179,12 +179,8 @@ MAKE_FUNCPTR(XRenderFindVisualFormat) MAKE_FUNCPTR(XRenderFreeGlyphSet) MAKE_FUNCPTR(XRenderFreePicture) MAKE_FUNCPTR(XRenderSetPictureClipRectangles) -#ifdef HAVE_XRENDERCREATELINEARGRADIENT MAKE_FUNCPTR(XRenderCreateLinearGradient) -#endif -#ifdef HAVE_XRENDERSETPICTURETRANSFORM MAKE_FUNCPTR(XRenderSetPictureTransform) -#endif MAKE_FUNCPTR(XRenderQueryExtension)
#undef MAKE_FUNCPTR @@ -328,7 +324,6 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void) if (!(xrender_handle = dlopen(SONAME_LIBXRENDER, RTLD_NOW))) return NULL;
#define LOAD_FUNCPTR(f) if((p##f = dlsym(xrender_handle, #f)) == NULL) return NULL -#define LOAD_OPTIONAL_FUNCPTR(f) p##f = dlsym(xrender_handle, #f) LOAD_FUNCPTR(XRenderAddGlyphs); LOAD_FUNCPTR(XRenderChangePicture); LOAD_FUNCPTR(XRenderComposite); @@ -342,13 +337,8 @@ const struct gdi_dc_funcs *X11DRV_XRender_Init(void) LOAD_FUNCPTR(XRenderFreePicture); LOAD_FUNCPTR(XRenderSetPictureClipRectangles); LOAD_FUNCPTR(XRenderQueryExtension); -#ifdef HAVE_XRENDERCREATELINEARGRADIENT - LOAD_OPTIONAL_FUNCPTR(XRenderCreateLinearGradient); -#endif -#ifdef HAVE_XRENDERSETPICTURETRANSFORM - LOAD_OPTIONAL_FUNCPTR(XRenderSetPictureTransform); -#endif -#undef LOAD_OPTIONAL_FUNCPTR + LOAD_FUNCPTR(XRenderCreateLinearGradient); + LOAD_FUNCPTR(XRenderSetPictureTransform); #undef LOAD_FUNCPTR
if (!pXRenderQueryExtension(gdi_display, &event_base, &xrender_error_base)) return NULL; @@ -451,7 +441,6 @@ static enum wxr_format get_xrender_format_from_bitmapinfo( const BITMAPINFO *inf /* Set the x/y scaling and x/y offsets in the transformation matrix of the source picture */ static void set_xrender_transformation(Picture src_pict, double xscale, double yscale, int xoffset, int yoffset) { -#ifdef HAVE_XRENDERSETPICTURETRANSFORM XTransform xform = {{ { XDoubleToFixed(xscale), XDoubleToFixed(0), XDoubleToFixed(xoffset) }, { XDoubleToFixed(0), XDoubleToFixed(yscale), XDoubleToFixed(yoffset) }, @@ -459,7 +448,6 @@ static void set_xrender_transformation(Picture src_pict, double xscale, double y }};
pXRenderSetPictureTransform(gdi_display, src_pict, &xform); -#endif }
static void update_xrender_clipping( struct xrender_physdev *dev, HRGN rgn ) @@ -2018,7 +2006,6 @@ static BOOL CDECL xrenderdrv_AlphaBlend( PHYSDEV dst_dev, struct bitblt_coords * static BOOL CDECL xrenderdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert, void * grad_array, ULONG ngrad, ULONG mode ) { -#ifdef HAVE_XRENDERCREATELINEARGRADIENT static const XFixed stops[2] = { 0, 1 << 16 }; struct xrender_physdev *physdev = get_xrender_dev( dev ); XLinearGradient gradient; @@ -2029,8 +2016,6 @@ static BOOL CDECL xrenderdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, U RECT rc; POINT pt[2];
- if (!pXRenderCreateLinearGradient) goto fallback; - /* <= 16-bpp uses dithering */ if (!physdev->pict_format || physdev->pict_format->depth <= 16) goto fallback;
@@ -2111,7 +2096,6 @@ static BOOL CDECL xrenderdrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, U }
fallback: -#endif dev = GET_NEXT_PHYSDEV( dev, pGradientFill ); return dev->funcs->pGradientFill( dev, vert_array, nvert, grad_array, ngrad, mode ); } diff --git a/include/config.h.in b/include/config.h.in index e975ca8a55d..d9d41890c5d 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -926,12 +926,6 @@ /* Define if libxml2 has the xmlSchemaSetValidStructuredErrors function */ #undef HAVE_XMLSCHEMASSETVALIDSTRUCTUREDERRORS
-/* Define if Xrender has the XRenderCreateLinearGradient function */ -#undef HAVE_XRENDERCREATELINEARGRADIENT - -/* Define if Xrender has the XRenderSetPictureTransform function */ -#undef HAVE_XRENDERSETPICTURETRANSFORM - /* Define if Xrandr has the XRRGetProviderResources function */ #undef HAVE_XRRGETPROVIDERRESOURCES