From patchwork Tue Aug 9 10:15:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 9270779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 89BE66082E for ; Tue, 9 Aug 2016 10:15:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 796A325227 for ; Tue, 9 Aug 2016 10:15:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D91127F80; Tue, 9 Aug 2016 10:15:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2FFFB25227 for ; Tue, 9 Aug 2016 10:15:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 18C436E3A9; Tue, 9 Aug 2016 10:15:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 06F56894E0; Tue, 9 Aug 2016 10:15:54 +0000 (UTC) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 09 Aug 2016 03:15:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,494,1464678000"; d="scan'208"; a="1022253172" Received: from ypreisle-mobl1.ger.corp.intel.com (HELO patser.lan) ([10.252.1.195]) by fmsmga001.fm.intel.com with ESMTP; 09 Aug 2016 03:15:54 -0700 Subject: [PATCH 2/2] drm/i915: Drop reference to plane state wait req in destructor. To: Keith Packard , Daniel Vetter References: <1470655403-24036-1-git-send-email-maarten.lankhorst@linux.intel.com> <1470655403-24036-3-git-send-email-maarten.lankhorst@linux.intel.com> <86oa53jm6k.fsf@hiro.keithp.com> From: Maarten Lankhorst Message-ID: <221af8c6-3c2b-ca59-16a3-ff14e17bdde6@linux.intel.com> Date: Tue, 9 Aug 2016 12:15:51 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <86oa53jm6k.fsf@hiro.keithp.com> Cc: Daniel Vetter , intel-gfx , dri-devel 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP With gem requests reworked to only keep some memory around after it's completed it's now mostly harmless to keep a reference to the request until the state is destroyed. This makes it easy to hang on to the request until the plane state is destroyed since it is just a bunch of memory now. On my 64-bits system a i915_gem_request is 352 bytes. With all 3 crtc's, each 4 planes enabled the total is 4224 bytes, low enough not to optimize this case too much. Signed-off-by: Maarten Lankhorst Cc: Keith Packard Cc: Daniel Vetter Cc: David Airlie Cc: intel-gfx@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Fixes: 849782575325 ("drm/i915: cleanup_plane_fb: also drop reference to current state wait_req") Reviewed-by: Daniel Vetter --- drivers/gpu/drm/i915/intel_atomic_plane.c | 5 ++++- drivers/gpu/drm/i915/intel_display.c | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c index 7de7721f65bc..f98071a1dcc0 100644 --- a/drivers/gpu/drm/i915/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c @@ -101,7 +101,10 @@ void intel_plane_destroy_state(struct drm_plane *plane, struct drm_plane_state *state) { - WARN_ON(state && to_intel_plane_state(state)->wait_req); + struct intel_plane_state *intel_state = to_intel_plane_state(state); + + i915_gem_request_assign(&intel_state->wait_req, NULL); + drm_atomic_helper_plane_destroy_state(plane, state); } diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index af45ee206239..774895288bcc 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -14063,17 +14063,11 @@ intel_cleanup_plane_fb(struct drm_plane *plane, const struct drm_plane_state *old_state) { struct drm_device *dev = plane->dev; - struct intel_plane_state *intel_state = to_intel_plane_state(plane->state); struct drm_i915_gem_object *old_obj = intel_fb_obj(old_state->fb); - struct intel_plane_state *old_intel_state = - to_intel_plane_state(old_state); if (old_obj && (plane->type != DRM_PLANE_TYPE_CURSOR || !INTEL_INFO(dev)->cursor_needs_physical)) intel_unpin_fb_obj(old_state->fb, old_state->rotation); - - i915_gem_request_assign(&intel_state->wait_req, NULL); - i915_gem_request_assign(&old_intel_state->wait_req, NULL); } int