diff mbox series

[2/7] gpu: host1x: Store pointer to client in jobs

Message ID 20180517153430.9602-3-thierry.reding@gmail.com
State Deferred
Headers show
Series gpu: host1x: Preparation work for destaging ABI | expand

Commit Message

Thierry Reding May 17, 2018, 3:34 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

Rather than storing some identifier derived from the application
context that can't be used concretely anywhere, store a pointer to the
client directly so that accesses can be made directly through that
client object.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/tegra/drm.c | 5 +++--
 drivers/gpu/host1x/cdma.c   | 2 +-
 drivers/gpu/host1x/cdma.h   | 2 +-
 include/linux/host1x.h      | 3 ++-
 4 files changed, 7 insertions(+), 5 deletions(-)

Comments

Dmitry Osipenko May 18, 2018, 5:35 p.m. UTC | #1
On 17.05.2018 18:34, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Rather than storing some identifier derived from the application
> context that can't be used concretely anywhere, store a pointer to the
> client directly so that accesses can be made directly through that
> client object.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/gpu/drm/tegra/drm.c | 5 +++--
>  drivers/gpu/host1x/cdma.c   | 2 +-
>  drivers/gpu/host1x/cdma.h   | 2 +-
>  include/linux/host1x.h      | 3 ++-
>  4 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index 33e479182773..e92e44e69871 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -317,6 +317,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>  		     struct drm_tegra_submit *args, struct drm_device *drm,
>  		     struct drm_file *file)
>  {
> +	struct host1x_client *client = &context->client->base;
>  	unsigned int num_cmdbufs = args->num_cmdbufs;
>  	unsigned int num_relocs = args->num_relocs;
>  	struct drm_tegra_cmdbuf __user *user_cmdbufs;
> @@ -348,8 +349,8 @@ int tegra_drm_submit(struct tegra_drm_context *context,
>  		return -ENOMEM;
>  
>  	job->num_relocs = args->num_relocs;
> -	job->client = (u32)args->context;
> -	job->class = context->client->base.class;
> +	job->client = client;
> +	job->class = client->class;
>  	job->serialize = true;
>  
>  	/*
> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> index 28541b280739..cb590ba886ec 100644
> --- a/drivers/gpu/host1x/cdma.c
> +++ b/drivers/gpu/host1x/cdma.c
> @@ -247,7 +247,7 @@ static void cdma_start_timer_locked(struct host1x_cdma *cdma,
>  static void stop_cdma_timer_locked(struct host1x_cdma *cdma)
>  {
>  	cancel_delayed_work(&cdma->timeout.wq);
> -	cdma->timeout.client = 0;
> +	cdma->timeout.client = NULL;
>  }
>  
>  /*
> diff --git a/drivers/gpu/host1x/cdma.h b/drivers/gpu/host1x/cdma.h
> index 286d49386be9..1825091bc0ed 100644
> --- a/drivers/gpu/host1x/cdma.h
> +++ b/drivers/gpu/host1x/cdma.h
> @@ -58,7 +58,7 @@ struct buffer_timeout {
>  	u32 syncpt_val;			/* syncpt value when completed */
>  	ktime_t start_ktime;		/* starting time */
>  	/* context timeout information */
> -	int client;
> +	struct host1x_client *client;
>  };
>  
>  enum cdma_event {
> diff --git a/include/linux/host1x.h b/include/linux/host1x.h
> index f66bece1e1b7..0632010f47fb 100644
> --- a/include/linux/host1x.h
> +++ b/include/linux/host1x.h
> @@ -202,7 +202,8 @@ struct host1x_job {
>  	/* Channel where job is submitted to */
>  	struct host1x_channel *channel;
>  
> -	u32 client;
> +	/* client where the job originated */
> +	struct host1x_client *client;
>  
>  	/* Gathers and their memory */
>  	struct host1x_job_gather *gathers;
> 

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 33e479182773..e92e44e69871 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -317,6 +317,7 @@  int tegra_drm_submit(struct tegra_drm_context *context,
 		     struct drm_tegra_submit *args, struct drm_device *drm,
 		     struct drm_file *file)
 {
+	struct host1x_client *client = &context->client->base;
 	unsigned int num_cmdbufs = args->num_cmdbufs;
 	unsigned int num_relocs = args->num_relocs;
 	struct drm_tegra_cmdbuf __user *user_cmdbufs;
@@ -348,8 +349,8 @@  int tegra_drm_submit(struct tegra_drm_context *context,
 		return -ENOMEM;
 
 	job->num_relocs = args->num_relocs;
-	job->client = (u32)args->context;
-	job->class = context->client->base.class;
+	job->client = client;
+	job->class = client->class;
 	job->serialize = true;
 
 	/*
diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index 28541b280739..cb590ba886ec 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -247,7 +247,7 @@  static void cdma_start_timer_locked(struct host1x_cdma *cdma,
 static void stop_cdma_timer_locked(struct host1x_cdma *cdma)
 {
 	cancel_delayed_work(&cdma->timeout.wq);
-	cdma->timeout.client = 0;
+	cdma->timeout.client = NULL;
 }
 
 /*
diff --git a/drivers/gpu/host1x/cdma.h b/drivers/gpu/host1x/cdma.h
index 286d49386be9..1825091bc0ed 100644
--- a/drivers/gpu/host1x/cdma.h
+++ b/drivers/gpu/host1x/cdma.h
@@ -58,7 +58,7 @@  struct buffer_timeout {
 	u32 syncpt_val;			/* syncpt value when completed */
 	ktime_t start_ktime;		/* starting time */
 	/* context timeout information */
-	int client;
+	struct host1x_client *client;
 };
 
 enum cdma_event {
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index f66bece1e1b7..0632010f47fb 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -202,7 +202,8 @@  struct host1x_job {
 	/* Channel where job is submitted to */
 	struct host1x_channel *channel;
 
-	u32 client;
+	/* client where the job originated */
+	struct host1x_client *client;
 
 	/* Gathers and their memory */
 	struct host1x_job_gather *gathers;