OSDN Git Service

i965: Allocate shadow batches to explicitly be the BO size.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 13 Apr 2018 22:35:56 +0000 (15:35 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 2 May 2018 16:26:55 +0000 (09:26 -0700)
commit5c049718318bfd9957aaa8f232d40286e101f02f
tree7bf79e9ab8afaf6cbb74d4ea0cab634c2eb81c10
parentec5df73803f101276973eeb780d1591462e5e0a6
i965: Allocate shadow batches to explicitly be the BO size.

This unfortunately makes it malloc/realloc on every new batch, rather
than once at startup.  But it ensures that the shadow buffer's size will
absolutely match the BO size.  Otherwise, as we tune BATCH_SZ/STATE_SZ
or bufmgr cache bucket sizes, we may get a BO size that's rounded up,
and fail to allocate the shadow buffer large enough.

This doesn't fix any bugs today, as BATCH_SZ/STATE_SZ are the size of
a cache bucket, but it's better to be safe than sorry.

Reported-by: James Xiong <james.xiong@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/mesa/drivers/dri/i965/intel_batchbuffer.c