Commit eb0c19c5 authored by Christian König's avatar Christian König Committed by Dave Airlie

drm/radeon: also make the cs_parse function per ring

Not all rings use PM4, so the cs_parser also needs to be per ring.
Signed-off-by: default avatarChristian König <deathsimple@vodafone.de>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarJerome Glisse <jglisse@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 442f7cfa
...@@ -1147,13 +1147,13 @@ struct radeon_asic { ...@@ -1147,13 +1147,13 @@ struct radeon_asic {
void (*emit_fence)(struct radeon_device *rdev, struct radeon_fence *fence); void (*emit_fence)(struct radeon_device *rdev, struct radeon_fence *fence);
void (*emit_semaphore)(struct radeon_device *rdev, struct radeon_ring *cp, void (*emit_semaphore)(struct radeon_device *rdev, struct radeon_ring *cp,
struct radeon_semaphore *semaphore, bool emit_wait); struct radeon_semaphore *semaphore, bool emit_wait);
int (*cs_parse)(struct radeon_cs_parser *p);
} ring[RADEON_NUM_RINGS]; } ring[RADEON_NUM_RINGS];
int (*ring_test)(struct radeon_device *rdev, struct radeon_ring *cp); int (*ring_test)(struct radeon_device *rdev, struct radeon_ring *cp);
int (*irq_set)(struct radeon_device *rdev); int (*irq_set)(struct radeon_device *rdev);
int (*irq_process)(struct radeon_device *rdev); int (*irq_process)(struct radeon_device *rdev);
u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc); u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc);
int (*cs_parse)(struct radeon_cs_parser *p);
int (*copy_blit)(struct radeon_device *rdev, int (*copy_blit)(struct radeon_device *rdev,
uint64_t src_offset, uint64_t src_offset,
uint64_t dst_offset, uint64_t dst_offset,
...@@ -1662,7 +1662,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v); ...@@ -1662,7 +1662,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v);
#define radeon_fini(rdev) (rdev)->asic->fini((rdev)) #define radeon_fini(rdev) (rdev)->asic->fini((rdev))
#define radeon_resume(rdev) (rdev)->asic->resume((rdev)) #define radeon_resume(rdev) (rdev)->asic->resume((rdev))
#define radeon_suspend(rdev) (rdev)->asic->suspend((rdev)) #define radeon_suspend(rdev) (rdev)->asic->suspend((rdev))
#define radeon_cs_parse(p) rdev->asic->cs_parse((p)) #define radeon_cs_parse(rdev, r, p) (rdev)->asic->ring[(r)].cs_parse((p))
#define radeon_vga_set_state(rdev, state) (rdev)->asic->vga_set_state((rdev), (state)) #define radeon_vga_set_state(rdev, state) (rdev)->asic->vga_set_state((rdev), (state))
#define radeon_gpu_is_lockup(rdev, cp) (rdev)->asic->gpu_is_lockup((rdev), (cp)) #define radeon_gpu_is_lockup(rdev, cp) (rdev)->asic->gpu_is_lockup((rdev), (cp))
#define radeon_asic_reset(rdev) (rdev)->asic->asic_reset((rdev)) #define radeon_asic_reset(rdev) (rdev)->asic->asic_reset((rdev))
......
...@@ -145,12 +145,12 @@ static struct radeon_asic r100_asic = { ...@@ -145,12 +145,12 @@ static struct radeon_asic r100_asic = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r100_fence_ring_emit, .emit_fence = &r100_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r100_cs_parse,
} }
}, },
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.cs_parse = &r100_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = NULL, .copy_dma = NULL,
.copy = &r100_copy_blit, .copy = &r100_copy_blit,
...@@ -205,12 +205,12 @@ static struct radeon_asic r200_asic = { ...@@ -205,12 +205,12 @@ static struct radeon_asic r200_asic = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r100_fence_ring_emit, .emit_fence = &r100_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r100_cs_parse,
} }
}, },
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.cs_parse = &r100_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = &r200_copy_dma, .copy_dma = &r200_copy_dma,
.copy = &r100_copy_blit, .copy = &r100_copy_blit,
...@@ -264,12 +264,12 @@ static struct radeon_asic r300_asic = { ...@@ -264,12 +264,12 @@ static struct radeon_asic r300_asic = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r300_fence_ring_emit, .emit_fence = &r300_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r300_cs_parse,
} }
}, },
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.cs_parse = &r300_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = &r200_copy_dma, .copy_dma = &r200_copy_dma,
.copy = &r100_copy_blit, .copy = &r100_copy_blit,
...@@ -324,12 +324,12 @@ static struct radeon_asic r300_asic_pcie = { ...@@ -324,12 +324,12 @@ static struct radeon_asic r300_asic_pcie = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r300_fence_ring_emit, .emit_fence = &r300_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r300_cs_parse,
} }
}, },
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.cs_parse = &r300_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = &r200_copy_dma, .copy_dma = &r200_copy_dma,
.copy = &r100_copy_blit, .copy = &r100_copy_blit,
...@@ -383,12 +383,12 @@ static struct radeon_asic r420_asic = { ...@@ -383,12 +383,12 @@ static struct radeon_asic r420_asic = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r300_fence_ring_emit, .emit_fence = &r300_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r300_cs_parse,
} }
}, },
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.cs_parse = &r300_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = &r200_copy_dma, .copy_dma = &r200_copy_dma,
.copy = &r100_copy_blit, .copy = &r100_copy_blit,
...@@ -443,12 +443,12 @@ static struct radeon_asic rs400_asic = { ...@@ -443,12 +443,12 @@ static struct radeon_asic rs400_asic = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r300_fence_ring_emit, .emit_fence = &r300_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r300_cs_parse,
} }
}, },
.irq_set = &r100_irq_set, .irq_set = &r100_irq_set,
.irq_process = &r100_irq_process, .irq_process = &r100_irq_process,
.get_vblank_counter = &r100_get_vblank_counter, .get_vblank_counter = &r100_get_vblank_counter,
.cs_parse = &r300_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = &r200_copy_dma, .copy_dma = &r200_copy_dma,
.copy = &r100_copy_blit, .copy = &r100_copy_blit,
...@@ -503,12 +503,12 @@ static struct radeon_asic rs600_asic = { ...@@ -503,12 +503,12 @@ static struct radeon_asic rs600_asic = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r300_fence_ring_emit, .emit_fence = &r300_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r300_cs_parse,
} }
}, },
.irq_set = &rs600_irq_set, .irq_set = &rs600_irq_set,
.irq_process = &rs600_irq_process, .irq_process = &rs600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.cs_parse = &r300_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = &r200_copy_dma, .copy_dma = &r200_copy_dma,
.copy = &r100_copy_blit, .copy = &r100_copy_blit,
...@@ -563,12 +563,12 @@ static struct radeon_asic rs690_asic = { ...@@ -563,12 +563,12 @@ static struct radeon_asic rs690_asic = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r300_fence_ring_emit, .emit_fence = &r300_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r300_cs_parse,
} }
}, },
.irq_set = &rs600_irq_set, .irq_set = &rs600_irq_set,
.irq_process = &rs600_irq_process, .irq_process = &rs600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.cs_parse = &r300_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = &r200_copy_dma, .copy_dma = &r200_copy_dma,
.copy = &r200_copy_dma, .copy = &r200_copy_dma,
...@@ -623,12 +623,12 @@ static struct radeon_asic rv515_asic = { ...@@ -623,12 +623,12 @@ static struct radeon_asic rv515_asic = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r300_fence_ring_emit, .emit_fence = &r300_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r300_cs_parse,
} }
}, },
.irq_set = &rs600_irq_set, .irq_set = &rs600_irq_set,
.irq_process = &rs600_irq_process, .irq_process = &rs600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.cs_parse = &r300_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = &r200_copy_dma, .copy_dma = &r200_copy_dma,
.copy = &r100_copy_blit, .copy = &r100_copy_blit,
...@@ -683,12 +683,12 @@ static struct radeon_asic r520_asic = { ...@@ -683,12 +683,12 @@ static struct radeon_asic r520_asic = {
.ib_execute = &r100_ring_ib_execute, .ib_execute = &r100_ring_ib_execute,
.emit_fence = &r300_fence_ring_emit, .emit_fence = &r300_fence_ring_emit,
.emit_semaphore = &r100_semaphore_ring_emit, .emit_semaphore = &r100_semaphore_ring_emit,
.cs_parse = &r300_cs_parse,
} }
}, },
.irq_set = &rs600_irq_set, .irq_set = &rs600_irq_set,
.irq_process = &rs600_irq_process, .irq_process = &rs600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.cs_parse = &r300_cs_parse,
.copy_blit = &r100_copy_blit, .copy_blit = &r100_copy_blit,
.copy_dma = &r200_copy_dma, .copy_dma = &r200_copy_dma,
.copy = &r100_copy_blit, .copy = &r100_copy_blit,
...@@ -742,12 +742,12 @@ static struct radeon_asic r600_asic = { ...@@ -742,12 +742,12 @@ static struct radeon_asic r600_asic = {
.ib_execute = &r600_ring_ib_execute, .ib_execute = &r600_ring_ib_execute,
.emit_fence = &r600_fence_ring_emit, .emit_fence = &r600_fence_ring_emit,
.emit_semaphore = &r600_semaphore_ring_emit, .emit_semaphore = &r600_semaphore_ring_emit,
.cs_parse = &r600_cs_parse,
} }
}, },
.irq_set = &r600_irq_set, .irq_set = &r600_irq_set,
.irq_process = &r600_irq_process, .irq_process = &r600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.cs_parse = &r600_cs_parse,
.copy_blit = &r600_copy_blit, .copy_blit = &r600_copy_blit,
.copy_dma = NULL, .copy_dma = NULL,
.copy = &r600_copy_blit, .copy = &r600_copy_blit,
...@@ -801,12 +801,12 @@ static struct radeon_asic rs780_asic = { ...@@ -801,12 +801,12 @@ static struct radeon_asic rs780_asic = {
.ib_execute = &r600_ring_ib_execute, .ib_execute = &r600_ring_ib_execute,
.emit_fence = &r600_fence_ring_emit, .emit_fence = &r600_fence_ring_emit,
.emit_semaphore = &r600_semaphore_ring_emit, .emit_semaphore = &r600_semaphore_ring_emit,
.cs_parse = &r600_cs_parse,
} }
}, },
.irq_set = &r600_irq_set, .irq_set = &r600_irq_set,
.irq_process = &r600_irq_process, .irq_process = &r600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.cs_parse = &r600_cs_parse,
.copy_blit = &r600_copy_blit, .copy_blit = &r600_copy_blit,
.copy_dma = NULL, .copy_dma = NULL,
.copy = &r600_copy_blit, .copy = &r600_copy_blit,
...@@ -860,12 +860,12 @@ static struct radeon_asic rv770_asic = { ...@@ -860,12 +860,12 @@ static struct radeon_asic rv770_asic = {
.ib_execute = &r600_ring_ib_execute, .ib_execute = &r600_ring_ib_execute,
.emit_fence = &r600_fence_ring_emit, .emit_fence = &r600_fence_ring_emit,
.emit_semaphore = &r600_semaphore_ring_emit, .emit_semaphore = &r600_semaphore_ring_emit,
.cs_parse = &r600_cs_parse,
} }
}, },
.irq_set = &r600_irq_set, .irq_set = &r600_irq_set,
.irq_process = &r600_irq_process, .irq_process = &r600_irq_process,
.get_vblank_counter = &rs600_get_vblank_counter, .get_vblank_counter = &rs600_get_vblank_counter,
.cs_parse = &r600_cs_parse,
.copy_blit = &r600_copy_blit, .copy_blit = &r600_copy_blit,
.copy_dma = NULL, .copy_dma = NULL,
.copy = &r600_copy_blit, .copy = &r600_copy_blit,
...@@ -919,12 +919,12 @@ static struct radeon_asic evergreen_asic = { ...@@ -919,12 +919,12 @@ static struct radeon_asic evergreen_asic = {
.ib_execute = &evergreen_ring_ib_execute, .ib_execute = &evergreen_ring_ib_execute,
.emit_fence = &r600_fence_ring_emit, .emit_fence = &r600_fence_ring_emit,
.emit_semaphore = &r600_semaphore_ring_emit, .emit_semaphore = &r600_semaphore_ring_emit,
.cs_parse = &evergreen_cs_parse,
} }
}, },
.irq_set = &evergreen_irq_set, .irq_set = &evergreen_irq_set,
.irq_process = &evergreen_irq_process, .irq_process = &evergreen_irq_process,
.get_vblank_counter = &evergreen_get_vblank_counter, .get_vblank_counter = &evergreen_get_vblank_counter,
.cs_parse = &evergreen_cs_parse,
.copy_blit = &r600_copy_blit, .copy_blit = &r600_copy_blit,
.copy_dma = NULL, .copy_dma = NULL,
.copy = &r600_copy_blit, .copy = &r600_copy_blit,
...@@ -978,12 +978,12 @@ static struct radeon_asic sumo_asic = { ...@@ -978,12 +978,12 @@ static struct radeon_asic sumo_asic = {
.ib_execute = &evergreen_ring_ib_execute, .ib_execute = &evergreen_ring_ib_execute,
.emit_fence = &r600_fence_ring_emit, .emit_fence = &r600_fence_ring_emit,
.emit_semaphore = &r600_semaphore_ring_emit, .emit_semaphore = &r600_semaphore_ring_emit,
} .cs_parse = &evergreen_cs_parse,
},
}, },
.irq_set = &evergreen_irq_set, .irq_set = &evergreen_irq_set,
.irq_process = &evergreen_irq_process, .irq_process = &evergreen_irq_process,
.get_vblank_counter = &evergreen_get_vblank_counter, .get_vblank_counter = &evergreen_get_vblank_counter,
.cs_parse = &evergreen_cs_parse,
.copy_blit = &r600_copy_blit, .copy_blit = &r600_copy_blit,
.copy_dma = NULL, .copy_dma = NULL,
.copy = &r600_copy_blit, .copy = &r600_copy_blit,
...@@ -1037,12 +1037,12 @@ static struct radeon_asic btc_asic = { ...@@ -1037,12 +1037,12 @@ static struct radeon_asic btc_asic = {
.ib_execute = &evergreen_ring_ib_execute, .ib_execute = &evergreen_ring_ib_execute,
.emit_fence = &r600_fence_ring_emit, .emit_fence = &r600_fence_ring_emit,
.emit_semaphore = &r600_semaphore_ring_emit, .emit_semaphore = &r600_semaphore_ring_emit,
.cs_parse = &evergreen_cs_parse,
} }
}, },
.irq_set = &evergreen_irq_set, .irq_set = &evergreen_irq_set,
.irq_process = &evergreen_irq_process, .irq_process = &evergreen_irq_process,
.get_vblank_counter = &evergreen_get_vblank_counter, .get_vblank_counter = &evergreen_get_vblank_counter,
.cs_parse = &evergreen_cs_parse,
.copy_blit = &r600_copy_blit, .copy_blit = &r600_copy_blit,
.copy_dma = NULL, .copy_dma = NULL,
.copy = &r600_copy_blit, .copy = &r600_copy_blit,
...@@ -1107,24 +1107,26 @@ static struct radeon_asic cayman_asic = { ...@@ -1107,24 +1107,26 @@ static struct radeon_asic cayman_asic = {
.ib_parse = &evergreen_ib_parse, .ib_parse = &evergreen_ib_parse,
.emit_fence = &cayman_fence_ring_emit, .emit_fence = &cayman_fence_ring_emit,
.emit_semaphore = &r600_semaphore_ring_emit, .emit_semaphore = &r600_semaphore_ring_emit,
.cs_parse = &evergreen_cs_parse,
}, },
[CAYMAN_RING_TYPE_CP1_INDEX] = { [CAYMAN_RING_TYPE_CP1_INDEX] = {
.ib_execute = &cayman_ring_ib_execute, .ib_execute = &cayman_ring_ib_execute,
.ib_parse = &evergreen_ib_parse, .ib_parse = &evergreen_ib_parse,
.emit_fence = &cayman_fence_ring_emit, .emit_fence = &cayman_fence_ring_emit,
.emit_semaphore = &r600_semaphore_ring_emit, .emit_semaphore = &r600_semaphore_ring_emit,
.cs_parse = &evergreen_cs_parse,
}, },
[CAYMAN_RING_TYPE_CP2_INDEX] = { [CAYMAN_RING_TYPE_CP2_INDEX] = {
.ib_execute = &cayman_ring_ib_execute, .ib_execute = &cayman_ring_ib_execute,
.ib_parse = &evergreen_ib_parse, .ib_parse = &evergreen_ib_parse,
.emit_fence = &cayman_fence_ring_emit, .emit_fence = &cayman_fence_ring_emit,
.emit_semaphore = &r600_semaphore_ring_emit, .emit_semaphore = &r600_semaphore_ring_emit,
.cs_parse = &evergreen_cs_parse,
} }
}, },
.irq_set = &evergreen_irq_set, .irq_set = &evergreen_irq_set,
.irq_process = &evergreen_irq_process, .irq_process = &evergreen_irq_process,
.get_vblank_counter = &evergreen_get_vblank_counter, .get_vblank_counter = &evergreen_get_vblank_counter,
.cs_parse = &evergreen_cs_parse,
.copy_blit = &r600_copy_blit, .copy_blit = &r600_copy_blit,
.copy_dma = NULL, .copy_dma = NULL,
.copy = &r600_copy_blit, .copy = &r600_copy_blit,
......
...@@ -348,7 +348,7 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev, ...@@ -348,7 +348,7 @@ static int radeon_cs_ib_chunk(struct radeon_device *rdev,
return r; return r;
} }
parser->ib->length_dw = ib_chunk->length_dw; parser->ib->length_dw = ib_chunk->length_dw;
r = radeon_cs_parse(parser); r = radeon_cs_parse(rdev, parser->ring, parser);
if (r || parser->parser_error) { if (r || parser->parser_error) {
DRM_ERROR("Invalid command stream !\n"); DRM_ERROR("Invalid command stream !\n");
return r; return r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment