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: 12195 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 93A0D23E29 for ; Fri, 12 Oct 2012 23:59:17 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 213CFA189C7 for ; Fri, 12 Oct 2012 23:59:17 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so2381526iag.11 for ; Fri, 12 Oct 2012 16:59:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=e74S0BF/vT+VosV/UbRyFWcu/YsK4cPogFlWvUkc2hg=; b=R2I75lioznpm+ofJZ9KiEkYjRDGm1g0j7osNYEd46ctwAW+YcB2IVdbo5WakGS2tom Wq/lC3fRTISjW2JdU5MrbNl/tJMQPy3vw2J/8DHexeqzjzzOAHcF3ZjkLdy8I7XthfjO 2pO9zCObLFLXo9NyHqcEasBfJJn9y3vVbTFKmGIuKMhgsdz5FLry/BD8WaszTw7x5gUM TbbDddTta8S3992jucnWSkgXcjvGLVQfZ5CkVbsETjp+IWPM8f3UUwEf6K6rYtKI7spz sWOx88BnaaLUZJGUKFhOOu5RtBZMfFhtF+EO4me54Sk/9ANfR/X9Nzsp/QCEPl1d0Xrw Mq6g== Received: by 10.50.87.134 with SMTP id ay6mr3530935igb.70.1350086356605; Fri, 12 Oct 2012 16:59:16 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp270729igt; Fri, 12 Oct 2012 16:59:16 -0700 (PDT) Received: by 10.182.64.101 with SMTP id n5mr4719016obs.11.1350086355905; Fri, 12 Oct 2012 16:59:15 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id 7si9699172oek.55.2012.10.12.16.59.15 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Oct 2012 16:59:15 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-ob0-f178.google.com with SMTP id tb18so4131298obb.37 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) Sender: Rob Clark 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 X-Gm-Message-State: ALoCoQlxaILLMow8UQBIV3HvMEZJ8UqYJFhESaToDWFXy2UFmQ0potpl+RF7HoM1rYTmhAfe5JBH 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; } } }