[PATCH v2 xf86-video-amdgpu] Add amdgpu_dirty_src_drawable helper

Alex Deucher alexdeucher at gmail.com
Mon Nov 27 21:56:09 UTC 2017


On Thu, Nov 23, 2017 at 5:48 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Allows tidying up amdgpu_dirty_src_equals and redisplay_dirty slightly.
>
> v2:
> * Different approach for amdgpu_dirty_master
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>

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

> ---
>  src/amdgpu_drv.h | 18 +++++++++---------
>  src/amdgpu_kms.c |  7 ++-----
>  2 files changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
> index 4ee13e12b..055c3c3e9 100644
> --- a/src/amdgpu_drv.h
> +++ b/src/amdgpu_drv.h
> @@ -177,24 +177,24 @@ amdgpu_master_screen(ScreenPtr screen)
>
>  static inline ScreenPtr
>  amdgpu_dirty_master(PixmapDirtyUpdatePtr dirty)
> +{
> +       return amdgpu_master_screen(dirty->slave_dst->drawable.pScreen);
> +}
> +
> +static inline DrawablePtr
> +amdgpu_dirty_src_drawable(PixmapDirtyUpdatePtr dirty)
>  {
>  #ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
> -       ScreenPtr screen = dirty->src->pScreen;
> +       return dirty->src;
>  #else
> -       ScreenPtr screen = dirty->src->drawable.pScreen;
> +       return &dirty->src->drawable;
>  #endif
> -
> -       return amdgpu_master_screen(screen);
>  }
>
>  static inline Bool
>  amdgpu_dirty_src_equals(PixmapDirtyUpdatePtr dirty, PixmapPtr pixmap)
>  {
> -#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
> -       return dirty->src == &pixmap->drawable;
> -#else
> -       return dirty->src == pixmap;
> -#endif
> +       return amdgpu_dirty_src_drawable(dirty) == &pixmap->drawable;
>  }
>
>
> diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
> index a5f2040a8..c15711224 100644
> --- a/src/amdgpu_kms.c
> +++ b/src/amdgpu_kms.c
> @@ -479,11 +479,8 @@ dirty_region(PixmapDirtyUpdatePtr dirty)
>  static void
>  redisplay_dirty(PixmapDirtyUpdatePtr dirty, RegionPtr region)
>  {
> -#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
> -       ScrnInfoPtr src_scrn = xf86ScreenToScrn(dirty->src->pScreen);
> -#else
> -       ScrnInfoPtr src_scrn = xf86ScreenToScrn(dirty->src->drawable.pScreen);
> -#endif
> +       ScrnInfoPtr src_scrn =
> +               xf86ScreenToScrn(amdgpu_dirty_src_drawable(dirty)->pScreen);
>
>         if (RegionNil(region))
>                 goto out;
> --
> 2.15.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list