From patchwork Wed Nov 28 15:05:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 1818281 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 24C4BDF230 for ; Wed, 28 Nov 2012 20:11:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 091A7E63F3 for ; Wed, 28 Nov 2012 12:11:55 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-gg0-f177.google.com (mail-gg0-f177.google.com [209.85.161.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 44902E63F3 for ; Wed, 28 Nov 2012 12:07:29 -0800 (PST) Received: by mail-gg0-f177.google.com with SMTP id y3so2233956ggc.36 for ; Wed, 28 Nov 2012 12:07:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=VKwkl7SL7HvDifBDzxeoheMotMhhiYp3LfvSRp8e8vc=; b=nbGOGwJUuyIQbgmf84FPs4NF3kn6XyuhjR7UhqWaCfaAJIPQaZTh5btEkKyZXUGRwg NZZNC1TkgqUGhZrwLfA4JJ9pvxtgwLSfeT4+HGuayj4jaAzSyH5KcayW+MKnowqoWqIq q7bGb0rPFgHf7VxSvq7m9qCfmznn2l0RCjbXtc3RzkZAlgn+dHZQIcIC+Ym92esDPl0E xDVlvv+U7I9L5fXYEQdmaku7Un/uAhoIhZGSWu4pGXXfTnlhNfPtPtSAarnH2EY+VPk6 xVVqRExD9Zv+bikeZ6fDlRCo8jA7Lwf+W5Es+vLsztQnoDqMnKVi8BCnCjtiitORU3aO AaIg== Received: by 10.236.9.104 with SMTP id 68mr20404700yhs.89.1354133248722; Wed, 28 Nov 2012 12:07:28 -0800 (PST) Received: from homer.localdomain.com ([66.187.233.206]) by mx.google.com with ESMTPS id z11sm20273235anj.13.2012.11.28.12.07.27 (version=SSLv3 cipher=OTHER); Wed, 28 Nov 2012 12:07:27 -0800 (PST) From: j.glisse@gmail.com To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/ttm: do not try to preserve caching state Date: Wed, 28 Nov 2012 10:05:48 -0500 Message-Id: <1354115148-27766-1-git-send-email-j.glisse@gmail.com> X-Mailer: git-send-email 1.7.11.7 Cc: Jerome Glisse X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: Jerome Glisse It make no sense to preserve caching state especialy when moving from vram to system. It burden the page allocator to match the vram caching (often WC) which just burn CPU cycle for no good reasons. Signed-off-by: Jerome Glisse --- drivers/gpu/drm/ttm/ttm_bo.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index bf6e4b5..39dcc58 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -896,19 +896,12 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo, } static uint32_t ttm_bo_select_caching(struct ttm_mem_type_manager *man, - uint32_t cur_placement, uint32_t proposed_placement) { uint32_t caching = proposed_placement & TTM_PL_MASK_CACHING; uint32_t result = proposed_placement & ~TTM_PL_MASK_CACHING; - /** - * Keep current caching if possible. - */ - - if ((cur_placement & caching) != 0) - result |= (cur_placement & caching); - else if ((man->default_caching & caching) != 0) + if ((man->default_caching & caching) != 0) result |= man->default_caching; else if ((TTM_PL_FLAG_CACHED & caching) != 0) result |= TTM_PL_FLAG_CACHED; @@ -978,8 +971,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, if (!type_ok) continue; - cur_flags = ttm_bo_select_caching(man, bo->mem.placement, - cur_flags); + cur_flags = ttm_bo_select_caching(man, cur_flags); /* * Use the access and other non-mapping-related flag bits from * the memory placement flags to the current flags @@ -1023,8 +1015,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, &cur_flags)) continue; - cur_flags = ttm_bo_select_caching(man, bo->mem.placement, - cur_flags); + cur_flags = ttm_bo_select_caching(man, cur_flags); /* * Use the access and other non-mapping-related flag bits from * the memory placement flags to the current flags