[PATCH 33/36] dix/xf86: initial offload slave tracking
Dave Airlie
airlied at gmail.com
Mon Jul 2 03:13:26 PDT 2012
From: Dave Airlie <airlied at redhat.com>
add the linked list and provider hooks.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
dix/dispatch.c | 18 ++++++++++++++++++
hw/xfree86/common/xf86platformBus.c | 3 +++
hw/xfree86/modes/xf86RandR12.c | 12 ++++++++++++
include/screenint.h | 6 ++++++
include/scrnintstr.h | 3 +++
randr/rrprovider.c | 7 +++++++
6 files changed, 49 insertions(+)
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 417fcf4..748e733 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3743,6 +3743,7 @@ static int init_screen(ScreenPtr pScreen, int i, Bool gpu)
xorg_list_init(&pScreen->pixmap_dirty_list);
xorg_list_init(&pScreen->unattached_list);
xorg_list_init(&pScreen->output_slave_list);
+ xorg_list_init(&pScreen->offload_slave_list);
/*
* This loop gets run once for every Screen that gets added,
@@ -3924,3 +3925,20 @@ DetachOutputGPU(ScreenPtr slave)
xorg_list_del(&slave->output_head);
slave->current_master = NULL;
}
+
+void
+AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new)
+{
+ assert(new->isGPU);
+ xorg_list_add(&new->offload_head, &pScreen->offload_slave_list);
+ new->current_master = pScreen;
+}
+
+void
+DetachOffloadGPU(ScreenPtr slave)
+{
+ assert(slave->isGPU);
+ xorg_list_del(&slave->offload_head);
+ slave->current_master = NULL;
+}
+
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index faed37b..1c73bf6 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -486,6 +486,9 @@ xf86platformRemoveDevice(int index)
xf86DetachAllCrtc(xf86GPUScreens[i]);
DetachOutputGPU(xf86GPUScreens[i]->pScreen);
break;
+ case RR_Role_Slave_Offload:
+ DetachOffloadGPU(xf86GPUScreens[i]->pScreen);
+ break;
}
xf86GPUScreens[i]->pScreen->CloseScreen(xf86GPUScreens[i]->pScreen);
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index e071d23..26223cb 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1778,6 +1778,13 @@ xf86RandR15ProviderSetRole(ScreenPtr pScreen,
xf86SetCurrentRole(xf86ScreenToScrn(pScreen), RR_Role_Slave_Output);
}
+ if (new_role == RR_Role_Slave_Offload) {
+ if (provider->current_role == 0)
+ DetachUnboundGPU(pScreen);
+ AttachOffloadGPU(master, pScreen);
+ xf86SetCurrentRole(xf86ScreenToScrn(pScreen), RR_Role_Slave_Offload);
+ }
+
if (!new_role) {
if (provider->current_role == RR_Role_Slave_Output) {
@@ -1786,7 +1793,12 @@ xf86RandR15ProviderSetRole(ScreenPtr pScreen,
xf86SetCurrentRole(xf86ScreenToScrn(pScreen), 0);
}
+ if (provider->current_role == RR_Role_Slave_Offload) {
+ DetachOffloadGPU(pScreen);
+ xf86SetCurrentRole(xf86ScreenToScrn(pScreen), 0);
+ }
AttachUnboundGPU(master, pScreen);
+
}
RRTellChanged(master);
diff --git a/include/screenint.h b/include/screenint.h
index b992cc2..e36b4d8 100644
--- a/include/screenint.h
+++ b/include/screenint.h
@@ -82,6 +82,12 @@ AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new);
extern _X_EXPORT void
DetachOutputGPU(ScreenPtr output);
+extern _X_EXPORT void
+AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new);
+
+extern _X_EXPORT void
+DetachOffloadGPU(ScreenPtr slave);
+
typedef struct _ColormapRec *ColormapPtr;
#endif /* SCREENINT_H */
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index caa6509..01c22f7 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -505,6 +505,9 @@ typedef struct _Screen {
StopPixmapTrackingProcPtr StopPixmapTracking;
struct xorg_list pixmap_dirty_list;
+ struct xorg_list offload_slave_list;
+ struct xorg_list offload_head;
+
} ScreenRec;
static inline RegionPtr
diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index 7426e22..e9d33fc 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -75,6 +75,10 @@ ProcRRGetProviders (ClientPtr client)
pScrPriv = rrGetScrPriv(iter);
total_providers += pScrPriv->provider ? 1 : 0;
}
+ xorg_list_for_each_entry(iter, &pScreen->offload_slave_list, offload_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;
@@ -114,6 +118,9 @@ ProcRRGetProviders (ClientPtr client)
xorg_list_for_each_entry(iter, &pScreen->output_slave_list, output_head) {
ADD_PROVIDER(iter);
}
+ xorg_list_for_each_entry(iter, &pScreen->offload_slave_list, offload_head) {
+ ADD_PROVIDER(iter);
+ }
xorg_list_for_each_entry(iter, &pScreen->unattached_list, unattached_head) {
ADD_PROVIDER(iter);
}
--
1.7.10.2
More information about the xorg-devel
mailing list