From patchwork Thu Mar 19 04:33:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 6045991 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0120F9F2A9 for ; Thu, 19 Mar 2015 04:34:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D7F0204D3 for ; Thu, 19 Mar 2015 04:34:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2FE92204B0 for ; Thu, 19 Mar 2015 04:34:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 066966E969; Wed, 18 Mar 2015 21:34:13 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by gabe.freedesktop.org (Postfix) with ESMTP id CB6D96E964 for ; Wed, 18 Mar 2015 21:34:09 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id A393E600621 From: Daniel Stone To: dri-devel@lists.freedesktop.org Subject: [RFC PATCH 33/37] drm: i915/tegra: atomic: Reference, not duplicate, modes Date: Thu, 19 Mar 2015 04:33:32 +0000 Message-Id: <1426739616-10635-33-git-send-email-daniels@collabora.com> X-Mailer: git-send-email 2.3.2 In-Reply-To: <1426739616-10635-1-git-send-email-daniels@collabora.com> References: <1426739556-10429-1-git-send-email-daniels@collabora.com> <1426739616-10635-1-git-send-email-daniels@collabora.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_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 Take a reference to existing modes, rather than duplicating them to create new ones. Signed-off-by: Daniel Stone --- drivers/gpu/drm/i915/intel_atomic.c | 8 ++------ drivers/gpu/drm/tegra/dc.c | 11 ++--------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c index 80cb562..8b80a54 100644 --- a/drivers/gpu/drm/i915/intel_atomic.c +++ b/drivers/gpu/drm/i915/intel_atomic.c @@ -227,12 +227,8 @@ intel_crtc_duplicate_state(struct drm_crtc *crtc) crtc_state->base.crtc = crtc; - if (intel_crtc->config && intel_crtc->config->mode) { - crtc_state->mode = - drm_mode_duplicate(crtc->dev, intel_crtc->config->mode); - if (!crtc_state->mode) - goto err; - } + if (crtc_state->base.mode) + drm_mode_reference(crtc_state->base.mode); return &crtc_state->base; err: diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 4dd51fe..888fcbd 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1018,12 +1018,8 @@ tegra_crtc_atomic_duplicate_state(struct drm_crtc *crtc) if (!copy) return NULL; - if (state->base.mode) { - copy->base.mode = - drm_mode_duplicate(crtc->dev, state->base.mode); - if (!copy->base.mode) - goto err; - } + if (copy->base.mode) + drm_mode_reference(copy->base.mode); copy->base.mode_changed = false; copy->base.active_changed = false; @@ -1031,9 +1027,6 @@ tegra_crtc_atomic_duplicate_state(struct drm_crtc *crtc) copy->base.event = NULL; return ©->base; -err: - kfree(copy); - return NULL; } static void tegra_crtc_atomic_destroy_state(struct drm_crtc *crtc,