From patchwork Fri Oct 12 23:58:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 1588491 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 484D13FD9C for ; Fri, 12 Oct 2012 23:59:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752809Ab2JLX7Q (ORCPT ); Fri, 12 Oct 2012 19:59:16 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:46457 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751437Ab2JLX7Q (ORCPT ); Fri, 12 Oct 2012 19:59:16 -0400 Received: by mail-ob0-f174.google.com with SMTP id uo13so3374903obb.19 for ; Fri, 12 Oct 2012 16:59:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=e74S0BF/vT+VosV/UbRyFWcu/YsK4cPogFlWvUkc2hg=; b=oqeTmhP1/ZsRumVJXFKoXkLI0N8ReGrN6xmdZR9ED8FtTkPjSuzR36nP+M/mu9mgGV u4S3PexnfT8MLqab2p7SgLtdNU/XG5UQQelyjzhnBG2b07cT5lPTN+76r5enenkPyn9X vlyXWkSkiYs9XPJB95kRNU7fSU7fAEszK0iKfL1eFTEqPhzJlicWBXXv7xjIkKuf2qeD rD/r8g0gNU3+vyJKY7Zr0rdOaP45h0VoR/gUBoi3qWs5awxgU7Hgc2OvptriyxT3Ga/e 7R/fw9XgahonO2jKZEWTNs430pWGo8Q40IuWkNPDY0ypuVQV/Sf+eqcwF/J0jjrEdTG2 /ixw== Received: by 10.60.170.109 with SMTP id al13mr4684953oec.126.1350086355714; Fri, 12 Oct 2012 16:59:15 -0700 (PDT) Received: from localhost (ppp-70-129-143-201.dsl.rcsntx.swbell.net. [70.129.143.201]) by mx.google.com with ESMTPS id f3sm5140200obz.8.2012.10.12.16.59.14 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Oct 2012 16:59:15 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org, linux-omap@vger.kernel.org Cc: patches@linaro.org, Greg KH , Tomi Valkeinen , Andy Gross , Rob Clark Subject: [PATCH] drm/omap: fix issue w/ fb attached to multiple CRTCs Date: Fri, 12 Oct 2012 18:58:02 -0500 Message-Id: <1350086282-12463-1-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Rob Clark When the fb is detached from one CRTC/plane, paddr was set back to zero. But really we don't want to do this because the fb could still be attached to other CRTC/plane(s). This originally worked like this to catch cases of freeing a pinned fb (but with the refcnt'ing this should no longer be needed). Also, there is checking in the GEM code for freeing a pinned GEM object, so this extra level of checking is redundant. Signed-off-by: Rob Clark --- drivers/staging/omapdrm/omap_fb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/omapdrm/omap_fb.c b/drivers/staging/omapdrm/omap_fb.c index 446801d..75d2ff1 100644 --- a/drivers/staging/omapdrm/omap_fb.c +++ b/drivers/staging/omapdrm/omap_fb.c @@ -253,6 +253,7 @@ int omap_framebuffer_replace(struct drm_framebuffer *a, int ret = 0, i, na, nb; struct omap_framebuffer *ofba = to_omap_framebuffer(a); struct omap_framebuffer *ofbb = to_omap_framebuffer(b); + uint32_t pinned_mask = 0; na = a ? drm_format_num_planes(a->pixel_format) : 0; nb = b ? drm_format_num_planes(b->pixel_format) : 0; @@ -263,25 +264,24 @@ int omap_framebuffer_replace(struct drm_framebuffer *a, pa = (i < na) ? &ofba->planes[i] : NULL; pb = (i < nb) ? &ofbb->planes[i] : NULL; - if (pa) { + if (pa) unpin(arg, pa->bo); - pa->paddr = 0; - } if (pb && !ret) { ret = omap_gem_get_paddr(pb->bo, &pb->paddr, true); - if (!ret) + if (!ret) { omap_gem_dma_sync(pb->bo, DMA_TO_DEVICE); + pinned_mask |= (1 << i); + } } } if (ret) { /* something went wrong.. unpin what has been pinned */ for (i = 0; i < nb; i++) { - struct plane *pb = &ofba->planes[i]; - if (pb->paddr) { + if (pinned_mask & (1 << i)) { + struct plane *pb = &ofba->planes[i]; unpin(arg, pb->bo); - pb->paddr = 0; } } }