diff options
author | Yang Rong <rong.r.yang@intel.com> | 2014-07-02 14:29:24 +0800 |
---|---|---|
committer | Zhigang Gong <zhigang.gong@intel.com> | 2014-07-02 13:47:15 +0800 |
commit | b4e85566429a987923173a49262607a509054075 (patch) | |
tree | f5a2693caaaee97fb8fcac81a942456ad584c41a /src/intel | |
parent | 0813acb1b5db09e442685d9a8f947c94fe7c73cb (diff) |
Refine the logic when suspend a batch buffer.
Clear the gpgpu's batch buffer when suspend to avoid potential issue.
Signed-off-by: Yang Rong <rong.r.yang@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/intel_batchbuffer.c | 12 | ||||
-rw-r--r-- | src/intel/intel_batchbuffer.h | 1 | ||||
-rw-r--r-- | src/intel/intel_gpgpu.c | 4 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/intel/intel_batchbuffer.c b/src/intel/intel_batchbuffer.c index 19dc9018..d0da77a4 100644 --- a/src/intel/intel_batchbuffer.c +++ b/src/intel/intel_batchbuffer.c @@ -186,3 +186,15 @@ intel_batchbuffer_delete(intel_batchbuffer_t *batch) cl_free(batch); } +LOCAL void +intel_batchbuffer_take(intel_batchbuffer_t *from, intel_batchbuffer_t *to) +{ + *to = *from; + //Need not unreference the buffer, to will unreference it. + from->buffer = NULL; + from->map = NULL; + from->ptr = NULL; + from->size = 0; + from->atomic = 0; + from->enable_slm = 0; +} diff --git a/src/intel/intel_batchbuffer.h b/src/intel/intel_batchbuffer.h index 0c3bc13e..c62043e3 100644 --- a/src/intel/intel_batchbuffer.h +++ b/src/intel/intel_batchbuffer.h @@ -101,6 +101,7 @@ extern void intel_batchbuffer_init(intel_batchbuffer_t*, struct intel_driver*); extern void intel_batchbuffer_terminate(intel_batchbuffer_t*); extern void intel_batchbuffer_flush(intel_batchbuffer_t*); extern void intel_batchbuffer_reset(intel_batchbuffer_t*, size_t sz); +extern void intel_batchbuffer_take(intel_batchbuffer_t*, intel_batchbuffer_t *); static INLINE uint32_t intel_batchbuffer_space(const intel_batchbuffer_t *batch) diff --git a/src/intel/intel_gpgpu.c b/src/intel/intel_gpgpu.c index 59573063..a7c449d0 100644 --- a/src/intel/intel_gpgpu.c +++ b/src/intel/intel_gpgpu.c @@ -1209,9 +1209,7 @@ intel_gpgpu_event_pending(intel_gpgpu_t *gpgpu, intel_event_t *event) assert(event->batch == NULL); //This command haven't pengding. event->batch = intel_batchbuffer_new(gpgpu->drv); assert(event->batch); - *event->batch = *gpgpu->batch; - if(event->batch->buffer) - drm_intel_bo_reference(event->batch->buffer); + intel_batchbuffer_take(gpgpu->batch, event->batch); } static void |