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 <robclark@freedesktop.org>main
parent
880871b378
commit
413a49a068
|
@ -318,21 +318,6 @@ static void * msm_ringbuffer_hostptr(struct fd_ringbuffer *ring)
|
||||||
return base + to_msm_ringbuffer(ring)->offset;
|
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)
|
static void delete_cmds(struct msm_ringbuffer *msm_ring)
|
||||||
{
|
{
|
||||||
struct msm_cmd *cmd, *tmp;
|
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++) {
|
for (i = 0; i < msm_ring->submit.nr_cmds; i++) {
|
||||||
struct drm_msm_gem_submit_cmd *cmd = &msm_ring->submit.cmds[i];
|
struct drm_msm_gem_submit_cmd *cmd = &msm_ring->submit.cmds[i];
|
||||||
struct msm_cmd *msm_cmd = msm_ring->cmds[i];
|
struct msm_cmd *msm_cmd = msm_ring->cmds[i];
|
||||||
uint32_t a = find_next_reloc_idx(msm_cmd, 0, cmd->submit_offset);
|
struct drm_msm_gem_submit_reloc *relocs = msm_cmd->relocs;
|
||||||
uint32_t b = find_next_reloc_idx(msm_cmd, a, cmd->submit_offset + cmd->size);
|
unsigned nr_relocs = msm_cmd->nr_relocs;
|
||||||
struct drm_msm_gem_submit_reloc *relocs = &msm_cmd->relocs[a];
|
|
||||||
unsigned nr_relocs = (b > a) ? b - a : 0;
|
|
||||||
|
|
||||||
/* for reusable stateobjs, the reloc table has reloc_idx that
|
/* for reusable stateobjs, the reloc table has reloc_idx that
|
||||||
* points into it's own private bos table, rather than the global
|
* points into it's own private bos table, rather than the global
|
||||||
|
|
Loading…
Reference in New Issue