projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
panfrost: Hoist job != NULL check
[mesa.git]
/
src
/
gallium
/
drivers
/
nouveau
/
nouveau_mm.c
diff --git
a/src/gallium/drivers/nouveau/nouveau_mm.c
b/src/gallium/drivers/nouveau/nouveau_mm.c
index 8d0b7bfe99a86433040f496789648465113776ac..43b3d99f48a7e5a6de75de5f4460ecfd6953ef45 100644
(file)
--- a/
src/gallium/drivers/nouveau/nouveau_mm.c
+++ b/
src/gallium/drivers/nouveau/nouveau_mm.c
@@
-3,15
+3,21
@@
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
-#include "util/
u_double_
list.h"
+#include "util/list.h"
+#include "nouveau_winsys.h"
#include "nouveau_screen.h"
#include "nouveau_mm.h"
#include "nouveau_screen.h"
#include "nouveau_mm.h"
-#include "nouveau/nouveau_bo.h"
+/* TODO: Higher orders can waste a lot of space for npot size buffers, should
+ * add an extra cache for such buffer objects.
+ *
+ * HACK: Max order == 21 to accommodate TF2's 1.5 MiB, frequently reallocated
+ * vertex buffer (VM flush (?) decreases performance dramatically).
+ */
-#define MM_MIN_ORDER 7
-#define MM_MAX_ORDER 2
0
+#define MM_MIN_ORDER 7
/* >= 6 to not violate ARB_map_buffer_alignment */
+#define MM_MAX_ORDER 2
1
#define MM_NUM_BUCKETS (MM_MAX_ORDER - MM_MIN_ORDER + 1)
#define MM_NUM_BUCKETS (MM_MAX_ORDER - MM_MIN_ORDER + 1)
@@
-28,8
+34,8
@@
struct mm_bucket {
struct nouveau_mman {
struct nouveau_device *dev;
struct mm_bucket bucket[MM_NUM_BUCKETS];
struct nouveau_mman {
struct nouveau_device *dev;
struct mm_bucket bucket[MM_NUM_BUCKETS];
- uint32_t storage_type;
uint32_t domain;
uint32_t domain;
+ union nouveau_bo_config config;
uint64_t allocated;
};
uint64_t allocated;
};
@@
-64,7
+70,7
@@
mm_slab_alloc(struct mm_slab *slab)
return -1;
}
return -1;
}
-static
INLINE
void
+static
inline
void
mm_slab_free(struct mm_slab *slab, int i)
{
assert(i < slab->count);
mm_slab_free(struct mm_slab *slab, int i)
{
assert(i < slab->count);
@@
-73,7
+79,7
@@
mm_slab_free(struct mm_slab *slab, int i)
assert(slab->free <= slab->count);
}
assert(slab->free <= slab->count);
}
-static
INLINE
int
+static
inline
int
mm_get_order(uint32_t size)
{
int s = __builtin_clz(size) ^ 31;
mm_get_order(uint32_t size)
{
int s = __builtin_clz(size) ^ 31;
@@
-98,12
+104,12
@@
mm_bucket_by_size(struct nouveau_mman *cache, unsigned size)
}
/* size of bo allocation for slab with chunks of (1 << chunk_order) bytes */
}
/* size of bo allocation for slab with chunks of (1 << chunk_order) bytes */
-static
INLINE
uint32_t
+static
inline
uint32_t
mm_default_slab_size(unsigned chunk_order)
{
static const int8_t slab_order[MM_MAX_ORDER - MM_MIN_ORDER + 1] =
{
mm_default_slab_size(unsigned chunk_order)
{
static const int8_t slab_order[MM_MAX_ORDER - MM_MIN_ORDER + 1] =
{
- 12, 12, 13, 14, 14, 17, 17, 17, 17, 19, 19, 20, 21, 22
+ 12, 12, 13, 14, 14, 17, 17, 17, 17, 19, 19, 20, 21, 22
, 22
};
assert(chunk_order <= MM_MAX_ORDER && chunk_order >= MM_MIN_ORDER);
};
assert(chunk_order <= MM_MAX_ORDER && chunk_order >= MM_MIN_ORDER);
@@
-128,8
+134,9
@@
mm_slab_new(struct nouveau_mman *cache, int chunk_order)
memset(&slab->bits[0], ~0, words * 4);
slab->bo = NULL;
memset(&slab->bits[0], ~0, words * 4);
slab->bo = NULL;
- ret = nouveau_bo_new_tile(cache->dev, cache->domain, 0, size,
- 0, cache->storage_type, &slab->bo);
+
+ ret = nouveau_bo_new(cache->dev, cache->domain, 0, size, &cache->config,
+ &slab->bo);
if (ret) {
FREE(slab);
return PIPE_ERROR_OUT_OF_MEMORY;
if (ret) {
FREE(slab);
return PIPE_ERROR_OUT_OF_MEMORY;
@@
-155,7
+162,7
@@
mm_slab_new(struct nouveau_mman *cache, int chunk_order)
/* @return token to identify slab or NULL if we just allocated a new bo */
struct nouveau_mm_allocation *
nouveau_mm_allocate(struct nouveau_mman *cache,
/* @return token to identify slab or NULL if we just allocated a new bo */
struct nouveau_mm_allocation *
nouveau_mm_allocate(struct nouveau_mman *cache,
- uint32_t size, struct nouveau_bo **bo, uint32_t *offset)
+
uint32_t size, struct nouveau_bo **bo, uint32_t *offset)
{
struct mm_bucket *bucket;
struct mm_slab *slab;
{
struct mm_bucket *bucket;
struct mm_slab *slab;
@@
-164,10
+171,11
@@
nouveau_mm_allocate(struct nouveau_mman *cache,
bucket = mm_bucket_by_size(cache, size);
if (!bucket) {
bucket = mm_bucket_by_size(cache, size);
if (!bucket) {
- ret = nouveau_bo_new
_tile(cache->dev, cache->domain, 0, size
,
-
0, cache->storage_type,
bo);
+ ret = nouveau_bo_new
(cache->dev, cache->domain, 0, size, &cache->config
,
+ bo);
if (ret)
if (ret)
- debug_printf("bo_new(%x, %x): %i\n", size, cache->storage_type, ret);
+ debug_printf("bo_new(%x, %x): %i\n",
+ size, cache->config.nv50.memtype, ret);
*offset = 0;
return NULL;
*offset = 0;
return NULL;
@@
-233,7
+241,7
@@
nouveau_mm_free_work(void *data)
struct nouveau_mman *
nouveau_mm_create(struct nouveau_device *dev, uint32_t domain,
struct nouveau_mman *
nouveau_mm_create(struct nouveau_device *dev, uint32_t domain,
-
uint32_t storage_type
)
+
union nouveau_bo_config *config
)
{
struct nouveau_mman *cache = MALLOC_STRUCT(nouveau_mman);
int i;
{
struct nouveau_mman *cache = MALLOC_STRUCT(nouveau_mman);
int i;
@@
-243,7
+251,7
@@
nouveau_mm_create(struct nouveau_device *dev, uint32_t domain,
cache->dev = dev;
cache->domain = domain;
cache->dev = dev;
cache->domain = domain;
- cache->
storage_type = storage_type
;
+ cache->
config = *config
;
cache->allocated = 0;
for (i = 0; i < MM_NUM_BUCKETS; ++i) {
cache->allocated = 0;
for (i = 0; i < MM_NUM_BUCKETS; ++i) {
@@
-255,7
+263,7
@@
nouveau_mm_create(struct nouveau_device *dev, uint32_t domain,
return cache;
}
return cache;
}
-static
INLINE
void
+static
inline
void
nouveau_mm_free_slabs(struct list_head *head)
{
struct mm_slab *slab, *next;
nouveau_mm_free_slabs(struct list_head *head)
{
struct mm_slab *slab, *next;
@@
-288,4
+296,3
@@
nouveau_mm_destroy(struct nouveau_mman *cache)
FREE(cache);
}
FREE(cache);
}
-