* [PATCH 1/2] drm/amdgpu: stop waiting in amdgpu_uvd_send_msg
@ 2023-01-17 8:12 Christian König
2023-01-17 8:12 ` [PATCH 2/2] drm/amdgpu: simplify amdgpu_uvd_send_msg Christian König
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2023-01-17 8:12 UTC (permalink / raw)
To: amd-gfx
We have a wait in the amdgpu_bo_kmap() code for quite a while now, so
waiting here isn't needed any more.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index b67a5fb2ff3e..dd0894c9740d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -1122,8 +1122,7 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
struct amdgpu_ib *ib;
uint32_t data[4];
uint64_t addr;
- long r;
- int i;
+ int i, r;
unsigned offset_idx = 0;
unsigned offset[3] = { UVD_BASE_SI, 0, 0 };
@@ -1158,24 +1157,10 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
ib->length_dw = 16;
if (direct) {
- r = dma_resv_wait_timeout(bo->tbo.base.resv,
- DMA_RESV_USAGE_KERNEL, false,
- msecs_to_jiffies(10));
- if (r == 0)
- r = -ETIMEDOUT;
- if (r < 0)
- goto err_free;
-
r = amdgpu_job_submit_direct(job, ring, &f);
if (r)
goto err_free;
} else {
- r = amdgpu_sync_resv(adev, &job->sync, bo->tbo.base.resv,
- AMDGPU_SYNC_ALWAYS,
- AMDGPU_FENCE_OWNER_UNDEFINED);
- if (r)
- goto err_free;
-
r = amdgpu_job_submit(job, &adev->uvd.entity,
AMDGPU_FENCE_OWNER_UNDEFINED, &f);
if (r)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] drm/amdgpu: simplify amdgpu_uvd_send_msg
2023-01-17 8:12 [PATCH 1/2] drm/amdgpu: stop waiting in amdgpu_uvd_send_msg Christian König
@ 2023-01-17 8:12 ` Christian König
2023-01-17 14:13 ` Alex Deucher
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2023-01-17 8:12 UTC (permalink / raw)
To: amd-gfx
We only need one offset and not an array of it.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index dd0894c9740d..229419c0c031 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -1118,29 +1118,26 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
{
struct amdgpu_device *adev = ring->adev;
struct dma_fence *f = NULL;
+ uint32_t offset, data[4];
struct amdgpu_job *job;
struct amdgpu_ib *ib;
- uint32_t data[4];
uint64_t addr;
int i, r;
- unsigned offset_idx = 0;
- unsigned offset[3] = { UVD_BASE_SI, 0, 0 };
r = amdgpu_job_alloc_with_ib(adev, 64, direct ? AMDGPU_IB_POOL_DIRECT :
AMDGPU_IB_POOL_DELAYED, &job);
if (r)
return r;
- if (adev->asic_type >= CHIP_VEGA10) {
- offset_idx = 1 + ring->me;
- offset[1] = adev->reg_offset[UVD_HWIP][0][1];
- offset[2] = adev->reg_offset[UVD_HWIP][1][1];
- }
+ if (adev->asic_type >= CHIP_VEGA10)
+ offset = adev->reg_offset[UVD_HWIP][ring->me][1];
+ else
+ offset = UVD_BASE_SI;
- data[0] = PACKET0(offset[offset_idx] + UVD_GPCOM_VCPU_DATA0, 0);
- data[1] = PACKET0(offset[offset_idx] + UVD_GPCOM_VCPU_DATA1, 0);
- data[2] = PACKET0(offset[offset_idx] + UVD_GPCOM_VCPU_CMD, 0);
- data[3] = PACKET0(offset[offset_idx] + UVD_NO_OP, 0);
+ data[0] = PACKET0(offset + UVD_GPCOM_VCPU_DATA0, 0);
+ data[1] = PACKET0(offset + UVD_GPCOM_VCPU_DATA1, 0);
+ data[2] = PACKET0(offset + UVD_GPCOM_VCPU_CMD, 0);
+ data[3] = PACKET0(offset + UVD_NO_OP, 0);
ib = &job->ibs[0];
addr = amdgpu_bo_gpu_offset(bo);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] drm/amdgpu: simplify amdgpu_uvd_send_msg
2023-01-17 8:12 ` [PATCH 2/2] drm/amdgpu: simplify amdgpu_uvd_send_msg Christian König
@ 2023-01-17 14:13 ` Alex Deucher
0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2023-01-17 14:13 UTC (permalink / raw)
To: Christian König; +Cc: amd-gfx
Series is:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
On Tue, Jan 17, 2023 at 3:12 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> We only need one offset and not an array of it.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index dd0894c9740d..229419c0c031 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -1118,29 +1118,26 @@ static int amdgpu_uvd_send_msg(struct amdgpu_ring *ring, struct amdgpu_bo *bo,
> {
> struct amdgpu_device *adev = ring->adev;
> struct dma_fence *f = NULL;
> + uint32_t offset, data[4];
> struct amdgpu_job *job;
> struct amdgpu_ib *ib;
> - uint32_t data[4];
> uint64_t addr;
> int i, r;
> - unsigned offset_idx = 0;
> - unsigned offset[3] = { UVD_BASE_SI, 0, 0 };
>
> r = amdgpu_job_alloc_with_ib(adev, 64, direct ? AMDGPU_IB_POOL_DIRECT :
> AMDGPU_IB_POOL_DELAYED, &job);
> if (r)
> return r;
>
> - if (adev->asic_type >= CHIP_VEGA10) {
> - offset_idx = 1 + ring->me;
> - offset[1] = adev->reg_offset[UVD_HWIP][0][1];
> - offset[2] = adev->reg_offset[UVD_HWIP][1][1];
> - }
> + if (adev->asic_type >= CHIP_VEGA10)
> + offset = adev->reg_offset[UVD_HWIP][ring->me][1];
> + else
> + offset = UVD_BASE_SI;
>
> - data[0] = PACKET0(offset[offset_idx] + UVD_GPCOM_VCPU_DATA0, 0);
> - data[1] = PACKET0(offset[offset_idx] + UVD_GPCOM_VCPU_DATA1, 0);
> - data[2] = PACKET0(offset[offset_idx] + UVD_GPCOM_VCPU_CMD, 0);
> - data[3] = PACKET0(offset[offset_idx] + UVD_NO_OP, 0);
> + data[0] = PACKET0(offset + UVD_GPCOM_VCPU_DATA0, 0);
> + data[1] = PACKET0(offset + UVD_GPCOM_VCPU_DATA1, 0);
> + data[2] = PACKET0(offset + UVD_GPCOM_VCPU_CMD, 0);
> + data[3] = PACKET0(offset + UVD_NO_OP, 0);
>
> ib = &job->ibs[0];
> addr = amdgpu_bo_gpu_offset(bo);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-17 14:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 8:12 [PATCH 1/2] drm/amdgpu: stop waiting in amdgpu_uvd_send_msg Christian König
2023-01-17 8:12 ` [PATCH 2/2] drm/amdgpu: simplify amdgpu_uvd_send_msg Christian König
2023-01-17 14:13 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.