nouveau: update view of available aperture space after each flush

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
main
Ben Skeggs 2009-11-02 18:49:40 +10:00
parent 6eafd1cf38
commit 68c2ac9640
3 changed files with 22 additions and 5 deletions

View File

@ -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;

View File

@ -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;

View File

@ -155,6 +155,9 @@ struct drm_nouveau_gem_pushbuf_call {
uint64_t relocs;
uint32_t suffix0;
uint32_t suffix1;
/* below only accessed for CALL2 */
uint64_t vram_available;
uint64_t gart_available;
};
struct drm_nouveau_gem_pin {
@ -212,5 +215,6 @@ struct drm_nouveau_sarea {
#define DRM_NOUVEAU_GEM_CPU_PREP 0x45
#define DRM_NOUVEAU_GEM_CPU_FINI 0x46
#define DRM_NOUVEAU_GEM_INFO 0x47
#define DRM_NOUVEAU_GEM_PUSHBUF_CALL2 0x48
#endif /* __NOUVEAU_DRM_H__ */