mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 18:10:11 +01:00
mesa: switch to c11 mutex functions
Reviewed-by: José Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
2706db701d
commit
d129ea7fa2
21 changed files with 141 additions and 141 deletions
|
|
@ -34,7 +34,7 @@ SEARCH_INCLUDES = YES
|
||||||
INCLUDE_PATH = ../include/
|
INCLUDE_PATH = ../include/
|
||||||
INCLUDE_FILE_PATTERNS =
|
INCLUDE_FILE_PATTERNS =
|
||||||
PREDEFINED =
|
PREDEFINED =
|
||||||
EXPAND_AS_DEFINED = _glthread_DECLARE_STATIC_MUTEX
|
EXPAND_AS_DEFINED =
|
||||||
SKIP_FUNCTION_MACROS = YES
|
SKIP_FUNCTION_MACROS = YES
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Configuration::addtions related to external references
|
# Configuration::addtions related to external references
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ _mesa_delete_vao(struct gl_context *ctx, struct gl_vertex_array_object *obj)
|
||||||
{
|
{
|
||||||
unbind_array_object_vbos(ctx, obj);
|
unbind_array_object_vbos(ctx, obj);
|
||||||
_mesa_reference_buffer_object(ctx, &obj->IndexBufferObj, NULL);
|
_mesa_reference_buffer_object(ctx, &obj->IndexBufferObj, NULL);
|
||||||
_glthread_DESTROY_MUTEX(obj->Mutex);
|
mtx_destroy(&obj->Mutex);
|
||||||
free(obj->Label);
|
free(obj->Label);
|
||||||
free(obj);
|
free(obj);
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +142,7 @@ _mesa_reference_vao_(struct gl_context *ctx,
|
||||||
GLboolean deleteFlag = GL_FALSE;
|
GLboolean deleteFlag = GL_FALSE;
|
||||||
struct gl_vertex_array_object *oldObj = *ptr;
|
struct gl_vertex_array_object *oldObj = *ptr;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(oldObj->Mutex);
|
mtx_lock(&oldObj->Mutex);
|
||||||
ASSERT(oldObj->RefCount > 0);
|
ASSERT(oldObj->RefCount > 0);
|
||||||
oldObj->RefCount--;
|
oldObj->RefCount--;
|
||||||
#if 0
|
#if 0
|
||||||
|
|
@ -150,7 +150,7 @@ _mesa_reference_vao_(struct gl_context *ctx,
|
||||||
(void *) oldObj, oldObj->Name, oldObj->RefCount);
|
(void *) oldObj, oldObj->Name, oldObj->RefCount);
|
||||||
#endif
|
#endif
|
||||||
deleteFlag = (oldObj->RefCount == 0);
|
deleteFlag = (oldObj->RefCount == 0);
|
||||||
_glthread_UNLOCK_MUTEX(oldObj->Mutex);
|
mtx_unlock(&oldObj->Mutex);
|
||||||
|
|
||||||
if (deleteFlag) {
|
if (deleteFlag) {
|
||||||
ASSERT(ctx->Driver.DeleteArrayObject);
|
ASSERT(ctx->Driver.DeleteArrayObject);
|
||||||
|
|
@ -163,7 +163,7 @@ _mesa_reference_vao_(struct gl_context *ctx,
|
||||||
|
|
||||||
if (vao) {
|
if (vao) {
|
||||||
/* reference new array object */
|
/* reference new array object */
|
||||||
_glthread_LOCK_MUTEX(vao->Mutex);
|
mtx_lock(&vao->Mutex);
|
||||||
if (vao->RefCount == 0) {
|
if (vao->RefCount == 0) {
|
||||||
/* this array's being deleted (look just above) */
|
/* this array's being deleted (look just above) */
|
||||||
/* Not sure this can every really happen. Warn if it does. */
|
/* Not sure this can every really happen. Warn if it does. */
|
||||||
|
|
@ -178,7 +178,7 @@ _mesa_reference_vao_(struct gl_context *ctx,
|
||||||
#endif
|
#endif
|
||||||
*ptr = vao;
|
*ptr = vao;
|
||||||
}
|
}
|
||||||
_glthread_UNLOCK_MUTEX(vao->Mutex);
|
mtx_unlock(&vao->Mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,7 +226,7 @@ _mesa_initialize_vao(struct gl_context *ctx,
|
||||||
|
|
||||||
obj->Name = name;
|
obj->Name = name;
|
||||||
|
|
||||||
_glthread_INIT_MUTEX(obj->Mutex);
|
mtx_init(&obj->Mutex, mtx_plain);
|
||||||
obj->RefCount = 1;
|
obj->RefCount = 1;
|
||||||
|
|
||||||
/* Init the individual arrays */
|
/* Init the individual arrays */
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,7 @@ _mesa_delete_buffer_object(struct gl_context *ctx,
|
||||||
bufObj->RefCount = -1000;
|
bufObj->RefCount = -1000;
|
||||||
bufObj->Name = ~0;
|
bufObj->Name = ~0;
|
||||||
|
|
||||||
_glthread_DESTROY_MUTEX(bufObj->Mutex);
|
mtx_destroy(&bufObj->Mutex);
|
||||||
free(bufObj->Label);
|
free(bufObj->Label);
|
||||||
free(bufObj);
|
free(bufObj);
|
||||||
}
|
}
|
||||||
|
|
@ -439,7 +439,7 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
|
||||||
GLboolean deleteFlag = GL_FALSE;
|
GLboolean deleteFlag = GL_FALSE;
|
||||||
struct gl_buffer_object *oldObj = *ptr;
|
struct gl_buffer_object *oldObj = *ptr;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(oldObj->Mutex);
|
mtx_lock(&oldObj->Mutex);
|
||||||
ASSERT(oldObj->RefCount > 0);
|
ASSERT(oldObj->RefCount > 0);
|
||||||
oldObj->RefCount--;
|
oldObj->RefCount--;
|
||||||
#if 0
|
#if 0
|
||||||
|
|
@ -447,7 +447,7 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
|
||||||
(void *) oldObj, oldObj->Name, oldObj->RefCount);
|
(void *) oldObj, oldObj->Name, oldObj->RefCount);
|
||||||
#endif
|
#endif
|
||||||
deleteFlag = (oldObj->RefCount == 0);
|
deleteFlag = (oldObj->RefCount == 0);
|
||||||
_glthread_UNLOCK_MUTEX(oldObj->Mutex);
|
mtx_unlock(&oldObj->Mutex);
|
||||||
|
|
||||||
if (deleteFlag) {
|
if (deleteFlag) {
|
||||||
|
|
||||||
|
|
@ -469,7 +469,7 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
|
||||||
|
|
||||||
if (bufObj) {
|
if (bufObj) {
|
||||||
/* reference new buffer */
|
/* reference new buffer */
|
||||||
_glthread_LOCK_MUTEX(bufObj->Mutex);
|
mtx_lock(&bufObj->Mutex);
|
||||||
if (bufObj->RefCount == 0) {
|
if (bufObj->RefCount == 0) {
|
||||||
/* this buffer's being deleted (look just above) */
|
/* this buffer's being deleted (look just above) */
|
||||||
/* Not sure this can every really happen. Warn if it does. */
|
/* Not sure this can every really happen. Warn if it does. */
|
||||||
|
|
@ -484,7 +484,7 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
|
||||||
#endif
|
#endif
|
||||||
*ptr = bufObj;
|
*ptr = bufObj;
|
||||||
}
|
}
|
||||||
_glthread_UNLOCK_MUTEX(bufObj->Mutex);
|
mtx_unlock(&bufObj->Mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -500,7 +500,7 @@ _mesa_initialize_buffer_object( struct gl_context *ctx,
|
||||||
(void) target;
|
(void) target;
|
||||||
|
|
||||||
memset(obj, 0, sizeof(struct gl_buffer_object));
|
memset(obj, 0, sizeof(struct gl_buffer_object));
|
||||||
_glthread_INIT_MUTEX(obj->Mutex);
|
mtx_init(&obj->Mutex, mtx_plain);
|
||||||
obj->RefCount = 1;
|
obj->RefCount = 1;
|
||||||
obj->Name = name;
|
obj->Name = name;
|
||||||
obj->Usage = GL_STATIC_DRAW_ARB;
|
obj->Usage = GL_STATIC_DRAW_ARB;
|
||||||
|
|
@ -818,7 +818,7 @@ _mesa_init_buffer_objects( struct gl_context *ctx )
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
|
memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
|
||||||
_glthread_INIT_MUTEX(DummyBufferObject.Mutex);
|
mtx_init(&DummyBufferObject.Mutex, mtx_plain);
|
||||||
DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
|
DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
|
||||||
|
|
||||||
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
|
_mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
|
||||||
|
|
@ -1070,7 +1070,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]);
|
struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]);
|
||||||
|
|
@ -1157,7 +1157,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1189,7 +1189,7 @@ _mesa_GenBuffers(GLsizei n, GLuint *buffer)
|
||||||
/*
|
/*
|
||||||
* This must be atomic (generation and allocation of buffer object IDs)
|
* This must be atomic (generation and allocation of buffer object IDs)
|
||||||
*/
|
*/
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
|
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
|
||||||
|
|
||||||
|
|
@ -1200,7 +1200,7 @@ _mesa_GenBuffers(GLsizei n, GLuint *buffer)
|
||||||
buffer[i] = first + i;
|
buffer[i] = first + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1218,9 +1218,9 @@ _mesa_IsBuffer(GLuint id)
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
bufObj = _mesa_lookup_bufferobj(ctx, id);
|
bufObj = _mesa_lookup_bufferobj(ctx, id);
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
return bufObj && bufObj != &DummyBufferObject;
|
return bufObj && bufObj != &DummyBufferObject;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,7 @@ dummy_enum_func(void)
|
||||||
*
|
*
|
||||||
* \sa Used by one_time_init().
|
* \sa Used by one_time_init().
|
||||||
*/
|
*/
|
||||||
_glthread_DECLARE_STATIC_MUTEX(OneTimeLock);
|
mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -382,7 +382,7 @@ one_time_init( struct gl_context *ctx )
|
||||||
{
|
{
|
||||||
static GLbitfield api_init_mask = 0x0;
|
static GLbitfield api_init_mask = 0x0;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(OneTimeLock);
|
mtx_lock(&OneTimeLock);
|
||||||
|
|
||||||
/* truly one-time init */
|
/* truly one-time init */
|
||||||
if (!api_init_mask) {
|
if (!api_init_mask) {
|
||||||
|
|
@ -423,7 +423,7 @@ one_time_init( struct gl_context *ctx )
|
||||||
|
|
||||||
api_init_mask |= 1 << ctx->API;
|
api_init_mask |= 1 << ctx->API;
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(OneTimeLock);
|
mtx_unlock(&OneTimeLock);
|
||||||
|
|
||||||
/* Hopefully atexit() is widely available. If not, we may need some
|
/* Hopefully atexit() is widely available. If not, we may need some
|
||||||
* #ifdef tests here.
|
* #ifdef tests here.
|
||||||
|
|
|
||||||
|
|
@ -8177,7 +8177,7 @@ _mesa_GenLists(GLsizei range)
|
||||||
/*
|
/*
|
||||||
* Make this an atomic operation
|
* Make this an atomic operation
|
||||||
*/
|
*/
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
|
base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range);
|
||||||
if (base) {
|
if (base) {
|
||||||
|
|
@ -8189,7 +8189,7 @@ _mesa_GenLists(GLsizei range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
#define MESSAGE_LOG 1
|
#define MESSAGE_LOG 1
|
||||||
#define MESSAGE_LOG_ARB 2
|
#define MESSAGE_LOG_ARB 2
|
||||||
|
|
||||||
_glthread_DECLARE_STATIC_MUTEX(DynamicIDMutex);
|
static mtx_t DynamicIDMutex = _MTX_INITIALIZER_NP;
|
||||||
static GLuint NextDynamicID = 1;
|
static GLuint NextDynamicID = 1;
|
||||||
|
|
||||||
struct gl_debug_severity
|
struct gl_debug_severity
|
||||||
|
|
@ -136,10 +136,10 @@ static void
|
||||||
debug_get_id(GLuint *id)
|
debug_get_id(GLuint *id)
|
||||||
{
|
{
|
||||||
if (!(*id)) {
|
if (!(*id)) {
|
||||||
_glthread_LOCK_MUTEX(DynamicIDMutex);
|
mtx_lock(&DynamicIDMutex);
|
||||||
if (!(*id))
|
if (!(*id))
|
||||||
*id = NextDynamicID++;
|
*id = NextDynamicID++;
|
||||||
_glthread_UNLOCK_MUTEX(DynamicIDMutex);
|
mtx_unlock(&DynamicIDMutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
#define EXEC_HEAP_SIZE (10*1024*1024)
|
#define EXEC_HEAP_SIZE (10*1024*1024)
|
||||||
|
|
||||||
_glthread_DECLARE_STATIC_MUTEX(exec_mutex);
|
static mtx_t exec_mutex = _MTX_INITIALIZER_NP;
|
||||||
|
|
||||||
static struct mem_block *exec_heap = NULL;
|
static struct mem_block *exec_heap = NULL;
|
||||||
static unsigned char *exec_mem = NULL;
|
static unsigned char *exec_mem = NULL;
|
||||||
|
|
@ -93,7 +93,7 @@ _mesa_exec_malloc(GLuint size)
|
||||||
struct mem_block *block = NULL;
|
struct mem_block *block = NULL;
|
||||||
void *addr = NULL;
|
void *addr = NULL;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(exec_mutex);
|
mtx_lock(&exec_mutex);
|
||||||
|
|
||||||
if (!init_heap())
|
if (!init_heap())
|
||||||
goto bail;
|
goto bail;
|
||||||
|
|
@ -109,7 +109,7 @@ _mesa_exec_malloc(GLuint size)
|
||||||
printf("_mesa_exec_malloc failed\n");
|
printf("_mesa_exec_malloc failed\n");
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
_glthread_UNLOCK_MUTEX(exec_mutex);
|
mtx_unlock(&exec_mutex);
|
||||||
|
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +118,7 @@ bail:
|
||||||
void
|
void
|
||||||
_mesa_exec_free(void *addr)
|
_mesa_exec_free(void *addr)
|
||||||
{
|
{
|
||||||
_glthread_LOCK_MUTEX(exec_mutex);
|
mtx_lock(&exec_mutex);
|
||||||
|
|
||||||
if (exec_heap) {
|
if (exec_heap) {
|
||||||
struct mem_block *block = mmFindBlock(exec_heap, (unsigned char *)addr - exec_mem);
|
struct mem_block *block = mmFindBlock(exec_heap, (unsigned char *)addr - exec_mem);
|
||||||
|
|
@ -127,7 +127,7 @@ _mesa_exec_free(void *addr)
|
||||||
mmFreeMem(block);
|
mmFreeMem(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(exec_mutex);
|
mtx_unlock(&exec_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,9 +89,9 @@ delete_dummy_framebuffer(struct gl_framebuffer *fb)
|
||||||
void
|
void
|
||||||
_mesa_init_fbobjects(struct gl_context *ctx)
|
_mesa_init_fbobjects(struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
_glthread_INIT_MUTEX(DummyFramebuffer.Mutex);
|
mtx_init(&DummyFramebuffer.Mutex, mtx_plain);
|
||||||
_glthread_INIT_MUTEX(DummyRenderbuffer.Mutex);
|
mtx_init(&DummyRenderbuffer.Mutex, mtx_plain);
|
||||||
_glthread_INIT_MUTEX(IncompleteFramebuffer.Mutex);
|
mtx_init(&IncompleteFramebuffer.Mutex, mtx_plain);
|
||||||
DummyFramebuffer.Delete = delete_dummy_framebuffer;
|
DummyFramebuffer.Delete = delete_dummy_framebuffer;
|
||||||
DummyRenderbuffer.Delete = delete_dummy_renderbuffer;
|
DummyRenderbuffer.Delete = delete_dummy_renderbuffer;
|
||||||
IncompleteFramebuffer.Delete = delete_dummy_framebuffer;
|
IncompleteFramebuffer.Delete = delete_dummy_framebuffer;
|
||||||
|
|
@ -484,7 +484,7 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
|
||||||
{
|
{
|
||||||
struct gl_renderbuffer_attachment *att;
|
struct gl_renderbuffer_attachment *att;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(fb->Mutex);
|
mtx_lock(&fb->Mutex);
|
||||||
|
|
||||||
att = get_attachment(ctx, fb, attachment);
|
att = get_attachment(ctx, fb, attachment);
|
||||||
ASSERT(att);
|
ASSERT(att);
|
||||||
|
|
@ -504,7 +504,7 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx,
|
||||||
|
|
||||||
invalidate_framebuffer(fb);
|
invalidate_framebuffer(fb);
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(fb->Mutex);
|
mtx_unlock(&fb->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1352,9 +1352,9 @@ _mesa_GenRenderbuffers(GLsizei n, GLuint *renderbuffers)
|
||||||
GLuint name = first + i;
|
GLuint name = first + i;
|
||||||
renderbuffers[i] = name;
|
renderbuffers[i] = name;
|
||||||
/* insert dummy placeholder into hash table */
|
/* insert dummy placeholder into hash table */
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
_mesa_HashInsert(ctx->Shared->RenderBuffers, name, &DummyRenderbuffer);
|
_mesa_HashInsert(ctx->Shared->RenderBuffers, name, &DummyRenderbuffer);
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2218,9 +2218,9 @@ _mesa_GenFramebuffers(GLsizei n, GLuint *framebuffers)
|
||||||
GLuint name = first + i;
|
GLuint name = first + i;
|
||||||
framebuffers[i] = name;
|
framebuffers[i] = name;
|
||||||
/* insert dummy placeholder into hash table */
|
/* insert dummy placeholder into hash table */
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
_mesa_HashInsert(ctx->Shared->FrameBuffers, name, &DummyFramebuffer);
|
_mesa_HashInsert(ctx->Shared->FrameBuffers, name, &DummyFramebuffer);
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2433,7 +2433,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
|
||||||
|
|
||||||
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
|
FLUSH_VERTICES(ctx, _NEW_BUFFERS);
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(fb->Mutex);
|
mtx_lock(&fb->Mutex);
|
||||||
if (texObj) {
|
if (texObj) {
|
||||||
if (attachment == GL_DEPTH_ATTACHMENT &&
|
if (attachment == GL_DEPTH_ATTACHMENT &&
|
||||||
texObj == fb->Attachment[BUFFER_STENCIL].Texture &&
|
texObj == fb->Attachment[BUFFER_STENCIL].Texture &&
|
||||||
|
|
@ -2491,7 +2491,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
|
||||||
|
|
||||||
invalidate_framebuffer(fb);
|
invalidate_framebuffer(fb);
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(fb->Mutex);
|
mtx_unlock(&fb->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ _mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
|
||||||
|
|
||||||
memset(fb, 0, sizeof(struct gl_framebuffer));
|
memset(fb, 0, sizeof(struct gl_framebuffer));
|
||||||
|
|
||||||
_glthread_INIT_MUTEX(fb->Mutex);
|
mtx_init(&fb->Mutex, mtx_plain);
|
||||||
|
|
||||||
fb->RefCount = 1;
|
fb->RefCount = 1;
|
||||||
|
|
||||||
|
|
@ -182,7 +182,7 @@ _mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name)
|
||||||
fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT;
|
fb->ColorReadBuffer = GL_COLOR_ATTACHMENT0_EXT;
|
||||||
fb->_ColorReadBufferIndex = BUFFER_COLOR0;
|
fb->_ColorReadBufferIndex = BUFFER_COLOR0;
|
||||||
fb->Delete = _mesa_destroy_framebuffer;
|
fb->Delete = _mesa_destroy_framebuffer;
|
||||||
_glthread_INIT_MUTEX(fb->Mutex);
|
mtx_init(&fb->Mutex, mtx_plain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -213,7 +213,7 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
|
||||||
assert(fb);
|
assert(fb);
|
||||||
assert(fb->RefCount == 0);
|
assert(fb->RefCount == 0);
|
||||||
|
|
||||||
_glthread_DESTROY_MUTEX(fb->Mutex);
|
mtx_destroy(&fb->Mutex);
|
||||||
|
|
||||||
for (i = 0; i < BUFFER_COUNT; i++) {
|
for (i = 0; i < BUFFER_COUNT; i++) {
|
||||||
struct gl_renderbuffer_attachment *att = &fb->Attachment[i];
|
struct gl_renderbuffer_attachment *att = &fb->Attachment[i];
|
||||||
|
|
@ -244,11 +244,11 @@ _mesa_reference_framebuffer_(struct gl_framebuffer **ptr,
|
||||||
GLboolean deleteFlag = GL_FALSE;
|
GLboolean deleteFlag = GL_FALSE;
|
||||||
struct gl_framebuffer *oldFb = *ptr;
|
struct gl_framebuffer *oldFb = *ptr;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(oldFb->Mutex);
|
mtx_lock(&oldFb->Mutex);
|
||||||
ASSERT(oldFb->RefCount > 0);
|
ASSERT(oldFb->RefCount > 0);
|
||||||
oldFb->RefCount--;
|
oldFb->RefCount--;
|
||||||
deleteFlag = (oldFb->RefCount == 0);
|
deleteFlag = (oldFb->RefCount == 0);
|
||||||
_glthread_UNLOCK_MUTEX(oldFb->Mutex);
|
mtx_unlock(&oldFb->Mutex);
|
||||||
|
|
||||||
if (deleteFlag)
|
if (deleteFlag)
|
||||||
oldFb->Delete(oldFb);
|
oldFb->Delete(oldFb);
|
||||||
|
|
@ -258,9 +258,9 @@ _mesa_reference_framebuffer_(struct gl_framebuffer **ptr,
|
||||||
assert(!*ptr);
|
assert(!*ptr);
|
||||||
|
|
||||||
if (fb) {
|
if (fb) {
|
||||||
_glthread_LOCK_MUTEX(fb->Mutex);
|
mtx_lock(&fb->Mutex);
|
||||||
fb->RefCount++;
|
fb->RefCount++;
|
||||||
_glthread_UNLOCK_MUTEX(fb->Mutex);
|
mtx_unlock(&fb->Mutex);
|
||||||
*ptr = fb;
|
*ptr = fb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ _mesa_GetGraphicsResetStatusARB( void )
|
||||||
*/
|
*/
|
||||||
status = ctx->Driver.GetGraphicsResetStatus(ctx);
|
status = ctx->Driver.GetGraphicsResetStatus(ctx);
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
/* If this context has not been affected by a GPU reset, check to see if
|
/* If this context has not been affected by a GPU reset, check to see if
|
||||||
* some other context in the share group has been affected by a reset.
|
* some other context in the share group has been affected by a reset.
|
||||||
|
|
@ -348,7 +348,7 @@ _mesa_GetGraphicsResetStatusARB( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->ShareGroupReset = ctx->Shared->ShareGroupReset;
|
ctx->ShareGroupReset = ctx->Shared->ShareGroupReset;
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ctx->Driver.GetGraphicsResetStatus && (MESA_VERBOSE & VERBOSE_API))
|
if (!ctx->Driver.GetGraphicsResetStatus && (MESA_VERBOSE & VERBOSE_API))
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@
|
||||||
struct _mesa_HashTable {
|
struct _mesa_HashTable {
|
||||||
struct hash_table *ht;
|
struct hash_table *ht;
|
||||||
GLuint MaxKey; /**< highest key inserted so far */
|
GLuint MaxKey; /**< highest key inserted so far */
|
||||||
_glthread_Mutex Mutex; /**< mutual exclusion lock */
|
mtx_t Mutex; /**< mutual exclusion lock */
|
||||||
_glthread_Mutex WalkMutex; /**< for _mesa_HashWalk() */
|
mtx_t WalkMutex; /**< for _mesa_HashWalk() */
|
||||||
GLboolean InDeleteAll; /**< Debug check */
|
GLboolean InDeleteAll; /**< Debug check */
|
||||||
/** Value that would be in the table for DELETED_KEY_VALUE. */
|
/** Value that would be in the table for DELETED_KEY_VALUE. */
|
||||||
void *deleted_key_data;
|
void *deleted_key_data;
|
||||||
|
|
@ -117,8 +117,8 @@ _mesa_NewHashTable(void)
|
||||||
if (table) {
|
if (table) {
|
||||||
table->ht = _mesa_hash_table_create(NULL, uint_key_compare);
|
table->ht = _mesa_hash_table_create(NULL, uint_key_compare);
|
||||||
_mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
|
_mesa_hash_table_set_deleted_key(table->ht, uint_key(DELETED_KEY_VALUE));
|
||||||
_glthread_INIT_MUTEX(table->Mutex);
|
mtx_init(&table->Mutex, mtx_plain);
|
||||||
_glthread_INIT_MUTEX(table->WalkMutex);
|
mtx_init(&table->WalkMutex, mtx_plain);
|
||||||
}
|
}
|
||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
@ -144,8 +144,8 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
|
||||||
|
|
||||||
_mesa_hash_table_destroy(table->ht, NULL);
|
_mesa_hash_table_destroy(table->ht, NULL);
|
||||||
|
|
||||||
_glthread_DESTROY_MUTEX(table->Mutex);
|
mtx_destroy(&table->Mutex);
|
||||||
_glthread_DESTROY_MUTEX(table->WalkMutex);
|
mtx_destroy(&table->WalkMutex);
|
||||||
free(table);
|
free(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,9 +187,9 @@ _mesa_HashLookup(struct _mesa_HashTable *table, GLuint key)
|
||||||
{
|
{
|
||||||
void *res;
|
void *res;
|
||||||
assert(table);
|
assert(table);
|
||||||
_glthread_LOCK_MUTEX(table->Mutex);
|
mtx_lock(&table->Mutex);
|
||||||
res = _mesa_HashLookup_unlocked(table, key);
|
res = _mesa_HashLookup_unlocked(table, key);
|
||||||
_glthread_UNLOCK_MUTEX(table->Mutex);
|
mtx_unlock(&table->Mutex);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -211,7 +211,7 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
|
||||||
assert(table);
|
assert(table);
|
||||||
assert(key);
|
assert(key);
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(table->Mutex);
|
mtx_lock(&table->Mutex);
|
||||||
|
|
||||||
if (key > table->MaxKey)
|
if (key > table->MaxKey)
|
||||||
table->MaxKey = key;
|
table->MaxKey = key;
|
||||||
|
|
@ -227,7 +227,7 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(table->Mutex);
|
mtx_unlock(&table->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -256,14 +256,14 @@ _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(table->Mutex);
|
mtx_lock(&table->Mutex);
|
||||||
if (key == DELETED_KEY_VALUE) {
|
if (key == DELETED_KEY_VALUE) {
|
||||||
table->deleted_key_data = NULL;
|
table->deleted_key_data = NULL;
|
||||||
} else {
|
} else {
|
||||||
entry = _mesa_hash_table_search(table->ht, uint_hash(key), uint_key(key));
|
entry = _mesa_hash_table_search(table->ht, uint_hash(key), uint_key(key));
|
||||||
_mesa_hash_table_remove(table->ht, entry);
|
_mesa_hash_table_remove(table->ht, entry);
|
||||||
}
|
}
|
||||||
_glthread_UNLOCK_MUTEX(table->Mutex);
|
mtx_unlock(&table->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -286,7 +286,7 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
|
||||||
|
|
||||||
ASSERT(table);
|
ASSERT(table);
|
||||||
ASSERT(callback);
|
ASSERT(callback);
|
||||||
_glthread_LOCK_MUTEX(table->Mutex);
|
mtx_lock(&table->Mutex);
|
||||||
table->InDeleteAll = GL_TRUE;
|
table->InDeleteAll = GL_TRUE;
|
||||||
hash_table_foreach(table->ht, entry) {
|
hash_table_foreach(table->ht, entry) {
|
||||||
callback((uintptr_t)entry->key, entry->data, userData);
|
callback((uintptr_t)entry->key, entry->data, userData);
|
||||||
|
|
@ -297,7 +297,7 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
|
||||||
table->deleted_key_data = NULL;
|
table->deleted_key_data = NULL;
|
||||||
}
|
}
|
||||||
table->InDeleteAll = GL_FALSE;
|
table->InDeleteAll = GL_FALSE;
|
||||||
_glthread_UNLOCK_MUTEX(table->Mutex);
|
mtx_unlock(&table->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -315,7 +315,7 @@ _mesa_HashClone(const struct _mesa_HashTable *table)
|
||||||
struct _mesa_HashTable *clonetable;
|
struct _mesa_HashTable *clonetable;
|
||||||
|
|
||||||
ASSERT(table);
|
ASSERT(table);
|
||||||
_glthread_LOCK_MUTEX(table2->Mutex);
|
mtx_lock(&table2->Mutex);
|
||||||
|
|
||||||
clonetable = _mesa_NewHashTable();
|
clonetable = _mesa_NewHashTable();
|
||||||
assert(clonetable);
|
assert(clonetable);
|
||||||
|
|
@ -323,7 +323,7 @@ _mesa_HashClone(const struct _mesa_HashTable *table)
|
||||||
_mesa_HashInsert(clonetable, (GLint)(uintptr_t)entry->key, entry->data);
|
_mesa_HashInsert(clonetable, (GLint)(uintptr_t)entry->key, entry->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(table2->Mutex);
|
mtx_unlock(&table2->Mutex);
|
||||||
|
|
||||||
return clonetable;
|
return clonetable;
|
||||||
}
|
}
|
||||||
|
|
@ -352,13 +352,13 @@ _mesa_HashWalk(const struct _mesa_HashTable *table,
|
||||||
|
|
||||||
ASSERT(table);
|
ASSERT(table);
|
||||||
ASSERT(callback);
|
ASSERT(callback);
|
||||||
_glthread_LOCK_MUTEX(table2->WalkMutex);
|
mtx_lock(&table2->WalkMutex);
|
||||||
hash_table_foreach(table->ht, entry) {
|
hash_table_foreach(table->ht, entry) {
|
||||||
callback((uintptr_t)entry->key, entry->data, userData);
|
callback((uintptr_t)entry->key, entry->data, userData);
|
||||||
}
|
}
|
||||||
if (table->deleted_key_data)
|
if (table->deleted_key_data)
|
||||||
callback(DELETED_KEY_VALUE, table->deleted_key_data, userData);
|
callback(DELETED_KEY_VALUE, table->deleted_key_data, userData);
|
||||||
_glthread_UNLOCK_MUTEX(table2->WalkMutex);
|
mtx_unlock(&table2->WalkMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -398,10 +398,10 @@ GLuint
|
||||||
_mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
|
_mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
|
||||||
{
|
{
|
||||||
const GLuint maxKey = ~((GLuint) 0) - 1;
|
const GLuint maxKey = ~((GLuint) 0) - 1;
|
||||||
_glthread_LOCK_MUTEX(table->Mutex);
|
mtx_lock(&table->Mutex);
|
||||||
if (maxKey - numKeys > table->MaxKey) {
|
if (maxKey - numKeys > table->MaxKey) {
|
||||||
/* the quick solution */
|
/* the quick solution */
|
||||||
_glthread_UNLOCK_MUTEX(table->Mutex);
|
mtx_unlock(&table->Mutex);
|
||||||
return table->MaxKey + 1;
|
return table->MaxKey + 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -419,13 +419,13 @@ _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys)
|
||||||
/* this key not in use, check if we've found enough */
|
/* this key not in use, check if we've found enough */
|
||||||
freeCount++;
|
freeCount++;
|
||||||
if (freeCount == numKeys) {
|
if (freeCount == numKeys) {
|
||||||
_glthread_UNLOCK_MUTEX(table->Mutex);
|
mtx_unlock(&table->Mutex);
|
||||||
return freeStart;
|
return freeStart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* cannot allocate a block of numKeys consecutive keys */
|
/* cannot allocate a block of numKeys consecutive keys */
|
||||||
_glthread_UNLOCK_MUTEX(table->Mutex);
|
mtx_unlock(&table->Mutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1190,7 +1190,7 @@ struct gl_sampler_object
|
||||||
*/
|
*/
|
||||||
struct gl_texture_object
|
struct gl_texture_object
|
||||||
{
|
{
|
||||||
_glthread_Mutex Mutex; /**< for thread safety */
|
mtx_t Mutex; /**< for thread safety */
|
||||||
GLint RefCount; /**< reference count */
|
GLint RefCount; /**< reference count */
|
||||||
GLuint Name; /**< the user-visible texture object ID */
|
GLuint Name; /**< the user-visible texture object ID */
|
||||||
GLchar *Label; /**< GL_KHR_debug */
|
GLchar *Label; /**< GL_KHR_debug */
|
||||||
|
|
@ -1463,7 +1463,7 @@ struct gl_buffer_mapping {
|
||||||
*/
|
*/
|
||||||
struct gl_buffer_object
|
struct gl_buffer_object
|
||||||
{
|
{
|
||||||
_glthread_Mutex Mutex;
|
mtx_t Mutex;
|
||||||
GLint RefCount;
|
GLint RefCount;
|
||||||
GLuint Name;
|
GLuint Name;
|
||||||
GLchar *Label; /**< GL_KHR_debug */
|
GLchar *Label; /**< GL_KHR_debug */
|
||||||
|
|
@ -1576,7 +1576,7 @@ struct gl_vertex_array_object
|
||||||
GLchar *Label; /**< GL_KHR_debug */
|
GLchar *Label; /**< GL_KHR_debug */
|
||||||
|
|
||||||
GLint RefCount;
|
GLint RefCount;
|
||||||
_glthread_Mutex Mutex;
|
mtx_t Mutex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the VAO use ARB semantics or Apple semantics?
|
* Does the VAO use ARB semantics or Apple semantics?
|
||||||
|
|
@ -2790,7 +2790,7 @@ struct gl_pipeline_object
|
||||||
|
|
||||||
GLint RefCount;
|
GLint RefCount;
|
||||||
|
|
||||||
_glthread_Mutex Mutex;
|
mtx_t Mutex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Programs used for rendering
|
* Programs used for rendering
|
||||||
|
|
@ -2927,7 +2927,7 @@ struct gl_sync_object
|
||||||
*/
|
*/
|
||||||
struct gl_shared_state
|
struct gl_shared_state
|
||||||
{
|
{
|
||||||
_glthread_Mutex Mutex; /**< for thread safety */
|
mtx_t Mutex; /**< for thread safety */
|
||||||
GLint RefCount; /**< Reference count */
|
GLint RefCount; /**< Reference count */
|
||||||
struct _mesa_HashTable *DisplayList; /**< Display lists hash table */
|
struct _mesa_HashTable *DisplayList; /**< Display lists hash table */
|
||||||
struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */
|
struct _mesa_HashTable *TexObjects; /**< Texture objects hash table */
|
||||||
|
|
@ -2945,7 +2945,7 @@ struct gl_shared_state
|
||||||
* \todo Improve the granularity of locking.
|
* \todo Improve the granularity of locking.
|
||||||
*/
|
*/
|
||||||
/*@{*/
|
/*@{*/
|
||||||
_glthread_Mutex TexMutex; /**< texobj thread safety */
|
mtx_t TexMutex; /**< texobj thread safety */
|
||||||
GLuint TextureStateStamp; /**< state notification for shared tex */
|
GLuint TextureStateStamp; /**< state notification for shared tex */
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
@ -3002,7 +3002,7 @@ struct gl_shared_state
|
||||||
*/
|
*/
|
||||||
struct gl_renderbuffer
|
struct gl_renderbuffer
|
||||||
{
|
{
|
||||||
_glthread_Mutex Mutex; /**< for thread safety */
|
mtx_t Mutex; /**< for thread safety */
|
||||||
GLuint ClassID; /**< Useful for drivers */
|
GLuint ClassID; /**< Useful for drivers */
|
||||||
GLuint Name;
|
GLuint Name;
|
||||||
GLchar *Label; /**< GL_KHR_debug */
|
GLchar *Label; /**< GL_KHR_debug */
|
||||||
|
|
@ -3080,7 +3080,7 @@ struct gl_renderbuffer_attachment
|
||||||
*/
|
*/
|
||||||
struct gl_framebuffer
|
struct gl_framebuffer
|
||||||
{
|
{
|
||||||
_glthread_Mutex Mutex; /**< for thread safety */
|
mtx_t Mutex; /**< for thread safety */
|
||||||
/**
|
/**
|
||||||
* If zero, this is a window system framebuffer. If non-zero, this
|
* If zero, this is a window system framebuffer. If non-zero, this
|
||||||
* is a FBO framebuffer; note that for some devices (i.e. those with
|
* is a FBO framebuffer; note that for some devices (i.e. those with
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ _mesa_delete_pipeline_object(struct gl_context *ctx,
|
||||||
_mesa_reference_shader_program(ctx, &obj->CurrentProgram[i], NULL);
|
_mesa_reference_shader_program(ctx, &obj->CurrentProgram[i], NULL);
|
||||||
|
|
||||||
_mesa_reference_shader_program(ctx, &obj->ActiveProgram, NULL);
|
_mesa_reference_shader_program(ctx, &obj->ActiveProgram, NULL);
|
||||||
_glthread_DESTROY_MUTEX(obj->Mutex);
|
mtx_destroy(&obj->Mutex);
|
||||||
ralloc_free(obj);
|
ralloc_free(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -77,7 +77,7 @@ _mesa_new_pipeline_object(struct gl_context *ctx, GLuint name)
|
||||||
struct gl_pipeline_object *obj = rzalloc(NULL, struct gl_pipeline_object);
|
struct gl_pipeline_object *obj = rzalloc(NULL, struct gl_pipeline_object);
|
||||||
if (obj) {
|
if (obj) {
|
||||||
obj->Name = name;
|
obj->Name = name;
|
||||||
_glthread_INIT_MUTEX(obj->Mutex);
|
mtx_init(&obj->Mutex, mtx_plain);
|
||||||
obj->RefCount = 1;
|
obj->RefCount = 1;
|
||||||
obj->Flags = _mesa_get_shader_flags();
|
obj->Flags = _mesa_get_shader_flags();
|
||||||
}
|
}
|
||||||
|
|
@ -177,11 +177,11 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx,
|
||||||
GLboolean deleteFlag = GL_FALSE;
|
GLboolean deleteFlag = GL_FALSE;
|
||||||
struct gl_pipeline_object *oldObj = *ptr;
|
struct gl_pipeline_object *oldObj = *ptr;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(oldObj->Mutex);
|
mtx_lock(&oldObj->Mutex);
|
||||||
ASSERT(oldObj->RefCount > 0);
|
ASSERT(oldObj->RefCount > 0);
|
||||||
oldObj->RefCount--;
|
oldObj->RefCount--;
|
||||||
deleteFlag = (oldObj->RefCount == 0);
|
deleteFlag = (oldObj->RefCount == 0);
|
||||||
_glthread_UNLOCK_MUTEX(oldObj->Mutex);
|
mtx_unlock(&oldObj->Mutex);
|
||||||
|
|
||||||
if (deleteFlag) {
|
if (deleteFlag) {
|
||||||
_mesa_delete_pipeline_object(ctx, oldObj);
|
_mesa_delete_pipeline_object(ctx, oldObj);
|
||||||
|
|
@ -193,7 +193,7 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx,
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
/* reference new pipeline object */
|
/* reference new pipeline object */
|
||||||
_glthread_LOCK_MUTEX(obj->Mutex);
|
mtx_lock(&obj->Mutex);
|
||||||
if (obj->RefCount == 0) {
|
if (obj->RefCount == 0) {
|
||||||
/* this pipeline's being deleted (look just above) */
|
/* this pipeline's being deleted (look just above) */
|
||||||
/* Not sure this can ever really happen. Warn if it does. */
|
/* Not sure this can ever really happen. Warn if it does. */
|
||||||
|
|
@ -204,7 +204,7 @@ _mesa_reference_pipeline_object_(struct gl_context *ctx,
|
||||||
obj->RefCount++;
|
obj->RefCount++;
|
||||||
*ptr = obj;
|
*ptr = obj;
|
||||||
}
|
}
|
||||||
_glthread_UNLOCK_MUTEX(obj->Mutex);
|
mtx_unlock(&obj->Mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
void
|
void
|
||||||
_mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
|
_mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
|
||||||
{
|
{
|
||||||
_glthread_INIT_MUTEX(rb->Mutex);
|
mtx_init(&rb->Mutex, mtx_plain);
|
||||||
|
|
||||||
rb->ClassID = 0;
|
rb->ClassID = 0;
|
||||||
rb->Name = name;
|
rb->Name = name;
|
||||||
|
|
@ -83,7 +83,7 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
|
||||||
void
|
void
|
||||||
_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
|
_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
|
||||||
{
|
{
|
||||||
_glthread_DESTROY_MUTEX(rb->Mutex);
|
mtx_destroy(&rb->Mutex);
|
||||||
free(rb->Label);
|
free(rb->Label);
|
||||||
free(rb);
|
free(rb);
|
||||||
}
|
}
|
||||||
|
|
@ -153,12 +153,12 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
|
||||||
GLboolean deleteFlag = GL_FALSE;
|
GLboolean deleteFlag = GL_FALSE;
|
||||||
struct gl_renderbuffer *oldRb = *ptr;
|
struct gl_renderbuffer *oldRb = *ptr;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(oldRb->Mutex);
|
mtx_lock(&oldRb->Mutex);
|
||||||
ASSERT(oldRb->RefCount > 0);
|
ASSERT(oldRb->RefCount > 0);
|
||||||
oldRb->RefCount--;
|
oldRb->RefCount--;
|
||||||
/*printf("RB DECR %p (%d) to %d\n", (void*) oldRb, oldRb->Name, oldRb->RefCount);*/
|
/*printf("RB DECR %p (%d) to %d\n", (void*) oldRb, oldRb->Name, oldRb->RefCount);*/
|
||||||
deleteFlag = (oldRb->RefCount == 0);
|
deleteFlag = (oldRb->RefCount == 0);
|
||||||
_glthread_UNLOCK_MUTEX(oldRb->Mutex);
|
mtx_unlock(&oldRb->Mutex);
|
||||||
|
|
||||||
if (deleteFlag) {
|
if (deleteFlag) {
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
@ -171,10 +171,10 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
|
||||||
|
|
||||||
if (rb) {
|
if (rb) {
|
||||||
/* reference new renderbuffer */
|
/* reference new renderbuffer */
|
||||||
_glthread_LOCK_MUTEX(rb->Mutex);
|
mtx_lock(&rb->Mutex);
|
||||||
rb->RefCount++;
|
rb->RefCount++;
|
||||||
/*printf("RB INCR %p (%d) to %d\n", (void*) rb, rb->Name, rb->RefCount);*/
|
/*printf("RB INCR %p (%d) to %d\n", (void*) rb, rb->Name, rb->RefCount);*/
|
||||||
_glthread_UNLOCK_MUTEX(rb->Mutex);
|
mtx_unlock(&rb->Mutex);
|
||||||
*ptr = rb;
|
*ptr = rb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ _mesa_reference_sampler_object_(struct gl_context *ctx,
|
||||||
GLboolean deleteFlag = GL_FALSE;
|
GLboolean deleteFlag = GL_FALSE;
|
||||||
struct gl_sampler_object *oldSamp = *ptr;
|
struct gl_sampler_object *oldSamp = *ptr;
|
||||||
|
|
||||||
/*_glthread_LOCK_MUTEX(oldSamp->Mutex);*/
|
/*mtx_lock(&oldSamp->Mutex);*/
|
||||||
ASSERT(oldSamp->RefCount > 0);
|
ASSERT(oldSamp->RefCount > 0);
|
||||||
oldSamp->RefCount--;
|
oldSamp->RefCount--;
|
||||||
#if 0
|
#if 0
|
||||||
|
|
@ -74,7 +74,7 @@ _mesa_reference_sampler_object_(struct gl_context *ctx,
|
||||||
(void *) oldSamp, oldSamp->Name, oldSamp->RefCount);
|
(void *) oldSamp, oldSamp->Name, oldSamp->RefCount);
|
||||||
#endif
|
#endif
|
||||||
deleteFlag = (oldSamp->RefCount == 0);
|
deleteFlag = (oldSamp->RefCount == 0);
|
||||||
/*_glthread_UNLOCK_MUTEX(oldSamp->Mutex);*/
|
/*mtx_unlock(&oldSamp->Mutex);*/
|
||||||
|
|
||||||
if (deleteFlag) {
|
if (deleteFlag) {
|
||||||
ASSERT(ctx->Driver.DeleteSamplerObject);
|
ASSERT(ctx->Driver.DeleteSamplerObject);
|
||||||
|
|
@ -87,7 +87,7 @@ _mesa_reference_sampler_object_(struct gl_context *ctx,
|
||||||
|
|
||||||
if (samp) {
|
if (samp) {
|
||||||
/* reference new sampler */
|
/* reference new sampler */
|
||||||
/*_glthread_LOCK_MUTEX(samp->Mutex);*/
|
/*mtx_lock(&samp->Mutex);*/
|
||||||
if (samp->RefCount == 0) {
|
if (samp->RefCount == 0) {
|
||||||
/* this sampler's being deleted (look just above) */
|
/* this sampler's being deleted (look just above) */
|
||||||
/* Not sure this can every really happen. Warn if it does. */
|
/* Not sure this can every really happen. Warn if it does. */
|
||||||
|
|
@ -102,7 +102,7 @@ _mesa_reference_sampler_object_(struct gl_context *ctx,
|
||||||
#endif
|
#endif
|
||||||
*ptr = samp;
|
*ptr = samp;
|
||||||
}
|
}
|
||||||
/*_glthread_UNLOCK_MUTEX(samp->Mutex);*/
|
/*mtx_unlock(&samp->Mutex);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,7 +203,7 @@ _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
if (samplers[i]) {
|
if (samplers[i]) {
|
||||||
|
|
@ -228,7 +228,7 @@ _mesa_DeleteSamplers(GLsizei count, const GLuint *samplers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ _mesa_init_shader_state(struct gl_context *ctx)
|
||||||
|
|
||||||
/* Extended for ARB_separate_shader_objects */
|
/* Extended for ARB_separate_shader_objects */
|
||||||
ctx->Shader.RefCount = 1;
|
ctx->Shader.RefCount = 1;
|
||||||
_glthread_INIT_MUTEX(ctx->Shader.Mutex);
|
mtx_init(&ctx->Shader.Mutex, mtx_plain);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -145,7 +145,7 @@ _mesa_free_shader_state(struct gl_context *ctx)
|
||||||
|
|
||||||
/* Extended for ARB_separate_shader_objects */
|
/* Extended for ARB_separate_shader_objects */
|
||||||
assert(ctx->Shader.RefCount == 1);
|
assert(ctx->Shader.RefCount == 1);
|
||||||
_glthread_DESTROY_MUTEX(ctx->Shader.Mutex);
|
mtx_destroy(&ctx->Shader.Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
|
||||||
if (!shared)
|
if (!shared)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
_glthread_INIT_MUTEX(shared->Mutex);
|
mtx_init(&shared->Mutex, mtx_plain);
|
||||||
|
|
||||||
shared->DisplayList = _mesa_NewHashTable();
|
shared->DisplayList = _mesa_NewHashTable();
|
||||||
shared->TexObjects = _mesa_NewHashTable();
|
shared->TexObjects = _mesa_NewHashTable();
|
||||||
|
|
@ -113,7 +113,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
|
||||||
assert(shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount == 1);
|
assert(shared->DefaultTex[TEXTURE_1D_INDEX]->RefCount == 1);
|
||||||
|
|
||||||
/* Mutex and timestamp for texobj state validation */
|
/* Mutex and timestamp for texobj state validation */
|
||||||
_glthread_INIT_MUTEX(shared->TexMutex);
|
mtx_init(&shared->TexMutex, mtx_plain);
|
||||||
shared->TextureStateStamp = 0;
|
shared->TextureStateStamp = 0;
|
||||||
|
|
||||||
shared->FrameBuffers = _mesa_NewHashTable();
|
shared->FrameBuffers = _mesa_NewHashTable();
|
||||||
|
|
@ -354,8 +354,8 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
|
||||||
_mesa_HashDeleteAll(shared->TexObjects, delete_texture_cb, ctx);
|
_mesa_HashDeleteAll(shared->TexObjects, delete_texture_cb, ctx);
|
||||||
_mesa_DeleteHashTable(shared->TexObjects);
|
_mesa_DeleteHashTable(shared->TexObjects);
|
||||||
|
|
||||||
_glthread_DESTROY_MUTEX(shared->Mutex);
|
mtx_destroy(&shared->Mutex);
|
||||||
_glthread_DESTROY_MUTEX(shared->TexMutex);
|
mtx_destroy(&shared->TexMutex);
|
||||||
|
|
||||||
free(shared);
|
free(shared);
|
||||||
}
|
}
|
||||||
|
|
@ -378,11 +378,11 @@ _mesa_reference_shared_state(struct gl_context *ctx,
|
||||||
struct gl_shared_state *old = *ptr;
|
struct gl_shared_state *old = *ptr;
|
||||||
GLboolean delete;
|
GLboolean delete;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(old->Mutex);
|
mtx_lock(&old->Mutex);
|
||||||
assert(old->RefCount >= 1);
|
assert(old->RefCount >= 1);
|
||||||
old->RefCount--;
|
old->RefCount--;
|
||||||
delete = (old->RefCount == 0);
|
delete = (old->RefCount == 0);
|
||||||
_glthread_UNLOCK_MUTEX(old->Mutex);
|
mtx_unlock(&old->Mutex);
|
||||||
|
|
||||||
if (delete) {
|
if (delete) {
|
||||||
free_shared_state(ctx, old);
|
free_shared_state(ctx, old);
|
||||||
|
|
@ -393,9 +393,9 @@ _mesa_reference_shared_state(struct gl_context *ctx,
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
/* reference new state */
|
/* reference new state */
|
||||||
_glthread_LOCK_MUTEX(state->Mutex);
|
mtx_lock(&state->Mutex);
|
||||||
state->RefCount++;
|
state->RefCount++;
|
||||||
*ptr = state;
|
*ptr = state;
|
||||||
_glthread_UNLOCK_MUTEX(state->Mutex);
|
mtx_unlock(&state->Mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -184,9 +184,9 @@ _mesa_validate_sync(struct gl_context *ctx,
|
||||||
void
|
void
|
||||||
_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
|
_mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
|
||||||
{
|
{
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
syncObj->RefCount++;
|
syncObj->RefCount++;
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -195,7 +195,7 @@ _mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
|
||||||
{
|
{
|
||||||
struct set_entry *entry;
|
struct set_entry *entry;
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
syncObj->RefCount--;
|
syncObj->RefCount--;
|
||||||
if (syncObj->RefCount == 0) {
|
if (syncObj->RefCount == 0) {
|
||||||
entry = _mesa_set_search(ctx->Shared->SyncObjects,
|
entry = _mesa_set_search(ctx->Shared->SyncObjects,
|
||||||
|
|
@ -203,11 +203,11 @@ _mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj)
|
||||||
syncObj);
|
syncObj);
|
||||||
assert (entry != NULL);
|
assert (entry != NULL);
|
||||||
_mesa_set_remove(ctx->Shared->SyncObjects, entry);
|
_mesa_set_remove(ctx->Shared->SyncObjects, entry);
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
ctx->Driver.DeleteSyncObject(ctx, syncObj);
|
ctx->Driver.DeleteSyncObject(ctx, syncObj);
|
||||||
} else {
|
} else {
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -288,11 +288,11 @@ _mesa_FenceSync(GLenum condition, GLbitfield flags)
|
||||||
|
|
||||||
ctx->Driver.FenceSync(ctx, syncObj, condition, flags);
|
ctx->Driver.FenceSync(ctx, syncObj, condition, flags);
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
_mesa_set_add(ctx->Shared->SyncObjects,
|
_mesa_set_add(ctx->Shared->SyncObjects,
|
||||||
_mesa_hash_pointer(syncObj),
|
_mesa_hash_pointer(syncObj),
|
||||||
syncObj);
|
syncObj);
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
return (GLsync) syncObj;
|
return (GLsync) syncObj;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ _mesa_legal_texture_base_format_for_target(struct gl_context *ctx,
|
||||||
static inline void
|
static inline void
|
||||||
_mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
|
_mesa_lock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
|
||||||
{
|
{
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
|
mtx_lock(&ctx->Shared->TexMutex);
|
||||||
ctx->Shared->TextureStateStamp++;
|
ctx->Shared->TextureStateStamp++;
|
||||||
(void) texObj;
|
(void) texObj;
|
||||||
}
|
}
|
||||||
|
|
@ -172,7 +172,7 @@ static inline void
|
||||||
_mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
|
_mesa_unlock_texture(struct gl_context *ctx, struct gl_texture_object *texObj)
|
||||||
{
|
{
|
||||||
(void) texObj;
|
(void) texObj;
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
|
mtx_unlock(&ctx->Shared->TexMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ _mesa_initialize_texture_object( struct gl_context *ctx,
|
||||||
|
|
||||||
memset(obj, 0, sizeof(*obj));
|
memset(obj, 0, sizeof(*obj));
|
||||||
/* init the non-zero fields */
|
/* init the non-zero fields */
|
||||||
_glthread_INIT_MUTEX(obj->Mutex);
|
mtx_init(&obj->Mutex, mtx_plain);
|
||||||
obj->RefCount = 1;
|
obj->RefCount = 1;
|
||||||
obj->Name = name;
|
obj->Name = name;
|
||||||
obj->Target = target;
|
obj->Target = target;
|
||||||
|
|
@ -237,7 +237,7 @@ _mesa_delete_texture_object(struct gl_context *ctx,
|
||||||
_mesa_reference_buffer_object(ctx, &texObj->BufferObject, NULL);
|
_mesa_reference_buffer_object(ctx, &texObj->BufferObject, NULL);
|
||||||
|
|
||||||
/* destroy the mutex -- it may have allocated memory (eg on bsd) */
|
/* destroy the mutex -- it may have allocated memory (eg on bsd) */
|
||||||
_glthread_DESTROY_MUTEX(texObj->Mutex);
|
mtx_destroy(&texObj->Mutex);
|
||||||
|
|
||||||
free(texObj->Label);
|
free(texObj->Label);
|
||||||
|
|
||||||
|
|
@ -374,12 +374,12 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr,
|
||||||
ASSERT(valid_texture_object(oldTex));
|
ASSERT(valid_texture_object(oldTex));
|
||||||
(void) valid_texture_object; /* silence warning in release builds */
|
(void) valid_texture_object; /* silence warning in release builds */
|
||||||
|
|
||||||
_glthread_LOCK_MUTEX(oldTex->Mutex);
|
mtx_lock(&oldTex->Mutex);
|
||||||
ASSERT(oldTex->RefCount > 0);
|
ASSERT(oldTex->RefCount > 0);
|
||||||
oldTex->RefCount--;
|
oldTex->RefCount--;
|
||||||
|
|
||||||
deleteFlag = (oldTex->RefCount == 0);
|
deleteFlag = (oldTex->RefCount == 0);
|
||||||
_glthread_UNLOCK_MUTEX(oldTex->Mutex);
|
mtx_unlock(&oldTex->Mutex);
|
||||||
|
|
||||||
if (deleteFlag) {
|
if (deleteFlag) {
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
@ -396,7 +396,7 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr,
|
||||||
if (tex) {
|
if (tex) {
|
||||||
/* reference new texture */
|
/* reference new texture */
|
||||||
ASSERT(valid_texture_object(tex));
|
ASSERT(valid_texture_object(tex));
|
||||||
_glthread_LOCK_MUTEX(tex->Mutex);
|
mtx_lock(&tex->Mutex);
|
||||||
if (tex->RefCount == 0) {
|
if (tex->RefCount == 0) {
|
||||||
/* this texture's being deleted (look just above) */
|
/* this texture's being deleted (look just above) */
|
||||||
/* Not sure this can every really happen. Warn if it does. */
|
/* Not sure this can every really happen. Warn if it does. */
|
||||||
|
|
@ -407,7 +407,7 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr,
|
||||||
tex->RefCount++;
|
tex->RefCount++;
|
||||||
*ptr = tex;
|
*ptr = tex;
|
||||||
}
|
}
|
||||||
_glthread_UNLOCK_MUTEX(tex->Mutex);
|
mtx_unlock(&tex->Mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1009,7 +1009,7 @@ _mesa_GenTextures( GLsizei n, GLuint *textures )
|
||||||
/*
|
/*
|
||||||
* This must be atomic (generation and allocation of texture IDs)
|
* This must be atomic (generation and allocation of texture IDs)
|
||||||
*/
|
*/
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n);
|
first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n);
|
||||||
|
|
||||||
|
|
@ -1020,7 +1020,7 @@ _mesa_GenTextures( GLsizei n, GLuint *textures )
|
||||||
GLenum target = 0;
|
GLenum target = 0;
|
||||||
texObj = ctx->Driver.NewTextureObject(ctx, name, target);
|
texObj = ctx->Driver.NewTextureObject(ctx, name, target);
|
||||||
if (!texObj) {
|
if (!texObj) {
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures");
|
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenTextures");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1031,7 +1031,7 @@ _mesa_GenTextures( GLsizei n, GLuint *textures )
|
||||||
textures[i] = name;
|
textures[i] = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1178,9 +1178,9 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
|
||||||
/* The texture _name_ is now free for re-use.
|
/* The texture _name_ is now free for re-use.
|
||||||
* Remove it from the hash table now.
|
* Remove it from the hash table now.
|
||||||
*/
|
*/
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
_mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name);
|
_mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name);
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
|
|
||||||
/* Unreference the texobj. If refcount hits zero, the texture
|
/* Unreference the texobj. If refcount hits zero, the texture
|
||||||
* will be deleted.
|
* will be deleted.
|
||||||
|
|
@ -1313,9 +1313,9 @@ _mesa_BindTexture( GLenum target, GLuint texName )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and insert it into hash table */
|
/* and insert it into hash table */
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
_mesa_HashInsert(ctx->Shared->TexObjects, texName, newTexObj);
|
_mesa_HashInsert(ctx->Shared->TexObjects, texName, newTexObj);
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
}
|
}
|
||||||
newTexObj->Target = target;
|
newTexObj->Target = target;
|
||||||
}
|
}
|
||||||
|
|
@ -1327,10 +1327,10 @@ _mesa_BindTexture( GLenum target, GLuint texName )
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
GLboolean early_out;
|
GLboolean early_out;
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_lock(&ctx->Shared->Mutex);
|
||||||
early_out = ((ctx->Shared->RefCount == 1)
|
early_out = ((ctx->Shared->RefCount == 1)
|
||||||
&& (newTexObj == texUnit->CurrentTex[targetIndex]));
|
&& (newTexObj == texUnit->CurrentTex[targetIndex]));
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
|
mtx_unlock(&ctx->Shared->Mutex);
|
||||||
if (early_out) {
|
if (early_out) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1493,7 +1493,7 @@ _mesa_IsTexture( GLuint texture )
|
||||||
void
|
void
|
||||||
_mesa_lock_context_textures( struct gl_context *ctx )
|
_mesa_lock_context_textures( struct gl_context *ctx )
|
||||||
{
|
{
|
||||||
_glthread_LOCK_MUTEX(ctx->Shared->TexMutex);
|
mtx_lock(&ctx->Shared->TexMutex);
|
||||||
|
|
||||||
if (ctx->Shared->TextureStateStamp != ctx->TextureStateTimestamp) {
|
if (ctx->Shared->TextureStateStamp != ctx->TextureStateTimestamp) {
|
||||||
ctx->NewState |= _NEW_TEXTURE;
|
ctx->NewState |= _NEW_TEXTURE;
|
||||||
|
|
@ -1506,7 +1506,7 @@ void
|
||||||
_mesa_unlock_context_textures( struct gl_context *ctx )
|
_mesa_unlock_context_textures( struct gl_context *ctx )
|
||||||
{
|
{
|
||||||
assert(ctx->Shared->TextureStateStamp == ctx->TextureStateTimestamp);
|
assert(ctx->Shared->TextureStateStamp == ctx->TextureStateTimestamp);
|
||||||
_glthread_UNLOCK_MUTEX(ctx->Shared->TexMutex);
|
mtx_unlock(&ctx->Shared->TexMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLAPIENTRY
|
void GLAPIENTRY
|
||||||
|
|
|
||||||
|
|
@ -424,7 +424,7 @@ _mesa_reference_program_(struct gl_context *ctx,
|
||||||
if (*ptr) {
|
if (*ptr) {
|
||||||
GLboolean deleteFlag;
|
GLboolean deleteFlag;
|
||||||
|
|
||||||
/*_glthread_LOCK_MUTEX((*ptr)->Mutex);*/
|
/*mtx_lock(&(*ptr)->Mutex);*/
|
||||||
#if 0
|
#if 0
|
||||||
printf("Program %p ID=%u Target=%s Refcount-- to %d\n",
|
printf("Program %p ID=%u Target=%s Refcount-- to %d\n",
|
||||||
*ptr, (*ptr)->Id,
|
*ptr, (*ptr)->Id,
|
||||||
|
|
@ -436,7 +436,7 @@ _mesa_reference_program_(struct gl_context *ctx,
|
||||||
(*ptr)->RefCount--;
|
(*ptr)->RefCount--;
|
||||||
|
|
||||||
deleteFlag = ((*ptr)->RefCount == 0);
|
deleteFlag = ((*ptr)->RefCount == 0);
|
||||||
/*_glthread_UNLOCK_MUTEX((*ptr)->Mutex);*/
|
/*mtx_lock(&(*ptr)->Mutex);*/
|
||||||
|
|
||||||
if (deleteFlag) {
|
if (deleteFlag) {
|
||||||
ASSERT(ctx);
|
ASSERT(ctx);
|
||||||
|
|
@ -448,7 +448,7 @@ _mesa_reference_program_(struct gl_context *ctx,
|
||||||
|
|
||||||
assert(!*ptr);
|
assert(!*ptr);
|
||||||
if (prog) {
|
if (prog) {
|
||||||
/*_glthread_LOCK_MUTEX(prog->Mutex);*/
|
/*mtx_lock(&prog->Mutex);*/
|
||||||
prog->RefCount++;
|
prog->RefCount++;
|
||||||
#if 0
|
#if 0
|
||||||
printf("Program %p ID=%u Target=%s Refcount++ to %d\n",
|
printf("Program %p ID=%u Target=%s Refcount++ to %d\n",
|
||||||
|
|
@ -457,7 +457,7 @@ _mesa_reference_program_(struct gl_context *ctx,
|
||||||
(prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
|
(prog->Target == MESA_GEOMETRY_PROGRAM ? "GP" : "FP")),
|
||||||
prog->RefCount);
|
prog->RefCount);
|
||||||
#endif
|
#endif
|
||||||
/*_glthread_UNLOCK_MUTEX(prog->Mutex);*/
|
/*mtx_unlock(&prog->Mutex);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
*ptr = prog;
|
*ptr = prog;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue