From 413a49a0688441e36beff361b7ad100a7f80e051 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 11 Oct 2018 09:43:58 -0400 Subject: [PATCH] freedreno/msm: simplify msm_ringbuffer_flush() Now that it doesn't have to deal with ringmarkers we can simplify the reloc handling. Signed-off-by: Rob Clark --- freedreno/msm/msm_ringbuffer.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c index 5cd97709..44a329a7 100644 --- a/freedreno/msm/msm_ringbuffer.c +++ b/freedreno/msm/msm_ringbuffer.c @@ -318,21 +318,6 @@ static void * msm_ringbuffer_hostptr(struct fd_ringbuffer *ring) return base + to_msm_ringbuffer(ring)->offset; } -static uint32_t find_next_reloc_idx(struct msm_cmd *msm_cmd, - uint32_t start, uint32_t offset) -{ - uint32_t i; - - /* a binary search would be more clever.. */ - for (i = start; i < msm_cmd->nr_relocs; i++) { - struct drm_msm_gem_submit_reloc *reloc = &msm_cmd->relocs[i]; - if (reloc->submit_offset >= offset) - return i; - } - - return i; -} - static void delete_cmds(struct msm_ringbuffer *msm_ring) { struct msm_cmd *cmd, *tmp; @@ -473,10 +458,8 @@ static int msm_ringbuffer_flush(struct fd_ringbuffer *ring, uint32_t *last_start for (i = 0; i < msm_ring->submit.nr_cmds; i++) { struct drm_msm_gem_submit_cmd *cmd = &msm_ring->submit.cmds[i]; struct msm_cmd *msm_cmd = msm_ring->cmds[i]; - uint32_t a = find_next_reloc_idx(msm_cmd, 0, cmd->submit_offset); - uint32_t b = find_next_reloc_idx(msm_cmd, a, cmd->submit_offset + cmd->size); - struct drm_msm_gem_submit_reloc *relocs = &msm_cmd->relocs[a]; - unsigned nr_relocs = (b > a) ? b - a : 0; + struct drm_msm_gem_submit_reloc *relocs = msm_cmd->relocs; + unsigned nr_relocs = msm_cmd->nr_relocs; /* for reusable stateobjs, the reloc table has reloc_idx that * points into it's own private bos table, rather than the global