[xserver] composite: Explicitly validate source picture in compNewPixmap

Submitted by Michel Dänzer on Feb. 3, 2017, 3:28 a.m.

Details

Message ID 20170203032813.19006-1-michel@daenzer.net
State Superseded
Headers show
Series "composite: Explicitly validate source picture in compNewPixmap" ( rev: 1 ) in X.org (DEPRECATED - USE GITLAB)

Not browsing as part of any series.

Commit Message

Michel Dänzer Feb. 3, 2017, 3:28 a.m.
From: Michel Dänzer <michel.daenzer@amd.com>

CompositePicture also does it, but only after the damage layer is
unwrapped, so no damage is reported.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99220
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---

For some reason, this causes an Xnest link failure without the
configure.ac change:

  CCLD     Xnest
../../composite/.libs/libcomposite.a(compalloc.o): In function `compNewPixmap':
.../../../composite/compalloc.c:590: undefined reference to `miCompositeSourceValidate'
collect2: error: ld returned 1 exit status

 composite/compalloc.c | 9 +++++++++
 configure.ac          | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/composite/compalloc.c b/composite/compalloc.c
index 05ffc7e85..e27ba05e4 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -45,6 +45,7 @@ 
 #include <dix-config.h>
 #endif
 
+#include <mipict.h>
 #include "compint.h"
 
 static void
@@ -579,6 +580,14 @@  compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
                                                serverClient, &error);
 
         if (pSrcPicture && pDstPicture) {
+            /*
+             * Validating the source picture may trigger
+             * compWindowUpdateAutomatic for redirected siblings of this
+             * window. Within CompositePicture, damageComposite unwraps
+             * the damage layer before this happens. Validate the source
+             * here to make sure damage is reported correctly.
+             */
+            miCompositeSourceValidate(pSrcPicture);
             CompositePicture(PictOpSrc,
                              pSrcPicture,
                              NULL,
diff --git a/configure.ac b/configure.ac
index 95aa297da..30dd37eb8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1847,7 +1847,7 @@  if test "x$XNEST" = xyes; then
 	if test "x$have_xnest" = xno; then
 		AC_MSG_ERROR([Xnest build explicitly requested, but required modules not found.])
 	fi
-	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB  $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
+	XNEST_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $COMPOSITE_LIB $RENDER_LIB $DAMAGE_LIB  $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
 	XNEST_SYS_LIBS="$XNESTMODULES_LIBS $GLX_SYS_LIBS"
 	AC_SUBST([XNEST_LIBS])
 	AC_SUBST([XNEST_SYS_LIBS])

Comments

On 03/02/17 12:28 PM, Michel Dänzer wrote:
>  
> @@ -579,6 +580,14 @@ compNewPixmap(WindowPtr pWin, int x, int y, int w, int h)
>                                                 serverClient, &error);
>  
>          if (pSrcPicture && pDstPicture) {
> +            /*
> +             * Validating the source picture may trigger
> +             * compWindowUpdateAutomatic for redirected siblings of this
> +             * window. Within CompositePicture, damageComposite unwraps
> +             * the damage layer before this happens. Validate the source
> +             * here to make sure damage is reported correctly.
> +             */
> +            miCompositeSourceValidate(pSrcPicture);
>              CompositePicture(PictOpSrc,
>                               pSrcPicture,
>                               NULL,

Maybe this should be handled in damageComposite instead, to avoid the
same problem in other cases where a window is used as a source picture?