[PATCH xf86-video-ati v2 1/3] Use root window (pixmap) instead of screen pixmap for scanout updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 1, 2017 at 5:19 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Preparation for following changes, no functional change intended yet.
>
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com> # v1
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
> ---
>
> v2: Add drmmode_screen_damage_destroy to prevent use-after-free on
>     server shutdown

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

>
>  src/drmmode_display.c | 21 ++++++++++++++-------
>  src/radeon_kms.c      |  2 +-
>  2 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index 245a92fb0..309ccbd6d 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -529,11 +529,8 @@ drmmode_crtc_scanout_free(drmmode_crtc_private_ptr drmmode_crtc)
>                                              &drmmode_crtc->scanout[1]);
>         }
>
> -       if (drmmode_crtc->scanout_damage) {
> +       if (drmmode_crtc->scanout_damage)
>                 DamageDestroy(drmmode_crtc->scanout_damage);
> -               drmmode_crtc->scanout_damage = NULL;
> -               RegionUninit(&drmmode_crtc->scanout_last_region);
> -       }
>  }
>
>  void
> @@ -605,6 +602,15 @@ radeon_screen_damage_report(DamagePtr damage, RegionPtr region, void *closure)
>         damage->damage.data = NULL;
>  }
>
> +static void
> +drmmode_screen_damage_destroy(DamagePtr damage, void *closure)
> +{
> +       drmmode_crtc_private_ptr drmmode_crtc = closure;
> +
> +       drmmode_crtc->scanout_damage = NULL;
> +       RegionUninit(&drmmode_crtc->scanout_last_region);
> +}
> +
>  static Bool
>  drmmode_can_use_hw_cursor(xf86CrtcPtr crtc)
>  {
> @@ -793,9 +799,10 @@ drmmode_crtc_scanout_update(xf86CrtcPtr crtc, DisplayModePtr mode,
>                 if (!drmmode_crtc->scanout_damage) {
>                         drmmode_crtc->scanout_damage =
>                                 DamageCreate(radeon_screen_damage_report,
> -                                            NULL, DamageReportRawRegion,
> -                                            TRUE, screen, NULL);
> -                       DamageRegister(&screen->GetScreenPixmap(screen)->drawable,
> +                                            drmmode_screen_damage_destroy,
> +                                            DamageReportRawRegion,
> +                                            TRUE, screen, drmmode_crtc);
> +                       DamageRegister(&screen->root->drawable,
>                                        drmmode_crtc->scanout_damage);
>                 }
>
> diff --git a/src/radeon_kms.c b/src/radeon_kms.c
> index b22c98406..f76d76a91 100644
> --- a/src/radeon_kms.c
> +++ b/src/radeon_kms.c
> @@ -981,7 +981,7 @@ radeon_scanout_do_update(xf86CrtcPtr xf86_crtc, int scanout_id)
>         GCPtr gc = GetScratchGC(pDraw->depth, pScreen);
>
>         ValidateGC(pDraw, gc);
> -       (*gc->ops->CopyArea)(&pScreen->GetScreenPixmap(pScreen)->drawable,
> +       (*gc->ops->CopyArea)(&pScreen->GetWindowPixmap(pScreen->root)->drawable,
>                              pDraw, gc,
>                              xf86_crtc->x + extents.x1, xf86_crtc->y + extents.y1,
>                              extents.x2 - extents.x1, extents.y2 - extents.y1,
> --
> 2.13.3
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux