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:
Caio Oliveira 2025-01-15 11:18:24 -08:00 committed by Marge Bot
parent 31e5d909e7
commit fbacf3761f
17 changed files with 291 additions and 52 deletions

View file

@ -687,6 +687,15 @@ option(
description : 'Build Ray Tracing on supported hardware.' 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( option(
'video-codecs', 'video-codecs',
type : 'array', type : 'array',

View file

@ -49,7 +49,9 @@
#include "common/intel_aux_map.h" #include "common/intel_aux_map.h"
#include "intel/common/intel_gem.h" #include "intel/common/intel_gem.h"
#include "intel/compiler/brw_compiler.h" #include "intel/compiler/brw_compiler.h"
#ifdef INTEL_USE_ELK
#include "intel/compiler/elk/elk_compiler.h" #include "intel/compiler/elk/elk_compiler.h"
#endif
#include "intel/ds/intel_tracepoints.h" #include "intel/ds/intel_tracepoints.h"
#include "util/hash_table.h" #include "util/hash_table.h"
#include "util/u_debug.h" #include "util/u_debug.h"
@ -239,11 +241,15 @@ iris_init_batch(struct iris_context *ice,
stderr, decode_flags, NULL, stderr, decode_flags, NULL,
decode_get_bo, decode_get_state_size, batch); decode_get_bo, decode_get_state_size, batch);
} else { } else {
#ifdef INTEL_USE_ELK
assert(screen->elk); assert(screen->elk);
intel_batch_decode_ctx_init_elk(&batch->decoder, &screen->elk->isa, intel_batch_decode_ctx_init_elk(&batch->decoder, &screen->elk->isa,
screen->devinfo, screen->devinfo,
stderr, decode_flags, NULL, stderr, decode_flags, NULL,
decode_get_bo, decode_get_state_size, batch); decode_get_bo, decode_get_state_size, batch);
#else
unreachable("no elk support");
#endif
} }
batch->decoder.dynamic_base = IRIS_MEMZONE_DYNAMIC_START; batch->decoder.dynamic_base = IRIS_MEMZONE_DYNAMIC_START;
batch->decoder.instruction_base = IRIS_MEMZONE_SHADER_START; batch->decoder.instruction_base = IRIS_MEMZONE_SHADER_START;

View file

@ -2574,6 +2574,14 @@ iris_bufmgr_get_for_fd(int fd, bool bo_reuse)
if (devinfo.ver < 8 || devinfo.platform == INTEL_PLATFORM_CHV) if (devinfo.ver < 8 || devinfo.platform == INTEL_PLATFORM_CHV)
return NULL; 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); bufmgr = iris_bufmgr_create(&devinfo, fd, bo_reuse);
if (bufmgr) if (bufmgr)
list_addtail(&bufmgr->link, &global_bufmgr_list); list_addtail(&bufmgr->link, &global_bufmgr_list);

View file

@ -285,6 +285,12 @@ iris_destroy_context(struct pipe_context *ctx)
unreachable("Unknown hardware generation"); \ 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. * Create a context.
* *

View file

@ -1513,9 +1513,11 @@ iris_execute_indirect_draw_supported(const struct iris_context *ice,
#ifdef genX #ifdef genX
# include "iris_genx_protos.h" # include "iris_genx_protos.h"
#else #else
# define genX(x) gfx8_##x # ifdef INTEL_USE_ELK
# include "iris_genx_protos.h" # define genX(x) gfx8_##x
# undef genX # include "iris_genx_protos.h"
# undef genX
# endif
# define genX(x) gfx9_##x # define genX(x) gfx9_##x
# include "iris_genx_protos.h" # include "iris_genx_protos.h"
# undef genX # undef genX

View file

@ -37,7 +37,9 @@
#include "util/disk_cache.h" #include "util/disk_cache.h"
#include "util/mesa-sha1.h" #include "util/mesa-sha1.h"
#include "intel/compiler/brw_compiler.h" #include "intel/compiler/brw_compiler.h"
#ifdef INTEL_USE_ELK
#include "intel/compiler/elk/elk_compiler.h" #include "intel/compiler/elk/elk_compiler.h"
#endif
#include "iris_context.h" #include "iris_context.h"
@ -89,8 +91,12 @@ iris_disk_cache_store(struct disk_cache *cache,
gl_shader_stage stage = ish->nir->info.stage; gl_shader_stage stage = ish->nir->info.stage;
const struct brw_stage_prog_data *brw = shader->brw_prog_data; 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; const struct elk_stage_prog_data *elk = shader->elk_prog_data;
assert((brw == NULL) != (elk == NULL)); assert((brw == NULL) != (elk == NULL));
#else
assert(brw);
#endif
cache_key cache_key; cache_key cache_key;
iris_disk_cache_compute_key(cache, ish, prog_key, prog_key_size, 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; serializable.base.relocs = NULL;
blob_write_bytes(&blob, &serializable, prog_data_s); blob_write_bytes(&blob, &serializable, prog_data_s);
} else { } else {
#ifdef INTEL_USE_ELK
size_t prog_data_s = elk_prog_data_size(stage); size_t prog_data_s = elk_prog_data_size(stage);
union elk_any_prog_data serializable; union elk_any_prog_data serializable;
assert(prog_data_s <= sizeof(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.param = NULL;
serializable.base.relocs = NULL; serializable.base.relocs = NULL;
blob_write_bytes(&blob, &serializable, prog_data_s); blob_write_bytes(&blob, &serializable, prog_data_s);
#else
unreachable("no elk support");
#endif
} }
blob_write_bytes(&blob, shader->map, shader->program_size); 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, blob_write_bytes(&blob, brw->param,
brw->nr_params * sizeof(uint32_t)); brw->nr_params * sizeof(uint32_t));
} else { } else {
#ifdef INTEL_USE_ELK
blob_write_bytes(&blob, elk->relocs, blob_write_bytes(&blob, elk->relocs,
elk->num_relocs * sizeof(struct elk_shader_reloc)); elk->num_relocs * sizeof(struct elk_shader_reloc));
blob_write_bytes(&blob, elk->param, blob_write_bytes(&blob, elk->param,
elk->nr_params * sizeof(uint32_t)); elk->nr_params * sizeof(uint32_t));
#else
unreachable("no elk support");
#endif
} }
blob_write_bytes(&blob, &shader->bt, sizeof(shader->bt)); blob_write_bytes(&blob, &shader->bt, sizeof(shader->bt));
@ -204,8 +218,11 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
if (!buffer) if (!buffer)
return false; return false;
const uint32_t prog_data_size = screen->brw ? brw_prog_data_size(stage) const uint32_t prog_data_size =
: elk_prog_data_size(stage); #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); void *prog_data = ralloc_size(NULL, prog_data_size);
const void *assembly; const void *assembly;
@ -215,13 +232,24 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
uint32_t *so_decls = NULL; uint32_t *so_decls = NULL;
struct brw_stage_prog_data *brw = screen->brw ? prog_data : 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; struct elk_stage_prog_data *elk = screen->elk ? prog_data : NULL;
assert((brw == NULL) != (elk == NULL)); assert((brw == NULL) != (elk == NULL));
#else
assert(brw);
#endif
struct blob_reader blob; struct blob_reader blob;
blob_reader_init(&blob, buffer, size); blob_reader_init(&blob, buffer, size);
blob_copy_bytes(&blob, prog_data, prog_data_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); num_system_values = blob_read_uint32(&blob);
if (num_system_values) { if (num_system_values) {
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)); blob_copy_bytes(&blob, brw->param, brw->nr_params * sizeof(uint32_t));
} }
} else { } else {
#ifdef INTEL_USE_ELK
elk->relocs = NULL; elk->relocs = NULL;
if (elk->num_relocs) { if (elk->num_relocs) {
struct elk_shader_reloc *relocs = struct elk_shader_reloc *relocs =
@ -263,6 +292,9 @@ iris_disk_cache_retrieve(struct iris_screen *screen,
blob_copy_bytes(&blob, elk->param, blob_copy_bytes(&blob, elk->param,
elk->nr_params * sizeof(uint32_t)); elk->nr_params * sizeof(uint32_t));
} }
#else
unreachable("no elk support");
#endif
} }
struct iris_binding_table bt; 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_TESS_EVAL ||
stage == MESA_SHADER_GEOMETRY) { stage == MESA_SHADER_GEOMETRY) {
struct intel_vue_map *vue_map = struct intel_vue_map *vue_map =
screen->brw ? &brw_vue_prog_data(prog_data)->vue_map #ifdef INTEL_USE_ELK
: &elk_vue_prog_data(prog_data)->vue_map; 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); 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) if (brw)
iris_apply_brw_prog_data(shader, brw); iris_apply_brw_prog_data(shader, brw);
else else
#ifdef INTEL_USE_ELK
iris_apply_elk_prog_data(shader, elk); iris_apply_elk_prog_data(shader, elk);
#else
unreachable("no elk support");
#endif
iris_finalize_program(shader, so_decls, system_values, iris_finalize_program(shader, so_decls, system_values,
num_system_values, kernel_input_size, num_cbufs, num_system_values, kernel_input_size, num_cbufs,
@ -348,9 +386,12 @@ iris_disk_cache_init(struct iris_screen *screen)
char timestamp[41]; char timestamp[41];
_mesa_sha1_format(timestamp, id_sha1); _mesa_sha1_format(timestamp, id_sha1);
const uint64_t driver_flags = screen->brw ? const uint64_t driver_flags =
brw_get_compiler_config_value(screen->brw) : #ifdef INTEL_USE_ELK
elk_get_compiler_config_value(screen->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); screen->disk_cache = disk_cache_create(renderer, timestamp, driver_flags);
#endif #endif
} }

View file

@ -46,9 +46,11 @@
#include "intel/compiler/brw_nir.h" #include "intel/compiler/brw_nir.h"
#include "intel/compiler/intel_nir.h" #include "intel/compiler/intel_nir.h"
#include "intel/compiler/brw_prim.h" #include "intel/compiler/brw_prim.h"
#ifdef INTEL_USE_ELK
#include "intel/compiler/elk/elk_compiler.h" #include "intel/compiler/elk/elk_compiler.h"
#include "intel/compiler/elk/elk_nir.h" #include "intel/compiler/elk/elk_nir.h"
#include "intel/compiler/elk/elk_prim.h" #include "intel/compiler/elk/elk_prim.h"
#endif
#include "iris_context.h" #include "iris_context.h"
#include "iris_pipe.h" #include "iris_pipe.h"
#include "nir/tgsi_to_nir.h" #include "nir/tgsi_to_nir.h"
@ -59,9 +61,12 @@
#define BRW_KEY_INIT(gen, prog_id, limit_trig_input) \ #define BRW_KEY_INIT(gen, prog_id, limit_trig_input) \
.base.program_string_id = prog_id, \ .base.program_string_id = prog_id, \
.base.limit_trig_input_range = limit_trig_input .base.limit_trig_input_range = limit_trig_input
#ifdef INTEL_USE_ELK
#define ELK_KEY_INIT(gen, prog_id, limit_trig_input) \ #define ELK_KEY_INIT(gen, prog_id, limit_trig_input) \
.base.program_string_id = prog_id, \ .base.program_string_id = prog_id, \
.base.limit_trig_input_range = limit_trig_input .base.limit_trig_input_range = limit_trig_input
#endif
struct iris_threaded_compile_job { struct iris_threaded_compile_job {
struct iris_screen *screen; 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); ralloc_steal(shader->brw_prog_data, brw->param);
} }
#ifdef INTEL_USE_ELK
static void static void
iris_apply_elk_wm_prog_data(struct iris_compiled_shader *shader, iris_apply_elk_wm_prog_data(struct iris_compiled_shader *shader,
const struct elk_wm_prog_data *elk) 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); ralloc_steal(shader->elk_prog_data, elk->param);
} }
#endif
void void
iris_finalize_program(struct iris_compiled_shader *shader, iris_finalize_program(struct iris_compiled_shader *shader,
uint32_t *streamout, uint32_t *streamout,
@ -495,7 +504,11 @@ iris_finalize_program(struct iris_compiled_shader *shader,
const struct iris_binding_table *bt) const struct iris_binding_table *bt)
{ {
/* There can be only one. */ /* There can be only one. */
#ifdef INTEL_USE_ELK
assert((shader->brw_prog_data == NULL) != (shader->elk_prog_data == NULL)); assert((shader->brw_prog_data == NULL) != (shader->elk_prog_data == NULL));
#else
assert(shader->brw_prog_data);
#endif
shader->streamout = streamout; shader->streamout = streamout;
shader->system_values = system_values; 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 static struct elk_vs_prog_key
iris_to_elk_vs_key(const struct iris_screen *screen, iris_to_elk_vs_key(const struct iris_screen *screen,
const struct iris_vs_prog_key *key) const struct iris_vs_prog_key *key)
@ -672,6 +687,8 @@ iris_to_elk_cs_key(const struct iris_screen *screen,
}; };
} }
#endif
static void * static void *
upload_state(struct u_upload_mgr *uploader, upload_state(struct u_upload_mgr *uploader,
struct iris_state_ref *ref, struct iris_state_ref *ref,
@ -911,6 +928,7 @@ static void
setup_vec4_image_sysval(uint32_t *sysvals, uint32_t idx, setup_vec4_image_sysval(uint32_t *sysvals, uint32_t idx,
unsigned offset, unsigned n) unsigned offset, unsigned n)
{ {
#ifdef INTEL_USE_ELK
assert(offset % sizeof(uint32_t) == 0); assert(offset % sizeof(uint32_t) == 0);
for (unsigned i = 0; i < n; ++i) 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) for (unsigned i = n; i < 4; ++i)
sysvals[i] = ELK_PARAM_BUILTIN_ZERO; 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); brw_debug_key_recompile(c, dbg, info->stage, &old_key.base, key);
} }
#ifdef INTEL_USE_ELK
static void static void
iris_debug_recompile_elk(struct iris_screen *screen, iris_debug_recompile_elk(struct iris_screen *screen,
struct util_debug_callback *dbg, 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); elk_debug_key_recompile(c, dbg, info->stage, &old_key.base, key);
} }
#endif
static void static void
check_urb_size(struct iris_context *ice, 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); iris_debug_recompile_brw(screen, dbg, ish, &brw_key.base);
} }
} else { } else {
#ifdef INTEL_USE_ELK
struct elk_vs_prog_data *elk_prog_data = struct elk_vs_prog_data *elk_prog_data =
rzalloc(mem_ctx, struct elk_vs_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_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
iris_apply_elk_prog_data(shader, &elk_prog_data->base.base); iris_apply_elk_prog_data(shader, &elk_prog_data->base.base);
} }
#else
unreachable("no elk support");
#endif
} }
if (program == NULL) { 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; 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); 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); struct elk_tcs_prog_key elk_key = iris_to_elk_tcs_key(screen, key);
#endif
uint32_t source_hash; uint32_t source_hash;
if (ish) { if (ish) {
@ -2081,8 +2111,12 @@ iris_compile_tcs(struct iris_screen *screen,
if (screen->brw) { if (screen->brw) {
nir = brw_nir_create_passthrough_tcs(mem_ctx, screen->brw, &brw_key); nir = brw_nir_create_passthrough_tcs(mem_ctx, screen->brw, &brw_key);
} else { } else {
#ifdef INTEL_USE_ELK
assert(screen->elk); assert(screen->elk);
nir = elk_nir_create_passthrough_tcs(mem_ctx, screen->elk, &elk_key); 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; 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); iris_debug_recompile_brw(screen, dbg, ish, &brw_key.base);
} }
} else { } else {
#ifdef INTEL_USE_ELK
assert(screen->elk); assert(screen->elk);
struct elk_tcs_prog_data *elk_prog_data = struct elk_tcs_prog_data *elk_prog_data =
rzalloc(mem_ctx, struct elk_tcs_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_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
iris_apply_elk_prog_data(shader, &elk_prog_data->base.base); iris_apply_elk_prog_data(shader, &elk_prog_data->base.base);
} }
#else
unreachable("no elk support");
#endif
} }
if (program == NULL) { 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); iris_apply_brw_prog_data(shader, &brw_prog_data->base.base);
} }
} else { } else {
#ifdef INTEL_USE_ELK
struct elk_tes_prog_data *elk_prog_data = struct elk_tes_prog_data *elk_prog_data =
rzalloc(mem_ctx, struct elk_tes_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_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
iris_apply_elk_prog_data(shader, &elk_prog_data->base.base); iris_apply_elk_prog_data(shader, &elk_prog_data->base.base);
} }
#else
unreachable("no elk support");
#endif
} }
if (program == NULL) { 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); iris_apply_brw_prog_data(shader, &brw_prog_data->base.base);
} }
} else { } else {
#ifdef INTEL_USE_ELK
struct elk_gs_prog_data *elk_prog_data = struct elk_gs_prog_data *elk_prog_data =
rzalloc(mem_ctx, struct elk_gs_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_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
iris_apply_elk_prog_data(shader, &elk_prog_data->base.base); iris_apply_elk_prog_data(shader, &elk_prog_data->base.base);
} }
#else
unreachable("no elk support");
#endif
} }
if (program == NULL) { if (program == NULL) {
@ -2675,6 +2721,7 @@ iris_compile_fs(struct iris_screen *screen,
iris_apply_brw_prog_data(shader, &brw_prog_data->base); iris_apply_brw_prog_data(shader, &brw_prog_data->base);
} }
} else { } else {
#ifdef INTEL_USE_ELK
struct elk_wm_prog_data *elk_prog_data = struct elk_wm_prog_data *elk_prog_data =
rzalloc(mem_ctx, struct elk_wm_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_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
iris_apply_elk_prog_data(shader, &elk_prog_data->base); iris_apply_elk_prog_data(shader, &elk_prog_data->base);
} }
#else
unreachable("no elk support");
#endif
} }
if (program == NULL) { if (program == NULL) {
@ -2961,7 +3011,11 @@ iris_compile_cs(struct iris_screen *screen,
if (screen->brw) if (screen->brw)
NIR_PASS_V(nir, brw_nir_lower_cs_intrinsics, devinfo, NULL); NIR_PASS_V(nir, brw_nir_lower_cs_intrinsics, devinfo, NULL);
else else
#ifdef INTEL_USE_ELK
NIR_PASS_V(nir, elk_nir_lower_cs_intrinsics, devinfo, NULL); 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, iris_setup_uniforms(devinfo, mem_ctx, nir, ish->kernel_input_size,
&system_values, &num_system_values, &num_cbufs); &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); iris_apply_brw_prog_data(shader, &brw_prog_data->base);
} }
} else { } else {
#ifdef INTEL_USE_ELK
struct elk_cs_prog_key elk_key = iris_to_elk_cs_key(screen, key); struct elk_cs_prog_key elk_key = iris_to_elk_cs_key(screen, key);
struct elk_cs_prog_data *elk_prog_data = 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_debug_recompile_elk(screen, dbg, ish, &elk_key.base);
iris_apply_elk_prog_data(shader, &elk_prog_data->base); iris_apply_elk_prog_data(shader, &elk_prog_data->base);
} }
#else
unreachable("no elk support");
#endif
} }
if (program == NULL) { if (program == NULL) {
@ -3444,7 +3502,9 @@ iris_create_shader_state(struct pipe_context *ctx,
(1ull << IRIS_NOS_RASTERIZER) | (1ull << IRIS_NOS_RASTERIZER) |
(1ull << IRIS_NOS_BLEND); (1ull << IRIS_NOS_BLEND);
#ifdef INTEL_USE_ELK
STATIC_ASSERT(BRW_FS_VARYING_INPUT_MASK == ELK_FS_VARYING_INPUT_MASK); 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 */ /* The program key needs the VUE map if there are > 16 inputs */
if (util_bitcount64(info->inputs_read & BRW_FS_VARYING_INPUT_MASK) > 16) { 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, .lower_stores = true,
}); });
} else { } else {
#ifdef INTEL_USE_ELK
assert(screen->elk); assert(screen->elk);
struct elk_nir_compiler_opts opts = {}; 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, .lower_get_size = true,
}); });
#else
unreachable("no elk support");
#endif
} }
NIR_PASS_V(nir, iris_lower_storage_image_derefs); 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), brw_cs_prog_data(shader->brw_prog_data),
block); block);
} else { } else {
#ifdef INTEL_USE_ELK
assert(shader->elk_prog_data); assert(shader->elk_prog_data);
return elk_cs_get_dispatch_info(devinfo, return elk_cs_get_dispatch_info(devinfo,
elk_cs_prog_data(shader->elk_prog_data), elk_cs_prog_data(shader->elk_prog_data),
block); 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), return brw_cs_push_const_total_size(brw_cs_prog_data(shader->brw_prog_data),
threads); threads);
} else { } else {
#ifdef INTEL_USE_ELK
assert(shader->elk_prog_data); assert(shader->elk_prog_data);
return elk_cs_push_const_total_size(elk_cs_prog_data(shader->elk_prog_data), return elk_cs_push_const_total_size(elk_cs_prog_data(shader->elk_prog_data),
threads); 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), return wm_prog_data_barycentric_modes(brw_wm_prog_data(shader->brw_prog_data),
pushed_msaa_flags); pushed_msaa_flags);
} else { } else {
#ifdef INTEL_USE_ELK
assert(shader->elk_prog_data); assert(shader->elk_prog_data);
return elk_wm_prog_data_barycentric_modes(elk_wm_prog_data(shader->elk_prog_data), return elk_wm_prog_data_barycentric_modes(elk_wm_prog_data(shader->elk_prog_data),
pushed_msaa_flags); 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) { if (screen->brw) {
return screen->brw->indirect_ubos_use_sampler; return screen->brw->indirect_ubos_use_sampler;
} else { } else {
#ifdef INTEL_USE_ELK
assert(screen->elk); assert(screen->elk);
return screen->elk->indirect_ubos_use_sampler; 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); gl_shader_stage stage = stage_from_pipe(pstage);
assert(ir == PIPE_SHADER_IR_NIR); assert(ir == PIPE_SHADER_IR_NIR);
#ifdef INTEL_USE_ELK
return screen->brw ? screen->brw->nir_options[stage] return screen->brw ? screen->brw->nir_options[stage]
: screen->elk->nir_options[stage]; : screen->elk->nir_options[stage];
#else
return screen->brw->nir_options[stage];
#endif
} }
void void
iris_compiler_init(struct iris_screen *screen) 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) { 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 = brw_compiler_create(screen, screen->devinfo);
screen->brw->shader_debug_log = iris_shader_debug_log; screen->brw->shader_debug_log = iris_shader_debug_log;
screen->brw->shader_perf_log = iris_shader_perf_log; screen->brw->shader_perf_log = iris_shader_perf_log;
} else { } 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 = elk_compiler_create(screen, screen->devinfo);
screen->elk->shader_debug_log = iris_shader_debug_log; screen->elk->shader_debug_log = iris_shader_debug_log;
screen->elk->shader_perf_log = iris_shader_perf_log; screen->elk->shader_perf_log = iris_shader_perf_log;
screen->elk->supports_shader_constants = true; screen->elk->supports_shader_constants = true;
#else
unreachable("no elk support");
#endif
} }
} }

View file

@ -40,8 +40,10 @@
#include "compiler/nir/nir_builder.h" #include "compiler/nir/nir_builder.h"
#include "intel/compiler/brw_compiler.h" #include "intel/compiler/brw_compiler.h"
#include "intel/compiler/brw_nir.h" #include "intel/compiler/brw_nir.h"
#ifdef INTEL_USE_ELK
#include "intel/compiler/elk/elk_compiler.h" #include "intel/compiler/elk/elk_compiler.h"
#include "intel/compiler/elk/elk_nir.h" #include "intel/compiler/elk/elk_nir.h"
#endif
#include "iris_context.h" #include "iris_context.h"
#include "iris_resource.h" #include "iris_resource.h"
@ -187,6 +189,7 @@ iris_upload_shader(struct iris_screen *screen,
shader->brw_prog_data, reloc_values, shader->brw_prog_data, reloc_values,
ARRAY_SIZE(reloc_values)); ARRAY_SIZE(reloc_values));
} else { } else {
#ifdef INTEL_USE_ELK
struct elk_shader_reloc_value reloc_values[] = { struct elk_shader_reloc_value reloc_values[] = {
{ {
.id = BRW_SHADER_RELOC_CONST_DATA_ADDR_LOW, .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, elk_write_shader_relocs(&screen->elk->isa, shader->map,
shader->elk_prog_data, reloc_values, shader->elk_prog_data, reloc_values,
ARRAY_SIZE(reloc_values)); ARRAY_SIZE(reloc_values));
#else
unreachable("no elk support");
#endif
} }
/* Store the 3DSTATE shader packets and other derived state. */ /* 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 blorp_context *blorp = blorp_batch->blorp;
struct iris_context *ice = blorp->driver_ctx; struct iris_context *ice = blorp->driver_ctx;
struct iris_batch *batch = blorp_batch->driver_batch; struct iris_batch *batch = blorp_batch->driver_batch;
struct iris_screen *screen = batch->screen;
struct iris_compiled_shader *shader = struct iris_compiled_shader *shader =
iris_find_cached_shader(ice, IRIS_CACHE_BLORP, key_size, key); 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); struct iris_bo *bo = iris_resource_bo(shader->assembly.res);
*kernel_out = *kernel_out =
iris_bo_offset_from_base_address(bo) + shader->assembly.offset; iris_bo_offset_from_base_address(bo) + shader->assembly.offset;
*((void **) prog_data_out) = screen->brw ? (void *)shader->brw_prog_data *((void **) prog_data_out) =
: (void *)shader->elk_prog_data; #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); 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) { if (screen->brw) {
iris_apply_brw_prog_data(shader, prog_data); iris_apply_brw_prog_data(shader, prog_data);
} else { } else {
#ifdef INTEL_USE_ELK
assert(screen->elk); assert(screen->elk);
iris_apply_elk_prog_data(shader, prog_data); iris_apply_elk_prog_data(shader, prog_data);
#else
unreachable("no elk support");
#endif
} }
iris_finalize_program(shader, NULL, NULL, 0, 0, 0, &bt); 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); struct iris_bo *bo = iris_resource_bo(shader->assembly.res);
*kernel_out = *kernel_out =
iris_bo_offset_from_base_address(bo) + shader->assembly.offset; iris_bo_offset_from_base_address(bo) + shader->assembly.offset;
*((void **) prog_data_out) = screen->brw ? (void *)shader->brw_prog_data *((void **) prog_data_out) =
: (void *)shader->elk_prog_data; #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); iris_use_pinned_bo(batch, bo, false, IRIS_DOMAIN_NONE);
@ -362,8 +377,10 @@ iris_ensure_indirect_generation_shader(struct iris_batch *batch)
return; return;
const nir_shader_compiler_options *nir_options = const nir_shader_compiler_options *nir_options =
screen->brw ? screen->brw->nir_options[MESA_SHADER_COMPUTE] #ifdef INTEL_USE_ELK
: screen->elk->nir_options[MESA_SHADER_COMPUTE]; 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_builder b = nir_builder_init_simple_shader(MESA_SHADER_FRAGMENT,
nir_options, nir_options,
@ -393,9 +410,13 @@ iris_ensure_indirect_generation_shader(struct iris_batch *batch)
struct brw_nir_compiler_opts opts = {}; struct brw_nir_compiler_opts opts = {};
brw_preprocess_nir(screen->brw, nir, &opts); brw_preprocess_nir(screen->brw, nir, &opts);
} else { } else {
#ifdef INTEL_USE_ELK
assert(screen->elk); assert(screen->elk);
struct elk_nir_compiler_opts opts = {}; struct elk_nir_compiler_opts opts = {};
elk_preprocess_nir(screen->elk, nir, &opts); elk_preprocess_nir(screen->elk, nir, &opts);
#else
unreachable("no elk support");
#endif
} }
NIR_PASS_V(nir, nir_propagate_invariant, false); NIR_PASS_V(nir, nir_propagate_invariant, false);
@ -461,6 +482,7 @@ iris_ensure_indirect_generation_shader(struct iris_batch *batch)
assert(program); assert(program);
iris_apply_brw_prog_data(shader, &prog_data->base); iris_apply_brw_prog_data(shader, &prog_data->base);
} else { } else {
#ifdef INTEL_USE_ELK
union elk_any_prog_key prog_key; union elk_any_prog_key prog_key;
memset(&prog_key, 0, sizeof(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, &params); program = elk_compile_fs(screen->elk, &params);
assert(program); assert(program);
iris_apply_elk_prog_data(shader, &prog_data->base); iris_apply_elk_prog_data(shader, &prog_data->base);
#else
unreachable("no elk support");
#endif
} }
struct iris_binding_table bt; struct iris_binding_table bt;

View file

@ -87,6 +87,11 @@
unreachable("Unknown hardware generation"); \ 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 * static const char *
iris_get_vendor(struct pipe_screen *pscreen) iris_get_vendor(struct pipe_screen *pscreen)
{ {

View file

@ -226,7 +226,9 @@ struct iris_screen {
struct isl_device isl_dev; struct isl_device isl_dev;
struct iris_bufmgr *bufmgr; struct iris_bufmgr *bufmgr;
struct brw_compiler *brw; struct brw_compiler *brw;
#ifdef INTEL_USE_ELK
struct elk_compiler *elk; struct elk_compiler *elk;
#endif
struct intel_perf_config *perf_cfg; struct intel_perf_config *perf_cfg;
const struct intel_l3_config *l3_config_3d; const struct intel_l3_config *l3_config_3d;

View file

@ -55,11 +55,16 @@ files_libiris = files(
iris_per_hw_ver_libs = [] iris_per_hw_ver_libs = []
foreach v : ['80', '90', '110', '120', '125', '200', '300'] 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_libs += static_library(
'iris_per_hw_ver@0@'.format(v), 'iris_per_hw_ver@0@'.format(v),
['iris_blorp.c', 'iris_query.c', 'iris_state.c', 'iris_indirect_gen.c', gen_xml_pack], ['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], include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_intel],
c_args : [ c_args : [
intel_common_args,
no_override_init_args, sse2_args, no_override_init_args, sse2_args,
'-DGFX_VERx10=@0@'.format(v), '-DGFX_VERx10=@0@'.format(v),
], ],
@ -79,8 +84,8 @@ libiris = static_library(
# these should not be necessary, but main/macros.h... # these should not be necessary, but main/macros.h...
inc_mesa, inc_mapi inc_mesa, inc_mapi
], ],
c_args : [sse2_args], c_args : [intel_common_args, sse2_args],
cpp_args : [sse2_args], cpp_args : [intel_common_args, sse2_args],
gnu_symbol_visibility : 'hidden', gnu_symbol_visibility : 'hidden',
dependencies : [dep_libdrm, dep_valgrind, idep_genxml, idep_nir_headers, dependencies : [dep_libdrm, dep_valgrind, idep_genxml, idep_nir_headers,
idep_libintel_common, idep_intel_driver_ds, idep_intel_dev, idep_libintel_common, idep_intel_driver_ds, idep_intel_dev,

View file

@ -34,17 +34,21 @@ idep_intel_blorp = declare_dependency(
link_with: libblorp, link_with: libblorp,
) )
libblorp_elk = static_library( if with_intel_elk
'blorp_elk', libblorp_elk = static_library(
[files_libblorp, files_blorp_elk], 'blorp_elk',
include_directories : [inc_include, inc_src, inc_intel], [files_libblorp, files_blorp_elk],
c_args : [no_override_init_args], include_directories : [inc_include, inc_src, inc_intel],
gnu_symbol_visibility : 'hidden', c_args : [no_override_init_args],
dependencies : [idep_nir_headers, idep_genxml, idep_mesautil, idep_intel_dev], gnu_symbol_visibility : 'hidden',
build_by_default: true, # FIXME XXX dependencies : [idep_nir_headers, idep_genxml, idep_mesautil, idep_intel_dev],
) build_by_default: true, # FIXME XXX
)
idep_intel_blorp_elk = declare_dependency( idep_intel_blorp_elk = declare_dependency(
dependencies: [idep_intel_dev], dependencies: [idep_intel_dev],
link_with: libblorp_elk, link_with: libblorp_elk,
) )
else
idep_intel_blorp_elk = null_dep
endif

View file

@ -327,4 +327,8 @@ brw_disasm_tool = executable(
endif endif
subdir('elk') if with_intel_elk
subdir('elk')
else
idep_intel_compiler_elk = null_dep
endif

View file

@ -55,20 +55,24 @@ idep_intel_decoder_brw = declare_dependency(
dependencies : idep_intel_decoder, dependencies : idep_intel_decoder,
) )
libintel_decoder_elk = static_library( if with_intel_elk
'intel_decoder_elk', libintel_decoder_elk = static_library(
[libintel_decoder_elk_files, genX_xml_h, sha1_h], 'intel_decoder_elk',
include_directories : [inc_include, inc_src, inc_intel], [libintel_decoder_elk_files, genX_xml_h, sha1_h],
c_args : [no_override_init_args, sse2_args], include_directories : [inc_include, inc_src, inc_intel],
gnu_symbol_visibility : 'hidden', c_args : [no_override_init_args, sse2_args],
dependencies : idep_intel_decoder, gnu_symbol_visibility : 'hidden',
build_by_default : false, dependencies : idep_intel_decoder,
) build_by_default : false,
)
idep_intel_decoder_elk = declare_dependency( idep_intel_decoder_elk = declare_dependency(
link_with : [libintel_decoder_elk], link_with : [libintel_decoder_elk],
dependencies : idep_intel_decoder, dependencies : idep_intel_decoder,
) )
else
idep_intel_decoder_elk = null_dep
endif
if with_tests and not with_platform_android if with_tests and not with_platform_android
gentest_xml = 'tests/gentest.xml' gentest_xml = 'tests/gentest.xml'

View file

@ -3,6 +3,17 @@
inc_intel = include_directories('.') 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('genxml')
subdir('dev') subdir('dev')
if with_intel_hasvk or with_intel_vk or with_gallium_crocus or with_gallium_iris if with_intel_hasvk or with_intel_vk or with_gallium_crocus or with_gallium_iris

View file

@ -7,10 +7,20 @@
#include "compiler/brw_disasm.h" #include "compiler/brw_disasm.h"
#include "compiler/brw_isa_info.h" #include "compiler/brw_isa_info.h"
#ifdef INTEL_USE_ELK
#include "compiler/elk/elk_disasm.h" #include "compiler/elk/elk_disasm.h"
#include "compiler/elk/elk_isa_info.h" #include "compiler/elk/elk_isa_info.h"
#endif
#include "dev/intel_device_info.h" #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 void
intel_disassemble(const struct intel_device_info *devinfo, intel_disassemble(const struct intel_device_info *devinfo,
const void *assembly, int start, FILE *out) 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_init_isa_info(&isa, devinfo);
brw_disassemble_with_errors(&isa, assembly, start, out); brw_disassemble_with_errors(&isa, assembly, start, out);
} else { } else {
#ifdef INTEL_USE_ELK
struct elk_isa_info isa; struct elk_isa_info isa;
elk_init_isa_info(&isa, devinfo); elk_init_isa_info(&isa, devinfo);
elk_disassemble_with_errors(&isa, assembly, start, out); 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, intel_batch_decode_ctx_init_brw(ctx, &isa, devinfo, fp,
flags, xml_path, get_bo, get_state_size, user_data); flags, xml_path, get_bo, get_state_size, user_data);
} else { } else {
#ifdef INTEL_USE_ELK
struct elk_isa_info isa; struct elk_isa_info isa;
elk_init_isa_info(&isa, devinfo); elk_init_isa_info(&isa, devinfo);
intel_batch_decode_ctx_init_elk(ctx, &isa, devinfo, fp, intel_batch_decode_ctx_init_elk(ctx, &isa, devinfo, fp,
flags, xml_path, get_bo, get_state_size, user_data); flags, xml_path, get_bo, get_state_size, user_data);
#else
not_supported(devinfo);
#endif
} }
} }

View file

@ -21,7 +21,7 @@ libintel_tools = static_library(
idep_libintel_common, idep_libintel_common,
], ],
include_directories : [inc_include, inc_src, inc_intel], 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', gnu_symbol_visibility : 'hidden',
install : false, install : false,
) )