[Mesa-dev] [PATCH 2/3] radeon/winsys: keep track of the last CS a BO was used in

Marek Olšák maraeo at gmail.com
Thu Sep 18 11:13:52 PDT 2014


On Thu, Sep 18, 2014 at 5:34 PM, Christian König
<deathsimple at vodafone.de> wrote:
> From: Christian König <christian.koenig at amd.com>
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  src/gallium/winsys/radeon/drm/radeon_drm_bo.h |  3 +++
>  src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 11 +++++++++--
>  src/gallium/winsys/radeon/drm/radeon_drm_cs.h |  2 +-
>  3 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.h b/src/gallium/winsys/radeon/drm/radeon_drm_bo.h
> index 1c00a13..393c53c 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.h
> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.h
> @@ -65,6 +65,9 @@ struct radeon_bo {
>      /* how many command streams, which are being emitted in a separate
>       * thread, is this bo referenced in? */
>      int num_active_ioctls;
> +
> +    /* the ID of the last command submission this buffer was used with */
> +    uint64_t last_cs_id;
>  };
>
>  struct pb_manager *radeon_bomgr_create(struct radeon_drm_winsys *rws);
> diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
> index 0aa54c2..e821b6f 100644
> --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
> +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
> @@ -107,7 +107,7 @@ static boolean radeon_init_cs_context(struct radeon_cs_context *csc,
>      csc->chunks[1].length_dw = 0;
>      csc->chunks[1].chunk_data = (uint64_t)(uintptr_t)csc->relocs;
>      csc->chunks[2].chunk_id = RADEON_CHUNK_ID_FLAGS;
> -    csc->chunks[2].length_dw = 2;
> +    csc->chunks[2].length_dw = 5;
>      csc->chunks[2].chunk_data = (uint64_t)(uintptr_t)&csc->flags;
>
>      csc->chunk_array[0] = (uint64_t)(uintptr_t)&csc->chunks[0];
> @@ -382,6 +382,7 @@ static boolean radeon_drm_cs_memory_below_limit(struct radeon_winsys_cs *rcs, ui
>
>  void radeon_drm_cs_emit_ioctl_oneshot(struct radeon_drm_cs *cs, struct radeon_cs_context *csc)
>  {
> +    uint64_t id;
>      unsigned i;
>
>      if (drmCommandWriteRead(csc->fd, DRM_RADEON_CS,
> @@ -403,8 +404,11 @@ void radeon_drm_cs_emit_ioctl_oneshot(struct radeon_drm_cs *cs, struct radeon_cs
>          radeon_dump_cs_on_lockup(cs, csc);
>      }
>
> -    for (i = 0; i < csc->crelocs; i++)
> +    id = *((uint64_t *)&csc->flags[3]);

Please add a comment here that the ID is returned by the CS ioctl.

Other than that, the series is:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek


More information about the mesa-dev mailing list