Bug 5828 - miComputeClips VTMove case doesn't update borderClip for composite-redirected window
Summary: miComputeClips VTMove case doesn't update borderClip for composite-redirected...
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: git
Hardware: All All
: high normal
Assignee: Xorg Project Team
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-07 07:01 UTC by Deron Johnson
Modified: 2006-03-30 06:24 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Deron Johnson 2006-02-07 07:01:17 UTC
The miComputeClips VTMove case doesn't properly calculate the
borderClip of a composite-redirected window. It leaves the old
borderClip in place. Specifically, the visibility of
composite-redirected windows computed in this routine is
VisibilityFullyObscured. Therefore the region translations of the
borderClip and clipList are skipped by the following code:

    case VTMove:
	if ((oldVis == newVis) &&
	    ((oldVis == VisibilityFullyObscured) ||
	     (oldVis == VisibilityUnobscured)))
	{
	    pChild = pParent;
	    while (1)
	    {
		if (pChild->viewable)
		{
		    if (pChild->visibility != VisibilityFullyObscured)
		    {
			REGION_TRANSLATE( pScreen, &pChild->borderClip,
						      dx, dy);
			REGION_TRANSLATE( pScreen, &pChild->clipList,
						      dx, dy);

My suggested fix is to force the region translation to happen for
composite-redirected windows, ignoring their visibility, viz.

    case VTMove:
	if ((oldVis == newVis) &&
	    ((oldVis == VisibilityFullyObscured) ||
	     (oldVis == VisibilityUnobscured)))
	{
	    pChild = pParent;
	    while (1)
	    {
		if (pChild->viewable)
		{
		    if (pChild->visibility != VisibilityFullyObscured
#ifdef COMPOSITE
			|| pChild->redirectDraw
#endif
			)
		    {
			REGION_TRANSLATE( pScreen, &pChild->borderClip,
						      dx, dy);
			REGION_TRANSLATE( pScreen, &pChild->clipList,
						      dx, dy);

Here is mail from Keith in which he approves of my suggested fix:

On Sun, 2006-02-05 at 16:04 -0800, Deron Johnson wrote:

>> The problem was that there is a bug in the way miComputeClips treats
>> composite-redirected windows during MoveWindow. The visibility of
>> composite-redirected windows is FullyObscured in this routine, so the
>> following border clip translation code is skipped. So the borderClip
>> of a mapped composite-redirected window is stale after it is moved.


Good catch.


>> This messes up the sending of damage events.


And more than that; having regions with the wrong offset should also
scramble drawing. Oops.


>> My suggested fix is to force the region translation to happen for
>> composite-redirected windows, viz.


Yeah, I think that's safest. You realize, of course, that the visibility
check is just an optimization; FullyObscured windows are supposed to
have empty clip lists. We could get away with always translating the
regions, but I think having the check in place will cause less confusion
in the future.
Comment 1 Deron Johnson 2006-02-24 12:01:38 UTC
Keith P. recommends the following fix: move the composite-specific code in
miComputeClips to be BEFORE the visibility computation. I have tested this
and it works.

Here is the code:

diff -c mivaltree.c mivaltree.c.fixed
*** mivaltree.c	2006-02-23 16:55:19.060842000 -0800
--- mivaltree.c.fixed	2006-02-23 16:56:58.633837000 -0800
***************
*** 266,271 ****
--- 266,283 ----
  	dy = 32767;
      borderSize.y2 = dy;
  
+ #ifdef COMPOSITE
+     /*
+      * In redirected drawing case, reset universe to borderSize
+      */
+     if (pParent->redirectDraw)
+     {
+ 	if (miSetRedirectBorderClipProc)
+ 	    (*miSetRedirectBorderClipProc) (pParent, universe);
+ 	REGION_COPY(pScreen, universe, &pParent->borderSize);
+     }
+ #endif
+ 
      oldVis = pParent->visibility;
      switch (RECT_IN_REGION( pScreen, universe, &borderSize)) 
      {
***************
*** 305,322 ****
  	((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
  	SendVisibilityNotify(pParent);
  
- #ifdef COMPOSITE
-     /*
-      * In redirected drawing case, reset universe to borderSize
-      */
-     if (pParent->redirectDraw)
-     {
- 	if (miSetRedirectBorderClipProc)
- 	    (*miSetRedirectBorderClipProc) (pParent, universe);
- 	REGION_COPY(pScreen, universe, &pParent->borderSize);
-     }
- #endif
- 
      dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x;
      dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y;
  
Comment 2 Søren Sandmann Pedersen 2006-03-31 00:24:09 UTC
This patch is in CVS since

Wed Mar 22 13:42:44 2006  Søren Sandmann  <sandmann@redhat.com>

        * mi/mivaltree.c (miComputeClips): Patch by Keith Packard to make
        sure redirected windows don't get considered "FullyObscured".




Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.