From: Jerome Glisse Subject: Re: [PATCH] drm/ttm: Only try to preserve caching in moves in the same space Date: Mon, 1 Feb 2010 18:05:18 +0100 Message-ID: <4240b9161002010905q22580b60w10b7d4ffc531494a@mail.gmail.com> References: <1264670799-16101-1-git-send-email-luca@luca-barbieri.com> <21d7e9971001311735q3718ad8dy5298f19175a79a6e@mail.gmail.com> <20100201133317.GH29000@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.sourceforge.net To: Luca Barbieri Cc: airlied@linux.ie, thellstrom@vmware.com, dri-devel@lists.sourceforge.net List-Id: dri-devel@lists.freedesktop.org On Mon, Feb 1, 2010 at 5:26 PM, Luca Barbieri wrote: > I see a problem with this. > > If you have uncached TT (e.g. AGP) you want to get uncached for > TT->SYSTEM, but you want cached for VRAM->SYSTEM. > If you set SYSTEM to uncached, then VRAM->SYSTEM will broken, and if > you set SYSTEM to cached, TT->SYSTEM will be broken. > If you set to uncached | cached, VRAM->SYSTEM will still be broken > because it will choose uncached. > > You would need to make the proposed placement conditional on the > current BO memory type, which is possible but somewhat defeats the > purpose of having all the ttm_bo_mem_space logic in ttm. > > Perhaps this doesn't usually happen because you would do VRAM->TT > instead of SYSTEM (is that really always the case? what if we don't > have enough space in GART?), but it seems a design deficiency in TTM > anyway. > The current placement caching should not really be a factor *unless* > we can actually do the move just by changing the caching attributes. > > What do you think? > > Of course we could also just drop ttm_bo_mem_space and let the driver > do that itself (perhaps using hardcorded helpers for the AGP and PCIE > case). It seems quite a radical solution though. > I assumed that VRAM<->SYSTEM always did go through TT (which is the case for radeon and i think for nouveau too, haven't checked :)). Assuming we have a system which can do VRAM<->SYSTEM directly and which is AGP, what you can do is : agp_caching_mask=UC and each time you do ask for a bo move you & the caching flags with agp_caching_mask, then you do SYSTEM.default_caching=CACHED You endup : VRAM->SYSTEM proposed_flags = SYSTEM.default_caching which is picking cached: TT->SYSTEM proposed_flags = SYSTEM.default_caching & agp_caching_mask so you endup keeping uncached VRAM->TT proposed_flags = TT.default_caching(=UC) & agp_caching_mask Idea is to mask all move which involve TT (AGP) with the agp_caching_mask, it's easy to do in radeon ttm layer code and i believe it's easy to do in nouveau too. On non AGP you set agp_caching_mask to UC|WC|CACHED. Anyway i think here the issue is more in ttm_tt_set_placement_caching which favor WC over UC and UC over cached, Thomas maybe you can enlight us on this ? If we change it to choose in this order : CACHED,WC,UC i think it would be easier (well it's not that hard anyway ;)) for the driver to tweak it's caching flags. Cheers, Jerome ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com --