From e1164698009530ef2d3423b313cac9ba1b3615cd Mon Sep 17 00:00:00 2001 From: Zhao Halley Date: Thu, 11 Apr 2013 17:26:30 +0800 Subject: [PATCH] Add XDamage notification after vaPutSurface Webkit requires it to trigger repaint --- configure.ac | 1 + va/Makefile.am | 2 +- va/x11/Makefile.am | 1 + va/x11/va_x11.c | 26 ++++++++++++++++++++++++-- 4 files changed, 27 insertions(+), 3 deletions(-) mode change 100644 => 100755 va/x11/va_x11.c diff --git a/configure.ac b/configure.ac index b296d4c..2c45af0 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/va/Makefile.am b/va/Makefile.am index 7ffde12..3526d98 100644 --- a/va/Makefile.am +++ b/va/Makefile.am @@ -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 diff --git a/va/x11/Makefile.am b/va/x11/Makefile.am index 508506e..d2be7bc 100644 --- a/va/x11/Makefile.am +++ b/va/x11/Makefile.am @@ -27,6 +27,7 @@ INCLUDES = \ $(X11_CFLAGS) \ $(XEXT_CFLAGS) \ $(XFIXES_CFLAGS) \ + $(XDAMAGE_CFLAGS) \ $(DRM_CFLAGS) \ $(NULL) diff --git a/va/x11/va_x11.c b/va/x11/va_x11.c old mode 100644 new mode 100755 index dfb9d07..5aace56 --- a/va/x11/va_x11.c +++ b/va/x11/va_x11.c @@ -43,6 +43,8 @@ #include #include #include +#include +#include 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; } -- 2.7.4