static void glamor_pixmap_fbo_cache_put(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo) { struct xorg_list *cache; int n_format; #ifdef NO_FBO_CACHE glamor_purge_fbo(fbo); return; #else n_format = cache_format(fbo->format); if (fbo->fb == 0 || fbo->external || n_format == -1 || glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) { glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX; glamor_fbo_expire(glamor_priv); glamor_purge_fbo(glamor_priv, fbo); return; } cache = &glamor_priv->fbo_cache[n_format] [cache_wbucket(fbo->width)] [cache_hbucket(fbo->height)]; DEBUGF ("Put cache entry %p to cache %p w %d h %d format %x fbo %d tex %d \n", fbo, cache, fbo->width, fbo->height, fbo->format, fbo->fb, fbo->tex); glamor_priv->fbo_cache_watermark += fbo->width * fbo->height; xorg_list_add(&fbo->list, cache); fbo->expire = glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX; #endif }
/** @brief Allocate and add a sequence of bytes at the end of a fragment list. Call DestroyFragments to release the list. @param frags A pointer to head of an initialized linked list @param bytes Number of bytes to allocate @return Returns a pointer to the allocated non-zeroed region that is to be filled by the caller. On error (out of memory) returns NULL and makes no changes to the list. */ static void * AddFragment(struct xorg_list *frags, int bytes) { FragmentList *f = malloc(sizeof(FragmentList) + bytes); if (!f) { return NULL; } else { f->bytes = bytes; xorg_list_add(&f->l, frags->prev); return (char*) f + sizeof(*f); } }
void armsoc_bo_unreference(struct armsoc_bo *bo) { if (!bo) return; assert(bo->refcnt > 0); if (--bo->refcnt > 0) return; if (bo->pDraw) HASH_DEL(hash, bo); xorg_list_add(&bo->entry, &pending_deletions); }
static Bool add_reslist(RESTYPE type, XID id, struct xorg_list *node) { struct xorg_list *list; void *ptr = NULL; dixLookupResourceByType(&ptr, id, type, NULL, DixWriteAccess); list = ptr; if (!list) { list = malloc(sizeof *list); if (!list) return FALSE; if (!AddResource(id, type, list)) { free(list); return FALSE; } xorg_list_init(list); } xorg_list_add(node, list); return TRUE; }