aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorBoris Brezillon <[email protected]>2019-09-14 09:58:55 +0200
committerBoris Brezillon <[email protected]>2019-09-18 10:29:13 +0200
commit154cb725d4a14d3d0360ee240665dd87281043cd (patch)
treef07eca1442c60bb88a64fdde77c5f468c395c23b /src/gallium
parent34efaafc93ca5c28c96396333eeba0f492ce6b94 (diff)
panfrost: Move the BO API to its own header
Right now, the BO API is spread over pan_{allocate,resource,screen}.h. Let's move all BO related definitions to a separate header file. Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/panfrost/pan_allocate.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_allocate.h20
-rw-r--r--src/gallium/drivers/panfrost/pan_assemble.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_blend_cso.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_bo.c2
-rw-r--r--src/gallium/drivers/panfrost/pan_bo.h100
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_instancing.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_job.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_mfbd.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.h6
-rw-r--r--src/gallium/drivers/panfrost/pan_screen.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_screen.h47
-rw-r--r--src/gallium/drivers/panfrost/pan_sfbd.c1
-rw-r--r--src/gallium/drivers/panfrost/pan_varyings.c1
16 files changed, 112 insertions, 74 deletions
diff --git a/src/gallium/drivers/panfrost/pan_allocate.c b/src/gallium/drivers/panfrost/pan_allocate.c
index e7970c1be2d..bdf6f26b77b 100644
--- a/src/gallium/drivers/panfrost/pan_allocate.c
+++ b/src/gallium/drivers/panfrost/pan_allocate.c
@@ -29,6 +29,7 @@
#include <assert.h>
#include <panfrost-misc.h>
#include <panfrost-job.h>
+#include "pan_bo.h"
#include "pan_context.h"
/* TODO: What does this actually have to be? */
diff --git a/src/gallium/drivers/panfrost/pan_allocate.h b/src/gallium/drivers/panfrost/pan_allocate.h
index a80eadaffce..f18218fb32a 100644
--- a/src/gallium/drivers/panfrost/pan_allocate.h
+++ b/src/gallium/drivers/panfrost/pan_allocate.h
@@ -43,26 +43,6 @@ struct panfrost_transfer {
mali_ptr gpu;
};
-struct panfrost_bo {
- /* Must be first for casting */
- struct list_head link;
-
- struct pipe_reference reference;
-
- /* Mapping for the entire object (all levels) */
- uint8_t *cpu;
-
- /* GPU address for the object */
- mali_ptr gpu;
-
- /* Size of all entire trees */
- size_t size;
-
- int gem_handle;
-
- uint32_t flags;
-};
-
struct panfrost_transfer
panfrost_allocate_transient(struct panfrost_batch *batch, size_t sz);
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c
index cc4822a2361..afd16abb2d2 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "pan_bo.h"
#include "pan_context.h"
#include "compiler/nir/nir.h"
diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c
index c61ffe203c4..83492e1ed03 100644
--- a/src/gallium/drivers/panfrost/pan_blend_cso.c
+++ b/src/gallium/drivers/panfrost/pan_blend_cso.c
@@ -29,6 +29,7 @@
#include "util/u_memory.h"
#include "pan_blend_shaders.h"
#include "pan_blending.h"
+#include "pan_bo.h"
/* A given Gallium blend state can be encoded to the hardware in numerous,
* dramatically divergent ways due to the interactions of blending with
diff --git a/src/gallium/drivers/panfrost/pan_bo.c b/src/gallium/drivers/panfrost/pan_bo.c
index 7f14b3e3638..e6a5c972ead 100644
--- a/src/gallium/drivers/panfrost/pan_bo.c
+++ b/src/gallium/drivers/panfrost/pan_bo.c
@@ -29,7 +29,7 @@
#include <pthread.h>
#include "drm-uapi/panfrost_drm.h"
-#include "pan_resource.h"
+#include "pan_bo.h"
#include "pan_screen.h"
#include "pan_util.h"
#include "pandecode/decode.h"
diff --git a/src/gallium/drivers/panfrost/pan_bo.h b/src/gallium/drivers/panfrost/pan_bo.h
new file mode 100644
index 00000000000..6d17ebecf6e
--- /dev/null
+++ b/src/gallium/drivers/panfrost/pan_bo.h
@@ -0,0 +1,100 @@
+/*
+ * © Copyright 2019 Alyssa Rosenzweig
+ * © Copyright 2019 Collabora, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ */
+
+#ifndef __PAN_BO_H__
+#define __PAN_BO_H__
+
+#include <panfrost-misc.h>
+#include "pipe/p_state.h"
+#include "util/list.h"
+
+struct panfrost_screen;
+
+/* Flags for allocated memory */
+
+/* This memory region is executable */
+#define PAN_BO_EXECUTE (1 << 0)
+
+/* This memory region should be lazily allocated and grow-on-page-fault. Must
+ * be used in conjunction with INVISIBLE */
+#define PAN_BO_GROWABLE (1 << 1)
+
+/* This memory region should not be mapped to the CPU */
+#define PAN_BO_INVISIBLE (1 << 2)
+
+/* This memory region will be used for varyings and needs to have the cache
+ * bits twiddled accordingly */
+#define PAN_BO_COHERENT_LOCAL (1 << 3)
+
+/* This region may not be used immediately and will not mmap on allocate
+ * (semantically distinct from INVISIBLE, which cannot never be mmaped) */
+#define PAN_BO_DELAY_MMAP (1 << 4)
+
+struct panfrost_bo {
+ /* Must be first for casting */
+ struct list_head link;
+
+ struct pipe_reference reference;
+
+ /* Mapping for the entire object (all levels) */
+ uint8_t *cpu;
+
+ /* GPU address for the object */
+ mali_ptr gpu;
+
+ /* Size of all entire trees */
+ size_t size;
+
+ int gem_handle;
+
+ uint32_t flags;
+};
+
+void
+panfrost_bo_reference(struct panfrost_bo *bo);
+void
+panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo);
+struct panfrost_bo *
+panfrost_bo_create(struct panfrost_screen *screen, size_t size,
+ uint32_t flags);
+void
+panfrost_bo_mmap(struct panfrost_screen *screen, struct panfrost_bo *bo);
+void
+panfrost_bo_release(struct panfrost_screen *screen, struct panfrost_bo *bo,
+ bool cacheable);
+struct panfrost_bo *
+panfrost_bo_import(struct panfrost_screen *screen, int fd);
+int
+panfrost_bo_export(struct panfrost_screen *screen, const struct panfrost_bo *bo);
+struct panfrost_bo *
+panfrost_bo_cache_fetch(struct panfrost_screen *screen,
+ size_t size, uint32_t flags);
+bool
+panfrost_bo_cache_put(struct panfrost_screen *screen,
+ struct panfrost_bo *bo);
+void
+panfrost_bo_cache_evict_all(struct panfrost_screen *screen);
+
+#endif /* __PAN_BO_H__ */
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index f01ddf18b10..d3e08c03ffa 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -27,6 +27,7 @@
#include <sys/poll.h>
#include <errno.h>
+#include "pan_bo.h"
#include "pan_context.h"
#include "pan_format.h"
diff --git a/src/gallium/drivers/panfrost/pan_instancing.c b/src/gallium/drivers/panfrost/pan_instancing.c
index e7e1f1d0e12..806823f0da0 100644
--- a/src/gallium/drivers/panfrost/pan_instancing.c
+++ b/src/gallium/drivers/panfrost/pan_instancing.c
@@ -23,6 +23,7 @@
*
*/
+#include "pan_bo.h"
#include "pan_context.h"
/* See mali_job for notes on how this works. But basically, for small vertex
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 839e19c1644..80ed730944b 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -27,6 +27,7 @@
#include "drm-uapi/panfrost_drm.h"
+#include "pan_bo.h"
#include "pan_context.h"
#include "util/hash_table.h"
#include "util/ralloc.h"
diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c
index fcddec2bf22..b01f8289bf9 100644
--- a/src/gallium/drivers/panfrost/pan_mfbd.c
+++ b/src/gallium/drivers/panfrost/pan_mfbd.c
@@ -22,6 +22,7 @@
*
*/
+#include "pan_bo.h"
#include "pan_context.h"
#include "pan_util.h"
#include "pan_format.h"
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 91f30450e54..97ab2f9d9a4 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -41,6 +41,7 @@
#include "util/u_transfer_helper.h"
#include "util/u_gen_mipmap.h"
+#include "pan_bo.h"
#include "pan_context.h"
#include "pan_screen.h"
#include "pan_resource.h"
diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h
index 6ed3d1fd60e..22404a609e1 100644
--- a/src/gallium/drivers/panfrost/pan_resource.h
+++ b/src/gallium/drivers/panfrost/pan_resource.h
@@ -57,12 +57,6 @@ struct panfrost_slice {
bool initialized;
};
-void
-panfrost_bo_reference(struct panfrost_bo *bo);
-
-void
-panfrost_bo_unreference(struct pipe_screen *screen, struct panfrost_bo *bo);
-
struct panfrost_resource {
struct pipe_resource base;
struct {
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index 54ef2efd3b1..dae8b941f1e 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -43,6 +43,7 @@
#include "drm-uapi/drm_fourcc.h"
#include "drm-uapi/panfrost_drm.h"
+#include "pan_bo.h"
#include "pan_screen.h"
#include "pan_resource.h"
#include "pan_public.h"
diff --git a/src/gallium/drivers/panfrost/pan_screen.h b/src/gallium/drivers/panfrost/pan_screen.h
index c93064ad968..fdc47df00ea 100644
--- a/src/gallium/drivers/panfrost/pan_screen.h
+++ b/src/gallium/drivers/panfrost/pan_screen.h
@@ -47,26 +47,6 @@ struct panfrost_screen;
/* Driver limits */
#define PAN_MAX_CONST_BUFFERS 16
-/* Flags for allocated memory */
-
-/* This memory region is executable */
-#define PAN_BO_EXECUTE (1 << 0)
-
-/* This memory region should be lazily allocated and grow-on-page-fault. Must
- * be used in conjunction with INVISIBLE */
-#define PAN_BO_GROWABLE (1 << 1)
-
-/* This memory region should not be mapped to the CPU */
-#define PAN_BO_INVISIBLE (1 << 2)
-
-/* This memory region will be used for varyings and needs to have the cache
- * bits twiddled accordingly */
-#define PAN_BO_COHERENT_LOCAL (1 << 3)
-
-/* This region may not be used immediately and will not mmap on allocate
- * (semantically distinct from INVISIBLE, which cannot never be mmaped) */
-#define PAN_BO_DELAY_MMAP (1 << 4)
-
/* Transient slab size. This is a balance between fragmentation against cache
* locality and ease of bookkeeping */
@@ -123,31 +103,4 @@ pan_screen(struct pipe_screen *p)
struct panfrost_fence *
panfrost_fence_create(struct panfrost_context *ctx);
-struct panfrost_bo *
-panfrost_bo_create(struct panfrost_screen *screen, size_t size,
- uint32_t flags);
-void
-panfrost_bo_mmap(struct panfrost_screen *screen, struct panfrost_bo *bo);
-void
-panfrost_bo_release(struct panfrost_screen *screen, struct panfrost_bo *bo,
- bool cacheable);
-struct panfrost_bo *
-panfrost_bo_import(struct panfrost_screen *screen, int fd);
-int
-panfrost_bo_export(struct panfrost_screen *screen, const struct panfrost_bo *bo);
-
-struct panfrost_bo *
-panfrost_bo_cache_fetch(
- struct panfrost_screen *screen,
- size_t size, uint32_t flags);
-
-bool
-panfrost_bo_cache_put(
- struct panfrost_screen *screen,
- struct panfrost_bo *bo);
-
-void
-panfrost_bo_cache_evict_all(
- struct panfrost_screen *screen);
-
#endif /* PAN_SCREEN_H */
diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c b/src/gallium/drivers/panfrost/pan_sfbd.c
index bf49ddfc1a0..b5e18f07045 100644
--- a/src/gallium/drivers/panfrost/pan_sfbd.c
+++ b/src/gallium/drivers/panfrost/pan_sfbd.c
@@ -22,6 +22,7 @@
*
*/
+#include "pan_bo.h"
#include "pan_context.h"
#include "pan_util.h"
#include "pan_format.h"
diff --git a/src/gallium/drivers/panfrost/pan_varyings.c b/src/gallium/drivers/panfrost/pan_varyings.c
index 7adfc3ec4c7..9dbd1e2ebac 100644
--- a/src/gallium/drivers/panfrost/pan_varyings.c
+++ b/src/gallium/drivers/panfrost/pan_varyings.c
@@ -23,6 +23,7 @@
*
*/
+#include "pan_bo.h"
#include "pan_context.h"
#include "util/u_prim.h"