Re: [Mesa-dev] [PATCH mesa 2/5] egl: Move _eglPointerIsDereferencable() to eglglobals.[ch]

2017-07-19 Thread Miguel Angel Vico


On Wed, 19 Jul 2017 11:36:59 +0100
Emil Velikov  wrote:

> On 18 July 2017 at 21:49, Miguel A. Vico  wrote:
> > More _eglPointerIsDereferencable() to eglglobals.[ch] and make it a
> > non-static function so it can be used out of egldisplay.c
> >  
> s/More/Move/

Done.

> 
> > Signed-off-by: Miguel A. Vico 
> > Reviewed-by: James Jones   
> Reviewed-by: Emil Velikov 

Thanks. I sent the new rebased v2 version. Could you push on my behalf?

> 
> -Emil

Thanks.

-- 
Miguel


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH mesa 2/5] egl: Move _eglPointerIsDereferencable() to eglglobals.[ch]

2017-07-19 Thread Emil Velikov
On 18 July 2017 at 21:49, Miguel A. Vico  wrote:
> More _eglPointerIsDereferencable() to eglglobals.[ch] and make it a
> non-static function so it can be used out of egldisplay.c
>
s/More/Move/

> Signed-off-by: Miguel A. Vico 
> Reviewed-by: James Jones 
Reviewed-by: Emil Velikov 

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH mesa 2/5] egl: Move _eglPointerIsDereferencable() to eglglobals.[ch]

2017-07-18 Thread Miguel A. Vico
More _eglPointerIsDereferencable() to eglglobals.[ch] and make it a
non-static function so it can be used out of egldisplay.c

Signed-off-by: Miguel A. Vico 
Reviewed-by: James Jones 
---
 src/egl/main/egldisplay.c | 33 -
 src/egl/main/eglglobals.c | 31 +++
 src/egl/main/eglglobals.h |  6 ++
 3 files changed, 37 insertions(+), 33 deletions(-)

diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 7aaab3c2c9..690728d2f7 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -49,10 +49,6 @@
 #include "eglsync.h"
 
 /* Includes for _eglNativePlatformDetectNativeDisplay */
-#ifdef HAVE_MINCORE
-#include 
-#include 
-#endif
 #ifdef HAVE_WAYLAND_PLATFORM
 #include 
 #endif
@@ -106,35 +102,6 @@ _eglGetNativePlatformFromEnv(void)
 
 
 /**
- * Perform validity checks on a generic pointer.
- */
-static EGLBoolean
-_eglPointerIsDereferencable(void *p)
-{
-#ifdef HAVE_MINCORE
-   uintptr_t addr = (uintptr_t) p;
-   unsigned char valid = 0;
-   const long page_size = getpagesize();
-
-   if (p == NULL)
-  return EGL_FALSE;
-
-   /* align addr to page_size */
-   addr &= ~(page_size - 1);
-
-   if (mincore((void *) addr, page_size, &valid) < 0) {
-  _eglLog(_EGL_DEBUG, "mincore failed: %m");
-  return EGL_FALSE;
-   }
-
-   return (valid & 0x01) == 0x01;
-#else
-   return p != NULL;
-#endif
-}
-
-
-/**
  * Try detecting native platform with the help of native display 
characteristcs.
  */
 static _EGLPlatformType
diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c
index baf96bb1ec..6fdc6c31ce 100644
--- a/src/egl/main/eglglobals.c
+++ b/src/egl/main/eglglobals.c
@@ -37,6 +37,12 @@
 #include "eglglobals.h"
 #include "egldisplay.h"
 #include "egldriver.h"
+#include "egllog.h"
+
+#ifdef HAVE_MINCORE
+#include 
+#include 
+#endif
 
 
 static mtx_t _eglGlobalMutex = _MTX_INITIALIZER_NP;
@@ -142,3 +148,28 @@ _eglGetClientExtensionString(void)
mtx_unlock(_eglGlobal.Mutex);
return ret;
 }
+
+EGLBoolean
+_eglPointerIsDereferencable(void *p)
+{
+#ifdef HAVE_MINCORE
+   uintptr_t addr = (uintptr_t) p;
+   unsigned char valid = 0;
+   const long page_size = getpagesize();
+
+   if (p == NULL)
+  return EGL_FALSE;
+
+   /* align addr to page_size */
+   addr &= ~(page_size - 1);
+
+   if (mincore((void *) addr, page_size, &valid) < 0) {
+  _eglLog(_EGL_DEBUG, "mincore failed: %m");
+  return EGL_FALSE;
+   }
+
+   return (valid & 0x01) == 0x01;
+#else
+   return p != NULL;
+#endif
+}
diff --git a/src/egl/main/eglglobals.h b/src/egl/main/eglglobals.h
index c6ef59d482..6655ccab65 100644
--- a/src/egl/main/eglglobals.h
+++ b/src/egl/main/eglglobals.h
@@ -87,4 +87,10 @@ static inline unsigned int DebugBitFromType(EGLenum type)
 extern const char *
 _eglGetClientExtensionString(void);
 
+/**
+ * Perform validity checks on a generic pointer.
+ */
+extern EGLBoolean
+_eglPointerIsDereferencable(void *p);
+
 #endif /* EGLGLOBALS_INCLUDED */
-- 
2.12.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev