summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:37:56 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-11-22 02:37:56 +0000
commite7a2786346bc6e40b27248cf122036d8c701fa22 (patch)
tree60a88f95fdab80c7ed76d3004fa3e6ef9a5d89d7
parentd519d823a14d9ef7ecbb7d53335573269db47671 (diff)
import Mesa 11.0.6
-rw-r--r--lib/mesa/SConstruct25
-rw-r--r--lib/mesa/include/c11/threads_win32.h10
-rw-r--r--lib/mesa/src/SConscript39
-rw-r--r--lib/mesa/src/glx/SConscript8
-rw-r--r--lib/mesa/src/glx/apple/Makefile.am5
-rw-r--r--lib/mesa/src/glx/dri3_priv.h106
-rw-r--r--lib/mesa/src/glx/indirect_size.h38
7 files changed, 133 insertions, 98 deletions
diff --git a/lib/mesa/SConstruct b/lib/mesa/SConstruct
index 0215aa830..ef71ab69c 100644
--- a/lib/mesa/SConstruct
+++ b/lib/mesa/SConstruct
@@ -1,7 +1,7 @@
#######################################################################
# Top-level SConstruct
#
-# For example, invoke scons as
+# For example, invoke scons as
#
# scons build=debug llvm=yes machine=x86
#
@@ -12,13 +12,13 @@
# build='debug'
# llvm=True
# machine='x86'
-#
+#
# Invoke
#
# scons -h
#
# to get the full list of options. See scons manpage for more info.
-#
+#
import os
import os.path
@@ -36,7 +36,7 @@ common.AddOptions(opts)
env = Environment(
options = opts,
tools = ['gallium'],
- toolpath = ['#scons'],
+ toolpath = ['#scons'],
ENV = os.environ,
)
@@ -50,10 +50,10 @@ except KeyError:
pass
else:
targets = targets.split(',')
- print('scons: warning: targets option is deprecated; pass the targets on their own such as')
- print()
- print(' scons %s' % ' '.join(targets))
- print()
+ print 'scons: warning: targets option is deprecated; pass the targets on their own such as'
+ print
+ print ' scons %s' % ' '.join(targets)
+ print
COMMAND_LINE_TARGETS.append(targets)
@@ -84,14 +84,9 @@ env.Append(CPPPATH = [
#print env.Dump()
-# Add a check target for running tests
-check = env.Alias('check')
-env.AlwaysBuild(check)
-
-
#######################################################################
-# Invoke host SConscripts
-#
+# Invoke host SConscripts
+#
# For things that are meant to be run on the native host build machine, instead
# of the target machine.
#
diff --git a/lib/mesa/include/c11/threads_win32.h b/lib/mesa/include/c11/threads_win32.h
index af7df4b9e..d017c31c3 100644
--- a/lib/mesa/include/c11/threads_win32.h
+++ b/lib/mesa/include/c11/threads_win32.h
@@ -502,13 +502,9 @@ thrd_current(void)
HANDLE hCurrentThread;
BOOL bRet;
- /* GetCurrentThread() returns a pseudo-handle, which we need
- * to pass to DuplicateHandle(). Only the resulting handle can be used
- * from other threads.
- *
- * Note that neither handle can be compared to the one by thread_create.
- * Only the thread IDs - as returned by GetThreadId() and GetCurrentThreadId()
- * can be compared directly.
+ /* GetCurrentThread() returns a pseudo-handle, which is useless. We need
+ * to call DuplicateHandle to get a real handle. However the handle value
+ * will not match the one returned by thread_create.
*
* Other potential solutions would be:
* - define thrd_t as a thread Ids, but this would mean we'd need to OpenThread for many operations
diff --git a/lib/mesa/src/SConscript b/lib/mesa/src/SConscript
index 5e843981e..106b87d42 100644
--- a/lib/mesa/src/SConscript
+++ b/lib/mesa/src/SConscript
@@ -1,52 +1,17 @@
-import filecmp
-import os
-import subprocess
-
Import('*')
+
if env['platform'] == 'windows':
SConscript('getopt/SConscript')
SConscript('util/SConscript')
-SConscript('compiler/SConscript')
+SConscript('glsl/SConscript')
if env['hostonly']:
# We are just compiling the things necessary on the host for cross
# compilation
Return()
-
-def write_git_sha1_h_file(filename):
- """Mesa looks for a git_sha1.h file at compile time in order to display
- the current git hash id in the GL_VERSION string. This function tries
- to retrieve the git hashid and write the header file. An empty file
- will be created if anything goes wrong."""
-
- tempfile = "git_sha1.h.tmp"
- with open(tempfile, "w") as f:
- args = [ 'sh', Dir('#').abspath + '/bin/git_sha1_gen.sh' ]
- try:
- subprocess.Popen(args, stdout=f).wait()
- except:
- print("Warning: exception in write_git_sha1_h_file()")
- return
-
- if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename):
- # The filename does not exist or it's different from the new file,
- # so replace old file with new.
- if os.path.exists(filename):
- os.remove(filename)
- os.rename(tempfile, filename)
- return
-
-
-# Create the git_sha1.h header file
-write_git_sha1_h_file("git_sha1.h")
-# and update CPPPATH so the git_sha1.h header can be found
-env.Append(CPPPATH = ["#" + env['build_dir']])
-
-
-
if env['platform'] != 'windows':
SConscript('loader/SConscript')
diff --git a/lib/mesa/src/glx/SConscript b/lib/mesa/src/glx/SConscript
index ca94d7951..619e4c373 100644
--- a/lib/mesa/src/glx/SConscript
+++ b/lib/mesa/src/glx/SConscript
@@ -40,6 +40,9 @@ if env['HAVE_XF86VIDMODE']:
env.Append(CPPDEFINES = ['XF86VIDMODE'])
env.PkgUseModules('XF86VIDMODE')
+if False: # XXX: SHARED_GLAPI
+ env.Append(CPPDEFINES = ['GLX_SHARED_GLAPI'])
+
sources = [
'clientattrib.c',
'clientinfo.c',
@@ -80,7 +83,6 @@ sources = [
'dri2_glx.c',
'dri2.c',
'dri_common_query_renderer.c',
- 'dri_common_interop.c',
#'dri3_glx.c',
'applegl_glx.c',
]
@@ -106,14 +108,14 @@ env.CodeGenerate(
)
env.CodeGenerate(
- target = 'indirect_size.c',
+ target = 'indirect_size.c',
script = GLAPI + 'gen/glX_proto_size.py',
source = sources,
command = python_cmd + ' $SCRIPT -f $SOURCE -m size_c --only-set > $TARGET'
)
env.CodeGenerate(
- target = 'indirect_init.c',
+ target = 'indirect_init.c',
script = GLAPI + 'gen/glX_proto_send.py',
source = sources,
command = python_cmd + ' $SCRIPT -f $SOURCE -m init_c > $TARGET'
diff --git a/lib/mesa/src/glx/apple/Makefile.am b/lib/mesa/src/glx/apple/Makefile.am
index bfa18b1c2..2cbff9ea9 100644
--- a/lib/mesa/src/glx/apple/Makefile.am
+++ b/lib/mesa/src/glx/apple/Makefile.am
@@ -6,12 +6,13 @@ AM_CFLAGS = \
-I$(top_srcdir)/src \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/glx \
- -I$(top_builddir)/src/mesa \
-I$(top_srcdir)/src/mesa \
+ -I$(top_builddir)/src/mesa \
-I$(top_srcdir)/src/mapi \
- -I$(top_builddir)/src/mapi/glapi \
-I$(top_srcdir)/src/mapi/glapi \
+ -I$(top_builddir)/src/mapi/glapi \
$(VISIBILITY_CFLAGS) \
+ $(SHARED_GLAPI_CFLAGS) \
$(DEFINES) \
$(X11_INCLUDES)
diff --git a/lib/mesa/src/glx/dri3_priv.h b/lib/mesa/src/glx/dri3_priv.h
index 1d3c03f99..160444907 100644
--- a/lib/mesa/src/glx/dri3_priv.h
+++ b/lib/mesa/src/glx/dri3_priv.h
@@ -59,14 +59,50 @@
#include <xcb/present.h>
#include <xcb/sync.h>
-#include "loader_dri3_helper.h"
-
/* From xmlpool/options.h, user exposed so should be stable */
#define DRI_CONF_VBLANK_NEVER 0
#define DRI_CONF_VBLANK_DEF_INTERVAL_0 1
#define DRI_CONF_VBLANK_DEF_INTERVAL_1 2
#define DRI_CONF_VBLANK_ALWAYS_SYNC 3
+enum dri3_buffer_type {
+ dri3_buffer_back = 0,
+ dri3_buffer_front = 1
+};
+
+struct dri3_buffer {
+ __DRIimage *image;
+ __DRIimage *linear_buffer;
+ uint32_t pixmap;
+
+ /* Synchronization between the client and X server is done using an
+ * xshmfence that is mapped into an X server SyncFence. This lets the
+ * client check whether the X server is done using a buffer with a simple
+ * xshmfence call, rather than going to read X events from the wire.
+ *
+ * However, we can only wait for one xshmfence to be triggered at a time,
+ * so we need to know *which* buffer is going to be idle next. We do that
+ * by waiting for a PresentIdleNotify event. When that event arrives, the
+ * 'busy' flag gets cleared and the client knows that the fence has been
+ * triggered, and that the wait call will not block.
+ */
+
+ uint32_t sync_fence; /* XID of X SyncFence object */
+ struct xshmfence *shm_fence; /* pointer to xshmfence object */
+ GLboolean busy; /* Set on swap, cleared on IdleNotify */
+ GLboolean own_pixmap; /* We allocated the pixmap ID, free on destroy */
+ void *driverPrivate;
+
+ uint32_t size;
+ uint32_t pitch;
+ uint32_t cpp;
+ uint32_t flags;
+ uint32_t width, height;
+ uint64_t last_swap;
+
+ enum dri3_buffer_type buffer_type;
+};
+
struct dri3_display
{
__GLXDRIdisplay base;
@@ -96,16 +132,13 @@ struct dri3_screen {
const __DRI2configQueryExtension *config;
const __DRItexBufferExtension *texBuffer;
const __DRI2rendererQueryExtension *rendererQuery;
- const __DRI2interopExtension *interop;
const __DRIconfig **driver_configs;
void *driver;
int fd;
- bool is_different_gpu;
+ int is_different_gpu;
int show_fps_interval;
-
- struct loader_dri3_extensions loader_dri3_ext;
};
struct dri3_context
@@ -114,10 +147,60 @@ struct dri3_context
__DRIcontext *driContext;
};
+#define DRI3_MAX_BACK 4
+#define DRI3_BACK_ID(i) (i)
+#define DRI3_FRONT_ID (DRI3_MAX_BACK)
+
+static inline int
+dri3_pixmap_buf_id(enum dri3_buffer_type buffer_type)
+{
+ if (buffer_type == dri3_buffer_back)
+ return DRI3_BACK_ID(0);
+ else
+ return DRI3_FRONT_ID;
+}
+
+#define DRI3_NUM_BUFFERS (1 + DRI3_MAX_BACK)
+
struct dri3_drawable {
__GLXDRIdrawable base;
- struct loader_dri3_drawable loader_drawable;
+ __DRIdrawable *driDrawable;
+ int width, height, depth;
int swap_interval;
+ uint8_t have_back;
+ uint8_t have_fake_front;
+ uint8_t is_pixmap;
+ uint8_t flipping;
+
+ /* Present extension capabilities
+ */
+ uint32_t present_capabilities;
+
+ /* SBC numbers are tracked by using the serial numbers
+ * in the present request and complete events
+ */
+ uint64_t send_sbc;
+ uint64_t recv_sbc;
+
+ /* Last received UST/MSC values for pixmap present complete */
+ uint64_t ust, msc;
+
+ /* Last received UST/MSC values from present notify msc event */
+ uint64_t notify_ust, notify_msc;
+
+ /* Serial numbers for tracking wait_for_msc events */
+ uint32_t send_msc_serial;
+ uint32_t recv_msc_serial;
+
+ struct dri3_buffer *buffers[DRI3_NUM_BUFFERS];
+ int cur_back;
+ int num_back;
+
+ uint32_t *stamp;
+
+ xcb_present_event_t eid;
+ xcb_gcontext_t gc;
+ xcb_special_event_t *special_event;
/* LIBGL_SHOW_FPS support */
uint64_t previous_ust;
@@ -132,12 +215,3 @@ dri3_query_renderer_integer(struct glx_screen *base, int attribute,
_X_HIDDEN int
dri3_query_renderer_string(struct glx_screen *base, int attribute,
const char **value);
-
-_X_HIDDEN int
-dri3_interop_query_device_info(struct glx_context *ctx,
- struct mesa_glinterop_device_info *out);
-
-_X_HIDDEN int
-dri3_interop_export_object(struct glx_context *ctx,
- struct mesa_glinterop_export_in *in,
- struct mesa_glinterop_export_out *out);
diff --git a/lib/mesa/src/glx/indirect_size.h b/lib/mesa/src/glx/indirect_size.h
index 52ef10e5e..fec7ed393 100644
--- a/lib/mesa/src/glx/indirect_size.h
+++ b/lib/mesa/src/glx/indirect_size.h
@@ -3,18 +3,18 @@
/*
* (C) Copyright IBM Corporation 2004
* All Rights Reserved.
- *
+ *
* 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, sub license,
* 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 (including the next
* paragraph) 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 NON-INFRINGEMENT. IN NO EVENT SHALL
@@ -26,7 +26,7 @@
*/
#if !defined( _INDIRECT_SIZE_H_ )
-# define _INDIRECT_SIZE_H_
+#define _INDIRECT_SIZE_H_
/**
* \file
@@ -38,17 +38,17 @@
#include <X11/Xfuncproto.h>
-# if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
-# define PURE __attribute__((pure))
-# else
-# define PURE
-# endif
+#if defined(__GNUC__) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
+#define PURE __attribute__((pure))
+#else
+#define PURE
+#endif
-# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-# define FASTCALL __attribute__((fastcall))
-# else
-# define FASTCALL
-# endif
+#if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+#define FASTCALL __attribute__((fastcall))
+#else
+#define FASTCALL
+#endif
extern _X_INTERNAL PURE FASTCALL GLint __glCallLists_size(GLenum);
extern _X_INTERNAL PURE FASTCALL GLint __glFogfv_size(GLenum);
@@ -72,12 +72,14 @@ extern _X_INTERNAL PURE FASTCALL GLint __glMap2d_size(GLenum);
extern _X_INTERNAL PURE FASTCALL GLint __glMap2f_size(GLenum);
extern _X_INTERNAL PURE FASTCALL GLint __glColorTableParameterfv_size(GLenum);
extern _X_INTERNAL PURE FASTCALL GLint __glColorTableParameteriv_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glConvolutionParameterfv_size(GLenum);
-extern _X_INTERNAL PURE FASTCALL GLint __glConvolutionParameteriv_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint
+__glConvolutionParameterfv_size(GLenum);
+extern _X_INTERNAL PURE FASTCALL GLint
+__glConvolutionParameteriv_size(GLenum);
extern _X_INTERNAL PURE FASTCALL GLint __glPointParameterfv_size(GLenum);
extern _X_INTERNAL PURE FASTCALL GLint __glPointParameteriv_size(GLenum);
-# undef PURE
-# undef FASTCALL
+#undef PURE
+#undef FASTCALL
#endif /* !defined( _INDIRECT_SIZE_H_ ) */