diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2013-12-27 15:05:44 +0800 |
---|---|---|
committer | Yakui Zhao <yakui.zhao@intel.com> | 2013-12-27 15:05:44 +0800 |
commit | 6f96ff99421a3a87d03bfe746c10058e200ddcce (patch) | |
tree | dc63d0362983065c98dc98f4941ef0a70e55af63 | |
parent | 28bca7bb56e49f7f500f1deca9825b1e9bd7744b (diff) | |
download | libva-intel-driver-6f96ff99421a3a87d03bfe746c10058e200ddcce.tar.gz libva-intel-driver-6f96ff99421a3a87d03bfe746c10058e200ddcce.tar.bz2 libva-intel-driver-6f96ff99421a3a87d03bfe746c10058e200ddcce.zip |
Fix the error of offset calculation for encoding on BDW
Currently although the encoding can work well, the offset in the internal
object is calculated incorrectly. So fix it to avoid the potential issue.
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
-rw-r--r-- | src/i965_gpe_utils.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/i965_gpe_utils.c b/src/i965_gpe_utils.c index 0d49703..6bbad2d 100644 --- a/src/i965_gpe_utils.c +++ b/src/i965_gpe_utils.c @@ -1082,7 +1082,7 @@ gen8_gpe_context_init(VADriverContextP ctx, struct i965_driver_data *i965 = i965_driver_data(ctx); dri_bo *bo; int bo_size; - unsigned int end_offset; + unsigned int start_offset, end_offset; dri_bo_unreference(gpe_context->surface_state_binding_table.bo); bo = dri_bo_alloc(i965->intel.bufmgr, @@ -1106,16 +1106,19 @@ gen8_gpe_context_init(VADriverContextP ctx, gpe_context->dynamic_state.end_offset = 0; /* Constant buffer offset */ - gpe_context->curbe_offset = ALIGN(end_offset, 64); - end_offset += gpe_context->curbe_size; + start_offset = ALIGN(end_offset, 64); + gpe_context->curbe_offset = start_offset; + end_offset = start_offset + gpe_context->curbe_size; /* Interface descriptor offset */ - gpe_context->idrt_offset = ALIGN(end_offset, 64); - end_offset += gpe_context->idrt_size; + start_offset = ALIGN(end_offset, 64); + gpe_context->idrt_offset = start_offset; + end_offset = start_offset + gpe_context->idrt_size; /* Sampler state offset */ - gpe_context->sampler_offset = ALIGN(end_offset, 64); - end_offset += gpe_context->sampler_size; + start_offset = ALIGN(end_offset, 64); + gpe_context->sampler_offset = start_offset; + end_offset = start_offset + gpe_context->sampler_size; /* update the end offset of dynamic_state */ gpe_context->dynamic_state.end_offset = end_offset; @@ -1187,9 +1190,11 @@ gen8_gpe_load_kernels(VADriverContextP ctx, kernel = &gpe_context->kernels[i]; kernel->kernel_offset = kernel_offset; - memcpy(kernel_ptr + kernel_offset, kernel->bin, kernel->size); + if (kernel->size) { + memcpy(kernel_ptr + kernel_offset, kernel->bin, kernel->size); - end_offset += kernel->size; + end_offset = kernel_offset + kernel->size; + } } gpe_context->instruction_state.end_offset = end_offset; |