[Libva] [PATCH Intel VA v2] Fix wrong ac_values's array size passed to intel_batchbuffer_data

Xiang, Haihao haihao.xiang at intel.com
Sat Sep 5 21:52:18 PDT 2015


> Checked libva/va/va.h the VAHuffmanTableBufferJPEGBaseline for
> ac_values's array size is 162. The intel_batchbuffer_data
> got pass in 164 size for 'huffman_table[index].ac_values'. Fix to
> correct array size value to 162.

Although ac_values's array size is 162, but there are two padded bytes
after ac_values, so it won't result in errors.

> 
> Signed-off-by: Lim Siew Hoon <siew.hoon.lim at intel.com>
> ---
>  src/gen75_mfd.c | 2 +-
>  src/gen7_mfd.c  | 2 +-
>  src/gen8_mfd.c  | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/gen75_mfd.c b/src/gen75_mfd.c
> index 0acded3..9ec9ab0 100644
> --- a/src/gen75_mfd.c
> +++ b/src/gen75_mfd.c
> @@ -2346,7 +2346,7 @@ gen75_mfd_jpeg_huff_table_state(VADriverContextP ctx,
>          intel_batchbuffer_data(batch, huffman_table->huffman_table[index].num_dc_codes, 12);
>          intel_batchbuffer_data(batch, huffman_table->huffman_table[index].dc_values, 12);
>          intel_batchbuffer_data(batch, huffman_table->huffman_table[index].num_ac_codes, 16);
> -        intel_batchbuffer_data(batch, huffman_table->huffman_table[index].ac_values, 164);
> +        intel_batchbuffer_data(batch, huffman_table->huffman_table[index].ac_values, 162);


The size passed to intel_batchbuffer_data must be a multiple of 4, hw
will ignore the padded bytes. Please refer to the implementation of
intel_batchbuffer_data().



>          ADVANCE_BCS_BATCH(batch);
>      }
>  }
> diff --git a/src/gen7_mfd.c b/src/gen7_mfd.c
> index 4e668ce..60b23af 100755
> --- a/src/gen7_mfd.c
> +++ b/src/gen7_mfd.c
> @@ -2028,7 +2028,7 @@ gen7_mfd_jpeg_huff_table_state(VADriverContextP ctx,
>          intel_batchbuffer_data(batch, huffman_table->huffman_table[index].num_dc_codes, 12);
>          intel_batchbuffer_data(batch, huffman_table->huffman_table[index].dc_values, 12);
>          intel_batchbuffer_data(batch, huffman_table->huffman_table[index].num_ac_codes, 16);
> -        intel_batchbuffer_data(batch, huffman_table->huffman_table[index].ac_values, 164);
> +        intel_batchbuffer_data(batch, huffman_table->huffman_table[index].ac_values, 162);
>          ADVANCE_BCS_BATCH(batch);
>      }
>  }
> diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c
> index c55cb4e..8fb95c7 100644
> --- a/src/gen8_mfd.c
> +++ b/src/gen8_mfd.c
> @@ -2058,7 +2058,7 @@ gen8_mfd_jpeg_huff_table_state(VADriverContextP ctx,
>          intel_batchbuffer_data(batch, huffman_table->huffman_table[index].num_dc_codes, 12);
>          intel_batchbuffer_data(batch, huffman_table->huffman_table[index].dc_values, 12);
>          intel_batchbuffer_data(batch, huffman_table->huffman_table[index].num_ac_codes, 16);
> -        intel_batchbuffer_data(batch, huffman_table->huffman_table[index].ac_values, 164);
> +        intel_batchbuffer_data(batch, huffman_table->huffman_table[index].ac_values, 162);
>          ADVANCE_BCS_BATCH(batch);
>      }
>  }




More information about the Libva mailing list