[Mesa-dev] [PATCH 4/4] Disable use of weak in threads_posix.h on Cygwin

2016-06-13 Thread Jon Turney
Weak doesn't work the same on PE/COFF as on ELF, they are only weak
references.  Specifically, since nothing else pulls in the object which
contains pthread_mutexattr_init() (and coming from the C library, that is
the only thing that object contains), means that it ends up as 0

Signed-off-by: Jon Turney 
---
 include/c11/threads_posix.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 61b7fab..43e803e 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -184,7 +184,7 @@ mtx_destroy(mtx_t *mtx)
  * Thus the linker will be happy and things don't clash when building
  * with -O1 or greater.
  */
-#ifdef HAVE_FUNC_ATTRIBUTE_WEAK
+#if defined(HAVE_FUNC_ATTRIBUTE_WEAK) && !defined(__CYGWIN__)
 __attribute__((weak))
 int pthread_mutexattr_init(pthread_mutexattr_t *attr);
 
-- 
2.8.3

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


[Mesa-dev] [PATCH 0/4] Various Cygwin fixes

2016-06-13 Thread Jon Turney
Jon Turney (2):
  configure: Don't require pthread-stubs on Cygwin
  Disable use of weak in threads_posix.h on Cygwin

Yaakov Selkowitz (2):
  configure: Define _GNU_SOURCE for Cygwin as well
  Use correct names for dlopen()ed files on Cygwin

 configure.ac   | 23 ---
 include/c11/threads_posix.h|  2 +-
 src/egl/drivers/dri2/egl_dri2.c|  2 ++
 src/gallium/auxiliary/util/u_format_s3tc.c |  2 ++
 src/glx/dri_common.c   |  3 +++
 src/mesa/main/texcompress_s3tc.c   |  2 ++
 6 files changed, 26 insertions(+), 8 deletions(-)

-- 
2.8.3

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


[Mesa-dev] [PATCH 3/4] configure: Don't require pthread-stubs on Cygwin

2016-06-13 Thread Jon Turney
Commit 1f4869a2 unconditionally requires pthread-stubs.  Unfortunately, the
cleverness that pthread-stubs is doesn't work with PE/COFF, and historically
Cygwin doesn't have a pthread-stubs.pc.

Don't require pthread-stubs on Cygwin.

Signed-off-by: Jon Turney 
---
 configure.ac | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4967c56..8c40446 100644
--- a/configure.ac
+++ b/configure.ac
@@ -822,9 +822,21 @@ dnl to -pthread, which causes problems if we need 
-lpthread to appear in
 dnl pkgconfig files.
 test -z "$PTHREAD_LIBS" && PTHREAD_LIBS="-lpthread"
 
-PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
-AC_SUBST(PTHREADSTUBS_CFLAGS)
-AC_SUBST(PTHREADSTUBS_LIBS)
+dnl pthread-stubs is mandatory on targets where it exists
+case "$host_os" in
+cygwin* )
+pthread_stubs_possible="no"
+;;
+* )
+pthread_stubs_possible="yes"
+;;
+esac
+
+if test "x$pthread_stubs_possible" = xyes; then
+PKG_CHECK_MODULES(PTHREADSTUBS, pthread-stubs)
+AC_SUBST(PTHREADSTUBS_CFLAGS)
+AC_SUBST(PTHREADSTUBS_LIBS)
+fi
 
 dnl SELinux awareness.
 AC_ARG_ENABLE([selinux],
-- 
2.8.3

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


[Mesa-dev] [PATCH 1/4] configure: Define _GNU_SOURCE for Cygwin as well

2016-06-13 Thread Jon Turney
From: Yaakov Selkowitz 

Cygwin headers are now a bit more correct in handling feature test macros,
so use _GNU_SOURCE when building for Cygwin, as well.

(Notwithstanding f381c27c, we should probably have always been using
_GNU_SOURCE, since asprintf() is used by mesa in places)

Signed-off-by: Yaakov Selkowitz 
Reviewed-by: Jon Turney 
---
 configure.ac | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index 33d1fef..4967c56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,15 +254,12 @@ case "$host_os" in
 *-android)
 android=yes
 ;;
-linux*|*-gnu*|gnu*)
+linux*|*-gnu*|gnu*|cygwin*)
 DEFINES="$DEFINES -D_GNU_SOURCE"
 ;;
 solaris*)
 DEFINES="$DEFINES -DSVR4"
 ;;
-cygwin*)
-DEFINES="$DEFINES -D_XOPEN_SOURCE=700"
-;;
 esac
 
 AM_CONDITIONAL(HAVE_ANDROID, test "x$android" = xyes)
-- 
2.8.3

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


[Mesa-dev] [PATCH 2/4] Use correct names for dlopen()ed files on Cygwin

2016-06-13 Thread Jon Turney
From: Yaakov Selkowitz 

Signed-off-by: Yaakov Selkowitz 
Reviewed-by: Jon Turney 
---
 src/egl/drivers/dri2/egl_dri2.c| 2 ++
 src/gallium/auxiliary/util/u_format_s3tc.c | 2 ++
 src/glx/dri_common.c   | 3 +++
 src/mesa/main/texcompress_s3tc.c   | 2 ++
 4 files changed, 9 insertions(+)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index bfde640..ac2be86 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2733,6 +2733,8 @@ dri2_load(_EGLDriver *drv)
const char *libname = "libglapi.so";
 #elif defined(__APPLE__)
const char *libname = "libglapi.0.dylib";
+#elif defined(__CYGWIN__)
+   const char *libname = "cygglapi-0.dll";
 #else
const char *libname = "libglapi.so.0";
 #endif
diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c 
b/src/gallium/auxiliary/util/u_format_s3tc.c
index cd3e165..8c4f215 100644
--- a/src/gallium/auxiliary/util/u_format_s3tc.c
+++ b/src/gallium/auxiliary/util/u_format_s3tc.c
@@ -32,6 +32,8 @@
 
 #if defined(_WIN32) || defined(WIN32)
 #define DXTN_LIBNAME "dxtn.dll"
+#elif defined(__CYGWIN__)
+#define DXTN_LIBNAME "cygtxc_dxtn.dll"
 #elif defined(__APPLE__)
 #define DXTN_LIBNAME "libtxc_dxtn.dylib"
 #else
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 6728d38..9cd320b 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -73,6 +73,9 @@ dri_message(int level, const char *f, ...)
}
 }
 
+#ifdef __CYGWIN__
+#define GL_LIB_NAME "cygGL-1.dll"
+#endif
 #ifndef GL_LIB_NAME
 #define GL_LIB_NAME "libGL.so.1"
 #endif
diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c
index 7ddb0ed..992ad05 100644
--- a/src/mesa/main/texcompress_s3tc.c
+++ b/src/mesa/main/texcompress_s3tc.c
@@ -46,6 +46,8 @@
 #define DXTN_LIBNAME "dxtn.dll"
 #define RTLD_LAZY 0
 #define RTLD_GLOBAL 0
+#elif defined(__CYGWIN__)
+#define DXTN_LIBNAME "cygtxc_dxtn.dll"
 #else
 #define DXTN_LIBNAME "libtxc_dxtn.so"
 #endif
-- 
2.8.3

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


Re: [Mesa-dev] [PATCH 2/6] ddebug: record and dump apitrace call numbers

2016-07-05 Thread Jon Turney

On 01/07/2016 00:21, Marek Olšák wrote:
[...]

diff --git a/src/gallium/drivers/ddebug/dd_util.h 
b/src/gallium/drivers/ddebug/dd_util.h
index 093bdff..3649644 100644
--- a/src/gallium/drivers/ddebug/dd_util.h
+++ b/src/gallium/drivers/ddebug/dd_util.h
@@ -71,4 +71,27 @@ dd_get_debug_file(bool verbose)
return f;
 }

+static inline void
+dd_parse_apitrace_marker(const char *string, int len, unsigned *call_number)
+{
+   unsigned num;
+   char *s;
+
+   if (len <= 0)
+  return;
+
+   /* Make it zero-terminated. */
+   s = alloca(len + 1);


This adds a use of alloca(), without a corresponding #include 

This fails to build, for me:


In file included from dd_pipe.h:34:0,
 from dd_screen.c:28:
dd_util.h: In function 'dd_parse_apitrace_marker':
dd_util.h:84:4: error: implicit declaration of function 'alloca' 
[-Werror=implicit-function-declaration]
s = alloca(len + 1);


Perhaps the attached is needed?



From 5f606bff8e5ed92a42956c10ee6b2b77360feaf5 Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Tue, 5 Jul 2016 10:40:05 +0100
Subject: [PATCH] Add alloca.h include to fix compilation on Cygwin

Fix compilation on Cygwin, since 50b22354, by adding #include 

Signed-off-by: Jon Turney 
---
 src/gallium/drivers/ddebug/dd_util.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/drivers/ddebug/dd_util.h 
b/src/gallium/drivers/ddebug/dd_util.h
index 3649644..9b9b3e0 100644
--- a/src/gallium/drivers/ddebug/dd_util.h
+++ b/src/gallium/drivers/ddebug/dd_util.h
@@ -28,6 +28,7 @@
 #ifndef DD_UTIL_H
 #define DD_UTIL_H
 
+#include 
 #include 
 #include 
 #include 
-- 
2.8.3

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


Re: [Mesa-dev] [PATCH 2/6] ddebug: record and dump apitrace call numbers

2016-07-13 Thread Jon Turney

On 05/07/2016 11:17, Marek Olšák wrote:

On Tue, Jul 5, 2016 at 12:13 PM, Jon Turney wrote:

On 01/07/2016 00:21, Marek Olšák wrote:
[...]
This adds a use of alloca(), without a corresponding #include 

This fails to build, for me:


In file included from dd_pipe.h:34:0,
 from dd_screen.c:28:
dd_util.h: In function 'dd_parse_apitrace_marker':
dd_util.h:84:4: error: implicit declaration of function 'alloca'
[-Werror=implicit-function-declaration]
s = alloca(len + 1);



Perhaps the attached is needed?


Yeah.

Reviewed-by: Marek Olšák 


Actually, I guess this should use c99_alloca.h, since that seems to be 
the mechanism for doing this portably.


Pushed with that correction.

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


[Mesa-dev] [PATCH] direct-to-native-GL for GLX clients on Cygwin ("Windows-DRI")

2016-07-18 Thread Jon Turney
Structurally, this is very similar to the existing Apple-DRI code, except I
have chosen to implement this using the __GLXDRIdisplay, etc. vtables (as
suggested originally in [1]), rather than a maze of ifdefs.  This also means
that LIBGL_ALWAYS_SOFTWARE and LIBGL_ALWAYS_INDIRECT work as expected.

[1] https://lists.freedesktop.org/archives/mesa-dev/2010-May/000756.html

This adds:

* the Windows-DRI extension protocol headers and the windowsdriproto.pc
file, for use in building the Windows-DRI extension for the X server

* a Windows-DRI extension helper client library

* a Windows-specific DRI implementation for GLX clients

The server is queried for Windows-DRI extension support on the screen before
using it (to detect the case where WGL is disabled or can't be activated).

The server is queried for fbconfigID to pixelformatindex mapping, which is
used to augment glx_config.

The server is queried for a native handle for the drawable (which is of a
different type for windows, pixmaps and pbuffers), which is used to augment
__GLXDRIdrawable.

Various GLX extensions are enabled depending on if the equivalent WGL
extension is available.

Signed-off-by: Jon Turney 
---
 configure.ac  |  10 +-
 src/glx/Makefile.am   |  14 +
 src/glx/driwindows_glx.c  | 609 ++
 src/glx/glxclient.h   |  11 +-
 src/glx/glxext.c  |  19 ++
 src/glx/windows/Makefile.am   |  31 ++
 src/glx/windows/wgl.c | 108 ++
 src/glx/windows/wgl.h |  44 +++
 src/glx/windows/windows_drawable.c| 192 +++
 src/glx/windows/windowsdriconst.h |  45 +++
 src/glx/windows/windowsdriproto.pc.in |   9 +
 src/glx/windows/windowsdristr.h   | 152 +
 src/glx/windows/windowsgl.c   | 403 ++
 src/glx/windows/windowsgl.h   |  52 +++
 src/glx/windows/windowsgl_internal.h  |  67 
 src/glx/windows/xwindowsdri.c | 237 +
 src/glx/windows/xwindowsdri.h |  59 
 src/mapi/Makefile.am  |   3 +
 src/mapi/glapi/gen/Makefile.am|   3 +
 src/mapi/glapi/glapi.h|   2 +-
 20 files changed, 2066 insertions(+), 4 deletions(-)
 create mode 100644 src/glx/driwindows_glx.c
 create mode 100644 src/glx/windows/Makefile.am
 create mode 100644 src/glx/windows/wgl.c
 create mode 100644 src/glx/windows/wgl.h
 create mode 100644 src/glx/windows/windows_drawable.c
 create mode 100644 src/glx/windows/windowsdriconst.h
 create mode 100644 src/glx/windows/windowsdriproto.pc.in
 create mode 100644 src/glx/windows/windowsdristr.h
 create mode 100644 src/glx/windows/windowsgl.c
 create mode 100644 src/glx/windows/windowsgl.h
 create mode 100644 src/glx/windows/windowsgl_internal.h
 create mode 100644 src/glx/windows/xwindowsdri.c
 create mode 100644 src/glx/windows/xwindowsdri.h

diff --git a/configure.ac b/configure.ac
index 54416b4..9cefc28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1114,7 +1114,9 @@ fi
 case "$host_os" in
 darwin*)
 dri_platform='apple' ;;
-gnu*|cygwin*)
+cygwin*)
+dri_platform='windows' ;;
+gnu*)
 dri_platform='none' ;;
 *)
 dri_platform='drm' ;;
@@ -1130,6 +1132,7 @@ AM_CONDITIONAL(HAVE_DRISW_KMS, test "x$have_drisw_kms" = 
xyes )
 AM_CONDITIONAL(HAVE_DRI2, test "x$enable_dri" = xyes -a "x$dri_platform" = 
xdrm -a "x$have_libdrm" = xyes )
 AM_CONDITIONAL(HAVE_DRI3, test "x$enable_dri3" = xyes -a "x$dri_platform" = 
xdrm -a "x$have_libdrm" = xyes )
 AM_CONDITIONAL(HAVE_APPLEDRI, test "x$enable_dri" = xyes -a "x$dri_platform" = 
xapple )
+AM_CONDITIONAL(HAVE_WINDOWSDRI, test "x$enable_dri" = xyes -a "x$dri_platform" 
= xwindows )
 
 AC_ARG_ENABLE([shared-glapi],
 [AS_HELP_STRING([--enable-shared-glapi],
@@ -1394,6 +1397,9 @@ xdri)
 if test x"$dri_platform" = xapple ; then
 DEFINES="$DEFINES -DGLX_USE_APPLEGL"
 fi
+if test x"$dri_platform" = xwindows ; then
+DEFINES="$DEFINES -DGLX_USE_WINDOWSGL"
+fi
 fi
 
 # add xf86vidmode if available
@@ -2744,6 +2750,8 @@ AC_CONFIG_FILES([Makefile
src/glx/Makefile
src/glx/apple/Makefile
src/glx/tests/Makefile
+   src/glx/windows/Makefile
+   src/glx/windows/windowsdriproto.pc
src/gtest/Makefile
src/intel/Makefile
src/intel/genxml/Makefile
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 3c0cb5f..5884e33 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -145,6 +145,16 @@ SUBDIRS += apple
 libglx_la_LIBADD += $(builddir)/apple/libappleglx.la
 endif
 
+if HAVE_WINDOWSDRI
+libglx_la_SOURCES += \
+  

Re: [Mesa-dev] [PATCH] glx/windows: Add wgl.h to the sources list

2016-11-02 Thread Jon Turney

On 02/11/2016 11:13, Andreas Boll wrote:

Otherwise it won't be picked in the tarball and the build will fail.


Thanks, my bad.

Reviewed-by: Jon Turney 


Fixes: 533b3530c12 ("direct-to-native-GL for GLX clients on Cygwin
("Windows-DRI")")
Cc: "13.0" 
Signed-off-by: Andreas Boll 
---
 src/glx/windows/Makefile.am | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glx/windows/Makefile.am b/src/glx/windows/Makefile.am
index c76af81..9806988 100644
--- a/src/glx/windows/Makefile.am
+++ b/src/glx/windows/Makefile.am
@@ -16,7 +16,8 @@ libwindowsglx_la_SOURCES = \
windowsgl.h \
windowsgl_internal.h \
windows_drawable.c \
-   wgl.c
+   wgl.c \
+   wgl.h

 libwindowsglx_la_CFLAGS = \
-I$(top_srcdir)/include \



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


Re: [Mesa-dev] [PATCH 1/2] configure.ac: require pthread-stubs only where available

2017-03-10 Thread Jon Turney

On 02/03/2017 19:02, Emil Velikov wrote:

From: Emil Velikov 

The project is a thing only for BSD platforms. Or in other words - for
any other platforms building/installing pthread-stubs results only in a
pthread-stub.pc file.

And even where it provides a DSO, there's a fundamental design issue
with it - see the pthread-stubs mailing list for the specifics.

Cc: Jeremy Huddleston Sequoia 
CC: Gary Wong 
Cc: Randy Fishel 
Cc: Niveditha Rau 
Signed-off-by: Emil Velikov 
---
Jeremy, others,

Afaict pthread-stubs expands to a simple .pc on your platforms, but a
confirmation will be greatly appreciated.
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a3d1a00bdd..e94e46a0b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -799,7 +799,7 @@ fi

 dnl pthread-stubs is mandatory on targets where it exists


This comment could probably do with revising, since that test has almost 
the opposite meaning now, perhaps something like "don't bother linking 
with pthread-stubs when it's a no-op"



 case "$host_os" in
-cygwin* )
+linux* | cygwin* | darwin* | solaris* | gnu*)
 pthread_stubs_possible="no"
 ;;
 * )



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


Re: [Mesa-dev] [PATCH mesa 1/6] glx: use ARRAY_SIZE macro

2017-09-07 Thread Jon Turney

On 07/09/2017 11:21, Eric Engestrom wrote:

Signed-off-by: Eric Engestrom 
---
  src/glx/driwindows_glx.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/glx/driwindows_glx.c b/src/glx/driwindows_glx.c
index 02d95e7bfd..85525431bf 100644
--- a/src/glx/driwindows_glx.c
+++ b/src/glx/driwindows_glx.c
@@ -24,6 +24,7 @@
  #include "glxclient.h"
  #include "glx_error.h"
  #include "dri_common.h"
+#include "util/macros.h"
  #include "windows/xwindowsdri.h"
  #include "windows/windowsgl.h"
  
@@ -427,7 +428,7 @@ driwindowsBindExtensions(struct driwindows_screen *psc)
  
 windows_extensions(&gl_extensions, &wgl_extensions);
  
-   for (i = 0; i < sizeof(extensionMap)/sizeof(extensionMap[0]); i++) {

+   for (i = 0; i < ARRAY_SIZE(extensionMap); i++) {
if (strstr(wgl_extensions, extensionMap[i].wglext)) {
__glXEnableDirectExtension(&psc->base, extensionMap[i].glxext);
        InfoMessageF("enabled %s\n", extensionMap[i].glxext);



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


Re: [Mesa-dev] [PATCH 7/7] meson: fix deps and underlinkage of libGL

2017-11-30 Thread Jon Turney

On 29/11/2017 17:34, Dylan Baker wrote:

Quoting Jon Turney (2017-11-29 08:22:54)

On 28/11/2017 18:21, Dylan Baker wrote:

Quoting Emil Velikov (2017-11-27 06:31:35)

IIRC Windows mandates binaries with unresolved symbols.
Other platforms allow such behaviour.

I think we want to set b_lundef=true, to catch these issues as part of
the build process.
We already do so in the autotools, android and at least partially in scons.

One would need a workaround for the sanitizers [1] analogous to our
autotools and scons builds.


[...]


JFYI,

b_lundef is true by default, and we don't override it. In this case (unless I'm
completely misreading/remembering [I wrote a very similar patch in my macos
branch]), the linkage is correct for Linux (possibly BSD too), but incorrect for
macOS, Cygwin, and Windows.


If this is the case, think this suggests that there's something
systematically wrong here, and this isn't the right fix...

I'll look into this a bit more.


I'm not sure there is anything wrong. with_dri_platfrom == 'drm' will always be
true on Linux/BSD, so really on Linux this patch has no functional changes, but
it will have functional changes in cases where with_dri_platform != 'drm', or am
I missing something?


Maybe it's me that's missing something...

There are references to functions provided by these libraries (xcb_glx, 
xcb, x11_xcb) in common code.


The linux build includes these libraries on the link line, and 
DT_NEEEDED tags are emitted for them (i.e. it is not underlinked, which 
is what I was assuming...)


All other things being equal, there shouldn't be the need to take 
special steps to link with those libraries when with_dri_platfrom != 'drm'


[time passes... Thorin sits down and starts singing about gold]

So it seems, when building for linux, xcb_glx and x11_xcb arrive in the 
link line from libloader_dri3_helper via libloader.


... and indeed when built -Ddri3=false, libGL has unresolved symbols for 
these libraries.

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


Re: [Mesa-dev] [PATCH 7/7] meson: fix deps and underlinkage of libGL

2017-12-01 Thread Jon Turney

On 30/11/2017 16:46, Emil Velikov wrote:

On 30 November 2017 at 15:13, Jon Turney wrote:

On 29/11/2017 17:34, Dylan Baker wrote:

[...]


Maybe it's me that's missing something...

There are references to functions provided by these libraries (xcb_glx, xcb,
x11_xcb) in common code.


Having a reference to those (as printed by the linker as it errors) should help.

There's a lot of macros guarding the different parts of GLX - the
obvious ones GLX_ seem there.

Another thing that comes to mind is the libloader_dri3_helper.
It should be a noop/empty for non-Linux/BSD but something is going wrong?


Yes, as I wrote in the bit of my email you snipped, these dependencies 
come via libloader_dri3_helper.


When configured -Ddri3=false (which is always the case on non-linux 
targets), libGL is underlinked, so this patch is correct.


Even with this patch applied, mesa fails to build for linux when 
configured with -Ddri3=false, due to various undefined references to 
libXext:



[3/3] Linking target src/glx/libGL.so.1.2.0.
FAILED: src/glx/libGL.so.1.2.0
cc  -o src/glx/libGL.so.1.2.0 'src/glx/GL@sha/src_glx_dummy.c.o' 
-Wl,--no-undefined -Wl,--as-needed -shared -fPIC -Wl,--start-group 
-Wl,-soname,libGL.so.1 -Wl,--whole-archive src/glx/libglx.a 
-Wl,--no-whole-archive src/mapi/glapi/libglapi_static.a 
src/mapi/shared-glapi/libglapi.so.0.0.0 src/loader/libloader.a 
src/util/libmesa_util.a src/util/libxmlconfig.a -pthread -Wl,-Bsymbolic 
-Wl,--gc-sections -ldrm -ldl -lm -Wl,--end-group -lX11 -lxcb-glx -lxcb 
-lX11-xcb -lX11 -lxcb -lxcb-dri2 -ldrm -lX11 -ldrm -lz -lexpat -lm 
'-Wl,-rpath,$ORIGIN/:$ORIGIN/../mapi/shared-glapi' 
-Wl,-rpath-link,/home/jon/src/mesa/build/src/glx:/home/jon/src/mesa/build/src/mapi/shared-glapi
src/glx/libglx.a(dri2.c.o): In function `DRI2CloseDisplay':
/home/jon/src/mesa/build/../src/glx/dri2.c:58: undefined reference to 
`XextRemoveDisplay'
src/glx/libglx.a(dri2.c.o): In function `DRI2FindDisplay':
/home/jon/src/mesa/build/../src/glx/dri2.c:81: undefined reference to 
`XextFindDisplay'
/home/jon/src/mesa/build/../src/glx/dri2.c:81: undefined reference to 
`XextCreateExtension'
/home/jon/src/mesa/build/../src/glx/dri2.c:81: undefined reference to 
`XextAddDisplay'
src/glx/libglx.a(dri2.c.o): In function `DRI2EventToWire':
/home/jon/src/mesa/build/../src/glx/dri2.c:168: undefined reference to 
`XMissingExtension'
src/glx/libglx.a(dri2.c.o): In function `DRI2WireToEvent':
/home/jon/src/mesa/build/../src/glx/dri2.c:93: undefined reference to 
`XMissingExtension'
src/glx/libglx.a(dri2.c.o): In function `DRI2QueryVersion':
/home/jon/src/mesa/build/../src/glx/dri2.c:229: undefined reference to 
`XMissingExtension'
src/glx/libglx.a(dri2.c.o): In function `DRI2Connect':
/home/jon/src/mesa/build/../src/glx/dri2.c:275: undefined reference to 
`XMissingExtension'
src/glx/libglx.a(dri2.c.o): In function `DRI2Authenticate':
/home/jon/src/mesa/build/../src/glx/dri2.c:344: undefined reference to 
`XMissingExtension'
src/glx/libglx.a(dri2.c.o):/home/jon/src/mesa/build/../src/glx/dri2.c:371: more 
undefined references to `XMissingExtension' follow
src/glx/libglx.a(dri2_glx.c.o): In function `dri2_copy_drawable':
/home/jon/src/mesa/build/../src/glx/dri2_glx.c:635: undefined reference to 
`XFixesCreateRegion'
/home/jon/src/mesa/build/../src/glx/dri2_glx.c:637: undefined reference to 
`XFixesDestroyRegion'
src/glx/libglx.a(dri2_glx.c.o): In function `__dri2CopySubBuffer':
/home/jon/src/mesa/build/../src/glx/dri2_glx.c:597: undefined reference to 
`XFixesCreateRegion'
/home/jon/src/mesa/build/../src/glx/dri2_glx.c:608: undefined reference to 
`XFixesDestroyRegion'
src/glx/libglx.a(dri_glx.c.o): In function `__glXReportDamage':
/home/jon/src/mesa/build/../src/glx/dri_glx.c:348: undefined reference to 
`XFixesCreateRegion'
/home/jon/src/mesa/build/../src/glx/dri_glx.c:350: undefined reference to 
`XDamageAdd'
/home/jon/src/mesa/build/../src/glx/dri_glx.c:351: undefined reference to 
`XFixesDestroyRegion'
src/glx/libglx.a(dri_glx.c.o): In function `has_damage_post':
/home/jon/src/mesa/build/../src/glx/dri_glx.c:296: undefined reference to 
`XDamageQueryVersion'
src/glx/libglx.a(XF86dri.c.o): In function `close_display':
/home/jon/src/mesa/build/../src/glx/XF86dri.c:82: undefined reference to 
`XextRemoveDisplay'
src/glx/libglx.a(XF86dri.c.o): In function `find_display':
/home/jon/src/mesa/build/../src/glx/XF86dri.c:77: undefined reference to 
`XextFindDisplay'
/home/jon/src/mesa/build/../src/glx/XF86dri.c:77: undefined reference to 
`XextCreateExtension'
/home/jon/src/mesa/build/../src/glx/XF86dri.c:77: undefined reference to 
`XextAddDisplay'
src/glx/libglx.a(XF86dri.c.o): In function `XF86DRIQueryVersion':
/home/jon/src/mesa/build/../src/glx/XF86dri.c:125: undefined reference to 
`XMissingExten

Re: [Mesa-dev] [PATCH 0/3] Fix linkage for libEGL and libGLX without dri3

2017-12-02 Thread Jon Turney

On 01/12/2017 23:06, Dylan Baker wrote:

As we discussed elsewhere, this should fix the linkage of the dri3 loader and
glx and egl.

Dylan Baker (3):
   meson: Reformat meson code to match more common style
   meson: fix underlinkage without dri3
   meson: Fix overlinkage of dri3 loader

  src/egl/meson.build|  2 +-
  src/glx/meson.build| 14 +-
  src/loader/meson.build |  3 +--
  3 files changed, 11 insertions(+), 8 deletions(-)



Great, thanks!

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


Re: [Mesa-dev] [PATCH v2 05/25] mesa: implement SPIR-V loading in glShaderBinary

2017-12-13 Thread Jon Turney

On 30/11/2017 23:57, Ian Romanick wrote:

On 11/30/2017 09:28 AM, Eduardo Lima Mitev wrote:

From: Nicolai Hähnle 

v2: * Add a gl_shader_spirv_data member to gl_shader, which already
encapsulates a gl_spirv_module where the binary will be saved.
(Eduardo Lima)

 * Just use the 'spirv_data' member to know whether a gl_shader has
the SPIR_V_BINARY_ARB state. (Timothy Arceri)

 * Remove redundant argument checks. Move extension presence check
to API entry point where the rest of checks are. Retype 'n' and
'length'arguments to use the correct and more standard types.
(Ian Romanick)
---
  src/mesa/main/glspirv.c   | 43 +++
  src/mesa/main/glspirv.h   |  5 +
  src/mesa/main/mtypes.h|  4 
  src/mesa/main/shaderapi.c | 45 ++---
  src/mesa/main/shaderobj.c |  2 ++
  5 files changed, 96 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/glspirv.c b/src/mesa/main/glspirv.c
index 8d1e652e088..d2e76bb1927 100644
--- a/src/mesa/main/glspirv.c
+++ b/src/mesa/main/glspirv.c

[...]

+
+   sh = alloca(sizeof(*sh) * (size_t)n);
+   if (!sh) {
+  _mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderBinary");
+  return;
+   }
+


This adds a use of alloca() without a corresponding #include.

Patch attached.

From 3b00c72a92ca1091d11ecffd8db404dcd598e63d Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Wed, 13 Dec 2017 19:49:07 +
Subject: [PATCH] Fix use of alloca() without #include 
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

../../../src/mesa/main/shaderapi.c: In function ‘_mesa_ShaderBinary’:
../../../src/mesa/main/shaderapi.c:2188:9: error: implicit declaration of 
function ‘alloca’ [-Werror=implicit-function-declaration]

Signed-off-by: Jon Turney 
---
 src/mesa/main/shaderapi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index d824a88ca2f..2c11e4d5bb6 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -38,6 +38,7 @@
 
 
 #include 
+#include 
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/dispatch.h"
-- 
2.15.1

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


[Mesa-dev] [PATCH 1/2] meson: Fix configuring dri glx with only gallium drivers

2018-01-12 Thread Jon Turney
'meson -Ddri-drivers= -Dgallium-drivers=swrast -Dglx=dri' fails with 'dri
based GLX requires at least one DRI driver'

Signed-off-by: Jon Turney 
---
 meson.build | 2 +-
 src/glx/meson.build | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 77e4e894b23..dd8e6145edb 100644
--- a/meson.build
+++ b/meson.build
@@ -323,7 +323,7 @@ if with_glx != 'disabled'
 if with_dri
   error('xlib conflicts with any dri driver')
 endif
-  elif with_glx == 'dri' and not with_dri
+  elif with_glx == 'dri' and not (with_dri or with_gallium)
 error('dri based GLX requires at least one DRI driver')
   endif
 endif
diff --git a/src/glx/meson.build b/src/glx/meson.build
index cdb388e9837..ead6e6138f7 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -65,7 +65,7 @@ extra_libs_libglx = []
 extra_deps_libgl = []
 extra_ld_args_libgl = []
 
-if with_dri
+if with_dri or with_gallium
   files_libglx += files(
 'dri_common.c',
 'dri_common.h',
-- 
2.15.1

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


[Mesa-dev] [PATCH 0/2] meson: Fixes when gallium swarast is the only driver configured

2018-01-12 Thread Jon Turney
Jon Turney (2):
  meson: Fix configuring dri glx with only gallium drivers
  meson: Fix install and linking of gallium swrast only driver

 include/meson.build| 2 +-
 meson.build| 2 +-
 src/gallium/meson.build| 2 +-
 src/gallium/state_trackers/dri/meson.build | 2 +-
 src/gallium/targets/dri/meson.build| 2 +-
 src/glx/meson.build| 2 +-
 src/mesa/drivers/dri/meson.build   | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

-- 
2.15.1

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


[Mesa-dev] [PATCH 2/2] meson: Fix install and linking of gallium swrast only driver

2018-01-12 Thread Jon Turney
When configured 'meson -Ddri-drivers= -Dgallium-drivers=swrast -Dglx=dri'
link and install a galliumized swrast_dri.so

Also install dri.pc and internal/dri_interface.h

Signed-off-by: Jon Turney 
---
 include/meson.build| 2 +-
 src/gallium/meson.build| 2 +-
 src/gallium/state_trackers/dri/meson.build | 2 +-
 src/gallium/targets/dri/meson.build| 2 +-
 src/mesa/drivers/dri/meson.build   | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/meson.build b/include/meson.build
index a2e7ce6580e..db3b479a94e 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -68,7 +68,7 @@ if with_egl
   )
 endif
 
-if with_dri
+if with_dri or with_gallium
   install_headers('GL/internal/dri_interface.h', subdir : 'GL/internal')
 endif
 
diff --git a/src/gallium/meson.build b/src/gallium/meson.build
index 6330c7514af..ba6392467b6 100644
--- a/src/gallium/meson.build
+++ b/src/gallium/meson.build
@@ -156,7 +156,7 @@ if with_gallium_opencl
   subdir('state_trackers/clover')
   subdir('targets/opencl')
 endif
-if with_dri
+if with_dri or with_gallium
   subdir('state_trackers/dri')
   subdir('targets/dri')
 endif
diff --git a/src/gallium/state_trackers/dri/meson.build 
b/src/gallium/state_trackers/dri/meson.build
index b99314ebf61..6cd70ad6c34 100644
--- a/src/gallium/state_trackers/dri/meson.build
+++ b/src/gallium/state_trackers/dri/meson.build
@@ -31,7 +31,7 @@ files_libdri = files(
   'dri_screen.h',
 )
 
-if with_dri
+if with_dri or with_gallium_softpipe
   files_libdri += files('drisw.c')
 endif
 
diff --git a/src/gallium/targets/dri/meson.build 
b/src/gallium/targets/dri/meson.build
index edf8d67fe39..bf53db4a29d 100644
--- a/src/gallium/targets/dri/meson.build
+++ b/src/gallium/targets/dri/meson.build
@@ -42,7 +42,7 @@ if with_ld_dynamic_list
   gallium_dri_link_depends += files('../dri-vdpau.dyn')
 endif
 
-if with_dri
+if with_dri or with_gallium_softpipe
   gallium_dri_link_with += libswdri
 endif
 if with_gallium_drisw_kms
diff --git a/src/mesa/drivers/dri/meson.build b/src/mesa/drivers/dri/meson.build
index 4ec2f343df2..b033d4c536f 100644
--- a/src/mesa/drivers/dri/meson.build
+++ b/src/mesa/drivers/dri/meson.build
@@ -63,7 +63,7 @@ endif
 
 # This needs to be installed if any dri drivers (including gallium dri drivers)
 # are built.
-if with_dri
+if with_dri or with_gallium
   pkg.generate(
 name : 'dri',
 filebase : 'dri',
-- 
2.15.1

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


Re: [Mesa-dev] [PATCH 1/2] meson: Fix configuring dri glx with only gallium drivers

2018-01-15 Thread Jon Turney

On 12/01/2018 17:33, Dylan Baker wrote:

Maybe this is correct, but it makes me nervous treating with_gallium as
equivalent to with_dri, since gallium drivers can be built dri-less
(gallium-xlib, and some other configurations on windows). I think something
like:

   with_glx = get_option('glx')
   if with_glx == 'auto'
 if with_dri
   with_glx = 'dri'
 elif with_gallium
   # Even when building just gallium drivers the user probably wants dri
   with_glx = 'dri'
   with_dri = true
 elif with_platform_x11 and with_any_opengl and not with_any_vk
   # The automatic behavior should not be to turn on xlib based glx when
   # building only vulkan drivers
   with_glx = 'xlib'
 else
   with_glx = 'disabled'
 endif
+ elif with_glx == 'dri'
+   if with_gallium
+ with_dri = true
+   endif
   endif


Would achieve the correct result, be simpler, and avoid accidentally adding dri
sources when we shouldn't.


Ah, yes.  I'd completely failed to spot that in the 'auto' case above.

How about the attached?
From f6d27e04bd7d8581b2cb723edaf6449eddb77cc8 Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Mon, 15 Jan 2018 19:39:46 +
Subject: [PATCH] meson: Set with_dri from with_gallium when DRI glx is
 explicitly configured

Set with_dri from with_gallium when DRI GLX is explicitly configured, as
well as when DRI GLX is chosen automatically.

Signed-off-by: Jon Turney 
---
 meson.build | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 77e4e894b23..7bc4983d96e 100644
--- a/meson.build
+++ b/meson.build
@@ -248,7 +248,6 @@ if with_glx == 'auto'
   elif with_gallium
 # Even when building just gallium drivers the user probably wants dri
 with_glx = 'dri'
-with_dri = true
   elif with_platform_x11 and with_any_opengl and not with_any_vk
 # The automatic behavior should not be to turn on xlib based glx when
 # building only vulkan drivers
@@ -257,6 +256,11 @@ if with_glx == 'auto'
 with_glx = 'disabled'
   endif
 endif
+if with_glx == 'dri'
+   if with_gallium
+  with_dri = true
+   endif
+endif
 
 if not (with_dri or with_gallium or with_glx == 'xlib' or with_glx == 
'gallium-xlib')
   with_gles1 = false
-- 
2.15.1

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


Re: [Mesa-dev] [PATCH 1/2] meson: Fix configuring dri glx with only gallium drivers

2018-01-15 Thread Jon Turney

On 12/01/2018 17:25, Dylan Baker wrote:

meson considers classic swrast to be a dri driver, I know it's not exactly
accurate, but, at least for me, it made the build system easier to reason about.


I think maybe the point here is that '-Ddri-drivers= -Dgallium-drivers= 
-Dglx=dri' (or at least, it's autotools equivalent) is a valid 
configuration, and gets you a libGL that falls back to indirect, since 
no swrast or real DRI driver can be loaded[*]. (Maybe it's even the only 
way to get that?)


[*] on Windows, it also hits some platform-specific client-side 
rendering first; on OSX, that's all it does (due to some badness I have 
some half-finished patches to fix...)



Quoting Adam Jackson (2018-01-12 09:06:37)

On Fri, 2018-01-12 at 13:18 +, Jon Turney wrote:

'meson -Ddri-drivers= -Dgallium-drivers=swrast -Dglx=dri' fails with 'dri
based GLX requires at least one DRI driver'

Signed-off-by: Jon Turney 
---
  meson.build | 2 +-
  src/glx/meson.build | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 77e4e894b23..dd8e6145edb 100644
--- a/meson.build
+++ b/meson.build
@@ -323,7 +323,7 @@ if with_glx != 'disabled'
  if with_dri
error('xlib conflicts with any dri driver')
  endif
-  elif with_glx == 'dri' and not with_dri
+  elif with_glx == 'dri' and not (with_dri or with_gallium)
  error('dri based GLX requires at least one DRI driver')


We should just remove this check. libGL doesn't actually require a DRI
driver, and at least on OSX there's no DRI driver you could possibly
build.

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


Re: [Mesa-dev] [PATCH v2 01/26] util: move os_time.[ch] to src/util

2017-11-10 Thread Jon Turney

On 06/11/2017 10:23, Nicolai Hähnle wrote:

diff --git a/src/gallium/auxiliary/os/os_time.h b/src/util/os_time.h
similarity index 89%
rename from src/gallium/auxiliary/os/os_time.h
rename to src/util/os_time.h
index ca0bdd5a0c4..049ab118db2 100644
--- a/src/gallium/auxiliary/os/os_time.h
+++ b/src/util/os_time.h
@@ -28,34 +28,29 @@
  /**
   * @file
   * OS independent time-manipulation functions.
   *
   * @author Jose Fonseca 
   */
  
  #ifndef _OS_TIME_H_

  #define _OS_TIME_H_
  
-

-#include "pipe/p_config.h"
-
-#if defined(PIPE_OS_UNIX)
-#  include  /* usleep */
-#endif
-
-#include "pipe/p_compiler.h"
-
+#include 
+#include 
  
  #ifdef __cplusplus

  extern "C" {
  #endif


This patch seems to drop the include of unistd.h, which may be needed 
for usleep() prototype.


(See http://dronecode.duckdns.org:8010/builders/mesa-mesa/builds/5790)

Patch attached.
From a186f46272c9677f9c33764cbd9d8dc9d442b473 Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Fri, 10 Nov 2017 11:41:13 +
Subject: [PATCH] util: include unistd.h, which may be required for usleep
 prototype
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This seems to be dropped in 222a2fb9 "util: move os_time.[ch] to src/util"

../../../src/util/os_time.c: In function ‘os_time_sleep’:
../../../src/util/os_time.c:104:4: error: implicit declaration of function 
‘usleep’ [-Werror=implicit-function-declaration]

Signed-off-by: Jon Turney 
---
 src/util/os_time.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/os_time.c b/src/util/os_time.c
index 8d8291ff173..72dc7e49c0e 100644
--- a/src/util/os_time.c
+++ b/src/util/os_time.c
@@ -40,6 +40,7 @@
 #include "util/u_atomic.h"
 
 #if defined(PIPE_OS_UNIX)
+#  include  /* usleep */
 #  include  /* timeval */
 #  include  /* timeval */
 #  include  /* sched_yield */
-- 
2.15.0

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


Re: [Mesa-dev] [PATCH] threads: fix MinGW build breakage

2017-11-10 Thread Jon Turney

On 09/11/2017 21:41, Nicolai Hähnle wrote:

Sorry for the mess.


I'm going to suggest that the fallback declaration of timespec_get() 
also needs to be provided for POSIX systems which don't have it.


Not noticed previously as it (or xtime_get()) doesn't seem to have had 
any users, prior to this series.


Patch attached.
From e04c7cfa3a3a560476d361a828070f7785da8bf0 Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Fri, 10 Nov 2017 12:22:25 +
Subject: [PATCH] Also provide timespec_get fallback if a POSIX platform
 doesn't have it

... not just on Windows

Signed-off-by: Jon Turney 
---
 include/c11/threads_posix.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 7bf6a0f6ef6..45cb6075e6e 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -382,7 +382,7 @@ tss_set(tss_t key, void *val)
 
 /* 7.25.7 Time functions */
 // 7.25.6.1
-#if 0
+#ifndef HAVE_TIMESPEC_GET
 static inline int
 timespec_get(struct timespec *ts, int base)
 {
-- 
2.15.0

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


[Mesa-dev] [PATCH] glx/windows: Fix building libwindowsdri when libX11 headers are installed in a non-standard location

2017-11-10 Thread Jon Turney
Signed-off-by: Jon Turney 
---
 src/glx/windows/Makefile.am | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/glx/windows/Makefile.am b/src/glx/windows/Makefile.am
index f84288b935c..f4f8e9664d7 100644
--- a/src/glx/windows/Makefile.am
+++ b/src/glx/windows/Makefile.am
@@ -10,6 +10,9 @@ pkgconfig_DATA = windowsdriproto.pc
 # library for using the Windows-DRI server extension
 libwindowsdri_la_SOURCES = xwindowsdri.c xwindowsdri.h
 
+libwindowsdri_la_CFLAGS = \
+$(X11_INCLUDES)
+
 # native rendering GL for windows
 libwindowsglx_la_SOURCES = \
windowsgl.c \
-- 
2.15.0

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


Re: [Mesa-dev] [PATCH] threads: fix MinGW build breakage

2017-11-10 Thread Jon Turney

On 10/11/2017 15:42, Nicolai Hähnle wrote:

On 10.11.2017 14:00, Jon Turney wrote:

On 09/11/2017 21:41, Nicolai Hähnle wrote:

Sorry for the mess.


I'm going to suggest that the fallback declaration of timespec_get() 
also needs to be provided for POSIX systems which don't have it.


Not noticed previously as it (or xtime_get()) doesn't seem to have had 
any users, prior to this series.


Patch attached.


Do you have a system where this is actually needed? Currently 
HAVE_TIMESPEC_GET is only defined in threads_win32.h, so some more 
detection logic somewhere would be required if this actually turns out 
to be an issue.


Hmm.. yes, I'd assumed that HAVE_TIMESPEC_GET was the result of an 
autoconf check, but it isn't.


Cygwin doesn't (currently) have timespec_get().

I'm thinking the correct solution here is actually to unconditionally 
declare timespec_get(), just like all the other C11 thread functions 
(and as the unused xtime_get() was, prior to 
f1a364878431c8c5f4fd38b40b9766449e49f552)?


Revised patch attached.
From f71d15ccab81af7dfb7393ed947827f02d333733 Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Fri, 10 Nov 2017 12:22:25 +
Subject: [PATCH] Provide timespec_get() in C11 thread.h emulation on POSIX
 also

Signed-off-by: Jon Turney 
---
 include/c11/threads_posix.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 7bf6a0f6ef6..25076f1b6e5 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -382,7 +382,6 @@ tss_set(tss_t key, void *val)
 
 /* 7.25.7 Time functions */
 // 7.25.6.1
-#if 0
 static inline int
 timespec_get(struct timespec *ts, int base)
 {
@@ -393,4 +392,3 @@ timespec_get(struct timespec *ts, int base)
 }
 return 0;
 }
-#endif
-- 
2.15.0

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


[Mesa-dev] [PATCH] meson: if dep_dl is an empty list, it's not a dependency object

2017-11-13 Thread Jon Turney
It's ok to use an empty list for dependencies:, but it's not ok to try to
use the found() method of it.

See also https://github.com/mesonbuild/meson/issues/2324

Signed-off-by: Jon Turney 
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 0cbaefb7882..9b0e495a58c 100644
--- a/meson.build
+++ b/meson.build
@@ -925,7 +925,7 @@ endif
 if dep_m.found()
   gl_priv_libs += '-lm'
 endif
-if dep_dl.found()
+if dep_dl != [] and dep_dl.found()
   gl_priv_libs += '-ldl'
 endif
 
-- 
2.15.0

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


Re: [Mesa-dev] [PATCH] meson: if dep_dl is an empty list, it's not a dependency object

2017-11-14 Thread Jon Turney

On 13/11/2017 17:41, Dylan Baker wrote:

I thought I'd fixed this already,
Reviewed-by: Dylan Baker 


This workaround is already in place for dep_xxf86vm.

I took a brief look, and didn't see anywhere the same problem could 
occur with any of the other uses of [] for a dependency.



Quoting Jon Turney (2017-11-13 02:28:27)

It's ok to use an empty list for dependencies:, but it's not ok to try to
use the found() method of it.

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


[Mesa-dev] [PATCH] meson: Don't define HAVE_PTHREAD only on linux

2017-11-15 Thread Jon Turney
I'm not sure of the reason for this. I don't see anything like this in
configure.ac

In include/c11/threads.h the cases are:

1) building for Windows -> threads_win32.h
2) HAVE_PTHREAD -> threads_posix.h
3) Not supported on this platform

So not defining HAVE_PTHREAD for anything not Windows just means we can't
build at all.

When we are building for Windows, I'm not sure if dependency('threads')
would ever find anything, or defining HAVE_PTHREAD has any effect, but avoid
defining it there, just in case.

Signed-off-by: Jon Turney 
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 84c0e102737..a0dd02b1f64 100644
--- a/meson.build
+++ b/meson.build
@@ -668,7 +668,7 @@ endif
 # TODO: some of these may be conditional
 dep_zlib = dependency('zlib', version : '>= 1.2.3')
 dep_thread = dependency('threads')
-if dep_thread.found() and host_machine.system() == 'linux'
+if dep_thread.found() and host_machine.system() != 'windows'
   pre_args += '-DHAVE_PTHREAD'
 endif
 dep_elf = dependency('libelf', required : false)
-- 
2.15.0

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


Re: [Mesa-dev] [PATCH] threads: fix MinGW build breakage

2017-11-15 Thread Jon Turney

On 15/11/2017 11:21, Nicolai Hähnle wrote:

On 13.11.2017 23:55, Rob Herring wrote:

On Fri, Nov 10, 2017 at 12:39 PM, Jon Turney
 wrote:

On 10/11/2017 15:42, Nicolai Hähnle wrote:


On 10.11.2017 14:00, Jon Turney wrote:


On 09/11/2017 21:41, Nicolai Hähnle wrote:


Sorry for the mess.



I'm going to suggest that the fallback declaration of 
timespec_get() also

needs to be provided for POSIX systems which don't have it.

Not noticed previously as it (or xtime_get()) doesn't seem to have had
any users, prior to this series.

Patch attached.



Do you have a system where this is actually needed? Currently
HAVE_TIMESPEC_GET is only defined in threads_win32.h, so some more 
detection
logic somewhere would be required if this actually turns out to be 
an issue.



Hmm.. yes, I'd assumed that HAVE_TIMESPEC_GET was the result of an 
autoconf

check, but it isn't.

Cygwin doesn't (currently) have timespec_get().

I'm thinking the correct solution here is actually to unconditionally
declare timespec_get(), just like all the other C11 thread functions 
(and as

the unused xtime_get() was, prior to
f1a364878431c8c5f4fd38b40b9766449e49f552)?

Revised patch attached.


That should fix Android builds.

Acked-by: Rob Herring 


The issue with this is that it makes the compiler unhappy when 
timespec_get *is* available. I'm looking at adding a configure check. 


Ah, and this doesn't effect the other C11 emulation functions in this 
header because we don't include threads.h, but we do include time.h?

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


Re: [Mesa-dev] [PATCH v2] threads, configure.ac, meson.build: define and use HAVE_TIMESPEC_GET

2017-11-15 Thread Jon Turney

On 15/11/2017 14:35, Nicolai Hähnle wrote:

From: Nicolai Hähnle 

v2: add HAVE_TIMESPEC_GET for non-Windows Scons builds

Cc: Jon Turney 
Cc: Rob Herring 
Cc: Alexander von Gluck IV 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103674
Fixes: f1a364878431 ("threads: update for late C11 changes")
---
  SConstruct  | 7 +++
  configure.ac| 1 +
  include/c11/threads_posix.h | 2 +-
  meson.build | 2 +-
  4 files changed, 10 insertions(+), 2 deletions(-)


Reviewed-by: Jon Turney 

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


[Mesa-dev] [PATCH] mapi: Teach es{1, 2}api/ABI-check shared library names on Cygwin

2017-11-20 Thread Jon Turney
Ideally we'd be able to get the library filename from libtool, but that
doesn't seem to be a feature...

Use of ${uname} is presumably ok here as we won't be running 'make check' if
we are cross-compiling

Signed-off-by: Jon Turney 
---
 src/mapi/es1api/ABI-check | 13 +
 src/mapi/es2api/ABI-check | 13 +
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/mapi/es1api/ABI-check b/src/mapi/es1api/ABI-check
index 0a867343c79..396ca74bbcb 100755
--- a/src/mapi/es1api/ABI-check
+++ b/src/mapi/es1api/ABI-check
@@ -9,12 +9,17 @@ set -eu
 # or in extensions that are part of the ES 1.1 extension pack.
 # (see 
http://www.khronos.org/registry/gles/specs/1.1/opengles_spec_1_1_extension_pack.pdf)
 
-if [ $(uname) == "Darwin" ]
-then
+case $(uname) in
+"Darwin")
   LIB=${1-es1api/.libs/libGLESv1_CM.dylib}
-else
+  ;;
+"CYGWIN"*)
+  LIB=${1-es1api/.libs/cygGLESv1_CM-1.dll}
+  ;;
+*)
   LIB=${1-es1api/.libs/libGLESv1_CM.so.1}
-fi
+  ;;
+esac
 
 if ! [ -f "$LIB" ]
 then
diff --git a/src/mapi/es2api/ABI-check b/src/mapi/es2api/ABI-check
index 716e6679a49..9d95e823814 100755
--- a/src/mapi/es2api/ABI-check
+++ b/src/mapi/es2api/ABI-check
@@ -6,12 +6,17 @@ set -eu
 # GL_EXT_multi_draw_arrays
 # GL_OES_EGL_image
 
-if [ $(uname) == "Darwin" ]
-then
+case $(uname) in
+"Darwin")
   LIB=${1-es2api/.libs/libGLESv2.dylib}
-else
+  ;;
+"CYGWIN"*)
+  LIB=${1-es2api/.libs/cygGLESv2-2.dll}
+  ;;
+*)
   LIB=${1-es2api/.libs/libGLESv2.so.2}
-fi
+  ;;
+esac
 
 if ! [ -f "$LIB" ]
 then
-- 
2.15.0

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


Re: [Mesa-dev] [PATCH 5/6] meson: add logic to select apple and windows dri

2017-11-21 Thread Jon Turney

On 21/11/2017 00:50, Dylan Baker wrote:

This is still not fully correct (haiku and BSD are probably not
correct), but Linux is not regressed and this should be correct for
macOS and Windows.

Signed-off-by: Dylan Baker 
---
  meson.build | 15 +--
  1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 52f2c1cb0d0..e7d2afb3d0a 100644
--- a/meson.build
+++ b/meson.build
@@ -187,8 +187,19 @@ if with_dri_i915
dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
  endif
  
-# TODO: other OSes

-with_dri_platform = 'drm'
+# TODO: gnu
+if host_machine.system() == 'darwin'
+  with_dri_platform = 'apple'
+elif host_machine.system() == 'windows'


This should be:

elif ['windows', 'cygwin'].contains(host_machine.system())


+  with_dri_platform = 'windows'
+elif host_machine.system() == 'linux'
+  # FIXME: This should include BSD and possibly other systems
+  with_dri_platform = 'drm'
+else
+  # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
+  # assert here that one of those cases has been met.
+  with_dri_platform = 'none'
+endif
  
  with_platform_android = false

  with_platform_wayland = false



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


Re: [Mesa-dev] [PATCH 1/3] util: Fix SHA1 implementation on big endian

2017-11-25 Thread Jon Turney

On 25/11/2017 04:24, Matt Turner wrote:

diff --git a/src/util/u_endian.h b/src/util/u_endian.h
index 7bbd7dc215..3d5c006f35 100644
--- a/src/util/u_endian.h
+++ b/src/util/u_endian.h
@@ -67,4 +67,7 @@

  #endif

+#warn Unknown Endianness for this platform. Assuming little endian
+#define PIPE_ARCH_LITTLE_ENDIAN
+
  #endif


I'm wondering what compiler this issues a warning on. gcc only seems to 
support #warning, not #warn, but that's not portable to msvc...



./util/u_endian.h:70:2: error: invalid preprocessing directive #warn
 #warn Unknown Endianness for this platform. Assuming little endian
  ^

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


Re: [Mesa-dev] [PATCH 1/3] util: Fix SHA1 implementation on big endian

2017-11-27 Thread Jon Turney

On 26/11/2017 00:46, Matt Turner wrote:

I've committed what I hope is the final fix.


After this series, if we are building on a target unknown to u_endian.h, 
so it can't determine the endianess, sha1.c now builds for big-endian.


This choice is made silently, but fortunately mesa-sha1_test fails when 
built for the wrong endianess, so there is some hope to notice this...




From e5c6197bdb4dec926ab31534b8533dd1bf14dfa1 Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Mon, 27 Nov 2017 13:32:53 +
Subject: [PATCH] Also include endian.h on cygwin

If u_endian.h can't determine the endianess, the default behaviour in sha1.c
is to build for big-endian

Signed-off-by: Jon Turney 
---
 src/util/u_endian.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/u_endian.h b/src/util/u_endian.h
index 50f94c578ed..22d011ec008 100644
--- a/src/util/u_endian.h
+++ b/src/util/u_endian.h
@@ -27,7 +27,7 @@
 #ifndef U_ENDIAN_H
 #define U_ENDIAN_H
 
-#if defined(__GLIBC__) || defined(ANDROID)
+#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__)
 #include 
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-- 
2.15.0

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


[Mesa-dev] [PATCH 5/7] meson: build src/glx/windows

2017-11-27 Thread Jon Turney
---
 src/glx/meson.build | 25 +--
 src/glx/windows/meson.build | 48 +
 2 files changed, 63 insertions(+), 10 deletions(-)
 create mode 100644 src/glx/windows/meson.build

diff --git a/src/glx/meson.build b/src/glx/meson.build
index deef3ed2235..a7eb48a0069 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -18,8 +18,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-# TODO: 
-#subdir('windows')
+subdir('windows')
 
 files_libglx = files(
   'clientattrib.c',
@@ -63,6 +62,8 @@ files_libglx = files(
 )
 
 extra_libs_libglx = []
+extra_deps_libgl = []
+extra_ld_args_libgl = []
 
 if with_dri
   files_libglx += files(
@@ -99,11 +100,15 @@ if with_dri_platform == 'apple'
   files_libglx += files('applegl_glx.c')
 elif with_dri_platform == 'windows'
   files_libglx += files('driwindows_glx.c')
-  # TODO
-  #extra_libs_libglx += [
-#libwindowsdri,
-#libwindowsglx,
-  #]
+  extra_libs_libglx += [
+libwindowsdri,
+libwindowsglx,
+  ]
+  extra_deps_libgl = [
+meson.get_compiler('c').find_library('gdi32'),
+meson.get_compiler('c').find_library('opengl32')
+  ]
+  extra_ld_args_libgl = '-Wl,--disable-stdcall-fixup'
 endif
 
 dri_driver_dir = join_paths(get_option('prefix'), dri_drivers_path)
@@ -139,7 +144,7 @@ libglx = static_library(
   ],
   c_args : [c_vis_args, gl_lib_cargs,
 '-DGL_LIB_NAME="lib@0@.so.@1@"'.format(gl_lib_name, 
gl_lib_version.split('.')[0])],
-  link_with : [libloader, libloader_dri3_helper, libmesa_util, libxmlconfig],
+  link_with : [libloader, libloader_dri3_helper, libmesa_util, libxmlconfig, 
extra_libs_libglx],
   dependencies : [dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd],
   build_by_default : false,
 )
@@ -161,9 +166,9 @@ if with_glx == 'dri'
 ],
 link_with : [libglapi_static, libglapi],
 link_whole : libglx,
-link_args : [ld_args_bsymbolic, ld_args_gc_sections],
+link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
 dependencies : [dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11,
-dep_xcb_dri2, dep_xcb_dri3],
+dep_xcb_dri2, dep_xcb_dri3, extra_deps_libgl],
 version : gl_lib_version,
 install : true,
   )
diff --git a/src/glx/windows/meson.build b/src/glx/windows/meson.build
new file mode 100644
index 000..1e66094b4ba
--- /dev/null
+++ b/src/glx/windows/meson.build
@@ -0,0 +1,48 @@
+# protocol defines for the Windows-DRI server extension
+
+files_windowsdriproto = files(
+ 'windowsdriconst.h',
+ 'windowsdristr.h',
+ )
+
+install_headers(
+  files_windowsdriproto,
+  subdir: 'X11/extensions',
+)
+
+pkg.generate(
+  name : 'windowsdriproto',
+  description : 'Windows-DRI extension headers',
+  version : '1.0.0',
+)
+
+# library for using the Windows-DRI server extension
+files_libwindowsdri = files(
+  'xwindowsdri.c',
+  'xwindowsdri.h',
+)
+
+libwindowsdri = static_library(
+  'driwindows',
+  [ files_libwindowsdri, files_windowsdriproto],
+  dependencies: dep_xext,
+  build_by_default: false,
+)
+
+# library for native GL on windows
+files_libwindowsglx = files(
+  'windowsgl.c',
+  'windowsgl.h',
+  'windowsgl_internal.h',
+  'windows_drawable.c',
+  'wgl.c',
+  'wgl.h',
+)
+
+libwindowsglx = static_library(
+  'glxwindows',
+  [ files_libwindowsglx, files_windowsdriproto],
+  include_directories: [inc_include, inc_src, inc_glapi],
+  c_args : [c_vis_args],
+  build_by_default: false,
+)
-- 
2.15.0

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


[Mesa-dev] [PATCH 1/7] meson: fix generated source inclusion on macOS and Windows

2017-11-27 Thread Jon Turney
From: Dylan Baker 

---
 src/mapi/glapi/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/glapi/meson.build b/src/mapi/glapi/meson.build
index 14ffa68ad0d..8856a95fb66 100644
--- a/src/mapi/glapi/meson.build
+++ b/src/mapi/glapi/meson.build
@@ -26,7 +26,7 @@ static_glapi_files = []
 static_glapi_args = []
 
 if ['apple', 'windows'].contains(with_dri_platform)
-  static_glapi_files += files('glapi_gentable.c')
+  static_glapi_files += [glapi_gentable_c, glapitable_h]
 endif
 
 if with_shared_glapi
-- 
2.15.0

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


[Mesa-dev] [PATCH 4/7] meson: set _GNU_SOURCE on cygwin

2017-11-27 Thread Jon Turney
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index d0618f97344..cf6e028746a 100644
--- a/meson.build
+++ b/meson.build
@@ -467,7 +467,7 @@ if cc.compiles('int foo(void) { return 0; } int bar(void) 
__attribute__((alias("
 endif
 
 # TODO: this is very incomplete
-if host_machine.system() == 'linux'
+if ['linux', 'cygwin'].contains(host_machine.system())
   pre_args += '-D_GNU_SOURCE'
 endif
 
-- 
2.15.0

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


[Mesa-dev] [PATCH 7/7] meson: fix deps and underlinkage of libGL

2017-11-27 Thread Jon Turney
---
 meson.build | 6 --
 src/glx/meson.build | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 68361fc4606..524a03eaa97 100644
--- a/meson.build
+++ b/meson.build
@@ -866,7 +866,7 @@ if with_platform_x11
 dep_x11 = dependency('x11')
 dep_xext = dependency('xext')
 dep_xcb = dependency('xcb')
-  elif with_glx == 'dri' and with_dri_platform == 'drm'
+  elif with_glx == 'dri'
 dep_x11 = dependency('x11')
 dep_xext = dependency('xext')
 dep_xdamage = dependency('xdamage', version : '>= 1.1')
@@ -874,9 +874,11 @@ if with_platform_x11
 dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
 dep_xxf86vm = dependency('xxf86vm', required : false)
   endif
-  if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
+  if with_any_vk or with_glx == 'dri'
 dep_xcb = dependency('xcb')
 dep_x11_xcb = dependency('x11-xcb')
+  endif
+  if with_any_vk or (with_glx == 'dri' and with_dri_platform == 'drm')
 dep_xcb_dri2 = dependency('xcb-dri2', version : '>= 1.8')
 
 if with_dri3
diff --git a/src/glx/meson.build b/src/glx/meson.build
index a7eb48a0069..2ffef4cf223 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -168,6 +168,7 @@ if with_glx == 'dri'
 link_whole : libglx,
 link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
 dependencies : [dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11,
+dep_xcb_glx, dep_xcb, dep_x11_xcb,
 dep_xcb_dri2, dep_xcb_dri3, extra_deps_libgl],
 version : gl_lib_version,
 install : true,
-- 
2.15.0

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


[Mesa-dev] [PATCH 6/7] meson: don't require dri2proto for darwin or windows

2017-11-27 Thread Jon Turney
---
 meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index cf6e028746a..68361fc4606 100644
--- a/meson.build
+++ b/meson.build
@@ -888,7 +888,9 @@ if with_platform_x11
 endif
   endif
   if with_glx == 'dri'
-dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
+if with_dri_platform == 'drm'
+  dep_dri2proto = dependency('dri2proto', version : '>= 2.8')
+endif
 dep_glproto = dependency('glproto', version : '>= 1.4.14')
   endif
   if with_egl
-- 
2.15.0

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


[Mesa-dev] [PATCH 2/7] meson: Don't build egl on macOS or Windows

2017-11-27 Thread Jon Turney
From: Dylan Baker 

---
 meson.build | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 53013e47ec4..c24225c0297 100644
--- a/meson.build
+++ b/meson.build
@@ -261,7 +261,10 @@ endif
 
 _egl = get_option('egl')
 if _egl == 'auto'
-  with_egl = with_dri and with_shared_glapi and egl_native_platform != ''
+  with_egl = (
+with_dri and with_shared_glapi and egl_native_platform != '' and not
+['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  )
 elif _egl == 'true'
   if not with_dri
 error('EGL requires dri')
-- 
2.15.0

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


[Mesa-dev] [PATCH 3/7] meson: set windows glx defines

2017-11-27 Thread Jon Turney
---
 meson.build | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meson.build b/meson.build
index c24225c0297..d0618f97344 100644
--- a/meson.build
+++ b/meson.build
@@ -378,6 +378,8 @@ if with_platform_x11
 endif
 if with_dri_platform == 'drm'
   pre_args += '-DGLX_USE_DRM'
+ elif with_dri_platform == 'windows'
+  pre_args += '-DGLX_USE_WINDOWSGL'
 endif
   endif
 else
-- 
2.15.0

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


[Mesa-dev] [PATCH 0/7] [RFC] meson: build src/glx/windows

2017-11-27 Thread Jon Turney
This series lets me build a mesa for Cygwin configured with:

 -Ddri-drivers=swrast -Dgallium-drivers= -Dplatforms=x11,surfaceless -Dglx=dri 
-Dvulkan-drivers= 

I'm really not sure about (2/8), the autotools build does something totally 
different...

Dylan Baker (2):
  meson: fix generated source inclusion on macOS and Windows
  meson: Don't build egl on macOS or Windows

Jon Turney (5):
  meson: set windows glx defines
  meson: set _GNU_SOURCE on cygwin
  meson: build src/glx/windows
  meson: don't require dri2proto for darwin or windows
  meson: fix deps and underlinkage of libGL

 meson.build | 19 +-
 src/glx/meson.build | 26 ++--
 src/glx/windows/meson.build | 48 +
 src/mapi/glapi/meson.build  |  2 +-
 4 files changed, 79 insertions(+), 16 deletions(-)
 create mode 100644 src/glx/windows/meson.build

-- 
2.15.0

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


Re: [Mesa-dev] [PATCH 5/7] meson: build src/glx/windows

2017-11-29 Thread Jon Turney

On 27/11/2017 18:35, Dylan Baker wrote:

Quoting Jon Turney (2017-11-27 05:58:32)

---
  src/glx/meson.build | 25 +--
  src/glx/windows/meson.build | 48 +
  2 files changed, 63 insertions(+), 10 deletions(-)
  create mode 100644 src/glx/windows/meson.build



+  extra_deps_libgl = [
+meson.get_compiler('c').find_library('gdi32'),
+meson.get_compiler('c').find_library('opengl32')


You should (though I haven't tested), be able to replace the last call with:
dependency('opengl')

(There is code for this in meson, but there's a lot of TODO's around it).


I'm not sure that's a good idea.  I did go back and forth a bit on just 
using '-lopengl32' here...


It probably helps to bear in mind that this is building a big shim, 
where the GL calls from a GLX client are ultimately directed to the 
native Windows opengl32.dll


(mainly this happens via a dispatch table populated using 
_glapi_create_table_from_handle() on a handle to opengl32.dll, but there 
are some direct calls, for probably not very good reasons)


So, it's quite important that opengl32 is linked with here, not just any 
libGL (e.g. an installed version of what we are building...)




diff --git a/src/glx/windows/meson.build b/src/glx/windows/meson.build
new file mode 100644
index 000..1e66094b4ba
--- /dev/null
+++ b/src/glx/windows/meson.build
@@ -0,0 +1,48 @@


Even if you don't care about the Copyright line, could you add the MIT text at
the top?


Done.


+libwindowsdri = static_library(
+  'driwindows',
+  [ files_libwindowsdri, files_windowsdriproto],

   ^ extra whitespace


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


Re: [Mesa-dev] [PATCH 7/7] meson: fix deps and underlinkage of libGL

2017-11-29 Thread Jon Turney

On 28/11/2017 18:21, Dylan Baker wrote:

Quoting Emil Velikov (2017-11-27 06:31:35)

IIRC Windows mandates binaries with unresolved symbols.
Other platforms allow such behaviour.

I think we want to set b_lundef=true, to catch these issues as part of
the build process.
We already do so in the autotools, android and at least partially in scons.

One would need a workaround for the sanitizers [1] analogous to our
autotools and scons builds.

Thanks for catching this Jon.
-Emil

[1] https://github.com/mesonbuild/meson/issues/764
See commits 8b5d477aa820e52ed622c329933550c561ab1c93 and
fa46848e51a619aba5a748316fe8fe4c2e17d243
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


JFYI,

b_lundef is true by default, and we don't override it. In this case (unless I'm
completely misreading/remembering [I wrote a very similar patch in my macos
branch]), the linkage is correct for Linux (possibly BSD too), but incorrect for
macOS, Cygwin, and Windows.


If this is the case, think this suggests that there's something 
systematically wrong here, and this isn't the right fix...


I'll look into this a bit more.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] meson: correctly set SYSCONFDIR for loading dirrc

2018-01-24 Thread Jon Turney

On 24/01/2018 18:19, Dylan Baker wrote:

Quoting Emil Velikov (2018-01-24 03:53:35)

On 24 January 2018 at 10:39, Marc Dietrich  wrote:

Hi Dylan,

Am Dienstag, 23. Januar 2018, 19:28:08 CET schrieb Dylan Baker:

Fixes: d1992255bb29 ("meson: Add build Intel "anv" vulkan driver")
Reported-by: Marc Dietrich 
Signed-off-by: Dylan Baker 
---
  src/util/meson.build | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/util/meson.build b/src/util/meson.build
index fa591c92e56..b23dba3a985 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -112,8 +112,12 @@ libxmlconfig = static_library(
files_xmlconfig,
include_directories : inc_common,
dependencies : [dep_expat, dep_m],
-  c_args : [c_msvc_compat_args, c_vis_args,
-'-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))],
+  c_args : [
+c_msvc_compat_args, c_vis_args,
+'-DSYSCONFDIR="@0@"'.format(
+  join_paths(get_option('prefix'), get_option('sysconfdir'))
+),
+  ],
build_by_default : false,
  )


this won't work as the prefix is often set to /usr, which results in
sysconfdir to be /usr/etc. As this is a special case, and "/etc" is the


No. from the meson documentation on join_paths(): "If any one of the 
individual segments is an absolute path, all segments before it are 
dropped."


So I think this is right as written.

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


Re: [Mesa-dev] [PATCH v2] meson: correctly set sysconfdir for drirc

2018-01-24 Thread Jon Turney

On 24/01/2018 19:35, Dylan Baker wrote:

v2: - Also fix drirc install path

Fixes: d1992255bb29 ("meson: Add build Intel "anv" vulkan driver")
Reported-by: Marc Dietrich 
Signed-off-by: Dylan Baker 
Reviewed-by: Eric Engestrom  (v1)
---
  src/util/meson.build | 9 ++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/util/meson.build b/src/util/meson.build
index fa591c92e56..4d34d578a25 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -83,7 +83,9 @@ files_mesa_util = files(
'u_vector.h',
  )
  
-install_data('drirc', install_dir : get_option('sysconfdir'))

+sysdir = join_paths(get_option('prefix'), get_option('sysconfdir'))
+
+install_data('drirc', install_dir : sysdir)


Hmm.. I think this would be a meson bug if this is needed.  the path 
given to install_dir: is relative to the prefix, unless absolute.


(see the last paragraph of 
http://mesonbuild.com/Installing.html#installing, although this could 
all be much better documented...)


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


[Mesa-dev] [PATCH] meson: libdrm shouldn't appear in Requires.private: if it wasn't found

2018-01-26 Thread Jon Turney
Otherwise, using pkg-config to retrieve flags will fail, e.g.

$ pkg-config gl --cflags
Package libdrm was not found in the pkg-config search path.
Perhaps you should add the directory containing `libdrm.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libdrm', required by 'gl', not found

Signed-off-by: Jon Turney 
---
 meson.build  | 6 --
 src/mesa/drivers/dri/meson.build | 7 ++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index bc5996992a3..824e3c46bc5 100644
--- a/meson.build
+++ b/meson.build
@@ -1213,8 +1213,10 @@ inc_include = include_directories('include')
 
 gl_priv_reqs = [
   'x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'x11-xcb', 'xcb',
-  'xcb-glx >= 1.8.1', 'libdrm >= 2.4.75',
-]
+  'xcb-glx >= 1.8.1']
+if dep_libdrm.found()
+  gl_priv_reqs += 'libdrm >= 2.4.75'
+endif
 if dep_xxf86vm != [] and dep_xxf86vm.found()
   gl_priv_reqs += 'xxf86vm'
 endif
diff --git a/src/mesa/drivers/dri/meson.build b/src/mesa/drivers/dri/meson.build
index 94798b0f5da..87021fba885 100644
--- a/src/mesa/drivers/dri/meson.build
+++ b/src/mesa/drivers/dri/meson.build
@@ -67,12 +67,17 @@ endif
 # This needs to be installed if any dri drivers (including gallium dri drivers)
 # are built.
 if with_dri
+  dri_req_private = []
+  if dep_libdrm.found()
+dri_req_private = ['libdrm >= 2.4.75']  # FIXME: don't hardcode this
+  endif
+
   pkg.generate(
 name : 'dri',
 filebase : 'dri',
 description : 'Direct Rendering Infrastructure',
 version : meson.project_version(),
 variables : ['dridriverdir=${prefix}/' + dri_drivers_path],
-requires_private : ['libdrm >= 2.4.75'],  # FIXME: don't hardcode this
+requires_private : dri_req_private,
   )
 endif
-- 
2.15.1

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


[Mesa-dev] [PATCH 3/6] glx/apple: include util/debug.h for env_var_as_boolean prototype

2018-01-28 Thread Jon Turney
mesa/src/glx/glxcmds.c:1295:21: error: implicit declaration of function 
'env_var_as_boolean' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
mesa/src/glx/apple/apple_visual.c:85:28: error: implicit declaration of 
function 'env_var_as_boolean' is invalid in C99 
[-Werror,-Wimplicit-function-declaration]
---
 src/glx/apple/apple_visual.c | 1 +
 src/glx/glxcmds.c| 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
index d482bfc4e71..4a90d77c3a5 100644
--- a/src/glx/apple/apple_visual.c
+++ b/src/glx/apple/apple_visual.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*  */
 #define glTexImage1D glTexImage1D_OSX
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index eee45d962d7..943b81754f3 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -43,6 +43,7 @@
 #ifdef GLX_USE_APPLEGL
 #include "apple/apple_glx_context.h"
 #include "apple/apple_glx.h"
+#include "util/debug.h"
 #else
 #include 
 #ifdef XF86VIDMODE
-- 
2.15.1

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


[Mesa-dev] [PATCH 1/6] configure: Default to gbm=no on osx

2018-01-28 Thread Jon Turney
---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index ae5162319d1..daa040d3194 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1270,10 +1270,10 @@ AC_ARG_ENABLE([xa],
 [enable_xa=no])
 AC_ARG_ENABLE([gbm],
[AS_HELP_STRING([--enable-gbm],
- [enable gbm library @<:@default=yes except cygwin@:>@])],
+ [enable gbm library @<:@default=yes except cygwin and macOS@:>@])],
[enable_gbm="$enableval"],
[case "$host_os" in
-   cygwin*)
+   cygwin* | darwin*)
   enable_gbm=no
   ;;
*)
-- 
2.15.1

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


[Mesa-dev] [PATCH 2/6] osx: ld doesn't support --build-id

2018-01-28 Thread Jon Turney
---
 configure.ac | 13 +
 src/mesa/drivers/dri/Makefile.am |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index daa040d3194..a54b7cb6650 100644
--- a/configure.ac
+++ b/configure.ac
@@ -685,6 +685,19 @@ AC_LINK_IFELSE(
 LDFLAGS=$save_LDFLAGS
 AM_CONDITIONAL(HAVE_LD_DYNAMIC_LIST, test "$have_ld_dynamic_list" = "yes")
 
+dnl
+dnl OSX linker does not support build-id
+dnl
+case "$host_os" in
+darwin*)
+LD_BUILD_ID=""
+;;
+*)
+LD_BUILD_ID="-Wl,--build-id=sha1"
+;;
+esac
+AC_SUBST([LD_BUILD_ID])
+
 dnl
 dnl compatibility symlinks
 dnl
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index ae30996e028..3876d7c4192 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -57,7 +57,7 @@ mesa_dri_drivers_la_LDFLAGS = \
-module \
-no-undefined \
-avoid-version \
-   -Wl,--build-id=sha1 \
+   $(LD_BUILD_ID) \
$(BSYMBOLIC) \
$(GC_SECTIONS) \
$(LD_NO_UNDEFINED)
-- 
2.15.1

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


[Mesa-dev] [PATCH 0/6] Fix osx build and add to CI

2018-01-28 Thread Jon Turney
Jon Turney (6):
  configure: Default to gbm=no on osx
  osx: ld doesn't support --build-id
  glx/apple: include util/debug.h for env_var_as_boolean prototype
  glx/apple: locate dispatch table functions to wrap by name
  glx/test: fix building for osx
  travis: add osx autotools build

 .travis.yml   | 123 --
 configure.ac  |  17 +-
 src/glx/apple/apple_glapi.c   |  12 ++--
 src/glx/apple/apple_visual.c  |   1 +
 src/glx/glxcmds.c |   1 +
 src/glx/tests/fake_glx_screen.cpp |  11 
 src/glx/tests/indirect_api.cpp|   4 ++
 src/mapi/glapi/gen/gl_gentable.py |  14 +
 src/mapi/glapi/glapi.h|   3 +
 src/mesa/drivers/dri/Makefile.am  |   2 +-
 10 files changed, 133 insertions(+), 55 deletions(-)

-- 
2.15.1

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


[Mesa-dev] [PATCH 4/6] glx/apple: locate dispatch table functions to wrap by name

2018-01-28 Thread Jon Turney
Avoid reaching into the dispatch table internals (and thus having to deal
with the complexities of remap etc.) by identifying functions to wrap by
name.

See:
https://lists.freedesktop.org/archives/mesa-dev/2015-June/086721.html et seq.
https://bugs.freedesktop.org/show_bug.cgi?id=90311
---
 src/glx/apple/apple_glapi.c   | 12 +---
 src/mapi/glapi/gen/gl_gentable.py | 14 ++
 src/mapi/glapi/glapi.h|  3 +++
 3 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/glx/apple/apple_glapi.c b/src/glx/apple/apple_glapi.c
index 4d19f7f6a3e..f2248ab01a2 100644
--- a/src/glx/apple/apple_glapi.c
+++ b/src/glx/apple/apple_glapi.c
@@ -41,7 +41,6 @@
 #include "main/glheader.h"
 #include "glapi.h"
 #include "glapitable.h"
-#include "main/dispatch.h"
 
 #include "apple_glx.h"
 #include "apple_xgl_api.h"
@@ -61,12 +60,11 @@ static void _apple_glapi_create_table(void) {
 assert(__applegl_api);
 memcpy(__applegl_api, __ogl_framework_api, sizeof(struct _glapi_table));
 
-SET_ReadPixels(__applegl_api, __applegl_glReadPixels);
-SET_CopyPixels(__applegl_api, __applegl_glCopyPixels);
-SET_CopyColorTable(__applegl_api, __applegl_glCopyColorTable);
-SET_DrawBuffer(__applegl_api, __applegl_glDrawBuffer);
-SET_DrawBuffers(__applegl_api, __applegl_glDrawBuffers);
-SET_Viewport(__applegl_api, __applegl_glViewport);
+_glapi_table_patch(__applegl_api, "ReadPixels", __applegl_glReadPixels);
+_glapi_table_patch(__applegl_api, "CopyPixels", __applegl_glCopyPixels);
+_glapi_table_patch(__applegl_api, "CopyColorTable", 
__applegl_glCopyColorTable);
+_glapi_table_patch(__applegl_api, "DrawBuffers", __applegl_glDrawBuffer);
+_glapi_table_patch(__applegl_api, "Viewport", __applegl_glViewport);
 }
 
 void apple_glapi_set_dispatch(void) {
diff --git a/src/mapi/glapi/gen/gl_gentable.py 
b/src/mapi/glapi/gen/gl_gentable.py
index 2f54d1d5792..50153bbabd5 100644
--- a/src/mapi/glapi/gen/gl_gentable.py
+++ b/src/mapi/glapi/gen/gl_gentable.py
@@ -56,6 +56,7 @@ header = """/* GLXEXT is the define used in the xserver when 
the GLX extension i
 #endif
 #include 
 #include 
+#include 
 
 #include "main/glheader.h"
 
@@ -144,6 +145,19 @@ _glapi_create_table_from_handle(void *handle, const char 
*symbol_prefix) {
 
 return disp;
 }
+
+void
+ _glapi_table_patch(struct _glapi_table *table, const char *name, void 
*wrapper)
+{
+   for (int func_index = 0; func_index < GLAPI_TABLE_COUNT; ++func_index) {
+  if (!strcmp(_glapi_table_func_names[func_index], name)) {
+((void **)table)[func_index] = wrapper;
+return;
+ }
+   }
+   fprintf(stderr, "could not patch %s in dispatch table\\n", name);
+}
+
 """
 
 
diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index f1ad4c1b5e8..d5d4e0a03a6 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -161,6 +161,9 @@ _glapi_get_proc_name(unsigned int offset);
 #if defined(GLX_USE_APPLEGL) || defined(GLX_USE_WINDOWSGL)
 _GLAPI_EXPORT struct _glapi_table *
 _glapi_create_table_from_handle(void *handle, const char *symbol_prefix);
+
+_GLAPI_EXPORT void
+_glapi_table_patch(struct _glapi_table *, const char *name, void *wrapper);
 #endif
 
 
-- 
2.15.1

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


[Mesa-dev] [PATCH 3/6] meson: build src/glx/apple

2018-01-28 Thread Jon Turney
---
 src/glx/apple/meson.build | 62 +++
 src/glx/meson.build   |  4 +++
 2 files changed, 66 insertions(+)
 create mode 100644 src/glx/apple/meson.build

diff --git a/src/glx/apple/meson.build b/src/glx/apple/meson.build
new file mode 100644
index 000..f69803713e0
--- /dev/null
+++ b/src/glx/apple/meson.build
@@ -0,0 +1,62 @@
+# Copyright © 2017 Jon Turney
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# library for native GL on macos
+files_libappleglx = files(
+  'apple_cgl.c',
+  'apple_cgl.h',
+  'appledri.c',
+  'appledri.h',
+  'appledristr.h',
+  'apple_glapi.c',
+  'apple_glx.c',
+  'apple_glx_context.c',
+  'apple_glx_context.h',
+  'apple_glx_drawable.c',
+  'apple_glx_drawable.h',
+  'apple_glx.h',
+  'apple_glx_log.c',
+  'apple_glx_log.h',
+  'apple_glx_pbuffer.c',
+  'apple_glx_pixmap.c',
+  'apple_glx_surface.c',
+  'apple_visual.c',
+  'apple_visual.h',
+  'apple_xgl_api.h',
+  'apple_xgl_api_read.c',
+  'apple_xgl_api_stereo.c',
+  'apple_xgl_api_viewport.c',
+  'glx_empty.c',
+)
+
+dep_xplugin = []
+if with_dri_platform == 'apple'
+  dep_xplugin = meson.get_compiler('c').find_library('Xplugin')
+endif
+# -framework ApplicationServices -framework CoreFoundation
+
+libappleglx = static_library(
+  'glxapple',
+  [files_libappleglx, glapitable_h],
+  include_directories: [inc_mesa, inc_glx, inc_src, inc_include, inc_glapi],
+  dependencies: [dep_xext, dep_xplugin],
+  c_args: [c_vis_args],
+  build_by_default: false,
+)
diff --git a/src/glx/meson.build b/src/glx/meson.build
index 04cd647ee49..ecedfd60f0e 100644
--- a/src/glx/meson.build
+++ b/src/glx/meson.build
@@ -18,6 +18,9 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
+inc_glx = include_directories('.')
+
+subdir('apple')
 subdir('windows')
 
 files_libglx = files(
@@ -98,6 +101,7 @@ endif
 
 if with_dri_platform == 'apple'
   files_libglx += files('applegl_glx.c')
+  extra_libs_libglx += libappleglx
 elif with_dri_platform == 'windows'
   files_libglx += files('driwindows_glx.c')
   extra_libs_libglx += [
-- 
2.15.1

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


[Mesa-dev] [PATCH 6/6] travis: add osx autotools build

2018-01-28 Thread Jon Turney
---
 .travis.yml | 123 ++--
 1 file changed, 78 insertions(+), 45 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 211df3ec1ef..9cecf2f615f 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -396,9 +396,39 @@ matrix:
 - libexpat1-dev
 - libx11-xcb-dev
 - libelf-dev
+- env:
+- LABEL="macOS make"
+- BUILD=make
+- MAKEFLAGS="-j4"
+- MAKE_CHECK_COMMAND="make check"
+- DRI_LOADERS="--with-platforms=x11 --disable-egl"
+  os: osx
+
+before_install:
+  - |
+if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+  HOMEBREW_NO_AUTO_UPDATE=1 brew install python3 ninja expat gettext ;
+  # Set PATH for homewbrew pip3 installs
+  PATH="$HOME/Library/Python/3.6/bin:${PATH}" ;
+  # Set PKG_CONFIG_PATH for keg-only expat
+  PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig:${PKG_CONFIG_PATH}" ;
+  # Set PATH for keg-only gettext
+  PATH="/usr/local/opt/gettext/bin:${PATH}" ;
+
+  # install xquartz for prepreqs ...
+  XQUARTZ_VERSION="2.7.11" ;
+  wget -nv 
https://dl.bintray.com/xquartz/downloads/XQuartz-${XQUARTZ_VERSION}.dmg ;
+  hdiutil attach XQuartz-${XQUARTZ_VERSION}.dmg ;
+  sudo installer -pkg /Volumes/XQuartz-${XQUARTZ_VERSION}/XQuartz.pkg 
-target / ;
+  hdiutil detach /Volumes/XQuartz-${XQUARTZ_VERSION} ;
+  # ... and set paths ;
+  PATH="/opt/X11/bin:${PATH}" ;
+  
PKG_CONFIG_PATH="/opt/X11/share/pkgconfig:/opt/X11/lib/pkgconfig:${PKG_CONFIG_PATH}"
 ;
+  ACLOCAL="aclocal -I /opt/X11/share/aclocal -I /usr/local/share/aclocal" ;
+fi
 
 install:
-  - pip install --user mako
+  - pip2 install --user mako
 
   # Install the latest meson from pip, since the version in the ubuntu repos is
   # often quite old.
@@ -419,62 +449,64 @@ install:
   # Install dependencies where we require specific versions (or where
   # disallowed by Travis CI's package whitelisting).
 
-  - wget $XORG_RELEASES/util/$XORGMACROS_VERSION.tar.bz2
-  - tar -jxvf $XORGMACROS_VERSION.tar.bz2
-  - (cd $XORGMACROS_VERSION && ./configure --prefix=$HOME/prefix && make 
install)
+  - |
+if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
+  wget $XORG_RELEASES/util/$XORGMACROS_VERSION.tar.bz2 ;
+  tar -jxvf $XORGMACROS_VERSION.tar.bz2 ;
+  (cd $XORGMACROS_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XORG_RELEASES/proto/$GLPROTO_VERSION.tar.bz2
-  - tar -jxvf $GLPROTO_VERSION.tar.bz2
-  - (cd $GLPROTO_VERSION && ./configure --prefix=$HOME/prefix && make install)
+  wget $XORG_RELEASES/proto/$GLPROTO_VERSION.tar.bz2 ;
+  tar -jxvf $GLPROTO_VERSION.tar.bz2 ;
+  (cd $GLPROTO_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XORG_RELEASES/proto/$DRI2PROTO_VERSION.tar.bz2
-  - tar -jxvf $DRI2PROTO_VERSION.tar.bz2
-  - (cd $DRI2PROTO_VERSION && ./configure --prefix=$HOME/prefix && make 
install)
+  wget $XORG_RELEASES/proto/$DRI2PROTO_VERSION.tar.bz2 ;
+  tar -jxvf $DRI2PROTO_VERSION.tar.bz2 ;
+  (cd $DRI2PROTO_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XCB_RELEASES/$XCBPROTO_VERSION.tar.bz2
-  - tar -jxvf $XCBPROTO_VERSION.tar.bz2
-  - (cd $XCBPROTO_VERSION && ./configure --prefix=$HOME/prefix && make install)
+  wget $XCB_RELEASES/$XCBPROTO_VERSION.tar.bz2 ;
+  tar -jxvf $XCBPROTO_VERSION.tar.bz2 ;
+  (cd $XCBPROTO_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XCB_RELEASES/$LIBXCB_VERSION.tar.bz2
-  - tar -jxvf $LIBXCB_VERSION.tar.bz2
-  - (cd $LIBXCB_VERSION && ./configure --prefix=$HOME/prefix && make install)
+  wget $XCB_RELEASES/$LIBXCB_VERSION.tar.bz2 ;
+  tar -jxvf $LIBXCB_VERSION.tar.bz2 ;
+  (cd $LIBXCB_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XORG_RELEASES/lib/$LIBPCIACCESS_VERSION.tar.bz2
-  - tar -jxvf $LIBPCIACCESS_VERSION.tar.bz2
-  - (cd $LIBPCIACCESS_VERSION && ./configure --prefix=$HOME/prefix && make 
install)
+  wget $XORG_RELEASES/lib/$LIBPCIACCESS_VERSION.tar.bz2 ;
+  tar -jxvf $LIBPCIACCESS_VERSION.tar.bz2 ;
+  (cd $LIBPCIACCESS_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget http://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.bz2
-  - tar -jxvf $LIBDRM_VERSION.tar.bz2
-  - (cd $LIBDRM_VERSION && ./configure --prefix=$HOME/prefix --enable-vc4 
--enable-freedreno --enable-etnaviv-experimental-api && make install)
+  wget http://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.bz2 ;
+  tar -jxvf $LIBDRM_VERSION.tar.bz2 ;
+  (cd $LIBDRM_VERSION && ./configure --prefix=$HOME/prefix --enable-vc4 
--enable-freedreno --enable-etnaviv-experimental-api && make install) ;
 
-  - wget $XORG_RELEASES/lib/$LIBXSHMFENCE_VERSION.tar.bz2
-  - tar -jxvf $LIBXSHMFENCE_VERSION.tar.bz2
-  - (cd $LIBXSHMFENCE_VERSION && ./configure --prefix=$HOME/prefix && make 
install)
+ 

[Mesa-dev] [PATCH 1/6] meson: find python2 on macOS

2018-01-28 Thread Jon Turney
From: Dylan Baker 

---
 meson.build | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 824e3c46bc5..178743eddb1 100644
--- a/meson.build
+++ b/meson.build
@@ -642,7 +642,13 @@ if with_platform_android
   pre_args += '-DHAVE_ANDROID_PLATFORM'
 endif
 
-prog_python2 = find_program('python2')
+# Basically we can't trust Linux because one distro had decided that python
+# should be python3. macOS doesn't have a python2 binary, however.
+if build_machine.system() != 'darwin'
+  prog_python2 = find_program('python2')
+else
+  prog_python2 = find_program('python')
+endif
 has_mako = run_command(prog_python2, '-c', 'import mako')
 if has_mako.returncode() != 0
   error('Python (2.x) mako module required to build mesa.')
-- 
2.15.1

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


[Mesa-dev] [PATCH 2/6] meson: set apple glx defines

2018-01-28 Thread Jon Turney
From: Dylan Baker 

---
 meson.build | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meson.build b/meson.build
index 178743eddb1..7e194a9f10d 100644
--- a/meson.build
+++ b/meson.build
@@ -616,6 +616,8 @@ if with_platform_x11
 endif
 if with_dri_platform == 'drm'
   pre_args += '-DGLX_USE_DRM'
+elif with_dri_platform == 'apple'
+  pre_args += '-DGLX_USE_APPLEGL'
 elif with_dri_platform == 'windows'
   pre_args += '-DGLX_USE_WINDOWSGL'
 endif
-- 
2.15.1

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


[Mesa-dev] [PATCH 0/6] meson: build src/glx/apple

2018-01-28 Thread Jon Turney
This also requires my "fix osx" series to actually build

Dylan Baker (2):
  meson: find python2 on macOS
  meson: set apple glx defines

Jon Turney (4):
  meson: build src/glx/apple
  meson: osx doesn't have librt, so don't require it
  meson: osx ld doesn't support --build-id
  travis: add macOS meson build

 .travis.yml  |  5 
 meson.build  | 16 +--
 src/glx/apple/meson.build| 62 
 src/glx/meson.build  |  4 +++
 src/mesa/drivers/dri/meson.build |  2 +-
 5 files changed, 86 insertions(+), 3 deletions(-)
 create mode 100644 src/glx/apple/meson.build

-- 
2.15.1

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


[Mesa-dev] [PATCH 4/6] meson: osx doesn't have librt, so don't require it

2018-01-28 Thread Jon Turney
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 7e194a9f10d..8fdbaa8b8d8 100644
--- a/meson.build
+++ b/meson.build
@@ -935,7 +935,7 @@ elif with_dri_i965 and get_option('shader-cache')
 endif
 
 # Determine whether or not the rt library is needed for time functions
-if cc.has_function('clock_gettime')
+if cc.has_function('clock_gettime') or (host_machine.system() == 'darwin')
   dep_clock = []
 else
   dep_clock = cc.find_library('rt')
-- 
2.15.1

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


[Mesa-dev] [PATCH 6/6] travis: add macOS meson build

2018-01-28 Thread Jon Turney
---
 .travis.yml | 5 +
 1 file changed, 5 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 9cecf2f615f..7e6bbfe306b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -403,6 +403,11 @@ matrix:
 - MAKE_CHECK_COMMAND="make check"
 - DRI_LOADERS="--with-platforms=x11 --disable-egl"
   os: osx
+- env:
+- LABEL="macOS meson"
+- BUILD=meson
+- MESON_OPTIONS="-Ddri-drivers=swrast -Dgallium-drivers= 
-Dvulkan-drivers= -Dplatforms=x11,surfaceless -Dglx=dri -Degl=false"
+  os: osx
 
 before_install:
   - |
-- 
2.15.1

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


[Mesa-dev] [PATCH 5/6] meson: osx ld doesn't support --build-id

2018-01-28 Thread Jon Turney
---
 meson.build  | 4 
 src/mesa/drivers/dri/meson.build | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 8fdbaa8b8d8..655a93cecef 100644
--- a/meson.build
+++ b/meson.build
@@ -914,6 +914,10 @@ if cc.links('int main() { return 0; }',
 name : 'dynamic-list')
   with_ld_dynamic_list = true
 endif
+ld_args_build_id = []
+if build_machine.system() != 'darwin'
+   ld_args_build_id += '-Wl,--build-id=sha1'
+endif
 
 # check for dl support
 if cc.has_function('dlopen')
diff --git a/src/mesa/drivers/dri/meson.build b/src/mesa/drivers/dri/meson.build
index 87021fba885..6342168ab33 100644
--- a/src/mesa/drivers/dri/meson.build
+++ b/src/mesa/drivers/dri/meson.build
@@ -53,7 +53,7 @@ if dri_drivers != []
 dependencies : [
   dep_selinux, dep_libdrm, dep_expat, dep_m, dep_thread, dep_dl, idep_nir,
 ],
-link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, 
ld_args_gc_sections],
+link_args : [ld_args_build_id, ld_args_bsymbolic, ld_args_gc_sections],
   )
 
   meson.add_install_script(
-- 
2.15.1

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


Re: [Mesa-dev] [PATCH 12/20] mesa: implement buffer/texture barriers for semaphore signal/wait v2

2018-01-31 Thread Jon Turney

On 23/01/2018 18:05, Andres Rodriguez wrote:

Make sure memory is accessible to the external client, for the specified
memory object, before the signal/after the wait.

v2: fixed flush order with respect to wait/signal emission

Signed-off-by: Andres Rodriguez 
---
  src/mesa/main/dd.h  | 14 ++-
  src/mesa/main/externalobjects.c | 38 +++---
  src/mesa/state_tracker/st_cb_semaphoreobjects.c | 53 +++--
  3 files changed, 95 insertions(+), 10 deletions(-)

[...]

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 4fb3ca07a9..c070d7a28d 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -23,6 +23,7 @@
  
  #include "macros.h"

  #include "mtypes.h"
+#include "bufferobj.h"
  #include "context.h"
  #include "externalobjects.h"
  #include "teximage.h"
@@ -716,7 +717,8 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore,
  {
 GET_CURRENT_CONTEXT(ctx);
 struct gl_semaphore_object *semObj;
-
+   struct gl_buffer_object **bufObjs;
+   struct gl_texture_object **texObjs;
  
 if (!ctx->Extensions.EXT_semaphore) {

_mesa_error(ctx, GL_INVALID_OPERATION, 
"glWaitSemaphoreEXT(unsupported)");
@@ -732,8 +734,20 @@ _mesa_WaitSemaphoreEXT(GLuint semaphore,
 FLUSH_VERTICES( ctx, 0 );
 FLUSH_CURRENT( ctx, 0 );
  
-   /* TODO: memory barriers and layout transitions */

-   ctx->Driver.ServerWaitSemaphoreObject(ctx, semObj);
+   bufObjs = alloca(sizeof(struct gl_buffer_object **) * numBufferBarriers);
+   for (unsigned i = 0; i < numBufferBarriers; i++) {
+  bufObjs[i] = _mesa_lookup_bufferobj(ctx, buffers[i]);
+   }
+
+   texObjs = alloca(sizeof(struct gl_texture_object **) * numTextureBarriers);
+   for (unsigned i = 0; i < numTextureBarriers; i++) {
+  texObjs[i] = _mesa_lookup_texture(ctx, textures[i]);
+   }
+
+   ctx->Driver.ServerWaitSemaphoreObject(ctx, semObj,
+ numBufferBarriers, bufObjs,
+ numTextureBarriers, texObjs,
+ srcLayouts);
  }
  
  void GLAPIENTRY

@@ -746,6 +760,8 @@ _mesa_SignalSemaphoreEXT(GLuint semaphore,
  {
 GET_CURRENT_CONTEXT(ctx);
 struct gl_semaphore_object *semObj;
+   struct gl_buffer_object **bufObjs;
+   struct gl_texture_object **texObjs;
  
 if (!ctx->Extensions.EXT_semaphore) {

_mesa_error(ctx, GL_INVALID_OPERATION, 
"glSignalSemaphoreEXT(unsupported)");
@@ -761,8 +777,20 @@ _mesa_SignalSemaphoreEXT(GLuint semaphore,
 FLUSH_VERTICES( ctx, 0 );
 FLUSH_CURRENT( ctx, 0 );
  
-   /* TODO: memory barriers and layout transitions */

-   ctx->Driver.ServerSignalSemaphoreObject(ctx, semObj);
+   bufObjs = alloca(sizeof(struct gl_buffer_object **) * numBufferBarriers);
+   for (unsigned i = 0; i < numBufferBarriers; i++) {
+  bufObjs[i] = _mesa_lookup_bufferobj(ctx, buffers[i]);
+   }
+
+   texObjs = alloca(sizeof(struct gl_texture_object **) * numTextureBarriers);
+   for (unsigned i = 0; i < numTextureBarriers; i++) {
+  texObjs[i] = _mesa_lookup_texture(ctx, textures[i]);
+   }
+
+   ctx->Driver.ServerSignalSemaphoreObject(ctx, semObj,
+   numBufferBarriers, bufObjs,
+   numTextureBarriers, texObjs,
+   dstLayouts);
  }

[...]

This adds a use of alloca(), without a corresponding #include.

Patch attached.

See also:
https://lists.freedesktop.org/archives/mesa-dev/2017-December/180073.html
https://lists.freedesktop.org/archives/mesa-dev/2016-July/122346.html

From 46a2c9bbd03234120594d50b48cbad73a355d240 Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Wed, 31 Jan 2018 12:46:22 +
Subject: [PATCH] Fix use of alloca() without #include 
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix use of alloca() without #include  in 29b9bd05

../src/mesa/main/externalobjects.c:737:14: error: implicit declaration of 
function ‘alloca’ [-Werror=implicit-function-declaration]

Signed-off-by: Jon Turney 
---
 src/mesa/main/externalobjects.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 463debd268..4648932a9b 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -21,6 +21,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 
+#include "c99_alloca.h"
 #include "macros.h"
 #include "mtypes.h"
 #include "bufferobj.h"
-- 
2.16.1

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


Re: [Mesa-dev] [PATCH 4/6] meson: osx doesn't have librt, so don't require it

2018-01-31 Thread Jon Turney

On 31/01/2018 15:21, Emil Velikov wrote:

On 30 January 2018 at 20:27, Dylan Baker  wrote:

Quoting Emil Velikov (2018-01-30 10:56:42)

Hi Jon,

On 28 January 2018 at 14:24, Jon Turney  wrote:

---
  meson.build | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 7e194a9f10d..8fdbaa8b8d8 100644
--- a/meson.build
+++ b/meson.build
@@ -935,7 +935,7 @@ elif with_dri_i965 and get_option('shader-cache')
  endif

  # Determine whether or not the rt library is needed for time functions
-if cc.has_function('clock_gettime')
+if cc.has_function('clock_gettime') or (host_machine.system() == 'darwin')


Absolutely no objections against the patch - just a small question.
If the meson/autotools check fails, does this mean that the resulting
binaries are having unresolved reference wrt said symbol?

Thanks
Emil


Not for meson, it builds -Wl,--no-undefined (or it's MSVC equivalent) by
default, so it shouldn't be possible to get unresolved symbols in a binary or
shared library.


Right, the question is why does the test (has_function) fails?


Some misunderstanding going on here, I think. It fails if the function 
isn't present.


(We then go on to report the failure as being librt not found, not that 
we couldn't work out how to find clock_gettime, but perhaps that's a 
separate issue)



A few possible solutions come to mind, but only one with toolchain
handy can confirm.
  - the test is broken (regardless meson/autotools/foo implementation)
  - the symbol is indirectly resolved
The est does not pull libfoo, while the final binary does. Libfoo
pulls libbar with the latter providing the symbol.
  - the final binary is having unresolved reference
  - all the clock_gettime references get 'magically' removed due to the
linker garbage collector

 From a quick search OSX 10.12 (or so) has clock_gettime. But details
are extremely sparse :-(


This change (and the check that autoconf is currently doing) is not needed.

If we're targeting OSX 10.12 or later, clock_gettime() exists.

Commit 990bd49f might have made sense once, but I think now that 
clock_gettime is used in include/c11/threads_posix.h, we're going to 
fail to build for OSX prior to 10.12, even when not trying to link with 
librt.


(I also had a patch to provide an implementation of clock_gettime if the 
target is an earlier OSX version, but I dropped it as probably not very 
useful)

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


[Mesa-dev] [PATCH 1/4] glx/test: fix building for osx

2018-02-01 Thread Jon Turney
An additional stub for applegl_create_context() is needed
Cannot test indirect API as it's not built on osx, currently

Signed-off-by: Jon Turney 
---
 src/glx/tests/fake_glx_screen.cpp | 11 +++
 src/glx/tests/indirect_api.cpp|  4 
 2 files changed, 15 insertions(+)

diff --git a/src/glx/tests/fake_glx_screen.cpp 
b/src/glx/tests/fake_glx_screen.cpp
index 801f54a6fa..71e4e8ce48 100644
--- a/src/glx/tests/fake_glx_screen.cpp
+++ b/src/glx/tests/fake_glx_screen.cpp
@@ -75,6 +75,17 @@ indirect_create_context_attribs(struct glx_screen *base,
return indirect_create_context(base, config_base, shareList, 0);
 }
 
+#ifdef GLX_USE_APPLEGL
+extern "C" struct glx_context *
+applegl_create_context(struct glx_screen *base,
+  struct glx_config *config_base,
+  struct glx_context *shareList,
+  int renderType)
+{
+   return indirect_create_context(base, config_base, shareList, renderType);
+}
+#endif
+
 /* This is necessary so that we don't have to link with glxcurrent.c
  * which would require us to link with X libraries and what not.
  */
diff --git a/src/glx/tests/indirect_api.cpp b/src/glx/tests/indirect_api.cpp
index 34304a185e..b9a4ca0655 100644
--- a/src/glx/tests/indirect_api.cpp
+++ b/src/glx/tests/indirect_api.cpp
@@ -705,6 +705,8 @@ void __indirect_glFramebufferTextureLayer(void) { }
 }
 /*@}*/
 
+#ifndef GLX_USE_APPLEGL
+
 class IndirectAPI : public ::testing::Test {
 public:
virtual void SetUp();
@@ -1518,3 +1520,5 @@ TEST_F(IndirectAPI, EXT_texture_array)
 {
EXPECT_EQ((_glapi_proc) __indirect_glFramebufferTextureLayer, 
table[_glapi_get_proc_offset("glFramebufferTextureLayerEXT")]);
 }
+
+#endif
-- 
2.16.1

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


[Mesa-dev] [PATCH 0/4] Fix osx build and add to CI (reprise)

2018-02-01 Thread Jon Turney
Jon Turney (4):
  glx/test: fix building for osx
  travis: conditionalize building of prerequisites on if OS=linux
  travis: pip -> pip2
  travis: add osx autotools build

 .travis.yml   | 123 --
 src/glx/tests/fake_glx_screen.cpp |  11 
 src/glx/tests/indirect_api.cpp|   4 ++
 3 files changed, 93 insertions(+), 45 deletions(-)

-- 
2.16.1

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


[Mesa-dev] [PATCH 2/4] travis: conditionalize building of prerequisites on if OS=linux

2018-02-01 Thread Jon Turney
Use a '|' YAML literal block to avoid the convoluted syntax needed to put
the entire conditional on a single line.

Signed-off-by: Jon Turney 
---
 .travis.yml | 91 +++--
 1 file changed, 47 insertions(+), 44 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 211df3ec1e..1d6cf98519 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -419,62 +419,64 @@ install:
   # Install dependencies where we require specific versions (or where
   # disallowed by Travis CI's package whitelisting).
 
-  - wget $XORG_RELEASES/util/$XORGMACROS_VERSION.tar.bz2
-  - tar -jxvf $XORGMACROS_VERSION.tar.bz2
-  - (cd $XORGMACROS_VERSION && ./configure --prefix=$HOME/prefix && make 
install)
+  - |
+if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
+  wget $XORG_RELEASES/util/$XORGMACROS_VERSION.tar.bz2 ;
+  tar -jxvf $XORGMACROS_VERSION.tar.bz2 ;
+  (cd $XORGMACROS_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XORG_RELEASES/proto/$GLPROTO_VERSION.tar.bz2
-  - tar -jxvf $GLPROTO_VERSION.tar.bz2
-  - (cd $GLPROTO_VERSION && ./configure --prefix=$HOME/prefix && make install)
+  wget $XORG_RELEASES/proto/$GLPROTO_VERSION.tar.bz2 ;
+  tar -jxvf $GLPROTO_VERSION.tar.bz2 ;
+  (cd $GLPROTO_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XORG_RELEASES/proto/$DRI2PROTO_VERSION.tar.bz2
-  - tar -jxvf $DRI2PROTO_VERSION.tar.bz2
-  - (cd $DRI2PROTO_VERSION && ./configure --prefix=$HOME/prefix && make 
install)
+  wget $XORG_RELEASES/proto/$DRI2PROTO_VERSION.tar.bz2 ;
+  tar -jxvf $DRI2PROTO_VERSION.tar.bz2 ;
+  (cd $DRI2PROTO_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XCB_RELEASES/$XCBPROTO_VERSION.tar.bz2
-  - tar -jxvf $XCBPROTO_VERSION.tar.bz2
-  - (cd $XCBPROTO_VERSION && ./configure --prefix=$HOME/prefix && make install)
+  wget $XCB_RELEASES/$XCBPROTO_VERSION.tar.bz2 ;
+  tar -jxvf $XCBPROTO_VERSION.tar.bz2 ;
+  (cd $XCBPROTO_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XCB_RELEASES/$LIBXCB_VERSION.tar.bz2
-  - tar -jxvf $LIBXCB_VERSION.tar.bz2
-  - (cd $LIBXCB_VERSION && ./configure --prefix=$HOME/prefix && make install)
+  wget $XCB_RELEASES/$LIBXCB_VERSION.tar.bz2 ;
+  tar -jxvf $LIBXCB_VERSION.tar.bz2 ;
+  (cd $LIBXCB_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget $XORG_RELEASES/lib/$LIBPCIACCESS_VERSION.tar.bz2
-  - tar -jxvf $LIBPCIACCESS_VERSION.tar.bz2
-  - (cd $LIBPCIACCESS_VERSION && ./configure --prefix=$HOME/prefix && make 
install)
+  wget $XORG_RELEASES/lib/$LIBPCIACCESS_VERSION.tar.bz2 ;
+  tar -jxvf $LIBPCIACCESS_VERSION.tar.bz2 ;
+  (cd $LIBPCIACCESS_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget http://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.bz2
-  - tar -jxvf $LIBDRM_VERSION.tar.bz2
-  - (cd $LIBDRM_VERSION && ./configure --prefix=$HOME/prefix --enable-vc4 
--enable-freedreno --enable-etnaviv-experimental-api && make install)
+  wget http://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.bz2 ;
+  tar -jxvf $LIBDRM_VERSION.tar.bz2 ;
+  (cd $LIBDRM_VERSION && ./configure --prefix=$HOME/prefix --enable-vc4 
--enable-freedreno --enable-etnaviv-experimental-api && make install) ;
 
-  - wget $XORG_RELEASES/lib/$LIBXSHMFENCE_VERSION.tar.bz2
-  - tar -jxvf $LIBXSHMFENCE_VERSION.tar.bz2
-  - (cd $LIBXSHMFENCE_VERSION && ./configure --prefix=$HOME/prefix && make 
install)
+  wget $XORG_RELEASES/lib/$LIBXSHMFENCE_VERSION.tar.bz2 ;
+  tar -jxvf $LIBXSHMFENCE_VERSION.tar.bz2 ;
+  (cd $LIBXSHMFENCE_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget 
http://people.freedesktop.org/~aplattner/vdpau/$LIBVDPAU_VERSION.tar.bz2
-  - tar -jxvf $LIBVDPAU_VERSION.tar.bz2
-  - (cd $LIBVDPAU_VERSION && ./configure --prefix=$HOME/prefix && make install)
+  wget 
http://people.freedesktop.org/~aplattner/vdpau/$LIBVDPAU_VERSION.tar.bz2 ;
+  tar -jxvf $LIBVDPAU_VERSION.tar.bz2 ;
+  (cd $LIBVDPAU_VERSION && ./configure --prefix=$HOME/prefix && make 
install) ;
 
-  - wget 
http://www.freedesktop.org/software/vaapi/releases/libva/$LIBVA_VERSION.tar.bz2
-  - tar -jxvf $LIBVA_VERSION.tar.bz2
-  - (cd $LIBVA_VERSION && ./configure --prefix=$HOME/prefix --disable-wayland 
--disable-dummy-driver && make install)
+  wget 
http://www.freedesktop.org/software/vaapi/releases/libva/$LIBVA_VERSION.tar.bz2 
;
+  tar -jxvf $LIBVA_VERSION.tar.bz2 ;
+  (cd $LIBVA_VERSION && ./configure --prefix=$HOME/prefix 
--disable-wayland

[Mesa-dev] [PATCH 3/4] travis: pip -> pip2

2018-02-01 Thread Jon Turney
On travis, for OSX, python2 from homebrew is pre-installed. per [1]:

 python points to the macOS system Python (with no manual PATH modification)
 python2 points to Homebrew’s Python 2.7.x (if installed)
 python3 points to Homebrew’s Python 3.x (if installed)
 pip doesn't exist
 pip2 points to Homebrew’s Python 2.7.x’s pip (if installed)
 pip3 points to Homebrew’s Python 3.x’s pip (if installed)

We will end up using 'python2' for building mesa.

Just use 'pip2' instead of 'pip', as that seems to work for all platforms on
travis.

[1] https://docs.brew.sh/Homebrew-and-Python.html

Signed-off-by: Jon Turney 
---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 1d6cf98519..e18327bec9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -398,7 +398,7 @@ matrix:
 - libelf-dev
 
 install:
-  - pip install --user mako
+  - pip2 install --user mako
 
   # Install the latest meson from pip, since the version in the ubuntu repos is
   # often quite old.
-- 
2.16.1

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


[Mesa-dev] [PATCH 4/4] travis: add osx autotools build

2018-02-01 Thread Jon Turney
Signed-off-by: Jon Turney 
---
 .travis.yml | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index e18327bec9..fc137c9667 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -396,6 +396,36 @@ matrix:
 - libexpat1-dev
 - libx11-xcb-dev
 - libelf-dev
+- env:
+- LABEL="macOS make"
+- BUILD=make
+- MAKEFLAGS="-j4"
+- MAKE_CHECK_COMMAND="make check"
+- DRI_LOADERS="--with-platforms=x11 --disable-egl"
+  os: osx
+
+before_install:
+  - |
+if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+  HOMEBREW_NO_AUTO_UPDATE=1 brew install python3 ninja expat gettext ;
+  # Set PATH for homebrew pip3 installs
+  PATH="$HOME/Library/Python/3.6/bin:${PATH}" ;
+  # Set PKG_CONFIG_PATH for keg-only expat
+  PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig:${PKG_CONFIG_PATH}" ;
+  # Set PATH for keg-only gettext
+  PATH="/usr/local/opt/gettext/bin:${PATH}" ;
+
+  # Install xquartz for prereqs ...
+  XQUARTZ_VERSION="2.7.11" ;
+  wget -nv 
https://dl.bintray.com/xquartz/downloads/XQuartz-${XQUARTZ_VERSION}.dmg ;
+  hdiutil attach XQuartz-${XQUARTZ_VERSION}.dmg ;
+  sudo installer -pkg /Volumes/XQuartz-${XQUARTZ_VERSION}/XQuartz.pkg 
-target / ;
+  hdiutil detach /Volumes/XQuartz-${XQUARTZ_VERSION} ;
+  # ... and set paths
+  PATH="/opt/X11/bin:${PATH}" ;
+  
PKG_CONFIG_PATH="/opt/X11/share/pkgconfig:/opt/X11/lib/pkgconfig:${PKG_CONFIG_PATH}"
 ;
+  ACLOCAL="aclocal -I /opt/X11/share/aclocal -I /usr/local/share/aclocal" ;
+fi
 
 install:
   - pip2 install --user mako
-- 
2.16.1

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


Re: [Mesa-dev] [PATCH 1/6] meson: find python2 on macOS

2018-02-01 Thread Jon Turney

On 01/02/2018 11:49, Emil Velikov wrote:

On 28 January 2018 at 14:24, Jon Turney  wrote:

From: Dylan Baker 

---
  meson.build | 8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 824e3c46bc5..178743eddb1 100644
--- a/meson.build
+++ b/meson.build
@@ -642,7 +642,13 @@ if with_platform_android
pre_args += '-DHAVE_ANDROID_PLATFORM'
  endif

-prog_python2 = find_program('python2')
+# Basically we can't trust Linux because one distro had decided that python
+# should be python3. macOS doesn't have a python2 binary, however.
+if build_machine.system() != 'darwin'
+  prog_python2 = find_program('python2')
+else
+  prog_python2 = find_program('python')
+endif


I think this is better suited in meson, thus everyone doesn't need to
reinvent the wheel.
Even if we're moving towards python2-free world ;-)


I wonder why this can't just be find_program('python2', 'python'), 
similar to what autotools does?

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


[Mesa-dev] [PATCH] meson: better defaults for osx, windows and cygwin

2018-02-03 Thread Jon Turney
set suitable defaults for 'dri-drivers', 'gallium-drivers', 'vulkan-drivers'
and 'platforms' options for osx, windows and cygwin, adding cygwin where
appropriate.

Signed-off-by: Jon Turney 
---
 meson.build | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index cb3b6587b4..b49bc9e805 100644
--- a/meson.build
+++ b/meson.build
@@ -92,15 +92,16 @@ with_dri_nouveau = false
 with_dri_swrast = false
 _drivers = get_option('dri-drivers')
 if _drivers == 'auto'
-  # TODO: PPC, Sparc
-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if not ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+# TODO: PPC, Sparc
 if ['x86', 'x86_64'].contains(host_machine.cpu_family())
   _drivers = 'i915,i965,r100,r200,nouveau'
 else
   error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
   else
-error('Unknown OS. Please pass -Ddri-drivers to set driver options. 
Patches gladly accepted to fix this.')
+# only swrast would make sense here, but gallium swrast is a much better 
default
+_drivers = ''
   endif
 endif
 if _drivers != ''
@@ -132,7 +133,7 @@ with_gallium_virgl = false
 with_gallium_swr = false
 _drivers = get_option('gallium-drivers')
 if _drivers == 'auto'
-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if not ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
 # TODO: PPC, Sparc
 if ['x86', 'x86_64'].contains(host_machine.cpu_family())
   _drivers = 'r300,r600,radeonsi,nouveau,virgl,svga,swrast'
@@ -142,7 +143,7 @@ if _drivers == 'auto'
   error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
   else
-error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
+_drivers = 'swrast'
   endif
 endif
 if _drivers != ''
@@ -170,7 +171,7 @@ with_amd_vk = false
 with_any_vk = false
 _vulkan_drivers = get_option('vulkan-drivers')
 if _vulkan_drivers == 'auto'
-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if not ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
 if host_machine.cpu_family().startswith('x86')
   _vulkan_drivers = 'amd,intel'
 else
@@ -234,7 +235,7 @@ if _platforms == 'auto'
   if system_has_kms_drm
 _platforms = 'x11,wayland,drm,surfaceless'
   else
-error('Unknown OS, no platforms enabled. Patches gladly accepted to fix 
this.')
+_platforms = 'x11,surfaceless'
   endif
 endif
 if _platforms != ''
-- 
2.16.1

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


Re: [Mesa-dev] [PATCH 6/6] travis: add macOS meson build

2018-02-03 Thread Jon Turney

On 01/02/2018 13:13, Emil Velikov wrote:

On 28 January 2018 at 14:24, Jon Turney wrote:

---
  .travis.yml | 5 +
  1 file changed, 5 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index 9cecf2f615f..7e6bbfe306b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -403,6 +403,11 @@ matrix:
  - MAKE_CHECK_COMMAND="make check"
  - DRI_LOADERS="--with-platforms=x11 --disable-egl"
os: osx
+- env:
+- LABEL="macOS meson"
+- BUILD=meson
+- MESON_OPTIONS="-Ddri-drivers=swrast -Dgallium-drivers= -Dvulkan-drivers= 
-Dplatforms=x11,surfaceless -Dglx=dri -Degl=false"

Can we please have the same [explicit] set of toggles for both
automake and meson?


Yeah, meson needs to learn some more sensible defaults in this case.

I've sent a separate patch for that.


You can drop the surfaceless platform - there's no way to use it w/o
EGL. Speaking of which, did we merge all the patches for it on
Cygwin/OSX?


I don't have any outstanding patches for that, but it's broken since the 
last time I fixed it :(


But that's a problem for another day...

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


Re: [Mesa-dev] [PATCH] meson: better defaults for osx, windows and cygwin

2018-02-03 Thread Jon Turney

On 03/02/2018 18:07, Dylan Baker wrote:

Quoting Jon Turney (2018-02-03 05:49:40)

-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if not ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+# TODO: PPC, Sparc
  if ['x86', 'x86_64'].contains(host_machine.cpu_family())
_drivers = 'i915,i965,r100,r200,nouveau'
  else
error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
  endif
else
-error('Unknown OS. Please pass -Ddri-drivers to set driver options. 
Patches gladly accepted to fix this.')
+# only swrast would make sense here, but gallium swrast is a much better 
default
+_drivers = ''


I'm really not a fan of dumping the 'else error' case. This currently means that
for example haiku will try to build something that they cannot support. I'd
really rather just set appropriate defaults for OSes that are guaranteed
supported and still let OSes that haven't been tested fall through to error. I
also think that's a nice place for people trying to use mesa meson on a new
platform, since they understand we haven't tested on their OS.


Good idea.  But that's not what the code currently does.  If it's not on 
the list of 'unknown' OSes (darwin, windows), any other OS e.g. haiku 
gets treated like linux...


Attached is a revised patch which is more explicit about what's a known 
OS.  I guess the BSDs probably should be added somewhere, but idk what's 
appropriate for them.



From e4e767a8d4d3e08651d1336f9896c6b7efa01be1 Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Fri, 2 Feb 2018 22:25:48 +
Subject: [PATCH] meson: better defaults for osx, windows and cygwin

set suitable defaults for 'dri-drivers', 'gallium-drivers', 'vulkan-drivers'
and 'platforms' options for osx, windows and cygwin, adding cygwin where
appropriate.

v2: error() for unknown OS

Signed-off-by: Jon Turney 
---
 meson.build | 21 +++--
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index cb3b6587b4..56a466f764 100644
--- a/meson.build
+++ b/meson.build
@@ -92,13 +92,16 @@ with_dri_nouveau = false
 with_dri_swrast = false
 _drivers = get_option('dri-drivers')
 if _drivers == 'auto'
-  # TODO: PPC, Sparc
-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if host_machine.system() == 'linux'
+# TODO: PPC, Sparc
 if ['x86', 'x86_64'].contains(host_machine.cpu_family())
   _drivers = 'i915,i965,r100,r200,nouveau'
 else
   error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
+  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+# only swrast would make sense here, but gallium swrast is a much better 
default
+_drivers = ''
   else
 error('Unknown OS. Please pass -Ddri-drivers to set driver options. 
Patches gladly accepted to fix this.')
   endif
@@ -132,7 +135,7 @@ with_gallium_virgl = false
 with_gallium_swr = false
 _drivers = get_option('gallium-drivers')
 if _drivers == 'auto'
-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if host_machine.system() == 'linux'
 # TODO: PPC, Sparc
 if ['x86', 'x86_64'].contains(host_machine.cpu_family())
   _drivers = 'r300,r600,radeonsi,nouveau,virgl,svga,swrast'
@@ -141,6 +144,8 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
+  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+_drivers = 'swrast'
   else
 error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
   endif
@@ -170,15 +175,17 @@ with_amd_vk = false
 with_any_vk = false
 _vulkan_drivers = get_option('vulkan-drivers')
 if _vulkan_drivers == 'auto'
-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if host_machine.system() == 'linux'
 if host_machine.cpu_family().startswith('x86')
   _vulkan_drivers = 'amd,intel'
 else
   error('Unknown architecture. Please pass -Dvulkan-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  else
+  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
 

Re: [Mesa-dev] [PATCH] meson: better defaults for osx, windows and cygwin

2018-02-05 Thread Jon Turney

On 05/02/2018 17:34, Dylan Baker wrote:

Quoting Jon Turney (2018-02-03 13:19:20)

On 03/02/2018 18:07, Dylan Baker wrote:

Quoting Jon Turney (2018-02-03 05:49:40)

-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if not ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+# TODO: PPC, Sparc
   if ['x86', 'x86_64'].contains(host_machine.cpu_family())
 _drivers = 'i915,i965,r100,r200,nouveau'
   else
 error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
   endif
 else
-error('Unknown OS. Please pass -Ddri-drivers to set driver options. 
Patches gladly accepted to fix this.')
+# only swrast would make sense here, but gallium swrast is a much better 
default
+_drivers = ''


I'm really not a fan of dumping the 'else error' case. This currently means that
for example haiku will try to build something that they cannot support. I'd
really rather just set appropriate defaults for OSes that are guaranteed
supported and still let OSes that haven't been tested fall through to error. I
also think that's a nice place for people trying to use mesa meson on a new
platform, since they understand we haven't tested on their OS.


Good idea.  But that's not what the code currently does.  If it's not on
the list of 'unknown' OSes (darwin, windows), any other OS e.g. haiku
gets treated like linux...

Attached is a revised patch which is more explicit about what's a known
OS.  I guess the BSDs probably should be added somewhere, but idk what's
appropriate for them.


I rather like this patch, so you can add:
Reviewed-by: Dylan Baker 


Thanks.


The only thing I might do differently is instead of checking for Linux use the
`system_has_kms_drm` variable (which covers the BSDs as well as Linux, but I'm
okay with landing this as-is and changing that later if that is the right thing
to do.


Yeah, that seems pretty plausible.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] meson: ensure xmlpool/options.h is generated for libgallium

2018-02-05 Thread Jon Turney
In file included from ../src/gallium/targets/dri/target.c:1:
In file included from ../src/gallium/auxiliary/target-helpers/drm_helper.h:8:
../src/util/xmlpool.h:103:10: fatal error: 'xmlpool/options.h' file not found

See also 26bde1e3.

Signed-off-by: Jon Turney 
---
 src/gallium/targets/dri/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/targets/dri/meson.build 
b/src/gallium/targets/dri/meson.build
index 30368c2152..75ce94ab2c 100644
--- a/src/gallium/targets/dri/meson.build
+++ b/src/gallium/targets/dri/meson.build
@@ -51,7 +51,7 @@ endif
 
 libgallium_dri = shared_library(
   'gallium_dri',
-  files('target.c'),
+  [files('target.c'), xmlpool_options_h],
   include_directories : [
 inc_common, inc_util, inc_dri_common, inc_gallium_drivers,
 inc_gallium_winsys, include_directories('../../state_trackers/dri'),
-- 
2.16.1

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


[Mesa-dev] [PATCH 0/2] appveyor: add Cygwin

2018-02-09 Thread Jon Turney
Jon Turney (2):
  appveyor: put build steps in a script, rather than inline in
appveyor.yml
  appveyor: Add a Cygwin build script

 appveyor.yml| 40 +---
 scripts/appveyor_cygwin.bat | 39 +++
 scripts/appveyor_msvc.bat   | 35 +++
 3 files changed, 87 insertions(+), 27 deletions(-)
 create mode 100644 scripts/appveyor_cygwin.bat
 create mode 100644 scripts/appveyor_msvc.bat

-- 
2.16.1

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


[Mesa-dev] [PATCH 2/2] appveyor: Add a Cygwin build script

2018-02-09 Thread Jon Turney
v2:
Use ccache
build using meson, rather than autotools
---
 appveyor.yml| 19 ++-
 scripts/appveyor_cygwin.bat | 39 +++
 2 files changed, 53 insertions(+), 5 deletions(-)
 create mode 100644 scripts/appveyor_cygwin.bat

diff --git a/appveyor.yml b/appveyor.yml
index cf3242b8e1..9c18353413 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -36,21 +36,30 @@ clone_depth: 100
 cache:
 - win_flex_bison-2.5.9.zip
 - llvm-3.3.1-msvc2013-mtd.7z
+- C:\pkgcache
+- 'C:\cygwin64\home\%USERNAME%\.ccache'
+- 'C:\cygwin\home\%USERNAME%\.ccache'
 
 os: Visual Studio 2013
 
 environment:
-  WINFLEXBISON_ARCHIVE: win_flex_bison-2.5.9.zip
-  LLVM_ARCHIVE: llvm-3.3.1-msvc2013-mtd.7z
+  matrix:
+  - compiler: msvc
+WINFLEXBISON_ARCHIVE: win_flex_bison-2.5.9.zip
+LLVM_ARCHIVE: llvm-3.3.1-msvc2013-mtd.7z
+  - compiler: cygwin
+arch: x64
 
 install:
-- call scripts\appveyor_msvc.bat install
+- call scripts\appveyor_%compiler%.bat install
 
 build_script:
-- call scripts\appveyor_msvc.bat build_script
+- call scripts\appveyor_%compiler%.bat build_script
 
 after_build:
-- call scripts\appveyor_msvc.bat after_build
+- call scripts\appveyor_%compiler%.bat after_build
+
+test: off
 
 # It's possible to setup notification here, as described in
 # http://www.appveyor.com/docs/notifications#appveyor-yml-configuration , but
diff --git a/scripts/appveyor_cygwin.bat b/scripts/appveyor_cygwin.bat
new file mode 100644
index 00..0da5c9b34a
--- /dev/null
+++ b/scripts/appveyor_cygwin.bat
@@ -0,0 +1,39 @@
+set PKGCACHE=C:\pkgcache
+set CYGWIN_MIRROR=http://cygwin.mirror.constant.com
+
+if _%arch%_ == _x64_ set SETUP=setup-x86_64.exe && set CYGWIN_ROOT=C:\cygwin64
+if _%arch%_ == _x86_ set SETUP=setup-x86.exe && set CYGWIN_ROOT=C:\cygwin
+
+set PATH=%CYGWIN_ROOT%\bin;%SYSTEMROOT%\system32
+
+goto %1
+
+:install
+echo Updating Cygwin and installing build prerequsites
+%CYGWIN_ROOT%\%SETUP% -qnNdO -R "%CYGWIN_ROOT%" -s "%CYGWIN_MIRROR%" -l 
"%PKGCACHE%" -g -P ^
+bison,^
+ccache,^
+flex,^
+glproto,^
+libX11-devel,^
+libX11-xcb-devel,^
+libXdamage-devel,^
+libXext-devel,^
+libXfixes-devel,^
+libexpat-devel,^
+libllvm-devel,^
+libxcb-dri2-devel,^
+libxcb-glx-devel,^
+libxcb-xfixes-devel,^
+meson,^
+ninja,^
+python2-mako,^
+zlib-devel
+goto :eof
+
+:build_script
+bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson build -Degl=false 
--wrap-mode=nofallback && ninja -C build"
+goto :eof
+
+:after_build
+goto :eof
-- 
2.16.1

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


[Mesa-dev] [PATCH 1/2] appveyor: put build steps in a script, rather than inline in appveyor.yml

2018-02-09 Thread Jon Turney
---
 appveyor.yml  | 29 +++--
 scripts/appveyor_msvc.bat | 35 +++
 2 files changed, 38 insertions(+), 26 deletions(-)
 create mode 100644 scripts/appveyor_msvc.bat

diff --git a/appveyor.yml b/appveyor.yml
index 96eb1a67b3..cf3242b8e1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -44,36 +44,13 @@ environment:
   LLVM_ARCHIVE: llvm-3.3.1-msvc2013-mtd.7z
 
 install:
-# Check pip
-- python --version
-- python -m pip --version
-# Install Mako
-- python -m pip install Mako==1.0.6
-# Install pywin32 extensions, needed by SCons
-- python -m pip install pypiwin32
-# Install python wheels, necessary to install SCons via pip
-- python -m pip install wheel
-# Install SCons
-- python -m pip install scons==2.5.1
-- scons --version
-# Install flex/bison
-- if not exist "%WINFLEXBISON_ARCHIVE%" appveyor DownloadFile 
"https://downloads.sourceforge.net/project/winflexbison/old_versions/%WINFLEXBISON_ARCHIVE%";
-- 7z x -y -owinflexbison\ "%WINFLEXBISON_ARCHIVE%" > nul
-- set Path=%CD%\winflexbison;%Path%
-- win_flex --version
-- win_bison --version
-# Download and extract LLVM
-- if not exist "%LLVM_ARCHIVE%" appveyor DownloadFile 
"https://people.freedesktop.org/~jrfonseca/llvm/%LLVM_ARCHIVE%";
-- 7z x -y "%LLVM_ARCHIVE%" > nul
-- mkdir llvm\bin
-- set LLVM=%CD%\llvm
+- call scripts\appveyor_msvc.bat install
 
 build_script:
-- scons -j%NUMBER_OF_PROCESSORS% MSVC_VERSION=12.0 llvm=1
+- call scripts\appveyor_msvc.bat build_script
 
 after_build:
-- scons -j%NUMBER_OF_PROCESSORS% MSVC_VERSION=12.0 llvm=1 check
-
+- call scripts\appveyor_msvc.bat after_build
 
 # It's possible to setup notification here, as described in
 # http://www.appveyor.com/docs/notifications#appveyor-yml-configuration , but
diff --git a/scripts/appveyor_msvc.bat b/scripts/appveyor_msvc.bat
new file mode 100644
index 00..a0a2d518ba
--- /dev/null
+++ b/scripts/appveyor_msvc.bat
@@ -0,0 +1,35 @@
+goto %1
+
+:install
+rem Check pip
+python --version
+python -m pip --version
+rem Install Mako
+python -m pip install Mako==1.0.6
+rem Install pywin32 extensions, needed by SCons
+python -m pip install pypiwin32
+rem Install python wheels, necessary to install SCons via pip
+python -m pip install wheel
+rem Install SCons
+python -m pip install scons==2.5.1
+call scons --version
+rem Install flex/bison
+if not exist "%WINFLEXBISON_ARCHIVE%" appveyor DownloadFile 
"https://downloads.sourceforge.net/project/winflexbison/old_versions/%WINFLEXBISON_ARCHIVE%";
+7z x -y -owinflexbison\ "%WINFLEXBISON_ARCHIVE%" > nul
+set Path=%CD%\winflexbison;%Path%
+win_flex --version
+win_bison --version
+rem Download and extract LLVM
+if not exist "%LLVM_ARCHIVE%" appveyor DownloadFile 
"https://people.freedesktop.org/~jrfonseca/llvm/%LLVM_ARCHIVE%";
+7z x -y "%LLVM_ARCHIVE%" > nul
+mkdir llvm\bin
+set LLVM=%CD%\llvm
+goto :eof
+
+:build_script
+call scons -j%NUMBER_OF_PROCESSORS% MSVC_VERSION=12.0 llvm=1
+goto :eof
+
+:after_build
+call scons -j%NUMBER_OF_PROCESSORS% MSVC_VERSION=12.0 llvm=1 check
+goto :eof
-- 
2.16.1

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


Re: [Mesa-dev] [PATCH 13/16] st/dri: implement v2 of DRI_ConfigOptions

2017-08-18 Thread Jon Turney

On 30/06/2017 13:45, Nicolai Hähnle wrote:

From: Nicolai Hähnle 

---
  src/gallium/auxiliary/pipe-loader/pipe_loader.c| 13 
  src/gallium/auxiliary/pipe-loader/pipe_loader.h| 16 +++
  .../auxiliary/pipe-loader/pipe_loader_drm.c| 23 ++
  src/gallium/state_trackers/dri/dri_screen.c|  5 +++--
  4 files changed, 55 insertions(+), 2 deletions(-) 


This change uses pipe_loader_get_driinfo_xml() unconditionally in 
pipe_loader.c, but it's definition in pipe_loader_get_driinfo_xml() is 
only built if HAVE_LIBDRM is defined.


I guess something like the attached is needed?

From b9286109b7037af043ba5d6ebb37f620f530e578 Mon Sep 17 00:00:00 2001
From: Jon Turney 
Date: Thu, 17 Aug 2017 22:10:52 +0100
Subject: [PATCH] Fix build when HAVE_LIBDRM isn't defined

make[4]: Entering directory '/wip/mesa/build/src/gallium/targets/dri'
  CXXLDgallium_dri.la
../../../../src/gallium/auxiliary/pipe-loader/.libs/libpipe_loader_static.a(libpipe_loader_static_la-pipe_loader.o):
 In function `pipe_loader_get_driinfo_xml':
/mesa/build/src/gallium/auxiliary/pipe-loader/../../../../../src/gallium/auxiliary/pipe-loader/pipe_loader.c:117:
 undefined reference to `pipe_loader_drm_get_driinfo_xml'

b4ff5e90 uses pipe_loader_get_driinfo_xml() unconditionally in
pipe_loader.c, but it's definition in pipe_loader_get_driinfo_xml() is only
built if HAVE_LIBDRM.

Arrange to always use the default XML if HAVE_LIBDRM isn't defined.

Signed-off-by: Jon Turney 
---
 src/gallium/auxiliary/pipe-loader/pipe_loader.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c 
b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
index 926db49fd24..e7cf9f86d99 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -114,7 +114,11 @@ pipe_loader_load_options(struct pipe_loader_device *dev)
 char *
 pipe_loader_get_driinfo_xml(const char *driver_name)
 {
+#ifdef HAVE_LIBDRM
char *xml = pipe_loader_drm_get_driinfo_xml(driver_name);
+#else
+   char *xml = NULL;
+#endif
 
if (!xml)
   xml = strdup(gallium_driinfo_xml);
-- 
2.14.1

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


[Mesa-dev] [PATCH 0/3] translate, rtasm fixes for 64-bit Cygwin

2013-10-10 Thread Jon TURNEY
Since 64-bit Cygwin is now a thing, fix translate_sse for it.

(It's unclear that it's ever worked on the Windows 64-bit target. Commit 
c2da8e77023325f46dde2009def2947b1a687c7b
"translate_sse: major rewrite (v5)" adds untested support for 64-bit Windows, 
and then commit
f4dd0991719ef3e2606920c5100b372181c60899 disabled tranlate_sse.c on MinGW 
x86_64 because of crashes.)

Jon TURNEY (3):
  rtasm: The heap is NX on 64-bit Cygwin, so use the rtasm_exec_malloc()
implementation which uses mmap()
  rtasm: Cygwin uses the msabi calling convention on x86_64
  traslate_sse: Fix generated code argument handling for msabi on x86_64

 src/gallium/auxiliary/rtasm/rtasm_execmem.c |  2 +-
 src/gallium/auxiliary/rtasm/rtasm_x86sse.h  |  2 +-
 src/gallium/auxiliary/translate/translate_sse.c | 14 +++---
 3 files changed, 13 insertions(+), 5 deletions(-)

-- 
1.8.3.4

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


[Mesa-dev] [PATCH 1/3] rtasm: The heap is NX on 64-bit Cygwin, so use the rtasm_exec_malloc() implementation which uses mmap()

2013-10-10 Thread Jon TURNEY
The heap is NX on 64-bit Cygwin, so use the rtasm_exec_malloc() implementation
which uses mmap() to allocate an anonymous page with execute permission, rather
than the one which just uses malloc().

Signed-off-by: Jon TURNEY 
---
 src/gallium/auxiliary/rtasm/rtasm_execmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c 
b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
index 8f7cc20..3c4b048 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c
+++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c
@@ -49,7 +49,7 @@
 #include 
 #endif
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) 
|| defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) 
|| defined(PIPE_OS_HAIKU) || defined(PIPE_OS_CYGWIN)
 
 
 /*
-- 
1.8.3.4

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


[Mesa-dev] [PATCH 2/3] rtasm: Cygwin uses the msabi calling convention on x86_64

2013-10-10 Thread Jon TURNEY
Cygwin also uses the msabi calling convention on x86_64, not the sysvabi calling
convention

Signed-off-by: Jon TURNEY 
---
 src/gallium/auxiliary/rtasm/rtasm_x86sse.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h 
b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
index 67c9bdd..498ca82 100644
--- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
+++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h
@@ -140,7 +140,7 @@ static INLINE enum x86_target x86_target( struct 
x86_function* p )
 {
 #ifdef PIPE_ARCH_X86
return X86_32;
-#elif defined(_WIN64)
+#elif (defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_WINDOWS)) && 
defined(PIPE_ARCH_X86_64)
return X86_64_WIN64_ABI;
 #elif defined(PIPE_ARCH_X86_64)
return X86_64_STD_ABI;
-- 
1.8.3.4

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


[Mesa-dev] [PATCH 3/3] traslate_sse: Fix generated code argument handling for msabi on x86_64

2013-10-10 Thread Jon TURNEY
translate_sse.c contains code for msabi on x86_64, but it appears to be
untested.

Currently arguments 1 and 2 passed to the generated code are moved as 32-bit
quantities into the registers used by sysvabi, irrespective of the architecture.
Since these may be pointers, they must be moved as 64-bit quantities to avoid
truncation.

Commit f4dd0991719ef3e2606920c5100b372181c60899 disabled tranlate_sse.c on MinGW
x86_64, I don't know if was due to this issue, or a different one...

Signed-off-by: Jon TURNEY 
---
 src/gallium/auxiliary/translate/translate_sse.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/translate/translate_sse.c 
b/src/gallium/auxiliary/translate/translate_sse.c
index 726a9b1..3e12f1e 100644
--- a/src/gallium/auxiliary/translate/translate_sse.c
+++ b/src/gallium/auxiliary/translate/translate_sse.c
@@ -1308,14 +1308,22 @@ static boolean build_vertex_emit( struct translate_sse 
*p,
x86_push(p->func, p->outbuf_EBX);
x86_push(p->func, p->count_EBP);
 
-/* on non-Win64 x86-64, these are already in the right registers */
+   /* on non-Win64 x86-64, these are already in the right registers */
if(x86_target(p->func) != X86_64_STD_ABI)
{
   x86_push(p->func, p->machine_EDI);
   x86_push(p->func, p->idx_ESI);
 
-  x86_mov(p->func, p->machine_EDI, x86_fn_arg(p->func, 1));
-  x86_mov(p->func, p->idx_ESI, x86_fn_arg(p->func, 2));
+  if(x86_target(p->func) != X86_32)
+  {
+x64_mov64(p->func, p->machine_EDI, x86_fn_arg(p->func, 1));
+x64_mov64(p->func, p->idx_ESI, x86_fn_arg(p->func, 2));
+  }
+  else
+  {
+x86_mov(p->func, p->machine_EDI, x86_fn_arg(p->func, 1));
+x86_mov(p->func, p->idx_ESI, x86_fn_arg(p->func, 2));
+  }
}
 
x86_mov(p->func, p->count_EBP, x86_fn_arg(p->func, 3));
-- 
1.8.3.4

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


[Mesa-dev] [PATCH] Fix compilation on cygwin after commit 762c9766c93697af8d7fbaa729aed118789dbe8e

2011-12-19 Thread Jon TURNEY
Fix compilation on cygwin after commit 762c9766c93697af8d7fbaa729aed118789dbe8e
"Use VERT_ATTRIB_* indexed array in gl_array_object" added the first non-driver
use of ffsll(), which exposes the fact that this isn't provided on cygwin.

Found by tinderbox, see [1]

[1] http://tinderbox.freedesktop.org/builds/2011-11-30-0017/logs/libGL/#build

Signed-off-by: Jon TURNEY 
---
 src/mesa/main/imports.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index 797f357..d5e3859 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -568,7 +568,7 @@ _mesa_init_sqrt_table(void);
 
 #ifdef __GNUC__
 
-#if defined(__MINGW32__) || defined(ANDROID)
+#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(ANDROID)
 #define ffs __builtin_ffs
 #define ffsll __builtin_ffsll
 #endif
-- 
1.7.5.1

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


Re: [Mesa-dev] [PATCH] Always build shared glapi

2012-01-22 Thread Jon TURNEY
On 11/01/2012 23:37, Matt Turner wrote:
> No one on IRC knows why an unshared glapi is useful.

It looks like this change stops OSMesa from builing on cygwin (See [1])

I think this is because we never tried building it with shared glapi on cygwin
before, and if we had, we would have noticed that libOSMesa is underlinked,
which is not permitted for PE/COFF shared libraries.

Patch attached which fixes this by explicitly linking libOSMesa with the
shared glapi library.

[1] http://tinderbox.freedesktop.org/builds/2012-01-21-0017/logs/libGL/#build
>From 30752cea7b296aaef3824320026554fbfa4a95ff Mon Sep 17 00:00:00 2001
From: Jon TURNEY 
Date: Sun, 22 Jan 2012 13:23:26 +
Subject: [PATCH] Fix underlinking in libOSMesa since commit adefee5 "Always
 build shared glapi"

Since we now always build shared glapi, this exposes the fact that libOSMesa was
underlinked when glapi was built shared.

Fix this by doing the same thing as drivers/X11/Makefile already does, ensuring
that the library is linked with the shared glapi library.

(I'm not clear why we link with both glapi.a and glapi.so, so this may be all 
wrong)

Signed-off-by: Jon TURNEY 
---
 src/mesa/drivers/osmesa/Makefile |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/osmesa/Makefile b/src/mesa/drivers/osmesa/Makefile
index 39ab09a..005f4d5 100644
--- a/src/mesa/drivers/osmesa/Makefile
+++ b/src/mesa/drivers/osmesa/Makefile
@@ -25,6 +25,8 @@ CORE_MESA = \
$(TOP)/src/mapi/glapi/libglapi.a \
$(TOP)/src/glsl/libglsl.a
 
+OSMESA_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(OSMESA_LIB_DEPS)
+
 .c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
 
-- 
1.7.5.1

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


[Mesa-dev] [PATCH] Don't build shared dricore when unneeded

2012-01-23 Thread Jon TURNEY
Refine "always build shared dricore" so we don't build it if we don't need
it because we aren't actually building any dri drivers because of 
--disable-driglx-direct

Signed-off-by: Jon TURNEY 
---
 configure.ac |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9599568..c76af5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1060,7 +1060,7 @@ DRI_CXXFLAGS='$(CXXFLAGS)'
 DRI_LIB_DEPS='$(TOP)/src/mesa/libmesa.a'
 MESA_MODULES='$(TOP)/src/mesa/libmesa.a'
 
-if test "x$enable_dri" = xyes ; then
+if test "x$enable_dri" = xyes && test "x$driglx_direct" = xyes ; then
 DRICORE_GLSL_LIBS='$(TOP)/$(LIB_DIR)/libglsl.so'
 DRICORE_LIBS='$(TOP)/$(LIB_DIR)/libdricore.so'
 DRICORE_LIB_DEPS='-L$(TOP)/$(LIB_DIR) -Wl,-R$(DRI_DRIVER_INSTALL_DIR) 
-lglsl'
-- 
1.7.5.1

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



Re: [Mesa-dev] [PATCH] Don't build shared dricore when unneeded

2012-01-23 Thread Jon TURNEY
On 23/01/2012 17:50, Matt Turner wrote:
> Good idea.
> 
> Reviewed-by: Matt Turner 
> 
> Do you have commit access?

Yes.
   d01e166..0fce6d3  master -> master
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] OSMesa glapi linlking

2012-01-25 Thread Jon TURNEY
On 25/01/2012 21:54, Matt Turner wrote:
> On Wed, Jan 25, 2012 at 4:45 PM, Kevin H. Hobbs  wrote:
>> On 01/25/2012 02:03 PM, Matt Turner wrote:
>>> On Wed, Jan 25, 2012 at 1:42 PM, Kevin H. Hobbs  wrote:
>>>
>>> Maybe try reverting 4e5a8937d1a1bfb2a3bd067ed01e036728675fc2?
>>
>>
>> So this change is just the line
>>
>> OSMESA_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB)
>> $(OSMESA_LIB_DEPS)
>>
>> So I commented that out.
>>
>> I now get an OSMesa library.
>>
>> I do not get a shared libglapi.so in lib nor is one installed in
>> the install step.
> 
> Right, unless you're compiling with --enable-shared-glapi, you won't
> get libglapi.so. I had to revert that change since it shared-glapi
> doesn't work with Xlib-glx apparently.

... and reverting "always build shared glapi" didn't wrap this line above in
ifeq ($(SHARED_GLAPI),1)/endif, since it wasn't there before.


Sigh.

I guess you could try the attached.
>From 81f07fcf0cee40b5f9fdc3bac9023f781cfb1ea9 Mon Sep 17 00:00:00 2001
From: Jon TURNEY 
Date: Wed, 25 Jan 2012 22:14:42 +
Subject: [PATCH] Don't try to link OSMesa with shared glapi unless shared
 glapi is built

This fixes the fact that 4e5a8937d1a1bfb2a3bd067ed01e036728675fc2 is left
even after the reversion in 027ce0c493a85c863df88b43f61aea34bcd4cd58 made
shared glapi optional again

Signed-off-by: Jon TURNEY 
---
 src/mesa/drivers/osmesa/Makefile |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/osmesa/Makefile b/src/mesa/drivers/osmesa/Makefile
index 005f4d5..6fae251 100644
--- a/src/mesa/drivers/osmesa/Makefile
+++ b/src/mesa/drivers/osmesa/Makefile
@@ -25,7 +25,9 @@ CORE_MESA = \
$(TOP)/src/mapi/glapi/libglapi.a \
$(TOP)/src/glsl/libglsl.a
 
+ifeq ($(SHARED_GLAPI),1)
 OSMESA_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(OSMESA_LIB_DEPS)
+endif
 
 .c.o:
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-- 
1.7.5.1

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


Re: [Mesa-dev] [PATCH] automake: src/mesa/drivers/osmesa

2012-01-27 Thread Jon TURNEY
On 27/01/2012 05:06, Matt Turner wrote:
> Please give this a try.
> 
> OSMesa is broken with shared-glapi. I'll fix that (it'll be much
> easier) when I automake glapi.

> +libOSMesa_la_SOURCES = osmesa.c
> +libOSMesa_la_LDFLAGS = -version-info 8:0:0 #FIXME
> +libOSMesa_la_LIBADD = $(LIBADD)
> +endif

You should use the libtool flag '-no-undefined' as well here, so libtool will
attempt to build a shared library even on architectures which require that all
symbols are resolved when the library is linked.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa (master): dri: make sure to build libdricommon.la

2012-01-27 Thread Jon TURNEY
On 27/01/2012 08:03, Eric Anholt wrote:
> On Thu, 26 Jan 2012 16:32:24 -0800 (PST), matts...@kemper.freedesktop.org 
> (Matt Turner) wrote:
>> Module: Mesa
>> Branch: master
>> Commit: 80aa78142d12b21dd7d4f0edc786af98a159a80f
>> URL:
>> http://cgit.freedesktop.org/mesa/mesa/commit/?id=80aa78142d12b21dd7d4f0edc786af98a159a80f
>>
>> Author: Matt Turner 
>> Date:   Thu Jan 26 19:31:12 2012 -0500
>>
>> dri: make sure to build libdricommon.la
> 
> Ouch.  Sorry about this, folks, I built with a dirty tree and didn't
> notice that the rebase off of the drirc changes wasn't good enough.

This commit breaks the ability to build when ./configured -with-driver=dri
--disable-driglx-direct --with-dri-drivers=swrast for platforms which don't
have DRM (See [1]), as it tries to build libdricommon.la even if we aren't
building a dri driver which requires it.

Attached is a patch which fixes this, although I'm not sure if that's the best
way of solving this problem (it might make more sense to conditionalize on
DRI_DIRS containing something other than swrast if all dri drivers are going
to use libdricommon)

[1]
http://tinderbox.freedesktop.org/builds/2012-01-27-0017/logs/libGL-indirect-only/#build
>From c527ad8a315ffb34bfcb34053d41f39aa8011b7c Mon Sep 17 00:00:00 2001
From: Jon TURNEY 
Date: Fri, 27 Jan 2012 19:06:28 +
Subject: [PATCH] dri: Don't build libdricommon.la if we don't need it

Refine 80aa78142d12b21dd7d4f0edc786af98a159a80f "dri: make sure to build 
libdricommon.la"
so we don't build libdricommon if we aren't building a dri driver which needs 
it (i.e.
if we are just building swrast)

Signed-off-by: Jon TURNEY 
---
 configure.ac |1 +
 src/mesa/drivers/dri/Makefile.am |6 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 06d400f..e173bcf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1289,6 +1289,7 @@ AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI 
= xyes)
 AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
 AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
 AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
+AM_CONDITIONAL(HAVE_COMMON_DRI, test x$HAVE_I915_DRI = xyes || test 
x$HAVE_I965_DRI = xyes || test x$HAVE_NOUVEAU_DRI = xyes || test 
x$HAVE_R200_DRI = xyes || test x$HAVE_RADEON_DRI = xyes)
 
 dnl
 dnl OSMesa configuration
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index 8b93582..48d3685 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -1,4 +1,8 @@
-SUBDIRS = common
+SUBDIRS =
+
+if HAVE_COMMON_DRI
+SUBDIRS+=common
+endif
 
 if HAVE_I915_DRI
 SUBDIRS+=i915
-- 
1.7.5.1

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


Re: [Mesa-dev] [PATCH] autoconf: Enable missing-prototypes errors when available.

2012-01-31 Thread Jon TURNEY
On 27/01/2012 19:58, Eric Anholt wrote:
> After the removal of the dri driver link test, this should help avoid
> the original problem that it was designed to catch: The warning about
> a missing prototype due to typoing a function name scrolling by in the
> Mesa build spew, and you not noticing until you try to run an
> application and it falls back to swrast.
> ---
>  configure.ac |   15 ++-
>  1 files changed, 14 insertions(+), 1 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 06d400f..0cd8421 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -176,7 +176,20 @@ esac
>  
>  dnl Add flags for gcc and g++
>  if test "x$GCC" = xyes; then
> -CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99"
> +CFLAGS="$CFLAGS -Wall -std=c99"
> +
> +# Enable -Werror=implicit-function-declaration and
> +# -Werror=missing-prototypes, if available, or otherwise, just
> +# -Wmissing-prototypes.  This is particularly useful to avoid
> +# generating a loadable driver module that has undefined symbols.
> +save_CFLAGS="$CFLAGS"
> +AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
> +CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
> +CFLAGS="$CFLAGS -Werror=missing-prototypes"
> +AC_LINK_IFELSE([AC_LANG_PROGRAM()],
> +AC_MSG_RESULT([yes]),
> +[CFLAGS="$save_CFLAGS -Wmissing-prototypes";
> + AC_MSG_RESULT([no])]);
>  
>  # Enable -fvisibility=hidden if using a gcc that supports it
>  save_CFLAGS="$CFLAGS"

Looks like this change breaks compilation of the C dispatch code, see [1], [2].

In file included from glapi_dispatch.c:91:
../../../src/mapi/glapi/glapitemp.h:4641: error: no previous prototype for
'glDrawBuffersNV'


[1] http://tinderbox.freedesktop.org/builds/2012-01-31-0012/logs/libGL/#build
[2]
http://tinderbox.freedesktop.org/builds/2012-01-31-0012/logs/libGL-indirect-only/#build
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] glapi dispatch table isn't built correctly with --shared-glapi

2012-02-01 Thread Jon TURNEY

This is with git master, but the same issue exists since at least mesa-7.11.2.

./configure --enable-shared-glapi --disable-driglx-direct --with-driver=dri
--with-dri-drivers=swrast --with-gallium-drivers=swrast

$ gdb --args ./glean -r foo -o -t vertProg1 --quick
...
(gdb) b __indirect_glProgramParameters4fvNV
Function "__indirect_glProgramParameters4fvNV" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (__indirect_glProgramParameters4fvNV) pending.
(gdb) r
Starting program: /opt/jhbuild/git/glean/bin/glean -r foo -o -t vertProg1 
--quick
Breakpoint 1, __indirect_glProgramParameters4fvNV (target=1, index=135353784,
num=20, params=0xb11c) at indirect.c:9306
9306struct glx_context *const gc = __glXGetCurrentContext();
(gdb) bt
#0  __indirect_glProgramParameters4fvNV (target=1, index=135353784, num=20,
params=0xb11c) at indirect.c:9306
#1  0x080b719b in GLEAN::VertexProgramTest::setup (this=0x8115520) at
tvertprog1.cpp:831
#2  0x080b82e3 in GLEAN::VertexProgramTest::runOne (this=0x8115520, r=...,
w=...) at tvertprog1.cpp:1112
#3  0x08059885 in GLEAN::BaseTest::run
(this=0x8115520, environment=...) at tbase.h:317
#4  0x08053ec0 in main (argc=7, argv=0xb3d4) at main.cpp:140
(gdb) frame 1
#1  0x080b719b in GLEAN::VertexProgramTest::setup (this=0x8115520) at
tvertprog1.cpp:831
831 glGenProgramsARB_func(1, &progID);

Note that glean is calling glGenPrograms, but we are ending up in
glProgramParameters4fvNV.

It seems the indirect dispatch table isn't being built correctly.  The
dispatch table layouts in glapi_map_tmpi.h and glapitable.h are inconsistent
when buiding shared glapi, as shared-glapi/glapi_mapi_tmp.h is generated from
gl_and_es_API.xml, whereas glapitable.h is generated from gl_API.xml

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


Re: [Mesa-dev] glapi dispatch table isn't built correctly with --shared-glapi

2012-02-01 Thread Jon TURNEY
On 01/02/2012 15:59, Matt Turner wrote:
> On Wed, Feb 1, 2012 at 9:41 AM, Jon TURNEY wrote:
>> Note that glean is calling glGenPrograms, but we are ending up in
>> glProgramParameters4fvNV.
>>
>> It seems the indirect dispatch table isn't being built correctly.  The
>> dispatch table layouts in glapi_map_tmpi.h and glapitable.h are inconsistent
>> when buiding shared glapi, as shared-glapi/glapi_mapi_tmp.h is generated from
>> gl_and_es_API.xml, whereas glapitable.h is generated from gl_API.xml
> 
> Do you think this is related to
> http://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg17627.html
> ?

The part of that thread that says...

On 24/01/2012 01:59, Brian Paul wrote:
> However, any program that uses extension functions acts peculiar and dies:

... I would guess so, yes.

Turning --shared-glapi always on just made it more obvious it was broken :S
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa (master): dri: make sure to build libdricommon.la

2012-02-02 Thread Jon TURNEY
On 27/01/2012 20:20, Matt Turner wrote:
> On Fri, Jan 27, 2012 at 8:11 PM, Jon TURNEY wrote:
>> On 27/01/2012 08:03, Eric Anholt wrote:
>>> On Thu, 26 Jan 2012 16:32:24 -0800 (PST), matts...@kemper.freedesktop.org 
>>> (Matt Turner) wrote:
>>>> Module: Mesa
>>>> Branch: master
>>>> Commit: 80aa78142d12b21dd7d4f0edc786af98a159a80f
>>>> URL:
>>>> http://cgit.freedesktop.org/mesa/mesa/commit/?id=80aa78142d12b21dd7d4f0edc786af98a159a80f
>>>>
>>>> Author: Matt Turner 
>>>> Date:   Thu Jan 26 19:31:12 2012 -0500
>>>>
>>>> dri: make sure to build libdricommon.la
>>>
>>> Ouch.  Sorry about this, folks, I built with a dirty tree and didn't
>>> notice that the rebase off of the drirc changes wasn't good enough.
>>
>> This commit breaks the ability to build when ./configured -with-driver=dri
>> --disable-driglx-direct --with-dri-drivers=swrast for platforms which don't
>> have DRM (See [1]), as it tries to build libdricommon.la even if we aren't
>> building a dri driver which requires it.
>>
>> Attached is a patch which fixes this, although I'm not sure if that's the 
>> best
>> way of solving this problem (it might make more sense to conditionalize on
>> DRI_DIRS containing something other than swrast if all dri drivers are going
>> to use libdricommon)

Attached is a patch which fixes this the other way, which I think is probably
better.

> and it looks like swrast is still broken anyway. It should have
> ../common/utils.c ../common/drisw_util.c in its sources.

I can't see a problem?  These are included in SWRAST_C_FILES via
SWRAST_COMMON_FILES
>From 97438ef51aaed032ced49f9ab2568a57969176df Mon Sep 17 00:00:00 2001
From: Jon TURNEY 
Date: Thu, 2 Feb 2012 10:39:04 +
Subject: [PATCH] dri: Don't build libdricommon.la if we don't need it

Refine 80aa78142d12b21dd7d4f0edc786af98a159a80f "dri: make sure to build 
libdricommon.la"
so we don't build libdricommon if we aren't building a dri driver which needs 
it (i.e.
if we are just building swrast)

In particular, this restores the ability to build the swrast dri driver without 
having to
have a xf86drm.h

Signed-off-by: Jon TURNEY 
---
 configure.ac |6 +-
 src/mesa/drivers/dri/Makefile.am |6 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index f7c0814..7af8319 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1240,11 +1240,14 @@ if test "x$enable_dri" = xyes; then
LIBS="$save_LIBS"
 fi
 
-# libdrm is required for all except swrast
+# if we are building any dri driver other than swrast ...
 if test -n "$DRI_DIRS" -a x"$DRI_DIRS" != xswrast; then
+# ... libdrm is required
 if test "x$have_libdrm" != xyes; then
 AC_MSG_ERROR([DRI drivers requires libdrm >= $LIBDRM_REQUIRED])
 fi
+# ... and build dricommon
+HAVE_COMMON_DRI=yes
 fi
 
 # put all the necessary libs together
@@ -1309,6 +1312,7 @@ AM_CONDITIONAL(HAVE_NOUVEAU_DRI, test x$HAVE_NOUVEAU_DRI 
= xyes)
 AM_CONDITIONAL(HAVE_R200_DRI, test x$HAVE_R200_DRI = xyes)
 AM_CONDITIONAL(HAVE_RADEON_DRI, test x$HAVE_RADEON_DRI = xyes)
 AM_CONDITIONAL(HAVE_SWRAST_DRI, test x$HAVE_SWRAST_DRI = xyes)
+AM_CONDITIONAL(HAVE_COMMON_DRI, test x$HAVE_COMMON_DRI = xyes)
 
 dnl
 dnl OSMesa configuration
diff --git a/src/mesa/drivers/dri/Makefile.am b/src/mesa/drivers/dri/Makefile.am
index 8b93582..48d3685 100644
--- a/src/mesa/drivers/dri/Makefile.am
+++ b/src/mesa/drivers/dri/Makefile.am
@@ -1,4 +1,8 @@
-SUBDIRS = common
+SUBDIRS =
+
+if HAVE_COMMON_DRI
+SUBDIRS+=common
+endif
 
 if HAVE_I915_DRI
 SUBDIRS+=i915
-- 
1.7.5.1

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


Re: [Mesa-dev] [PATCH] osmesa: remove GLAPI_LIB from OSMESA_LIB_DEPS

2012-02-02 Thread Jon TURNEY
On 02/02/2012 14:43, Brian Paul wrote:
> Fixes both the autoconf and legacy config builds.
> 
> The build was failing with "/usr/bin/ld: cannot find -lglapi" since
> there was no -L flag pointing to the lib.  But it's redundant anyway
> since libglapi.a is already in the CORE_MESA object list.
> ---
>  src/mesa/drivers/osmesa/Makefile |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mesa/drivers/osmesa/Makefile 
> b/src/mesa/drivers/osmesa/Makefile
> index 005f4d5..32ee6cf 100644
> --- a/src/mesa/drivers/osmesa/Makefile
> +++ b/src/mesa/drivers/osmesa/Makefile
> @@ -25,7 +25,7 @@ CORE_MESA = \
>   $(TOP)/src/mapi/glapi/libglapi.a \
>   $(TOP)/src/glsl/libglsl.a
>  
> -OSMESA_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(OSMESA_LIB_DEPS)
> +OSMESA_LIB_DEPS := -L$(TOP)/$(LIB_DIR) $(OSMESA_LIB_DEPS)
>  
>  .c.o:
>   $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@

After this change the line does nothing but add an unneeded -L flag

Please just revert 4e5a8937d1a1bfb2a3bd067ed01e036728675fc2
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa (master): dri: make sure to build libdricommon.la

2012-02-03 Thread Jon TURNEY
On 03/02/2012 09:28, Eric Anholt wrote:
> On Thu, 02 Feb 2012 10:54:22 +0000, Jon TURNEY wrote:
>> On 27/01/2012 20:20, Matt Turner wrote:
>>> On Fri, Jan 27, 2012 at 8:11 PM, Jon TURNEY wrote:
>>>> On 27/01/2012 08:03, Eric Anholt wrote:
>>>>> On Thu, 26 Jan 2012 16:32:24 -0800 (PST), (Matt Turner) wrote:
>>>>>> Module: Mesa
>>>>>> Branch: master
>>>>>> Commit: 80aa78142d12b21dd7d4f0edc786af98a159a80f
>>>>>> URL:
>>>>>> http://cgit.freedesktop.org/mesa/mesa/commit/?id=80aa78142d12b21dd7d4f0edc786af98a159a80f
>>>>>>
>>>>>> Author: Matt Turner 
>>>>>> Date:   Thu Jan 26 19:31:12 2012 -0500
>>>>>>
>>>>>> dri: make sure to build libdricommon.la
>>>>>
>>>>> Ouch.  Sorry about this, folks, I built with a dirty tree and didn't
>>>>> notice that the rebase off of the drirc changes wasn't good enough.
>>>>
>>>> This commit breaks the ability to build when ./configured -with-driver=dri
>>>> --disable-driglx-direct --with-dri-drivers=swrast for platforms which don't
>>>> have DRM (See [1]), as it tries to build libdricommon.la even if we aren't
>>>> building a dri driver which requires it.
>>>>
>>>> Attached is a patch which fixes this, although I'm not sure if that's the 
>>>> best
>>>> way of solving this problem (it might make more sense to conditionalize on
>>>> DRI_DIRS containing something other than swrast if all dri drivers are 
>>>> going
>>>> to use libdricommon)
>>
>> Attached is a patch which fixes this the other way, which I think is probably
>> better.
> 
> This looks good, except that the HAVE_ check should be put around the
> definitions in common/, not the SUBDIRs.
> 
> (this is a general automake rule, and something that we're failing at in
> Mesa).

Can you be a bit more explicit about what rule we are violating here?

Conditionally constructing SUBDIRS in this fashion is described in the
automake manual (see [1]), and seems to be a common style in automakefiles.

[1]
http://www.gnu.org/software/automake/manual/html_node/Subdirectories-with-AM_005fCONDITIONAL.html#Subdirectories-with-AM_005fCONDITIONAL
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Print error message when switching to indirect rendering

2012-02-04 Thread Jon TURNEY
On 04/02/2012 01:14, Carl Worth wrote:
> I recently had a problem with a dri driver failing to load, (it turned
> out to be a case of the driver being built for 64-bit, but running a
> 32-bit application).
> 
> At the time, mesa switched over to indirect rendering without me
> realizing it at all. This left me quite confused. Finally, a kind
> friend pointed me to LIBGL_DEBUG=verbose and I was able to diagnose
> the problem.
> 
> I think mesa could have been that friend first. Here's a patch series
> to introduce a new CriticalErrorMessageF macro which will print a
> message even if LIBGL_DEBUG is unset, (but, like ErrorMessageF, will
> still silence the message if LIBGL_DEBUG is set to quiet).
> 
> Then, the error messages regarding switching to indirect and
> software-direct rendering are moved from ErrorMessageF to
> CriticalErrorMessageF.
> 
> I think this makes mesa a bit kinder when things go wrong, without
> spewing excessive noise in common cases. Any diagreement? Are their
> other obvious candidates for CriticalErrorMessageF?

It looks like these error messages will always be emitted when software-direct
and indirect are the only paths available (e.g. when ./configured with
--with-dri-drivers=swrast or --disable-driglx-direct).
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Print error message when switching to indirect rendering

2012-02-08 Thread Jon TURNEY
On 06/02/2012 23:14, Carl Worth wrote:
> On 2012-02-04, Jon TURNEY wrote:
>> It looks like these error messages will always be emitted when 
>> software-direct
>> and indirect are the only paths available (e.g. when ./configured with
>> --with-dri-drivers=swrast or --disable-driglx-direct).
> 
> Thanks for sharing your concern, Jon. I certainly don't want to
> increase unwanted error-message spew.
> 
> Checking the code, the case of --disable-driglx-direct is already
> fine. All of these error messages are in C files that are already
> protected by:
> 
>   #if defined(GLX_DIRECT_RENDERING)
> 
> so this code won't even get compiled if direct rendering is disabled.
> 
> As to swrast being the only driver available, that one is a bit
> trickier to detect. If the X server tells Mesa that the hardware wants
> a driver named "i965_dri.so", then Mesa is going to try to load that
> driver, (and will not be able to distinguish between the cases of "I
> intentionally never compiled that driver" vs. "I had compiled that
> driver, but unintentionally deleted it").
> 
> But I imagine that anybody that *is* intentionally using
> --with-dri-drivers=swrast is already arranging it so that the X server
> never asks Mesa to load a driver like "i965" anyway, (for example, by
> using the "vesa" driver or whatever").
> 
> So, I don't think there will be any undesired spew.

Okay. Yes, I hadn't absorbed (and it's a bit clearer in the revised form) that
these errors are reporting "x failed to load" rather than "y is loading
(implying something went wrong with x)" :-)

Thanks for checking.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa (master): Don't bother making compatibilty symlinks

2013-03-12 Thread Jon TURNEY
On 12/03/2013 03:12, Stéphane Marchesin wrote:
> It looks like this commit (and the other ones in the series) aren't
> present in the mesa git tree. It also looks like the last commit was
> pushed twice, and is present with the hash from the second time.

Last week, I pushed a bunch of wrong commits by accident, then reset master
back to the correct commit.

Something like that commit is probably appropriate now, but the comment should
make clear that's a cygwin-specific patch which should never have escaped.

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


[Mesa-dev] [PATCH] libgl-xlib: softpipe and llvmpipe aren't mutually exclusive at link time

2013-01-14 Thread Jon TURNEY
Since automake changes softpipe and llvmpipe are mutually exclusive at link
time.  This doesn't make much sense to me as we can choose between them at
run-time using GALLIUM_DRIVER.

Creating library file: .libs/libGL.dll.a
.libs/xlib.o: In function `sw_screen_create_named':
/jhbuild/checkout/mesa/mesa/src/gallium/targets/libgl-xlib/../../../../src/gallium/auxiliary/target-helpers/inline_sw_helper.h:35:
undefined reference to `_softpipe_create_screen'

Signed-off-by: Jon TURNEY 
---
 src/gallium/targets/libgl-xlib/Makefile.am |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/gallium/targets/libgl-xlib/Makefile.am 
b/src/gallium/targets/libgl-xlib/Makefile.am
index 620ce08..e88af68 100644
--- a/src/gallium/targets/libgl-xlib/Makefile.am
+++ b/src/gallium/targets/libgl-xlib/Makefile.am
@@ -47,6 +47,7 @@ libGL_la_LDFLAGS = -version-number 
$(GL_MAJOR):$(GL_MINOR):$(GL_TINY) -no-undefi
 libGL_la_LIBADD = \
$(top_builddir)/src/gallium/state_trackers/glx/libxlib.la \
$(top_builddir)/src/gallium/winsys/sw/xlib/libws_xlib.la \
+   $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
$(top_builddir)/src/gallium/drivers/galahad/libgalahad.la \
@@ -59,6 +60,4 @@ if HAVE_MESA_LLVM
 libGL_la_LIBADD += $(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la 
$(LLVM_LIBS)
 AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
 libGL_la_LDFLAGS += $(LLVM_LDFLAGS)
-else
-libGL_la_LIBADD += $(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la
 endif
-- 
1.7.9

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


[Mesa-dev] [PATCH] Fix mapi code generator for out-of-tree build

2013-01-15 Thread Jon TURNEY
Use os.path.join() rather than hand-rolling it, so path is correct if
sys.argv[0] returns an absolute path.

(According to the python documentation, it's platform dependent whether
sys.argv[0] is a full pathname or not.  It probably also depends on how
the process was started...)

Signed-off-by: Jon TURNEY 
---
 src/mapi/mapi/mapi_abi.py |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index 30ffe7b..c645c02 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -29,7 +29,7 @@
 import sys
 # make it possible to import glapi
 import os
-GLAPI = "./%s/../glapi/gen" % (os.path.dirname(sys.argv[0]))
+GLAPI = os.path.join(".", os.path.dirname(sys.argv[0]), "../glapi/gen")
 sys.path.append(GLAPI)
 
 import re
-- 
1.7.9

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


Re: [Mesa-dev] [PATCH] glx: Verify that drawable creation on the client side actually worked

2013-02-27 Thread Jon TURNEY
On 04/05/2011 22:50, Adam Jackson wrote:
> ... and clean up if it didn't.
> 
> Signed-off-by: Adam Jackson 
> ---
>  src/glx/glx_pbuffer.c |   76 
> -
>  src/glx/glxcmds.c |   74 +++-
>  2 files changed, 98 insertions(+), 52 deletions(-)
> 
> diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
> index 5f91bc6..1d9c1e9 100644
> --- a/src/glx/glx_pbuffer.c
> +++ b/src/glx/glx_pbuffer.c

>  
>  #else
>  
> -static void
> +static GLboolean
>  CreateDRIDrawable(Display *dpy, const struct glx_config * fbconfig,
> XID drawable, XID glxdrawable,
> const int *attrib_list, size_t num_attribs)
>  {
> +return GL_FALSE;
>  }
>  

Always returning GL_FALSE (failed) here when built without
GLX_DIRECT_RENDERING defined ...

>  /**
>   * Create a non-pbuffer GLX drawable.
>   *
> @@ -378,6 +402,7 @@ CreateDrawable(Display *dpy, struct glx_config *config,
> Drawable drawable, const int *attrib_list, CARD8 glxCode)
>  {
> xGLXCreateWindowReq *req;
> +   GLXDrawable ret;
> CARD32 *data;
> unsigned int i;
> CARD8 opcode;
> @@ -401,7 +426,7 @@ CreateDrawable(Display *dpy, struct glx_config *config,
> req->screen = config->screen;
> req->fbconfig = config->fbconfigID;
> req->window = drawable;
> -   req->glxwindow = XAllocID(dpy);
> +   req->glxwindow = ret = XAllocID(dpy);
> req->numAttribs = i;
>  
> if (attrib_list)
> @@ -410,9 +435,16 @@ CreateDrawable(Display *dpy, struct glx_config *config,
> UnlockDisplay(dpy);
> SyncHandle();
>  
> -   CreateDRIDrawable(dpy, config, drawable, req->glxwindow, attrib_list, i);
> +   if (!CreateDRIDrawable(dpy, config, drawable, ret, attrib_list, i)) {
> +  if (glxCode == X_GLXCreatePixmap)
> + glxCode = X_GLXDestroyPixmap;
> +  else
> + glxCode = X_GLXDestroyWindow;
> +  protocolDestroyDrawable(dpy, ret, glxCode);
> +  ret = None;
> +   }

... and then always checking the result here, looks like this makes
CreateDrawable (and hence glXCreateWindow() and glXCreatePbuffer()) always
fail (when built without GLX_DIRECT_RENDERING defined)

>  
> -   return req->glxwindow;
> +   return ret;
>  }

>  
> @@ -474,6 +490,7 @@ CreatePbuffer(Display * dpy, struct glx_config *config,
> CARD8 opcode;
> unsigned int i;
> Pixmap pixmap;
> +   GLboolean glx_1_3 = GL_FALSE;
>  
> i = 0;
> if (attrib_list) {
> @@ -492,6 +509,8 @@ CreatePbuffer(Display * dpy, struct glx_config *config,
>xGLXCreatePbufferReq *req;
>unsigned int extra = (size_in_attribs) ? 0 : 2;
>  
> +  glx_1_3 = GL_TRUE;
> +
>GetReqExtra(GLXCreatePbuffer, (8 * (i + extra)), req);
>data = (CARD32 *) (req + 1);
>  
> @@ -536,7 +555,12 @@ CreatePbuffer(Display * dpy, struct glx_config *config,
> pixmap = XCreatePixmap(dpy, RootWindow(dpy, config->screen),
> width, height, config->rgbBits);
>  
> -   CreateDRIDrawable(dpy, config, pixmap, id, attrib_list, i);
> +   if (!CreateDRIDrawable(dpy, config, pixmap, id, attrib_list, i)) {
> +  CARD32 o = glx_1_3 ? X_GLXDestroyPbuffer : 
> X_GLXvop_DestroyGLXPbufferSGIX;
> +  XFreePixmap(dpy, pixmap);
> +  protocolDestroyDrawable(dpy, id, o);
> +  id = None;
> +   }

Ditto.

>  
> return id;
>  }

Attached is a patch to fix.

>From f210b48ed7ae8d0286676ed94c38c5a6ca4338b4 Mon Sep 17 00:00:00 2001
From: Jon TURNEY 
Date: Tue, 26 Feb 2013 15:47:44 +
Subject: [PATCH] glXCreateWindow() always fails when built without
 GLX_DIRECT_RENDERING defined

glXCreateWindow() and glXCreatePbuffer() always fail when built without
GLX_DIRECT_RENDERING defined since commit 
4833104718677caad0027d5e7539ca9bba389392

Signed-off-by: Jon TURNEY 
---
 src/glx/glx_pbuffer.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index e4b2c86..f11305a 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -241,7 +241,7 @@ CreateDRIDrawable(Display *dpy, const struct glx_config * 
fbconfig,
  XID drawable, XID glxdrawable,
  const int *attrib_list, size_t num_attribs)
 {
-return GL_FALSE;
+return GL_TRUE;
 }
 
 static void
-- 
1.7.9

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


[Mesa-dev] [PATCH 0/3] Fixes for glapi/test/check_table test

2013-02-27 Thread Jon TURNEY
Now that the make target is supported, I've turned on 'make check' for mesa in 
my tinderbox, but it fails [1]

The logic behind patch [3/3] is sufficently convoluted that I'm not sure I've 
got it right.  However, I'm pretty sure that the code is wrong as it stands, as 
it's checking for a #define which is never made.

[1] http://tinderbox.freedesktop.org/builds/2013-02-27-0010/logs/libGL/#check

Jon TURNEY (3):
  Fix out-of-tree build of 'make check' in src/mapi/glapi/tests/
  Fix glapi/tests/check_table.cpp for standardized OpenGL function
names
  Properly check GLX_INDIRECT_RENDERING in glapi/tests/check_table

 src/mapi/glapi/tests/Makefile.am |7 +-
 src/mapi/glapi/tests/check_table.cpp |  530 +-
 2 files changed, 269 insertions(+), 268 deletions(-)

-- 
1.7.9

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


  1   2   3   >