[v2,18/37] panfrost: Add flags to reflect the BO imported/exported state

Submitted by Boris Brezillon on Sept. 16, 2019, 9:36 a.m.

Details

Message ID 20190916093715.32203-19-boris.brezillon@collabora.com
State New
Headers show
Series "panfrost: Support batch pipelining" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Boris Brezillon Sept. 16, 2019, 9:36 a.m.
Will be useful to make the ioctl(WAIT_BO) call conditional on BOs that
are not exported/imported (meaning that all GPU accesses are known
by the context).

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 src/gallium/drivers/panfrost/pan_bo.c | 4 ++--
 src/gallium/drivers/panfrost/pan_bo.h | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/pan_bo.c b/src/gallium/drivers/panfrost/pan_bo.c
index 3f05226f96f4..4aabd5fd23ab 100644
--- a/src/gallium/drivers/panfrost/pan_bo.c
+++ b/src/gallium/drivers/panfrost/pan_bo.c
@@ -387,7 +387,7 @@  panfrost_bo_import(struct panfrost_screen *screen, int fd)
         bo->gem_handle = gem_handle;
         bo->gpu = (mali_ptr) get_bo_offset.offset;
         bo->size = lseek(fd, 0, SEEK_END);
-        bo->flags |= PAN_BO_DONT_REUSE;
+        bo->flags |= PAN_BO_DONT_REUSE | PAN_BO_IMPORTED;
         assert(bo->size > 0);
         pipe_reference_init(&bo->reference, 1);
 
@@ -408,7 +408,7 @@  panfrost_bo_export(struct panfrost_bo *bo)
         if (ret == -1)
                 return -1;
 
-        bo->flags |= PAN_BO_DONT_REUSE;
+        bo->flags |= PAN_BO_DONT_REUSE | PAN_BO_EXPORTED;
         return args.fd;
 }
 
diff --git a/src/gallium/drivers/panfrost/pan_bo.h b/src/gallium/drivers/panfrost/pan_bo.h
index 49b392f7bd76..e141a60fc407 100644
--- a/src/gallium/drivers/panfrost/pan_bo.h
+++ b/src/gallium/drivers/panfrost/pan_bo.h
@@ -56,6 +56,12 @@  struct panfrost_screen;
  * let the BO logic know about this contraint. */
 #define PAN_BO_DONT_REUSE         (1 << 5)
 
+/* BO has been imported */
+#define PAN_BO_IMPORTED           (1 << 6)
+
+/* BO has been exported */
+#define PAN_BO_EXPORTED           (1 << 7)
+
 struct panfrost_bo {
         /* Must be first for casting */
         struct list_head link;

Comments

R-b, but could we move this patch before the one adding the WAIT_BO? And
I guess some succeeding patches we'll want to move before as well, and
then the final one using it get squashed? Let's see.

On Mon, Sep 16, 2019 at 11:36:56AM +0200, Boris Brezillon wrote:
> Will be useful to make the ioctl(WAIT_BO) call conditional on BOs that
> are not exported/imported (meaning that all GPU accesses are known
> by the context).
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
>  src/gallium/drivers/panfrost/pan_bo.c | 4 ++--
>  src/gallium/drivers/panfrost/pan_bo.h | 6 ++++++
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/panfrost/pan_bo.c b/src/gallium/drivers/panfrost/pan_bo.c
> index 3f05226f96f4..4aabd5fd23ab 100644
> --- a/src/gallium/drivers/panfrost/pan_bo.c
> +++ b/src/gallium/drivers/panfrost/pan_bo.c
> @@ -387,7 +387,7 @@ panfrost_bo_import(struct panfrost_screen *screen, int fd)
>          bo->gem_handle = gem_handle;
>          bo->gpu = (mali_ptr) get_bo_offset.offset;
>          bo->size = lseek(fd, 0, SEEK_END);
> -        bo->flags |= PAN_BO_DONT_REUSE;
> +        bo->flags |= PAN_BO_DONT_REUSE | PAN_BO_IMPORTED;
>          assert(bo->size > 0);
>          pipe_reference_init(&bo->reference, 1);
>  
> @@ -408,7 +408,7 @@ panfrost_bo_export(struct panfrost_bo *bo)
>          if (ret == -1)
>                  return -1;
>  
> -        bo->flags |= PAN_BO_DONT_REUSE;
> +        bo->flags |= PAN_BO_DONT_REUSE | PAN_BO_EXPORTED;
>          return args.fd;
>  }
>  
> diff --git a/src/gallium/drivers/panfrost/pan_bo.h b/src/gallium/drivers/panfrost/pan_bo.h
> index 49b392f7bd76..e141a60fc407 100644
> --- a/src/gallium/drivers/panfrost/pan_bo.h
> +++ b/src/gallium/drivers/panfrost/pan_bo.h
> @@ -56,6 +56,12 @@ struct panfrost_screen;
>   * let the BO logic know about this contraint. */
>  #define PAN_BO_DONT_REUSE         (1 << 5)
>  
> +/* BO has been imported */
> +#define PAN_BO_IMPORTED           (1 << 6)
> +
> +/* BO has been exported */
> +#define PAN_BO_EXPORTED           (1 << 7)
> +
>  struct panfrost_bo {
>          /* Must be first for casting */
>          struct list_head link;
> -- 
> 2.21.0