Skip to content

Commit

Permalink
drm/nouveau: pass gpuobj alignment request down into backing allocator
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Dec 3, 2010
1 parent 0541324 commit 9100468
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions drivers/gpu/drm/nouveau/nouveau_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ struct nouveau_instmem_engine {
void (*resume)(struct drm_device *dev);

int (*populate)(struct drm_device *, struct nouveau_gpuobj *,
uint32_t *size);
u32 *size, u32 align);
void (*clear)(struct drm_device *, struct nouveau_gpuobj *);
int (*bind)(struct drm_device *, struct nouveau_gpuobj *);
int (*unbind)(struct drm_device *, struct nouveau_gpuobj *);
Expand Down Expand Up @@ -1121,7 +1121,7 @@ extern void nv04_instmem_takedown(struct drm_device *);
extern int nv04_instmem_suspend(struct drm_device *);
extern void nv04_instmem_resume(struct drm_device *);
extern int nv04_instmem_populate(struct drm_device *, struct nouveau_gpuobj *,
uint32_t *size);
u32 *size, u32 align);
extern void nv04_instmem_clear(struct drm_device *, struct nouveau_gpuobj *);
extern int nv04_instmem_bind(struct drm_device *, struct nouveau_gpuobj *);
extern int nv04_instmem_unbind(struct drm_device *, struct nouveau_gpuobj *);
Expand All @@ -1133,7 +1133,7 @@ extern void nv50_instmem_takedown(struct drm_device *);
extern int nv50_instmem_suspend(struct drm_device *);
extern void nv50_instmem_resume(struct drm_device *);
extern int nv50_instmem_populate(struct drm_device *, struct nouveau_gpuobj *,
uint32_t *size);
u32 *size, u32 align);
extern void nv50_instmem_clear(struct drm_device *, struct nouveau_gpuobj *);
extern int nv50_instmem_bind(struct drm_device *, struct nouveau_gpuobj *);
extern int nv50_instmem_unbind(struct drm_device *, struct nouveau_gpuobj *);
Expand All @@ -1147,7 +1147,7 @@ extern void nvc0_instmem_takedown(struct drm_device *);
extern int nvc0_instmem_suspend(struct drm_device *);
extern void nvc0_instmem_resume(struct drm_device *);
extern int nvc0_instmem_populate(struct drm_device *, struct nouveau_gpuobj *,
uint32_t *size);
u32 *size, u32 align);
extern void nvc0_instmem_clear(struct drm_device *, struct nouveau_gpuobj *);
extern int nvc0_instmem_bind(struct drm_device *, struct nouveau_gpuobj *);
extern int nvc0_instmem_unbind(struct drm_device *, struct nouveau_gpuobj *);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/nouveau/nouveau_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ nouveau_gpuobj_new(struct drm_device *dev, struct nouveau_channel *chan,
NV_DEBUG(dev, "global heap\n");

/* allocate backing pages, sets vinst */
ret = engine->instmem.populate(dev, gpuobj, &size);
ret = engine->instmem.populate(dev, gpuobj, &size, align);
if (ret) {
nouveau_gpuobj_ref(NULL, &gpuobj);
return ret;
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/nouveau/nv04_instmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ nv04_instmem_takedown(struct drm_device *dev)

int
nv04_instmem_populate(struct drm_device *dev, struct nouveau_gpuobj *gpuobj,
uint32_t *sz)
u32 *size, u32 align)
{
return 0;
}
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/nouveau/nv50_instmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,19 +322,19 @@ nv50_instmem_resume(struct drm_device *dev)

int
nv50_instmem_populate(struct drm_device *dev, struct nouveau_gpuobj *gpuobj,
uint32_t *sz)
u32 *size, u32 align)
{
int ret;

if (gpuobj->im_backing)
return -EINVAL;

*sz = ALIGN(*sz, 4096);
if (*sz == 0)
*size = ALIGN(*size, 4096);
if (*size == 0)
return -EINVAL;

ret = nouveau_bo_new(dev, NULL, *sz, 0, TTM_PL_FLAG_VRAM, 0, 0x0000,
true, false, &gpuobj->im_backing);
ret = nouveau_bo_new(dev, NULL, *size, align, TTM_PL_FLAG_VRAM,
0, 0x0000, true, false, &gpuobj->im_backing);
if (ret) {
NV_ERROR(dev, "error getting PRAMIN backing pages: %d\n", ret);
return ret;
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/nouveau/nvc0_instmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@

int
nvc0_instmem_populate(struct drm_device *dev, struct nouveau_gpuobj *gpuobj,
uint32_t *size)
u32 *size, u32 align)
{
int ret;

*size = ALIGN(*size, 4096);
if (*size == 0)
return -EINVAL;

ret = nouveau_bo_new(dev, NULL, *size, 0, TTM_PL_FLAG_VRAM, 0, 0x0000,
true, false, &gpuobj->im_backing);
ret = nouveau_bo_new(dev, NULL, *size, align, TTM_PL_FLAG_VRAM,
0, 0x0000, true, false, &gpuobj->im_backing);
if (ret) {
NV_ERROR(dev, "error getting PRAMIN backing pages: %d\n", ret);
return ret;
Expand Down

0 comments on commit 9100468

Please sign in to comment.