Change in DDX interface for Composite extension

Keith Packard keithp@keithp.com
Wed, 25 Feb 2004 09:34:58 -0800


--==_Exmh_1493649546P
Content-Type: text/plain; charset=us-ascii


To get the Composite extension working, a major change is required in the 
DIX/DDX interface.  Composite requires an addition to the PixmapRec 
structure to locate window backing pixmaps on the screen -- this is 
the location of the upper left corner of the pixmap on the screen, which is
pWin->drawable.x - pWin->borderWidth.

  /*
   * PIXMAP -- device dependent
   */

  typedef struct _Pixmap {
      DrawableRec               drawable;
      int                       refcnt;
      int                       devKind;
+     /*
+      * for pixmaps used to hold window contents, these two
+      * coordinates indicate the position of the pixmap relative
+      * to the origin of the screen.  Offset window drawing by
+      * the negative of this amount.
+      */
+ #ifdef COMPOSITE
+     short             screen_x;
+     short             screen_y;
+ #endif
      DevUnion          devPrivate;
  #ifdef PIXPRIV
      DevUnion          *devPrivates; /* real devPrivates like gcs & windows */
  #endif
  } PixmapRec;

Given a relative window coordinate (x_win, y_win), you can compute the 
absolute screen coordinates with:

	x_screen = x_win + pWin->drawable.x;
	y_screen = y_win + pWin->drawable.y;

Given the absolute screen coordinate, you can compute the location of that 
pixel within the pixmap containing the window (pPix) with:

	x_pix = x_screen - pPix->screen_x;
	y_pix = y_screen - pPix->screen_y;

Now, pixmaps may actually be located within a larger address space; the 
XFree86 DDX uses a global 2D space encompassing the root pixmap along with 
other off-screen pixmaps.  Those pixmaps are positioned in that larger 
space using drawable.x and drawable.y.  You can compute the location
of that pixel within the global coordinate space with:

	x_global = x_pix + pPix->drawable.x;
	y_global = y_pix + pPix->drawable.y;

Now, one trick is that when drawing to pPix directly, you *don't* use the 
screen_x/screen_y values; those serve to offset drawing for all windows 
contained in pPix.

In a very brief exploration of the XAA interface, I'm not sure any of this 
matters to drivers, and it may well be that we won't have to do any work 
on each driver, and may even be able to maintain ABI compatibility.  
Further study is required...

-keith



--==_Exmh_1493649546P
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Exmh version 2.3.1 11/28/2001

iD8DBQFAPNzCQp8BWwlsTdMRAlcsAJ9gxwVnJ/tlrI2hz9SulNkATeRTUwCfb9MG
eCtFl08eJcpN5wMJWnnZa3E=
=HxLM
-----END PGP SIGNATURE-----

--==_Exmh_1493649546P--