From 7c2308769b0766578dc0f7e95471cd6f1903bcec Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Sun, 27 Dec 2020 00:01:44 +1300 Subject: [PATCH] panfrost: Use the correct NIR options for OpenCL on Bifrost This is needed so that 64-bit operations are lowered properly. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_compute.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c index 103327eab46..324b2fe0fbf 100644 --- a/src/gallium/drivers/panfrost/pan_compute.c +++ b/src/gallium/drivers/panfrost/pan_compute.c @@ -32,6 +32,8 @@ #include "pan_bo.h" #include "util/u_memory.h" #include "nir_serialize.h" +#include "midgard/midgard_compile.h" +#include "bifrost/bifrost_compile.h" /* Compute CSOs are tracked like graphics shader CSOs, but are * considerably simpler. We do not implement multiple @@ -44,6 +46,7 @@ panfrost_create_compute_state( const struct pipe_compute_state *cso) { struct panfrost_context *ctx = pan_context(pctx); + struct panfrost_device *dev = pan_device(pctx->screen); struct panfrost_shader_variants *so = CALLOC_STRUCT(panfrost_shader_variants); so->cbase = *cso; @@ -60,7 +63,12 @@ panfrost_create_compute_state( 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); + + const struct nir_shader_compiler_options *options = + (dev->quirks & IS_BIFROST) ? &bifrost_nir_options + : &midgard_nir_options; + + so->cbase.prog = nir_deserialize(NULL, options, &reader); so->cbase.ir_type = PIPE_SHADER_IR_NIR; }