aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancisco Jerez2010-09-28 15:45:27 -0500
committerFrancisco Jerez2010-10-11 21:10:09 -0500
commit09b1062628f2cbddb3ebae20e7b3b8a0a93acebf (patch)
treefba939828713bc549be66aa2fb97feff65468a49 /nouveau
parent1b9187c43a0c17600611edb9e299141748e87974 (diff)
downloadlibdrm-09b1062628f2cbddb3ebae20e7b3b8a0a93acebf.tar.gz
libdrm-09b1062628f2cbddb3ebae20e7b3b8a0a93acebf.tar.xz
libdrm-09b1062628f2cbddb3ebae20e7b3b8a0a93acebf.zip
nouveau: Let the user choose the push buffer size.
Signed-off-by: Francisco Jerez <currojerez@riseup.net> Acked-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'nouveau')
-rw-r--r--nouveau/nouveau_channel.c5
-rw-r--r--nouveau/nouveau_channel.h2
-rw-r--r--nouveau/nouveau_private.h6
-rw-r--r--nouveau/nouveau_pushbuf.c8
4 files changed, 11 insertions, 10 deletions
diff --git a/nouveau/nouveau_channel.c b/nouveau/nouveau_channel.c
index 40a0b344..ded54241 100644
--- a/nouveau/nouveau_channel.c
+++ b/nouveau/nouveau_channel.c
@@ -28,7 +28,8 @@
28 28
29int 29int
30nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma, 30nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma,
31 uint32_t tt_ctxdma, struct nouveau_channel **chan) 31 uint32_t tt_ctxdma, int pushbuf_size,
32 struct nouveau_channel **chan)
32{ 33{
33 struct nouveau_device_priv *nvdev = nouveau_device(dev); 34 struct nouveau_device_priv *nvdev = nouveau_device(dev);
34 struct nouveau_channel_priv *nvchan; 35 struct nouveau_channel_priv *nvchan;
@@ -90,7 +91,7 @@ nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma,
90 return ret; 91 return ret;
91 } 92 }
92 93
93 ret = nouveau_pushbuf_init(&nvchan->base); 94 ret = nouveau_pushbuf_init(&nvchan->base, pushbuf_size);
94 if (ret) { 95 if (ret) {
95 nouveau_channel_free((void *)&nvchan); 96 nouveau_channel_free((void *)&nvchan);
96 return ret; 97 return ret;
diff --git a/nouveau/nouveau_channel.h b/nouveau/nouveau_channel.h
index ddcf8e49..d61a4c0d 100644
--- a/nouveau/nouveau_channel.h
+++ b/nouveau/nouveau_channel.h
@@ -49,7 +49,7 @@ struct nouveau_channel {
49 49
50int 50int
51nouveau_channel_alloc(struct nouveau_device *, uint32_t fb, uint32_t tt, 51nouveau_channel_alloc(struct nouveau_device *, uint32_t fb, uint32_t tt,
52 struct nouveau_channel **); 52 int pushbuf_size, struct nouveau_channel **);
53 53
54void 54void
55nouveau_channel_free(struct nouveau_channel **); 55nouveau_channel_free(struct nouveau_channel **);
diff --git a/nouveau/nouveau_private.h b/nouveau/nouveau_private.h
index 5a952f73..4c535345 100644
--- a/nouveau/nouveau_private.h
+++ b/nouveau/nouveau_private.h
@@ -37,8 +37,8 @@
37#include "nouveau_pushbuf.h" 37#include "nouveau_pushbuf.h"
38#include "nouveau_reloc.h" 38#include "nouveau_reloc.h"
39 39
40#define CALPB_BUFFERS 4 40#define CALPB_BUFFERS 3
41#define CALPB_BUFSZ 16384 41
42struct nouveau_pushbuf_priv { 42struct nouveau_pushbuf_priv {
43 uint32_t cal_suffix0; 43 uint32_t cal_suffix0;
44 uint32_t cal_suffix1; 44 uint32_t cal_suffix1;
@@ -64,7 +64,7 @@ struct nouveau_pushbuf_priv {
64#define nouveau_pushbuf(n) ((struct nouveau_pushbuf_priv *)(n)) 64#define nouveau_pushbuf(n) ((struct nouveau_pushbuf_priv *)(n))
65 65
66int 66int
67nouveau_pushbuf_init(struct nouveau_channel *); 67nouveau_pushbuf_init(struct nouveau_channel *, int buf_size);
68void 68void
69nouveau_pushbuf_fini(struct nouveau_channel *); 69nouveau_pushbuf_fini(struct nouveau_channel *);
70 70
diff --git a/nouveau/nouveau_pushbuf.c b/nouveau/nouveau_pushbuf.c
index 28b8018a..90836bcd 100644
--- a/nouveau/nouveau_pushbuf.c
+++ b/nouveau/nouveau_pushbuf.c
@@ -78,7 +78,7 @@ nouveau_pushbuf_fini_call(struct nouveau_channel *chan)
78} 78}
79 79
80static int 80static int
81nouveau_pushbuf_init_call(struct nouveau_channel *chan) 81nouveau_pushbuf_init_call(struct nouveau_channel *chan, int buf_size)
82{ 82{
83 struct drm_nouveau_gem_pushbuf req; 83 struct drm_nouveau_gem_pushbuf req;
84 struct nouveau_channel_priv *nvchan = nouveau_channel(chan); 84 struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
@@ -101,7 +101,7 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan)
101 101
102 for (i = 0; i < CALPB_BUFFERS; i++) { 102 for (i = 0; i < CALPB_BUFFERS; i++) {
103 ret = nouveau_bo_new(dev, flags | NOUVEAU_BO_MAP, 103 ret = nouveau_bo_new(dev, flags | NOUVEAU_BO_MAP,
104 0, CALPB_BUFSZ, &nvpb->buffer[i]); 104 0, buf_size, &nvpb->buffer[i]);
105 if (ret) { 105 if (ret) {
106 nouveau_pushbuf_fini_call(chan); 106 nouveau_pushbuf_fini_call(chan);
107 return ret; 107 return ret;
@@ -114,13 +114,13 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan)
114} 114}
115 115
116int 116int
117nouveau_pushbuf_init(struct nouveau_channel *chan) 117nouveau_pushbuf_init(struct nouveau_channel *chan, int buf_size)
118{ 118{
119 struct nouveau_channel_priv *nvchan = nouveau_channel(chan); 119 struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
120 struct nouveau_pushbuf_priv *nvpb = &nvchan->pb; 120 struct nouveau_pushbuf_priv *nvpb = &nvchan->pb;
121 int ret; 121 int ret;
122 122
123 ret = nouveau_pushbuf_init_call(chan); 123 ret = nouveau_pushbuf_init_call(chan, buf_size);
124 if (ret) 124 if (ret)
125 return ret; 125 return ret;
126 126