static void * brw_dri_create_fence_fd(__DRIcontext *dri_ctx, int fd) { struct brw_context *brw = dri_ctx->driverPrivate; struct brw_fence *fence; assert(brw->screen->has_exec_fence); fence = calloc(1, sizeof(*fence)); if (!fence) return NULL; brw_fence_init(brw, fence, BRW_FENCE_TYPE_SYNC_FD); if (fd == -1) { /* Create an out-fence fd */ if (!brw_fence_insert_locked(brw, fence)) goto fail; } else { /* Import the sync fd as an in-fence. */ fence->sync_fd = dup(fd); } assert(fence->sync_fd != -1); return fence; fail: brw_fence_finish(fence); free(fence); return NULL; }
static void brw_gl_fence_sync(struct gl_context *ctx, struct gl_sync_object *_sync, GLenum condition, GLbitfield flags) { struct brw_context *brw = brw_context(ctx); struct brw_gl_sync *sync = (struct brw_gl_sync *) _sync; brw_fence_init(brw, &sync->fence); brw_fence_insert(brw, &sync->fence); }
static void * brw_dri_create_fence(__DRIcontext *ctx) { struct brw_context *brw = ctx->driverPrivate; struct brw_fence *fence; fence = calloc(1, sizeof(*fence)); if (!fence) return NULL; brw_fence_init(brw, fence); brw_fence_insert(brw, fence); return fence; }
static void brw_gl_fence_sync(struct gl_context *ctx, struct gl_sync_object *_sync, GLenum condition, GLbitfield flags) { struct brw_context *brw = brw_context(ctx); struct brw_gl_sync *sync = (struct brw_gl_sync *) _sync; /* brw_fence_insert_locked() assumes it must do a complete flush */ assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE); brw_fence_init(brw, &sync->fence, BRW_FENCE_TYPE_BO_WAIT); if (!brw_fence_insert_locked(brw, &sync->fence)) { /* FIXME: There exists no way to report a GL error here. If an error * occurs, continue silently and hope for the best. */ } }
static void * brw_dri_create_fence(__DRIcontext *ctx) { struct brw_context *brw = ctx->driverPrivate; struct brw_fence *fence; fence = calloc(1, sizeof(*fence)); if (!fence) return NULL; brw_fence_init(brw, fence, BRW_FENCE_TYPE_BO_WAIT); if (!brw_fence_insert_locked(brw, fence)) { brw_fence_finish(fence); free(fence); return NULL; } return fence; }