Add XDamage notification after vaPutSurface 2.0 accepted/2.0/20130411.165328 submit/2.0/20130411.093845
authorZhao Halley <halley.zhao@intel.com>
Thu, 11 Apr 2013 09:26:30 +0000 (17:26 +0800)
committerZhao Halley <halley.zhao@intel.com>
Thu, 11 Apr 2013 09:34:03 +0000 (17:34 +0800)
Webkit requires it to trigger repaint

configure.ac
va/Makefile.am
va/x11/Makefile.am
va/x11/va_x11.c [changed mode: 0644->0755]

index b296d4c..2c45af0 100644 (file)
@@ -232,6 +232,7 @@ if test "$enable_x11" = "yes"; then
     PKG_CHECK_MODULES([X11],    [x11],    [:], [USE_X11="no"])
     PKG_CHECK_MODULES([XEXT],   [xext],   [:], [USE_X11="no"])
     PKG_CHECK_MODULES([XFIXES], [xfixes], [:], [USE_X11="no"])
+    PKG_CHECK_MODULES([XDAMAGE], [xdamage], [:], [USE_X11="no"])
     if test "$USE_X11" = "yes"; then
         AC_DEFINE([HAVE_VA_X11], [1], [Defined to 1 if VA/X11 API is built])
     fi
index 7ffde12..3526d98 100644 (file)
@@ -100,7 +100,7 @@ libva_x11_la_SOURCES                =
 libva_x11_la_LDFLAGS           = $(LDADD)
 libva_x11_la_DEPENDENCIES      = libva.la x11/libva_x11.la
 libva_x11_la_LIBADD            = libva.la x11/libva_x11.la \
-       $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(XFIXES_LIBS) $(DRM_LIBS) -ldl
+       $(LIBVA_LIBS) $(X11_LIBS) $(XEXT_LIBS) $(XFIXES_LIBS) $(XDAMAGE_LIBS) $(DRM_LIBS) -ldl
 endif
 
 if USE_GLX
index 508506e..d2be7bc 100644 (file)
@@ -27,6 +27,7 @@ INCLUDES = \
        $(X11_CFLAGS)           \
        $(XEXT_CFLAGS)          \
        $(XFIXES_CFLAGS)        \
+       $(XDAMAGE_CFLAGS)       \
        $(DRM_CFLAGS)           \
        $(NULL)
 
old mode 100644 (file)
new mode 100755 (executable)
index dfb9d07..5aace56
@@ -43,6 +43,8 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <X11/extensions/Xfixes.h>
+#include <X11/extensions/Xdamage.h> 
 
 static int va_DisplayContextIsValid (
     VADisplayContextP pDisplayContext
@@ -230,7 +232,21 @@ void va_TracePutSurface (
     unsigned int flags /* de-interlacing flags */
 );
 
-
+static void va_report_damage(VADriverContextP ctx, Drawable draw, int x, int y, int width, int height)
+{
+    XRectangle xrect;
+    XserverRegion region;
+
+    xrect.x = x;
+    xrect.y = y;
+    xrect.width = width;
+    xrect.height = height;
+
+    region = XFixesCreateRegion(ctx->native_dpy, &xrect, 1);
+    XDamageAdd(ctx->native_dpy, draw, region);
+    XFixesDestroyRegion(ctx->native_dpy, region);
+    XFlush(ctx->native_dpy);
+}
 VAStatus vaPutSurface (
     VADisplay dpy,
     VASurfaceID surface,
@@ -249,6 +265,8 @@ VAStatus vaPutSurface (
 )
 {
   VADriverContextP ctx;
+  VAStatus  status;
+  XRectangle rect;
 
   if (fool_postp)
       return VA_STATUS_SUCCESS;
@@ -260,7 +278,11 @@ VAStatus vaPutSurface (
                 destx, desty, destw, desth,
            cliprects, number_cliprects, flags );
   
-  return ctx->vtable->vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
+  status = ctx->vtable->vaPutSurface( ctx, surface, (void *)draw, srcx, srcy, srcw, srch,
                                    destx, desty, destw, desth,
                                    cliprects, number_cliprects, flags );
+
+  va_report_damage(ctx, draw, destx, desty, destw, desth);
+
+  return status;
 }