[Libva] [Libva-intel-driver][PATCH v2 05/17] Fix the size calculation of the required memory for dynamic state buffer

Zhao Yakui yakui.zhao at intel.com
Fri Nov 18 06:26:47 UTC 2016


On 11/18/2016 01:43 PM, Xiang, Haihao wrote:
> Make sure the size for each part in dynamic state buffer is multiple of 64 bytes.
>

This looks good to me.

Add: Reviewed-by: Zhao Yakui <yakui.zhao at intel.com>

> Signed-off-by: Xiang, Haihao<haihao.xiang at intel.com>
> ---
>   src/i965_gpe_utils.c | 9 +++++----
>   1 file 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;



More information about the Libva mailing list