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

ykzhao yakui.zhao at intel.com
Tue Sep 18 01:38:47 PDT 2012


On Tue, 2012-09-18 at 02:14 -0600, Xiang, Haihao wrote:
> 
> > -----Original Message-----
> > From: libva-bounces+haihao.xiang=intel.com at lists.freedesktop.org
> > [mailto:libva-bounces+haihao.xiang=intel.com at lists.freedesktop.org] On
> > Behalf Of yakui.zhao at intel.com
> > Sent: Tuesday, September 18, 2012 4:01 PM
> > To: libva at lists.freedesktop.org
> > Subject: [Libva] [PATCH ] Fix inconsistent surface dimension during allocating
> > surface buffer object
> > 
> > From: Zhao Yakui <yakui.zhao at intel.com>
> > 
> > When one surface is created, the height/width is aligned to 16 pixels.
> 
> Actually orig_width/height is the width/height, width/height is the stride in x/y-axis. 
>  
> 
> > But when trying to allocate the buffer object for it, the width is aligned to 128
> > and height is aligned to 32. 
> 
> It is the requirement of the Y-tiled surface however for linear surface, aligning to 16 byte is enough 
> 
> > If the surface is mapped and accessed
> 
> You can't map the surface directly, do you mean vaDeriveImage() first then calling vaMapBuffer() to 
> Access the surface ? Allocating the buffer object will be done before deriving the image.

Right. It firstly calls the vaDeriveImage and then map it.
But in the function of i965_DeriveImage on the master branch, it firstly
returns the image format(width/height/pitch and so on) and then try to
allocate the buffer. This is wrong. (This issue doesn't exist on the
staging branch).
If it uses always uses consistent width/height stride, it doesn't
matter. 

Thanks.
    Yakui
> 
> > before
> > allocating the buffer object, the incorrect dimension is returned and and the
> > incorrect content is written.
> > 
> > From: Zhao Yakui <yakui.zhao at intel.com>
> > ---
> >  src/i965_drv_video.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index
> > 588961f..8956367 100644
> > --- a/src/i965_drv_video.c
> > +++ b/src/i965_drv_video.c
> > @@ -506,8 +506,8 @@ 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);
> > +        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;
> > --
> > 1.7.12-rc1
> > 
> > _______________________________________________
> > Libva mailing list
> > Libva at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/libva




More information about the Libva mailing list