From patchwork Thu Mar 8 06:06:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharat Masetty X-Patchwork-Id: 10266571 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 08C3860594 for ; Thu, 8 Mar 2018 06:07:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDE4D29747 for ; Thu, 8 Mar 2018 06:07:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2F512974E; Thu, 8 Mar 2018 06:07:08 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 57F6C29747 for ; Thu, 8 Mar 2018 06:07:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7DE156E285; Thu, 8 Mar 2018 06:07:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 18D896E20C; Thu, 8 Mar 2018 06:07:01 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C56A460867; Thu, 8 Mar 2018 06:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520489220; bh=yaNTSQKeP3Q/BffOvKUtAnOzB0uLq3FaKCAKpqx2qAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=le6lgKq3wSPpytYrMTKWV1xummctUiW17DNDYIcpHUaKOnu3FIn3ZmNSw+PxcwCEp Wos07+FNvznOcIdBetE0uuPtmUC2DJ1+FIK4QpY4OUqCgwMXCDzZjshM/B1Afq0yrm RMZ/YZxyzIWpV8FRFSSMwbgvD0z1JpK14Lr6A+lU= Received: from smasetty-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: smasetty@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E00176076C; Thu, 8 Mar 2018 06:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520489220; bh=yaNTSQKeP3Q/BffOvKUtAnOzB0uLq3FaKCAKpqx2qAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=le6lgKq3wSPpytYrMTKWV1xummctUiW17DNDYIcpHUaKOnu3FIn3ZmNSw+PxcwCEp Wos07+FNvznOcIdBetE0uuPtmUC2DJ1+FIK4QpY4OUqCgwMXCDzZjshM/B1Afq0yrm RMZ/YZxyzIWpV8FRFSSMwbgvD0z1JpK14Lr6A+lU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E00176076C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=smasetty@codeaurora.org From: Sharat Masetty To: freedreno@lists.freedesktop.org Subject: [PATCH 1/6] drm/msm: Add submitqueue setup and close Date: Thu, 8 Mar 2018 11:36:20 +0530 Message-Id: <1520489185-21828-2-git-send-email-smasetty@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520489185-21828-1-git-send-email-smasetty@codeaurora.org> References: <1520489185-21828-1-git-send-email-smasetty@codeaurora.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, Sharat Masetty , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a bit of infrastructure to give the different Adreno targets the flexibility to setup the submitqueues per their needs. Signed-off-by: Sharat Masetty --- drivers/gpu/drm/msm/msm_gpu.h | 7 +++++++ drivers/gpu/drm/msm/msm_submitqueue.c | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index b824117..b9b86ef 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -69,6 +69,10 @@ struct msm_gpu_funcs { int (*debugfs_init)(struct msm_gpu *gpu, struct drm_minor *minor); #endif int (*gpu_busy)(struct msm_gpu *gpu, uint64_t *value); + int (*submitqueue_setup)(struct msm_gpu *gpu, + struct msm_gpu_submitqueue *queue); + void (*submitqueue_close)(struct msm_gpu *gpu, + struct msm_gpu_submitqueue *queue); }; struct msm_gpu { @@ -173,6 +177,9 @@ struct msm_gpu_submitqueue { int faults; struct list_head node; struct kref ref; + struct msm_gpu *gpu; + struct drm_gem_object *bo; + uint64_t bo_iova; }; static inline void gpu_write(struct msm_gpu *gpu, u32 reg, u32 data) diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c index 5115f75..1e696da 100644 --- a/drivers/gpu/drm/msm/msm_submitqueue.c +++ b/drivers/gpu/drm/msm/msm_submitqueue.c @@ -18,6 +18,10 @@ void msm_submitqueue_destroy(struct kref *kref) { struct msm_gpu_submitqueue *queue = container_of(kref, struct msm_gpu_submitqueue, ref); + struct msm_gpu *gpu = queue->gpu; + + if (gpu && gpu->funcs->submitqueue_close) + gpu->funcs->submitqueue_close(gpu, queue); kfree(queue); } @@ -65,6 +69,7 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx, { struct msm_drm_private *priv = drm->dev_private; struct msm_gpu_submitqueue *queue; + struct msm_gpu *gpu = priv->gpu; if (!ctx) return -ENODEV; @@ -77,11 +82,14 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx, kref_init(&queue->ref); queue->flags = flags; - if (priv->gpu) { - if (prio >= priv->gpu->nr_rings) + if (gpu) { + if (prio >= gpu->nr_rings) { + kfree(queue); return -EINVAL; + } queue->prio = prio; + queue->gpu = gpu; } write_lock(&ctx->queuelock); @@ -95,6 +103,9 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx, write_unlock(&ctx->queuelock); + if (gpu && gpu->funcs->submitqueue_setup) + gpu->funcs->submitqueue_setup(gpu, queue); + return 0; }