modesetting: Fix msSharePixmapBacking Segfault Regression

Commit cb1b1e184 modified msSharePixmapBacking() to derive modesettingPtr from
the 'screen' argument. Unfortunately, the name of the argument is misleading --
the screen is the slave screen. If the master is modesetting,
and the slave is not modesetting, it will segfault.

To fix the problem, this change derives modesettingPtr from
ppix->drawable.pScreen. This method is already used when calling
ms->glamor.shareable_fd_from_pixmap() later in the function.

To avoid future issues, this change also renames the 'screen' argument to
'slave'.

Signed-off-by: Alex Goins <agoins@nvidia.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
This commit is contained in:
Alex Goins 2019-12-12 20:18:53 -06:00 committed by Aaron Plattner
parent 58155baeac
commit 456dff1bf8

View File

@ -1443,10 +1443,11 @@ CreateScreenResources(ScreenPtr pScreen)
}
static Bool
msSharePixmapBacking(PixmapPtr ppix, ScreenPtr screen, void **handle)
msSharePixmapBacking(PixmapPtr ppix, ScreenPtr slave, void **handle)
{
#ifdef GLAMOR_HAS_GBM
modesettingPtr ms = modesettingPTR(xf86ScreenToScrn(screen));
modesettingPtr ms =
modesettingPTR(xf86ScreenToScrn(ppix->drawable.pScreen));
int ret;
CARD16 stride;
CARD32 size;