i965: Fix shadow batches to be the same size as the real BO.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 13 Apr 2018 18:48:06 +0000 (11:48 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 18 Apr 2018 20:55:08 +0000 (13:55 -0700)
commitda25ae92bebb8921003c0df30820d06a5f5e3fef
tree0cabf88c35ba87f19d3d2849d918a31210f48870
parent7bd24d951a69292b5a8090000541ece2142591ef
i965: Fix shadow batches to be the same size as the real BO.

brw_bo_alloc may round up our allocation size to the next bucket size.
In this case, we would malloc a shadow buffer that was the original
intended size, but use bo->size (the larger size) for all of our checks.

This could cause us to run off the end of the shadow buffer.

v2: Actually use the new BO size (caught by Lionel)

Reported-by: James Xiong <james.xiong@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: c7dcee58b5fe183e1653c13bff6a212f0d157b29 (i965: Avoid problems from referencing orphaned BOs after growing.)
src/mesa/drivers/dri/i965/intel_batchbuffer.c