Re: [Mesa-dev] [PATCH 6/7] broadcom/vc4: Expose syncobj import

2018-04-23 Thread Eric Anholt
Stefan Schake  writes:

> Our submit ioctl allows to optionally specify a syncobj that will be
> waited on before job execution. Expose this in our job submission
> interface. Since every uint32_t could be a valid syncobj handle, pass
> the handle as a pointer so we can make it optional.
>
> Signed-off-by: Stefan Schake 
> ---
>  src/gallium/drivers/vc4/vc4_context.h |  2 ++
>  src/gallium/drivers/vc4/vc4_job.c | 24 +++-
>  2 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/vc4/vc4_context.h 
> b/src/gallium/drivers/vc4/vc4_context.h
> index d094957bb5..ac72a14008 100644
> --- a/src/gallium/drivers/vc4/vc4_context.h
> +++ b/src/gallium/drivers/vc4/vc4_context.h
> @@ -512,6 +512,8 @@ struct vc4_job *vc4_get_job(struct vc4_context *vc4,
>  struct vc4_job *vc4_get_job_for_fbo(struct vc4_context *vc4);
>  
>  void vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job);
> +void vc4_job_submit_sync(struct vc4_context *vc4, struct vc4_job *job,
> + uint32_t* in_sync);
>  void vc4_flush_jobs_writing_resource(struct vc4_context *vc4,
>   struct pipe_resource *prsc);
>  void vc4_flush_jobs_reading_resource(struct vc4_context *vc4,
> diff --git a/src/gallium/drivers/vc4/vc4_job.c 
> b/src/gallium/drivers/vc4/vc4_job.c
> index 2b68ea7b74..1084d39b1f 100644
> --- a/src/gallium/drivers/vc4/vc4_job.c
> +++ b/src/gallium/drivers/vc4/vc4_job.c
> @@ -368,10 +368,22 @@ vc4_submit_setup_rcl_msaa_surface(struct vc4_job *job,
>  }
>  
>  /**
> - * Submits the job to the kernel and then reinitializes it.
> + * Wrapper for vc4_job_submit_sync omitting the rarely needed syncobj import
> + * parameter.
>   */
>  void
>  vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job)
> +{
> +vc4_job_submit_sync(vc4, job, NULL);
> +}
> +
> +/**
> + * Submits the job to the kernel and then reinitializes it, optionally 
> passing
> + * a syncobj that will be waited on before job execution.
> + */
> +void
> +vc4_job_submit_sync(struct vc4_context *vc4, struct vc4_job *job,
> +uint32_t* in_sync)

Could we call this "vc4_job_submit_with_sync()" or something?
job_submit_sync() sounds to me like "submit this synchronously, so block
on completion."

Style nit: * goes next to the variable name rather than the type.
However, I think you can just use uint32_ts instead of pointers
throughout, with 0 meaning no sync obj.


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 6/7] broadcom/vc4: Expose syncobj import

2018-04-21 Thread Stefan Schake
Our submit ioctl allows to optionally specify a syncobj that will be
waited on before job execution. Expose this in our job submission
interface. Since every uint32_t could be a valid syncobj handle, pass
the handle as a pointer so we can make it optional.

Signed-off-by: Stefan Schake 
---
 src/gallium/drivers/vc4/vc4_context.h |  2 ++
 src/gallium/drivers/vc4/vc4_job.c | 24 +++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/vc4/vc4_context.h 
b/src/gallium/drivers/vc4/vc4_context.h
index d094957bb5..ac72a14008 100644
--- a/src/gallium/drivers/vc4/vc4_context.h
+++ b/src/gallium/drivers/vc4/vc4_context.h
@@ -512,6 +512,8 @@ struct vc4_job *vc4_get_job(struct vc4_context *vc4,
 struct vc4_job *vc4_get_job_for_fbo(struct vc4_context *vc4);
 
 void vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job);
+void vc4_job_submit_sync(struct vc4_context *vc4, struct vc4_job *job,
+ uint32_t* in_sync);
 void vc4_flush_jobs_writing_resource(struct vc4_context *vc4,
  struct pipe_resource *prsc);
 void vc4_flush_jobs_reading_resource(struct vc4_context *vc4,
diff --git a/src/gallium/drivers/vc4/vc4_job.c 
b/src/gallium/drivers/vc4/vc4_job.c
index 2b68ea7b74..1084d39b1f 100644
--- a/src/gallium/drivers/vc4/vc4_job.c
+++ b/src/gallium/drivers/vc4/vc4_job.c
@@ -368,10 +368,22 @@ vc4_submit_setup_rcl_msaa_surface(struct vc4_job *job,
 }
 
 /**
- * Submits the job to the kernel and then reinitializes it.
+ * Wrapper for vc4_job_submit_sync omitting the rarely needed syncobj import
+ * parameter.
  */
 void
 vc4_job_submit(struct vc4_context *vc4, struct vc4_job *job)
+{
+vc4_job_submit_sync(vc4, job, NULL);
+}
+
+/**
+ * Submits the job to the kernel and then reinitializes it, optionally passing
+ * a syncobj that will be waited on before job execution.
+ */
+void
+vc4_job_submit_sync(struct vc4_context *vc4, struct vc4_job *job,
+uint32_t* in_sync)
 {
 if (!job->needs_flush)
 goto done;
@@ -482,6 +494,16 @@ vc4_job_submit(struct vc4_context *vc4, struct vc4_job 
*job)
 submit.flags |= VC4_SUBMIT_CL_EXPORT_SYNCOBJ;
 }
 
+if (in_sync) {
+/* If the kernel has no syncobj support, we should never try
+ * to import one as it breaks backwards compatibility.
+ */
+assert(vc4->screen->has_syncobj);
+
+submit.in_sync = *in_sync;
+submit.flags |= VC4_SUBMIT_CL_IMPORT_SYNCOBJ;
+}
+
 if (!(vc4_debug & VC4_DEBUG_NORAST)) {
 int ret;
 
-- 
2.14.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev