2013-07-20 18:35:31 -06:00
|
|
|
/* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Rob Clark <robclark@freedesktop.org>
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
* SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Rob Clark <robclark@freedesktop.org>
|
|
|
|
*/
|
|
|
|
|
2014-09-28 12:19:14 -06:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2013-07-20 18:35:31 -06:00
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include "freedreno_ringbuffer.h"
|
|
|
|
#include "msm_priv.h"
|
|
|
|
|
|
|
|
struct msm_ringbuffer {
|
|
|
|
struct fd_ringbuffer base;
|
|
|
|
struct fd_bo *ring_bo;
|
|
|
|
|
2015-07-21 10:11:36 -06:00
|
|
|
/* submit ioctl related tables: */
|
|
|
|
struct {
|
|
|
|
/* bo's table: */
|
|
|
|
struct drm_msm_gem_submit_bo *bos;
|
|
|
|
uint32_t nr_bos, max_bos;
|
|
|
|
|
|
|
|
/* cmd's table: */
|
|
|
|
struct drm_msm_gem_submit_cmd *cmds;
|
|
|
|
uint32_t nr_cmds, max_cmds;
|
|
|
|
|
|
|
|
/* reloc's table: */
|
|
|
|
struct drm_msm_gem_submit_reloc *relocs;
|
|
|
|
uint32_t nr_relocs, max_relocs;
|
|
|
|
} submit;
|
|
|
|
|
2015-07-21 09:57:00 -06:00
|
|
|
/* should have matching entries in submit.bos: */
|
|
|
|
struct fd_bo **bos;
|
|
|
|
uint32_t nr_bos, max_bos;
|
|
|
|
|
2015-07-21 10:11:36 -06:00
|
|
|
/* should have matching entries in submit.cmds: */
|
2013-12-21 10:11:40 -07:00
|
|
|
struct fd_ringbuffer **rings;
|
|
|
|
uint32_t nr_rings, max_rings;
|
2013-07-20 18:35:31 -06:00
|
|
|
};
|
|
|
|
|
2015-07-21 09:57:00 -06:00
|
|
|
static pthread_mutex_t idx_lock = PTHREAD_MUTEX_INITIALIZER;
|
|
|
|
|
2013-07-20 18:35:31 -06:00
|
|
|
static void *grow(void *ptr, uint32_t nr, uint32_t *max, uint32_t sz)
|
|
|
|
{
|
|
|
|
if ((nr + 1) > *max) {
|
|
|
|
if ((*max * 2) < (nr + 1))
|
|
|
|
*max = nr + 5;
|
|
|
|
else
|
|
|
|
*max = *max * 2;
|
|
|
|
ptr = realloc(ptr, *max * sz);
|
|
|
|
}
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define APPEND(x, name) ({ \
|
|
|
|
(x)->name = grow((x)->name, (x)->nr_ ## name, &(x)->max_ ## name, sizeof((x)->name[0])); \
|
|
|
|
(x)->nr_ ## name ++; \
|
|
|
|
})
|
|
|
|
|
|
|
|
static inline struct msm_ringbuffer * to_msm_ringbuffer(struct fd_ringbuffer *x)
|
|
|
|
{
|
|
|
|
return (struct msm_ringbuffer *)x;
|
|
|
|
}
|
|
|
|
|
2015-07-21 09:57:00 -06:00
|
|
|
static uint32_t append_bo(struct fd_ringbuffer *ring, struct fd_bo *bo)
|
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring);
|
|
|
|
uint32_t idx;
|
|
|
|
|
|
|
|
idx = APPEND(&msm_ring->submit, bos);
|
|
|
|
idx = APPEND(msm_ring, bos);
|
|
|
|
|
|
|
|
msm_ring->submit.bos[idx].flags = 0;
|
|
|
|
msm_ring->submit.bos[idx].handle = bo->handle;
|
|
|
|
msm_ring->submit.bos[idx].presumed = to_msm_bo(bo)->presumed;
|
|
|
|
|
|
|
|
msm_ring->bos[idx] = fd_bo_ref(bo);
|
|
|
|
|
|
|
|
return idx;
|
|
|
|
}
|
|
|
|
|
2013-07-20 18:35:31 -06:00
|
|
|
/* add (if needed) bo, return idx: */
|
|
|
|
static uint32_t bo2idx(struct fd_ringbuffer *ring, struct fd_bo *bo, uint32_t flags)
|
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring);
|
|
|
|
struct msm_bo *msm_bo = to_msm_bo(bo);
|
|
|
|
uint32_t idx;
|
2015-07-21 09:57:00 -06:00
|
|
|
pthread_mutex_lock(&idx_lock);
|
|
|
|
if (!msm_bo->current_ring) {
|
|
|
|
idx = append_bo(ring, bo);
|
|
|
|
msm_bo->current_ring = ring;
|
|
|
|
msm_bo->idx = idx;
|
|
|
|
} else if (msm_bo->current_ring == ring) {
|
|
|
|
idx = msm_bo->idx;
|
2013-07-20 18:35:31 -06:00
|
|
|
} else {
|
2015-07-21 09:57:00 -06:00
|
|
|
/* slow-path: */
|
|
|
|
for (idx = 0; idx < msm_ring->nr_bos; idx++)
|
|
|
|
if (msm_ring->bos[idx] == bo)
|
|
|
|
break;
|
|
|
|
if (idx == msm_ring->nr_bos) {
|
|
|
|
/* not found */
|
|
|
|
idx = append_bo(ring, bo);
|
|
|
|
}
|
2013-07-20 18:35:31 -06:00
|
|
|
}
|
2015-07-21 09:57:00 -06:00
|
|
|
pthread_mutex_unlock(&idx_lock);
|
2013-07-20 18:35:31 -06:00
|
|
|
if (flags & FD_RELOC_READ)
|
2015-07-21 10:11:36 -06:00
|
|
|
msm_ring->submit.bos[idx].flags |= MSM_SUBMIT_BO_READ;
|
2013-07-20 18:35:31 -06:00
|
|
|
if (flags & FD_RELOC_WRITE)
|
2015-07-21 10:11:36 -06:00
|
|
|
msm_ring->submit.bos[idx].flags |= MSM_SUBMIT_BO_WRITE;
|
2013-07-20 18:35:31 -06:00
|
|
|
return idx;
|
|
|
|
}
|
|
|
|
|
2013-12-21 10:11:40 -07:00
|
|
|
static int check_cmd_bo(struct fd_ringbuffer *ring,
|
|
|
|
struct drm_msm_gem_submit_cmd *cmd, struct fd_bo *bo)
|
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring);
|
2015-07-21 10:11:36 -06:00
|
|
|
return msm_ring->submit.bos[cmd->submit_idx].handle == bo->handle;
|
2013-12-21 10:11:40 -07:00
|
|
|
}
|
|
|
|
|
2013-07-20 18:35:31 -06:00
|
|
|
static uint32_t offset_bytes(void *end, void *start)
|
|
|
|
{
|
|
|
|
return ((char *)end) - ((char *)start);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct drm_msm_gem_submit_cmd * get_cmd(struct fd_ringbuffer *ring,
|
2013-12-21 10:11:40 -07:00
|
|
|
struct fd_ringbuffer *target_ring, struct fd_bo *target_bo,
|
|
|
|
uint32_t submit_offset, uint32_t size, uint32_t type)
|
2013-07-20 18:35:31 -06:00
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring);
|
|
|
|
struct drm_msm_gem_submit_cmd *cmd = NULL;
|
|
|
|
uint32_t i;
|
|
|
|
|
|
|
|
/* figure out if we already have a cmd buf: */
|
2015-07-21 10:11:36 -06:00
|
|
|
for (i = 0; i < msm_ring->submit.nr_cmds; i++) {
|
|
|
|
cmd = &msm_ring->submit.cmds[i];
|
2013-07-20 18:35:31 -06:00
|
|
|
if ((cmd->submit_offset == submit_offset) &&
|
|
|
|
(cmd->size == size) &&
|
2013-12-21 10:11:40 -07:00
|
|
|
(cmd->type == type) &&
|
|
|
|
check_cmd_bo(ring, cmd, target_bo))
|
2013-07-20 18:35:31 -06:00
|
|
|
break;
|
|
|
|
cmd = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create cmd buf if not: */
|
|
|
|
if (!cmd) {
|
2015-07-21 10:11:36 -06:00
|
|
|
uint32_t idx = APPEND(&msm_ring->submit, cmds);
|
2013-12-21 10:11:40 -07:00
|
|
|
APPEND(msm_ring, rings);
|
|
|
|
msm_ring->rings[idx] = target_ring;
|
2015-07-21 10:11:36 -06:00
|
|
|
cmd = &msm_ring->submit.cmds[idx];
|
2013-07-20 18:35:31 -06:00
|
|
|
cmd->type = type;
|
2013-12-21 10:11:40 -07:00
|
|
|
cmd->submit_idx = bo2idx(ring, target_bo, FD_RELOC_READ);
|
2013-07-20 18:35:31 -06:00
|
|
|
cmd->submit_offset = submit_offset;
|
|
|
|
cmd->size = size;
|
2014-03-19 08:11:13 -06:00
|
|
|
cmd->pad = 0;
|
2013-07-20 18:35:31 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return cmd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void * msm_ringbuffer_hostptr(struct fd_ringbuffer *ring)
|
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring);
|
|
|
|
return fd_bo_map(msm_ring->ring_bo);
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t find_next_reloc_idx(struct msm_ringbuffer *msm_ring,
|
|
|
|
uint32_t start, uint32_t offset)
|
|
|
|
{
|
|
|
|
uint32_t i;
|
|
|
|
|
|
|
|
/* a binary search would be more clever.. */
|
2015-07-21 10:11:36 -06:00
|
|
|
for (i = start; i < msm_ring->submit.nr_relocs; i++) {
|
|
|
|
struct drm_msm_gem_submit_reloc *reloc = &msm_ring->submit.relocs[i];
|
2013-07-20 18:35:31 -06:00
|
|
|
if (reloc->submit_offset >= offset)
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2014-02-19 09:01:23 -07:00
|
|
|
static void flush_reset(struct fd_ringbuffer *ring)
|
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring);
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
/* for each of the cmd buffers, clear their reloc's: */
|
2015-07-21 10:11:36 -06:00
|
|
|
for (i = 0; i < msm_ring->submit.nr_cmds; i++) {
|
2014-02-19 09:01:23 -07:00
|
|
|
struct msm_ringbuffer *target_ring = to_msm_ringbuffer(msm_ring->rings[i]);
|
2015-07-21 10:11:36 -06:00
|
|
|
target_ring->submit.nr_relocs = 0;
|
2014-02-19 09:01:23 -07:00
|
|
|
}
|
|
|
|
|
2015-07-21 10:11:36 -06:00
|
|
|
msm_ring->submit.nr_relocs = 0;
|
|
|
|
msm_ring->submit.nr_cmds = 0;
|
|
|
|
msm_ring->submit.nr_bos = 0;
|
2015-07-21 09:57:00 -06:00
|
|
|
msm_ring->nr_rings = 0;
|
|
|
|
msm_ring->nr_bos = 0;
|
2014-02-19 09:01:23 -07:00
|
|
|
}
|
|
|
|
|
2013-07-20 18:35:31 -06:00
|
|
|
static int msm_ringbuffer_flush(struct fd_ringbuffer *ring, uint32_t *last_start)
|
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring);
|
|
|
|
struct fd_bo *ring_bo = msm_ring->ring_bo;
|
|
|
|
struct drm_msm_gem_submit req = {
|
|
|
|
.pipe = to_msm_pipe(ring->pipe)->pipe,
|
|
|
|
};
|
|
|
|
uint32_t i, submit_offset, size;
|
2015-07-21 09:57:00 -06:00
|
|
|
int ret;
|
2013-07-20 18:35:31 -06:00
|
|
|
|
|
|
|
submit_offset = offset_bytes(last_start, ring->start);
|
|
|
|
size = offset_bytes(ring->cur, last_start);
|
|
|
|
|
2013-12-21 10:11:40 -07:00
|
|
|
get_cmd(ring, ring, ring_bo, submit_offset, size, MSM_SUBMIT_CMD_BUF);
|
2013-07-20 18:35:31 -06:00
|
|
|
|
|
|
|
/* needs to be after get_cmd() as that could create bos/cmds table: */
|
2015-07-21 10:11:36 -06:00
|
|
|
req.bos = VOID2U64(msm_ring->submit.bos),
|
|
|
|
req.nr_bos = msm_ring->submit.nr_bos;
|
|
|
|
req.cmds = VOID2U64(msm_ring->submit.cmds),
|
|
|
|
req.nr_cmds = msm_ring->submit.nr_cmds;
|
2013-07-20 18:35:31 -06:00
|
|
|
|
|
|
|
/* for each of the cmd's fix up their reloc's: */
|
2015-07-21 10:11:36 -06:00
|
|
|
for (i = 0; i < msm_ring->submit.nr_cmds; i++) {
|
|
|
|
struct drm_msm_gem_submit_cmd *cmd = &msm_ring->submit.cmds[i];
|
2013-12-21 10:11:40 -07:00
|
|
|
struct msm_ringbuffer *target_ring = to_msm_ringbuffer(msm_ring->rings[i]);
|
|
|
|
uint32_t a = find_next_reloc_idx(target_ring, 0, cmd->submit_offset);
|
|
|
|
uint32_t b = find_next_reloc_idx(target_ring, a, cmd->submit_offset + cmd->size);
|
2015-07-21 10:11:36 -06:00
|
|
|
cmd->relocs = VOID2U64(&target_ring->submit.relocs[a]);
|
2013-07-20 18:35:31 -06:00
|
|
|
cmd->nr_relocs = (b > a) ? b - a : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_MSG("nr_cmds=%u, nr_bos=%u\n", req.nr_cmds, req.nr_bos);
|
|
|
|
|
|
|
|
ret = drmCommandWriteRead(ring->pipe->dev->fd, DRM_MSM_GEM_SUBMIT,
|
|
|
|
&req, sizeof(req));
|
2014-02-19 09:01:23 -07:00
|
|
|
if (ret) {
|
2013-07-20 18:35:31 -06:00
|
|
|
ERROR_MSG("submit failed: %d (%s)", ret, strerror(errno));
|
2014-02-19 09:01:23 -07:00
|
|
|
} else {
|
|
|
|
/* update timestamp on all rings associated with submit: */
|
2015-07-21 10:11:36 -06:00
|
|
|
for (i = 0; i < msm_ring->submit.nr_cmds; i++) {
|
2014-02-19 09:01:23 -07:00
|
|
|
struct fd_ringbuffer *target_ring = msm_ring->rings[i];
|
|
|
|
if (!ret)
|
|
|
|
target_ring->last_timestamp = req.fence;
|
|
|
|
}
|
|
|
|
}
|
2013-07-20 18:35:31 -06:00
|
|
|
|
2015-07-21 09:57:00 -06:00
|
|
|
for (i = 0; i < msm_ring->nr_bos; i++) {
|
|
|
|
struct msm_bo *msm_bo = to_msm_bo(msm_ring->bos[i]);
|
|
|
|
msm_bo->current_ring = NULL;
|
2013-07-20 18:35:31 -06:00
|
|
|
fd_bo_del(&msm_bo->base);
|
|
|
|
}
|
|
|
|
|
2014-02-19 09:01:23 -07:00
|
|
|
flush_reset(ring);
|
2013-07-20 18:35:31 -06:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-02-19 09:01:23 -07:00
|
|
|
static void msm_ringbuffer_reset(struct fd_ringbuffer *ring)
|
|
|
|
{
|
|
|
|
flush_reset(ring);
|
|
|
|
}
|
|
|
|
|
2013-07-20 18:35:31 -06:00
|
|
|
static void msm_ringbuffer_emit_reloc(struct fd_ringbuffer *ring,
|
|
|
|
const struct fd_reloc *r)
|
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring);
|
2013-12-21 10:11:40 -07:00
|
|
|
struct fd_ringbuffer *parent = ring->parent ? ring->parent : ring;
|
2013-07-20 18:35:31 -06:00
|
|
|
struct msm_bo *msm_bo = to_msm_bo(r->bo);
|
|
|
|
struct drm_msm_gem_submit_reloc *reloc;
|
2015-07-21 10:11:36 -06:00
|
|
|
uint32_t idx = APPEND(&msm_ring->submit, relocs);
|
2013-07-20 18:35:31 -06:00
|
|
|
uint32_t addr;
|
|
|
|
|
2015-07-21 10:11:36 -06:00
|
|
|
reloc = &msm_ring->submit.relocs[idx];
|
2013-07-20 18:35:31 -06:00
|
|
|
|
2013-12-21 10:11:40 -07:00
|
|
|
reloc->reloc_idx = bo2idx(parent, r->bo, r->flags);
|
2013-07-20 18:35:31 -06:00
|
|
|
reloc->reloc_offset = r->offset;
|
|
|
|
reloc->or = r->or;
|
|
|
|
reloc->shift = r->shift;
|
|
|
|
reloc->submit_offset = offset_bytes(ring->cur, ring->start);
|
|
|
|
|
|
|
|
addr = msm_bo->presumed;
|
|
|
|
if (r->shift < 0)
|
|
|
|
addr >>= -r->shift;
|
|
|
|
else
|
|
|
|
addr <<= r->shift;
|
|
|
|
(*ring->cur++) = addr | r->or;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void msm_ringbuffer_emit_reloc_ring(struct fd_ringbuffer *ring,
|
|
|
|
struct fd_ringmarker *target, struct fd_ringmarker *end)
|
|
|
|
{
|
2013-12-21 10:11:40 -07:00
|
|
|
struct fd_bo *target_bo = to_msm_ringbuffer(target->ring)->ring_bo;
|
2013-07-20 18:35:31 -06:00
|
|
|
struct drm_msm_gem_submit_cmd *cmd;
|
|
|
|
uint32_t submit_offset, size;
|
|
|
|
|
|
|
|
submit_offset = offset_bytes(target->cur, target->ring->start);
|
|
|
|
size = offset_bytes(end->cur, target->cur);
|
|
|
|
|
2013-12-21 10:11:40 -07:00
|
|
|
cmd = get_cmd(ring, target->ring, target_bo, submit_offset, size,
|
2013-07-20 18:35:31 -06:00
|
|
|
MSM_SUBMIT_CMD_IB_TARGET_BUF);
|
|
|
|
assert(cmd);
|
|
|
|
|
|
|
|
msm_ringbuffer_emit_reloc(ring, &(struct fd_reloc){
|
2013-12-21 10:11:40 -07:00
|
|
|
.bo = target_bo,
|
2013-07-20 18:35:31 -06:00
|
|
|
.flags = FD_RELOC_READ,
|
|
|
|
.offset = submit_offset,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
static void msm_ringbuffer_destroy(struct fd_ringbuffer *ring)
|
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring = to_msm_ringbuffer(ring);
|
|
|
|
if (msm_ring->ring_bo)
|
|
|
|
fd_bo_del(msm_ring->ring_bo);
|
|
|
|
free(msm_ring);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct fd_ringbuffer_funcs funcs = {
|
|
|
|
.hostptr = msm_ringbuffer_hostptr,
|
|
|
|
.flush = msm_ringbuffer_flush,
|
2014-02-19 09:01:23 -07:00
|
|
|
.reset = msm_ringbuffer_reset,
|
2013-07-20 18:35:31 -06:00
|
|
|
.emit_reloc = msm_ringbuffer_emit_reloc,
|
|
|
|
.emit_reloc_ring = msm_ringbuffer_emit_reloc_ring,
|
|
|
|
.destroy = msm_ringbuffer_destroy,
|
|
|
|
};
|
|
|
|
|
2015-03-23 15:35:38 -06:00
|
|
|
drm_private struct fd_ringbuffer * msm_ringbuffer_new(struct fd_pipe *pipe,
|
2013-07-20 18:35:31 -06:00
|
|
|
uint32_t size)
|
|
|
|
{
|
|
|
|
struct msm_ringbuffer *msm_ring;
|
|
|
|
struct fd_ringbuffer *ring = NULL;
|
|
|
|
|
|
|
|
msm_ring = calloc(1, sizeof(*msm_ring));
|
|
|
|
if (!msm_ring) {
|
|
|
|
ERROR_MSG("allocation failed");
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
ring = &msm_ring->base;
|
|
|
|
ring->funcs = &funcs;
|
|
|
|
|
|
|
|
msm_ring->ring_bo = fd_bo_new(pipe->dev, size, 0);
|
|
|
|
if (!msm_ring->ring_bo) {
|
|
|
|
ERROR_MSG("ringbuffer allocation failed");
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ring;
|
|
|
|
fail:
|
|
|
|
if (ring)
|
|
|
|
fd_ringbuffer_del(ring);
|
|
|
|
return NULL;
|
|
|
|
}
|