aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/panfrost/Makefile.sources3
-rw-r--r--src/gallium/drivers/panfrost/meson.build1
-rw-r--r--src/gallium/drivers/panfrost/pan_assemble.c2
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c4
-rw-r--r--src/gallium/drivers/panfrost/pan_job.c4
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c27
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.h4
-rw-r--r--src/panfrost/Makefile.sources5
-rw-r--r--src/panfrost/encoder/meson.build1
-rw-r--r--src/panfrost/encoder/pan_bo.c (renamed from src/gallium/drivers/panfrost/pan_bo.c)12
-rw-r--r--src/panfrost/encoder/pan_bo.h (renamed from src/gallium/drivers/panfrost/pan_bo.h)0
-rw-r--r--src/panfrost/encoder/pan_device.h2
-rw-r--r--src/panfrost/encoder/pan_util.h (renamed from src/gallium/drivers/panfrost/pan_util.h)0
13 files changed, 40 insertions, 25 deletions
diff --git a/src/gallium/drivers/panfrost/Makefile.sources b/src/gallium/drivers/panfrost/Makefile.sources
index 1c796605d64..c734cd0807c 100644
--- a/src/gallium/drivers/panfrost/Makefile.sources
+++ b/src/gallium/drivers/panfrost/Makefile.sources
@@ -13,8 +13,6 @@ C_SOURCES := \
pan_blend_shaders.c \
pan_blend_shaders.h \
pan_blit.c \
- pan_bo.c \
- pan_bo.h \
pan_cmdstream.c \
pan_cmdstream.h \
pan_compute.c \
@@ -31,4 +29,3 @@ C_SOURCES := \
pan_screen.c \
pan_screen.h \
pan_sfbd.c \
- pan_util.h
diff --git a/src/gallium/drivers/panfrost/meson.build b/src/gallium/drivers/panfrost/meson.build
index 92f043ea0a0..5a2d466c9d5 100644
--- a/src/gallium/drivers/panfrost/meson.build
+++ b/src/gallium/drivers/panfrost/meson.build
@@ -30,7 +30,6 @@ files_panfrost = files(
'nir/nir_lower_framebuffer.c',
'pan_context.c',
- 'pan_bo.c',
'pan_blit.c',
'pan_job.c',
'pan_allocate.c',
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c
index 63f87dc26e1..5d5a0f33248 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -76,7 +76,7 @@ panfrost_shader_compile(struct panfrost_context *ctx,
* that's how I'd do it. */
if (size) {
- state->bo = panfrost_bo_create(dev, size, PAN_BO_EXECUTE);
+ state->bo = pan_bo_create(dev, size, PAN_BO_EXECUTE);
memcpy(state->bo->cpu, dst, size);
state->first_tag = program.first_tag;
} else {
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index a0111a6ca06..2d268270954 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -922,7 +922,7 @@ panfrost_create_sampler_view(
template->u.tex.last_layer,
type, prsrc->layout);
- so->bo = panfrost_bo_create(device, size, 0);
+ so->bo = pan_bo_create(device, size, 0);
panfrost_new_texture(
so->bo->cpu,
@@ -1180,7 +1180,7 @@ panfrost_begin_query(struct pipe_context *pipe, struct pipe_query *q)
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
/* Allocate a bo for the query results to be stored */
if (!query->bo) {
- query->bo = panfrost_bo_create(
+ query->bo = pan_bo_create(
pan_device(ctx->base.screen),
sizeof(unsigned), 0);
}
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index eca2944bff0..8634bf74d6e 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -603,12 +603,12 @@ panfrost_batch_create_bo(struct panfrost_batch *batch, size_t size,
{
struct panfrost_bo *bo;
- bo = panfrost_bo_create(pan_device(batch->ctx->base.screen), size,
+ bo = pan_bo_create(pan_device(batch->ctx->base.screen), size,
create_flags);
panfrost_batch_add_bo(batch, bo, access_flags);
/* panfrost_batch_add_bo() has retained a reference and
- * panfrost_bo_create() initialize the refcnt to 1, so let's
+ * pan_bo_create() initialize the refcnt to 1, so let's
* unreference the BO here so it gets released when the batch is
* destroyed (unless it's retained by someone else in the meantime).
*/
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 3929ff176cd..3505f373788 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -47,8 +47,26 @@
#include "pan_resource.h"
#include "pan_util.h"
#include "pan_tiling.h"
+#include "pandecode/decode.h"
#include "panfrost-quirks.h"
+/* Wrapper around panfrost_bo_create that handles pandecode */
+
+struct panfrost_bo *
+pan_bo_create(struct panfrost_device *dev, size_t size, uint32_t flags)
+{
+ struct panfrost_bo *bo = panfrost_bo_create(dev, size, flags);
+
+ if (pan_debug & (PAN_DBG_TRACE | PAN_DBG_SYNC)) {
+ if (flags & PAN_BO_INVISIBLE)
+ pandecode_inject_mmap(bo->gpu, NULL, bo->size, NULL);
+ else if (!(flags & PAN_BO_DELAY_MMAP))
+ pandecode_inject_mmap(bo->gpu, bo->cpu, bo->size, NULL);
+ }
+
+ return bo;
+}
+
void
panfrost_resource_reset_damage(struct panfrost_resource *pres)
{
@@ -406,7 +424,7 @@ panfrost_resource_create_bo(struct panfrost_device *dev, struct panfrost_resourc
/* We create a BO immediately but don't bother mapping, since we don't
* care to map e.g. FBOs which the CPU probably won't touch */
- pres->bo = panfrost_bo_create(dev, bo_size, PAN_BO_DELAY_MMAP);
+ pres->bo = pan_bo_create(dev, bo_size, PAN_BO_DELAY_MMAP);
}
void
@@ -562,6 +580,9 @@ panfrost_transfer_map(struct pipe_context *pctx,
/* If we haven't already mmaped, now's the time */
panfrost_bo_mmap(bo);
+ if (pan_debug & (PAN_DBG_TRACE | PAN_DBG_SYNC))
+ pandecode_inject_mmap(bo->gpu, bo->cpu, bo->size, NULL);
+
if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) {
/* If the BO is used by one of the pending batches or if it's
* not ready yet (still accessed by one of the already flushed
@@ -580,7 +601,7 @@ panfrost_transfer_map(struct pipe_context *pctx,
* doing to it.
*/
if (!(bo->flags & (PAN_BO_IMPORTED | PAN_BO_EXPORTED)))
- newbo = panfrost_bo_create(dev, bo->size,
+ newbo = pan_bo_create(dev, bo->size,
flags);
if (newbo) {
@@ -862,7 +883,7 @@ panfrost_resource_hint_layout(
/* If we grew in size, reallocate the BO */
if (new_size > rsrc->bo->size) {
panfrost_bo_unreference(rsrc->bo);
- rsrc->bo = panfrost_bo_create(dev, new_size, PAN_BO_DELAY_MMAP);
+ rsrc->bo = pan_bo_create(dev, new_size, PAN_BO_DELAY_MMAP);
}
/* TODO: If there are textures bound, regenerate their descriptors */
diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h
index a3d78e940e5..0a25e305de0 100644
--- a/src/gallium/drivers/panfrost/pan_resource.h
+++ b/src/gallium/drivers/panfrost/pan_resource.h
@@ -118,4 +118,8 @@ panfrost_resource_set_damage_region(struct pipe_screen *screen,
unsigned int nrects,
const struct pipe_box *rects);
+
+struct panfrost_bo *
+pan_bo_create(struct panfrost_device *dev, size_t size, uint32_t flags);
+
#endif /* PAN_RESOURCE_H */
diff --git a/src/panfrost/Makefile.sources b/src/panfrost/Makefile.sources
index ad9a230567e..a92213a21ca 100644
--- a/src/panfrost/Makefile.sources
+++ b/src/panfrost/Makefile.sources
@@ -17,6 +17,8 @@ bifrost_FILES := \
encoder_FILES := \
encoder/pan_afbc.c \
encoder/pan_attributes.c \
+ encoder/pan_bo.c \
+ encoder/pan_bo.h \
encoder/pan_device.h \
encoder/pan_encoder.h \
encoder/pan_format.c \
@@ -25,7 +27,8 @@ encoder_FILES := \
encoder/pan_sampler.c \
encoder/pan_tiler.c \
encoder/pan_texture.c \
- encoder/pan_scratch.c
+ encoder/pan_scratch.c \
+ encoder/pan_util.h
midgard_FILES := \
midgard/compiler.h \
diff --git a/src/panfrost/encoder/meson.build b/src/panfrost/encoder/meson.build
index babf52916ae..de45322c578 100644
--- a/src/panfrost/encoder/meson.build
+++ b/src/panfrost/encoder/meson.build
@@ -24,6 +24,7 @@ libpanfrost_encoder_files = files(
'pan_afbc.c',
'pan_attributes.c',
+ 'pan_bo.c',
'pan_format.c',
'pan_invocation.c',
'pan_sampler.c',
diff --git a/src/gallium/drivers/panfrost/pan_bo.c b/src/panfrost/encoder/pan_bo.c
index 62e14a5bafd..aca4f8f3848 100644
--- a/src/gallium/drivers/panfrost/pan_bo.c
+++ b/src/panfrost/encoder/pan_bo.c
@@ -31,8 +31,6 @@
#include "drm-uapi/panfrost_drm.h"
#include "pan_bo.h"
-#include "pan_util.h"
-#include "pandecode/decode.h"
#include "os/os_mman.h"
@@ -72,7 +70,7 @@ panfrost_bo_alloc(struct panfrost_device *dev, size_t size,
ret = drmIoctl(dev->fd, DRM_IOCTL_PANFROST_CREATE_BO, &create_bo);
if (ret) {
- DBG("DRM_IOCTL_PANFROST_CREATE_BO failed: %m\n");
+ fprintf(stderr, "DRM_IOCTL_PANFROST_CREATE_BO failed: %m\n");
return NULL;
}
@@ -344,10 +342,6 @@ panfrost_bo_mmap(struct panfrost_bo *bo)
fprintf(stderr, "mmap failed: %p %m\n", bo->cpu);
assert(0);
}
-
- /* Record the mmap if we're tracing */
- if (pan_debug & (PAN_DBG_TRACE | PAN_DBG_SYNC))
- pandecode_inject_mmap(bo->gpu, bo->cpu, bo->size, NULL);
}
static void
@@ -404,10 +398,6 @@ panfrost_bo_create(struct panfrost_device *dev, size_t size,
if (!(flags & (PAN_BO_INVISIBLE | PAN_BO_DELAY_MMAP)))
panfrost_bo_mmap(bo);
- else if (flags & PAN_BO_INVISIBLE) {
- if (pan_debug & (PAN_DBG_TRACE | PAN_DBG_SYNC))
- pandecode_inject_mmap(bo->gpu, NULL, bo->size, NULL);
- }
p_atomic_set(&bo->refcnt, 1);
diff --git a/src/gallium/drivers/panfrost/pan_bo.h b/src/panfrost/encoder/pan_bo.h
index fc20ceed1d4..fc20ceed1d4 100644
--- a/src/gallium/drivers/panfrost/pan_bo.h
+++ b/src/panfrost/encoder/pan_bo.h
diff --git a/src/panfrost/encoder/pan_device.h b/src/panfrost/encoder/pan_device.h
index 07158b92007..19aa2df35bd 100644
--- a/src/panfrost/encoder/pan_device.h
+++ b/src/panfrost/encoder/pan_device.h
@@ -34,9 +34,9 @@
#include "util/u_dynarray.h"
#include "util/bitset.h"
#include "util/set.h"
+#include "util/list.h"
#include <panfrost-misc.h>
-#include "pan_allocate.h"
/* Driver limits */
#define PAN_MAX_CONST_BUFFERS 16
diff --git a/src/gallium/drivers/panfrost/pan_util.h b/src/panfrost/encoder/pan_util.h
index 06484ce383b..06484ce383b 100644
--- a/src/gallium/drivers/panfrost/pan_util.h
+++ b/src/panfrost/encoder/pan_util.h