nouveau: Let the user choose the push buffer size.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 28 Sep 2010 20:45:27 +0000 (22:45 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 12 Oct 2010 02:10:09 +0000 (04:10 +0200)
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Ben Skeggs <bskeggs@redhat.com>
nouveau/nouveau_channel.c
nouveau/nouveau_channel.h
nouveau/nouveau_private.h
nouveau/nouveau_pushbuf.c

index 40a0b34..ded5424 100644 (file)
@@ -28,7 +28,8 @@
 
 int
 nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma,
-                     uint32_t tt_ctxdma, struct nouveau_channel **chan)
+                     uint32_t tt_ctxdma, int pushbuf_size,
+                     struct nouveau_channel **chan)
 {
        struct nouveau_device_priv *nvdev = nouveau_device(dev);
        struct nouveau_channel_priv *nvchan;
@@ -90,7 +91,7 @@ nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma,
                return ret;
        }
 
-       ret = nouveau_pushbuf_init(&nvchan->base);
+       ret = nouveau_pushbuf_init(&nvchan->base, pushbuf_size);
        if (ret) {
                nouveau_channel_free((void *)&nvchan);
                return ret;
index ddcf8e4..d61a4c0 100644 (file)
@@ -49,7 +49,7 @@ struct nouveau_channel {
 
 int
 nouveau_channel_alloc(struct nouveau_device *, uint32_t fb, uint32_t tt,
-                     struct nouveau_channel **);
+                     int pushbuf_size, struct nouveau_channel **);
 
 void
 nouveau_channel_free(struct nouveau_channel **);
index 5a952f7..4c53534 100644 (file)
@@ -37,8 +37,8 @@
 #include "nouveau_pushbuf.h"
 #include "nouveau_reloc.h"
 
-#define CALPB_BUFFERS 4
-#define CALPB_BUFSZ   16384
+#define CALPB_BUFFERS 3
+
 struct nouveau_pushbuf_priv {
        uint32_t cal_suffix0;
        uint32_t cal_suffix1;
@@ -64,7 +64,7 @@ struct nouveau_pushbuf_priv {
 #define nouveau_pushbuf(n) ((struct nouveau_pushbuf_priv *)(n))
 
 int
-nouveau_pushbuf_init(struct nouveau_channel *);
+nouveau_pushbuf_init(struct nouveau_channel *, int buf_size);
 void
 nouveau_pushbuf_fini(struct nouveau_channel *);
 
index 28b8018..90836bc 100644 (file)
@@ -78,7 +78,7 @@ nouveau_pushbuf_fini_call(struct nouveau_channel *chan)
 }
 
 static int
-nouveau_pushbuf_init_call(struct nouveau_channel *chan)
+nouveau_pushbuf_init_call(struct nouveau_channel *chan, int buf_size)
 {
        struct drm_nouveau_gem_pushbuf req;
        struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
@@ -101,7 +101,7 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan)
 
        for (i = 0; i < CALPB_BUFFERS; i++) {
                ret = nouveau_bo_new(dev, flags | NOUVEAU_BO_MAP,
-                                    0, CALPB_BUFSZ, &nvpb->buffer[i]);
+                                    0, buf_size, &nvpb->buffer[i]);
                if (ret) {
                        nouveau_pushbuf_fini_call(chan);
                        return ret;
@@ -114,13 +114,13 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan)
 }
 
 int
-nouveau_pushbuf_init(struct nouveau_channel *chan)
+nouveau_pushbuf_init(struct nouveau_channel *chan, int buf_size)
 {
        struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
        struct nouveau_pushbuf_priv *nvpb = &nvchan->pb;
        int ret;
 
-       ret = nouveau_pushbuf_init_call(chan);
+       ret = nouveau_pushbuf_init_call(chan, buf_size);
        if (ret)
                return ret;