本文整理汇总了C++中pipe_mutex_init函数的典型用法代码示例。如果您正苦于以下问题:C++ pipe_mutex_init函数的具体用法?C++ pipe_mutex_init怎么用?C++ pipe_mutex_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pipe_mutex_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: stw_init
boolean
stw_init(const struct stw_winsys *stw_winsys)
{
static struct stw_device stw_dev_storage;
struct pipe_screen *screen;
debug_printf("%s\n", __FUNCTION__);
assert(!stw_dev);
stw_tls_init();
stw_dev = &stw_dev_storage;
memset(stw_dev, 0, sizeof(*stw_dev));
#ifdef DEBUG
stw_dev->memdbg_no = debug_memory_begin();
#endif
stw_dev->stw_winsys = stw_winsys;
#ifdef WIN32_THREADS
_glthread_INIT_MUTEX(OneTimeLock);
#endif
screen = stw_winsys->create_screen();
if(!screen)
goto error1;
#ifdef DEBUG
stw_dev->screen = trace_screen_create(screen);
stw_dev->trace_running = stw_dev->screen != screen ? TRUE : FALSE;
#else
stw_dev->screen = screen;
#endif
stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer;
pipe_mutex_init( stw_dev->ctx_mutex );
pipe_mutex_init( stw_dev->fb_mutex );
stw_dev->ctx_table = handle_table_create();
if (!stw_dev->ctx_table) {
goto error1;
}
stw_pixelformat_init();
return TRUE;
error1:
stw_dev = NULL;
return FALSE;
}
示例2: CALLOC_STRUCT
struct radeon_winsys *radeon_drm_winsys_create(int fd)
{
struct radeon_drm_winsys *ws = CALLOC_STRUCT(radeon_drm_winsys);
if (!ws) {
return NULL;
}
ws->fd = fd;
if (!do_winsys_init(ws))
goto fail;
/* Create managers. */
ws->kman = radeon_bomgr_create(ws);
if (!ws->kman)
goto fail;
ws->cman = pb_cache_manager_create(ws->kman, 1000000);
if (!ws->cman)
goto fail;
if (ws->gen >= R600) {
ws->surf_man = radeon_surface_manager_new(fd);
if (!ws->surf_man)
goto fail;
}
/* Set functions. */
ws->base.destroy = radeon_winsys_destroy;
ws->base.query_info = radeon_query_info;
ws->base.cs_request_feature = radeon_cs_request_feature;
ws->base.surface_init = radeon_drm_winsys_surface_init;
ws->base.surface_best = radeon_drm_winsys_surface_best;
ws->base.query_timestamp = radeon_query_timestamp;
radeon_bomgr_init_functions(ws);
radeon_drm_cs_init_functions(ws);
pipe_mutex_init(ws->hyperz_owner_mutex);
pipe_mutex_init(ws->cmask_owner_mutex);
return &ws->base;
fail:
if (ws->cman)
ws->cman->destroy(ws->cman);
if (ws->kman)
ws->kman->destroy(ws->kman);
if (ws->surf_man)
radeon_surface_manager_free(ws->surf_man);
FREE(ws);
return NULL;
}
示例3: pb_cache_manager_create
/**
* Create a caching buffer manager
*
* @param provider The buffer manager to which cache miss buffer requests
* should be redirected.
* @param usecs Unused buffers may be released from the cache after this
* time
* @param size_factor Declare buffers that are size_factor times bigger than
* the requested size as cache hits.
* @param bypass_usage Bitmask. If (requested usage & bypass_usage) != 0,
* buffer allocation requests are redirected to the provider.
* @param maximum_cache_size Maximum size of all unused buffers the cache can
* hold.
*/
struct pb_manager *
pb_cache_manager_create(struct pb_manager *provider,
unsigned usecs,
float size_factor,
unsigned bypass_usage,
uint64_t maximum_cache_size)
{
struct pb_cache_manager *mgr;
if(!provider)
return NULL;
mgr = CALLOC_STRUCT(pb_cache_manager);
if (!mgr)
return NULL;
mgr->base.destroy = pb_cache_manager_destroy;
mgr->base.create_buffer = pb_cache_manager_create_buffer;
mgr->base.flush = pb_cache_manager_flush;
mgr->provider = provider;
mgr->usecs = usecs;
mgr->size_factor = size_factor;
mgr->bypass_usage = bypass_usage;
LIST_INITHEAD(&mgr->delayed);
mgr->numDelayed = 0;
mgr->max_cache_size = maximum_cache_size;
pipe_mutex_init(mgr->mutex);
return &mgr->base;
}
示例4: fenced_bufmgr_create
struct pb_manager *
fenced_bufmgr_create(struct pb_manager *provider,
struct pb_fence_ops *ops,
pb_size max_buffer_size,
pb_size max_cpu_total_size)
{
struct fenced_manager *fenced_mgr;
if(!provider)
return NULL;
fenced_mgr = CALLOC_STRUCT(fenced_manager);
if (!fenced_mgr)
return NULL;
fenced_mgr->base.destroy = fenced_bufmgr_destroy;
fenced_mgr->base.create_buffer = fenced_bufmgr_create_buffer;
fenced_mgr->base.flush = fenced_bufmgr_flush;
fenced_mgr->provider = provider;
fenced_mgr->ops = ops;
fenced_mgr->max_buffer_size = max_buffer_size;
fenced_mgr->max_cpu_total_size = max_cpu_total_size;
LIST_INITHEAD(&fenced_mgr->fenced);
fenced_mgr->num_fenced = 0;
LIST_INITHEAD(&fenced_mgr->unfenced);
fenced_mgr->num_unfenced = 0;
pipe_mutex_init(fenced_mgr->mutex);
return &fenced_mgr->base;
}
示例5: debug_symbol_name_cached
const char*
debug_symbol_name_cached(const void *addr)
{
const char* name;
#ifdef PIPE_SUBSYSTEM_WINDOWS_USER
static boolean first = TRUE;
if (first) {
pipe_mutex_init(symbols_mutex);
first = FALSE;
}
#endif
pipe_mutex_lock(symbols_mutex);
if(!symbols_hash)
symbols_hash = util_hash_table_create(hash_ptr, compare_ptr);
name = util_hash_table_get(symbols_hash, (void*)addr);
if(!name)
{
char buf[1024];
debug_symbol_name(addr, buf, sizeof(buf));
name = strdup(buf);
util_hash_table_set(symbols_hash, (void*)addr, (void*)name);
}
pipe_mutex_unlock(symbols_mutex);
return name;
}
示例6: CALLOC_STRUCT
/**
* Create a new primitive setup/render stage.
*/
struct setup_context *setup_create_context( struct softpipe_context *softpipe )
{
struct setup_context *setup = CALLOC_STRUCT(setup_context);
#if SP_NUM_QUAD_THREADS > 1
uint i;
#endif
setup->softpipe = softpipe;
setup->quad.coef = setup->coef;
setup->quad.posCoef = &setup->posCoef;
#if SP_NUM_QUAD_THREADS > 1
setup->que.first = 0;
setup->que.last = 0;
pipe_mutex_init( setup->que.que_mutex );
pipe_condvar_init( setup->que.que_notfull_condvar );
pipe_condvar_init( setup->que.que_notempty_condvar );
setup->que.jobs_added = 0;
setup->que.jobs_done = 0;
pipe_condvar_init( setup->que.que_done_condvar );
for (i = 0; i < SP_NUM_QUAD_THREADS; i++) {
setup->threads[i].setup = setup;
setup->threads[i].id = i;
setup->threads[i].handle = pipe_thread_create( quad_thread, &setup->threads[i] );
}
#endif
return setup;
}
示例7: pb_debug_manager_create
struct pb_manager *
pb_debug_manager_create(struct pb_manager *provider,
pb_size underflow_size, pb_size overflow_size)
{
struct pb_debug_manager *mgr;
if(!provider)
return NULL;
mgr = CALLOC_STRUCT(pb_debug_manager);
if (!mgr)
return NULL;
mgr->base.destroy = pb_debug_manager_destroy;
mgr->base.create_buffer = pb_debug_manager_create_buffer;
mgr->base.flush = pb_debug_manager_flush;
mgr->provider = provider;
mgr->underflow_size = underflow_size;
mgr->overflow_size = overflow_size;
pipe_mutex_init(mgr->mutex);
LIST_INITHEAD(&mgr->list);
return &mgr->base;
}
示例8: lp_scene_create
/**
* Create a new scene object.
* \param queue the queue to put newly rendered/emptied scenes into
*/
struct lp_scene *
lp_scene_create( struct pipe_context *pipe )
{
struct lp_scene *scene = CALLOC_STRUCT(lp_scene);
if (!scene)
return NULL;
scene->pipe = pipe;
scene->data.head =
CALLOC_STRUCT(data_block);
pipe_mutex_init(scene->mutex);
#ifdef DEBUG
/* Do some scene limit sanity checks here */
{
size_t maxBins = TILES_X * TILES_Y;
size_t maxCommandBytes = sizeof(struct cmd_block) * maxBins;
size_t maxCommandPlusData = maxCommandBytes + DATA_BLOCK_SIZE;
/* We'll need at least one command block per bin. Make sure that's
* less than the max allowed scene size.
*/
assert(maxCommandBytes < LP_SCENE_MAX_SIZE);
/* We'll also need space for at least one other data block */
assert(maxCommandPlusData <= LP_SCENE_MAX_SIZE);
}
#endif
return scene;
}
示例9: rbug_screen_create
struct pipe_screen *
rbug_screen_create(struct pipe_screen *screen)
{
struct rbug_screen *rb_screen;
if (!debug_get_option_rbug())
return screen;
rb_screen = CALLOC_STRUCT(rbug_screen);
if (!rb_screen)
return screen;
pipe_mutex_init(rb_screen->list_mutex);
make_empty_list(&rb_screen->contexts);
make_empty_list(&rb_screen->resources);
make_empty_list(&rb_screen->surfaces);
make_empty_list(&rb_screen->transfers);
rb_screen->base.winsys = NULL;
rb_screen->base.destroy = rbug_screen_destroy;
rb_screen->base.get_name = rbug_screen_get_name;
rb_screen->base.get_vendor = rbug_screen_get_vendor;
rb_screen->base.get_param = rbug_screen_get_param;
rb_screen->base.get_shader_param = rbug_screen_get_shader_param;
rb_screen->base.get_paramf = rbug_screen_get_paramf;
rb_screen->base.is_format_supported = rbug_screen_is_format_supported;
rb_screen->base.context_create = rbug_screen_context_create;
rb_screen->base.resource_create = rbug_screen_resource_create;
rb_screen->base.resource_from_handle = rbug_screen_resource_from_handle;
rb_screen->base.resource_get_handle = rbug_screen_resource_get_handle;
rb_screen->base.resource_destroy = rbug_screen_resource_destroy;
rb_screen->base.user_buffer_create = rbug_screen_user_buffer_create;
rb_screen->base.flush_frontbuffer = rbug_screen_flush_frontbuffer;
rb_screen->base.fence_reference = rbug_screen_fence_reference;
rb_screen->base.fence_signalled = rbug_screen_fence_signalled;
rb_screen->base.fence_finish = rbug_screen_fence_finish;
rb_screen->screen = screen;
rb_screen->private_context = screen->context_create(screen, NULL);
if (!rb_screen->private_context)
goto err_free;
rb_screen->rbug = rbug_start(rb_screen);
if (!rb_screen->rbug)
goto err_context;
return &rb_screen->base;
err_context:
rb_screen->private_context->destroy(rb_screen->private_context);
err_free:
FREE(rb_screen);
return screen;
}
示例10: xmesa_init_display
static XMesaDisplay
xmesa_init_display( Display *display )
{
pipe_static_mutex(init_mutex);
XMesaDisplay xmdpy;
int i;
pipe_mutex_lock(init_mutex);
/* Look for XMesaDisplay which corresponds to 'display' */
for (i = 0; i < NumDisplays; i++) {
if (Displays[i].display == display) {
/* Found it */
pipe_mutex_unlock(init_mutex);
return &Displays[i];
}
}
/* Create new XMesaDisplay */
assert(NumDisplays < MAX_DISPLAYS);
xmdpy = &Displays[NumDisplays];
NumDisplays++;
if (!xmdpy->display && display) {
xmdpy->display = display;
xmdpy->screen = driver.create_pipe_screen(display);
xmdpy->smapi = CALLOC_STRUCT(st_manager);
if (xmdpy->smapi) {
xmdpy->smapi->screen = xmdpy->screen;
xmdpy->smapi->get_param = xmesa_get_param;
}
if (xmdpy->screen && xmdpy->smapi) {
pipe_mutex_init(xmdpy->mutex);
}
else {
if (xmdpy->screen) {
xmdpy->screen->destroy(xmdpy->screen);
xmdpy->screen = NULL;
}
if (xmdpy->smapi) {
FREE(xmdpy->smapi);
xmdpy->smapi = NULL;
}
xmdpy->display = NULL;
}
}
if (!xmdpy->display || xmdpy->display != display)
xmdpy = NULL;
pipe_mutex_unlock(init_mutex);
return xmdpy;
}
示例11: util_queue_init
void
util_queue_init(struct util_queue *queue,
void (*execute_job)(void *))
{
memset(queue, 0, sizeof(*queue));
queue->execute_job = execute_job;
pipe_mutex_init(queue->lock);
pipe_semaphore_init(&queue->has_space, ARRAY_SIZE(queue->jobs));
pipe_semaphore_init(&queue->queued, 0);
queue->thread = pipe_thread_create(util_queue_thread_func, queue);
}
示例12: virgl_drm_winsys_create
static struct virgl_winsys *
virgl_drm_winsys_create(int drmFD)
{
struct virgl_drm_winsys *qdws;
qdws = CALLOC_STRUCT(virgl_drm_winsys);
if (!qdws)
return NULL;
qdws->fd = drmFD;
qdws->num_delayed = 0;
qdws->usecs = 1000000;
LIST_INITHEAD(&qdws->delayed);
pipe_mutex_init(qdws->mutex);
pipe_mutex_init(qdws->bo_handles_mutex);
qdws->bo_handles = util_hash_table_create(handle_hash, handle_compare);
qdws->bo_names = util_hash_table_create(handle_hash, handle_compare);
qdws->base.destroy = virgl_drm_winsys_destroy;
qdws->base.transfer_put = virgl_bo_transfer_put;
qdws->base.transfer_get = virgl_bo_transfer_get;
qdws->base.resource_create = virgl_drm_winsys_resource_cache_create;
qdws->base.resource_unref = virgl_drm_winsys_resource_unref;
qdws->base.resource_create_from_handle = virgl_drm_winsys_resource_create_handle;
qdws->base.resource_get_handle = virgl_drm_winsys_resource_get_handle;
qdws->base.resource_map = virgl_drm_resource_map;
qdws->base.resource_wait = virgl_drm_resource_wait;
qdws->base.cmd_buf_create = virgl_drm_cmd_buf_create;
qdws->base.cmd_buf_destroy = virgl_drm_cmd_buf_destroy;
qdws->base.submit_cmd = virgl_drm_winsys_submit_cmd;
qdws->base.emit_res = virgl_drm_emit_res;
qdws->base.res_is_referenced = virgl_drm_res_is_ref;
qdws->base.cs_create_fence = virgl_cs_create_fence;
qdws->base.fence_wait = virgl_fence_wait;
qdws->base.fence_reference = virgl_fence_reference;
qdws->base.get_caps = virgl_drm_get_caps;
return &qdws->base;
}
示例13: r300_screen_create
struct pipe_screen* r300_screen_create(struct radeon_winsys *rws)
{
struct r300_screen *r300screen = CALLOC_STRUCT(r300_screen);
if (!r300screen) {
FREE(r300screen);
return NULL;
}
rws->query_info(rws, &r300screen->info);
r300_init_debug(r300screen);
r300_parse_chipset(r300screen->info.pci_id, &r300screen->caps);
if (SCREEN_DBG_ON(r300screen, DBG_NO_ZMASK))
r300screen->caps.zmask_ram = 0;
if (SCREEN_DBG_ON(r300screen, DBG_NO_HIZ))
r300screen->caps.hiz_ram = 0;
if (r300screen->info.drm_minor < 8)
r300screen->caps.has_us_format = FALSE;
pipe_mutex_init(r300screen->num_contexts_mutex);
util_slab_create(&r300screen->pool_buffers,
sizeof(struct r300_resource), 64,
UTIL_SLAB_SINGLETHREADED);
r300screen->rws = rws;
r300screen->screen.winsys = (struct pipe_winsys*)rws;
r300screen->screen.destroy = r300_destroy_screen;
r300screen->screen.get_name = r300_get_name;
r300screen->screen.get_vendor = r300_get_vendor;
r300screen->screen.get_param = r300_get_param;
r300screen->screen.get_shader_param = r300_get_shader_param;
r300screen->screen.get_paramf = r300_get_paramf;
r300screen->screen.get_video_param = r300_get_video_param;
r300screen->screen.is_format_supported = r300_is_format_supported;
r300screen->screen.is_video_format_supported = vl_video_buffer_is_format_supported;
r300screen->screen.context_create = r300_create_context;
r300screen->screen.fence_reference = r300_fence_reference;
r300screen->screen.fence_signalled = r300_fence_signalled;
r300screen->screen.fence_finish = r300_fence_finish;
r300_init_screen_resource_functions(r300screen);
util_format_s3tc_init();
return &r300screen->screen;
}
示例14: fOptions
GalliumContext::GalliumContext(ulong options)
:
fOptions(options),
fScreen(NULL),
fCurrentContext(0)
{
CALLED();
// Make all contexts a known value
for (context_id i = 0; i < CONTEXT_MAX; i++)
fContext[i] = NULL;
CreateScreen();
pipe_mutex_init(fMutex);
}
示例15: lp_scene_create
/**
* Create a new scene object.
* \param queue the queue to put newly rendered/emptied scenes into
*/
struct lp_scene *
lp_scene_create( struct pipe_context *pipe )
{
struct lp_scene *scene = CALLOC_STRUCT(lp_scene);
if (!scene)
return NULL;
scene->pipe = pipe;
scene->data.head =
CALLOC_STRUCT(data_block);
pipe_mutex_init(scene->mutex);
return scene;
}