mesa: remove darwin-specific derivations
The ‘mesa-darwin’ stuff was very out of date (2012). This moves darwin to use the newer mesa. Stuff seems to build okay. Needs more testing on other stuff though (libraries work). No drivers build but that is how it should work on macOS. /cc @cstrahan @Anton-Latukha
This commit is contained in:
parent
bd1ebb0fa0
commit
16879e2f6a
|
@ -1,73 +0,0 @@
|
|||
{ stdenv, fetchurl, pkgconfig, intltool, flex, bison
|
||||
, python, libxml2Python, expat, makedepend, xorg, llvm, libffi, libvdpau
|
||||
, OpenGL, apple_sdk, Xplugin
|
||||
}:
|
||||
|
||||
let
|
||||
version = "8.0.5";
|
||||
self = stdenv.mkDerivation rec {
|
||||
name = "mesa-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "ftp://ftp.freedesktop.org/pub/mesa/older-versions/8.x/${version}/MesaLib-${version}.tar.bz2";
|
||||
sha256 = "0pjs8x51c0i6mawgd4w03lxpyx5fnx7rc8plr8jfsscf9yiqs6si";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgconfig python makedepend flex bison ];
|
||||
|
||||
buildInputs = with xorg; [
|
||||
glproto dri2proto libXfixes libXi libXmu
|
||||
intltool expat libxml2Python llvm
|
||||
presentproto
|
||||
libX11 libXext libxcb libXt libxshmfence
|
||||
libffi libvdpau
|
||||
] ++ stdenv.lib.optionals stdenv.isDarwin [ OpenGL apple_sdk.sdk Xplugin ];
|
||||
|
||||
propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ OpenGL ];
|
||||
|
||||
postUnpack = ''
|
||||
ln -s darwin $sourceRoot/configs/current
|
||||
'';
|
||||
|
||||
preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
|
||||
substituteInPlace bin/mklib --replace g++ clang++
|
||||
'';
|
||||
|
||||
patches = [
|
||||
./patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch
|
||||
./patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch
|
||||
./patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch
|
||||
./patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch
|
||||
./patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch
|
||||
./patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch
|
||||
./patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch
|
||||
./patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch
|
||||
./patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch
|
||||
./patches/patch-src-mapi-vgapi-Makefile.diff
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
configurePhase = ":";
|
||||
|
||||
configureFlags = [
|
||||
# NOTE: Patents expired on June 17 2018.
|
||||
# For details see: https://www.phoronix.com/scan.php?page=news_item&px=OpenGL-Texture-Float-Freed
|
||||
"texture-float"
|
||||
];
|
||||
|
||||
makeFlags = "INSTALL_DIR=\${out} CC=cc CXX=c++";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru = { inherit version; };
|
||||
|
||||
meta = {
|
||||
description = "An open source implementation of OpenGL";
|
||||
homepage = http://www.mesa3d.org/;
|
||||
license = "bsd";
|
||||
platforms = stdenv.lib.platforms.darwin;
|
||||
maintainers = with stdenv.lib.maintainers; [ cstrahan ];
|
||||
};
|
||||
};
|
||||
in self // { driverLink = self; }
|
|
@ -1,147 +0,0 @@
|
|||
From 9cf1afbf8ae87ddbb29b24a0f9f2724e9e2935c1 Mon Sep 17 00:00:00 2001
|
||||
From: Brian Paul <brianp@vmware.com>
|
||||
Date: Tue, 4 Sep 2012 20:17:15 -0600
|
||||
Subject: [PATCH 03/13] mesa: fix per-level max texture size error checking
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is a long-standing omission in Mesa's texture image size checking.
|
||||
We need to take the mipmap level into consideration when checking if the
|
||||
width, height and depth are too large.
|
||||
|
||||
Fixes the new piglit max-texture-size-level test.
|
||||
Thanks to Stéphane Marchesin for finding this problem.
|
||||
|
||||
Note: This is a candidate for the stable branches.
|
||||
|
||||
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
|
||||
(cherry picked from commit 771e7b6d884bb4294a89f276a904d90b28efb90a)
|
||||
---
|
||||
src/mesa/main/teximage.c | 36 +++++++++++++++++++++---------------
|
||||
1 file changed, 21 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
|
||||
index 3aecc0f..ed22fa9 100644
|
||||
--- a/src/mesa/main/teximage.c
|
||||
+++ b/src/mesa/main/teximage.c
|
||||
@@ -1251,11 +1251,12 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||
|
||||
switch (target) {
|
||||
case GL_PROXY_TEXTURE_1D:
|
||||
- maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
|
||||
- if (width < 2 * border || width > 2 * border + maxSize)
|
||||
- return GL_FALSE;
|
||||
if (level >= ctx->Const.MaxTextureLevels)
|
||||
return GL_FALSE;
|
||||
+ maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); /* level zero size */
|
||||
+ maxSize >>= level; /* level size */
|
||||
+ if (width < 2 * border || width > 2 * border + maxSize)
|
||||
+ return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
@@ -1263,13 +1264,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||
return GL_TRUE;
|
||||
|
||||
case GL_PROXY_TEXTURE_2D:
|
||||
+ if (level >= ctx->Const.MaxTextureLevels)
|
||||
+ return GL_FALSE;
|
||||
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
|
||||
+ maxSize >>= level;
|
||||
if (width < 2 * border || width > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
if (height < 2 * border || height > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
- if (level >= ctx->Const.MaxTextureLevels)
|
||||
- return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
@@ -1279,15 +1281,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||
return GL_TRUE;
|
||||
|
||||
case GL_PROXY_TEXTURE_3D:
|
||||
+ if (level >= ctx->Const.Max3DTextureLevels)
|
||||
+ return GL_FALSE;
|
||||
maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
|
||||
+ maxSize >>= level;
|
||||
if (width < 2 * border || width > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
if (height < 2 * border || height > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
if (depth < 2 * border || depth > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
- if (level >= ctx->Const.Max3DTextureLevels)
|
||||
- return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
@@ -1299,23 +1302,24 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||
return GL_TRUE;
|
||||
|
||||
case GL_PROXY_TEXTURE_RECTANGLE_NV:
|
||||
+ if (level != 0)
|
||||
+ return GL_FALSE;
|
||||
maxSize = ctx->Const.MaxTextureRectSize;
|
||||
if (width < 0 || width > maxSize)
|
||||
return GL_FALSE;
|
||||
if (height < 0 || height > maxSize)
|
||||
return GL_FALSE;
|
||||
- if (level != 0)
|
||||
- return GL_FALSE;
|
||||
return GL_TRUE;
|
||||
|
||||
case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
|
||||
+ if (level >= ctx->Const.MaxCubeTextureLevels)
|
||||
+ return GL_FALSE;
|
||||
maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
|
||||
+ maxSize >>= level;
|
||||
if (width < 2 * border || width > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
if (height < 2 * border || height > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
- if (level >= ctx->Const.MaxCubeTextureLevels)
|
||||
- return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
@@ -1325,13 +1329,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||
return GL_TRUE;
|
||||
|
||||
case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
|
||||
+ if (level >= ctx->Const.MaxTextureLevels)
|
||||
+ return GL_FALSE;
|
||||
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
|
||||
+ maxSize >>= level;
|
||||
if (width < 2 * border || width > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
|
||||
return GL_FALSE;
|
||||
- if (level >= ctx->Const.MaxTextureLevels)
|
||||
- return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
@@ -1339,15 +1344,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
|
||||
return GL_TRUE;
|
||||
|
||||
case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
|
||||
+ if (level >= ctx->Const.MaxTextureLevels)
|
||||
+ return GL_FALSE;
|
||||
maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
|
||||
+ maxSize >>= level;
|
||||
if (width < 2 * border || width > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
if (height < 2 * border || height > 2 * border + maxSize)
|
||||
return GL_FALSE;
|
||||
if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
|
||||
return GL_FALSE;
|
||||
- if (level >= ctx->Const.MaxTextureLevels)
|
||||
- return GL_FALSE;
|
||||
if (!ctx->Extensions.ARB_texture_non_power_of_two) {
|
||||
if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
|
||||
return GL_FALSE;
|
||||
--
|
||||
1.9.2
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
From db8cb2250335a93cad6e877e634116e5cd6b42fc Mon Sep 17 00:00:00 2001
|
||||
From: Dave Airlie <airlied@redhat.com>
|
||||
Date: Tue, 13 Mar 2012 14:53:25 +0000
|
||||
Subject: [PATCH 08/13] glsl: initialise const force glsl extension warning in
|
||||
fake ctx
|
||||
|
||||
valgrind complained about an uninitialised value being used in
|
||||
glsl_parser_extras.cpp, and this was the one it was giving out about.
|
||||
|
||||
Just initialise the value in the fakectx.
|
||||
|
||||
Signed-off-by: Dave Airlie <airlied@redhat.com>
|
||||
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48057
|
||||
(cherry picked from commit b78a77f979b21a84aecb6fa4f19a2ed51a48c306)
|
||||
---
|
||||
src/glsl/builtins/tools/generate_builtins.py | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py
|
||||
index 72d12bb..bd15c4d 100755
|
||||
--- a/src/glsl/builtins/tools/generate_builtins.py
|
||||
+++ b/src/glsl/builtins/tools/generate_builtins.py
|
||||
@@ -156,6 +156,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne
|
||||
fakeCtx.API = API_OPENGL;
|
||||
fakeCtx.Const.GLSLVersion = 130;
|
||||
fakeCtx.Extensions.ARB_ES2_compatibility = true;
|
||||
+ fakeCtx.Const.ForceGLSLExtensionsWarn = false;
|
||||
gl_shader *sh = _mesa_new_shader(NULL, 0, target);
|
||||
struct _mesa_glsl_parse_state *st =
|
||||
new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh);
|
||||
--
|
||||
1.9.2
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
From 2286bd68a832a4d4908d50e1a4496853e1f3305a Mon Sep 17 00:00:00 2001
|
||||
From: Brian Paul <brianp@vmware.com>
|
||||
Date: Mon, 27 Aug 2012 21:52:07 -0600
|
||||
Subject: [PATCH 09/13] mesa: test for GL_EXT_framebuffer_sRGB in glPopAttrib()
|
||||
|
||||
To avoid spurious GL_INVALID_ENUM errors if the extension isn't supported.
|
||||
(cherry picked from commit 1aee8803f83f7ae24d9c2150c70afff2b1ee4c2f)
|
||||
---
|
||||
src/mesa/main/attrib.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
|
||||
index 225ac89..cc384c7 100644
|
||||
--- a/src/mesa/main/attrib.c
|
||||
+++ b/src/mesa/main/attrib.c
|
||||
@@ -993,7 +993,8 @@ _mesa_PopAttrib(void)
|
||||
_mesa_ClampColorARB(GL_CLAMP_READ_COLOR_ARB, color->ClampReadColor);
|
||||
|
||||
/* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
|
||||
- _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
|
||||
+ if (ctx->Extensions.EXT_framebuffer_sRGB)
|
||||
+ _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
|
||||
}
|
||||
break;
|
||||
case GL_CURRENT_BIT:
|
||||
--
|
||||
1.9.2
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
From 9c50093adff0c7531ab32a7ec9ce3b91712b4d20 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
Date: Sat, 20 Jul 2013 10:25:28 -0700
|
||||
Subject: [PATCH 11/13] Apple: glFlush() is not needed with CGLFlushDrawable()
|
||||
|
||||
<rdar://problem/14496373>
|
||||
|
||||
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
(cherry picked from commit fa5ed99d8e809fb86e486a40273a4a6971055398)
|
||||
---
|
||||
src/glx/apple/apple_glx.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/src/glx/apple/apple_glx.c b/src/glx/apple/apple_glx.c
|
||||
index 56cff64..4e2aa33 100644
|
||||
--- a/src/glx/apple/apple_glx.c
|
||||
+++ b/src/glx/apple/apple_glx.c
|
||||
@@ -132,8 +132,6 @@ apple_glx_swap_buffers(void *ptr)
|
||||
{
|
||||
struct apple_glx_context *ac = ptr;
|
||||
|
||||
- /* This may not be needed with CGLFlushDrawable: */
|
||||
- glFlush();
|
||||
apple_cgl.flush_drawable(ac->context_obj);
|
||||
}
|
||||
|
||||
--
|
||||
1.9.2
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
From 629600450b3845a768c0edc92ea3f444d03a2738 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
Date: Tue, 20 May 2014 01:37:58 -0700
|
||||
Subject: [PATCH 12/13] glapi: Avoid heap corruption in _glapi_table
|
||||
|
||||
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
Reviewed-by: Chia-I Wu <olv@lunarg.com>
|
||||
(cherry picked from commit ff5456d1acf6f627a6837be3f3f37c6a268c9e8e)
|
||||
---
|
||||
src/mapi/glapi/gen/gl_gentable.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
|
||||
index 5657e32..0d0a02d 100644
|
||||
--- a/src/mapi/glapi/gen/gl_gentable.py
|
||||
+++ b/src/mapi/glapi/gen/gl_gentable.py
|
||||
@@ -111,7 +111,7 @@ __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
|
||||
|
||||
struct _glapi_table *
|
||||
_glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
|
||||
- struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
|
||||
+ struct _glapi_table *disp = calloc(1, _glapi_get_dispatch_table_size() * sizeof(_glapi_proc));
|
||||
char symboln[512];
|
||||
|
||||
if(!disp)
|
||||
--
|
||||
1.9.2
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
From ba59a779ed41e08fa16805c1c60da39885546d0e Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
Date: Tue, 20 May 2014 10:53:00 -0700
|
||||
Subject: [PATCH 13/13] darwin: Fix test for kCGLPFAOpenGLProfile support at
|
||||
runtime
|
||||
|
||||
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
(cherry picked from commit 7a109268ab5b3544e7f7b99e84ef1fdf54023fb4)
|
||||
---
|
||||
src/glx/apple/apple_visual.c | 14 +++++++++-----
|
||||
1 file changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
|
||||
index 282934f..238c248 100644
|
||||
--- a/src/glx/apple/apple_visual.c
|
||||
+++ b/src/glx/apple/apple_visual.c
|
||||
@@ -73,11 +73,15 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||
GLint vsref = 0;
|
||||
CGLError error = 0;
|
||||
|
||||
- /* Request an OpenGL 3.2 profile if one is available */
|
||||
- if(apple_cgl.version_major > 1 || (apple_cgl.version_major == 1 && apple_cgl.version_minor >= 3)) {
|
||||
- attr[numattr++] = kCGLPFAOpenGLProfile;
|
||||
- attr[numattr++] = kCGLOGLPVersion_3_2_Core;
|
||||
- }
|
||||
+ /* Request an OpenGL 3.2 profile if one is available and supported */
|
||||
+ attr[numattr++] = kCGLPFAOpenGLProfile;
|
||||
+ attr[numattr++] = kCGLOGLPVersion_3_2_Core;
|
||||
+
|
||||
+ /* Test for kCGLPFAOpenGLProfile support at runtime and roll it out if not supported */
|
||||
+ attr[numattr] = 0;
|
||||
+ error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||
+ if (error == kCGLBadAttribute)
|
||||
+ numattr -= 2;
|
||||
|
||||
if (offscreen) {
|
||||
apple_glx_diagnostic
|
||||
--
|
||||
1.9.2
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
From f0702d6e631bb912a230c081463bb51a0dde1bff Mon Sep 17 00:00:00 2001
|
||||
From: Jon TURNEY <jon.turney@dronecode.org.uk>
|
||||
Date: Mon, 12 May 2014 15:38:26 +0100
|
||||
Subject: [PATCH 1001/1003] appleglx: Improve error reporting if
|
||||
CGLChoosePixelFormat() didn't find any matching pixel formats.
|
||||
|
||||
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
|
||||
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
(cherry picked from commit 002a3a74273b81dfb226e1c3f0a8c18525ed0af4)
|
||||
---
|
||||
src/glx/apple/apple_visual.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
|
||||
index 238c248..c6ede51 100644
|
||||
--- a/src/glx/apple/apple_visual.c
|
||||
+++ b/src/glx/apple/apple_visual.c
|
||||
@@ -167,4 +167,9 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||
fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
|
||||
abort();
|
||||
}
|
||||
+
|
||||
+ if (!*pfobj) {
|
||||
+ fprintf(stderr, "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
|
||||
+ abort();
|
||||
+ }
|
||||
}
|
||||
--
|
||||
1.9.2 (Apple Git-49)
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
From 1b2f877c8ef052b183c1f20ece6c6e4a7bfd237c Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
Date: Sat, 24 May 2014 14:13:33 -0700
|
||||
Subject: [PATCH 1002/1003] darwin: Write errors in choosing the pixel format
|
||||
to the crash log
|
||||
|
||||
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
(cherry picked from commit 9eb1d36c978a9b15ae2e999c630492dfffd7f165)
|
||||
---
|
||||
src/glx/apple/apple_visual.c | 18 ++++++++++++++++--
|
||||
1 file changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
|
||||
index c6ede51..951b213 100644
|
||||
--- a/src/glx/apple/apple_visual.c
|
||||
+++ b/src/glx/apple/apple_visual.c
|
||||
@@ -63,6 +63,16 @@ enum
|
||||
MAX_ATTR = 60
|
||||
};
|
||||
|
||||
+static char __crashreporter_info_buff__[4096] = { 0 };
|
||||
+static const char *__crashreporter_info__ __attribute__((__used__)) =
|
||||
+ &__crashreporter_info_buff__[0];
|
||||
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
|
||||
+// This is actually a toolchain requirement, but I'm not sure the correct check,
|
||||
+// but it should be fine to just only include it for Leopard and later. This line
|
||||
+// just tells the linker to never strip this symbol (such as for space optimization)
|
||||
+__asm__ (".desc ___crashreporter_info__, 0x10");
|
||||
+#endif
|
||||
+
|
||||
void
|
||||
apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * mode,
|
||||
bool * double_buffered, bool * uses_stereo,
|
||||
@@ -164,12 +174,16 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||
error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||
|
||||
if (error) {
|
||||
- fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
|
||||
+ snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
|
||||
+ "CGLChoosePixelFormat error: %s\n", apple_cgl.error_string(error));
|
||||
+ fprintf(stderr, "%s", __crashreporter_info_buff__);
|
||||
abort();
|
||||
}
|
||||
|
||||
if (!*pfobj) {
|
||||
- fprintf(stderr, "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
|
||||
+ snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
|
||||
+ "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
|
||||
+ fprintf(stderr, "%s", __crashreporter_info_buff__);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
--
|
||||
1.9.2 (Apple Git-49)
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
From 9d6e12eb6b06202519e48a7321f32944d7a34b0f Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
Date: Sat, 24 May 2014 14:08:16 -0700
|
||||
Subject: [PATCH 1003/1003] darwin: Guard Core Profile usage behind a testing
|
||||
envvar
|
||||
|
||||
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
|
||||
(cherry picked from commit 04ce3be4010305902cc5ae81e8e0c8550d043a1e)
|
||||
---
|
||||
src/glx/apple/apple_visual.c | 30 ++++++++++++++++++++----------
|
||||
1 file changed, 20 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
|
||||
index 951b213..046581b 100644
|
||||
--- a/src/glx/apple/apple_visual.c
|
||||
+++ b/src/glx/apple/apple_visual.c
|
||||
@@ -82,16 +82,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||
int numattr = 0;
|
||||
GLint vsref = 0;
|
||||
CGLError error = 0;
|
||||
-
|
||||
- /* Request an OpenGL 3.2 profile if one is available and supported */
|
||||
- attr[numattr++] = kCGLPFAOpenGLProfile;
|
||||
- attr[numattr++] = kCGLOGLPVersion_3_2_Core;
|
||||
-
|
||||
- /* Test for kCGLPFAOpenGLProfile support at runtime and roll it out if not supported */
|
||||
- attr[numattr] = 0;
|
||||
- error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||
- if (error == kCGLBadAttribute)
|
||||
- numattr -= 2;
|
||||
+ bool use_core_profile = getenv("LIBGL_PROFILE_CORE");
|
||||
|
||||
if (offscreen) {
|
||||
apple_glx_diagnostic
|
||||
@@ -167,12 +158,31 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
|
||||
attr[numattr++] = mode->samples;
|
||||
}
|
||||
|
||||
+ /* Debugging support for Core profiles to support newer versions of OpenGL */
|
||||
+ if (use_core_profile) {
|
||||
+ attr[numattr++] = kCGLPFAOpenGLProfile;
|
||||
+ attr[numattr++] = kCGLOGLPVersion_3_2_Core;
|
||||
+ }
|
||||
+
|
||||
attr[numattr++] = 0;
|
||||
|
||||
assert(numattr < MAX_ATTR);
|
||||
|
||||
error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||
|
||||
+ if ((error == kCGLBadAttribute || vsref == 0) && use_core_profile) {
|
||||
+ apple_glx_diagnostic
|
||||
+ ("Trying again without CoreProfile: error=%s, vsref=%d\n", apple_cgl.error_string(error), vsref);
|
||||
+
|
||||
+ if (!error)
|
||||
+ apple_cgl.destroy_pixel_format(*pfobj);
|
||||
+
|
||||
+ numattr -= 3;
|
||||
+ attr[numattr++] = 0;
|
||||
+
|
||||
+ error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
|
||||
+ }
|
||||
+
|
||||
if (error) {
|
||||
snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
|
||||
"CGLChoosePixelFormat error: %s\n", apple_cgl.error_string(error));
|
||||
--
|
||||
1.9.2 (Apple Git-49)
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
--- a/src/mapi/vgapi/Makefile 2012-11-30 12:06:24.000000000 -0500
|
||||
+++ b/src/mapi/vgapi/Makefile 2012-11-30 12:06:52.000000000 -0500
|
||||
@@ -75,6 +75,8 @@
|
||||
install-headers:
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/VG
|
||||
$(INSTALL) -m 644 $(TOP)/include/VG/*.h $(DESTDIR)$(INSTALL_INC_DIR)/VG
|
||||
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/KHR
|
||||
+ $(INSTALL) -m 644 $(TOP)/include/KHR/*.h $(DESTDIR)$(INSTALL_INC_DIR)/KHR
|
||||
|
||||
install: default install-headers install-pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
|
@ -0,0 +1,76 @@
|
|||
diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
|
||||
index 45cb6075e6..62937311b9 100644
|
||||
--- a/include/c11/threads_posix.h
|
||||
+++ b/include/c11/threads_posix.h
|
||||
@@ -36,6 +36,11 @@
|
||||
#include <sched.h>
|
||||
#include <stdint.h> /* for intptr_t */
|
||||
|
||||
+#ifdef __MACH__
|
||||
+#include <mach/clock.h>
|
||||
+#include <mach/mach.h>
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
Configuration macro:
|
||||
|
||||
@@ -383,12 +388,25 @@ tss_set(tss_t key, void *val)
|
||||
/*-------------------- 7.25.7 Time functions --------------------*/
|
||||
// 7.25.6.1
|
||||
#ifndef HAVE_TIMESPEC_GET
|
||||
+
|
||||
static inline int
|
||||
timespec_get(struct timespec *ts, int base)
|
||||
{
|
||||
if (!ts) return 0;
|
||||
if (base == TIME_UTC) {
|
||||
+#ifdef __MACH__
|
||||
+ if (ts != NULL) {
|
||||
+ clock_serv_t cclock;
|
||||
+ mach_timespec_t mts;
|
||||
+ host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
||||
+ clock_get_time(cclock, &mts);
|
||||
+ mach_port_deallocate(mach_task_self(), cclock);
|
||||
+ ts->tv_sec = mts.tv_sec;
|
||||
+ ts->tv_nsec = mts.tv_nsec;
|
||||
+ }
|
||||
+#else
|
||||
clock_gettime(CLOCK_REALTIME, ts);
|
||||
+#endif
|
||||
return base;
|
||||
}
|
||||
return 0;
|
||||
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
|
||||
index 1208ebb315..e1378fb1f0 100644
|
||||
--- a/src/egl/drivers/dri2/egl_dri2.c
|
||||
+++ b/src/egl/drivers/dri2/egl_dri2.c
|
||||
@@ -65,6 +65,11 @@
|
||||
#include "util/u_vector.h"
|
||||
#include "mapi/glapi/glapi.h"
|
||||
|
||||
+#ifdef __MACH__
|
||||
+#include <mach/clock.h>
|
||||
+#include <mach/mach.h>
|
||||
+#endif
|
||||
+
|
||||
#define NUM_ATTRIBS 12
|
||||
|
||||
static void
|
||||
@@ -3092,7 +3097,17 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
|
||||
|
||||
/* We override the clock to monotonic when creating the condition
|
||||
* variable. */
|
||||
+#ifdef __MACH__
|
||||
+ clock_serv_t cclock;
|
||||
+ mach_timespec_t mts;
|
||||
+ host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
|
||||
+ clock_get_time(cclock, &mts);
|
||||
+ mach_port_deallocate(mach_task_self(), cclock);
|
||||
+ current.tv_sec = mts.tv_sec;
|
||||
+ current.tv_nsec = mts.tv_nsec;
|
||||
+#else
|
||||
clock_gettime(CLOCK_MONOTONIC, ¤t);
|
||||
+#endif
|
||||
|
||||
/* calculating when to expire */
|
||||
expire.tv_nsec = timeout % 1000000000L;
|
|
@ -8,6 +8,8 @@
|
|||
, galliumDrivers ? null
|
||||
, driDrivers ? null
|
||||
, vulkanDrivers ? null
|
||||
, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
|
||||
, OpenGL, Xplugin
|
||||
}:
|
||||
|
||||
/** Packaging design:
|
||||
|
@ -29,19 +31,21 @@ else
|
|||
|
||||
let
|
||||
defaultGalliumDrivers =
|
||||
if stdenv.isAarch32
|
||||
optionals (builtins.elem "drm" eglPlatforms)
|
||||
(if stdenv.isAarch32
|
||||
then ["virgl" "nouveau" "freedreno" "vc4" "etnaviv" "imx"]
|
||||
else if stdenv.isAarch64
|
||||
then ["virgl" "nouveau" "vc4" ]
|
||||
else ["virgl" "svga" "i915" "r300" "r600" "radeonsi" "nouveau"];
|
||||
else ["virgl" "svga" "i915" "r300" "r600" "radeonsi" "nouveau"]);
|
||||
defaultDriDrivers =
|
||||
if (stdenv.isAarch32 || stdenv.isAarch64)
|
||||
optionals (builtins.elem "drm" eglPlatforms)
|
||||
(if (stdenv.isAarch32 || stdenv.isAarch64)
|
||||
then ["nouveau"]
|
||||
else ["i915" "i965" "nouveau" "radeon" "r200"];
|
||||
else ["i915" "i965" "nouveau" "radeon" "r200"]);
|
||||
defaultVulkanDrivers =
|
||||
if (stdenv.isAarch32 || stdenv.isAarch64)
|
||||
optionals stdenv.isLinux (if (stdenv.isAarch32 || stdenv.isAarch64)
|
||||
then []
|
||||
else ["intel"] ++ lib.optional enableRadv "radeon";
|
||||
else ["intel"] ++ lib.optional enableRadv "radeon");
|
||||
in
|
||||
|
||||
let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in
|
||||
|
@ -51,11 +55,11 @@ let
|
|||
(if gallium_ == null
|
||||
then defaultGalliumDrivers
|
||||
else gallium_)
|
||||
++ ["swrast" "virgl"];
|
||||
++ lib.optional stdenv.isLinux "swrast";
|
||||
driDrivers =
|
||||
(if dri_ == null
|
||||
then defaultDriDrivers
|
||||
else dri_) ++ ["swrast"];
|
||||
then optionals (elem "drm" eglPlatforms) defaultDriDrivers
|
||||
else dri_) ++ lib.optional stdenv.isLinux "swrast";
|
||||
vulkanDrivers =
|
||||
if vulkan_ == null
|
||||
then defaultVulkanDrivers
|
||||
|
@ -89,9 +93,10 @@ let self = stdenv.mkDerivation {
|
|||
./symlink-drivers.patch
|
||||
./missing-includes.patch # dev_t needs sys/stat.h, time_t needs time.h, etc.-- fixes build w/musl
|
||||
./disk_cache-include-dri-driver-path-in-cache-key.patch
|
||||
];
|
||||
] ++ lib.optional stdenv.isDarwin ./darwin-clock-gettime.patch;
|
||||
|
||||
outputs = [ "out" "dev" "drivers" "osmesa" ];
|
||||
outputs = [ "out" "dev" "drivers" ]
|
||||
++ lib.optional (elem "swrast" galliumDrivers) "osmesa";
|
||||
|
||||
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
|
||||
configureFlags = [
|
||||
|
@ -99,18 +104,10 @@ let self = stdenv.mkDerivation {
|
|||
"--localstatedir=/var"
|
||||
"--with-dri-driverdir=$(drivers)/lib/dri"
|
||||
"--with-dri-searchpath=${libglvnd.driverLink}/lib/dri"
|
||||
"--with-platforms=x11,wayland,drm"
|
||||
]
|
||||
++ (optional (galliumDrivers != [])
|
||||
("--with-gallium-drivers=" +
|
||||
builtins.concatStringsSep "," galliumDrivers))
|
||||
++ (optional (driDrivers != [])
|
||||
("--with-dri-drivers=" +
|
||||
builtins.concatStringsSep "," driDrivers))
|
||||
++ (optional (vulkanDrivers != [])
|
||||
("--with-vulkan-drivers=" +
|
||||
builtins.concatStringsSep "," vulkanDrivers))
|
||||
++ [
|
||||
"--with-platforms=${concatStringsSep "," eglPlatforms}"
|
||||
"--with-gallium-drivers=${concatStringsSep "," galliumDrivers}"
|
||||
"--with-dri-drivers=${concatStringsSep "," driDrivers}"
|
||||
"--with-vulkan-drivers=${concatStringsSep "," vulkanDrivers}"
|
||||
(enableFeature stdenv.isLinux "dri3")
|
||||
(enableFeature stdenv.isLinux "nine") # Direct3D in Wine
|
||||
"--enable-libglvnd"
|
||||
|
@ -121,17 +118,18 @@ let self = stdenv.mkDerivation {
|
|||
"--enable-glx"
|
||||
# https://bugs.freedesktop.org/show_bug.cgi?id=35268
|
||||
(enableFeature (!stdenv.hostPlatform.isMusl) "glx-tls")
|
||||
"--enable-gallium-osmesa" # used by wine
|
||||
# used by wine
|
||||
(enableFeature (elem "swrast" galliumDrivers) "gallium-osmesa")
|
||||
"--enable-llvm"
|
||||
"--enable-egl"
|
||||
"--enable-xa" # used in vmware driver
|
||||
"--enable-gbm"
|
||||
(enableFeature stdenv.isLinux "egl")
|
||||
(enableFeature stdenv.isLinux "xa") # used in vmware driver
|
||||
(enableFeature stdenv.isLinux "gbm")
|
||||
"--enable-xvmc"
|
||||
"--enable-vdpau"
|
||||
"--enable-shared-glapi"
|
||||
"--enable-llvm-shared-libs"
|
||||
"--enable-omx-bellagio"
|
||||
"--enable-va"
|
||||
(enableFeature stdenv.isLinux "omx-bellagio")
|
||||
(enableFeature stdenv.isLinux "va")
|
||||
"--disable-opencl"
|
||||
];
|
||||
|
||||
|
@ -139,16 +137,18 @@ let self = stdenv.mkDerivation {
|
|||
|
||||
propagatedBuildInputs = with xorg;
|
||||
[ libXdamage libXxf86vm ]
|
||||
++ optional stdenv.isLinux libdrm;
|
||||
++ optional stdenv.isLinux libdrm
|
||||
++ optionals stdenv.isDarwin [ OpenGL Xplugin ];
|
||||
|
||||
buildInputs = with xorg; [
|
||||
expat llvmPackages.llvm libglvnd
|
||||
glproto dri2proto dri3proto presentproto
|
||||
libX11 libXext libxcb libXt libXfixes libxshmfence
|
||||
libffi wayland wayland-protocols libvdpau libelf libXvMC
|
||||
libomxil-bellagio libva-minimal libpthreadstubs openssl/*or another sha1 provider*/
|
||||
libffi libvdpau libelf libXvMC
|
||||
libpthreadstubs openssl/*or another sha1 provider*/
|
||||
valgrind-light python2 python2.pkgs.Mako
|
||||
];
|
||||
] ++ lib.optionals stdenv.isLinux [ wayland wayland-protocols
|
||||
libomxil-bellagio libva-minimal ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
doCheck = false;
|
||||
|
@ -160,7 +160,7 @@ let self = stdenv.mkDerivation {
|
|||
];
|
||||
|
||||
# TODO: probably not all .la files are completely fixed, but it shouldn't matter;
|
||||
postInstall = ''
|
||||
postInstall = optionalString (galliumDrivers != []) ''
|
||||
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
|
||||
mv -t "$drivers/lib/" \
|
||||
$out/lib/libXvMC* \
|
||||
|
@ -214,7 +214,7 @@ let self = stdenv.mkDerivation {
|
|||
# TODO:
|
||||
# check $out doesn't depend on llvm: builder failures are ignored
|
||||
# for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
|
||||
postFixup = ''
|
||||
postFixup = optionalString (galliumDrivers != []) ''
|
||||
# add RPATH so the drivers can find the moved libgallium and libdricore9
|
||||
# moved here to avoid problems with stripping patchelfed files
|
||||
for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
|
||||
|
@ -234,7 +234,9 @@ let self = stdenv.mkDerivation {
|
|||
|
||||
# Use stub libraries from libglvnd and headers from Mesa.
|
||||
buildCommand = ''
|
||||
ln -s ${libglvnd.out} $out
|
||||
mkdir -p $out/nix-support
|
||||
ln -s ${libglvnd.out}/lib $out/lib
|
||||
|
||||
mkdir -p $dev/{,lib/pkgconfig,nix-support}
|
||||
echo "$out" > $dev/nix-support/propagated-build-inputs
|
||||
ln -s ${self.dev}/include $dev/include
|
||||
|
@ -256,6 +258,8 @@ let self = stdenv.mkDerivation {
|
|||
genPkgConfig egl EGL
|
||||
genPkgConfig glesv1_cm GLESv1_CM
|
||||
genPkgConfig glesv2 GLESv2
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
echo ${OpenGL} > $out/nix-support/propagated-build-inputs
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -264,7 +268,7 @@ let self = stdenv.mkDerivation {
|
|||
description = "An open source implementation of OpenGL";
|
||||
homepage = https://www.mesa3d.org/;
|
||||
license = licenses.mit; # X11 variant, in most files
|
||||
platforms = platforms.linux;
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
maintainers = with maintainers; [ vcunat ];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -11079,37 +11079,32 @@ with pkgs;
|
|||
## libGL/libGLU/Mesa stuff
|
||||
|
||||
# Default libGL implementation, should provide headers and libGL.so/libEGL.so/... to link agains them
|
||||
libGL = libGLDarwinOr mesa_noglu.stubs;
|
||||
libGL = mesa_noglu.stubs;
|
||||
|
||||
# Default libGLU
|
||||
libGLU = libGLDarwinOr mesa_glu;
|
||||
libGLU = mesa_glu;
|
||||
|
||||
# Combined derivation, contains both libGL and libGLU
|
||||
# Please, avoid using this attribute. It was meant as transitional hack
|
||||
# for packages that assume that libGLU and libGL live in the same prefix.
|
||||
# libGLU_combined propagates both libGL and libGLU
|
||||
libGLU_combined = libGLDarwinOr (buildEnv {
|
||||
libGLU_combined = buildEnv {
|
||||
name = "libGLU-combined";
|
||||
paths = [ libGL libGLU ];
|
||||
extraOutputsToInstall = [ "dev" ];
|
||||
});
|
||||
};
|
||||
|
||||
# Default derivation with libGL.so.1 to link into /run/opengl-drivers (if need)
|
||||
libGL_driver = libGLDarwinOr mesa_drivers;
|
||||
libGL_driver = mesa_drivers;
|
||||
|
||||
libGLSupported = lib.elem system lib.platforms.mesaPlatforms;
|
||||
|
||||
libGLDarwin = callPackage ../development/libraries/mesa-darwin {
|
||||
inherit (darwin.apple_sdk.frameworks) OpenGL;
|
||||
inherit (darwin.apple_sdk.libs) Xplugin;
|
||||
inherit (darwin) apple_sdk;
|
||||
};
|
||||
|
||||
libGLDarwinOr = alternative: if stdenv.isDarwin then libGLDarwin else alternative;
|
||||
|
||||
mesa_noglu = callPackage ../development/libraries/mesa {
|
||||
llvmPackages = llvmPackages_6;
|
||||
inherit (darwin.apple_sdk.frameworks) OpenGL;
|
||||
inherit (darwin.apple_sdk.libs) Xplugin;
|
||||
};
|
||||
mesa = mesa_noglu;
|
||||
|
||||
mesa_glu = callPackage ../development/libraries/mesa-glu { };
|
||||
|
||||
|
|
Loading…
Reference in New Issue