From patchwork Wed Jul 17 13:07:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Egbert Eich X-Patchwork-Id: 2828596 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5075D9F967 for ; Wed, 17 Jul 2013 13:17:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9DAE820190 for ; Wed, 17 Jul 2013 13:17:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EC59020186 for ; Wed, 17 Jul 2013 13:17:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF37243692 for ; Wed, 17 Jul 2013 06:17:34 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by gabe.freedesktop.org (Postfix) with ESMTP id F33B0E6716 for ; Wed, 17 Jul 2013 06:07:55 -0700 (PDT) Received: from debian (p5DCF2FCF.dip0.t-ipconnect.de [93.207.47.207]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0M15EC-1UAmmT3dY8-00tDwG; Wed, 17 Jul 2013 15:07:50 +0200 Received: from sles11.fritz.box (sles11.fritz.box [192.168.178.22]) by debian (Postfix) with ESMTP id 0A68C13C78; Wed, 17 Jul 2013 15:07:47 +0200 (CEST) From: Egbert Eich To: dri-devel@lists.freedesktop.org Subject: [PATCH 06/16] drm/mgag200: Fix logic in mgag200_bo_pin() Date: Wed, 17 Jul 2013 15:07:19 +0200 Message-Id: <1374066449-21714-7-git-send-email-eich@suse.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1374066449-21714-1-git-send-email-eich@suse.com> References: <1374066449-21714-1-git-send-email-eich@suse.com> X-Provags-ID: V02:K0:3xAhUdpSG4z06JZloXpdMvrJ9kfhoa+sdST0cSyFoDK 8BRq/GyGyO4KUbY06x6a0m7nvFXKokyfXgz9kXQqEhhPZ9suPK M0LPwsl7umNVOcXodlfj9XaYp7Rr+gR4IHNeqQXO2GjfCjCFO5 XkhnkVsqqFqw3E9/a4b+wjbIVIN4f9r/8TDPOO3Om4K68ZhXbn +ZWhT5rY5hQWfCxBGs3GlCA0UQyM8Dzb/HqiCj+yw/baKXFHl6 GVvQ4DvK8OzqKL8+qLxrdCmHJJo7gLAg7rX541bcdgoy64i/VP RZCkMrvVEtrYEgTDLqluN89+HNUAyoolPBFBl8pOOL4Oe0GDl0 TzUMXrohJz0KZYY1v/3pTlnXpuTaNEk2CKwMMy10n Cc: Egbert Eich , Egbert Eich , Mathieu Larouche , Dave Airlie , Christopher Harvey 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 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Egbert Eich --- drivers/gpu/drm/mgag200/mgag200_ttm.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/mgag200/mgag200_ttm.c b/drivers/gpu/drm/mgag200/mgag200_ttm.c index 6461fd2..2606031 100644 --- a/drivers/gpu/drm/mgag200/mgag200_ttm.c +++ b/drivers/gpu/drm/mgag200/mgag200_ttm.c @@ -350,20 +350,16 @@ int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr) { int i, ret; - if (bo->pin_count) { - bo->pin_count++; - if (gpu_addr) - *gpu_addr = mgag200_bo_gpu_offset(bo); - } - - mgag200_ttm_placement(bo, pl_flag); - for (i = 0; i < bo->placement.num_placement; i++) - bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; - ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); - if (ret) - return ret; - bo->pin_count = 1; + if (!bo->pin_count) { + mgag200_ttm_placement(bo, pl_flag); + for (i = 0; i < bo->placement.num_placement; i++) + bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; + ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false); + if (ret) + return ret; + } + bo->pin_count++; if (gpu_addr) *gpu_addr = mgag200_bo_gpu_offset(bo); return 0;