Hi Kristian,

This patch fixes EGL breakage after -fvisibility=hidden.  Please check.

-olv
From 70c8aadb47615814b2596c775fb8c94ef2ca218c Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olva...@gmail.com>
Date: Tue, 5 Jan 2010 21:39:15 +0800
Subject: [PATCH] egl: Fix breakage from -fvisibility=hidden.

Mark EGL API and driver functions as PUBLIC.  Remove unnecessary
call to _eglSwapBuffers in egl_softpipe.

Signed-off-by: Chia-I Wu <olva...@gmail.com>
---
 include/EGL/eglplatform.h              |    5 +++++
 src/egl/main/eglcompiler.h             |   10 ++++++++++
 src/egl/main/eglconfig.h               |   14 +++++++-------
 src/egl/main/eglconfigutil.h           |    6 +++---
 src/egl/main/eglcontext.h              |    4 ++--
 src/egl/main/eglcurrent.h              |   10 +++++-----
 src/egl/main/egldisplay.h              |    4 ++--
 src/egl/main/egldriver.h               |    7 ++++---
 src/egl/main/egllog.h                  |    6 +++---
 src/egl/main/eglmode.h                 |    2 +-
 src/egl/main/eglscreen.h               |    6 +++---
 src/egl/main/eglsurface.h              |    2 +-
 src/gallium/winsys/egl_xlib/egl_xlib.c |   22 ++++++++--------------
 13 files changed, 54 insertions(+), 44 deletions(-)

diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
index 9e83b60..09abb5d 100644
--- a/include/EGL/eglplatform.h
+++ b/include/EGL/eglplatform.h
@@ -18,6 +18,11 @@
 #include <stdint.h>
 #endif
 
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
+#  define EGLAPI __attribute__((visibility("default")))
+#  define EGLAPIENTRY
+#endif
+
 /* Macros used in EGL function prototype declarations.
  *
  * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
diff --git a/src/egl/main/eglcompiler.h b/src/egl/main/eglcompiler.h
index 6b639b7..f7c93f1 100644
--- a/src/egl/main/eglcompiler.h
+++ b/src/egl/main/eglcompiler.h
@@ -61,4 +61,14 @@
 #endif
 
 
+/**
+ * Function visibility
+ */
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303
+#  define PUBLIC __attribute__((visibility("default")))
+#else
+#  define PUBLIC
+#endif
+
+
 #endif /* EGLCOMPILER_INCLUDED */
diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
index 6b8a259..799bf4e 100644
--- a/src/egl/main/eglconfig.h
+++ b/src/egl/main/eglconfig.h
@@ -91,11 +91,11 @@ _eglSetConfigAttrib(_EGLConfig *conf, EGLint attr, EGLint val)
 }
 
 
-extern void
+PUBLIC void
 _eglInitConfig(_EGLConfig *config, EGLint id);
 
 
-extern EGLConfig
+PUBLIC EGLConfig
 _eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf);
 
 
@@ -144,24 +144,24 @@ _eglGetConfigHandle(_EGLConfig *conf)
 }
 
 
-extern EGLBoolean
+PUBLIC EGLBoolean
 _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching);
 
 
-extern EGLBoolean
+PUBLIC EGLBoolean
 _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria);
 
 
-extern EGLBoolean
+PUBLIC EGLBoolean
 _eglParseConfigAttribList(_EGLConfig *conf, const EGLint *attrib_list);
 
 
-extern EGLint
+PUBLIC EGLint
 _eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2,
                    const _EGLConfig *criteria, EGLBoolean compare_id);
 
 
-extern void
+PUBLIC void
 _eglSortConfigs(const _EGLConfig **configs, EGLint count,
                 EGLint (*compare)(const _EGLConfig *, const _EGLConfig *,
                                   void *),
diff --git a/src/egl/main/eglconfigutil.h b/src/egl/main/eglconfigutil.h
index 8c923ee..9f8906d 100644
--- a/src/egl/main/eglconfigutil.h
+++ b/src/egl/main/eglconfigutil.h
@@ -7,16 +7,16 @@
 #include "eglconfig.h"
 
 
-extern void
+PUBLIC void
 _eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode);
 
 
-extern EGLBoolean
+PUBLIC EGLBoolean
 _eglConfigFromContextModesRec(_EGLConfig *conf, const __GLcontextModes *m,
                               EGLint conformant, EGLint renderable_type);
 
 
-extern EGLBoolean
+PUBLIC EGLBoolean
 _eglFillInConfigs( _EGLConfig *configs,
                    EGLenum fb_format, EGLenum fb_type,
                    const uint8_t * depth_bits, const uint8_t * stencil_bits,
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index 45c7b47..cb9e3f4 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -30,7 +30,7 @@ struct _egl_context
 };
 
 
-extern EGLBoolean
+PUBLIC EGLBoolean
 _eglInitContext(_EGLDriver *drv, _EGLContext *ctx,
                 _EGLConfig *config, const EGLint *attrib_list);
 
@@ -47,7 +47,7 @@ extern EGLBoolean
 _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx, EGLint attribute, EGLint *value);
 
 
-extern EGLBoolean
+PUBLIC EGLBoolean
 _eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurface *read, _EGLContext *ctx);
 
 
diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h
index 9503e0a..c4478b3 100644
--- a/src/egl/main/eglcurrent.h
+++ b/src/egl/main/eglcurrent.h
@@ -60,7 +60,7 @@ _eglConvertApiFromIndex(EGLint idx)
 }
 
 
-extern _EGLThreadInfo *
+PUBLIC _EGLThreadInfo *
 _eglGetCurrentThread(void);
 
 
@@ -72,19 +72,19 @@ extern EGLBoolean
 _eglIsCurrentThreadDummy(void);
 
 
-extern _EGLContext *
+PUBLIC _EGLContext *
 _eglGetCurrentContext(void);
 
 
-extern _EGLDisplay *
+PUBLIC _EGLDisplay *
 _eglGetCurrentDisplay(void);
 
 
-extern _EGLSurface *
+PUBLIC _EGLSurface *
 _eglGetCurrentSurface(EGLint readdraw);
 
 
-extern EGLBoolean
+PUBLIC EGLBoolean
 _eglError(EGLint errCode, const char *msg);
 
 
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index ea4e35a..4f619e5 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -78,11 +78,11 @@ extern _EGLDisplay *
 _eglFindDisplay(NativeDisplayType nativeDisplay);
 
 
-extern void
+PUBLIC void
 _eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *dpy);
 
 
-extern void
+PUBLIC void
 _eglCleanupDisplay(_EGLDisplay *disp);
 
 
diff --git a/src/egl/main/egldriver.h b/src/egl/main/egldriver.h
index 6c848eb..59bd195 100644
--- a/src/egl/main/egldriver.h
+++ b/src/egl/main/egldriver.h
@@ -25,7 +25,8 @@ struct _egl_driver
 };
 
 
-extern _EGLDriver *_eglMain(const char *args);
+PUBLIC _EGLDriver *
+_eglMain(const char *args);
 
 
 extern const char *
@@ -48,11 +49,11 @@ extern _EGLDriver *
 _eglLookupDriver(EGLDisplay d);
 
 
-extern void
+PUBLIC void
 _eglInitDriverFallbacks(_EGLDriver *drv);
 
 
-extern EGLint
+PUBLIC EGLint
 _eglFindAPIs(void);
 
 
diff --git a/src/egl/main/egllog.h b/src/egl/main/egllog.h
index 83c8bb7..3a99bfe 100644
--- a/src/egl/main/egllog.h
+++ b/src/egl/main/egllog.h
@@ -12,15 +12,15 @@
 typedef void (*_EGLLogProc)(EGLint level, const char *msg);
 
 
-extern void
+PUBLIC void
 _eglSetLogProc(_EGLLogProc logger);
 
 
-extern void
+PUBLIC void
 _eglSetLogLevel(EGLint level);
 
 
-extern void
+PUBLIC void
 _eglLog(EGLint level, const char *fmtStr, ...);
 
 
diff --git a/src/egl/main/eglmode.h b/src/egl/main/eglmode.h
index af7c2c5..a089a5e 100644
--- a/src/egl/main/eglmode.h
+++ b/src/egl/main/eglmode.h
@@ -29,7 +29,7 @@ extern _EGLMode *
 _eglLookupMode(EGLModeMESA mode, _EGLDisplay *dpy);
 
 
-extern _EGLMode *
+PUBLIC _EGLMode *
 _eglAddNewMode(_EGLScreen *screen, EGLint width, EGLint height,
                EGLint refreshRate, const char *name);
 
diff --git a/src/egl/main/eglscreen.h b/src/egl/main/eglscreen.h
index 8860a2a..d52e538 100644
--- a/src/egl/main/eglscreen.h
+++ b/src/egl/main/eglscreen.h
@@ -30,7 +30,7 @@ extern EGLScreenMESA
 _eglAllocScreenHandle(void);
 
 
-extern void
+PUBLIC void
 _eglInitScreen(_EGLScreen *screen);
 
 
@@ -38,7 +38,7 @@ extern _EGLScreen *
 _eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *dpy);
 
 
-extern void
+PUBLIC void
 _eglAddScreen(_EGLDisplay *display, _EGLScreen *screen);
 
 
@@ -83,7 +83,7 @@ extern void
 _eglDestroyScreenModes(_EGLScreen *scrn);
 
 
-extern void
+PUBLIC void
 _eglDestroyScreen(_EGLScreen *scrn);
 
 
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index b75fa9c..dacdf7e 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -40,7 +40,7 @@ struct _egl_surface
 };
 
 
-extern EGLBoolean
+PUBLIC EGLBoolean
 _eglInitSurface(_EGLDriver *drv, _EGLSurface *surf, EGLint type,
                 _EGLConfig *config, const EGLint *attrib_list);
 
diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c
index 599973c..420dccc 100644
--- a/src/gallium/winsys/egl_xlib/egl_xlib.c
+++ b/src/gallium/winsys/egl_xlib/egl_xlib.c
@@ -751,24 +751,18 @@ xlib_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
 static EGLBoolean
 xlib_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw)
 {
-   /* error checking step: */
-   if (!_eglSwapBuffers(drv, dpy, draw))
-      return EGL_FALSE;
-
-   {
-      struct xlib_egl_surface *xsurf = lookup_surface(draw);
-      struct pipe_winsys *pws = xsurf->winsys;
-      struct pipe_surface *psurf;
+   struct xlib_egl_surface *xsurf = lookup_surface(draw);
+   struct pipe_winsys *pws = xsurf->winsys;
+   struct pipe_surface *psurf;
 
-      st_get_framebuffer_surface(xsurf->Framebuffer, ST_SURFACE_BACK_LEFT,
-                                 &psurf);
+   st_get_framebuffer_surface(xsurf->Framebuffer, ST_SURFACE_BACK_LEFT,
+         &psurf);
 
-      st_notify_swapbuffers(xsurf->Framebuffer);
+   st_notify_swapbuffers(xsurf->Framebuffer);
 
-      display_surface(pws, psurf, xsurf);
+   display_surface(pws, psurf, xsurf);
 
-      check_and_update_buffer_size(xsurf);
-   }
+   check_and_update_buffer_size(xsurf);
 
    return EGL_TRUE;
 }
-- 
1.6.4.3

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to