From 249b1ad98440fee5174aa490e7c3269b88de8904 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 8 Mar 2014 17:32:37 +0800 Subject: ilo: rework winsys batch buffer functions Rename intel_winsys_check_aperture_size() to intel_winsys_can_submit_bo(), intel_bo_exec() to intel_winsys_submit_bo(), and intel_winsys_decode_commands() to intel_winsys_decode_bo(). Make a semantic change to ignore intel_context when the ring is not the render ring. --- src/gallium/winsys/intel/drm/intel_drm_winsys.c | 48 ++++++++++++++----------- src/gallium/winsys/intel/intel_winsys.h | 37 ++++++++++--------- 2 files changed, 47 insertions(+), 38 deletions(-) (limited to 'src/gallium/winsys/intel') diff --git a/src/gallium/winsys/intel/drm/intel_drm_winsys.c b/src/gallium/winsys/intel/drm/intel_drm_winsys.c index e119f9ed9a1..12ed2e43355 100644 --- a/src/gallium/winsys/intel/drm/intel_drm_winsys.c +++ b/src/gallium/winsys/intel/drm/intel_drm_winsys.c @@ -356,18 +356,38 @@ intel_winsys_export_handle(struct intel_winsys *winsys, return 0; } +bool +intel_winsys_can_submit_bo(struct intel_winsys *winsys, + struct intel_bo **bo_array, + int count) +{ + return !drm_intel_bufmgr_check_aperture_space((drm_intel_bo **) bo_array, + count); +} + int -intel_winsys_check_aperture_space(struct intel_winsys *winsys, - struct intel_bo **bo_array, - int count) +intel_winsys_submit_bo(struct intel_winsys *winsys, + struct intel_bo *bo, int used, + struct intel_context *ctx, + unsigned long flags) { - return drm_intel_bufmgr_check_aperture_space((drm_intel_bo **) bo_array, - count); + /* logical contexts are only available for the render ring */ + if ((flags & 0x7) > INTEL_EXEC_RENDER) + ctx = NULL; + + if (ctx) { + return drm_intel_gem_bo_context_exec(gem_bo(bo), + (drm_intel_context *) ctx, used, flags); + } + else { + return drm_intel_bo_mrb_exec(gem_bo(bo), + used, NULL, 0, 0, flags); + } } void -intel_winsys_decode_commands(struct intel_winsys *winsys, - struct intel_bo *bo, int used) +intel_winsys_decode_bo(struct intel_winsys *winsys, + struct intel_bo *bo, int used) { void *ptr; @@ -509,20 +529,6 @@ intel_bo_has_reloc(struct intel_bo *bo, struct intel_bo *target_bo) return drm_intel_bo_references(gem_bo(bo), gem_bo(target_bo)); } -int -intel_bo_exec(struct intel_bo *bo, int used, - struct intel_context *ctx, unsigned long flags) -{ - if (ctx) { - return drm_intel_gem_bo_context_exec(gem_bo(bo), - (drm_intel_context *) ctx, used, flags); - } - else { - return drm_intel_bo_mrb_exec(gem_bo(bo), - used, NULL, 0, 0, flags); - } -} - int intel_bo_wait(struct intel_bo *bo, int64_t timeout) { diff --git a/src/gallium/winsys/intel/intel_winsys.h b/src/gallium/winsys/intel/intel_winsys.h index b16f3a2d8a8..e84c9600c35 100644 --- a/src/gallium/winsys/intel/intel_winsys.h +++ b/src/gallium/winsys/intel/intel_winsys.h @@ -161,13 +161,26 @@ intel_winsys_export_handle(struct intel_winsys *winsys, struct winsys_handle *handle); /** - * Check that buffer objects directly specified in \p bo_array, and those - * indirectly referenced by them, can fit in the aperture space. + * Return true when buffer objects directly specified in \p bo_array, and + * those indirectly referenced by them, can fit in the aperture space. + */ +bool +intel_winsys_can_submit_bo(struct intel_winsys *winsys, + struct intel_bo **bo_array, + int count); + +/** + * Submit \p bo for execution. + * + * \p bo and all bos referenced by \p bo will be considered busy until all + * commands are parsed and executed. \p ctx is ignored when the bo is not + * submitted to the render ring. */ int -intel_winsys_check_aperture_space(struct intel_winsys *winsys, - struct intel_bo **bo_array, - int count); +intel_winsys_submit_bo(struct intel_winsys *winsys, + struct intel_bo *bo, int used, + struct intel_context *ctx, + unsigned long flags); /** * Decode the commands contained in \p bo. For debugging. @@ -176,8 +189,8 @@ intel_winsys_check_aperture_space(struct intel_winsys *winsys, * \param used Size of the commands in bytes. */ void -intel_winsys_decode_commands(struct intel_winsys *winsys, - struct intel_bo *bo, int used); +intel_winsys_decode_bo(struct intel_winsys *winsys, + struct intel_bo *bo, int used); /** * Increase the reference count of \p bo. @@ -273,16 +286,6 @@ intel_bo_truncate_relocs(struct intel_bo *bo, int start); bool intel_bo_has_reloc(struct intel_bo *bo, struct intel_bo *target_bo); -/** - * Submit \p bo for execution. - * - * \p bo and all bos referenced by \p bo will be considered busy until all - * commands are parsed and executed. - */ -int -intel_bo_exec(struct intel_bo *bo, int used, - struct intel_context *ctx, unsigned long flags); - /** * Wait until \bo is idle, or \p timeout nanoseconds have passed. A * negative timeout means to wait indefinitely. -- cgit v1.2.3