summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-10-19 17:14:44 -0400
committerAlyssa Rosenzweig <[email protected]>2019-10-26 13:17:42 +0000
commit728a9757006c564d11a550f559ca3a89e496b813 (patch)
treebf33ae0d64683dc4163c731d9ceb85b7346ade8d /src
parentafb0d08cb0f2f97620504e5ccf9bf0c744c42403 (diff)
panfrost: Expose serialized NIR support
Serialized NIR is required for clover with the SPIR-V pipeline. With this change and PAN_MESA_DEBUG=deqp, clinfo is able to successfully probe panfrost. Code from Nouveau (commit 7955fabcf89c7265f7f4244e46c5bcb83b9687fa by Karol Herbst). Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/panfrost/pan_compute.c15
-rw-r--r--src/gallium/drivers/panfrost/pan_screen.c2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c
index 036dffbb17b..20a9a0904a6 100644
--- a/src/gallium/drivers/panfrost/pan_compute.c
+++ b/src/gallium/drivers/panfrost/pan_compute.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019 Collabora, Ltd.
+ * Copyright (C) 2019 Red Hat Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -27,6 +28,7 @@
#include "pan_context.h"
#include "util/u_memory.h"
+#include "nir_serialize.h"
/* Compute CSOs are tracked like graphics shader CSOs, but are
* considerably simpler. We do not implement multiple
@@ -51,11 +53,18 @@ panfrost_create_compute_state(
v->tripipe = malloc(sizeof(struct mali_shader_meta));
- panfrost_shader_compile(ctx, v->tripipe,
- cso->ir_type, cso->prog,
- MESA_SHADER_COMPUTE, v, NULL);
+ if (cso->ir_type == PIPE_SHADER_IR_NIR_SERIALIZED) {
+ struct blob_reader reader;
+ const struct pipe_binary_program_header *hdr = cso->prog;
+ blob_reader_init(&reader, hdr->blob, hdr->num_bytes);
+ so->cbase.prog = nir_deserialize(NULL, &midgard_nir_options, &reader);
+ so->cbase.ir_type = PIPE_SHADER_IR_NIR;
+ }
+ panfrost_shader_compile(ctx, v->tripipe,
+ so->cbase.ir_type, so->cbase.prog,
+ MESA_SHADER_COMPUTE, v, NULL);
return so;
}
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index d698e5071f8..8d54f8c0aa1 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -330,7 +330,7 @@ panfrost_get_shader_param(struct pipe_screen *screen,
return PIPE_SHADER_IR_NIR;
case PIPE_SHADER_CAP_SUPPORTED_IRS:
- return (1 << PIPE_SHADER_IR_NIR);
+ return (1 << PIPE_SHADER_IR_NIR) | (1 << PIPE_SHADER_IR_NIR_SERIALIZED);
case PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT:
return 32;