mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-16 11:10:42 +01:00
xfree86: detach scanout pixmaps when detaching output GPUs
Commit8f4640bdb9fixed a bit of a chicken-and-egg problem by detaching GPU screens when their providers are destroyed, which happens before CloseScreen is called. However, this created a new problem: the GPU screen tears down its RandR crtc objects during CloseScreen and if one of them is active, it tries to detach the scanout pixmap then. This crashes because RRCrtcDetachScanoutPixmap tries to get the master screen's screen pixmap, but crtc->pScreen->current_master is already NULL at that point. It doesn't make sense for an unbound GPU screen to still be scanning out its former master screen's pixmap, so detach them first when the provider is destroyed. Signed-off-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Keith Packard <keithp@keithp.com> (cherry picked from commitbdd1e22cbd)
This commit is contained in:
parent
9fbbea8cda
commit
2bea21ea7e
1 changed files with 16 additions and 3 deletions
|
|
@ -1770,6 +1770,19 @@ xf86RandR12EnterVT(ScrnInfoPtr pScrn)
|
|||
return RRGetInfo(pScreen, TRUE); /* force a re-probe of outputs and notify clients about changes */
|
||||
}
|
||||
|
||||
static void
|
||||
xf86DetachOutputGPU(ScreenPtr pScreen)
|
||||
{
|
||||
rrScrPrivPtr rp = rrGetScrPriv(pScreen);
|
||||
int i;
|
||||
|
||||
/* make sure there are no attached shared scanout pixmaps first */
|
||||
for (i = 0; i < rp->numCrtcs; i++)
|
||||
RRCrtcDetachScanoutPixmap(rp->crtcs[i]);
|
||||
|
||||
DetachOutputGPU(pScreen);
|
||||
}
|
||||
|
||||
static Bool
|
||||
xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen,
|
||||
RRProviderPtr provider,
|
||||
|
|
@ -1779,7 +1792,7 @@ xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen,
|
|||
if (provider->output_source) {
|
||||
ScreenPtr cmScreen = pScreen->current_master;
|
||||
|
||||
DetachOutputGPU(pScreen);
|
||||
xf86DetachOutputGPU(pScreen);
|
||||
AttachUnboundGPU(cmScreen, pScreen);
|
||||
}
|
||||
provider->output_source = NULL;
|
||||
|
|
@ -1807,7 +1820,7 @@ xf86RandR14ProviderSetOffloadSink(ScreenPtr pScreen,
|
|||
if (!sink_provider) {
|
||||
if (provider->offload_sink) {
|
||||
ScreenPtr cmScreen = pScreen->current_master;
|
||||
DetachOutputGPU(pScreen);
|
||||
xf86DetachOutputGPU(pScreen);
|
||||
AttachUnboundGPU(cmScreen, pScreen);
|
||||
}
|
||||
|
||||
|
|
@ -1897,7 +1910,7 @@ xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider)
|
|||
config->randr_provider->offload_sink = NULL;
|
||||
}
|
||||
else if (config->randr_provider->output_source) {
|
||||
DetachOutputGPU(screen);
|
||||
xf86DetachOutputGPU(screen);
|
||||
config->randr_provider->output_source = NULL;
|
||||
}
|
||||
else if (screen->current_master)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue