nouveau: remove delayed kernel bo creation
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>main
parent
fbc8b2d95f
commit
f1660c2491
|
@ -59,7 +59,7 @@ nouveau_bo_info(struct nouveau_bo_priv *nvbo, struct drm_nouveau_gem_info *arg)
|
|||
static int
|
||||
nouveau_bo_allocated(struct nouveau_bo_priv *nvbo)
|
||||
{
|
||||
if (nvbo->sysmem || nvbo->handle || (nvbo->flags & NOUVEAU_BO_PIN))
|
||||
if (nvbo->sysmem || nvbo->handle)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ nouveau_bo_kalloc(struct nouveau_bo_priv *nvbo, struct nouveau_channel *chan)
|
|||
struct drm_nouveau_gem_info *info = &req.info;
|
||||
int ret;
|
||||
|
||||
if (nvbo->handle || (nvbo->flags & NOUVEAU_BO_PIN))
|
||||
if (nvbo->handle)
|
||||
return 0;
|
||||
|
||||
req.channel_hint = chan ? chan->id : 0;
|
||||
|
@ -191,14 +191,17 @@ nouveau_bo_new_tile(struct nouveau_device *dev, uint32_t flags, int align,
|
|||
nvbo->base.tile_flags = tile_flags;
|
||||
|
||||
nvbo->refcount = 1;
|
||||
/* Don't set NOUVEAU_BO_PIN here, or nouveau_bo_allocated() will
|
||||
* decided the buffer's already allocated when it's not. The
|
||||
* call to nouveau_bo_pin() later will set this flag.
|
||||
*/
|
||||
nvbo->flags = (flags & ~NOUVEAU_BO_PIN);
|
||||
nvbo->flags = flags;
|
||||
nvbo->size = size;
|
||||
nvbo->align = align;
|
||||
|
||||
if (flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)) {
|
||||
ret = nouveau_bo_kalloc(nvbo, NULL);
|
||||
if (ret) {
|
||||
nouveau_bo_ref(NULL, (void *)nvbo);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (flags & NOUVEAU_BO_PIN) {
|
||||
ret = nouveau_bo_pin((void *)nvbo, nvbo->flags);
|
||||
if (ret) {
|
||||
|
@ -206,6 +209,7 @@ nouveau_bo_new_tile(struct nouveau_device *dev, uint32_t flags, int align,
|
|||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*bo = &nvbo->base;
|
||||
return 0;
|
||||
|
@ -489,25 +493,15 @@ nouveau_bo_pin(struct nouveau_bo *bo, uint32_t flags)
|
|||
if (nvbo->pinned)
|
||||
return 0;
|
||||
|
||||
/* Ensure we have a kernel object... */
|
||||
if (!nvbo->flags) {
|
||||
if (!(flags & (NOUVEAU_BO_VRAM | NOUVEAU_BO_GART)))
|
||||
if (!nvbo->handle)
|
||||
return -EINVAL;
|
||||
nvbo->flags = flags;
|
||||
}
|
||||
|
||||
if (!nvbo->handle) {
|
||||
ret = nouveau_bo_kalloc(nvbo, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Now force it to stay put :) */
|
||||
req.handle = nvbo->handle;
|
||||
req.domain = 0;
|
||||
if (nvbo->flags & NOUVEAU_BO_VRAM)
|
||||
if (flags & NOUVEAU_BO_VRAM)
|
||||
req.domain |= NOUVEAU_GEM_DOMAIN_VRAM;
|
||||
if (nvbo->flags & NOUVEAU_BO_GART)
|
||||
if (flags & NOUVEAU_BO_GART)
|
||||
req.domain |= NOUVEAU_GEM_DOMAIN_GART;
|
||||
|
||||
ret = drmCommandWriteRead(nvdev->fd, DRM_NOUVEAU_GEM_PIN, &req,
|
||||
|
@ -517,7 +511,6 @@ nouveau_bo_pin(struct nouveau_bo *bo, uint32_t flags)
|
|||
nvbo->offset = req.offset;
|
||||
nvbo->domain = req.domain;
|
||||
nvbo->pinned = 1;
|
||||
nvbo->flags |= NOUVEAU_BO_PIN;
|
||||
|
||||
/* Fill in public nouveau_bo members */
|
||||
if (nvbo->domain & NOUVEAU_GEM_DOMAIN_VRAM)
|
||||
|
|
Loading…
Reference in New Issue