summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2016-05-13 15:58:10 +0200
committerHans de Goede <hdegoede@redhat.com>2016-06-17 11:35:58 +0200
commit5c7af02b103790ac1fb6a71822788892c70290b6 (patch)
tree461aac3e1d7caacda49b58c5226319e0b74ffa77 /dix
parentbab0f450a719a11799491043b82c2f293fed27fe (diff)
xrandrprovider: Do not use separate lists for unbound / source / offload slaves
A single provider can be both a offload and source slave at the same time, the use of seperate lists breaks in this case e.g. : xrandr --listproviders Providers: number : 2 Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 0 name:modesetting Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 0 name:modesetting xrandr --setprovideroutputsource 1 0x7b xrandr --listproviders Providers: number : 2 Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 1 name:modesetting Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 1 name:modesetting xrandr --setprovideroffloadsink 1 0x7b xrandr --listproviders Providers: number : 3 Provider 0: id: 0x7b cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 2 associated providers: 2 name:modesetting Provider 1: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 2 name:modesetting Provider 2: id: 0x46 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 5 associated providers: 2 name:modesetting Not good. The problem is that the provider with id 0x46 now is on both the output_slave_list and the offload_slave_list of the master screen. This commit fixes this by unifying all 3 lists into a single slaves list. Note that this does change the struct _Screen definition, so this is an ABI break. I do not expect any of the drivers to actually use the removed / changed fields so a recompile should suffice. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'dix')
-rw-r--r--dix/dispatch.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 86124c683..8a7eff712 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3789,9 +3789,7 @@ static int init_screen(ScreenPtr pScreen, int i, Bool gpu)
pScreen->CreateScreenResources = 0;
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);
+ xorg_list_init(&pScreen->slave_list);
/*
* This loop gets run once for every Screen that gets added,
@@ -3950,7 +3948,7 @@ AttachUnboundGPU(ScreenPtr pScreen, ScreenPtr new)
{
assert(new->isGPU);
assert(!new->current_master);
- xorg_list_add(&new->unattached_head, &pScreen->unattached_list);
+ xorg_list_add(&new->slave_head, &pScreen->slave_list);
new->current_master = pScreen;
}
@@ -3958,7 +3956,9 @@ void
DetachUnboundGPU(ScreenPtr slave)
{
assert(slave->isGPU);
- xorg_list_del(&slave->unattached_head);
+ assert(!slave->is_output_slave);
+ assert(!slave->is_offload_slave);
+ xorg_list_del(&slave->slave_head);
slave->current_master = NULL;
}
@@ -3966,31 +3966,35 @@ void
AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new)
{
assert(new->isGPU);
- xorg_list_add(&new->output_head, &pScreen->output_slave_list);
- new->current_master = pScreen;
+ assert(!new->is_output_slave);
+ assert(new->current_master == pScreen);
+ new->is_output_slave = TRUE;
+ new->current_master->output_slaves++;
}
void
DetachOutputGPU(ScreenPtr slave)
{
assert(slave->isGPU);
- xorg_list_del(&slave->output_head);
- slave->current_master = NULL;
+ assert(slave->is_output_slave);
+ slave->current_master->output_slaves--;
+ slave->is_output_slave = FALSE;
}
void
AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new)
{
assert(new->isGPU);
- xorg_list_add(&new->offload_head, &pScreen->offload_slave_list);
- new->current_master = pScreen;
+ assert(!new->is_offload_slave);
+ assert(new->current_master == pScreen);
+ new->is_offload_slave = TRUE;
}
void
DetachOffloadGPU(ScreenPtr slave)
{
assert(slave->isGPU);
- xorg_list_del(&slave->offload_head);
- slave->current_master = NULL;
+ assert(slave->is_offload_slave);
+ slave->is_offload_slave = FALSE;
}