From patchwork Mon Feb 26 07:38: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: 10241331 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 8A2E6602DC for ; Mon, 26 Feb 2018 07:39:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67E4929307 for ; Mon, 26 Feb 2018 07:39:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59B8D2998A; Mon, 26 Feb 2018 07:39:16 +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 049C229352 for ; Mon, 26 Feb 2018 07:39:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 693F56E0EE; Mon, 26 Feb 2018 07:39:12 +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 9E0A46E10A; Mon, 26 Feb 2018 07:39:10 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 89F966095F; Mon, 26 Feb 2018 07:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519630750; bh=yaNTSQKeP3Q/BffOvKUtAnOzB0uLq3FaKCAKpqx2qAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b36olYUCjo8gpadLZth+PXI14e6Pc5ZqwqU7sgA9BJOu02DPEkp2TeufwybHW3Xqw KwFXR5MLvO2aVFIX5WtZGHib/eUHQEF9uIBQ3FYKwRyd29wDtT07s7BajpyCCQcqJp OHeH7nr5+RB82mXl0J/sh+HT4xL19xSYn+XpkVc0= 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 C80B46021C; Mon, 26 Feb 2018 07:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1519630750; bh=yaNTSQKeP3Q/BffOvKUtAnOzB0uLq3FaKCAKpqx2qAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b36olYUCjo8gpadLZth+PXI14e6Pc5ZqwqU7sgA9BJOu02DPEkp2TeufwybHW3Xqw KwFXR5MLvO2aVFIX5WtZGHib/eUHQEF9uIBQ3FYKwRyd29wDtT07s7BajpyCCQcqJp OHeH7nr5+RB82mXl0J/sh+HT4xL19xSYn+XpkVc0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C80B46021C 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/4] drm/msm: Add submitqueue setup and close Date: Mon, 26 Feb 2018 13:08:20 +0530 Message-Id: <1519630703-2957-2-git-send-email-smasetty@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519630703-2957-1-git-send-email-smasetty@codeaurora.org> References: <1519630703-2957-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 Reviewed-by: Jordan Crouse --- 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; }