/* Copyright (c) 2001, Stanford University
* All rights reserved
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#include "server_dispatch.h"
#include "server.h"
#include "cr_error.h"
#include "cr_mem.h"
#include "state/cr_statetypes.h"
{
#if DEBUG_BARRIERS
#endif
if (cr_server.ignore_papi)
{
return;
}
#if DEBUG_BARRIERS
cr_server.head_spu->dispatch_table.ChromiumParametervCR( GL_PRINT_STRING_CR, GL_UNSIGNED_BYTE, sizeof(debug_buf), debug_buf );
#endif
if (count == 0)
{
#if DEBUG_BARRIERS
cr_server.head_spu->dispatch_table.ChromiumParametervCR( GL_PRINT_STRING_CR, GL_UNSIGNED_BYTE, sizeof(debug_buf), debug_buf );
#endif
}
/* we use maxBarrierCount in Clear() and SwapBuffers() and also use it
* in __getNextClient() for deadlock detection. The issue is that all
* the existing clients may be blocked, but we might soon get another
* client connection to break the apparent deadlock.
*/
{
barrier->num_waiting = 0;
#if DEBUG_BARRIERS
cr_server.head_spu->dispatch_table.ChromiumParametervCR( GL_PRINT_STRING_CR, GL_UNSIGNED_BYTE, sizeof(debug_buf), debug_buf );
#endif
}
else
{
/* HACK -- this allows everybody to create a barrier, and all
but the first creation are ignored, assuming the count
match. */
#if DEBUG_BARRIERS
cr_server.head_spu->dispatch_table.ChromiumParametervCR( GL_PRINT_STRING_CR, GL_UNSIGNED_BYTE, sizeof(debug_buf), debug_buf );
#endif
{
#if DEBUG_BARRIERS
cr_server.head_spu->dispatch_table.ChromiumParametervCR( GL_PRINT_STRING_CR, GL_UNSIGNED_BYTE, sizeof(debug_buf), debug_buf );
#endif
crError( "Barrier name=%u created with count=%u, but already "
}
}
if (cr_server.debug_barriers)
}
{
if (cr_server.ignore_papi)
{
return;
}
}
{
#if DEBUG_BARRIERS
#endif
if (cr_server.ignore_papi)
{
return;
}
{
}
#if DEBUG_BARRIERS
cr_server.head_spu->dispatch_table.ChromiumParametervCR( GL_PRINT_STRING_CR, GL_UNSIGNED_BYTE, sizeof(debug_buf), debug_buf );
cr_server.head_spu->dispatch_table.ChromiumParametervCR( GL_PRINT_STRING_CR, GL_UNSIGNED_BYTE, sizeof(debug_buf), debug_buf );
#endif
{
GLuint i;
if (cr_server.debug_barriers)
crDebug("crserver: BarrierExec(client=%p, id=%d, num_waiting=%d/%d) - release",
{
}
barrier->num_waiting = 0;
}
else if (cr_server.debug_barriers)
crDebug("crserver: BarrierExec(client=%p, id=%d, num_waiting=%d/%d) - block",
}
{
if (cr_server.ignore_papi)
{
return;
}
if (sema)
return; /* already created */
if (cr_server.debug_barriers)
}
{
if (cr_server.ignore_papi)
{
return;
}
}
/* Semaphore wait */
{
if (cr_server.ignore_papi)
{
return;
}
if (!sema)
{
}
{
/* go */
if (cr_server.debug_barriers)
crDebug("crserver: SemaphoreP(client=%p, id=%d, count=%d) decrement to %d",
}
else
{
/* block */
if (cr_server.debug_barriers)
crDebug("crserver: SemaphoreP(client=%p, id=%d, count=%d) - block.",
{
}
else
{
}
}
}
/* Semaphore signal */
{
if (cr_server.ignore_papi)
{
return;
}
if (!sema)
{
}
{
if (cr_server.debug_barriers)
crDebug("crserver: SemaphoreV(client=%p, id=%d, count=%d) - unblock.",
/* unblock one waiter */
{
}
}
else
{
/* nobody's waiting */
if (cr_server.debug_barriers)
crDebug("crserver: SemaphoreV(client=%p, id=%d, count=%d) - increment to %d",
}
}