nouveau: Let the user choose the push buffer size.
Signed-off-by: Francisco Jerez <currojerez@riseup.net> Acked-by: Ben Skeggs <bskeggs@redhat.com>main
parent
1b9187c43a
commit
09b1062628
|
@ -28,7 +28,8 @@
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma,
|
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_device_priv *nvdev = nouveau_device(dev);
|
||||||
struct nouveau_channel_priv *nvchan;
|
struct nouveau_channel_priv *nvchan;
|
||||||
|
@ -90,7 +91,7 @@ nouveau_channel_alloc(struct nouveau_device *dev, uint32_t fb_ctxdma,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nouveau_pushbuf_init(&nvchan->base);
|
ret = nouveau_pushbuf_init(&nvchan->base, pushbuf_size);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
nouveau_channel_free((void *)&nvchan);
|
nouveau_channel_free((void *)&nvchan);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -49,7 +49,7 @@ struct nouveau_channel {
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_channel_alloc(struct nouveau_device *, uint32_t fb, uint32_t tt,
|
nouveau_channel_alloc(struct nouveau_device *, uint32_t fb, uint32_t tt,
|
||||||
struct nouveau_channel **);
|
int pushbuf_size, struct nouveau_channel **);
|
||||||
|
|
||||||
void
|
void
|
||||||
nouveau_channel_free(struct nouveau_channel **);
|
nouveau_channel_free(struct nouveau_channel **);
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
#include "nouveau_pushbuf.h"
|
#include "nouveau_pushbuf.h"
|
||||||
#include "nouveau_reloc.h"
|
#include "nouveau_reloc.h"
|
||||||
|
|
||||||
#define CALPB_BUFFERS 4
|
#define CALPB_BUFFERS 3
|
||||||
#define CALPB_BUFSZ 16384
|
|
||||||
struct nouveau_pushbuf_priv {
|
struct nouveau_pushbuf_priv {
|
||||||
uint32_t cal_suffix0;
|
uint32_t cal_suffix0;
|
||||||
uint32_t cal_suffix1;
|
uint32_t cal_suffix1;
|
||||||
|
@ -64,7 +64,7 @@ struct nouveau_pushbuf_priv {
|
||||||
#define nouveau_pushbuf(n) ((struct nouveau_pushbuf_priv *)(n))
|
#define nouveau_pushbuf(n) ((struct nouveau_pushbuf_priv *)(n))
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_pushbuf_init(struct nouveau_channel *);
|
nouveau_pushbuf_init(struct nouveau_channel *, int buf_size);
|
||||||
void
|
void
|
||||||
nouveau_pushbuf_fini(struct nouveau_channel *);
|
nouveau_pushbuf_fini(struct nouveau_channel *);
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ nouveau_pushbuf_fini_call(struct nouveau_channel *chan)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
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 drm_nouveau_gem_pushbuf req;
|
||||||
struct nouveau_channel_priv *nvchan = nouveau_channel(chan);
|
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++) {
|
for (i = 0; i < CALPB_BUFFERS; i++) {
|
||||||
ret = nouveau_bo_new(dev, flags | NOUVEAU_BO_MAP,
|
ret = nouveau_bo_new(dev, flags | NOUVEAU_BO_MAP,
|
||||||
0, CALPB_BUFSZ, &nvpb->buffer[i]);
|
0, buf_size, &nvpb->buffer[i]);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
nouveau_pushbuf_fini_call(chan);
|
nouveau_pushbuf_fini_call(chan);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -114,13 +114,13 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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_channel_priv *nvchan = nouveau_channel(chan);
|
||||||
struct nouveau_pushbuf_priv *nvpb = &nvchan->pb;
|
struct nouveau_pushbuf_priv *nvpb = &nvchan->pb;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_pushbuf_init_call(chan);
|
ret = nouveau_pushbuf_init_call(chan, buf_size);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue