drm/amdgpu: add support for inplace IB patching for MM engines v2
Subsystems (2)
PATCH 1/2 drm/amdgpu: add support for inplace IB patching for MM engines v2
We are going to need that for the second UVD instance on Vega20.
v2: rename to patch_cs_in_place
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 22 +++++++++++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 + 3 files changed, 17 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1751,6 +1751,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)#define amdgpu_vm_write_pte (adev, ib, pe, value, count, incr) ((adev)->vm_manager.vm_pte_funcs->write_pte((ib), (pe), (value), (count), (incr)))#define amdgpu_vm_set_pte_pde (adev, ib, pe, addr, count, incr, flags) ((adev)->vm_manager.vm_pte_funcs->set_pte_pde((ib), (pe), (addr), (count), (incr), (flags)))#define amdgpu_ring_parse_cs (r, p, ib) ((r)->funcs->parse_cs((p), (ib))) +#define amdgpu_ring_patch_cs_in_place (r, p, ib) ((r)->funcs->patch_cs_in_place((p), (ib)))#define amdgpu_ring_test_ring (r) (r)->funcs->test_ring((r))#define amdgpu_ring_test_ib (r, t) (r)->funcs->test_ib((r), (t))#define amdgpu_ring_get_rptr (r) (r)->funcs->get_rptr((r))
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +15 -7
@@ -916,7 +916,7 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev,int r;/* Only for UVD/VCE VM emulation */ -if (p->ring->funcs->parse_cs) { +if (p->ring->funcs->parse_cs || p->ring->funcs->patch_cs_in_place) {unsigned i, j;for (i =0 , j =0 ; i < p->nchunks && j < p->job->num_ibs; i++) {
@@ -957,12 +957,20 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev, offset = m->start *AMDGPU_GPU_PAGE_SIZE ; kptr += va_start - offset; -memcpy (ib->ptr, kptr, chunk_ib->ib_bytes); -amdgpu_bo_kunmap (aobj); - - r =amdgpu_ring_parse_cs (ring, p, j); -if (r) -return r; +if (p->ring->funcs->parse_cs) { +memcpy (ib->ptr, kptr, chunk_ib->ib_bytes); +amdgpu_bo_kunmap (aobj); + + r =amdgpu_ring_parse_cs (ring, p, j); +if (r) +return r; + }else { + ib->ptr = (uint32_t *)kptr; + r =amdgpu_ring_patch_cs_in_place (ring, p, j); +amdgpu_bo_kunmap (aobj); +if (r) +return r; + } j++; }
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1 -0
@@ -123,6 +123,7 @@ struct amdgpu_ring_funcs {void (*set_wptr)(struct amdgpu_ring *ring);/* validating and patching of IBs */ int (*parse_cs)(struct amdgpu_cs_parser *p,uint32_t ib_idx); +int (*patch_cs_in_place)(struct amdgpu_cs_parser *p,uint32_t ib_idx);/* constants to calculate how many DW are needed for an emit */ unsigned emit_frame_size;unsigned emit_ib_size;
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180725110527.36163-1-christian.koenig-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu: patch the IBs for the second UVD instance v2
Patch the IBs for the second UVD instance so that userspace don't need to care about the instance they submit to.
v2: use direct IB patching
--- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +27 -0
@@ -1205,6 +1205,32 @@ static int uvd_v7_0_ring_test_ring(struct amdgpu_ring *ring)return r; } +/** +* uvd_v7_0_enc_ring_test_ring - test if UVD ENC ring is working +* +* @ring: the engine to test on +* +*/ +static int uvd_v7_0_ring_patch_cs (struct amdgpu_cs_parser *p,uint32_t ib_idx) +{ +struct amdgpu_ib *ib = &p->job->ibs[ib_idx]; +unsigned i; + +/* No patching necessary for the first instance */ +if (!p->ring->me) +return 0 ; + +for (i =0 ; i < ib->length_dw; i +=2 ) { +uint32_t reg =amdgpu_get_ib_value (p, ib_idx, i); + + reg -= p->adev->reg_offset[UVD_HWIP ][0 ][1 ]; + reg += p->adev->reg_offset[UVD_HWIP ][1 ][1 ]; + +amdgpu_set_ib_value (p, ib_idx, i, reg); + } +return 0 ; +} +/** * uvd_v7_0_ring_emit_ib - execute indirect buffer *
@@ -1697,6 +1723,7 @@ static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = { .get_rptr = uvd_v7_0_ring_get_rptr, .get_wptr = uvd_v7_0_ring_get_wptr, .set_wptr = uvd_v7_0_ring_set_wptr, + .patch_cs = uvd_v7_0_ring_patch_cs, .emit_frame_size =6 +/* hdp invalidate */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 +
Signature · 6 lines
2.14.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180725110527.36163-2-christian.koenig-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/2] drm/amdgpu: patch the IBs for the second UVD instance v2
Quoted 16 lines · Christian König
Patch the IBs for the second UVD instance so that userspace don't need to care about the instance they submit to.
v2: use direct IB patching
Signed-off-by Christian König <[email protected]>Reviewed-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c static int uvd_v7_0_ring_test_ring(struct amdgpu_ring *ring) · line 1214
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +7
-0@@ -1205,6 +1205,32 @@ static int uvd_v7_0_ring_test_ring(struct amdgpu_ring *ring)return r; } +/** +* uvd_v7_0_enc_ring_test_ring - test if UVD ENC ring is working +* +* @ring: the engine to test on +* +*/ +static int uvd_v7_0_ring_patch_cs (struct amdgpu_cs_parser *p,uint32_t ib_idx)
Should be patch_cs_in_place to match the change in patch1.
Alex
Quoted 33 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +20
-1+{ +struct amdgpu_ib *ib = &p->job->ibs[ib_idx]; +unsigned i; + +/* No patching necessary for the first instance */ +if (!p->ring->me) +return 0 ; + +for (i =0 ; i < ib->length_dw; i +=2 ) { +uint32_t reg =amdgpu_get_ib_value (p, ib_idx, i); + + reg -= p->adev->reg_offset[UVD_HWIP ][0 ][1 ]; + reg += p->adev->reg_offset[UVD_HWIP ][1 ][1 ]; + +amdgpu_set_ib_value (p, ib_idx, i, reg); + } +return 0 ; +} +/** * uvd_v7_0_ring_emit_ib - execute indirect buffer * @@ -1697,6 +1723,7 @@ static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = { .get_rptr = uvd_v7_0_ring_get_rptr, .get_wptr = uvd_v7_0_ring_get_wptr, .set_wptr = uvd_v7_0_ring_set_wptr, + .patch_cs = uvd_v7_0_ring_patch_cs, .emit_frame_size =6 +/* hdp invalidate */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 + --2.14.1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
James Zhu
Reviewed-byRe: [PATCH 2/2] drm/amdgpu: patch the IBs for the second UVD instance v2
In reply to a message not in the archiveQuoted 49 lines · Christian König
Patch the IBs for the second UVD instance so that userspace don't need to care about the instance they submit to.
v2: use direct IB patching
Signed-off-by Christian König <[email protected]>Reviewed-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +26
-0@@ -1205,6 +1205,32 @@ static int uvd_v7_0_ring_test_ring(struct amdgpu_ring *ring)return r; } +/** +* uvd_v7_0_enc_ring_test_ring - test if UVD ENC ring is working +* +* @ring: the engine to test on +* +*/ +static int uvd_v7_0_ring_patch_cs (struct amdgpu_cs_parser *p,uint32_t ib_idx) +{ +struct amdgpu_ib *ib = &p->job->ibs[ib_idx]; +unsigned i; + +/* No patching necessary for the first instance */ +if (!p->ring->me) +return 0 ; + +for (i =0 ; i < ib->length_dw; i +=2 ) { +uint32_t reg =amdgpu_get_ib_value (p, ib_idx, i); + + reg -= p->adev->reg_offset[UVD_HWIP ][0 ][1 ]; + reg += p->adev->reg_offset[UVD_HWIP ][1 ][1 ]; + +amdgpu_set_ib_value (p, ib_idx, i, reg); + } +return 0 ; +} +/** * uvd_v7_0_ring_emit_ib - execute indirect buffer *
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = { · line 1726
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +1
-0@@ -1697,6 +1723,7 @@ static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = { .get_rptr = uvd_v7_0_ring_get_rptr, .get_wptr = uvd_v7_0_ring_get_wptr, .set_wptr = uvd_v7_0_ring_set_wptr, + .patch_cs = uvd_v7_0_ring_patch_cs,
It should be .patch_cs_in_place. With this fix,
James
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = { · line 1729
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +0
-0.emit_frame_size =6 +/* hdp invalidate */ SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 +
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 5ad3109a-d096-33bf-2f4d-6ee8cfa292ec-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/2] drm/amdgpu: patch the IBs for the second UVD instance v2
Am 25.07.2018 um 21:43 schrieb James Zhu:
Quoted 50 lines · Christian König
Quoted 48 lines
Patch the IBs for the second UVD instance so that userspace don't need to care about the instance they submit to.
v2: use direct IB patching
Signed-off-by Christian König <[email protected]>Reviewed-by Alex Deucher <[email protected]>---
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c| 27 +++++++++++++++++++++++++++1 file changed, 27 insertions(+)drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +0
-0@@ -1205,6 +1205,32 @@ static int uvd_v7_0_ring_test_ring(struct amdgpu_ring *ring) return r; }+/**
+ *uvd_v7_0_enc_ring_test_ring- test if UVD ENC ring is working
+ *
+ * @ring: the engine to test on
+ *
+ */
+static intuvd_v7_0_ring_patch_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +19
-0+{ + struct amdgpu_ib *ib = &p->job->ibs[ib_idx]; + unsigned i; + + /* No patching necessary for the first instance */ + if (!p->ring->me) + return 0; + + for (i = 0; i < ib->length_dw; i += 2) { + uint32_t reg = amdgpu_get_ib_value(p, ib_idx, i); + + reg -= p->adev->reg_offset[UVD_HWIP][0][1]; + reg += p->adev->reg_offset[UVD_HWIP][1][1]; + + amdgpu_set_ib_value(p, ib_idx, i, reg); + } + return 0; +} +/**
*uvd_v7_0_ring_emit_ib- execute indirect buffer
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c static const struct amdgpu_ring_funcs · line 1727
Quoted 7 lines
*
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +1
-0@@ -1697,6 +1723,7 @@ static const struct amdgpu_ring_funcs uvd_v7_0_ring_vm_funcs = { .get_rptr = uvd_v7_0_ring_get_rptr, .get_wptr = uvd_v7_0_ring_get_wptr, .set_wptr = uvd_v7_0_ring_set_wptr, + .patch_cs = uvd_v7_0_ring_patch_cs,It should be .patch_cs_in_place. With this fix,
Yeah, sorry accidentally send out the original version without the rebase fixes.
Quoted 2 lines
Reviewed-by James Zhu <[email protected]>
Thanks,
Christian.
Quoted 11 lines
James
Quoted 3 lines
.emit_frame_size =
6 + /* hdp invalidate */
SOC15_FLUSH_GPU_TLB_NUM_WREG* 6 +_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Hi James,
can you give those two patches another try on a Vega20? At least in theory it should work now.
Thanks in advance,
Christian.
Am 25.07.2018 um 13:05 schrieb Christian König:
Quoted 68 lines
We are going to need that for the second UVD instance on Vega20.
v2: rename to
patch_cs_in_placeSigned-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 22 +++++++++++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 + 3 files changed, 17 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1751,6 +1751,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)#define amdgpu_vm_write_pte (adev, ib, pe, value, count, incr) ((adev)->vm_manager.vm_pte_funcs->write_pte((ib), (pe), (value), (count), (incr)))#define amdgpu_vm_set_pte_pde (adev, ib, pe, addr, count, incr, flags) ((adev)->vm_manager.vm_pte_funcs->set_pte_pde((ib), (pe), (addr), (count), (incr), (flags)))#define amdgpu_ring_parse_cs (r, p, ib) ((r)->funcs->parse_cs((p), (ib))) +#define amdgpu_ring_patch_cs_in_place (r, p, ib) ((r)->funcs->patch_cs_in_place((p), (ib)))#define amdgpu_ring_test_ring (r) (r)->funcs->test_ring((r))#define amdgpu_ring_test_ib (r, t) (r)->funcs->test_ib((r), (t))#define amdgpu_ring_get_rptr (r) (r)->funcs->get_rptr((r))drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +15
-7@@ -916,7 +916,7 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev,int r;/* Only for UVD/VCE VM emulation */ -if (p->ring->funcs->parse_cs) { +if (p->ring->funcs->parse_cs || p->ring->funcs->patch_cs_in_place) {unsigned i, j;for (i =0 , j =0 ; i < p->nchunks && j < p->job->num_ibs; i++) {@@ -957,12 +957,20 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev, offset = m->start *AMDGPU_GPU_PAGE_SIZE ; kptr += va_start - offset; -memcpy (ib->ptr, kptr, chunk_ib->ib_bytes); -amdgpu_bo_kunmap (aobj); - - r =amdgpu_ring_parse_cs (ring, p, j); -if (r) -return r; +if (p->ring->funcs->parse_cs) { +memcpy (ib->ptr, kptr, chunk_ib->ib_bytes); +amdgpu_bo_kunmap (aobj); + + r =amdgpu_ring_parse_cs (ring, p, j); +if (r) +return r; + }else { + ib->ptr = (uint32_t *)kptr; + r =amdgpu_ring_patch_cs_in_place (ring, p, j); +amdgpu_bo_kunmap (aobj); +if (r) +return r; + } j++; }drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h struct amdgpu_ring_funcs { · line 129
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1
-0@@ -123,6 +123,7 @@ struct amdgpu_ring_funcs {void (*set_wptr)(struct amdgpu_ring *ring);/* validating and patching of IBs */ int (*parse_cs)(struct amdgpu_cs_parser *p,uint32_t ib_idx); +int (*patch_cs_in_place)(struct amdgpu_cs_parser *p,uint32_t ib_idx);/* constants to calculate how many DW are needed for an emit */ unsigned emit_frame_size;unsigned emit_ib_size;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 148c5d69-462f-4c6f-5ccf-85e5e2be3933-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Hi Christian,
Sure, Let me find a time to try this afternoon.
Best Regards!
James Zhu
Quoted 76 lines · Christian König
Hi James,
can you give those two patches another try on a Vega20? At least in theory it should work now.
Thanks in advance,
Christian.Am 25.07.2018 um 13:05 schrieb Christian König:
Quoted 68 lines
We are going to need that for the second UVD instance on Vega20.
v2: rename to
patch_cs_in_placeSigned-off-by Christian König <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 22 +++++++++++++++-------drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h| 1 +3 files changed, 17 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1751,6 +1751,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring) #define amdgpu_vm_write_pte(adev, ib, pe, value, count, incr) ((adev)->vm_manager.vm_pte_funcs->write_pte((ib), (pe), (value), (count), (incr))) #define amdgpu_vm_set_pte_pde(adev, ib, pe, addr, count, incr, flags) ((adev)->vm_manager.vm_pte_funcs->set_pte_pde((ib), (pe), (addr), (count), (incr), (flags))) #define amdgpu_ring_parse_cs(r, p, ib) ((r)->funcs->parse_cs((p), (ib))) +#define amdgpu_ring_patch_cs_in_place (r, p, ib) ((r)->funcs->patch_cs_in_place((p), (ib))) #define amdgpu_ring_test_ring(r) (r)->funcs->test_ring((r)) #define amdgpu_ring_test_ib(r, t) (r)->funcs->test_ib((r), (t))#define
amdgpu_ring_get_rptr(r)(r)->funcs->get_rptr((r))drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +15
-6@@ -916,7 +916,7 @@ static int amdgpu_cs_ib_vm_chunk(structamdgpu_device *adev, int r; /* Only for UVD/VCE VM emulation */ - if (p->ring->funcs->parse_cs) { + if (p->ring->funcs->parse_cs || p->ring->funcs->patch_cs_in_place) { unsigned i, j; for (i = 0, j = 0; i < p->nchunks && j < p->job->num_ibs; i++) {@@ -957,12 +957,20 @@ static int amdgpu_cs_ib_vm_chunk(structamdgpu_device *adev, offset = m->start * AMDGPU_GPU_PAGE_SIZE; kptr += va_start - offset; - memcpy(ib->ptr, kptr, chunk_ib->ib_bytes); - amdgpu_bo_kunmap(aobj); - - r = amdgpu_ring_parse_cs(ring, p, j); - if (r) - return r; + if (p->ring->funcs->parse_cs) { + memcpy(ib->ptr, kptr, chunk_ib->ib_bytes); + amdgpu_bo_kunmap(aobj); + + r = amdgpu_ring_parse_cs(ring, p, j); + if (r) + return r; + } else { + ib->ptr = (uint32_t *)kptr; + r = amdgpu_ring_patch_cs_in_place(ring, p, j); + amdgpu_bo_kunmap(aobj); + if (r) + return r; + } j++; }drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0
-0@@ -123,6 +123,7 @@ struct amdgpu_ring_funcs {
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1
-0void (*set_wptr)(struct amdgpu_ring *ring); /* validating and patching of IBs */ int (*parse_cs)(struct amdgpu_cs_parser *p, uint32_t ib_idx); + int (*patch_cs_in_place)(struct amdgpu_cs_parser *p, uint32_t ib_idx); /* constants to calculate how many DW are needed for an emit */ unsigned emit_frame_size;unsigned
emit_ib_size;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Yes, it works great.
Quoted 68 lines · Christian König
We are going to need that for the second UVD instance on Vega20.
v2: rename to
patch_cs_in_placeSigned-off-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 22 +++++++++++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 1 + 3 files changed, 17 insertions(+), 7 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1751,6 +1751,7 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)#define amdgpu_vm_write_pte (adev, ib, pe, value, count, incr) ((adev)->vm_manager.vm_pte_funcs->write_pte((ib), (pe), (value), (count), (incr)))#define amdgpu_vm_set_pte_pde (adev, ib, pe, addr, count, incr, flags) ((adev)->vm_manager.vm_pte_funcs->set_pte_pde((ib), (pe), (addr), (count), (incr), (flags)))#define amdgpu_ring_parse_cs (r, p, ib) ((r)->funcs->parse_cs((p), (ib))) +#define amdgpu_ring_patch_cs_in_place (r, p, ib) ((r)->funcs->patch_cs_in_place((p), (ib)))#define amdgpu_ring_test_ring (r) (r)->funcs->test_ring((r))#define amdgpu_ring_test_ib (r, t) (r)->funcs->test_ib((r), (t))#define amdgpu_ring_get_rptr (r) (r)->funcs->get_rptr((r))drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +15
-7@@ -916,7 +916,7 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev,int r;/* Only for UVD/VCE VM emulation */ -if (p->ring->funcs->parse_cs) { +if (p->ring->funcs->parse_cs || p->ring->funcs->patch_cs_in_place) {unsigned i, j;for (i =0 , j =0 ; i < p->nchunks && j < p->job->num_ibs; i++) {@@ -957,12 +957,20 @@ static int amdgpu_cs_ib_vm_chunk(struct amdgpu_device *adev, offset = m->start *AMDGPU_GPU_PAGE_SIZE ; kptr += va_start - offset; -memcpy (ib->ptr, kptr, chunk_ib->ib_bytes); -amdgpu_bo_kunmap (aobj); - - r =amdgpu_ring_parse_cs (ring, p, j); -if (r) -return r; +if (p->ring->funcs->parse_cs) { +memcpy (ib->ptr, kptr, chunk_ib->ib_bytes); +amdgpu_bo_kunmap (aobj); + + r =amdgpu_ring_parse_cs (ring, p, j); +if (r) +return r; + }else { + ib->ptr = (uint32_t *)kptr; + r =amdgpu_ring_patch_cs_in_place (ring, p, j); +amdgpu_bo_kunmap (aobj); +if (r) +return r; + } j++; }drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h struct amdgpu_ring_funcs { · line 129
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +1
-0@@ -123,6 +123,7 @@ struct amdgpu_ring_funcs {void (*set_wptr)(struct amdgpu_ring *ring);/* validating and patching of IBs */ int (*parse_cs)(struct amdgpu_cs_parser *p,uint32_t ib_idx); +int (*patch_cs_in_place)(struct amdgpu_cs_parser *p,uint32_t ib_idx);/* constants to calculate how many DW are needed for an emit */ unsigned emit_frame_size;unsigned emit_ib_size;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx