summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/dri/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2008-04-04 12:39:45 +1000
committerBen Skeggs <skeggsb@gmail.com>2008-04-04 12:55:57 +1000
commitfbb6cc7842ec8a59b60018233275babc4deb6765 (patch)
tree99ca4056f59f2e8b4366dd47650edb0fb17e5979 /src/gallium/winsys/dri/nouveau
parent0b57662fa6feb3d4571e4a3bc3a2243547595816 (diff)
nouveau: in some cases don't create the buffer in local mem initially.
Diffstat (limited to 'src/gallium/winsys/dri/nouveau')
-rw-r--r--src/gallium/winsys/dri/nouveau/nouveau_context.c11
-rw-r--r--src/gallium/winsys/dri/nouveau/nouveau_context.h5
-rw-r--r--src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c2
-rw-r--r--src/gallium/winsys/dri/nouveau/nouveau_winsys_pipe.c22
4 files changed, 37 insertions, 3 deletions
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_context.c b/src/gallium/winsys/dri/nouveau/nouveau_context.c
index cf1d83b18f..aaeaebd271 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_context.c
+++ b/src/gallium/winsys/dri/nouveau/nouveau_context.c
@@ -7,6 +7,7 @@
#include "state_tracker/st_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
+#include "pipe/p_screen.h"
#include "nouveau_context.h"
#include "nouveau_dri.h"
@@ -133,7 +134,7 @@ nouveau_context_create(const __GLcontextModes *glVis,
/* G80 */
break;
default:
- NOUVEAU_ERR("Unsupported chipset: NV%02x\n", nv->chipset);
+ NOUVEAU_ERR("Unsupported chipset: NV%02x\n", (int)nv->chipset);
return GL_FALSE;
}
@@ -255,9 +256,17 @@ nouveau_context_create(const __GLcontextModes *glVis,
}
if (!getenv("NOUVEAU_FORCE_SOFTPIPE")) {
+ struct pipe_screen *pscreen;
+
pipe = nouveau_pipe_create(nv);
if (!pipe)
NOUVEAU_ERR("Couldn't create hw pipe\n");
+ pscreen = nvc->pscreen;
+
+ nv->cap.hw_vertex_buffer =
+ pscreen->get_param(pscreen, NOUVEAU_CAP_HW_VTXBUF);
+ nv->cap.hw_index_buffer =
+ pscreen->get_param(pscreen, NOUVEAU_CAP_HW_IDXBUF);
}
if (!pipe) {
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_context.h b/src/gallium/winsys/dri/nouveau/nouveau_context.h
index 92f551855a..acb58fab44 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_context.h
+++ b/src/gallium/winsys/dri/nouveau/nouveau_context.h
@@ -56,6 +56,11 @@ struct nouveau_context {
struct nouveau_screen *nv_screen;
struct pipe_surface *frontbuffer;
+ struct {
+ int hw_vertex_buffer;
+ int hw_index_buffer;
+ } cap;
+
/* Hardware context */
struct nouveau_channel_context *nvc;
int pctx_id;
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c b/src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c
index 2e3ac5492f..78919bdee8 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c
+++ b/src/gallium/winsys/dri/nouveau/nouveau_pushbuf.c
@@ -137,6 +137,8 @@ nouveau_pushbuf_flush(struct nouveau_channel *chan, unsigned min)
if (nvpb->base.remaining == nvpb->size)
return 0;
+ nouveau_fence_flush(chan);
+
nvpb->size -= nvpb->base.remaining;
nvchan->dma->cur += nvpb->size;
nvchan->dma->free -= nvpb->size;
diff --git a/src/gallium/winsys/dri/nouveau/nouveau_winsys_pipe.c b/src/gallium/winsys/dri/nouveau/nouveau_winsys_pipe.c
index b1bf9c521a..849e38d22b 100644
--- a/src/gallium/winsys/dri/nouveau/nouveau_winsys_pipe.c
+++ b/src/gallium/winsys/dri/nouveau/nouveau_winsys_pipe.c
@@ -79,9 +79,10 @@ nouveau_pipe_bo_create(struct pipe_winsys *pws, unsigned alignment,
unsigned usage, unsigned size)
{
struct nouveau_pipe_winsys *nvpws = (struct nouveau_pipe_winsys *)pws;
- struct nouveau_device *dev = nvpws->nv->nv_screen->device;
+ struct nouveau_context *nv = nvpws->nv;
+ struct nouveau_device *dev = nv->nv_screen->device;
struct nouveau_pipe_buffer *nvbuf;
- uint32_t flags = 0;
+ uint32_t flags;
nvbuf = calloc(1, sizeof(*nvbuf));
if (!nvbuf)
@@ -92,6 +93,23 @@ nouveau_pipe_bo_create(struct pipe_winsys *pws, unsigned alignment,
nvbuf->base.size = size;
flags = NOUVEAU_BO_LOCAL;
+
+ if (usage & PIPE_BUFFER_USAGE_PIXEL) {
+ if (usage & NOUVEAU_BUFFER_USAGE_TEXTURE)
+ flags |= NOUVEAU_BO_GART;
+ flags |= NOUVEAU_BO_VRAM;
+ }
+
+ if (usage & PIPE_BUFFER_USAGE_VERTEX) {
+ if (nv->cap.hw_vertex_buffer)
+ flags |= NOUVEAU_BO_GART;
+ }
+
+ if (usage & PIPE_BUFFER_USAGE_INDEX) {
+ if (nv->cap.hw_index_buffer)
+ flags |= NOUVEAU_BO_GART;
+ }
+
if (nouveau_bo_new(dev, flags, alignment, size, &nvbuf->bo)) {
free(nvbuf);
return NULL;