1/* 2 * Copyright (c) Red Hat Inc. 3 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sub license, 8 * and/or sell copies of the Software, and to permit persons to whom the --- 25 unchanged lines hidden (view full) --- 34 35/* simple list based uncached page pool 36 * - Pool collects resently freed pages for reuse 37 * - Use page->lru to keep a free list 38 * - doesn't track currently in use pages 39 */ 40 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: stable/10/sys/dev/drm2/ttm/ttm_page_alloc.c 275408 2014-12-02 14:09:54Z tijl $"); |
43 44#include <dev/drm2/drmP.h> 45#include <dev/drm2/ttm/ttm_bo_driver.h> 46#include <dev/drm2/ttm/ttm_page_alloc.h> 47 |
48#define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(vm_page_t)) 49#define SMALL_ALLOCATION 16 50#define FREE_ALL_PAGES (~0U) 51/* times are in msecs */ 52#define PAGE_FREE_INTERVAL 1000 53 54/** 55 * struct ttm_page_pool - Pool to reuse recently allocated uc/wc pages. --- 155 unchanged lines hidden (view full) --- 211 return snprintf(buffer, PAGE_SIZE, "%u\n", val); 212} 213#endif 214 215static struct ttm_pool_manager *_manager; 216 217static int set_pages_array_wb(vm_page_t *pages, int addrinarray) 218{ |
219#ifdef TTM_HAS_AGP |
220 int i; 221 |
222 for (i = 0; i < addrinarray; i++) 223 pmap_page_set_memattr(pages[i], VM_MEMATTR_WRITE_BACK); |
224#endif |
225 return 0; 226} 227 228static int set_pages_array_wc(vm_page_t *pages, int addrinarray) 229{ |
230#ifdef TTM_HAS_AGP |
231 int i; 232 |
233 for (i = 0; i < addrinarray; i++) 234 pmap_page_set_memattr(pages[i], VM_MEMATTR_WRITE_COMBINING); |
235#endif |
236 return 0; 237} 238 239static int set_pages_array_uc(vm_page_t *pages, int addrinarray) 240{ |
241#ifdef TTM_HAS_AGP |
242 int i; 243 |
244 for (i = 0; i < addrinarray; i++) 245 pmap_page_set_memattr(pages[i], VM_MEMATTR_UNCACHEABLE); |
246#endif |
247 return 0; 248} 249 250/** 251 * Select the right pool or requested caching state and ttm flags. */ 252static struct ttm_page_pool *ttm_get_pool(int flags, 253 enum ttm_caching_state cstate) 254{ --- 631 unchanged lines hidden --- |