mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 11:40:10 +01:00
intel: Add meson option -Dintel-elk
Defaults to true. When set to false Iris and various tools can be built without ELK support. In both cases this means supporting only Gfx9+. This option must be true to build Crocus or Hasvk. This allows skipping re-building ELK when developing for newer platforms with tools/tests enabled. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11575 Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33054>
This commit is contained in:
parent
31e5d909e7
commit
fbacf3761f
17 changed files with 291 additions and 52 deletions
|
|
@ -687,6 +687,15 @@ option(
|
|||
description : 'Build Ray Tracing on supported hardware.'
|
||||
)
|
||||
|
||||
option(
|
||||
'intel-elk',
|
||||
type : 'boolean',
|
||||
value : true,
|
||||
description : 'Build ELK compiler (used for Gfx8 and earlier). ' +
|
||||
'This is required for Crocus and Hasvk, and it is ' +
|
||||
'optional for Iris and various developer tools.'
|
||||
)
|
||||
|
||||
option(
|
||||
'video-codecs',
|
||||
type : 'array',
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@
|
|||
#include "common/intel_aux_map.h"
|
||||
#include "intel/common/intel_gem.h"
|
||||
#include "intel/compiler/brw_compiler.h"
|
||||
#ifdef INTEL_USE_ELK
|
||||
#include "intel/compiler/elk/elk_compiler.h"
|
||||
#endif
|
||||
#include "intel/ds/intel_tracepoints.h"
|
||||
#include "util/hash_table.h"
|
||||
#include "util/u_debug.h"
|
||||
|
|
@ -239,11 +241,15 @@ iris_init_batch(struct iris_context *ice,
|
|||
stderr, decode_flags, NULL,
|
||||
decode_get_bo, decode_get_state_size, batch);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(screen->elk);
|
||||
intel_batch_decode_ctx_init_elk(&batch->decoder, &screen->elk->isa,
|
||||
screen->devinfo,
|
||||
stderr, decode_flags, NULL,
|
||||
decode_get_bo, decode_get_state_size, batch);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
batch->decoder.dynamic_base = IRIS_MEMZONE_DYNAMIC_START;
|
||||
batch->decoder.instruction_base = IRIS_MEMZONE_SHADER_START;
|
||||
|
|
|
|||
|
|
@ -2574,6 +2574,14 @@ iris_bufmgr_get_for_fd(int fd, bool bo_reuse)
|
|||
if (devinfo.ver < 8 || devinfo.platform == INTEL_PLATFORM_CHV)
|
||||
return NULL;
|
||||
|
||||
#ifndef INTEL_USE_ELK
|
||||
if (devinfo.ver < 9) {
|
||||
WARN_ONCE(devinfo.ver == 8,
|
||||
"ERROR: Iris was compiled without support for Gfx version 8.\n");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
bufmgr = iris_bufmgr_create(&devinfo, fd, bo_reuse);
|
||||
if (bufmgr)
|
||||
list_addtail(&bufmgr->link, &global_bufmgr_list);
|
||||
|
|
|
|||
|
|
@ -285,6 +285,12 @@ iris_destroy_context(struct pipe_context *ctx)
|
|||
unreachable("Unknown hardware generation"); \
|
||||
}
|
||||
|
||||
#ifndef INTEL_USE_ELK
|
||||
static inline void gfx8_init_state(struct iris_context *ice) { unreachable("no elk support"); }
|
||||
static inline void gfx8_init_blorp(struct iris_context *ice) { unreachable("no elk support"); }
|
||||
static inline void gfx8_init_query(struct iris_context *ice) { unreachable("no elk support"); }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Create a context.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1513,9 +1513,11 @@ iris_execute_indirect_draw_supported(const struct iris_context *ice,
|
|||
#ifdef genX
|
||||
# include "iris_genx_protos.h"
|
||||
#else
|
||||
# ifdef INTEL_USE_ELK
|
||||
# define genX(x) gfx8_##x
|
||||
# include "iris_genx_protos.h"
|
||||
# undef genX
|
||||
# endif
|
||||
# define genX(x) gfx9_##x
|
||||
# include "iris_genx_protos.h"
|
||||
# undef genX
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@
|
|||
#include "util/disk_cache.h"
|
||||
#include "util/mesa-sha1.h"
|
||||
#include "intel/compiler/brw_compiler.h"
|
||||
#ifdef INTEL_USE_ELK
|
||||
#include "intel/compiler/elk/elk_compiler.h"
|
||||
#endif
|
||||
|
||||
#include "iris_context.h"
|
||||
|
||||
|
|
@ -89,8 +91,12 @@ iris_disk_cache_store(struct disk_cache *cache,
|
|||
|
||||
gl_shader_stage stage = ish->nir->info.stage;
|
||||
const struct brw_stage_prog_data *brw = shader->brw_prog_data;
|
||||
#ifdef INTEL_USE_ELK
|
||||
const struct elk_stage_prog_data *elk = shader->elk_prog_data;
|
||||
assert((brw == NULL) != (elk == NULL));
|
||||
#else
|
||||
assert(brw);
|
||||
#endif
|
||||
|
||||
cache_key cache_key;
|
||||
iris_disk_cache_compute_key(cache, ish, prog_key, prog_key_size, cache_key);
|
||||
|
|
@ -126,6 +132,7 @@ iris_disk_cache_store(struct disk_cache *cache,
|
|||
serializable.base.relocs = NULL;
|
||||
blob_write_bytes(&blob, &serializable, prog_data_s);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
size_t prog_data_s = elk_prog_data_size(stage);
|
||||
union elk_any_prog_data serializable;
|
||||
assert(prog_data_s <= sizeof(serializable));
|
||||
|
|
@ -133,6 +140,9 @@ iris_disk_cache_store(struct disk_cache *cache,
|
|||
serializable.base.param = NULL;
|
||||
serializable.base.relocs = NULL;
|
||||
blob_write_bytes(&blob, &serializable, prog_data_s);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
blob_write_bytes(&blob, shader->map, shader->program_size);
|
||||
|
|
@ -146,10 +156,14 @@ iris_disk_cache_store(struct disk_cache *cache,
|
|||
blob_write_bytes(&blob, brw->param,
|
||||
brw->nr_params * sizeof(uint32_t));
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
blob_write_bytes(&blob, elk->relocs,
|
||||
elk->num_relocs * sizeof(struct elk_shader_reloc));
|
||||
blob_write_bytes(&blob, elk->param,
|
||||
elk->nr_params * sizeof(uint32_t));
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
blob_write_bytes(&blob, &shader->bt, sizeof(shader->bt));
|
||||
|
||||
|
|
@ -204,8 +218,11 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
|
|||
if (!buffer)
|
||||
return false;
|
||||
|
||||
const uint32_t prog_data_size = screen->brw ? brw_prog_data_size(stage)
|
||||
: elk_prog_data_size(stage);
|
||||
const uint32_t prog_data_size =
|
||||
#ifdef INTEL_USE_ELK
|
||||
screen->elk ? elk_prog_data_size(stage) :
|
||||
#endif
|
||||
brw_prog_data_size(stage);
|
||||
|
||||
void *prog_data = ralloc_size(NULL, prog_data_size);
|
||||
const void *assembly;
|
||||
|
|
@ -215,13 +232,24 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
|
|||
uint32_t *so_decls = NULL;
|
||||
|
||||
struct brw_stage_prog_data *brw = screen->brw ? prog_data : NULL;
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_stage_prog_data *elk = screen->elk ? prog_data : NULL;
|
||||
assert((brw == NULL) != (elk == NULL));
|
||||
#else
|
||||
assert(brw);
|
||||
#endif
|
||||
|
||||
struct blob_reader blob;
|
||||
blob_reader_init(&blob, buffer, size);
|
||||
blob_copy_bytes(&blob, prog_data, prog_data_size);
|
||||
assembly = blob_read_bytes(&blob, brw ? brw->program_size : elk->program_size);
|
||||
|
||||
const unsigned program_size =
|
||||
#ifdef INTEL_USE_ELK
|
||||
elk ? elk->program_size :
|
||||
#endif
|
||||
brw->program_size;
|
||||
|
||||
assembly = blob_read_bytes(&blob, program_size);
|
||||
num_system_values = blob_read_uint32(&blob);
|
||||
if (num_system_values) {
|
||||
system_values =
|
||||
|
|
@ -248,6 +276,7 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
|
|||
blob_copy_bytes(&blob, brw->param, brw->nr_params * sizeof(uint32_t));
|
||||
}
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
elk->relocs = NULL;
|
||||
if (elk->num_relocs) {
|
||||
struct elk_shader_reloc *relocs =
|
||||
|
|
@ -263,6 +292,9 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
|
|||
blob_copy_bytes(&blob, elk->param,
|
||||
elk->nr_params * sizeof(uint32_t));
|
||||
}
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
struct iris_binding_table bt;
|
||||
|
|
@ -272,8 +304,10 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
|
|||
stage == MESA_SHADER_TESS_EVAL ||
|
||||
stage == MESA_SHADER_GEOMETRY) {
|
||||
struct intel_vue_map *vue_map =
|
||||
screen->brw ? &brw_vue_prog_data(prog_data)->vue_map
|
||||
: &elk_vue_prog_data(prog_data)->vue_map;
|
||||
#ifdef INTEL_USE_ELK
|
||||
screen->elk ? &elk_vue_prog_data(prog_data)->vue_map :
|
||||
#endif
|
||||
&brw_vue_prog_data(prog_data)->vue_map;
|
||||
so_decls = screen->vtbl.create_so_decl_list(&ish->stream_output, vue_map);
|
||||
}
|
||||
|
||||
|
|
@ -292,7 +326,11 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
|
|||
if (brw)
|
||||
iris_apply_brw_prog_data(shader, brw);
|
||||
else
|
||||
#ifdef INTEL_USE_ELK
|
||||
iris_apply_elk_prog_data(shader, elk);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
|
||||
iris_finalize_program(shader, so_decls, system_values,
|
||||
num_system_values, kernel_input_size, num_cbufs,
|
||||
|
|
@ -348,9 +386,12 @@ iris_disk_cache_init(struct iris_screen *screen)
|
|||
char timestamp[41];
|
||||
_mesa_sha1_format(timestamp, id_sha1);
|
||||
|
||||
const uint64_t driver_flags = screen->brw ?
|
||||
brw_get_compiler_config_value(screen->brw) :
|
||||
elk_get_compiler_config_value(screen->elk);
|
||||
const uint64_t driver_flags =
|
||||
#ifdef INTEL_USE_ELK
|
||||
screen->elk ? elk_get_compiler_config_value(screen->elk) :
|
||||
#endif
|
||||
brw_get_compiler_config_value(screen->brw);
|
||||
|
||||
screen->disk_cache = disk_cache_create(renderer, timestamp, driver_flags);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,9 +46,11 @@
|
|||
#include "intel/compiler/brw_nir.h"
|
||||
#include "intel/compiler/intel_nir.h"
|
||||
#include "intel/compiler/brw_prim.h"
|
||||
#ifdef INTEL_USE_ELK
|
||||
#include "intel/compiler/elk/elk_compiler.h"
|
||||
#include "intel/compiler/elk/elk_nir.h"
|
||||
#include "intel/compiler/elk/elk_prim.h"
|
||||
#endif
|
||||
#include "iris_context.h"
|
||||
#include "iris_pipe.h"
|
||||
#include "nir/tgsi_to_nir.h"
|
||||
|
|
@ -59,9 +61,12 @@
|
|||
#define BRW_KEY_INIT(gen, prog_id, limit_trig_input) \
|
||||
.base.program_string_id = prog_id, \
|
||||
.base.limit_trig_input_range = limit_trig_input
|
||||
|
||||
#ifdef INTEL_USE_ELK
|
||||
#define ELK_KEY_INIT(gen, prog_id, limit_trig_input) \
|
||||
.base.program_string_id = prog_id, \
|
||||
.base.limit_trig_input_range = limit_trig_input
|
||||
#endif
|
||||
|
||||
struct iris_threaded_compile_job {
|
||||
struct iris_screen *screen;
|
||||
|
|
@ -285,6 +290,8 @@ iris_apply_brw_prog_data(struct iris_compiled_shader *shader,
|
|||
ralloc_steal(shader->brw_prog_data, brw->param);
|
||||
}
|
||||
|
||||
#ifdef INTEL_USE_ELK
|
||||
|
||||
static void
|
||||
iris_apply_elk_wm_prog_data(struct iris_compiled_shader *shader,
|
||||
const struct elk_wm_prog_data *elk)
|
||||
|
|
@ -485,6 +492,8 @@ iris_apply_elk_prog_data(struct iris_compiled_shader *shader,
|
|||
ralloc_steal(shader->elk_prog_data, elk->param);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
iris_finalize_program(struct iris_compiled_shader *shader,
|
||||
uint32_t *streamout,
|
||||
|
|
@ -495,7 +504,11 @@ iris_finalize_program(struct iris_compiled_shader *shader,
|
|||
const struct iris_binding_table *bt)
|
||||
{
|
||||
/* There can be only one. */
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert((shader->brw_prog_data == NULL) != (shader->elk_prog_data == NULL));
|
||||
#else
|
||||
assert(shader->brw_prog_data);
|
||||
#endif
|
||||
|
||||
shader->streamout = streamout;
|
||||
shader->system_values = system_values;
|
||||
|
|
@ -588,6 +601,8 @@ iris_to_brw_cs_key(const struct iris_screen *screen,
|
|||
};
|
||||
}
|
||||
|
||||
#ifdef INTEL_USE_ELK
|
||||
|
||||
static struct elk_vs_prog_key
|
||||
iris_to_elk_vs_key(const struct iris_screen *screen,
|
||||
const struct iris_vs_prog_key *key)
|
||||
|
|
@ -672,6 +687,8 @@ iris_to_elk_cs_key(const struct iris_screen *screen,
|
|||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void *
|
||||
upload_state(struct u_upload_mgr *uploader,
|
||||
struct iris_state_ref *ref,
|
||||
|
|
@ -911,6 +928,7 @@ static void
|
|||
setup_vec4_image_sysval(uint32_t *sysvals, uint32_t idx,
|
||||
unsigned offset, unsigned n)
|
||||
{
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(offset % sizeof(uint32_t) == 0);
|
||||
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
|
|
@ -918,6 +936,9 @@ setup_vec4_image_sysval(uint32_t *sysvals, uint32_t idx,
|
|||
|
||||
for (unsigned i = n; i < 4; ++i)
|
||||
sysvals[i] = ELK_PARAM_BUILTIN_ZERO;
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1635,6 +1656,8 @@ iris_debug_recompile_brw(struct iris_screen *screen,
|
|||
brw_debug_key_recompile(c, dbg, info->stage, &old_key.base, key);
|
||||
}
|
||||
|
||||
#ifdef INTEL_USE_ELK
|
||||
|
||||
static void
|
||||
iris_debug_recompile_elk(struct iris_screen *screen,
|
||||
struct util_debug_callback *dbg,
|
||||
|
|
@ -1685,6 +1708,7 @@ iris_debug_recompile_elk(struct iris_screen *screen,
|
|||
elk_debug_key_recompile(c, dbg, info->stage, &old_key.base, key);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
check_urb_size(struct iris_context *ice,
|
||||
|
|
@ -1898,6 +1922,7 @@ iris_compile_vs(struct iris_screen *screen,
|
|||
iris_debug_recompile_brw(screen, dbg, ish, &brw_key.base);
|
||||
}
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_vs_prog_data *elk_prog_data =
|
||||
rzalloc(mem_ctx, struct elk_vs_prog_data);
|
||||
|
||||
|
|
@ -1928,6 +1953,9 @@ iris_compile_vs(struct iris_screen *screen,
|
|||
iris_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
|
||||
iris_apply_elk_prog_data(shader, &elk_prog_data->base.base);
|
||||
}
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (program == NULL) {
|
||||
|
|
@ -2071,7 +2099,9 @@ iris_compile_tcs(struct iris_screen *screen,
|
|||
|
||||
const struct iris_tcs_prog_key *const key = &shader->key.tcs;
|
||||
struct brw_tcs_prog_key brw_key = iris_to_brw_tcs_key(screen, key);
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_tcs_prog_key elk_key = iris_to_elk_tcs_key(screen, key);
|
||||
#endif
|
||||
uint32_t source_hash;
|
||||
|
||||
if (ish) {
|
||||
|
|
@ -2081,8 +2111,12 @@ iris_compile_tcs(struct iris_screen *screen,
|
|||
if (screen->brw) {
|
||||
nir = brw_nir_create_passthrough_tcs(mem_ctx, screen->brw, &brw_key);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(screen->elk);
|
||||
nir = elk_nir_create_passthrough_tcs(mem_ctx, screen->elk, &elk_key);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
source_hash = *(uint32_t*)nir->info.source_blake3;
|
||||
}
|
||||
|
|
@ -2118,6 +2152,7 @@ iris_compile_tcs(struct iris_screen *screen,
|
|||
iris_debug_recompile_brw(screen, dbg, ish, &brw_key.base);
|
||||
}
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(screen->elk);
|
||||
struct elk_tcs_prog_data *elk_prog_data =
|
||||
rzalloc(mem_ctx, struct elk_tcs_prog_data);
|
||||
|
|
@ -2141,6 +2176,9 @@ iris_compile_tcs(struct iris_screen *screen,
|
|||
iris_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
|
||||
iris_apply_elk_prog_data(shader, &elk_prog_data->base.base);
|
||||
}
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (program == NULL) {
|
||||
|
|
@ -2317,6 +2355,7 @@ iris_compile_tes(struct iris_screen *screen,
|
|||
iris_apply_brw_prog_data(shader, &brw_prog_data->base.base);
|
||||
}
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_tes_prog_data *elk_prog_data =
|
||||
rzalloc(mem_ctx, struct elk_tes_prog_data);
|
||||
|
||||
|
|
@ -2347,6 +2386,9 @@ iris_compile_tes(struct iris_screen *screen,
|
|||
iris_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
|
||||
iris_apply_elk_prog_data(shader, &elk_prog_data->base.base);
|
||||
}
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (program == NULL) {
|
||||
|
|
@ -2496,6 +2538,7 @@ iris_compile_gs(struct iris_screen *screen,
|
|||
iris_apply_brw_prog_data(shader, &brw_prog_data->base.base);
|
||||
}
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_gs_prog_data *elk_prog_data =
|
||||
rzalloc(mem_ctx, struct elk_gs_prog_data);
|
||||
|
||||
|
|
@ -2524,6 +2567,9 @@ iris_compile_gs(struct iris_screen *screen,
|
|||
iris_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
|
||||
iris_apply_elk_prog_data(shader, &elk_prog_data->base.base);
|
||||
}
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (program == NULL) {
|
||||
|
|
@ -2675,6 +2721,7 @@ iris_compile_fs(struct iris_screen *screen,
|
|||
iris_apply_brw_prog_data(shader, &brw_prog_data->base);
|
||||
}
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_wm_prog_data *elk_prog_data =
|
||||
rzalloc(mem_ctx, struct elk_wm_prog_data);
|
||||
|
||||
|
|
@ -2705,6 +2752,9 @@ iris_compile_fs(struct iris_screen *screen,
|
|||
iris_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
|
||||
iris_apply_elk_prog_data(shader, &elk_prog_data->base);
|
||||
}
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (program == NULL) {
|
||||
|
|
@ -2961,7 +3011,11 @@ iris_compile_cs(struct iris_screen *screen,
|
|||
if (screen->brw)
|
||||
NIR_PASS_V(nir, brw_nir_lower_cs_intrinsics, devinfo, NULL);
|
||||
else
|
||||
#ifdef INTEL_USE_ELK
|
||||
NIR_PASS_V(nir, elk_nir_lower_cs_intrinsics, devinfo, NULL);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
|
||||
iris_setup_uniforms(devinfo, mem_ctx, nir, ish->kernel_input_size,
|
||||
&system_values, &num_system_values, &num_cbufs);
|
||||
|
|
@ -2997,6 +3051,7 @@ iris_compile_cs(struct iris_screen *screen,
|
|||
iris_apply_brw_prog_data(shader, &brw_prog_data->base);
|
||||
}
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_cs_prog_key elk_key = iris_to_elk_cs_key(screen, key);
|
||||
|
||||
struct elk_cs_prog_data *elk_prog_data =
|
||||
|
|
@ -3019,6 +3074,9 @@ iris_compile_cs(struct iris_screen *screen,
|
|||
iris_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
|
||||
iris_apply_elk_prog_data(shader, &elk_prog_data->base);
|
||||
}
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (program == NULL) {
|
||||
|
|
@ -3444,7 +3502,9 @@ iris_create_shader_state(struct pipe_context *ctx,
|
|||
(1ull << IRIS_NOS_RASTERIZER) |
|
||||
(1ull << IRIS_NOS_BLEND);
|
||||
|
||||
#ifdef INTEL_USE_ELK
|
||||
STATIC_ASSERT(BRW_FS_VARYING_INPUT_MASK == ELK_FS_VARYING_INPUT_MASK);
|
||||
#endif
|
||||
|
||||
/* The program key needs the VUE map if there are > 16 inputs */
|
||||
if (util_bitcount64(info->inputs_read & BRW_FS_VARYING_INPUT_MASK) > 16) {
|
||||
|
|
@ -3719,6 +3779,7 @@ iris_finalize_nir(struct pipe_screen *_screen, struct nir_shader *nir)
|
|||
.lower_stores = true,
|
||||
});
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(screen->elk);
|
||||
|
||||
struct elk_nir_compiler_opts opts = {};
|
||||
|
|
@ -3735,6 +3796,9 @@ iris_finalize_nir(struct pipe_screen *_screen, struct nir_shader *nir)
|
|||
*/
|
||||
.lower_get_size = true,
|
||||
});
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
NIR_PASS_V(nir, iris_lower_storage_image_derefs);
|
||||
|
|
@ -3825,10 +3889,14 @@ iris_get_cs_dispatch_info(const struct intel_device_info *devinfo,
|
|||
brw_cs_prog_data(shader->brw_prog_data),
|
||||
block);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(shader->elk_prog_data);
|
||||
return elk_cs_get_dispatch_info(devinfo,
|
||||
elk_cs_prog_data(shader->elk_prog_data),
|
||||
block);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3840,9 +3908,13 @@ iris_cs_push_const_total_size(const struct iris_compiled_shader *shader,
|
|||
return brw_cs_push_const_total_size(brw_cs_prog_data(shader->brw_prog_data),
|
||||
threads);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(shader->elk_prog_data);
|
||||
return elk_cs_push_const_total_size(elk_cs_prog_data(shader->elk_prog_data),
|
||||
threads);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3854,9 +3926,13 @@ iris_fs_barycentric_modes(const struct iris_compiled_shader *shader,
|
|||
return wm_prog_data_barycentric_modes(brw_wm_prog_data(shader->brw_prog_data),
|
||||
pushed_msaa_flags);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(shader->elk_prog_data);
|
||||
return elk_wm_prog_data_barycentric_modes(elk_wm_prog_data(shader->elk_prog_data),
|
||||
pushed_msaa_flags);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3872,8 +3948,12 @@ iris_indirect_ubos_use_sampler(struct iris_screen *screen)
|
|||
if (screen->brw) {
|
||||
return screen->brw->indirect_ubos_use_sampler;
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(screen->elk);
|
||||
return screen->elk->indirect_ubos_use_sampler;
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3921,25 +4001,34 @@ iris_get_compiler_options(struct pipe_screen *pscreen,
|
|||
gl_shader_stage stage = stage_from_pipe(pstage);
|
||||
assert(ir == PIPE_SHADER_IR_NIR);
|
||||
|
||||
#ifdef INTEL_USE_ELK
|
||||
return screen->brw ? screen->brw->nir_options[stage]
|
||||
: screen->elk->nir_options[stage];
|
||||
#else
|
||||
return screen->brw->nir_options[stage];
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
iris_compiler_init(struct iris_screen *screen)
|
||||
{
|
||||
STATIC_ASSERT(IRIS_MAX_DRAW_BUFFERS == BRW_MAX_DRAW_BUFFERS);
|
||||
STATIC_ASSERT(IRIS_MAX_DRAW_BUFFERS == ELK_MAX_DRAW_BUFFERS);
|
||||
STATIC_ASSERT(IRIS_MAX_SOL_BINDINGS == ELK_MAX_SOL_BINDINGS);
|
||||
|
||||
if (screen->devinfo->ver >= 9) {
|
||||
STATIC_ASSERT(IRIS_MAX_DRAW_BUFFERS == BRW_MAX_DRAW_BUFFERS);
|
||||
|
||||
screen->brw = brw_compiler_create(screen, screen->devinfo);
|
||||
screen->brw->shader_debug_log = iris_shader_debug_log;
|
||||
screen->brw->shader_perf_log = iris_shader_perf_log;
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
STATIC_ASSERT(IRIS_MAX_DRAW_BUFFERS == ELK_MAX_DRAW_BUFFERS);
|
||||
STATIC_ASSERT(IRIS_MAX_SOL_BINDINGS == ELK_MAX_SOL_BINDINGS);
|
||||
|
||||
screen->elk = elk_compiler_create(screen, screen->devinfo);
|
||||
screen->elk->shader_debug_log = iris_shader_debug_log;
|
||||
screen->elk->shader_perf_log = iris_shader_perf_log;
|
||||
screen->elk->supports_shader_constants = true;
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,10 @@
|
|||
#include "compiler/nir/nir_builder.h"
|
||||
#include "intel/compiler/brw_compiler.h"
|
||||
#include "intel/compiler/brw_nir.h"
|
||||
#ifdef INTEL_USE_ELK
|
||||
#include "intel/compiler/elk/elk_compiler.h"
|
||||
#include "intel/compiler/elk/elk_nir.h"
|
||||
#endif
|
||||
#include "iris_context.h"
|
||||
#include "iris_resource.h"
|
||||
|
||||
|
|
@ -187,6 +189,7 @@ iris_upload_shader(struct iris_screen *screen,
|
|||
shader->brw_prog_data, reloc_values,
|
||||
ARRAY_SIZE(reloc_values));
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_shader_reloc_value reloc_values[] = {
|
||||
{
|
||||
.id = BRW_SHADER_RELOC_CONST_DATA_ADDR_LOW,
|
||||
|
|
@ -200,6 +203,9 @@ iris_upload_shader(struct iris_screen *screen,
|
|||
elk_write_shader_relocs(&screen->elk->isa, shader->map,
|
||||
shader->elk_prog_data, reloc_values,
|
||||
ARRAY_SIZE(reloc_values));
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Store the 3DSTATE shader packets and other derived state. */
|
||||
|
|
@ -221,7 +227,6 @@ iris_blorp_lookup_shader(struct blorp_batch *blorp_batch,
|
|||
struct blorp_context *blorp = blorp_batch->blorp;
|
||||
struct iris_context *ice = blorp->driver_ctx;
|
||||
struct iris_batch *batch = blorp_batch->driver_batch;
|
||||
struct iris_screen *screen = batch->screen;
|
||||
struct iris_compiled_shader *shader =
|
||||
iris_find_cached_shader(ice, IRIS_CACHE_BLORP, key_size, key);
|
||||
|
||||
|
|
@ -231,8 +236,11 @@ iris_blorp_lookup_shader(struct blorp_batch *blorp_batch,
|
|||
struct iris_bo *bo = iris_resource_bo(shader->assembly.res);
|
||||
*kernel_out =
|
||||
iris_bo_offset_from_base_address(bo) + shader->assembly.offset;
|
||||
*((void **) prog_data_out) = screen->brw ? (void *)shader->brw_prog_data
|
||||
: (void *)shader->elk_prog_data;
|
||||
*((void **) prog_data_out) =
|
||||
#ifdef INTEL_USE_ELK
|
||||
batch->screen->elk ? (void *)shader->elk_prog_data :
|
||||
#endif
|
||||
(void *)shader->brw_prog_data;
|
||||
|
||||
iris_use_pinned_bo(batch, bo, false, IRIS_DOMAIN_NONE);
|
||||
|
||||
|
|
@ -265,8 +273,12 @@ iris_blorp_upload_shader(struct blorp_batch *blorp_batch, uint32_t stage,
|
|||
if (screen->brw) {
|
||||
iris_apply_brw_prog_data(shader, prog_data);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(screen->elk);
|
||||
iris_apply_elk_prog_data(shader, prog_data);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
iris_finalize_program(shader, NULL, NULL, 0, 0, 0, &bt);
|
||||
|
|
@ -278,8 +290,11 @@ iris_blorp_upload_shader(struct blorp_batch *blorp_batch, uint32_t stage,
|
|||
struct iris_bo *bo = iris_resource_bo(shader->assembly.res);
|
||||
*kernel_out =
|
||||
iris_bo_offset_from_base_address(bo) + shader->assembly.offset;
|
||||
*((void **) prog_data_out) = screen->brw ? (void *)shader->brw_prog_data
|
||||
: (void *)shader->elk_prog_data;
|
||||
*((void **) prog_data_out) =
|
||||
#ifdef INTEL_USE_ELK
|
||||
screen->elk ? (void *)shader->elk_prog_data :
|
||||
#endif
|
||||
(void*)shader->brw_prog_data;
|
||||
|
||||
iris_use_pinned_bo(batch, bo, false, IRIS_DOMAIN_NONE);
|
||||
|
||||
|
|
@ -362,8 +377,10 @@ iris_ensure_indirect_generation_shader(struct iris_batch *batch)
|
|||
return;
|
||||
|
||||
const nir_shader_compiler_options *nir_options =
|
||||
screen->brw ? screen->brw->nir_options[MESA_SHADER_COMPUTE]
|
||||
: screen->elk->nir_options[MESA_SHADER_COMPUTE];
|
||||
#ifdef INTEL_USE_ELK
|
||||
screen->elk ? screen->elk->nir_options[MESA_SHADER_COMPUTE] :
|
||||
#endif
|
||||
screen->brw->nir_options[MESA_SHADER_COMPUTE];
|
||||
|
||||
nir_builder b = nir_builder_init_simple_shader(MESA_SHADER_FRAGMENT,
|
||||
nir_options,
|
||||
|
|
@ -393,9 +410,13 @@ iris_ensure_indirect_generation_shader(struct iris_batch *batch)
|
|||
struct brw_nir_compiler_opts opts = {};
|
||||
brw_preprocess_nir(screen->brw, nir, &opts);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
assert(screen->elk);
|
||||
struct elk_nir_compiler_opts opts = {};
|
||||
elk_preprocess_nir(screen->elk, nir, &opts);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
NIR_PASS_V(nir, nir_propagate_invariant, false);
|
||||
|
|
@ -461,6 +482,7 @@ iris_ensure_indirect_generation_shader(struct iris_batch *batch)
|
|||
assert(program);
|
||||
iris_apply_brw_prog_data(shader, &prog_data->base);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
union elk_any_prog_key prog_key;
|
||||
memset(&prog_key, 0, sizeof(prog_key));
|
||||
|
||||
|
|
@ -485,6 +507,9 @@ iris_ensure_indirect_generation_shader(struct iris_batch *batch)
|
|||
program = elk_compile_fs(screen->elk, ¶ms);
|
||||
assert(program);
|
||||
iris_apply_elk_prog_data(shader, &prog_data->base);
|
||||
#else
|
||||
unreachable("no elk support");
|
||||
#endif
|
||||
}
|
||||
|
||||
struct iris_binding_table bt;
|
||||
|
|
|
|||
|
|
@ -87,6 +87,11 @@
|
|||
unreachable("Unknown hardware generation"); \
|
||||
}
|
||||
|
||||
#ifndef INTEL_USE_ELK
|
||||
static inline void gfx8_init_screen_state(struct iris_screen *screen) { unreachable("no elk support"); }
|
||||
static inline void gfx8_init_screen_gen_state(struct iris_screen *screen) { unreachable("no elk support"); }
|
||||
#endif
|
||||
|
||||
static const char *
|
||||
iris_get_vendor(struct pipe_screen *pscreen)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -226,7 +226,9 @@ struct iris_screen {
|
|||
struct isl_device isl_dev;
|
||||
struct iris_bufmgr *bufmgr;
|
||||
struct brw_compiler *brw;
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_compiler *elk;
|
||||
#endif
|
||||
struct intel_perf_config *perf_cfg;
|
||||
|
||||
const struct intel_l3_config *l3_config_3d;
|
||||
|
|
|
|||
|
|
@ -55,11 +55,16 @@ files_libiris = files(
|
|||
|
||||
iris_per_hw_ver_libs = []
|
||||
foreach v : ['80', '90', '110', '120', '125', '200', '300']
|
||||
if v == '80' and not with_intel_elk
|
||||
continue
|
||||
endif
|
||||
|
||||
iris_per_hw_ver_libs += static_library(
|
||||
'iris_per_hw_ver@0@'.format(v),
|
||||
['iris_blorp.c', 'iris_query.c', 'iris_state.c', 'iris_indirect_gen.c', gen_xml_pack],
|
||||
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_intel],
|
||||
c_args : [
|
||||
intel_common_args,
|
||||
no_override_init_args, sse2_args,
|
||||
'-DGFX_VERx10=@0@'.format(v),
|
||||
],
|
||||
|
|
@ -79,8 +84,8 @@ libiris = static_library(
|
|||
# these should not be necessary, but main/macros.h...
|
||||
inc_mesa, inc_mapi
|
||||
],
|
||||
c_args : [sse2_args],
|
||||
cpp_args : [sse2_args],
|
||||
c_args : [intel_common_args, sse2_args],
|
||||
cpp_args : [intel_common_args, sse2_args],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
dependencies : [dep_libdrm, dep_valgrind, idep_genxml, idep_nir_headers,
|
||||
idep_libintel_common, idep_intel_driver_ds, idep_intel_dev,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ idep_intel_blorp = declare_dependency(
|
|||
link_with: libblorp,
|
||||
)
|
||||
|
||||
if with_intel_elk
|
||||
libblorp_elk = static_library(
|
||||
'blorp_elk',
|
||||
[files_libblorp, files_blorp_elk],
|
||||
|
|
@ -48,3 +49,6 @@ idep_intel_blorp_elk = declare_dependency(
|
|||
dependencies: [idep_intel_dev],
|
||||
link_with: libblorp_elk,
|
||||
)
|
||||
else
|
||||
idep_intel_blorp_elk = null_dep
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -327,4 +327,8 @@ brw_disasm_tool = executable(
|
|||
|
||||
endif
|
||||
|
||||
if with_intel_elk
|
||||
subdir('elk')
|
||||
else
|
||||
idep_intel_compiler_elk = null_dep
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ idep_intel_decoder_brw = declare_dependency(
|
|||
dependencies : idep_intel_decoder,
|
||||
)
|
||||
|
||||
if with_intel_elk
|
||||
libintel_decoder_elk = static_library(
|
||||
'intel_decoder_elk',
|
||||
[libintel_decoder_elk_files, genX_xml_h, sha1_h],
|
||||
|
|
@ -69,6 +70,9 @@ idep_intel_decoder_elk = declare_dependency(
|
|||
link_with : [libintel_decoder_elk],
|
||||
dependencies : idep_intel_decoder,
|
||||
)
|
||||
else
|
||||
idep_intel_decoder_elk = null_dep
|
||||
endif
|
||||
|
||||
if with_tests and not with_platform_android
|
||||
gentest_xml = 'tests/gentest.xml'
|
||||
|
|
|
|||
|
|
@ -3,6 +3,17 @@
|
|||
|
||||
inc_intel = include_directories('.')
|
||||
|
||||
with_intel_elk = get_option('intel-elk')
|
||||
|
||||
intel_common_args = []
|
||||
if with_intel_elk
|
||||
intel_common_args += ['-DINTEL_USE_ELK']
|
||||
else
|
||||
if with_gallium_crocus or with_intel_hasvk
|
||||
error('Cannot build Crocus or Hasvk with meson option -Dintel-elk=false set.')
|
||||
endif
|
||||
endif
|
||||
|
||||
subdir('genxml')
|
||||
subdir('dev')
|
||||
if with_intel_hasvk or with_intel_vk or with_gallium_crocus or with_gallium_iris
|
||||
|
|
|
|||
|
|
@ -7,10 +7,20 @@
|
|||
|
||||
#include "compiler/brw_disasm.h"
|
||||
#include "compiler/brw_isa_info.h"
|
||||
#ifdef INTEL_USE_ELK
|
||||
#include "compiler/elk/elk_disasm.h"
|
||||
#include "compiler/elk/elk_isa_info.h"
|
||||
#endif
|
||||
#include "dev/intel_device_info.h"
|
||||
|
||||
static void
|
||||
not_supported(const struct intel_device_info *devinfo)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Tool compiled without support for Gfx version %d.\n",
|
||||
devinfo->ver);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void
|
||||
intel_disassemble(const struct intel_device_info *devinfo,
|
||||
const void *assembly, int start, FILE *out)
|
||||
|
|
@ -20,9 +30,13 @@ intel_disassemble(const struct intel_device_info *devinfo,
|
|||
brw_init_isa_info(&isa, devinfo);
|
||||
brw_disassemble_with_errors(&isa, assembly, start, out);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_isa_info isa;
|
||||
elk_init_isa_info(&isa, devinfo);
|
||||
elk_disassemble_with_errors(&isa, assembly, start, out);
|
||||
#else
|
||||
not_supported(devinfo);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -41,9 +55,13 @@ intel_decoder_init(struct intel_batch_decode_ctx *ctx,
|
|||
intel_batch_decode_ctx_init_brw(ctx, &isa, devinfo, fp,
|
||||
flags, xml_path, get_bo, get_state_size, user_data);
|
||||
} else {
|
||||
#ifdef INTEL_USE_ELK
|
||||
struct elk_isa_info isa;
|
||||
elk_init_isa_info(&isa, devinfo);
|
||||
intel_batch_decode_ctx_init_elk(ctx, &isa, devinfo, fp,
|
||||
flags, xml_path, get_bo, get_state_size, user_data);
|
||||
#else
|
||||
not_supported(devinfo);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ libintel_tools = static_library(
|
|||
idep_libintel_common,
|
||||
],
|
||||
include_directories : [inc_include, inc_src, inc_intel],
|
||||
c_args : [no_override_init_args],
|
||||
c_args : [intel_common_args, no_override_init_args],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
install : false,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue