[Libva] [PATCH_V2] Fix inconsistent surface dimension during allocating surface buffer object

Gwenole Beauchesne gb.devel at gmail.com
Thu Sep 20 23:12:12 PDT 2012


Hi,

2012/9/21  <yakui.zhao at intel.com>:

> This is to fix the regression caused by e25b3fbce3fc3c13ca054ba9a512bec954642fa8.
> When one surface is created,the height/width is aligned to 16 pixels. But when
> trying to allocate buffer object for it on SNB/IVB and the later chips,the width
> is aligned to 128 and height is aligned to 32. If the surface is mapped and accessed
> before allocating surface buffer object, the APP will get incorrect dimension.
>
> Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
> ---
>  src/i965_drv_video.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
> index 3bea253..662d8af 100644
> --- a/src/i965_drv_video.c
> +++ b/src/i965_drv_video.c
> @@ -516,8 +516,13 @@ i965_CreateSurfaces(VADriverContextP ctx,
>          obj_surface->orig_width = width;
>          obj_surface->orig_height = height;
>
> -        obj_surface->width = ALIGN(width, 16);
> -        obj_surface->height = ALIGN(height, 16);
> +       if (IS_G4X(i965->intel.device_id) || IS_IRONLAKE(i965->intel.device_id)) {
> +               obj_surface->width = ALIGN(width, 16);
> +               obj_surface->height = ALIGN(height, 16);
> +       } else {
> +               obj_surface->width = ALIGN(width, 128);
> +               obj_surface->height = ALIGN(height, 32);
> +       }
>          obj_surface->flags = SURFACE_REFERENCED;
>          obj_surface->fourcc = 0;
>          obj_surface->bo = NULL;

This indeed looks better this way.

Thanks,
Gwenole.


More information about the Libva mailing list