mesa: fix glthread marshal build issues on platforms without PTHREAD
This commit is contained in:
@@ -68,6 +68,8 @@ class PrintCode(gl_XML.gl_print_base):
|
|||||||
print header
|
print header
|
||||||
print '#include <X11/Xlib-xcb.h>'
|
print '#include <X11/Xlib-xcb.h>'
|
||||||
print
|
print
|
||||||
|
print '#ifdef HAVE_PTHREAD'
|
||||||
|
print
|
||||||
print 'static _X_INLINE int safe_mul(int a, int b)'
|
print 'static _X_INLINE int safe_mul(int a, int b)'
|
||||||
print '{'
|
print '{'
|
||||||
print ' if (a < 0 || b < 0) return -1;'
|
print ' if (a < 0 || b < 0) return -1;'
|
||||||
@@ -78,7 +80,8 @@ class PrintCode(gl_XML.gl_print_base):
|
|||||||
print
|
print
|
||||||
|
|
||||||
def printRealFooter(self):
|
def printRealFooter(self):
|
||||||
pass
|
print
|
||||||
|
print '#endif'
|
||||||
|
|
||||||
def print_sync_call(self, func):
|
def print_sync_call(self, func):
|
||||||
call = 'CALL_{0}(ctx->CurrentServerDispatch, ({1}))'.format(
|
call = 'CALL_{0}(ctx->CurrentServerDispatch, ({1}))'.format(
|
||||||
|
@@ -24,18 +24,19 @@
|
|||||||
#ifndef _GLTHREAD_H
|
#ifndef _GLTHREAD_H
|
||||||
#define _GLTHREAD_H
|
#define _GLTHREAD_H
|
||||||
|
|
||||||
|
#include "main/mtypes.h"
|
||||||
|
|
||||||
|
/* Command size is a number of bytes stored in a short. */
|
||||||
|
#define MARSHAL_MAX_CMD_SIZE 65535
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD
|
#ifdef HAVE_PTHREAD
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "main/mtypes.h"
|
|
||||||
|
|
||||||
enum marshal_dispatch_cmd_id;
|
enum marshal_dispatch_cmd_id;
|
||||||
|
|
||||||
/* Command size is a number of bytes stored in a short. */
|
|
||||||
#define MARSHAL_MAX_CMD_SIZE 65535
|
|
||||||
|
|
||||||
struct glthread_state
|
struct glthread_state
|
||||||
{
|
{
|
||||||
/** The worker thread that asynchronously processes our GL commands. */
|
/** The worker thread that asynchronously processes our GL commands. */
|
||||||
@@ -145,5 +146,10 @@ _mesa_glthread_restore_dispatch(struct gl_context *ctx)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
_mesa_glthread_flush_batch(struct gl_context *ctx)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* !HAVE_PTHREAD */
|
#endif /* !HAVE_PTHREAD */
|
||||||
#endif /* _GLTHREAD_H*/
|
#endif /* _GLTHREAD_H*/
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
#include "dispatch.h"
|
#include "dispatch.h"
|
||||||
#include "marshal_generated.h"
|
#include "marshal_generated.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_PTHREAD
|
||||||
|
|
||||||
struct marshal_cmd_Flush
|
struct marshal_cmd_Flush
|
||||||
{
|
{
|
||||||
struct marshal_cmd_base cmd_base;
|
struct marshal_cmd_base cmd_base;
|
||||||
@@ -257,3 +259,4 @@ _mesa_marshal_BindBuffer(GLenum target, GLuint buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@@ -46,6 +46,7 @@ struct marshal_cmd_base
|
|||||||
uint16_t cmd_size;
|
uint16_t cmd_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_PTHREAD
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
_mesa_glthread_allocate_command(struct gl_context *ctx,
|
_mesa_glthread_allocate_command(struct gl_context *ctx,
|
||||||
@@ -66,6 +67,56 @@ _mesa_glthread_allocate_command(struct gl_context *ctx,
|
|||||||
return cmd_base;
|
return cmd_base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instead of conditionally handling marshaling previously-bound user vertex
|
||||||
|
* array data in draw calls (deprecated and removed in GL core), we just
|
||||||
|
* disable threading at the point where the user sets a user vertex array.
|
||||||
|
*/
|
||||||
|
static inline bool
|
||||||
|
_mesa_glthread_is_non_vbo_vertex_attrib_pointer(const struct gl_context *ctx)
|
||||||
|
{
|
||||||
|
struct glthread_state *glthread = ctx->GLThread;
|
||||||
|
|
||||||
|
return ctx->API != API_OPENGL_CORE && !glthread->vertex_array_is_vbo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instead of conditionally handling marshaling immediate index data in draw
|
||||||
|
* calls (deprecated and removed in GL core), we just disable threading.
|
||||||
|
*/
|
||||||
|
static inline bool
|
||||||
|
_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx)
|
||||||
|
{
|
||||||
|
struct glthread_state *glthread = ctx->GLThread;
|
||||||
|
|
||||||
|
return ctx->API != API_OPENGL_CORE && !glthread->element_array_is_vbo;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* FIXME: dummy functions for non PTHREAD platforms */
|
||||||
|
static inline void *
|
||||||
|
_mesa_glthread_allocate_command(struct gl_context *ctx,
|
||||||
|
uint16_t cmd_id,
|
||||||
|
size_t size)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
_mesa_glthread_is_non_vbo_vertex_attrib_pointer(const struct gl_context *ctx)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEBUG_MARSHAL_PRINT_CALLS 0
|
#define DEBUG_MARSHAL_PRINT_CALLS 0
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
@@ -133,31 +184,6 @@ _mesa_glthread_is_compat_bind_vertex_array(const struct gl_context *ctx)
|
|||||||
return ctx->API != API_OPENGL_CORE;
|
return ctx->API != API_OPENGL_CORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Instead of conditionally handling marshaling previously-bound user vertex
|
|
||||||
* array data in draw calls (deprecated and removed in GL core), we just
|
|
||||||
* disable threading at the point where the user sets a user vertex array.
|
|
||||||
*/
|
|
||||||
static inline bool
|
|
||||||
_mesa_glthread_is_non_vbo_vertex_attrib_pointer(const struct gl_context *ctx)
|
|
||||||
{
|
|
||||||
struct glthread_state *glthread = ctx->GLThread;
|
|
||||||
|
|
||||||
return ctx->API != API_OPENGL_CORE && !glthread->vertex_array_is_vbo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instead of conditionally handling marshaling immediate index data in draw
|
|
||||||
* calls (deprecated and removed in GL core), we just disable threading.
|
|
||||||
*/
|
|
||||||
static inline bool
|
|
||||||
_mesa_glthread_is_non_vbo_draw_elements(const struct gl_context *ctx)
|
|
||||||
{
|
|
||||||
struct glthread_state *glthread = ctx->GLThread;
|
|
||||||
|
|
||||||
return ctx->API != API_OPENGL_CORE && !glthread->element_array_is_vbo;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct marshal_cmd_ShaderSource;
|
struct marshal_cmd_ShaderSource;
|
||||||
struct marshal_cmd_Flush;
|
struct marshal_cmd_Flush;
|
||||||
struct marshal_cmd_BindBuffer;
|
struct marshal_cmd_BindBuffer;
|
||||||
|
Reference in New Issue
Block a user