Xephyr: Make glxinfo work on the ATI R200 free driver.

* hw/kdrive/ephyr/ephyr.c:
	  (EphyrDuplicateVisual): when duplicating the
	  visual, copy the color component masks and the class
	  from the hostX
	  (EphyrMirrorHostVisuals): don't mix blue and green mask.
	* hw/kdrive/ephyr/ephyrdri.c: add more logs.
	  (ephyrDRICreateDrawable): actually implement this.
	  for the moment it creates a DRI drawable for the hostX window,
	  no matter what drawable this call was issued for.
	  (ephyrDRIGetDrawableInfo): actually implemented this.
	  for the moment the drawable info queried for its attrs is the
	  Xephyr main main window.
	* hw/kdrive/ephyr/ephyrdriext.c:
	  (ProcXF86DRIGetDrawableInfo): properly hook this dispatch
	  function to the ephyrDRIGetDrawableInfo() function.
	* hw/kdrive/ephyr/ephyrglxext.c: add a bunch of GLX implementation hooks
	  here. Hijack some of the xserver GLX hooks with them. Still need to
	  properly support byteswapped clients though.
	* hw/kdrive/ephyr/ephyrhostglx.c,h: actually implemented the protocol
	  level forwarding functions used by the GLX entr points in
	  ephyrglxext.c. Here as well, there are a bunch of them, but we are
	  far from having implemented all the GLX calls.
	* hw/kdrive/ephyr/hostx.c,h:
	  (hostx_get_window_attributes): added this new entry point
	  (hostx_allocate_resource_id_peer): added this to keep track of
	   resource IDs peers: one member of the peer is in Xephyr, the other
	   is in host X.
	  (hostx_get_resource_id_peer): ditto.
This commit is contained in:
Dodji Seketeli 2007-08-30 23:54:49 +02:00 • committed by Dodji Seketeli
commit 4dd4be99df
9 changed files with 801 additions and 40 deletions

View file

@ -969,6 +969,27 @@ hostx_get_window(void)
return HostX.win ;
}
int
hostx_get_window_attributes (int a_window, EphyrHostWindowAttributes *a_attrs)
{
XWindowAttributes attrs ;
memset (&attrs, 0, sizeof (attrs)) ;
if (!XGetWindowAttributes (hostx_get_display (),
a_window,
&attrs)) {
return FALSE ;
}
a_attrs->x = attrs.x ;
a_attrs->y = attrs.y ;
a_attrs->width = attrs.width ;
a_attrs->height = attrs.height ;
if (attrs.visual)
a_attrs->visualid = attrs.visual->visualid ;
return TRUE ;
}
int
hostx_get_extension_info (const char *a_ext_name,
int *a_major_opcode,
@ -1039,3 +1060,75 @@ out:
}
typedef struct {
int is_valid ;
int local_id ;
int remote_id ;
} ResourcePair ;
#define RESOURCE_PEERS_SIZE 1024*10
static ResourcePair resource_peers[RESOURCE_PEERS_SIZE] ;
int
hostx_allocate_resource_id_peer (int a_local_resource_id,
int *a_remote_resource_id)
{
int i=0 ;
ResourcePair *peer=NULL ;
Display *dpy=hostx_get_display ();
/*
* first make sure a resource peer
* does not exist already for
* a_local_resource_id
*/
for (i=0; i<RESOURCE_PEERS_SIZE; i++) {
if (resource_peers[i].is_valid
&& resource_peers[i].local_id == a_local_resource_id) {
peer = &resource_peers[i] ;
break ;
}
}
/*
* find one free peer entry, an feed it with
*/
if (!peer) {
for (i=0; i<RESOURCE_PEERS_SIZE; i++) {
if (!resource_peers[i].is_valid) {
peer = &resource_peers[i] ;
break ;
}
}
if (peer) {
peer->remote_id = XAllocID (dpy);
peer->local_id = a_local_resource_id ;
peer->is_valid = TRUE ;
}
}
if (peer) {
*a_remote_resource_id = peer->remote_id ;
return TRUE ;
}
return FALSE ;
}
int
hostx_get_resource_id_peer (int a_local_resource_id,
int *a_remote_resource_id)
{
int i=0 ;
ResourcePair *peer=NULL ;
for (i=0; i<RESOURCE_PEERS_SIZE; i++) {
if (resource_peers[i].is_valid
&& resource_peers[i].local_id == a_local_resource_id) {
peer = &resource_peers[i] ;
break ;
}
}
if (peer) {
*a_remote_resource_id = peer->remote_id ;
return TRUE ;
}
return FALSE ;
}