On Don, 2010-12-09 at 20:19 +1000, Dave Airlie wrote: > 2010/12/9 Michel DÃnzer <michel@xxxxxxxxxxx>: > > On Fre, 2010-12-03 at 16:38 -0500, jglisse@xxxxxxxxxx wrote: > >> From: Jerome Glisse <jglisse@xxxxxxxxxx> > >> > >> Forbid allocating buffer bigger than visible VRAM or GTT, also > >> properly set lpfn field. > >> > >> v2 - use max macro > >> - silence warning > >> v3 - don't explicitly set range limit > >> - use min macro > >> > >> Cc: stable <stable@xxxxxxxxxx> > >> > >> Signed-off-by: Jerome Glisse <jglisse@xxxxxxxxxx> > >> --- > >> drivers/gpu/drm/radeon/radeon_object.c | 13 +++++++++++-- > >> 1 files changed, 11 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c > >> index 1d06774..a598d00 100644 > >> --- a/drivers/gpu/drm/radeon/radeon_object.c > >> +++ b/drivers/gpu/drm/radeon/radeon_object.c > >> @@ -104,6 +105,14 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, > >> } > >> *bo_ptr = NULL; > >> > >> + /* maximun bo size is the minimun btw visible vram and gtt size */ > >> + max_size = min(rdev->mc.visible_vram_size, rdev->mc.gtt_size); > >> + if ((page_align << PAGE_SHIFT) >= max_size) { > >> + printk(KERN_WARNING "%s:%d alloc size %ldM bigger than %ldMb limit\n", > >> + __func__, __LINE__, page_align >> (20 - PAGE_SHIFT), max_size >> 20); > >> + return -ENOMEM; > >> + } > > > > Still not sure this simple minimum is quite the right solution... e.g. > > if GTT is larger than visible VRAM, what's the problem with having a BO > > that fits in GTT but not in visible VRAM? On systems with 8 MB of VRAM, > > this will effectively limit the maximum texture size to 2048x1024. > > Just wondering if such a card exists, the only 8MB cards I know are > pre-r100, I think a 16MB M6 is the lowest one I can find. >From r100_vram_init_sizes(): rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); /* Some production boards of m6 will report 0 * if it's 8 MB */ if (rdev->mc.real_vram_size == 0) { rdev->mc.real_vram_size = 8192 * 1024; WREG32(RADEON_CONFIG_MEMSIZE, rdev->mc.real_vram_size); } -- Earthling Michel DÃnzer | http://www.vmware.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel