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 7955fabcf8 by
Karol Herbst).
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
@@ -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,12 +53,19 @@ panfrost_create_compute_state(
|
||||
|
||||
v->tripipe = malloc(sizeof(struct mali_shader_meta));
|
||||
|
||||
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,
|
||||
cso->ir_type, cso->prog,
|
||||
so->cbase.ir_type, so->cbase.prog,
|
||||
MESA_SHADER_COMPUTE, v, NULL);
|
||||
|
||||
|
||||
|
||||
return so;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user