[Libva] [PATCH] libva: new flags for vaPutSurface() to distinguish pixmap from window

Xiang, Haihao haihao.xiang at intel.com
Wed Jun 30 19:22:46 PDT 2010


On Wed, 2010-06-30 at 16:22 +0800, Gwenole Beauchesne wrote:
> Hi,
> 
> On Tue, 29 Jun 2010, Xiang, Haihao wrote:
> 
> > Meanwhile render pixmap directly.
> 
> I once tried TFP on Ironlake. It used to work on Ubuntu/lucid-RC without 
> other changes. This no longer works nowadays because Ubuntu/lucid final 
> dropped support for GLX 1.3.

The latest DRI2 uses swapbuffer instead of DRI2CopyRegion if possible, and it seems swapbuffer doesn't work with a pixmap.
in addition, rendering back buffer then swapping/copying to front buffer
isn't necessary for pixmap. 

TFP on Ironlake works with this patch. Of course I don't use
Ubuntu/lucid. 

you can use mplayer -vo vaapi:gl or maplyer -vo vaapi:gl:reflect  to
verify it.


> That said, I don't think this patch is useful. Normally, a VA driver will 
> know whether the drawable is a Pixmap or a Window, since it's generally 
> tied to the X driver. In our drivers, I use a function (e.g. is_pixmap()) 
> to check for that.
> 
> I mean, do_drawable_hash() can also use such a function, if we can't know 
> that from the X driver. How is the Moorestown driver working on this side?
> 
> BTW, here is the function I use. There surely is a better one though.
> 
> // X error trap
> static int x11_error_code = 0;
> static int (*old_error_handler)(Display *, XErrorEvent *);
> 
> static int error_handler(Display *dpy, XErrorEvent *error)
> {
>      x11_error_code = error->error_code;
>      return 0;
> }
> 
> void x11_trap_errors(void)
> {
>      x11_error_code    = 0;
>      old_error_handler = XSetErrorHandler(error_handler);
> }
> 
> int x11_untrap_errors(void)
> {
>      XSetErrorHandler(old_error_handler);
>      return x11_error_code;
> }
> 
> static int is_window(Display *dpy, Drawable drawable)
> {
>      XWindowAttributes wattr;
> 
>      x11_trap_errors();
>      XGetWindowAttributes(dpy, drawable, &wattr);
>      return x11_untrap_errors() == 0;
> }
> 
Thanks, I will give a try.

> Regards,
> Gwenole.



More information about the Libva mailing list