summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--intel/intel_bufmgr.h6
-rw-r--r--intel/intel_bufmgr_gem.c31
2 files changed, 33 insertions, 4 deletions
diff --git a/intel/intel_bufmgr.h b/intel/intel_bufmgr.h
index f43ee470..11579fbc 100644
--- a/intel/intel_bufmgr.h
+++ b/intel/intel_bufmgr.h
@@ -221,6 +221,12 @@ int drm_intel_gem_context_get_id(drm_intel_context *ctx,
221void drm_intel_gem_context_destroy(drm_intel_context *ctx); 221void drm_intel_gem_context_destroy(drm_intel_context *ctx);
222int drm_intel_gem_bo_context_exec(drm_intel_bo *bo, drm_intel_context *ctx, 222int drm_intel_gem_bo_context_exec(drm_intel_bo *bo, drm_intel_context *ctx,
223 int used, unsigned int flags); 223 int used, unsigned int flags);
224int drm_intel_gem_bo_fence_exec(drm_intel_bo *bo,
225 drm_intel_context *ctx,
226 int used,
227 int in_fence,
228 int *out_fence,
229 unsigned int flags);
224 230
225int drm_intel_bo_gem_export_to_prime(drm_intel_bo *bo, int *prime_fd); 231int drm_intel_bo_gem_export_to_prime(drm_intel_bo *bo, int *prime_fd);
226drm_intel_bo *drm_intel_bo_gem_create_from_prime(drm_intel_bufmgr *bufmgr, 232drm_intel_bo *drm_intel_bo_gem_create_from_prime(drm_intel_bufmgr *bufmgr,
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index 554d079b..9195f3e6 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -2376,6 +2376,7 @@ drm_intel_gem_bo_exec(drm_intel_bo *bo, int used,
2376static int 2376static int
2377do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx, 2377do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
2378 drm_clip_rect_t *cliprects, int num_cliprects, int DR4, 2378 drm_clip_rect_t *cliprects, int num_cliprects, int DR4,
2379 int in_fence, int *out_fence,
2379 unsigned int flags) 2380 unsigned int flags)
2380{ 2381{
2381 drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr; 2382 drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;
@@ -2430,12 +2431,20 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
2430 else 2431 else
2431 i915_execbuffer2_set_context_id(execbuf, ctx->ctx_id); 2432 i915_execbuffer2_set_context_id(execbuf, ctx->ctx_id);
2432 execbuf.rsvd2 = 0; 2433 execbuf.rsvd2 = 0;
2434 if (in_fence != -1) {
2435 execbuf.rsvd2 = in_fence;
2436 execbuf.flags |= I915_EXEC_FENCE_IN;
2437 }
2438 if (out_fence != NULL) {
2439 *out_fence = -1;
2440 execbuf.flags |= I915_EXEC_FENCE_OUT;
2441 }
2433 2442
2434 if (bufmgr_gem->no_exec) 2443 if (bufmgr_gem->no_exec)
2435 goto skip_execution; 2444 goto skip_execution;
2436 2445
2437 ret = drmIoctl(bufmgr_gem->fd, 2446 ret = drmIoctl(bufmgr_gem->fd,
2438 DRM_IOCTL_I915_GEM_EXECBUFFER2, 2447 DRM_IOCTL_I915_GEM_EXECBUFFER2_WR,
2439 &execbuf); 2448 &execbuf);
2440 if (ret != 0) { 2449 if (ret != 0) {
2441 ret = -errno; 2450 ret = -errno;
@@ -2451,6 +2460,9 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,
2451 } 2460 }
2452 drm_intel_update_buffer_offsets2(bufmgr_gem); 2461 drm_intel_update_buffer_offsets2(bufmgr_gem);
2453 2462
2463 if (ret == 0 && out_fence != NULL)
2464 *out_fence = execbuf.rsvd2 >> 32;
2465
2454skip_execution: 2466skip_execution:
2455 if (bufmgr_gem->bufmgr.debug) 2467 if (bufmgr_gem->bufmgr.debug)
2456 drm_intel_gem_dump_validation_list(bufmgr_gem); 2468 drm_intel_gem_dump_validation_list(bufmgr_gem);
@@ -2476,7 +2488,7 @@ drm_intel_gem_bo_exec2(drm_intel_bo *bo, int used,
2476 int DR4) 2488 int DR4)
2477{ 2489{
2478 return do_exec2(bo, used, NULL, cliprects, num_cliprects, DR4, 2490 return do_exec2(bo, used, NULL, cliprects, num_cliprects, DR4,
2479 I915_EXEC_RENDER); 2491 -1, NULL, I915_EXEC_RENDER);
2480} 2492}
2481 2493
2482static int 2494static int
@@ -2485,14 +2497,25 @@ drm_intel_gem_bo_mrb_exec2(drm_intel_bo *bo, int used,
2485 unsigned int flags) 2497 unsigned int flags)
2486{ 2498{
2487 return do_exec2(bo, used, NULL, cliprects, num_cliprects, DR4, 2499 return do_exec2(bo, used, NULL, cliprects, num_cliprects, DR4,
2488 flags); 2500 -1, NULL, flags);
2489} 2501}
2490 2502
2491int 2503int
2492drm_intel_gem_bo_context_exec(drm_intel_bo *bo, drm_intel_context *ctx, 2504drm_intel_gem_bo_context_exec(drm_intel_bo *bo, drm_intel_context *ctx,
2493 int used, unsigned int flags) 2505 int used, unsigned int flags)
2494{ 2506{
2495 return do_exec2(bo, used, ctx, NULL, 0, 0, flags); 2507 return do_exec2(bo, used, ctx, NULL, 0, 0, -1, NULL, flags);
2508}
2509
2510int
2511drm_intel_gem_bo_fence_exec(drm_intel_bo *bo,
2512 drm_intel_context *ctx,
2513 int used,
2514 int in_fence,
2515 int *out_fence,
2516 unsigned int flags)
2517{
2518 return do_exec2(bo, used, ctx, NULL, 0, 0, in_fence, out_fence, flags);
2496} 2519}
2497 2520
2498static int 2521static int