mirror of https://gitee.com/openkylin/linux.git
drm/nouveau: remove no_vm/mappable flags from nouveau_bo
'mappable' isn't really used at all, nor is it necessary anymore as the bo code is capable of moving buffers to mappable vram as required. 'no_vm' isn't necessary anymore either, any places that don't want to be mapped into a GPU address space should allocate the VRAM directly instead. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
2503c6fa3e
commit
d550c41e4f
|
@ -98,8 +98,7 @@ nouveau_bo_fixup_align(struct nouveau_bo *nvbo, int *align, int *size,
|
||||||
int
|
int
|
||||||
nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
|
nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
|
||||||
int size, int align, uint32_t flags, uint32_t tile_mode,
|
int size, int align, uint32_t flags, uint32_t tile_mode,
|
||||||
uint32_t tile_flags, bool no_vm, bool mappable,
|
uint32_t tile_flags, struct nouveau_bo **pnvbo)
|
||||||
struct nouveau_bo **pnvbo)
|
|
||||||
{
|
{
|
||||||
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
||||||
struct nouveau_bo *nvbo;
|
struct nouveau_bo *nvbo;
|
||||||
|
@ -110,8 +109,6 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
INIT_LIST_HEAD(&nvbo->head);
|
INIT_LIST_HEAD(&nvbo->head);
|
||||||
INIT_LIST_HEAD(&nvbo->entry);
|
INIT_LIST_HEAD(&nvbo->entry);
|
||||||
nvbo->mappable = mappable;
|
|
||||||
nvbo->no_vm = no_vm;
|
|
||||||
nvbo->tile_mode = tile_mode;
|
nvbo->tile_mode = tile_mode;
|
||||||
nvbo->tile_flags = tile_flags;
|
nvbo->tile_flags = tile_flags;
|
||||||
nvbo->bo.bdev = &dev_priv->ttm.bdev;
|
nvbo->bo.bdev = &dev_priv->ttm.bdev;
|
||||||
|
@ -119,7 +116,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
|
||||||
nouveau_bo_fixup_align(nvbo, &align, &size, &page_shift);
|
nouveau_bo_fixup_align(nvbo, &align, &size, &page_shift);
|
||||||
align >>= PAGE_SHIFT;
|
align >>= PAGE_SHIFT;
|
||||||
|
|
||||||
if (!nvbo->no_vm && dev_priv->chan_vm) {
|
if (dev_priv->chan_vm) {
|
||||||
ret = nouveau_vm_get(dev_priv->chan_vm, size, page_shift,
|
ret = nouveau_vm_get(dev_priv->chan_vm, size, page_shift,
|
||||||
NV_MEM_ACCESS_RW, &nvbo->vma);
|
NV_MEM_ACCESS_RW, &nvbo->vma);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -504,14 +501,6 @@ static inline uint32_t
|
||||||
nouveau_bo_mem_ctxdma(struct ttm_buffer_object *bo,
|
nouveau_bo_mem_ctxdma(struct ttm_buffer_object *bo,
|
||||||
struct nouveau_channel *chan, struct ttm_mem_reg *mem)
|
struct nouveau_channel *chan, struct ttm_mem_reg *mem)
|
||||||
{
|
{
|
||||||
struct nouveau_bo *nvbo = nouveau_bo(bo);
|
|
||||||
|
|
||||||
if (nvbo->no_vm) {
|
|
||||||
if (mem->mem_type == TTM_PL_TT)
|
|
||||||
return NvDmaGART;
|
|
||||||
return NvDmaVRAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mem->mem_type == TTM_PL_TT)
|
if (mem->mem_type == TTM_PL_TT)
|
||||||
return chan->gart_handle;
|
return chan->gart_handle;
|
||||||
return chan->vram_handle;
|
return chan->vram_handle;
|
||||||
|
@ -523,22 +512,21 @@ nvc0_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
|
||||||
{
|
{
|
||||||
struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
|
struct drm_nouveau_private *dev_priv = nouveau_bdev(bo->bdev);
|
||||||
struct nouveau_bo *nvbo = nouveau_bo(bo);
|
struct nouveau_bo *nvbo = nouveau_bo(bo);
|
||||||
u64 src_offset = old_mem->start << PAGE_SHIFT;
|
|
||||||
u64 dst_offset = new_mem->start << PAGE_SHIFT;
|
|
||||||
u32 page_count = new_mem->num_pages;
|
u32 page_count = new_mem->num_pages;
|
||||||
|
u64 src_offset, dst_offset;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!nvbo->no_vm) {
|
src_offset = old_mem->start << PAGE_SHIFT;
|
||||||
if (old_mem->mem_type == TTM_PL_VRAM)
|
if (old_mem->mem_type == TTM_PL_VRAM)
|
||||||
src_offset = nvbo->vma.offset;
|
src_offset = nvbo->vma.offset;
|
||||||
else
|
else
|
||||||
src_offset += dev_priv->gart_info.aper_base;
|
src_offset += dev_priv->gart_info.aper_base;
|
||||||
|
|
||||||
if (new_mem->mem_type == TTM_PL_VRAM)
|
dst_offset = new_mem->start << PAGE_SHIFT;
|
||||||
dst_offset = nvbo->vma.offset;
|
if (new_mem->mem_type == TTM_PL_VRAM)
|
||||||
else
|
dst_offset = nvbo->vma.offset;
|
||||||
dst_offset += dev_priv->gart_info.aper_base;
|
else
|
||||||
}
|
dst_offset += dev_priv->gart_info.aper_base;
|
||||||
|
|
||||||
page_count = new_mem->num_pages;
|
page_count = new_mem->num_pages;
|
||||||
while (page_count) {
|
while (page_count) {
|
||||||
|
@ -580,18 +568,16 @@ nv50_bo_move_m2mf(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
src_offset = old_mem->start << PAGE_SHIFT;
|
src_offset = old_mem->start << PAGE_SHIFT;
|
||||||
dst_offset = new_mem->start << PAGE_SHIFT;
|
if (old_mem->mem_type == TTM_PL_VRAM)
|
||||||
if (!nvbo->no_vm) {
|
src_offset = nvbo->vma.offset;
|
||||||
if (old_mem->mem_type == TTM_PL_VRAM)
|
else
|
||||||
src_offset = nvbo->vma.offset;
|
src_offset += dev_priv->gart_info.aper_base;
|
||||||
else
|
|
||||||
src_offset += dev_priv->gart_info.aper_base;
|
|
||||||
|
|
||||||
if (new_mem->mem_type == TTM_PL_VRAM)
|
dst_offset = new_mem->start << PAGE_SHIFT;
|
||||||
dst_offset = nvbo->vma.offset;
|
if (new_mem->mem_type == TTM_PL_VRAM)
|
||||||
else
|
dst_offset = nvbo->vma.offset;
|
||||||
dst_offset += dev_priv->gart_info.aper_base;
|
else
|
||||||
}
|
dst_offset += dev_priv->gart_info.aper_base;
|
||||||
|
|
||||||
ret = RING_SPACE(chan, 3);
|
ret = RING_SPACE(chan, 3);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -737,7 +723,7 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
chan = nvbo->channel;
|
chan = nvbo->channel;
|
||||||
if (!chan || nvbo->no_vm) {
|
if (!chan) {
|
||||||
chan = dev_priv->channel;
|
chan = dev_priv->channel;
|
||||||
mutex_lock_nested(&chan->mutex, NOUVEAU_KCHANNEL_MUTEX);
|
mutex_lock_nested(&chan->mutex, NOUVEAU_KCHANNEL_MUTEX);
|
||||||
}
|
}
|
||||||
|
@ -836,7 +822,7 @@ nouveau_bo_vm_bind(struct ttm_buffer_object *bo, struct ttm_mem_reg *new_mem,
|
||||||
struct nouveau_bo *nvbo = nouveau_bo(bo);
|
struct nouveau_bo *nvbo = nouveau_bo(bo);
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
|
|
||||||
if (nvbo->no_vm || new_mem->mem_type != TTM_PL_VRAM) {
|
if (new_mem->mem_type != TTM_PL_VRAM) {
|
||||||
/* Nothing to do. */
|
/* Nothing to do. */
|
||||||
*new_tile = NULL;
|
*new_tile = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -90,8 +90,7 @@ nouveau_channel_user_pushbuf_alloc(struct drm_device *dev)
|
||||||
else
|
else
|
||||||
location = TTM_PL_FLAG_TT;
|
location = TTM_PL_FLAG_TT;
|
||||||
|
|
||||||
ret = nouveau_bo_new(dev, NULL, 65536, 0, location, 0, 0x0000, false,
|
ret = nouveau_bo_new(dev, NULL, 65536, 0, location, 0, 0x0000, &pushbuf);
|
||||||
true, &pushbuf);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
NV_ERROR(dev, "error allocating DMA push buffer: %d\n", ret);
|
NV_ERROR(dev, "error allocating DMA push buffer: %d\n", ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -61,8 +61,6 @@ enum {
|
||||||
NvM2MF = 0x80000001,
|
NvM2MF = 0x80000001,
|
||||||
NvDmaFB = 0x80000002,
|
NvDmaFB = 0x80000002,
|
||||||
NvDmaTT = 0x80000003,
|
NvDmaTT = 0x80000003,
|
||||||
NvDmaVRAM = 0x80000004,
|
|
||||||
NvDmaGART = 0x80000005,
|
|
||||||
NvNotify0 = 0x80000006,
|
NvNotify0 = 0x80000006,
|
||||||
Nv2D = 0x80000007,
|
Nv2D = 0x80000007,
|
||||||
NvCtxSurf2D = 0x80000008,
|
NvCtxSurf2D = 0x80000008,
|
||||||
|
|
|
@ -104,8 +104,6 @@ struct nouveau_bo {
|
||||||
struct nouveau_channel *channel;
|
struct nouveau_channel *channel;
|
||||||
|
|
||||||
struct nouveau_vma vma;
|
struct nouveau_vma vma;
|
||||||
bool mappable;
|
|
||||||
bool no_vm;
|
|
||||||
|
|
||||||
uint32_t tile_mode;
|
uint32_t tile_mode;
|
||||||
uint32_t tile_flags;
|
uint32_t tile_flags;
|
||||||
|
@ -1293,7 +1291,7 @@ extern struct ttm_bo_driver nouveau_bo_driver;
|
||||||
extern int nouveau_bo_new(struct drm_device *, struct nouveau_channel *,
|
extern int nouveau_bo_new(struct drm_device *, struct nouveau_channel *,
|
||||||
int size, int align, uint32_t flags,
|
int size, int align, uint32_t flags,
|
||||||
uint32_t tile_mode, uint32_t tile_flags,
|
uint32_t tile_mode, uint32_t tile_flags,
|
||||||
bool no_vm, bool mappable, struct nouveau_bo **);
|
struct nouveau_bo **);
|
||||||
extern int nouveau_bo_pin(struct nouveau_bo *, uint32_t flags);
|
extern int nouveau_bo_pin(struct nouveau_bo *, uint32_t flags);
|
||||||
extern int nouveau_bo_unpin(struct nouveau_bo *);
|
extern int nouveau_bo_unpin(struct nouveau_bo *);
|
||||||
extern int nouveau_bo_map(struct nouveau_bo *);
|
extern int nouveau_bo_map(struct nouveau_bo *);
|
||||||
|
@ -1356,7 +1354,7 @@ static inline struct nouveau_fence *nouveau_fence_ref(struct nouveau_fence *obj)
|
||||||
extern int nouveau_gem_new(struct drm_device *, struct nouveau_channel *,
|
extern int nouveau_gem_new(struct drm_device *, struct nouveau_channel *,
|
||||||
int size, int align, uint32_t flags,
|
int size, int align, uint32_t flags,
|
||||||
uint32_t tile_mode, uint32_t tile_flags,
|
uint32_t tile_mode, uint32_t tile_flags,
|
||||||
bool no_vm, bool mappable, struct nouveau_bo **);
|
struct nouveau_bo **);
|
||||||
extern int nouveau_gem_object_new(struct drm_gem_object *);
|
extern int nouveau_gem_object_new(struct drm_gem_object *);
|
||||||
extern void nouveau_gem_object_del(struct drm_gem_object *);
|
extern void nouveau_gem_object_del(struct drm_gem_object *);
|
||||||
extern int nouveau_gem_ioctl_new(struct drm_device *, void *,
|
extern int nouveau_gem_ioctl_new(struct drm_device *, void *,
|
||||||
|
|
|
@ -297,7 +297,7 @@ nouveau_fbcon_create(struct nouveau_fbdev *nfbdev,
|
||||||
size = roundup(size, PAGE_SIZE);
|
size = roundup(size, PAGE_SIZE);
|
||||||
|
|
||||||
ret = nouveau_gem_new(dev, dev_priv->channel, size, 0, TTM_PL_FLAG_VRAM,
|
ret = nouveau_gem_new(dev, dev_priv->channel, size, 0, TTM_PL_FLAG_VRAM,
|
||||||
0, 0x0000, false, true, &nvbo);
|
0, 0x0000, &nvbo);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
NV_ERROR(dev, "failed to allocate framebuffer\n");
|
NV_ERROR(dev, "failed to allocate framebuffer\n");
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -578,7 +578,7 @@ nouveau_fence_init(struct drm_device *dev)
|
||||||
/* Create a shared VRAM heap for cross-channel sync. */
|
/* Create a shared VRAM heap for cross-channel sync. */
|
||||||
if (USE_SEMA(dev)) {
|
if (USE_SEMA(dev)) {
|
||||||
ret = nouveau_bo_new(dev, NULL, size, 0, TTM_PL_FLAG_VRAM,
|
ret = nouveau_bo_new(dev, NULL, size, 0, TTM_PL_FLAG_VRAM,
|
||||||
0, 0, false, true, &dev_priv->fence.bo);
|
0, 0, &dev_priv->fence.bo);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -62,14 +62,13 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
|
||||||
int
|
int
|
||||||
nouveau_gem_new(struct drm_device *dev, struct nouveau_channel *chan,
|
nouveau_gem_new(struct drm_device *dev, struct nouveau_channel *chan,
|
||||||
int size, int align, uint32_t flags, uint32_t tile_mode,
|
int size, int align, uint32_t flags, uint32_t tile_mode,
|
||||||
uint32_t tile_flags, bool no_vm, bool mappable,
|
uint32_t tile_flags, struct nouveau_bo **pnvbo)
|
||||||
struct nouveau_bo **pnvbo)
|
|
||||||
{
|
{
|
||||||
struct nouveau_bo *nvbo;
|
struct nouveau_bo *nvbo;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_bo_new(dev, chan, size, align, flags, tile_mode,
|
ret = nouveau_bo_new(dev, chan, size, align, flags, tile_mode,
|
||||||
tile_flags, no_vm, mappable, pnvbo);
|
tile_flags, pnvbo);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
nvbo = *pnvbo;
|
nvbo = *pnvbo;
|
||||||
|
@ -97,7 +96,7 @@ nouveau_gem_info(struct drm_gem_object *gem, struct drm_nouveau_gem_info *rep)
|
||||||
|
|
||||||
rep->size = nvbo->bo.mem.num_pages << PAGE_SHIFT;
|
rep->size = nvbo->bo.mem.num_pages << PAGE_SHIFT;
|
||||||
rep->offset = nvbo->bo.offset;
|
rep->offset = nvbo->bo.offset;
|
||||||
rep->map_handle = nvbo->mappable ? nvbo->bo.addr_space_offset : 0;
|
rep->map_handle = nvbo->bo.addr_space_offset;
|
||||||
rep->tile_mode = nvbo->tile_mode;
|
rep->tile_mode = nvbo->tile_mode;
|
||||||
rep->tile_flags = nvbo->tile_flags;
|
rep->tile_flags = nvbo->tile_flags;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -136,9 +135,7 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data,
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nouveau_gem_new(dev, chan, req->info.size, req->align, flags,
|
ret = nouveau_gem_new(dev, chan, req->info.size, req->align, flags,
|
||||||
req->info.tile_mode, req->info.tile_flags, false,
|
req->info.tile_mode, req->info.tile_flags, &nvbo);
|
||||||
(req->info.domain & NOUVEAU_GEM_DOMAIN_MAPPABLE),
|
|
||||||
&nvbo);
|
|
||||||
if (chan)
|
if (chan)
|
||||||
nouveau_channel_put(&chan);
|
nouveau_channel_put(&chan);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -152,7 +152,6 @@ nouveau_mem_vram_fini(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
||||||
|
|
||||||
nouveau_bo_unpin(dev_priv->vga_ram);
|
|
||||||
nouveau_bo_ref(NULL, &dev_priv->vga_ram);
|
nouveau_bo_ref(NULL, &dev_priv->vga_ram);
|
||||||
|
|
||||||
ttm_bo_device_release(&dev_priv->ttm.bdev);
|
ttm_bo_device_release(&dev_priv->ttm.bdev);
|
||||||
|
@ -461,13 +460,17 @@ nouveau_mem_vram_init(struct drm_device *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nouveau_bo_new(dev, NULL, 256*1024, 0, TTM_PL_FLAG_VRAM,
|
if (dev_priv->card_type < NV_50) {
|
||||||
0, 0, true, true, &dev_priv->vga_ram);
|
ret = nouveau_bo_new(dev, NULL, 256*1024, 0, TTM_PL_FLAG_VRAM,
|
||||||
if (ret == 0)
|
0, 0, &dev_priv->vga_ram);
|
||||||
ret = nouveau_bo_pin(dev_priv->vga_ram, TTM_PL_FLAG_VRAM);
|
if (ret == 0)
|
||||||
if (ret) {
|
ret = nouveau_bo_pin(dev_priv->vga_ram,
|
||||||
NV_WARN(dev, "failed to reserve VGA memory\n");
|
TTM_PL_FLAG_VRAM);
|
||||||
nouveau_bo_ref(NULL, &dev_priv->vga_ram);
|
|
||||||
|
if (ret) {
|
||||||
|
NV_WARN(dev, "failed to reserve VGA memory\n");
|
||||||
|
nouveau_bo_ref(NULL, &dev_priv->vga_ram);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_priv->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 1),
|
dev_priv->fb_mtrr = drm_mtrr_add(pci_resource_start(dev->pdev, 1),
|
||||||
|
@ -672,13 +675,14 @@ nouveau_vram_manager_init(struct ttm_mem_type_manager *man, unsigned long p_size
|
||||||
{
|
{
|
||||||
struct drm_nouveau_private *dev_priv = nouveau_bdev(man->bdev);
|
struct drm_nouveau_private *dev_priv = nouveau_bdev(man->bdev);
|
||||||
struct nouveau_mm *mm;
|
struct nouveau_mm *mm;
|
||||||
u32 b_size;
|
u64 size, block, rsvd;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
p_size = (p_size << PAGE_SHIFT) >> 12;
|
rsvd = (256 * 1024); /* vga memory */
|
||||||
b_size = dev_priv->vram_rblock_size >> 12;
|
size = (p_size << PAGE_SHIFT) - rsvd;
|
||||||
|
block = dev_priv->vram_rblock_size;
|
||||||
|
|
||||||
ret = nouveau_mm_init(&mm, 0, p_size, b_size);
|
ret = nouveau_mm_init(&mm, rsvd >> 12, size >> 12, block >> 12);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,7 @@ nouveau_notifier_init_channel(struct nouveau_channel *chan)
|
||||||
else
|
else
|
||||||
flags = TTM_PL_FLAG_TT;
|
flags = TTM_PL_FLAG_TT;
|
||||||
|
|
||||||
ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags,
|
ret = nouveau_gem_new(dev, NULL, PAGE_SIZE, 0, flags, 0, 0, &ntfy);
|
||||||
0, 0x0000, false, true, &ntfy);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -544,7 +544,6 @@ static int
|
||||||
nouveau_card_init_channel(struct drm_device *dev)
|
nouveau_card_init_channel(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
struct drm_nouveau_private *dev_priv = dev->dev_private;
|
||||||
struct nouveau_gpuobj *gpuobj = NULL;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = nouveau_channel_alloc(dev, &dev_priv->channel,
|
ret = nouveau_channel_alloc(dev, &dev_priv->channel,
|
||||||
|
@ -552,41 +551,8 @@ nouveau_card_init_channel(struct drm_device *dev)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* no dma objects on fermi... */
|
|
||||||
if (dev_priv->card_type >= NV_C0)
|
|
||||||
goto out_done;
|
|
||||||
|
|
||||||
ret = nouveau_gpuobj_dma_new(dev_priv->channel, NV_CLASS_DMA_IN_MEMORY,
|
|
||||||
0, dev_priv->vram_size,
|
|
||||||
NV_MEM_ACCESS_RW, NV_MEM_TARGET_VRAM,
|
|
||||||
&gpuobj);
|
|
||||||
if (ret)
|
|
||||||
goto out_err;
|
|
||||||
|
|
||||||
ret = nouveau_ramht_insert(dev_priv->channel, NvDmaVRAM, gpuobj);
|
|
||||||
nouveau_gpuobj_ref(NULL, &gpuobj);
|
|
||||||
if (ret)
|
|
||||||
goto out_err;
|
|
||||||
|
|
||||||
ret = nouveau_gpuobj_dma_new(dev_priv->channel, NV_CLASS_DMA_IN_MEMORY,
|
|
||||||
0, dev_priv->gart_info.aper_size,
|
|
||||||
NV_MEM_ACCESS_RW, NV_MEM_TARGET_GART,
|
|
||||||
&gpuobj);
|
|
||||||
if (ret)
|
|
||||||
goto out_err;
|
|
||||||
|
|
||||||
ret = nouveau_ramht_insert(dev_priv->channel, NvDmaGART, gpuobj);
|
|
||||||
nouveau_gpuobj_ref(NULL, &gpuobj);
|
|
||||||
if (ret)
|
|
||||||
goto out_err;
|
|
||||||
|
|
||||||
out_done:
|
|
||||||
mutex_unlock(&dev_priv->channel->mutex);
|
mutex_unlock(&dev_priv->channel->mutex);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
out_err:
|
|
||||||
nouveau_channel_put(&dev_priv->channel);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nouveau_switcheroo_set_state(struct pci_dev *pdev,
|
static void nouveau_switcheroo_set_state(struct pci_dev *pdev,
|
||||||
|
|
|
@ -1031,7 +1031,7 @@ nv04_crtc_create(struct drm_device *dev, int crtc_num)
|
||||||
drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256);
|
drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256);
|
||||||
|
|
||||||
ret = nouveau_bo_new(dev, NULL, 64*64*4, 0x100, TTM_PL_FLAG_VRAM,
|
ret = nouveau_bo_new(dev, NULL, 64*64*4, 0x100, TTM_PL_FLAG_VRAM,
|
||||||
0, 0x0000, false, true, &nv_crtc->cursor.nvbo);
|
0, 0x0000, &nv_crtc->cursor.nvbo);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = nouveau_bo_pin(nv_crtc->cursor.nvbo, TTM_PL_FLAG_VRAM);
|
ret = nouveau_bo_pin(nv_crtc->cursor.nvbo, TTM_PL_FLAG_VRAM);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
|
|
@ -752,7 +752,7 @@ nv50_crtc_create(struct drm_device *dev, int index)
|
||||||
nv_crtc->lut.depth = 0;
|
nv_crtc->lut.depth = 0;
|
||||||
|
|
||||||
ret = nouveau_bo_new(dev, NULL, 4096, 0x100, TTM_PL_FLAG_VRAM,
|
ret = nouveau_bo_new(dev, NULL, 4096, 0x100, TTM_PL_FLAG_VRAM,
|
||||||
0, 0x0000, false, true, &nv_crtc->lut.nvbo);
|
0, 0x0000, &nv_crtc->lut.nvbo);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = nouveau_bo_pin(nv_crtc->lut.nvbo, TTM_PL_FLAG_VRAM);
|
ret = nouveau_bo_pin(nv_crtc->lut.nvbo, TTM_PL_FLAG_VRAM);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -778,7 +778,7 @@ nv50_crtc_create(struct drm_device *dev, int index)
|
||||||
drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256);
|
drm_mode_crtc_set_gamma_size(&nv_crtc->base, 256);
|
||||||
|
|
||||||
ret = nouveau_bo_new(dev, NULL, 64*64*4, 0x100, TTM_PL_FLAG_VRAM,
|
ret = nouveau_bo_new(dev, NULL, 64*64*4, 0x100, TTM_PL_FLAG_VRAM,
|
||||||
0, 0x0000, false, true, &nv_crtc->cursor.nvbo);
|
0, 0x0000, &nv_crtc->cursor.nvbo);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = nouveau_bo_pin(nv_crtc->cursor.nvbo, TTM_PL_FLAG_VRAM);
|
ret = nouveau_bo_pin(nv_crtc->cursor.nvbo, TTM_PL_FLAG_VRAM);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
|
|
@ -117,7 +117,7 @@ nv50_evo_channel_new(struct drm_device *dev, int chid,
|
||||||
evo->user_put = 0;
|
evo->user_put = 0;
|
||||||
|
|
||||||
ret = nouveau_bo_new(dev, NULL, 4096, 0, TTM_PL_FLAG_VRAM, 0, 0,
|
ret = nouveau_bo_new(dev, NULL, 4096, 0, TTM_PL_FLAG_VRAM, 0, 0,
|
||||||
false, true, &evo->pushbuf_bo);
|
&evo->pushbuf_bo);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = nouveau_bo_pin(evo->pushbuf_bo, TTM_PL_FLAG_VRAM);
|
ret = nouveau_bo_pin(evo->pushbuf_bo, TTM_PL_FLAG_VRAM);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -331,7 +331,7 @@ nv50_evo_create(struct drm_device *dev)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
ret = nouveau_bo_new(dev, NULL, 4096, 0x1000, TTM_PL_FLAG_VRAM,
|
ret = nouveau_bo_new(dev, NULL, 4096, 0x1000, TTM_PL_FLAG_VRAM,
|
||||||
0, 0x0000, false, true, &dispc->sem.bo);
|
0, 0x0000, &dispc->sem.bo);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
offset = dispc->sem.bo->bo.mem.start << PAGE_SHIFT;
|
offset = dispc->sem.bo->bo.mem.start << PAGE_SHIFT;
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ nvc0_fifo_create_context(struct nouveau_channel *chan)
|
||||||
|
|
||||||
/* allocate vram for control regs, map into polling area */
|
/* allocate vram for control regs, map into polling area */
|
||||||
ret = nouveau_bo_new(dev, NULL, 0x1000, 0, TTM_PL_FLAG_VRAM,
|
ret = nouveau_bo_new(dev, NULL, 0x1000, 0, TTM_PL_FLAG_VRAM,
|
||||||
0, 0, true, true, &fifoch->user);
|
0, 0, &fifoch->user);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue