diff mbox

[Intel,gfx,i-g-t,1/4] lib: Clean the batch buffer store after reset

Message ID 1386320087-3017-1-git-send-email-haihao.xiang@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Xiang, Haihao Dec. 6, 2013, 8:54 a.m. UTC
From: "Xiang, Haihao" <haihao.xiang@intel.com>

Otherwise the stale data in the buffer

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
---
 lib/intel_batchbuffer.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Kenneth Graunke Dec. 6, 2013, 10:14 a.m. UTC | #1
On 12/06/2013 12:54 AM, Xiang, Haihao wrote:
> From: "Xiang, Haihao" <haihao.xiang@intel.com>
> 
> Otherwise the stale data in the buffer
> 
> Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
> ---
>  lib/intel_batchbuffer.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> index 06a5437..9ce7424 100644
> --- a/lib/intel_batchbuffer.c
> +++ b/lib/intel_batchbuffer.c
> @@ -50,6 +50,8 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
>  	batch->bo = drm_intel_bo_alloc(batch->bufmgr, "batchbuffer",
>  				       BATCH_SZ, 4096);
>  
> +	memset(batch->buffer, 0, sizeof(batch->buffer));
> +
>  	batch->ptr = batch->buffer;
>  }
>  
> 

I don't think that should be harmful, but this would definitely make
debugging nicer.  For intel-gpu-tools, I think it makes sense.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Lespiau, Damien Dec. 6, 2013, 1:03 p.m. UTC | #2
On Fri, Dec 06, 2013 at 02:14:52AM -0800, Kenneth Graunke wrote:
> On 12/06/2013 12:54 AM, Xiang, Haihao wrote:
> > From: "Xiang, Haihao" <haihao.xiang@intel.com>
> > 
> > Otherwise the stale data in the buffer
> > 
> > Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
> > ---
> >  lib/intel_batchbuffer.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> > index 06a5437..9ce7424 100644
> > --- a/lib/intel_batchbuffer.c
> > +++ b/lib/intel_batchbuffer.c
> > @@ -50,6 +50,8 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch)
> >  	batch->bo = drm_intel_bo_alloc(batch->bufmgr, "batchbuffer",
> >  				       BATCH_SZ, 4096);
> >  
> > +	memset(batch->buffer, 0, sizeof(batch->buffer));
> > +
> >  	batch->ptr = batch->buffer;
> >  }
> >  
> > 
> 
> I don't think that should be harmful, but this would definitely make
> debugging nicer.  For intel-gpu-tools, I think it makes sense.
> 
> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

Indeed, I think it makes sense as well, thanks for the patch and review, pushed.
diff mbox

Patch

diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index 06a5437..9ce7424 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -50,6 +50,8 @@  intel_batchbuffer_reset(struct intel_batchbuffer *batch)
 	batch->bo = drm_intel_bo_alloc(batch->bufmgr, "batchbuffer",
 				       BATCH_SZ, 4096);
 
+	memset(batch->buffer, 0, sizeof(batch->buffer));
+
 	batch->ptr = batch->buffer;
 }