nouveau: allow pipe driver to define which buffers should start in sysmem
authorBen Skeggs <bskeggs@redhat.com>
Thu, 3 Mar 2011 05:56:20 +0000 (15:56 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Thu, 3 Mar 2011 05:56:20 +0000 (15:56 +1000)
PIPE_BIND_CONSTANT_BUFFER alone was OK for nv50/nvc0, but nv30 will need
to be able to set others on certain chipsets.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
src/gallium/drivers/nouveau/nouveau_buffer.c
src/gallium/drivers/nouveau/nouveau_screen.h
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nvc0/nvc0_screen.c

index 571fa0c608bdecb3722ab30699be414fe97dc58c..d0cc29104b84a880ff46a2949ee8e48a8dfa0b65 100644 (file)
@@ -340,7 +340,7 @@ nouveau_buffer_create(struct pipe_screen *pscreen,
    pipe_reference_init(&buffer->base.reference, 1);
    buffer->base.screen = pscreen;
 
-   if (buffer->base.bind & PIPE_BIND_CONSTANT_BUFFER)
+   if ((buffer->base.bind & screen->sysmem_bindings) == screen->sysmem_bindings)
       ret = nouveau_buffer_allocate(screen, buffer, 0);
    else
       ret = nouveau_buffer_allocate(screen, buffer, NOUVEAU_BO_GART);
index 580b4da6b4ec21f0b35388a8435ab15770e2e0a5..c091abf27860e5c7573910e858b66549b0c08277 100644 (file)
@@ -16,6 +16,7 @@ struct nouveau_screen {
         * these almost always should be set to the same value */
        unsigned vertex_buffer_flags;
        unsigned index_buffer_flags;
+       unsigned sysmem_bindings;
 
        struct {
                struct nouveau_fence *head;
index 2bc26e57500bcf2f6f08ac0ae136dadc232a8590..3f148436e81a8d4896223cfc03b84eced644ab34 100644 (file)
@@ -293,6 +293,8 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
       return NULL;
    pscreen = &screen->base.base;
 
+   screen->base.sysmem_bindings = PIPE_BIND_CONSTANT_BUFFER;
+
    ret = nouveau_screen_init(&screen->base, dev);
    if (ret)
       FAIL_SCREEN_INIT("nouveau_screen_init failed: %d\n", ret);
@@ -309,9 +311,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
 
    nv50_screen_init_resource_functions(pscreen);
 
-   screen->base.vertex_buffer_flags = screen->base.index_buffer_flags =
-      NOUVEAU_BO_GART;
-
    ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, 4096,
                         &screen->fence.bo);
    if (ret)
index b84a1bee8dae908ee650deb591c263e0c783d9c4..923bb83e8a3ba41aa79746348f2dd93b12d8c8b8 100644 (file)
@@ -358,6 +358,8 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
       return NULL;
    pscreen = &screen->base.base;
 
+   screen->base.sysmem_bindings = PIPE_BIND_CONSTANT_BUFFER;
+
    ret = nouveau_screen_init(&screen->base, dev);
    if (ret) {
       nvc0_screen_destroy(pscreen);
@@ -375,9 +377,6 @@ nvc0_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
 
    nvc0_screen_init_resource_functions(pscreen);
 
-   screen->base.vertex_buffer_flags = NOUVEAU_BO_GART;
-   screen->base.index_buffer_flags = 0;
-
    ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, 4096,
                         &screen->fence.bo);
    if (ret)