From patchwork Mon Oct 7 08:34:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 2994991 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 760CCBF924 for ; Mon, 7 Oct 2013 08:43:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31650201C7 for ; Mon, 7 Oct 2013 08:43:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id C3C57201BF for ; Mon, 7 Oct 2013 08:43:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B7072E6BD2 for ; Mon, 7 Oct 2013 01:43:31 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f44.google.com (mail-bk0-f44.google.com [209.85.214.44]) by gabe.freedesktop.org (Postfix) with ESMTP id A81CDE66C7 for ; Mon, 7 Oct 2013 01:36:51 -0700 (PDT) Received: by mail-bk0-f44.google.com with SMTP id mz10so2482615bkb.17 for ; Mon, 07 Oct 2013 01:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=munS3U2jUFC13MicMuimmizImQSlKecBrfgoYs2bxhQ=; b=Ju/Ui1RJU1NoN/QfpheGRZAfguokKCOR1BihnNqArUHMRHfw5Pb0RhyjBmxnzAXIlE BrgdLeu08IULjfcoDRg1z6pyALr23Zdr2C58Xm4+FCjCD5u+ngbrqUjN1w6Zl6CK6lJe QMlIH32dhtlyBMej71KbV9ugFAa004RwEkLN5M9WQZ0qbZt875if2X/SBI29qcFqYpIF 9s5WSe+I1+8vwFuxou6avGtDK3XvXSTpvOMWDA+jaD1bX/OSao0N9w3tmBKt7S6v03aD 5krEBXudkylPgLjL2MI+GwhrSiQvvwyhttpvUPuvJwoePwZZEtZ+bSpeqpSNe2kb9daG 5biw== X-Received: by 10.204.71.133 with SMTP id h5mr26298648bkj.0.1381135010765; Mon, 07 Oct 2013 01:36:50 -0700 (PDT) Received: from localhost (port-46445.pppoe.wtnet.de. [46.59.230.36]) by mx.google.com with ESMTPSA id zl3sm16335786bkb.4.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 07 Oct 2013 01:36:50 -0700 (PDT) From: Thierry Reding To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 05/27] drm/tegra: Rename host1x_drm_context to tegra_drm_context Date: Mon, 7 Oct 2013 10:34:22 +0200 Message-Id: <1381134884-5816-6-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1381134884-5816-1-git-send-email-treding@nvidia.com> References: <1381134884-5816-1-git-send-email-treding@nvidia.com> Cc: linux-tegra@vger.kernel.org, devicetree@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The structure represents a context associated with a particular process that has opened the Tegra DRM device and requested a channel. This is a very DRM-specific notion and has nothing to do with host1x. Rename the structure to more clearly mark the boundaries between the two. Signed-off-by: Thierry Reding --- drivers/gpu/host1x/drm/drm.c | 34 +++++++++++++++++++++------------- drivers/gpu/host1x/drm/drm.h | 8 ++++---- drivers/gpu/host1x/drm/gr2d.c | 6 +++--- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/host1x/drm/drm.c b/drivers/gpu/host1x/drm/drm.c index 67fd856..7f8f419 100644 --- a/drivers/gpu/host1x/drm/drm.c +++ b/drivers/gpu/host1x/drm/drm.c @@ -306,7 +306,7 @@ static int tegra_drm_open(struct drm_device *drm, struct drm_file *filp) return 0; } -static void host1x_drm_context_free(struct host1x_drm_context *context) +static void tegra_drm_context_free(struct tegra_drm_context *context) { context->client->ops->close_channel(context); kfree(context); @@ -320,10 +320,15 @@ static void tegra_drm_lastclose(struct drm_device *drm) } #ifdef CONFIG_DRM_TEGRA_STAGING +static struct tegra_drm_context *tegra_drm_get_context(__u64 context) +{ + return (struct tegra_drm_context *)(uintptr_t)context; +} + static bool tegra_drm_file_owns_context(struct tegra_drm_file *file, - struct host1x_drm_context *context) + struct tegra_drm_context *context) { - struct host1x_drm_context *ctx; + struct tegra_drm_context *ctx; list_for_each_entry(ctx, &file->contexts, list) if (ctx == context) @@ -413,7 +418,7 @@ static int tegra_open_channel(struct drm_device *drm, void *data, struct tegra_drm_file *fpriv = file->driver_priv; struct tegra_drm *tegra = drm->dev_private; struct drm_tegra_open_channel *args = data; - struct host1x_drm_context *context; + struct tegra_drm_context *context; struct host1x_client *client; int err = -ENODEV; @@ -442,14 +447,15 @@ static int tegra_close_channel(struct drm_device *drm, void *data, { struct drm_tegra_close_channel *args = data; struct tegra_drm_file *fpriv = file->driver_priv; - struct host1x_drm_context *context = - (struct host1x_drm_context *)(uintptr_t)args->context; + struct tegra_drm_context *context; + + context = tegra_drm_get_context(args->context); if (!tegra_drm_file_owns_context(fpriv, context)) return -EINVAL; list_del(&context->list); - host1x_drm_context_free(context); + tegra_drm_context_free(context); return 0; } @@ -459,10 +465,11 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data, { struct tegra_drm_file *fpriv = file->driver_priv; struct drm_tegra_get_syncpt *args = data; - struct host1x_drm_context *context = - (struct host1x_drm_context *)(uintptr_t)args->context; + struct tegra_drm_context *context; struct host1x_syncpt *syncpt; + context = tegra_drm_get_context(args->context); + if (!tegra_drm_file_owns_context(fpriv, context)) return -ENODEV; @@ -480,8 +487,9 @@ static int tegra_submit(struct drm_device *drm, void *data, { struct tegra_drm_file *fpriv = file->driver_priv; struct drm_tegra_submit *args = data; - struct host1x_drm_context *context = - (struct host1x_drm_context *)(uintptr_t)args->context; + struct tegra_drm_context *context; + + context = tegra_drm_get_context(args->context); if (!tegra_drm_file_owns_context(fpriv, context)) return -ENODEV; @@ -563,14 +571,14 @@ static void tegra_drm_disable_vblank(struct drm_device *drm, int pipe) static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file) { struct tegra_drm_file *fpriv = file->driver_priv; - struct host1x_drm_context *context, *tmp; + struct tegra_drm_context *context, *tmp; struct drm_crtc *crtc; list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) tegra_dc_cancel_page_flip(crtc, file); list_for_each_entry_safe(context, tmp, &fpriv->contexts, list) - host1x_drm_context_free(context); + tegra_drm_context_free(context); kfree(fpriv); } diff --git a/drivers/gpu/host1x/drm/drm.h b/drivers/gpu/host1x/drm/drm.h index 74869d3..dd6b98b 100644 --- a/drivers/gpu/host1x/drm/drm.h +++ b/drivers/gpu/host1x/drm/drm.h @@ -46,7 +46,7 @@ struct tegra_drm { struct host1x_client; -struct host1x_drm_context { +struct tegra_drm_context { struct host1x_client *client; struct host1x_channel *channel; struct list_head list; @@ -56,9 +56,9 @@ struct host1x_client_ops { int (*drm_init)(struct host1x_client *client, struct drm_device *drm); int (*drm_exit)(struct host1x_client *client); int (*open_channel)(struct host1x_client *client, - struct host1x_drm_context *context); - void (*close_channel)(struct host1x_drm_context *context); - int (*submit)(struct host1x_drm_context *context, + struct tegra_drm_context *context); + void (*close_channel)(struct tegra_drm_context *context); + int (*submit)(struct tegra_drm_context *context, struct drm_tegra_submit *args, struct drm_device *drm, struct drm_file *file); }; diff --git a/drivers/gpu/host1x/drm/gr2d.c b/drivers/gpu/host1x/drm/gr2d.c index 5f838b1..06507c8 100644 --- a/drivers/gpu/host1x/drm/gr2d.c +++ b/drivers/gpu/host1x/drm/gr2d.c @@ -58,7 +58,7 @@ static int gr2d_client_exit(struct host1x_client *client) } static int gr2d_open_channel(struct host1x_client *client, - struct host1x_drm_context *context) + struct tegra_drm_context *context) { struct gr2d *gr2d = to_gr2d(client); @@ -70,7 +70,7 @@ static int gr2d_open_channel(struct host1x_client *client, return 0; } -static void gr2d_close_channel(struct host1x_drm_context *context) +static void gr2d_close_channel(struct tegra_drm_context *context) { host1x_channel_put(context->channel); } @@ -94,7 +94,7 @@ static struct host1x_bo *host1x_bo_lookup(struct drm_device *drm, return &bo->base; } -static int gr2d_submit(struct host1x_drm_context *context, +static int gr2d_submit(struct tegra_drm_context *context, struct drm_tegra_submit *args, struct drm_device *drm, struct drm_file *file) {