From 0d6152913098d739be07f9085cdf44c9cc68d096 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Sat, 18 Jun 2016 09:08:53 -0400 Subject: [PATCH] freedreno/msm: drop return from get_cmd() Not actually needed. It just needs to ensure that there is a corresponding entry in the submit's cmds table. Signed-off-by: Rob Clark --- freedreno/msm/msm_ringbuffer.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/freedreno/msm/msm_ringbuffer.c b/freedreno/msm/msm_ringbuffer.c index 66ae146..4b46c20 100644 --- a/freedreno/msm/msm_ringbuffer.c +++ b/freedreno/msm/msm_ringbuffer.c @@ -176,12 +176,15 @@ static int check_cmd_bo(struct fd_ringbuffer *ring, return msm_ring->submit.bos[cmd->submit_idx].handle == bo->handle; } -static struct drm_msm_gem_submit_cmd * get_cmd(struct fd_ringbuffer *ring, +/* Ensure that submit has corresponding entry in cmds table for the + * target cmdstream buffer: + */ +static void 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) { struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring); - struct drm_msm_gem_submit_cmd *cmd = NULL; + struct drm_msm_gem_submit_cmd *cmd; uint32_t i; /* figure out if we already have a cmd buf: */ @@ -191,24 +194,19 @@ static struct drm_msm_gem_submit_cmd * get_cmd(struct fd_ringbuffer *ring, (cmd->size == size) && (cmd->type == type) && check_cmd_bo(ring, cmd, target_bo)) - break; - cmd = NULL; + return; } /* create cmd buf if not: */ - if (!cmd) { - uint32_t idx = APPEND(&msm_ring->submit, cmds); - APPEND(msm_ring, rings); - msm_ring->rings[idx] = target_ring; - cmd = &msm_ring->submit.cmds[idx]; - cmd->type = type; - cmd->submit_idx = bo2idx(ring, target_bo, FD_RELOC_READ); - cmd->submit_offset = submit_offset; - cmd->size = size; - cmd->pad = 0; - } - - return cmd; + i = APPEND(&msm_ring->submit, cmds); + APPEND(msm_ring, rings); + msm_ring->rings[i] = target_ring; + cmd = &msm_ring->submit.cmds[i]; + cmd->type = type; + cmd->submit_idx = bo2idx(ring, target_bo, FD_RELOC_READ); + cmd->submit_offset = submit_offset; + cmd->size = size; + cmd->pad = 0; } static void * msm_ringbuffer_hostptr(struct fd_ringbuffer *ring) @@ -360,11 +358,9 @@ static void msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring, uint32_t submit_offset, uint32_t size) { struct fd_bo *target_bo = to_msm_ringbuffer(target)->ring_bo; - struct drm_msm_gem_submit_cmd *cmd; - cmd = get_cmd(ring, target, target_bo, submit_offset, size, + get_cmd(ring, target, target_bo, submit_offset, size, MSM_SUBMIT_CMD_IB_TARGET_BUF); - assert(cmd); msm_ringbuffer_emit_reloc(ring, &(struct fd_reloc){ .bo = target_bo, -- 2.7.4