[Libva] [PATCH] libva: new flags for vaPutSurface() to distinguish pixmap from window
Xiang, Haihao
haihao.xiang at intel.com
Wed Jun 30 22:44:44 PDT 2010
On Wed, 2010-06-30 at 17:06 +0800, Yuan, Shengquan wrote:
> On Wed, Jun 30, 2010 at 4:22 PM, Gwenole Beauchesne
> <gbeauchesne at splitted-desktop.com> 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.
> >
> > 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?
> >
>
> There isn't a simple way for it. We firstly tried this:
> ======================================
>
> /* Check drawable type, 1 for window, 0 for pixmap
> * Have significant performance drop in XFCE environment
> */
> static void psb__CheckDrawableType(Display *dpy, Window win, Drawable
> draw, int *type_ret)
> {
>
> unsigned int child_num;
> Window root_return;
> Window parent_return;
> Window *child_return;
> int i;
>
> if (win == draw) {
> *type_ret = 1;
> return;
> }
>
> XQueryTree(dpy, win, &root_return, &parent_return, &child_return,
> &child_num);
>
> if (!child_num)
> return;
>
> for(i =0; i< child_num; i++)
> psb__CheckDrawableType(dpy, child_return[i], draw, type_ret);
> }
> ======================================
>
> But we found it has performance issue, then we changed to use a Xv
> attribute to get it from X server.
Which Xv attribute? I am looking for a simple way to get drawable type.
Thanks
Haihao
> In some sense, we need to check it for every vaPutSurface and then
> will cause high C0 residence.
>
>
> > 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;
> > }
> >
> > Regards,
> > Gwenole.
> > _______________________________________________
> > Libva mailing list
> > Libva at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/libva
> >
More information about the Libva
mailing list