[V2] modesetting: Fix X crash in ms_dirty_update()

jimqu jimqu at amd.com
Tue Aug 7 04:47:58 UTC 2018


ping....


On 2018年08月06日 10:40, Jim Qu wrote:
> On some Intel iGPU + AMD dGPU platform, when connect extern display
> from dGPU, X will crash, show the log like:
>
> randr: falling back to unsynchronized pixmap sharing
> (EE)
> (EE) Backtrace:
> (EE) 0: /usr/lib/xorg/Xorg (xorg_backtrace+0x4e)
> (EE) 1: /usr/lib/xorg/Xorg (0x55cb0151a000+0x1b5ce9)
> (EE) 2: /lib/x86_64-linux-gnu/libpthread.so.0 (0x7f1587a1d000+0x11390)
> (EE)
> (EE) Segmentation fault at address 0x0
> (EE)
>
> There is NULL pointer accessing on ent->slave_dst->drawable.pScreen->
> SharedPixmapNotifyDamage.
>
> On the platform, since the dGPU is GPU device, so that the iGPU is
> output master device. SharedPixmapNotifyDamage() should be called when
> current device is output master.
>
> Change-Id: I8fa6922a4f75b5e068970fc4d362f778052379f2
> Signed-off-by: Jim Qu <Jim.Qu at amd.com>
> ---
>   hw/xfree86/drivers/modesetting/driver.c | 22 ++++++++++++----------
>   1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
> index 9362370..37fafb1 100644
> --- a/hw/xfree86/drivers/modesetting/driver.c
> +++ b/hw/xfree86/drivers/modesetting/driver.c
> @@ -640,19 +640,21 @@ ms_dirty_update(ScreenPtr screen, int *timeout)
>       xorg_list_for_each_entry(ent, &screen->pixmap_dirty_list, ent) {
>           region = DamageRegion(ent->damage);
>           if (RegionNotEmpty(region)) {
> -            msPixmapPrivPtr ppriv =
> -                msGetPixmapPriv(&ms->drmmode, ent->slave_dst);
> +            if (!screen->isGPU) {
> +                    msPixmapPrivPtr ppriv =
> +                        msGetPixmapPriv(&ms->drmmode, ent->slave_dst->master_pixmap);
>   
> -            if (ppriv->notify_on_damage) {
> -                ppriv->notify_on_damage = FALSE;
> +                    if (ppriv->notify_on_damage) {
> +                        ppriv->notify_on_damage = FALSE;
>   
> -                ent->slave_dst->drawable.pScreen->
> -                    SharedPixmapNotifyDamage(ent->slave_dst);
> -            }
> +                        ent->slave_dst->drawable.pScreen->
> +                            SharedPixmapNotifyDamage(ent->slave_dst);
> +                    }
>   
> -            /* Requested manual updating */
> -            if (ppriv->defer_dirty_update)
> -                continue;
> +                    /* Requested manual updating */
> +                    if (ppriv->defer_dirty_update)
> +                        continue;
> +            }
>   
>               redisplay_dirty(screen, ent, timeout);
>               DamageEmpty(ent->damage);



More information about the xorg-devel mailing list