if (bo->current_stream == stream) {
idx = bo->idx;
} else {
- /* slow-path: */
- for (idx = 0; idx < priv->nr_bos; idx++)
- if (priv->bos[idx] == bo)
- break;
- if (idx == priv->nr_bos) {
- /* not found */
+ void *val;
+
+ if (!priv->bo_table)
+ priv->bo_table = drmHashCreate();
+
+ if (!drmHashLookup(priv->bo_table, bo->handle, &val)) {
+ /* found */
+ idx = (uint32_t)(uintptr_t)val;
+ } else {
idx = append_bo(stream, bo);
+ val = (void *)(uintptr_t)idx;
+ drmHashInsert(priv->bo_table, bo->handle, val);
}
+
bo->current_stream = stream;
bo->idx = idx;
}
etna_bo_del(bo);
}
+ if (priv->bo_table) {
+ drmHashDestroy(priv->bo_table);
+ priv->bo_table = NULL;
+ }
+
if (out_fence_fd)
*out_fence_fd = req.fence_fd;
}
reset_buffer(stream);
}
-void etna_cmd_stream_finish(struct etna_cmd_stream *stream)
-{
- struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
-
- flush(stream, -1, NULL);
- etna_pipe_wait(priv->pipe, priv->last_timestamp, 5000);
- reset_buffer(stream);
-}
-
void etna_cmd_stream_reloc(struct etna_cmd_stream *stream,
const struct etna_reloc *r)
{