static void mm_buffer_fence(struct pb_buffer *buf, struct pipe_fence_handle *fence) { struct mm_buffer *mm_buf = mm_buffer(buf); struct mm_pb_manager *mm = mm_buf->mgr; pb_fence(mm->buffer, fence); }
static enum pipe_error mm_buffer_validate(struct pb_buffer *buf, struct pb_validate *vl, unsigned flags) { struct mm_buffer *mm_buf = mm_buffer(buf); struct mm_pb_manager *mm = mm_buf->mgr; return pb_validate(mm->buffer, vl, flags); }
static void * mm_buffer_map(struct pb_buffer *buf, unsigned flags) { struct mm_buffer *mm_buf = mm_buffer(buf); struct mm_pb_manager *mm = mm_buf->mgr; return (unsigned char *) mm->map + mm_buf->block->ofs; }
static void mm_buffer_get_base_buffer(struct pb_buffer *buf, struct pb_buffer **base_buf, pb_size *offset) { struct mm_buffer *mm_buf = mm_buffer(buf); struct mm_pb_manager *mm = mm_buf->mgr; pb_get_base_buffer(mm->buffer, base_buf, offset); *offset += mm_buf->block->ofs; }
static void * mm_buffer_map(struct pb_buffer *buf, unsigned flags, void *flush_ctx) { struct mm_buffer *mm_buf = mm_buffer(buf); struct mm_pb_manager *mm = mm_buf->mgr; /* XXX: it will be necessary to remap here to propagate flush_ctx */ return (unsigned char *) mm->map + mm_buf->block->ofs; }
static void mm_buffer_destroy(struct pb_buffer *buf) { struct mm_buffer *mm_buf = mm_buffer(buf); struct mm_pb_manager *mm = mm_buf->mgr; assert(!pipe_is_referenced(&mm_buf->base.reference)); mtx_lock(&mm->mutex); u_mmFreeMem(mm_buf->block); FREE(mm_buf); mtx_unlock(&mm->mutex); }