xf86: add output source setting callback (v2)

This adds support for the randr callback for setting the output source
for a device.

v2: drop root clip change on detach

Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2012-07-05 15:50:24 +01:00
parent 4c92eb00f9
commit 98686512cb
2 changed files with 38 additions and 1 deletions

View File

@ -741,7 +741,11 @@ xf86CrtcCloseScreen(ScreenPtr screen)
}
/* detach any providers */
if (config->randr_provider) {
if (screen->current_master)
if (config->randr_provider->output_source) {
DetachOutputGPU(screen);
config->randr_provider->output_source = NULL;
}
else if (screen->current_master)
DetachUnboundGPU(screen);
}
xf86RandR12CloseScreen(screen);

View File

@ -1753,6 +1753,37 @@ xf86RandR12EnterVT(ScrnInfoPtr pScrn)
return RRGetInfo(pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */
}
static Bool
xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen,
RRProviderPtr provider,
RRProviderPtr source_provider)
{
if (!source_provider) {
if (provider->output_source) {
ScreenPtr cmScreen = pScreen->current_master;
DetachOutputGPU(pScreen);
AttachUnboundGPU(cmScreen, pScreen);
}
provider->output_source = NULL;
return TRUE;
}
if (provider->output_source == source_provider)
return TRUE;
SetRootClip(source_provider->pScreen, FALSE);
DetachUnboundGPU(pScreen);
AttachOutputGPU(source_provider->pScreen, pScreen);
provider->output_source = source_provider;
SetRootClip(source_provider->pScreen, TRUE);
return TRUE;
}
static Bool
xf86RandR14ProviderSetProperty(ScreenPtr pScreen,
RRProviderPtr randr_provider,
@ -1821,6 +1852,8 @@ xf86RandR12Init12(ScreenPtr pScreen)
rp->rrModeDestroy = xf86RandR12ModeDestroy;
rp->rrSetConfig = NULL;
rp->rrProviderSetOutputSource = xf86RandR14ProviderSetOutputSource;
rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty;
rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty;
rp->rrCrtcSetScanoutPixmap = xf86CrtcSetScanoutPixmap;