本文整理汇总了C++中pipe_mutex_lock函数的典型用法代码示例。如果您正苦于以下问题:C++ pipe_mutex_lock函数的具体用法?C++ pipe_mutex_lock怎么用?C++ pipe_mutex_lock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pipe_mutex_lock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rbug_context_create_surface
static struct pipe_surface *
rbug_context_create_surface(struct pipe_context *_pipe,
struct pipe_resource *_resource,
const struct pipe_surface *surf_tmpl)
{
struct rbug_context *rb_pipe = rbug_context(_pipe);
struct rbug_resource *rb_resource = rbug_resource(_resource);
struct pipe_context *pipe = rb_pipe->pipe;
struct pipe_resource *resource = rb_resource->resource;
struct pipe_surface *result;
pipe_mutex_lock(rb_pipe->call_mutex);
result = pipe->create_surface(pipe,
resource,
surf_tmpl);
pipe_mutex_unlock(rb_pipe->call_mutex);
if (result)
return rbug_surface_create(rb_pipe, rb_resource, result);
return NULL;
}
示例2: vlVdpOutputSurfaceGetBitsNative
/**
* Copy image data from a VdpOutputSurface to application memory in the
* surface's native format.
*/
VdpStatus
vlVdpOutputSurfaceGetBitsNative(VdpOutputSurface surface,
VdpRect const *source_rect,
void *const *destination_data,
uint32_t const *destination_pitches)
{
vlVdpOutputSurface *vlsurface;
struct pipe_context *pipe;
struct pipe_resource *res;
struct pipe_box box;
struct pipe_transfer *transfer;
uint8_t *map;
vlsurface = vlGetDataHTAB(surface);
if (!vlsurface)
return VDP_STATUS_INVALID_HANDLE;
pipe = vlsurface->device->context;
if (!pipe)
return VDP_STATUS_INVALID_HANDLE;
pipe_mutex_lock(vlsurface->device->mutex);
vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL);
res = vlsurface->sampler_view->texture;
box = RectToPipeBox(source_rect, res);
map = pipe->transfer_map(pipe, res, 0, PIPE_TRANSFER_READ, &box, &transfer);
if (!map) {
pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_RESOURCES;
}
util_copy_rect(*destination_data, res->format, *destination_pitches, 0, 0,
box.width, box.height, map, transfer->stride, 0, 0);
pipe_transfer_unmap(pipe, transfer);
pipe_mutex_unlock(vlsurface->device->mutex);
return VDP_STATUS_OK;
}
示例3: vlVaDestroyImage
VAStatus
vlVaDestroyImage(VADriverContextP ctx, VAImageID image)
{
vlVaDriver *drv;
VAImage *vaimage;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
pipe_mutex_lock(drv->mutex);
vaimage = handle_table_get(drv->htab, image);
if (!vaimage) {
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_ERROR_INVALID_IMAGE;
}
handle_table_remove(VL_VA_DRIVER(ctx)->htab, image);
pipe_mutex_unlock(drv->mutex);
FREE(vaimage);
return vlVaDestroyBuffer(ctx, vaimage->buf);
}
示例4: pb_cache_manager_flush
static void
pb_cache_manager_flush(struct pb_manager *_mgr)
{
struct pb_cache_manager *mgr = pb_cache_manager(_mgr);
struct list_head *curr, *next;
struct pb_cache_buffer *buf;
pipe_mutex_lock(mgr->mutex);
curr = mgr->delayed.next;
next = curr->next;
while(curr != &mgr->delayed) {
buf = LIST_ENTRY(struct pb_cache_buffer, curr, head);
_pb_cache_buffer_destroy(buf);
curr = next;
next = curr->next;
}
pipe_mutex_unlock(mgr->mutex);
assert(mgr->provider->flush);
if(mgr->provider->flush)
mgr->provider->flush(mgr->provider);
}
示例5: virgl_drm_resource_reference
static void virgl_drm_resource_reference(struct virgl_drm_winsys *qdws,
struct virgl_hw_res **dres,
struct virgl_hw_res *sres)
{
struct virgl_hw_res *old = *dres;
if (pipe_reference(&(*dres)->reference, &sres->reference)) {
if (!can_cache_resource(old)) {
virgl_hw_res_destroy(qdws, old);
} else {
pipe_mutex_lock(qdws->mutex);
virgl_cache_list_check_free(qdws);
old->start = os_time_get();
old->end = old->start + qdws->usecs;
LIST_ADDTAIL(&old->head, &qdws->delayed);
qdws->num_delayed++;
pipe_mutex_unlock(qdws->mutex);
}
}
*dres = sres;
}
示例6: rbug_clear_render_target
static void
rbug_clear_render_target(struct pipe_context *_pipe,
struct pipe_surface *_dst,
const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
unsigned width, unsigned height)
{
struct rbug_context *rb_pipe = rbug_context(_pipe);
struct rbug_surface *rb_surface_dst = rbug_surface(_dst);
struct pipe_context *pipe = rb_pipe->pipe;
struct pipe_surface *dst = rb_surface_dst->surface;
pipe_mutex_lock(rb_pipe->call_mutex);
pipe->clear_render_target(pipe,
dst,
color,
dstx,
dsty,
width,
height);
pipe_mutex_unlock(rb_pipe->call_mutex);
}
示例7: pb_debug_buffer_map
static void *
pb_debug_buffer_map(struct pb_buffer *_buf,
unsigned flags)
{
struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
void *map;
pb_debug_buffer_check(buf);
map = pb_map(buf->buffer, flags);
if(!map)
return NULL;
if(map) {
pipe_mutex_lock(buf->mutex);
++buf->map_count;
debug_backtrace_capture(buf->map_backtrace, 1, PB_DEBUG_MAP_BACKTRACE);
pipe_mutex_unlock(buf->mutex);
}
return (uint8_t *)map + buf->underflow_size;
}
示例8: stw_st_framebuffer_flush_front
static boolean
stw_st_framebuffer_flush_front(struct st_context_iface *stctx,
struct st_framebuffer_iface *stfb,
enum st_attachment_type statt)
{
struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
boolean ret;
HDC hDC;
pipe_mutex_lock(stwfb->fb->mutex);
/* We must not cache HDCs anywhere, as they can be invalidated by the
* application, or screen resolution changes. */
hDC = GetDC(stwfb->fb->hWnd);
ret = stw_st_framebuffer_present_locked(hDC, &stwfb->base, statt);
ReleaseDC(stwfb->fb->hWnd, hDC);
return ret;
}
示例9: vlVaMapBuffer
VAStatus
vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff)
{
vlVaDriver *drv;
vlVaBuffer *buf;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
if (!drv)
return VA_STATUS_ERROR_INVALID_CONTEXT;
if (!pbuff)
return VA_STATUS_ERROR_INVALID_PARAMETER;
pipe_mutex_lock(drv->mutex);
buf = handle_table_get(drv->htab, buf_id);
if (!buf || buf->export_refcount > 0) {
pipe_mutex_unlock(drv->mutex);
return VA_STATUS_ERROR_INVALID_BUFFER;
}
if (buf->derived_surface.resource) {
*pbuff = pipe_buffer_map(drv->pipe, buf->derived_surface.resource,
PIPE_TRANSFER_WRITE,
&buf->derived_surface.transfer);
pipe_mutex_unlock(drv->mutex);
if (!buf->derived_surface.transfer || !*pbuff)
return VA_STATUS_ERROR_INVALID_BUFFER;
} else {
pipe_mutex_unlock(drv->mutex);
*pbuff = buf->data;
}
return VA_STATUS_SUCCESS;
}
示例10: debug_malloc
void *
debug_malloc(const char *file, unsigned line, const char *function,
size_t size)
{
struct debug_memory_header *hdr;
struct debug_memory_footer *ftr;
hdr = os_malloc(sizeof(*hdr) + size + sizeof(*ftr));
if(!hdr) {
debug_printf("%s:%u:%s: out of memory when trying to allocate %lu bytes\n",
file, line, function,
(long unsigned)size);
return NULL;
}
hdr->no = last_no++;
hdr->file = file;
hdr->line = line;
hdr->function = function;
hdr->size = size;
hdr->magic = DEBUG_MEMORY_MAGIC;
hdr->tag = 0;
#if DEBUG_FREED_MEMORY
hdr->freed = FALSE;
#endif
#if DEBUG_MEMORY_STACK
debug_backtrace_capture(hdr->backtrace, 0, DEBUG_MEMORY_STACK);
#endif
ftr = footer_from_header(hdr);
ftr->magic = DEBUG_MEMORY_MAGIC;
pipe_mutex_lock(list_mutex);
LIST_ADDTAIL(&hdr->head, &list);
pipe_mutex_unlock(list_mutex);
return data_from_header(hdr);
}
示例11: pb_cache_release_all_buffers
/**
* Empty the cache. Useful when there is not enough memory.
*/
void
pb_cache_release_all_buffers(struct pb_cache *mgr)
{
struct list_head *curr, *next;
struct pb_cache_entry *buf;
unsigned i;
pipe_mutex_lock(mgr->mutex);
for (i = 0; i < ARRAY_SIZE(mgr->buckets); i++) {
struct list_head *cache = &mgr->buckets[i];
curr = cache->next;
next = curr->next;
while (curr != cache) {
buf = LIST_ENTRY(struct pb_cache_entry, curr, head);
destroy_buffer_locked(buf);
curr = next;
next = curr->next;
}
}
pipe_mutex_unlock(mgr->mutex);
}
示例12: intel_winsys_decode_bo
void
intel_winsys_decode_bo(struct intel_winsys *winsys,
struct intel_bo *bo, int used)
{
void *ptr;
ptr = intel_bo_map(bo, false);
if (!ptr) {
debug_printf("failed to map buffer for decoding\n");
return;
}
pipe_mutex_lock(winsys->mutex);
if (!winsys->decode) {
winsys->decode = drm_intel_decode_context_alloc(winsys->info.devid);
if (!winsys->decode) {
pipe_mutex_unlock(winsys->mutex);
intel_bo_unmap(bo);
return;
}
/* debug_printf()/debug_error() uses stderr by default */
drm_intel_decode_set_output_file(winsys->decode, stderr);
}
/* in dwords */
used /= 4;
drm_intel_decode_set_batch_pointer(winsys->decode,
ptr, gem_bo(bo)->offset64, used);
drm_intel_decode(winsys->decode);
pipe_mutex_unlock(winsys->mutex);
intel_bo_unmap(bo);
}
示例13: rbug_set_framebuffer_state
static void
rbug_set_framebuffer_state(struct pipe_context *_pipe,
const struct pipe_framebuffer_state *_state)
{
struct rbug_context *rb_pipe = rbug_context(_pipe);
struct pipe_context *pipe = rb_pipe->pipe;
struct pipe_framebuffer_state unwrapped_state;
struct pipe_framebuffer_state *state = NULL;
unsigned i;
/* must protect curr status */
pipe_mutex_lock(rb_pipe->call_mutex);
rb_pipe->curr.nr_cbufs = 0;
memset(rb_pipe->curr.cbufs, 0, sizeof(rb_pipe->curr.cbufs));
rb_pipe->curr.zsbuf = NULL;
/* unwrap the input state */
if (_state) {
memcpy(&unwrapped_state, _state, sizeof(unwrapped_state));
rb_pipe->curr.nr_cbufs = _state->nr_cbufs;
for(i = 0; i < _state->nr_cbufs; i++) {
unwrapped_state.cbufs[i] = rbug_surface_unwrap(_state->cbufs[i]);
if (_state->cbufs[i])
rb_pipe->curr.cbufs[i] = rbug_resource(_state->cbufs[i]->texture);
}
unwrapped_state.zsbuf = rbug_surface_unwrap(_state->zsbuf);
if (_state->zsbuf)
rb_pipe->curr.zsbuf = rbug_resource(_state->zsbuf->texture);
state = &unwrapped_state;
}
pipe->set_framebuffer_state(pipe,
state);
pipe_mutex_unlock(rb_pipe->call_mutex);
}
示例14: vlVaQueryConfigAttributes
VAStatus
vlVaQueryConfigAttributes(VADriverContextP ctx, VAConfigID config_id, VAProfile *profile,
VAEntrypoint *entrypoint, VAConfigAttrib *attrib_list, int *num_attribs)
{
vlVaDriver *drv;
vlVaConfig *config;
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
drv = VL_VA_DRIVER(ctx);
if (!drv)
return VA_STATUS_ERROR_INVALID_CONTEXT;
pipe_mutex_lock(drv->mutex);
config = handle_table_get(drv->htab, config_id);
pipe_mutex_unlock(drv->mutex);
if (!config)
return VA_STATUS_ERROR_INVALID_CONFIG;
*profile = PipeToProfile(config->profile);
if (config->profile == PIPE_VIDEO_PROFILE_UNKNOWN) {
*entrypoint = VAEntrypointVideoProc;
*num_attribs = 0;
return VA_STATUS_SUCCESS;
}
*entrypoint = config->entrypoint;
*num_attribs = 1;
attrib_list[0].type = VAConfigAttribRTFormat;
attrib_list[0].value = config->rt_format;
return VA_STATUS_SUCCESS;
}
示例15: lp_setup_rasterize_scene
/** Rasterize all scene's bins */
static void
lp_setup_rasterize_scene( struct lp_setup_context *setup )
{
struct lp_scene *scene = setup->scene;
struct llvmpipe_screen *screen = llvmpipe_screen(scene->pipe->screen);
scene->num_active_queries = setup->active_binned_queries;
memcpy(scene->active_queries, setup->active_queries,
scene->num_active_queries * sizeof(scene->active_queries[0]));
lp_scene_end_binning(scene);
lp_fence_reference(&setup->last_fence, scene->fence);
if (setup->last_fence)
setup->last_fence->issued = TRUE;
pipe_mutex_lock(screen->rast_mutex);
/* FIXME: We enqueue the scene then wait on the rasterizer to finish.
* This means we never actually run any vertex stuff in parallel to
* rasterization (not in the same context at least) which is what the
* multiple scenes per setup is about - when we get a new empty scene
* any old one is already empty again because we waited here for
* raster tasks to be finished. Ideally, we shouldn't need to wait here
* and rely on fences elsewhere when waiting is necessary.
* Certainly, lp_scene_end_rasterization() would need to be deferred too
* and there's probably other bits why this doesn't actually work.
*/
lp_rast_queue_scene(screen->rast, scene);
lp_rast_finish(screen->rast);
pipe_mutex_unlock(screen->rast_mutex);
lp_scene_end_rasterization(setup->scene);
lp_setup_reset( setup );
LP_DBG(DEBUG_SETUP, "%s done \n", __FUNCTION__);
}