[PATCH] [RFC] modesetting: add zaphod support (v2)

Александр Волков a.volkov at rusbitech.ru
Mon Nov 23 02:34:12 PST 2015


27.07.2015 02:43, Dave Airlie пишет:
> +modesettingEntPtr ms_ent_priv(ScrnInfoPtr scrn)
> +{
> +    DevUnion     *pPriv;
> +    modesettingPtr ms = modesettingPTR(scrn);
> +    pPriv = xf86GetEntityPrivate(ms->pEnt->index,
> +                                 ms_entity_index);
> +    return pPriv->ptr;
> +}

> @@ -596,19 +626,25 @@ FreeRec(ScrnInfoPtr pScrn)
>       pScrn->driverPrivate = NULL;
>   
>       if (ms->fd > 0) {
> +        modesettingEntPtr ms_ent;
>           int ret;
>   
> -        if (ms->pEnt->location.type == BUS_PCI)
> -            ret = drmClose(ms->fd);
> -        else
> +        ms_ent = ms_ent_priv(pScrn);
>                                     prefer_shadow);

> diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
> ...
>   
>   #define modesettingPTR(p) ((modesettingPtr)((p)->driverPrivate))

Calling ms_ent_priv() after setting pScrn->driverPrivate to NULL causes 
a segfault, because modesettingPTR() in ms_ent_priv() returns NULL.
For example, the segfault happens after unplugging a USB card.


More information about the xorg-devel mailing list