[Fwd: Re: composite still redirect the overlay window?]

Carlos Eduardo Rodrigues Diógenes cerdiogenes at yahoo.com.br
Wed Apr 5 07:07:18 PDT 2006


Anyone can explaim this behavior to us?

Thanks.

-------- Forwarded Message --------
> From: Deron Johnson <Deron.Johnson at Sun.COM>
> Reply-To: Deron.Johnson at Sun.COM
> To: Carlos Eduardo Rodrigues Diógenes <cerdiogenes at yahoo.com.br>,
> Deron.Johnson at Sun.COM
> Subject: Re: composite still redirect the overlay window?
> Date: Mon, 03 Apr 2006 15:17:20 -0700
> 
> I used gdb to check the contents of the overlay WindowRec during the
> second composite (in which the overlay window is the destination) and
> the redirectDraw member is 0. This means that your suspicion that
> the overlay window is being redirected is not what is actually
> happening. During the execution of this program the overlay window is
> definitely not being redirected.
> 
> I don't know a lot about how the render extension works, but here is my
> guess as to what is happening. Is it possible that because you are
> using IncludeInferiors mode to copy the root to the destination pixmap
> since the overlay window is the topmost child of the root window, and
> obscures all other children, that you are ending up copying the pixels
> of the overlay window into the destination window? This would account
> for the infinite recursion.
> 
> Carlos Eduardo Rodrigues Diógenes wrote On 03/31/06 04:59,:
> > Hi Deron,
> > 
> > On Thu, 2006-03-30 at 11:47 -0800, Deron Johnson wrote:
> > 
> >>I thought I fixed that bug. Please check compwindow.c:compCheckRedirect.
> >>Does it have the following code?
> > 
> > 
> > Yes.
> > 
> > Attached is the program that I'm running.
> > 
> > This redirect the root window subwindows using
> > CompositeRedirectAutomatic.
> > 
> > I created three Pictures: One to redirect the childrens content of the
> > root window, other to hold a part of this first one and do some type of
> > post processing (magnify) and the other (the overlay window) to show
> > these post-processed results.
> > 
> > What is done in each movement of the mouse is:
> > 
> > copy the content of the root window to a Picture (created with a
> > pixmap), magnify this portion and then send it to the overlay window.
> > 
> > But when the mouse moves I get infinite recursion. The content that is
> > being displaied in the overlay window is magnified and showed again in
> > the overlay window and not the content of the root window.
> > 
> >>Bool
> >>compCheckRedirect (WindowPtr pWin)
> >>{
> >>    CompWindowPtr   cw = GetCompWindow (pWin);
> >>    CompScreenPtr   cs = GetCompScreen(pWin->drawable.pScreen);
> >>    Bool	    should;
> >>
> >>    should = pWin->realized && (pWin->drawable.class != InputOnly) &&
> >>	     (cw != NULL);
> >>
> >>    /* Never redirect the overlay window */    <<<<<<<<<<<<<
> >>    if (cs->pOverlayWin != NULL) {
> >>	if (pWin == cs->pOverlayWin) {
> >>	    should = FALSE;
> >>	}
> >>    }	
> >>
> >>If not then you don't have the latest version of the file. I did a
> >>checkout of a fresh version of xserver and I have verified that
> >>this fix did get integrated.
> >>
> >>If you have this fix and the overlay window is still being redirected
> >>I would like to know more about how you are determining this.  When I
> >>run the attached test program (from Soeren) on my version with the
> >>above fix I see the purple screen, which indicates that the overlay
> >>window is not being redirected.
> >>
> >>Carlos Eduardo Rodrigues Diógenes wrote On 03/30/06 11:46,:
> >>
> >>>Hi,
> >>>
> >>>After the last commites of Deron Johson I recompiled my Xorg and noticed
> >>>that the overlay window is still being redirect. There is anything
> >>>missing to complete the composite extension?
> >>>
> >>>Thanks,
> >>>
> >>>
> >>>------------------------------------------------------------------------
> >>>
> >>>#include <stdio.h>
> >>>
> >>>#include <X11/Xlib.h>
> >>>#include <X11/Xutil.h>
> >>>#include <X11/Xatom.h>
> >>>
> >>>#include <X11/extensions/Xcomposite.h>
> >>>#include <X11/extensions/Xrender.h>
> >>>
> >>>int                      scr;
> >>>Window                   rootwin, magWin;
> >>>int                      root_width, root_height;
> >>>double                   magstep = 4.0;
> >>>Picture                  rootPicture, dstPicture, magPicture;
> >>>
> >>>int
> >>>error (Display *dpy, XErrorEvent *ev)
> >>>{
> >>>  char message[100];
> >>>
> >>>  XGetErrorText (dpy, ev->error_code, message, 100);
> >>>
> >>>  fprintf (stderr, "%s\n", message);
> >>>  
> >>>  return 0;
> >>>}
> >>>
> >>>void
> >>>PaintOffScreen (Display *dpy, int x, int y) 
> >>>{
> >>>  int x1, y1;
> >>>
> >>>  x1 = x - (int) (root_width / (int) magstep) / 2;
> >>>  y1 = y - (int) (root_height / (int) magstep) / 2;
> >>>
> >>>  XRenderComposite (dpy, PictOpSrc, rootPicture, None, dstPicture, x1, y1, 0,
> >>>		    0, 0, 0, root_width / (int) magstep,
> >>>		    root_height / (int) magstep);
> >>>  XRenderComposite (dpy, PictOpSrc, dstPicture, None, magPicture, 0, 0, 0, 0,
> >>>		    0, 0, root_width, root_height);
> >>>}
> >>>
> >>>int
> >>>main (int argc, char **argv)
> >>>{
> >>>  Display                  *dpy;
> >>>  XEvent                   ev;
> >>>  GC                       gc;
> >>>  Pixmap                   dstPixmap, magPixmap;
> >>>  XRenderPictureAttributes pict_attr;
> >>>  int                      composite_event, composite_error, render_event,
> >>>                           render_error, pxOld, pyOld, root_x, root_y,
> >>>                           unused_x, unused_y;
> >>>  XTransform               xform;
> >>>  Window                   root_return, parent_return, *children, child,
> >>>	  dest;
> >>>  unsigned int             nchildren, unused_mask;
> >>>
> >>>  /* counters */
> >>>  int                      i;
> >>>
> >>>  xform.matrix[0][0] = XDoubleToFixed (1.0/magstep);
> >>>  xform.matrix[0][1] = 0.0;
> >>>  xform.matrix[0][2] = 0.0;
> >>>  
> >>>  xform.matrix[1][0] = 0.0;
> >>>  xform.matrix[1][1] = XDoubleToFixed (1.0/magstep);
> >>>  xform.matrix[1][2] = 0.0;
> >>>  
> >>>  xform.matrix[2][0] = 0.0;
> >>>  xform.matrix[2][1] = 0.0;
> >>>  xform.matrix[2][2] = XDoubleToFixed (1.0);
> >>> 
> >>>  if ((dpy = XOpenDisplay (NULL)) == NULL) {
> >>>    fprintf (stderr, "Unable to connect to the Xserver!\n");
> >>>    exit (1);
> >>>  }
> >>>#ifdef DEBUG
> >>>  XSynchronize (dpy, True);
> >>>#endif
> >>>  XSetErrorHandler (error);
> >>>
> >>>  scr = DefaultScreen (dpy);
> >>>  rootwin = RootWindow (dpy, scr);
> >>>
> >>>  if (!XRenderQueryExtension (dpy, &render_event, &render_error)) {
> >>>    fprintf (stderr, "Render extension no avaliable!\n");
> >>>    exit (1);
> >>>  }
> >>>  if (!XCompositeQueryExtension (dpy, &composite_event, &composite_error)) {
> >>>    fprintf (stderr, "Composite extension no avaliable!\n");
> >>>    exit (1);
> >>>  }
> >>>
> >>>  pict_attr.subwindow_mode = IncludeInferiors;
> >>>
> >>>  root_width = DisplayWidth (dpy, scr);
> >>>  root_height = DisplayHeight (dpy, scr);
> >>>
> >>>  XCompositeRedirectSubwindows (dpy, rootwin, CompositeRedirectAutomatic);
> >>>
> >>>  magWin = XCompositeGetOverlayWindow (dpy, rootwin);
> >>>
> >>>  rootPicture =
> >>>    XRenderCreatePicture (dpy, rootwin,
> >>>			  XRenderFindVisualFormat (dpy, 
> >>>						   DefaultVisual (dpy, scr)),
> >>>			  CPSubwindowMode, &pict_attr);
> >>>
> >>>  dstPixmap = XCreatePixmap (dpy, rootwin, root_width / (int) magstep,
> >>>			     root_height / (int) magstep,
> >>>			     DefaultDepth (dpy, scr));
> >>>  dstPicture =
> >>>    XRenderCreatePicture (dpy, dstPixmap,
> >>>			  XRenderFindVisualFormat (dpy,
> >>>						   DefaultVisual (dpy, scr)),
> >>>			  CPSubwindowMode, &pict_attr);
> >>>
> >>>  magPixmap = XCreatePixmap (dpy, rootwin, root_width / (int) magstep,
> >>>			     root_height / (int) magstep,
> >>>			     DefaultDepth (dpy, scr));
> >>>  magPicture =
> >>>    XRenderCreatePicture (dpy, magWin,
> >>>			  XRenderFindVisualFormat (dpy,
> >>>						   DefaultVisual (dpy, scr)),
> >>>			  CPSubwindowMode, &pict_attr);
> >>>
> >>>  XRenderSetPictureTransform (dpy, dstPicture, &xform);
> >>>  XRenderSetPictureFilter (dpy, dstPicture, FilterBilinear, 0, 0);
> >>>
> >>>  XQueryPointer (dpy, rootwin, &root_return, &parent_return, &root_x, &root_y,
> >>>		 &unused_x, &unused_y, &unused_mask);
> >>>
> >>>  PaintOffScreen (dpy, root_x, root_y);
> >>>
> >>>  pxOld = root_x;
> >>>  pyOld = root_y;
> >>>
> >>>  while (1) {
> >>>    XQueryPointer (dpy, rootwin, &rootwin, &child, &root_x, &root_y,
> >>>		   &unused_x, &unused_y, &unused_mask);
> >>>    if (pxOld != root_x || pyOld != root_y) {
> >>>      PaintOffScreen (dpy, root_x, root_y);
> >>>      pxOld = root_x;
> >>>      pyOld = root_y;
> >>>    }
> >>>  }
> >>>
> >>>  return 0;
> >>>}
> 
-- 
Carlos Eduardo Rodrigues Diógenes




More information about the xorg mailing list