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: 1588501 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id D6C123FD9C for ; Fri, 12 Oct 2012 23:59:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD9E59E9BE for ; Fri, 12 Oct 2012 16:59:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ob0-f177.google.com (mail-ob0-f177.google.com [209.85.214.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 18D309E77C for ; Fri, 12 Oct 2012 16:59:16 -0700 (PDT) Received: by mail-ob0-f177.google.com with SMTP id wd20so3542569obb.36 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 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 Cc: Greg KH , Tomi Valkeinen , Rob Clark , patches@linaro.org 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: 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; } } }