Re: [PATCH 19/36] dix: add ability to link output slave gpus to the current gpu

2012-07-03 Thread Dave Airlie
On Tue, Jul 3, 2012 at 12:41 AM, Keith Packard kei...@keithp.com wrote:

 Dave Airlie airl...@gmail.com writes:

 +void
 +AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new)
 +{
 +assert(new-isGPU);
 +xorg_list_add(new-output_head, pScreen-output_slave_list);
 +new-current_master = pScreen;
 +}

 I'd love an assert that new isn't already on a list somehow?

I'm not really sure you can tell that, since list members don't have
to make sense
by default,

I could add
assert(!new-current_master);
which should be true.

Dave.
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 19/36] dix: add ability to link output slave gpus to the current gpu

2012-07-03 Thread Keith Packard
Dave Airlie airl...@gmail.com writes:

 I could add
 assert(!new-current_master);
 which should be true.

Yeah, that's probably a good idea for now; I fear mis-use of this API
will end with slaves being on multiple masters...

-- 
keith.pack...@intel.com


pgpyTbWgfZTTx.pgp
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 19/36] dix: add ability to link output slave gpus to the current gpu

2012-07-02 Thread Dave Airlie
From: Dave Airlie airl...@redhat.com

Just add the interfaces to attach/detach output slaves, and
a linked list to keep track of them. Hook up the randr providers
list to include these slaves.

Signed-off-by: Dave Airlie airl...@redhat.com
---
 dix/dispatch.c   |   16 
 include/screenint.h  |6 ++
 include/scrnintstr.h |3 +++
 randr/rrprovider.c   |7 +++
 4 files changed, 32 insertions(+)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index b9da233..59dce2f 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3741,6 +3741,7 @@ static int init_screen(ScreenPtr pScreen, int i, Bool gpu)
 pScreen-CreateScreenResources = 0;
 
 xorg_list_init(pScreen-unattached_list);
+xorg_list_init(pScreen-output_slave_list);
 
 /*
  * This loop gets run once for every Screen that gets added,
@@ -3907,3 +3908,18 @@ DetachUnboundGPU(ScreenPtr slave)
 slave-current_master = NULL;
 }
 
+void
+AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new)
+{
+assert(new-isGPU);
+xorg_list_add(new-output_head, pScreen-output_slave_list);
+new-current_master = pScreen;
+}
+
+void
+DetachOutputGPU(ScreenPtr slave)
+{
+assert(slave-isGPU);
+xorg_list_del(slave-output_head);
+slave-current_master = NULL;
+}
diff --git a/include/screenint.h b/include/screenint.h
index c0c60ef..b992cc2 100644
--- a/include/screenint.h
+++ b/include/screenint.h
@@ -76,6 +76,12 @@ AttachUnboundGPU(ScreenPtr pScreen, ScreenPtr new);
 extern _X_EXPORT void
 DetachUnboundGPU(ScreenPtr unbound);
 
+extern _X_EXPORT void
+AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new);
+
+extern _X_EXPORT void
+DetachOutputGPU(ScreenPtr output);
+
 typedef struct _ColormapRec *ColormapPtr;
 
 #endif  /* SCREENINT_H */
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 8a21c2c..6a22167 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -483,6 +483,9 @@ typedef struct _Screen {
 
 ScreenPtr current_master;
 
+struct xorg_list output_slave_list;
+struct xorg_list output_head;
+
 } ScreenRec;
 
 static inline RegionPtr
diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index c019e91..7426e22 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -71,6 +71,10 @@ ProcRRGetProviders (ClientPtr client)
 
 if (pScrPriv-provider)
 total_providers++;
+xorg_list_for_each_entry(iter, pScreen-output_slave_list, output_head) {
+pScrPriv = rrGetScrPriv(iter);
+total_providers += pScrPriv-provider ? 1 : 0;
+}
 xorg_list_for_each_entry(iter, pScreen-unattached_list, unattached_head) 
{
 pScrPriv = rrGetScrPriv(iter);
 total_providers += pScrPriv-provider ? 1 : 0;
@@ -107,6 +111,9 @@ ProcRRGetProviders (ClientPtr client)
 
 providers = (RRProvider *)extra;
 ADD_PROVIDER(pScreen);
+xorg_list_for_each_entry(iter, pScreen-output_slave_list, 
output_head) {
+ADD_PROVIDER(iter);
+}
 xorg_list_for_each_entry(iter, pScreen-unattached_list, 
unattached_head) {
 ADD_PROVIDER(iter);
 }
-- 
1.7.10.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 19/36] dix: add ability to link output slave gpus to the current gpu

2012-07-02 Thread Keith Packard

Dave Airlie airl...@gmail.com writes:

 +void
 +AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new)
 +{
 +assert(new-isGPU);
 +xorg_list_add(new-output_head, pScreen-output_slave_list);
 +new-current_master = pScreen;
 +}

I'd love an assert that new isn't already on a list somehow?

-- 
keith.pack...@intel.com


pgpcYXaPok4OI.pgp
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel