From patchwork Sun Nov 3 03:00:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilija Hadzic X-Patchwork-Id: 3131951 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DAB79BEEB2 for ; Sun, 3 Nov 2013 02:57:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01C9E2034B for ; Sun, 3 Nov 2013 02:57:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 29D9420347 for ; Sun, 3 Nov 2013 02:57:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF104EDE21; Sat, 2 Nov 2013 19:57:22 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f41.google.com (mail-qa0-f41.google.com [209.85.216.41]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E81CEDE21 for ; Sat, 2 Nov 2013 19:57:20 -0700 (PDT) Received: by mail-qa0-f41.google.com with SMTP id f11so1436037qae.0 for ; Sat, 02 Nov 2013 19:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XsuVoauvKZc7miZxPM1wQWQU0Xn6JSqcMeYqoWfjKWg=; b=p/cCl5HMiIdl4psVEnIB7+9VujOVfBAtbRBTs+qkLJjbLKMBmcQIW+1I87IvmWQkm2 mgVgvyO9X8O2nIok/rZ+iSpvk+yPmDrWnOkXJegtv8yUgAvioKlwbxH6tHeUNG3qbFUB N3VbMMtmPUCOO6ZyHaKflMJhPzeq9HRNEkUltb41n14DDvOnWrM4o8rNTLQwxGJr6fvM ke5mWWnteLDZbDINYjpySEeq45WNvj1N+MI1X8HlnVeQAECqtxghwTisUKpwgmKCgF+U Bp9lUMqC7tRU69SMT9dPSmfvPQ9+9xGy3wxyLNp+lpeA89+PXy3e3eNo3MEmzYV6vGWN tgkA== X-Received: by 10.49.108.135 with SMTP id hk7mr13570075qeb.33.1383447440201; Sat, 02 Nov 2013 19:57:20 -0700 (PDT) Received: from caterpillar.hsd1.nj.comcast.net. (c-98-221-32-44.hsd1.nj.comcast.net. [98.221.32.44]) by mx.google.com with ESMTPSA id e7sm39060424qag.7.2013.11.02.19.57.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Nov 2013 19:57:19 -0700 (PDT) From: Ilija Hadzic To: alexdeucher@gmail.com, dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/radeon/kms: add crtc_disable function for legacy crtc Date: Sat, 2 Nov 2013 23:00:20 -0400 Message-Id: <1383447620-3329-3-git-send-email-ihadzic@research.bell-labs.com> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1383447620-3329-1-git-send-email-ihadzic@research.bell-labs.com> References: <1383447620-3329-1-git-send-email-ihadzic@research.bell-labs.com> Cc: Ilija Hadzic 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@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 To plug the VRAM memory leak (see previous patch for details) we must unpin the frame buffer when disabling the CRTC. This warrants the addition of disable function for legacy CRTC, which puts the CRTC in DPMS-OFF state and unpins the frame buffer if there is one associated with the CRTC. Signed-off-by: Ilija Hadzic --- drivers/gpu/drm/radeon/radeon_legacy_crtc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 7cb178a..0c7b8c6 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c @@ -1056,6 +1056,26 @@ static void radeon_crtc_commit(struct drm_crtc *crtc) } } +static void radeon_crtc_disable(struct drm_crtc *crtc) +{ + radeon_crtc_dpms(crtc, DRM_MODE_DPMS_OFF); + if (crtc->fb) { + int r; + struct radeon_framebuffer *radeon_fb; + struct radeon_bo *rbo; + + radeon_fb = to_radeon_framebuffer(crtc->fb); + rbo = gem_to_radeon_bo(radeon_fb->obj); + r = radeon_bo_reserve(rbo, false); + if (unlikely(r)) + DRM_ERROR("failed to reserve rbo before unpin\n"); + else { + radeon_bo_unpin(rbo); + radeon_bo_unreserve(rbo); + } + } +} + static const struct drm_crtc_helper_funcs legacy_helper_funcs = { .dpms = radeon_crtc_dpms, .mode_fixup = radeon_crtc_mode_fixup, @@ -1065,6 +1085,7 @@ static const struct drm_crtc_helper_funcs legacy_helper_funcs = { .prepare = radeon_crtc_prepare, .commit = radeon_crtc_commit, .load_lut = radeon_crtc_load_lut, + .disable = radeon_crtc_disable };