Add XDamage notification after vaPutSurface
[profile/ivi/libva.git] / va / x11 / va_x11.c
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;
 }