Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 260121
b: refs/heads/master
c: f91bac5
h: refs/heads/master
i:
  260119: 00e5d20
v: v3
  • Loading branch information
Ben Skeggs committed Jun 23, 2011
1 parent 56cafd7 commit db4ffd0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 111af5c100fa0c0b94301f719dd22dab87f5d0a4
refs/heads/master: f91bac5bf694e8060b7473fb0aefb8de09aa9595
27 changes: 12 additions & 15 deletions trunk/drivers/gpu/drm/nouveau/nouveau_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)

static void
nouveau_bo_fixup_align(struct nouveau_bo *nvbo, u32 flags,
int *align, int *size, int *page_shift)
int *align, int *size)
{
struct drm_nouveau_private *dev_priv = nouveau_bdev(nvbo->bo.bdev);

Expand All @@ -82,17 +82,8 @@ nouveau_bo_fixup_align(struct nouveau_bo *nvbo, u32 flags,
}
}
} else {
if (likely(dev_priv->chan_vm)) {
if (!(flags & TTM_PL_FLAG_TT) && *size > 256 * 1024)
*page_shift = dev_priv->chan_vm->lpg_shift;
else
*page_shift = dev_priv->chan_vm->spg_shift;
} else {
*page_shift = 12;
}

*size = roundup(*size, (1 << *page_shift));
*align = max((1 << *page_shift), *align);
*size = roundup(*size, (1 << nvbo->page_shift));
*align = max((1 << nvbo->page_shift), *align);
}

*size = roundup(*size, PAGE_SIZE);
Expand All @@ -105,7 +96,7 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
{
struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nouveau_bo *nvbo;
int ret = 0, page_shift = 0;
int ret;

nvbo = kzalloc(sizeof(struct nouveau_bo), GFP_KERNEL);
if (!nvbo)
Expand All @@ -116,11 +107,17 @@ nouveau_bo_new(struct drm_device *dev, struct nouveau_channel *chan,
nvbo->tile_flags = tile_flags;
nvbo->bo.bdev = &dev_priv->ttm.bdev;

nouveau_bo_fixup_align(nvbo, flags, &align, &size, &page_shift);
nvbo->page_shift = 12;
if (dev_priv->bar1_vm) {
if (!(flags & TTM_PL_FLAG_TT) && size > 256 * 1024)
nvbo->page_shift = dev_priv->bar1_vm->lpg_shift;
}

nouveau_bo_fixup_align(nvbo, flags, &align, &size);
align >>= PAGE_SHIFT;

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, nvbo->page_shift,
NV_MEM_ACCESS_RW, &nvbo->vma);
if (ret) {
kfree(nvbo);
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/gpu/drm/nouveau/nouveau_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ struct nouveau_bo {
struct nouveau_channel *channel;

struct nouveau_vma vma;
unsigned page_shift;

uint32_t tile_mode;
uint32_t tile_flags;
Expand Down
6 changes: 2 additions & 4 deletions trunk/drivers/gpu/drm/nouveau/nouveau_mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
int ret;

if (nvbo->tile_flags & NOUVEAU_GEM_TILE_NONCONTIG)
size_nc = 1 << nvbo->vma.node->type;
size_nc = 1 << nvbo->page_shift;

ret = vram->get(dev, mem->num_pages << PAGE_SHIFT,
mem->page_alignment << PAGE_SHIFT, size_nc,
Expand All @@ -804,9 +804,7 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man,
return (ret == -ENOSPC) ? 0 : ret;
}

node->page_shift = 12;
if (nvbo->vma.node)
node->page_shift = nvbo->vma.node->type;
node->page_shift = nvbo->page_shift;

mem->mm_node = node;
mem->start = node->offset >> PAGE_SHIFT;
Expand Down

0 comments on commit db4ffd0

Please sign in to comment.