[v2,08/37] panfrost: Move panfrost_bo_{reference, unreference}() to pan_bo.c

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

Details

Message ID 20190916093715.32203-9-boris.brezillon@collabora.com
State Accepted
Commit 29d0e5c1776cf430f0fd7d262df55670a5ff8d05
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.
This way we have all BO related functions placed in the same source
file.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
---
 src/gallium/drivers/panfrost/pan_bo.c       | 20 ++++++++++++++++++++
 src/gallium/drivers/panfrost/pan_resource.c | 19 -------------------
 2 files changed, 20 insertions(+), 19 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 22476f095660..9b0e8d943b43 100644
--- a/src/gallium/drivers/panfrost/pan_bo.c
+++ b/src/gallium/drivers/panfrost/pan_bo.c
@@ -29,6 +29,7 @@ 
 #include <pthread.h>
 #include "drm-uapi/panfrost_drm.h"
 
+#include "pan_resource.h"
 #include "pan_screen.h"
 #include "pan_util.h"
 #include "pandecode/decode.h"
@@ -319,6 +320,25 @@  panfrost_bo_release(struct panfrost_screen *screen, struct panfrost_bo *bo,
         ralloc_free(bo);
 }
 
+void
+panfrost_bo_reference(struct panfrost_bo *bo)
+{
+        if (bo)
+                pipe_reference(NULL, &bo->reference);
+}
+
+void
+panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo)
+{
+        if (!bo)
+                return;
+
+        /* When the reference count goes to zero, we need to cleanup */
+
+        if (pipe_reference(&bo->reference, NULL))
+                panfrost_bo_release(pan_screen(screen), bo, true);
+}
+
 struct panfrost_bo *
 panfrost_bo_import(struct panfrost_screen *screen, int fd)
 {
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 47a44bfd81a0..766edee3ca6f 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -521,25 +521,6 @@  panfrost_resource_create(struct pipe_screen *screen,
         return (struct pipe_resource *)so;
 }
 
-void
-panfrost_bo_reference(struct panfrost_bo *bo)
-{
-        if (bo)
-                pipe_reference(NULL, &bo->reference);
-}
-
-void
-panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo)
-{
-        if (!bo)
-                return;
-
-        /* When the reference count goes to zero, we need to cleanup */
-
-        if (pipe_reference(&bo->reference, NULL))
-                panfrost_bo_release(pan_screen(screen), bo, true);
-}
-
 static void
 panfrost_resource_destroy(struct pipe_screen *screen,
                           struct pipe_resource *pt)

Comments

R-b
On Mon, Sep 16, 2019 at 11:36:46AM +0200, Boris Brezillon wrote:
> This way we have all BO related functions placed in the same source
> file.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
>  src/gallium/drivers/panfrost/pan_bo.c       | 20 ++++++++++++++++++++
>  src/gallium/drivers/panfrost/pan_resource.c | 19 -------------------
>  2 files changed, 20 insertions(+), 19 deletions(-)
> 
> diff --git a/src/gallium/drivers/panfrost/pan_bo.c b/src/gallium/drivers/panfrost/pan_bo.c
> index 22476f095660..9b0e8d943b43 100644
> --- a/src/gallium/drivers/panfrost/pan_bo.c
> +++ b/src/gallium/drivers/panfrost/pan_bo.c
> @@ -29,6 +29,7 @@
>  #include <pthread.h>
>  #include "drm-uapi/panfrost_drm.h"
>  
> +#include "pan_resource.h"
>  #include "pan_screen.h"
>  #include "pan_util.h"
>  #include "pandecode/decode.h"
> @@ -319,6 +320,25 @@ panfrost_bo_release(struct panfrost_screen *screen, struct panfrost_bo *bo,
>          ralloc_free(bo);
>  }
>  
> +void
> +panfrost_bo_reference(struct panfrost_bo *bo)
> +{
> +        if (bo)
> +                pipe_reference(NULL, &bo->reference);
> +}
> +
> +void
> +panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo)
> +{
> +        if (!bo)
> +                return;
> +
> +        /* When the reference count goes to zero, we need to cleanup */
> +
> +        if (pipe_reference(&bo->reference, NULL))
> +                panfrost_bo_release(pan_screen(screen), bo, true);
> +}
> +
>  struct panfrost_bo *
>  panfrost_bo_import(struct panfrost_screen *screen, int fd)
>  {
> diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
> index 47a44bfd81a0..766edee3ca6f 100644
> --- a/src/gallium/drivers/panfrost/pan_resource.c
> +++ b/src/gallium/drivers/panfrost/pan_resource.c
> @@ -521,25 +521,6 @@ panfrost_resource_create(struct pipe_screen *screen,
>          return (struct pipe_resource *)so;
>  }
>  
> -void
> -panfrost_bo_reference(struct panfrost_bo *bo)
> -{
> -        if (bo)
> -                pipe_reference(NULL, &bo->reference);
> -}
> -
> -void
> -panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo)
> -{
> -        if (!bo)
> -                return;
> -
> -        /* When the reference count goes to zero, we need to cleanup */
> -
> -        if (pipe_reference(&bo->reference, NULL))
> -                panfrost_bo_release(pan_screen(screen), bo, true);
> -}
> -
>  static void
>  panfrost_resource_destroy(struct pipe_screen *screen,
>                            struct pipe_resource *pt)
> -- 
> 2.21.0