[PATCH] drm/radeon/bo: add some fallback placements for VRAM only objects. (v2)

Michel Dänzer michel at daenzer.net
Tue Apr 27 03:25:38 PDT 2010


On Die, 2010-04-27 at 20:14 +1000, Dave Airlie wrote: 
> 2010/4/27 Michel Dänzer <michel at daenzer.net>:
> > [ Moving to the new list ]
> >
> > On Die, 2010-04-27 at 12:34 +1000, Dave Airlie wrote:
> >> From: Dave Airlie <airlied at redhat.com>
> >>
> >> On constrained r100 systems compiz would fail to start due to a lack
> >> of memory, we can just fallback place the objects rather than completely
> >> failing it works a lot better.
> >>
> >> v2:
> >> fixes issue identified by Michel when pinning could happen in a busy placement domain.
> >
> > [...]
> >
> >
> >> diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
> >> index 6a8617b..ab3bc7b 100644
> >> --- a/drivers/gpu/drm/radeon/radeon_object.c
> >> +++ b/drivers/gpu/drm/radeon/radeon_object.c
> >> @@ -64,17 +64,21 @@ bool radeon_ttm_bo_is_radeon_bo(struct ttm_buffer_object *bo)
> >>       return false;
> >>  }
> >>
> >> -void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
> >> +void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain, bool pinned)
> >>  {
> >> -     u32 c = 0;
> >> +     u32 c = 0, b = 0;
> >>
> >>       rbo->placement.fpfn = 0;
> >>       rbo->placement.lpfn = 0;
> >>       rbo->placement.placement = rbo->placements;
> >> -     rbo->placement.busy_placement = rbo->placements;
> >> +     rbo->placement.busy_placement = rbo->busy_placements;
> >>       if (domain & RADEON_GEM_DOMAIN_VRAM)
> >>               rbo->placements[c++] = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED |
> >>                                       TTM_PL_FLAG_VRAM;
> >> +     /* add busy placement to TTM if VRAM is only option */
> >> +     if (domain == RADEON_GEM_DOMAIN_VRAM && pinned == false) {
> >> +             rbo->busy_placements[b++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT;
> >> +     }
> >>       if (domain & RADEON_GEM_DOMAIN_GTT)
> >>               rbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT;
> >>       if (domain & RADEON_GEM_DOMAIN_CPU)
> >> @@ -82,7 +86,7 @@ void radeon_ttm_placement_from_domain(struct radeon_bo *rbo, u32 domain)
> >>       if (!c)
> >>               rbo->placements[c++] = TTM_PL_MASK_CACHING | TTM_PL_FLAG_SYSTEM;
> >>       rbo->placement.num_placement = c;
> >> -     rbo->placement.num_busy_placement = c;
> >> +     rbo->placement.num_busy_placement = b;
> >>  }
> >>
> >>  int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
> >
> > BTW, this means there won't be any busy placements if (domain !=
> > RADEON_GEM_DOMAIN_VRAM || pinned). Not sure if that's a problem.
> >
> 
> Well there isn't really anywhere else to put things, I don't think
> falling GTT back to VRAM will ever be a case we have to worry about as
> much, its not like should be pinning anything major in GTT especially
> in the middle.
> 
> Falling back to system placement would sort of suck since the GPU
> can't access it.

Sure, but then the busy placements in the existing code would seem
redundant as well, and I was wondering if there might have been a reason
for them to be there anyway.


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the dri-devel mailing list