[Xquartz-changes] mesa: Branch '10.5-darwin-build-fixes' - 5 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Wed Feb 11 01:01:45 PST 2015


Rebased ref, commits from common ancestor:
commit 59a857da9989f5bc16670dbe35004e750a4bc140
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Mon May 12 16:30:26 2014 +0100

    applegl: Provide requirements of _SET_DrawBuffers
    
    _SET_DrawBuffers requires driDispatchRemapTable, so we need to link with libmesa
    for remap.c.  libmesa requires the C++ linker.
    
    Also need to arrange to call _mesa_init_remap_table() to initialize the remap
    table.
    
    XXX: There has to be a better way fixing this.
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 3ea1b30..3f82285 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -138,7 +138,10 @@ libglx_la_SOURCES += \
 	applegl_glx.c
 
 SUBDIRS += apple
-libglx_la_LIBADD += $(builddir)/apple/libappleglx.la
+libglx_la_LIBADD += \
+	$(builddir)/apple/libappleglx.la \
+	$(top_builddir)/src/mesa/libmesa.la
+nodist_EXTRA_lib at GL_LIB@_la_SOURCES = dummy.cpp
 endif
 
 GL_LIBS = \
diff --git a/src/glx/apple/apple_glapi.c b/src/glx/apple/apple_glapi.c
index 4d19f7f..849044b 100644
--- a/src/glx/apple/apple_glapi.c
+++ b/src/glx/apple/apple_glapi.c
@@ -39,6 +39,7 @@
 #include <GL/gl.h>
 
 #include "main/glheader.h"
+#include "main/remap.h"
 #include "glapi.h"
 #include "glapitable.h"
 #include "main/dispatch.h"
@@ -54,6 +55,8 @@ static void _apple_glapi_create_table(void) {
     if (__applegl_api)
         return;
 
+    _mesa_init_remap_table();
+
     __ogl_framework_api = _glapi_create_table_from_handle(apple_cgl_get_dl_handle(), "gl");
     assert(__ogl_framework_api);
 
commit e2eb131ecf02c2686e3f06737fe952835333452f
Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Sun May 11 14:40:07 2014 +0100

    darwin: Suppress type conversion warnings for GLhandleARB
    
    On darwin, GLhandleARB is defined as a void *, not the unsigned int it is on
    linux.
    
    For the moment, apply a cast to supress the warning
    
    Possibly this is safe, as for the mesa software renderer the shader program
    handle is not a real pointer, but a integer handle
    
    Probably this is not the right thing to do, and we should pay closer attention
    to how the GLhandlerARB type is used.
    
    main/shader_query.cpp:49:7: error: no matching function for call to '_mesa_lookup_shader_program_err'
          _mesa_lookup_shader_program_err(ctx, program, "glBindAttribLocation");
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../src/mesa/main/shaderobj.h:81:1: note: candidate function not viable: cannot convert argument of incomplete type 'GLhandleARB' (aka 'void *') to 'GLuint' (aka 'unsigned int')
    _mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
    ^
    main/shader_query.cpp:111:13: error: no matching function for call to '_mesa_lookup_shader_program_err'
       shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib");
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../src/mesa/main/shaderobj.h:81:1: note: candidate function not viable: cannot convert argument of incomplete type 'GLhandleARB' (aka 'void *') to 'GLuint' (aka 'unsigned int')
    _mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
    ^
    main/shader_query.cpp:218:7: error: no matching function for call to '_mesa_lookup_shader_program_err'
          _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation");
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../src/mesa/main/shaderobj.h:81:1: note: candidate function not viable: cannot convert argument of incomplete type 'GLhandleARB' (aka 'void *') to 'GLuint' (aka 'unsigned int')
    _mesa_lookup_shader_program_err(struct gl_context *ctx, GLuint name,
    
    Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>

diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index df9081b..b2d2f54 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -46,7 +46,7 @@ _mesa_BindAttribLocation(GLhandleARB program, GLuint index,
    GET_CURRENT_CONTEXT(ctx);
 
    struct gl_shader_program *const shProg =
-      _mesa_lookup_shader_program_err(ctx, program, "glBindAttribLocation");
+      _mesa_lookup_shader_program_err(ctx, (uintptr_t)program, "glBindAttribLocation");
    if (!shProg)
       return;
 
@@ -114,7 +114,7 @@ _mesa_GetActiveAttrib(GLhandleARB program, GLuint desired_index,
       return;
    }
 
-   shProg = _mesa_lookup_shader_program_err(ctx, program, "glGetActiveAttrib");
+   shProg = _mesa_lookup_shader_program_err(ctx, (uintptr_t)program, "glGetActiveAttrib");
    if (!shProg)
       return;
 
@@ -232,7 +232,7 @@ _mesa_GetAttribLocation(GLhandleARB program, const GLcharARB * name)
 {
    GET_CURRENT_CONTEXT(ctx);
    struct gl_shader_program *const shProg =
-      _mesa_lookup_shader_program_err(ctx, program, "glGetAttribLocation");
+      _mesa_lookup_shader_program_err(ctx, (uintptr_t)program, "glGetAttribLocation");
 
    if (!shProg) {
       return -1;
commit d38b43272cd196d84045b2fcfc8df88d0336ed7e
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Thu Jan 1 19:48:40 2015 -0800

    swrast: Build fix for darwin
    
    Fixes regression from commit 64b1dc44495890cbc2c7c5509cb830264020998c
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    CC: Emil Velikov <emil.l.velikov at gmail.com>
    CC: jon.turney at dronecode.org.uk
    CC: ionic at macports.org

diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index 8005f7d..0a3ec8a 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -60,6 +60,9 @@
 #include "swrast_priv.h"
 #include "swrast/s_context.h"
 
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
 const __DRIextension **__driDriverGetExtensions_swrast(void);
 
 const char * const swrast_vendor_string = "Mesa Project";
@@ -136,6 +139,16 @@ swrast_query_renderer_integer(__DRIscreen *psp, int param,
       value[0] = 0;
       return 0;
    case __DRI2_RENDERER_VIDEO_MEMORY: {
+      /* This should probably share code with os_get_total_physical_memory()
+       * from src/gallium/auxiliary/os/os_misc.c
+       */
+#if defined(CTL_HW) && defined(HW_MEMSIZE)
+        int mib[2] = { CTL_HW, HW_MEMSIZE };
+        unsigned long system_memory_bytes;
+        size_t len = sizeof(system_memory_bytes);
+        if (sysctl(mib, 2, &system_memory_bytes, &len, NULL, 0) != 0)
+            return -1;
+#elif defined(_SC_PHYS_PAGES) && defined(_SC_PAGE_SIZE)
       /* XXX: Do we want to return the full amount of system memory ? */
       const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
       const long system_page_size = sysconf(_SC_PAGE_SIZE);
@@ -145,6 +158,9 @@ swrast_query_renderer_integer(__DRIscreen *psp, int param,
 
       const uint64_t system_memory_bytes = (uint64_t) system_memory_pages
          * (uint64_t) system_page_size;
+#else
+#error "Unsupported platform"
+#endif
 
       const unsigned system_memory_megabytes =
          (unsigned) (system_memory_bytes / (1024 * 1024));
commit d03de1dd7d2261382305ea5695f9f510bc9e7dd4
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Tue Feb 10 22:21:47 2015 -0800

    darwin: build fix
    
    xfont.c:237:14: error: implicit declaration of function 'GetGLXDRIDrawable' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
       glxdraw = GetGLXDRIDrawable(CC->currentDpy, CC->currentDrawable);
                 ^
    Fixes regression from 291be28476ea60c6fb1eb2a882e2e25def5d3735
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    (cherry picked from commit e68b67b53fce39a8c93188262d9e795ca50750ac)

diff --git a/src/glx/xfont.c b/src/glx/xfont.c
index a086b7a..00498bc 100644
--- a/src/glx/xfont.c
+++ b/src/glx/xfont.c
@@ -221,7 +221,10 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
    XGCValues values;
    unsigned long valuemask;
    XFontStruct *fs;
+
+#if !defined(GLX_USE_APPLEGL)
    __GLXDRIdrawable *glxdraw;
+#endif
 
    GLint swapbytes, lsbfirst, rowlength;
    GLint skiprows, skippixels, alignment;
@@ -234,9 +237,11 @@ DRI_glXUseXFont(struct glx_context *CC, Font font, int first, int count, int lis
    dpy = CC->currentDpy;
    win = CC->currentDrawable;
 
+#if !defined(GLX_USE_APPLEGL)
    glxdraw = GetGLXDRIDrawable(CC->currentDpy, CC->currentDrawable);
    if (glxdraw)
       win = glxdraw->xDrawable;
+#endif
 
    fs = XQueryFont(dpy, font);
    if (!fs) {
commit b1b7b5b068441eccac382edab0f0872e3834be45
Author: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
Date:   Tue Feb 10 20:32:02 2015 -0800

    darwin: build fix
    
    ../../../src/mesa/main/compiler.h:47:10: fatal error: 'util/macros.h' file not found
    
    Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
    (cherry picked from commit 1c67a5687a35e984323b6034adb914a66d64bb2f)

diff --git a/src/glx/apple/Makefile.am b/src/glx/apple/Makefile.am
index b500a45..2cbff9e 100644
--- a/src/glx/apple/Makefile.am
+++ b/src/glx/apple/Makefile.am
@@ -3,6 +3,7 @@ EXTRA_DIST = RELEASE_NOTES
 noinst_LTLIBRARIES = libappleglx.la
 
 AM_CFLAGS = \
+	-I$(top_srcdir)/src \
 	-I$(top_srcdir)/include \
 	-I$(top_srcdir)/src/glx \
 	-I$(top_srcdir)/src/mesa \


More information about the Xquartz-changes mailing list