[PATCH] drm/amdgpu: minor CS optimization
Deucher, Alexander
Alexander.Deucher at amd.com
Thu Oct 12 14:33:36 UTC 2017
> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Christian König
> Sent: Thursday, October 12, 2017 6:20 AM
> To: Grodzovsky, Andrey; amd-gfx at lists.freedesktop.org
> Subject: [PATCH] drm/amdgpu: minor CS optimization
>
> From: Christian König <christian.koenig at amd.com>
>
> We only need to loop over all IBs for old UVD/VCE command stream
> patching.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 37 +++++++++++++++++----
> -------------
> 1 file changed, 19 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 2ae5d52..20e2a71 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -855,36 +855,37 @@ static int amdgpu_cs_ib_vm_chunk(struct
> amdgpu_device *adev,
> struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
> struct amdgpu_vm *vm = &fpriv->vm;
> struct amdgpu_ring *ring = p->job->ring;
> - int i, j, r;
> -
> - for (i = 0, j = 0; i < p->nchunks && j < p->job->num_ibs; i++) {
> -
> - struct amdgpu_cs_chunk *chunk;
> - struct amdgpu_ib *ib;
> - struct drm_amdgpu_cs_chunk_ib *chunk_ib;
> -
> - chunk = &p->chunks[i];
> - ib = &p->job->ibs[j];
> - chunk_ib = (struct drm_amdgpu_cs_chunk_ib *)chunk-
> >kdata;
> + int r;
>
> - if (chunk->chunk_id != AMDGPU_CHUNK_ID_IB)
> - continue;
> + /* Only for UVD/VCE VM emulation */
> + if (p->job->ring->funcs->parse_cs) {
> + unsigned i, j;
>
> - if (p->job->ring->funcs->parse_cs) {
> + for (i = 0, j = 0; i < p->nchunks && j < p->job->num_ibs; i++) {
> + struct drm_amdgpu_cs_chunk_ib *chunk_ib;
> struct amdgpu_bo_va_mapping *m;
> struct amdgpu_bo *aobj = NULL;
> + struct amdgpu_cs_chunk *chunk;
> + struct amdgpu_ib *ib;
> uint64_t offset;
> uint8_t *kptr;
>
> + chunk = &p->chunks[i];
> + ib = &p->job->ibs[j];
> + chunk_ib = chunk->kdata;
> +
> + if (chunk->chunk_id != AMDGPU_CHUNK_ID_IB)
> + continue;
> +
> r = amdgpu_cs_find_mapping(p, chunk_ib->va_start,
> - &aobj, &m);
> + &aobj, &m);
> if (r) {
> DRM_ERROR("IB va_start is invalid\n");
> return r;
> }
>
> if ((chunk_ib->va_start + chunk_ib->ib_bytes) >
> - (m->last + 1) * AMDGPU_GPU_PAGE_SIZE) {
> + (m->last + 1) * AMDGPU_GPU_PAGE_SIZE) {
> DRM_ERROR("IB va_start+ib_bytes is
> invalid\n");
> return -EINVAL;
> }
> @@ -901,12 +902,12 @@ static int amdgpu_cs_ib_vm_chunk(struct
> amdgpu_device *adev,
> memcpy(ib->ptr, kptr, chunk_ib->ib_bytes);
> amdgpu_bo_kunmap(aobj);
>
> - /* Only for UVD/VCE VM emulation */
> r = amdgpu_ring_parse_cs(ring, p, j);
> if (r)
> return r;
> +
> + j++;
> }
> - j++;
> }
>
> if (p->job->vm) {
> --
> 2.7.4
>
> _______________________________________________
> 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