From patchwork Mon Jul 1 06:26:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Manna, Animesh" X-Patchwork-Id: 11025077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7446746 for ; Mon, 1 Jul 2019 06:34:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC37128329 for ; Mon, 1 Jul 2019 06:34:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0F96284DA; Mon, 1 Jul 2019 06:34:38 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham 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 8531428329 for ; Mon, 1 Jul 2019 06:34:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D5B089F69; Mon, 1 Jul 2019 06:34:38 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5E91A89F69 for ; Mon, 1 Jul 2019 06:34:36 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jun 2019 23:34:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,437,1557212400"; d="scan'208";a="153988740" Received: from amanna.iind.intel.com ([10.223.74.216]) by orsmga007.jf.intel.com with ESMTP; 30 Jun 2019 23:34:34 -0700 From: Animesh Manna To: intel-gfx@lists.freedesktop.org Date: Mon, 1 Jul 2019 11:56:28 +0530 Message-Id: <20190701062632.456-12-animesh.manna@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190701062632.456-1-animesh.manna@intel.com> References: <20190701062632.456-1-animesh.manna@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 11/15] drm/i915/dsb: function to destroy DSB context. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jani Nikula Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Freed the gem object after completion of dsb workload. Cc: Shashank Sharma Cc: Jani Nikula Cc: Rodrigo Vivi Signed-off-by: Animesh Manna --- drivers/gpu/drm/i915/intel_dsb.c | 16 ++++++++++++++++ drivers/gpu/drm/i915/intel_dsb.h | 1 + 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/i915/intel_dsb.c b/drivers/gpu/drm/i915/intel_dsb.c index 0270f4fef600..dddaae27d7b5 100644 --- a/drivers/gpu/drm/i915/intel_dsb.c +++ b/drivers/gpu/drm/i915/intel_dsb.c @@ -233,3 +233,19 @@ void intel_dsb_commit(struct intel_dsb *dsb) dsb->free_pos = 0; intel_dsb_disable_engine(dsb); } + +void intel_dsb_put(struct intel_dsb *dsb) +{ + struct intel_crtc *crtc = dsb->crtc; + struct drm_i915_private *i915 = to_i915(crtc->base.dev); + struct i915_vma *vma = dsb->vma; + + if (dsb->cmd_buf) { + mutex_lock(&i915->drm.struct_mutex); + crtc->dsb_in_use--; + i915_gem_object_unpin_map(vma->obj); + i915_vma_unpin_and_release(&vma, 0); + dsb->cmd_buf = NULL; + mutex_unlock(&i915->drm.struct_mutex); + } +} diff --git a/drivers/gpu/drm/i915/intel_dsb.h b/drivers/gpu/drm/i915/intel_dsb.h index 7330add3c96f..7b94fd9bc067 100644 --- a/drivers/gpu/drm/i915/intel_dsb.h +++ b/drivers/gpu/drm/i915/intel_dsb.h @@ -43,5 +43,6 @@ struct intel_dsb * intel_dsb_get(struct intel_crtc *crtc); void intel_dsb_reg_write(struct intel_dsb *dsb, i915_reg_t reg, u32 val); void intel_dsb_commit(struct intel_dsb *dsb); +void intel_dsb_put(struct intel_dsb *dsb); #endif