freedreno: rework internal ring->emit_reloc_ring()
No need for it to deal with ringmarkers. Signed-off-by: Rob Clark <robclark@freedesktop.org>main
parent
681fd2ab6d
commit
73db0a0421
|
@ -122,7 +122,8 @@ struct fd_ringbuffer_funcs {
|
|||
void (*emit_reloc)(struct fd_ringbuffer *ring,
|
||||
const struct fd_reloc *reloc);
|
||||
void (*emit_reloc_ring)(struct fd_ringbuffer *ring,
|
||||
struct fd_ringmarker *target, struct fd_ringmarker *end);
|
||||
struct fd_ringbuffer *target,
|
||||
uint32_t submit_offset, uint32_t size);
|
||||
void (*destroy)(struct fd_ringbuffer *ring);
|
||||
};
|
||||
|
||||
|
@ -168,4 +169,10 @@ struct fd_bo {
|
|||
#define U642VOID(x) ((void *)(unsigned long)(x))
|
||||
#define VOID2U64(x) ((uint64_t)(unsigned long)(x))
|
||||
|
||||
static inline uint32_t
|
||||
offset_bytes(void *end, void *start)
|
||||
{
|
||||
return ((char *)end) - ((char *)start);
|
||||
}
|
||||
|
||||
#endif /* FREEDRENO_PRIV_H_ */
|
||||
|
|
|
@ -102,8 +102,14 @@ fd_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
|
|||
struct fd_ringmarker *target,
|
||||
struct fd_ringmarker *end)
|
||||
{
|
||||
uint32_t submit_offset, size;
|
||||
|
||||
assert(target->ring == end->ring);
|
||||
ring->funcs->emit_reloc_ring(ring, target, end);
|
||||
|
||||
submit_offset = offset_bytes(target->cur, target->ring->start);
|
||||
size = offset_bytes(end->cur, target->cur);
|
||||
|
||||
ring->funcs->emit_reloc_ring(ring, target->ring, submit_offset, size);
|
||||
}
|
||||
|
||||
struct fd_ringmarker * fd_ringmarker_new(struct fd_ringbuffer *ring)
|
||||
|
|
|
@ -174,11 +174,11 @@ static void kgsl_ringbuffer_emit_reloc(struct fd_ringbuffer *ring,
|
|||
}
|
||||
|
||||
static void kgsl_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
|
||||
struct fd_ringmarker *target, struct fd_ringmarker *end)
|
||||
struct fd_ringbuffer *target,
|
||||
uint32_t submit_offset, uint32_t size)
|
||||
{
|
||||
struct kgsl_ringbuffer *target_ring = to_kgsl_ringbuffer(target->ring);
|
||||
(*ring->cur++) = target_ring->bo->gpuaddr +
|
||||
(uint8_t *)target->cur - (uint8_t *)target->ring->start;
|
||||
struct kgsl_ringbuffer *target_ring = to_kgsl_ringbuffer(target);
|
||||
(*ring->cur++) = target_ring->bo->gpuaddr + submit_offset;
|
||||
}
|
||||
|
||||
static void kgsl_ringbuffer_destroy(struct fd_ringbuffer *ring)
|
||||
|
|
|
@ -143,11 +143,6 @@ static int check_cmd_bo(struct fd_ringbuffer *ring,
|
|||
return msm_ring->submit.bos[cmd->submit_idx].handle == bo->handle;
|
||||
}
|
||||
|
||||
static uint32_t offset_bytes(void *end, void *start)
|
||||
{
|
||||
return ((char *)end) - ((char *)start);
|
||||
}
|
||||
|
||||
static struct drm_msm_gem_submit_cmd * get_cmd(struct fd_ringbuffer *ring,
|
||||
struct fd_ringbuffer *target_ring, struct fd_bo *target_bo,
|
||||
uint32_t submit_offset, uint32_t size, uint32_t type)
|
||||
|
@ -328,16 +323,13 @@ static void msm_ringbuffer_emit_reloc(struct fd_ringbuffer *ring,
|
|||
}
|
||||
|
||||
static void msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
|
||||
struct fd_ringmarker *target, struct fd_ringmarker *end)
|
||||
struct fd_ringbuffer *target,
|
||||
uint32_t submit_offset, uint32_t size)
|
||||
{
|
||||
struct fd_bo *target_bo = to_msm_ringbuffer(target->ring)->ring_bo;
|
||||
struct fd_bo *target_bo = to_msm_ringbuffer(target)->ring_bo;
|
||||
struct drm_msm_gem_submit_cmd *cmd;
|
||||
uint32_t submit_offset, size;
|
||||
|
||||
submit_offset = offset_bytes(target->cur, target->ring->start);
|
||||
size = offset_bytes(end->cur, target->cur);
|
||||
|
||||
cmd = get_cmd(ring, target->ring, target_bo, submit_offset, size,
|
||||
cmd = get_cmd(ring, target, target_bo, submit_offset, size,
|
||||
MSM_SUBMIT_CMD_IB_TARGET_BUF);
|
||||
assert(cmd);
|
||||
|
||||
|
|
Loading…
Reference in New Issue