freedreno/msm: simplify emit_reloc_ring() vfunc
Now that it doesn't have to deal with the ringmarker case, we can make some simplifications. Signed-off-by: Rob Clark <robclark@freedesktop.org>main
parent
96b625240c
commit
5c4722e907
|
@ -140,8 +140,7 @@ struct fd_ringbuffer_funcs {
|
||||||
void (*emit_reloc)(struct fd_ringbuffer *ring,
|
void (*emit_reloc)(struct fd_ringbuffer *ring,
|
||||||
const struct fd_reloc *reloc);
|
const struct fd_reloc *reloc);
|
||||||
uint32_t (*emit_reloc_ring)(struct fd_ringbuffer *ring,
|
uint32_t (*emit_reloc_ring)(struct fd_ringbuffer *ring,
|
||||||
struct fd_ringbuffer *target, uint32_t cmd_idx,
|
struct fd_ringbuffer *target, uint32_t cmd_idx);
|
||||||
uint32_t submit_offset, uint32_t size);
|
|
||||||
uint32_t (*cmd_count)(struct fd_ringbuffer *ring);
|
uint32_t (*cmd_count)(struct fd_ringbuffer *ring);
|
||||||
void (*destroy)(struct fd_ringbuffer *ring);
|
void (*destroy)(struct fd_ringbuffer *ring);
|
||||||
};
|
};
|
||||||
|
|
|
@ -166,8 +166,7 @@ drm_public uint32_t
|
||||||
fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring,
|
fd_ringbuffer_emit_reloc_ring_full(struct fd_ringbuffer *ring,
|
||||||
struct fd_ringbuffer *target, uint32_t cmd_idx)
|
struct fd_ringbuffer *target, uint32_t cmd_idx)
|
||||||
{
|
{
|
||||||
uint32_t size = offset_bytes(target->cur, target->start);
|
return ring->funcs->emit_reloc_ring(ring, target, cmd_idx);
|
||||||
return ring->funcs->emit_reloc_ring(ring, target, cmd_idx, 0, size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drm_public uint32_t
|
drm_public uint32_t
|
||||||
|
|
|
@ -174,13 +174,12 @@ static void kgsl_ringbuffer_emit_reloc(struct fd_ringbuffer *ring,
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t kgsl_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
|
static uint32_t kgsl_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
|
||||||
struct fd_ringbuffer *target, uint32_t cmd_idx,
|
struct fd_ringbuffer *target, uint32_t cmd_idx)
|
||||||
uint32_t submit_offset, uint32_t size)
|
|
||||||
{
|
{
|
||||||
struct kgsl_ringbuffer *target_ring = to_kgsl_ringbuffer(target);
|
struct kgsl_ringbuffer *target_ring = to_kgsl_ringbuffer(target);
|
||||||
assert(cmd_idx == 0);
|
assert(cmd_idx == 0);
|
||||||
(*ring->cur++) = target_ring->bo->gpuaddr + submit_offset;
|
(*ring->cur++) = target_ring->bo->gpuaddr;
|
||||||
return size;
|
return offset_bytes(target->cur, target->start);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void kgsl_ringbuffer_destroy(struct fd_ringbuffer *ring)
|
static void kgsl_ringbuffer_destroy(struct fd_ringbuffer *ring)
|
||||||
|
|
|
@ -566,15 +566,14 @@ static void msm_ringbuffer_emit_reloc(struct fd_ringbuffer *ring,
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32_t msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
|
static uint32_t msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
|
||||||
struct fd_ringbuffer *target, uint32_t cmd_idx,
|
struct fd_ringbuffer *target, uint32_t cmd_idx)
|
||||||
uint32_t submit_offset, uint32_t size)
|
|
||||||
{
|
{
|
||||||
struct msm_cmd *cmd = NULL;
|
struct msm_cmd *cmd = NULL;
|
||||||
struct msm_ringbuffer *msm_target = to_msm_ringbuffer(target);
|
struct msm_ringbuffer *msm_target = to_msm_ringbuffer(target);
|
||||||
uint32_t idx = 0;
|
uint32_t idx = 0;
|
||||||
int added_cmd = FALSE;
|
int added_cmd = FALSE;
|
||||||
|
uint32_t size;
|
||||||
submit_offset += msm_target->offset;
|
uint32_t submit_offset = msm_target->offset;
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(cmd, &msm_target->cmd_list, list) {
|
LIST_FOR_EACH_ENTRY(cmd, &msm_target->cmd_list, list) {
|
||||||
if (idx == cmd_idx)
|
if (idx == cmd_idx)
|
||||||
|
@ -593,6 +592,7 @@ static uint32_t msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
|
||||||
size = cmd->size;
|
size = cmd->size;
|
||||||
} else {
|
} else {
|
||||||
struct fd_ringbuffer *parent = ring->parent ? ring->parent : ring;
|
struct fd_ringbuffer *parent = ring->parent ? ring->parent : ring;
|
||||||
|
size = offset_bytes(target->cur, target->start);
|
||||||
added_cmd = get_cmd(parent, cmd, submit_offset, size,
|
added_cmd = get_cmd(parent, cmd, submit_offset, size,
|
||||||
MSM_SUBMIT_CMD_IB_TARGET_BUF);
|
MSM_SUBMIT_CMD_IB_TARGET_BUF);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue