cl_gpgpu_flush may be called when the batch buffer has been
released. We need to check whether there is a valid buffer
before we really take the following actions.

Signed-off-by: Zhigang Gong <[email protected]>
---
 src/intel/intel_gpgpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/intel_gpgpu.c b/src/intel/intel_gpgpu.c
index 1da6400..6af6e40 100644
--- a/src/intel/intel_gpgpu.c
+++ b/src/intel/intel_gpgpu.c
@@ -555,6 +555,8 @@ intel_gpgpu_check_binded_buf_address(intel_gpgpu_t *gpgpu)
 static void
 intel_gpgpu_flush(intel_gpgpu_t *gpgpu)
 {
+  if (!gpgpu->batch || !gpgpu->batch->buffer)
+    return;
   intel_batchbuffer_emit_mi_flush(gpgpu->batch);
   intel_batchbuffer_flush(gpgpu->batch);
   intel_gpgpu_check_binded_buf_address(gpgpu);
-- 
1.8.3.2

_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to