static drmBONode * psbAddListItem(drmBOList * list, drmBO * item, uint64_t arg0, uint64_t arg1) { drmBONode *node; drmMMListHead *l; l = list->free.next; if (l == &list->free) { node = (drmBONode *) malloc(sizeof(*node)); if (!node) { return NULL; } list->numCurrent++; } else { DRMLISTDEL(l); node = DRMLISTENTRY(drmBONode, l, head); } memset(&node->bo_arg, 0, sizeof(node->bo_arg)); node->buf = item; node->arg0 = arg0; node->arg1 = arg1; DRMLISTADDTAIL(&node->head, &list->list); list->numOnList++; return node; }
struct nouveau_bufref * nouveau_bufctx_refn(struct nouveau_bufctx *bctx, int bin, struct nouveau_bo *bo, uint32_t flags) { struct nouveau_bufctx_priv *pctx = nouveau_bufctx(bctx); struct nouveau_bufbin_priv *pbin = &pctx->bins[bin]; struct nouveau_bufref_priv *pref = pctx->free; if (!pref) pref = malloc(sizeof(*pref)); else pctx->free = pref->next; if (pref) { pref->base.bo = bo; pref->base.flags = flags; pref->base.packet = 0; DRMLISTADDTAIL(&pref->base.thead, &bctx->pending); pref->bufctx = bctx; pref->next = pbin->list; pbin->list = pref; } return &pref->base; }