summaryrefslogtreecommitdiff
path: root/libdrm/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2009-11-02 18:49:40 +1000
committerBen Skeggs <bskeggs@redhat.com>2009-11-04 13:24:52 +1000
commit68c2ac9640a59881d18e2d55f666c2cd4c21e00b (patch)
treeb33ad932f3859768eb3341de01ce28406947b4ff /libdrm/nouveau
parent6eafd1cf386d93bb9e34660227ca6f26aadfeb32 (diff)
nouveau: update view of available aperture space after each flush
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'libdrm/nouveau')
-rw-r--r--libdrm/nouveau/nouveau_private.h1
-rw-r--r--libdrm/nouveau/nouveau_pushbuf.c22
2 files changed, 18 insertions, 5 deletions
diff --git a/libdrm/nouveau/nouveau_private.h b/libdrm/nouveau/nouveau_private.h
index 67144e33..9ce87fb2 100644
--- a/libdrm/nouveau/nouveau_private.h
+++ b/libdrm/nouveau/nouveau_private.h
@@ -41,6 +41,7 @@
struct nouveau_pushbuf_priv {
struct nouveau_pushbuf base;
+ int no_aper_update;
int use_cal;
uint32_t cal_suffix0;
uint32_t cal_suffix1;
diff --git a/libdrm/nouveau/nouveau_pushbuf.c b/libdrm/nouveau/nouveau_pushbuf.c
index fbcddd77..20d5db3d 100644
--- a/libdrm/nouveau/nouveau_pushbuf.c
+++ b/libdrm/nouveau/nouveau_pushbuf.c
@@ -202,10 +202,17 @@ nouveau_pushbuf_init_call(struct nouveau_channel *chan)
req.channel = chan->id;
req.handle = 0;
ret = drmCommandWriteRead(nouveau_device(dev)->fd,
- DRM_NOUVEAU_GEM_PUSHBUF_CALL,
+ DRM_NOUVEAU_GEM_PUSHBUF_CALL2,
&req, sizeof(req));
- if (ret)
- return;
+ if (ret) {
+ ret = drmCommandWriteRead(nouveau_device(dev)->fd,
+ DRM_NOUVEAU_GEM_PUSHBUF_CALL2,
+ &req, sizeof(req));
+ if (ret)
+ return;
+
+ nvpb->no_aper_update = 1;
+ }
for (i = 0; i < CALPB_BUFFERS; i++) {
ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP,
@@ -282,14 +289,19 @@ restart_cal:
nvpb->current_offset;
req.suffix0 = nvpb->cal_suffix0;
req.suffix1 = nvpb->cal_suffix1;
- ret = drmCommandWriteRead(nvdev->fd,
- DRM_NOUVEAU_GEM_PUSHBUF_CALL,
+ ret = drmCommandWriteRead(nvdev->fd, nvpb->no_aper_update ?
+ DRM_NOUVEAU_GEM_PUSHBUF_CALL :
+ DRM_NOUVEAU_GEM_PUSHBUF_CALL2,
&req, sizeof(req));
if (ret == -EAGAIN)
goto restart_cal;
nvpb->cal_suffix0 = req.suffix0;
nvpb->cal_suffix1 = req.suffix1;
assert(ret == 0);
+ if (!nvpb->no_aper_update) {
+ nvdev->base.vm_vram_size = req.vram_available;
+ nvdev->base.vm_gart_size = req.gart_available;
+ }
} else {
struct drm_nouveau_gem_pushbuf req;