From patchwork Sun Nov 5 11:01:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Perttunen X-Patchwork-Id: 10042093 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 33CA160244 for ; Sun, 5 Nov 2017 11:23:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13305292C1 for ; Sun, 5 Nov 2017 11:23:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 07E24292E1; Sun, 5 Nov 2017 11:23: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 745BE292D1 for ; Sun, 5 Nov 2017 11:23:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB69C6E0FE; Sun, 5 Nov 2017 11:23:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kapsi.fi (mail.kapsi.fi [IPv6:2001:67c:1be8::25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5D7FD6E0FE for ; Sun, 5 Nov 2017 11:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=82mMQXgPlGREsatuWJePx8EKYVq5WoTlYOgHIE00bQc=; b=o4t/WjOrZ50+rVT7ftUETcv9rocuJkxHvI6QK1jWVjFNQiqmhllqtVq+EMR8ui2xxM5/0h8wRsCs34uSjUynylRc9T1B83hOeJ1T+LUilZIcdXuqj24Eo6mWTK+cqvs/bqQiCswTmDIAWw+SIoDs8JfIxWI7IGF+K0iC9rafaKFDTYYc0xPGlINu64Sy5xUNtgBqcAfI7dd5iwQxzMWKiBhMWQj5Vli7N1LJtFJpOlTuYgUuxOYCv51dIT1XgWcrEe0q5B2zvd8ZKaSURO1j/Q4jTEiqkNl5d7Ntx1iQWavcD5S4kCNgspAyVNGZ2aY6or0KWrYefrIg3L1uXw+2rg==; Received: from dsl-hkibng22-54f983-249.dhcp.inet.fi ([84.249.131.249] helo=localhost.localdomain) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1eBIgk-0006dR-KV; Sun, 05 Nov 2017 13:02:02 +0200 From: Mikko Perttunen To: thierry.reding@gmail.com, jonathanh@nvidia.com Subject: [PATCH 07/10] drm/tegra: Make syncpoints be per-context Date: Sun, 5 Nov 2017 13:01:15 +0200 Message-Id: <20171105110118.15142-8-mperttunen@nvidia.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171105110118.15142-1-mperttunen@nvidia.com> References: <20171105110118.15142-1-mperttunen@nvidia.com> X-SA-Exim-Connect-IP: 84.249.131.249 X-SA-Exim-Mail-From: mperttunen@nvidia.com X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Cc: linux-tegra@vger.kernel.org, digetx@gmail.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Mikko Perttunen 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-Virus-Scanned: ClamAV using ClamSMTP As a preparation for each context potentially being able to have a separate hardware channel, and thus requiring a separate syncpoint, move syncpoints to be stored inside each context instead of global client data. Signed-off-by: Mikko Perttunen --- drivers/gpu/drm/tegra/drm.c | 8 ++++---- drivers/gpu/drm/tegra/drm.h | 1 + drivers/gpu/drm/tegra/gr2d.c | 2 ++ drivers/gpu/drm/tegra/gr3d.c | 2 ++ drivers/gpu/drm/tegra/vic.c | 2 ++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c index 3e2a4a19412e..b964e18e3058 100644 --- a/drivers/gpu/drm/tegra/drm.c +++ b/drivers/gpu/drm/tegra/drm.c @@ -783,12 +783,12 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data, goto unlock; } - if (args->index >= context->client->base.num_syncpts) { + if (args->index >= 1) { err = -EINVAL; goto unlock; } - syncpt = context->client->base.syncpts[args->index]; + syncpt = context->syncpt; args->id = host1x_syncpt_id(syncpt); unlock: @@ -837,12 +837,12 @@ static int tegra_get_syncpt_base(struct drm_device *drm, void *data, goto unlock; } - if (args->syncpt >= context->client->base.num_syncpts) { + if (args->syncpt >= 1) { err = -EINVAL; goto unlock; } - syncpt = context->client->base.syncpts[args->syncpt]; + syncpt = context->syncpt; base = host1x_syncpt_get_base(syncpt); if (!base) { diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 079aebb3fb38..11d690846fd0 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -79,6 +79,7 @@ struct tegra_drm_context { struct tegra_drm_client *client; struct host1x_channel *channel; + struct host1x_syncpt *syncpt; unsigned int id; }; diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c index 6ea070da7718..3db3bcac48b9 100644 --- a/drivers/gpu/drm/tegra/gr2d.c +++ b/drivers/gpu/drm/tegra/gr2d.c @@ -76,6 +76,8 @@ static int gr2d_open_channel(struct tegra_drm_client *client, if (!context->channel) return -ENOMEM; + context->syncpt = client->base.syncpts[0]; + return 0; } diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index cee2ab645cde..279438342c8c 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -86,6 +86,8 @@ static int gr3d_open_channel(struct tegra_drm_client *client, if (!context->channel) return -ENOMEM; + context->syncpt = client->base.syncpts[0]; + return 0; } diff --git a/drivers/gpu/drm/tegra/vic.c b/drivers/gpu/drm/tegra/vic.c index 6697a21a250d..efe5f3af933e 100644 --- a/drivers/gpu/drm/tegra/vic.c +++ b/drivers/gpu/drm/tegra/vic.c @@ -240,6 +240,8 @@ static int vic_open_channel(struct tegra_drm_client *client, return -ENOMEM; } + context->syncpt = client->base.syncpts[0]; + return 0; }