summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2015-04-09 09:52:44 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2016-11-18 16:26:47 +0800
commit5762b3697ff5908b9bd8392fb936be8f7396c156 (patch)
tree5a6f7720327bbcbbb1e8a97b6279656a035b32f7
parent8c8ee4961682a8f69fc9d91844f4284bcd4bf710 (diff)
Fix the size calculation of the required memory for dynamic state buffer
Make sure the size for each part in dynamic state buffer is multiple of 64 bytes. Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com> Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
-rw-r--r--src/i965_gpe_utils.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/i965_gpe_utils.c b/src/i965_gpe_utils.c
index d7286fc..139ab1b 100644
--- a/src/i965_gpe_utils.c
+++ b/src/i965_gpe_utils.c
@@ -1122,8 +1122,9 @@ gen8_gpe_context_init(VADriverContextP ctx,
assert(bo);
gpe_context->surface_state_binding_table.bo = bo;
- bo_size = gpe_context->idrt.max_entries * gpe_context->idrt.entry_size + gpe_context->curbe.length +
- gpe_context->sampler.max_entries * gpe_context->sampler.entry_size + 192;
+ bo_size = gpe_context->idrt.max_entries * ALIGN(gpe_context->idrt.entry_size, 64) +
+ ALIGN(gpe_context->curbe.length, 64) +
+ gpe_context->sampler.max_entries * ALIGN(gpe_context->sampler.entry_size, 64);
dri_bo_unreference(gpe_context->dynamic_state.bo);
bo = dri_bo_alloc(i965->intel.bufmgr,
"surface state & binding table",
@@ -1150,7 +1151,7 @@ gen8_gpe_context_init(VADriverContextP ctx,
gpe_context->idrt.bo = bo;
dri_bo_reference(gpe_context->idrt.bo);
gpe_context->idrt.offset = start_offset;
- end_offset = start_offset + gpe_context->idrt.entry_size * gpe_context->idrt.max_entries;
+ end_offset = start_offset + ALIGN(gpe_context->idrt.entry_size, 64) * gpe_context->idrt.max_entries;
/* Sampler state offset */
start_offset = ALIGN(end_offset, 64);
@@ -1158,7 +1159,7 @@ gen8_gpe_context_init(VADriverContextP ctx,
gpe_context->sampler.bo = bo;
dri_bo_reference(gpe_context->sampler.bo);
gpe_context->sampler.offset = start_offset;
- end_offset = start_offset + gpe_context->sampler.entry_size * gpe_context->sampler.max_entries;
+ end_offset = start_offset + ALIGN(gpe_context->sampler.entry_size, 64) * gpe_context->sampler.max_entries;
/* update the end offset of dynamic_state */
gpe_context->dynamic_state.end_offset = end_offset;