Also flag shadows as dynamic since they're for CPU access as well.
#define NOUVEAU_TEXTURE_USAGE_LINEAR (1 << 16)
#define NOUVEAU_BUFFER_USAGE_TEXTURE (1 << 16)
-#define NOUVEAU_BUFFER_USAGE_ZETA (1 << 17)
+#define NOUVEAU_BUFFER_USAGE_CPU (1 << 17)
+#define NOUVEAU_BUFFER_USAGE_ZETA (1 << 18)
struct nouveau_winsys {
struct nouveau_context *nv;
{
struct pipe_winsys *ws = pscreen->winsys;
struct nv40_miptree *mt;
+ unsigned buf_usage = PIPE_BUFFER_USAGE_PIXEL |
+ NOUVEAU_BUFFER_USAGE_TEXTURE;
mt = MALLOC(sizeof(struct nv40_miptree));
if (!mt)
if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY |
PIPE_TEXTURE_USAGE_DISPLAY_TARGET))
mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
+ else
+ if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC)
+ mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
else {
switch (pt->format) {
/* TODO: Figure out which formats can be swizzled */
}
}
+ if (pt->tex_usage & PIPE_TEXTURE_USAGE_DYNAMIC)
+ buf_usage |= NOUVEAU_BUFFER_USAGE_CPU;
+
nv40_miptree_layout(mt);
- mt->buffer = ws->buffer_create(ws, 256,
- PIPE_BUFFER_USAGE_PIXEL |
- NOUVEAU_BUFFER_USAGE_TEXTURE,
- mt->total_size);
+ mt->buffer = ws->buffer_create(ws, 256, buf_usage, mt->total_size);
if (!mt->buffer) {
FREE(mt);
return NULL;
if (!mt->shadow_tex) {
unsigned old_tex_usage = surface->texture->tex_usage;
- surface->texture->tex_usage = NOUVEAU_TEXTURE_USAGE_LINEAR;
+ surface->texture->tex_usage = NOUVEAU_TEXTURE_USAGE_LINEAR |
+ PIPE_TEXTURE_USAGE_DYNAMIC;
mt->shadow_tex = screen->texture_create(screen, surface->texture);
surface->texture->tex_usage = old_tex_usage;
if (usage & PIPE_BUFFER_USAGE_PIXEL) {
if (usage & NOUVEAU_BUFFER_USAGE_TEXTURE)
flags |= NOUVEAU_BO_GART;
- flags |= NOUVEAU_BO_VRAM;
+ if (!(usage & NOUVEAU_BUFFER_USAGE_CPU))
+ flags |= NOUVEAU_BO_VRAM;
switch (dev->chipset & 0xf0) {
case 0x50:
if (usage & PIPE_BUFFER_USAGE_PIXEL) {
if (usage & NOUVEAU_BUFFER_USAGE_TEXTURE)
flags |= NOUVEAU_BO_GART;
- flags |= NOUVEAU_BO_VRAM;
+ if (!(usage & NOUVEAU_BUFFER_USAGE_CPU))
+ flags |= NOUVEAU_BO_VRAM;
}
if (usage & PIPE_BUFFER_USAGE_VERTEX) {