From a9c1c75e9ce3f6d06c5a0a1d6610a63184b5954f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 21 Jun 2021 16:24:17 +1000 Subject: [PATCH] crocus: convert a bunch of is_haswell into verx10 checks. This just make things easier when gen8 support is added Part-of: --- src/gallium/drivers/crocus/crocus_draw.c | 10 +++++----- src/gallium/drivers/crocus/crocus_formats.c | 4 ++-- src/gallium/drivers/crocus/crocus_pipe_control.c | 2 +- src/gallium/drivers/crocus/crocus_program.c | 8 ++++---- src/gallium/drivers/crocus/crocus_resource.c | 2 +- src/gallium/drivers/crocus/crocus_screen.c | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/crocus/crocus_draw.c b/src/gallium/drivers/crocus/crocus_draw.c index 119c557..b837e86 100644 --- a/src/gallium/drivers/crocus/crocus_draw.c +++ b/src/gallium/drivers/crocus/crocus_draw.c @@ -82,7 +82,7 @@ can_cut_index_handle_prim(struct crocus_context *ice, const struct intel_device_info *devinfo = &screen->devinfo; /* Haswell can do it all. */ - if (devinfo->is_haswell) + if (devinfo->verx10 >= 75) return true; if (!can_cut_index_handle_restart_index(ice, draw)) @@ -176,7 +176,7 @@ crocus_update_draw_info(struct crocus_context *ice, ice->state.cut_index; if (ice->state.primitive_restart != info->primitive_restart || ice->state.cut_index != cut_index) { - if (screen->devinfo.is_haswell) + if (screen->devinfo.verx10 >= 75) ice->state.dirty |= CROCUS_DIRTY_GEN75_VF; ice->state.primitive_restart = info->primitive_restart; ice->state.cut_index = info->restart_index; @@ -261,7 +261,7 @@ crocus_indirect_draw_vbo(struct crocus_context *ice, struct pipe_draw_indirect_info indirect = *dindirect; const struct intel_device_info *devinfo = &batch->screen->devinfo; - if (devinfo->is_haswell && indirect.indirect_draw_count && + if (devinfo->verx10 >= 75 && indirect.indirect_draw_count && ice->state.predicate == CROCUS_PREDICATE_STATE_USE_BIT) { /* Upload MI_PREDICATE_RESULT to GPR15.*/ screen->vtbl.load_register_reg64(batch, CS_GPR(15), MI_PREDICATE_RESULT); @@ -284,7 +284,7 @@ crocus_indirect_draw_vbo(struct crocus_context *ice, indirect.offset += indirect.stride; } - if (devinfo->is_haswell && indirect.indirect_draw_count && + if (devinfo->verx10 >= 75 && indirect.indirect_draw_count && ice->state.predicate == CROCUS_PREDICATE_STATE_USE_BIT) { /* Restore MI_PREDICATE_RESULT. */ screen->vtbl.load_register_reg64(batch, MI_PREDICATE_RESULT, CS_GPR(15)); @@ -363,7 +363,7 @@ crocus_draw_vbo(struct pipe_context *ctx, } if (indirect && indirect->count_from_stream_output && - !screen->devinfo.is_haswell) { + screen->devinfo.verx10 < 75) { crocus_draw_vbo_get_vertex_count(ctx, info, drawid_offset, indirect); return; } diff --git a/src/gallium/drivers/crocus/crocus_formats.c b/src/gallium/drivers/crocus/crocus_formats.c index 99c2032..e724c4c 100644 --- a/src/gallium/drivers/crocus/crocus_formats.c +++ b/src/gallium/drivers/crocus/crocus_formats.c @@ -451,7 +451,7 @@ crocus_is_format_supported(struct pipe_screen *pscreen, return false; /* no stencil texturing prior to haswell */ - if (!devinfo->is_haswell) { + if (devinfo->verx10 < 75) { if (pformat == PIPE_FORMAT_S8_UINT || pformat == PIPE_FORMAT_X24S8_UINT || pformat == PIPE_FORMAT_S8X24_UINT || @@ -543,7 +543,7 @@ crocus_is_format_supported(struct pipe_screen *pscreen, if (usage & PIPE_BIND_VERTEX_BUFFER) { supported &= isl_format_supports_vertex_fetch(devinfo, format); - if (!devinfo->is_haswell) { + if (devinfo->verx10 < 75) { /* W/A: Pre-Haswell, the hardware doesn't really support the formats * we'd like to use here, so upload everything as UINT and fix it in * the shader diff --git a/src/gallium/drivers/crocus/crocus_pipe_control.c b/src/gallium/drivers/crocus/crocus_pipe_control.c index 7a9625c..aebaa98 100644 --- a/src/gallium/drivers/crocus/crocus_pipe_control.c +++ b/src/gallium/drivers/crocus/crocus_pipe_control.c @@ -348,7 +348,7 @@ crocus_memory_barrier(struct pipe_context *ctx, unsigned flags) /* Typed surface messages are handled by the render cache on IVB, so we * need to flush it too. */ - if (!devinfo->is_haswell) + if (devinfo->verx10 < 75) bits |= PIPE_CONTROL_RENDER_TARGET_FLUSH; for (int i = 0; i < ice->batch_count; i++) { diff --git a/src/gallium/drivers/crocus/crocus_program.c b/src/gallium/drivers/crocus/crocus_program.c index fb8216b..24a8dcf 100644 --- a/src/gallium/drivers/crocus/crocus_program.c +++ b/src/gallium/drivers/crocus/crocus_program.c @@ -163,7 +163,7 @@ crocus_populate_sampler_prog_key_data(struct crocus_context *ice, continue; if (texture->base.target == PIPE_BUFFER) continue; - if (!devinfo->is_haswell) { + if (devinfo->verx10 < 75) { key->swizzles[s] = crocus_get_texture_swizzle(ice, texture); } @@ -196,7 +196,7 @@ crocus_populate_sampler_prog_key_data(struct crocus_context *ice, * request blue. Haswell can use SCS for this, but Ivybridge * needs a shader workaround. */ - if (!devinfo->is_haswell) + if (devinfo->verx10 < 75) key->gather_channel_quirk_mask |= 1 << s; break; default: @@ -1009,7 +1009,7 @@ crocus_setup_binding_table(const struct intel_device_info *devinfo, /* rewrite the tg4 component from green to blue before replacing the texture index */ - if (devinfo->ver == 7 && !devinfo->is_haswell) { + if (devinfo->verx10 == 70) { if (tex->component == 1) if (key->gather_channel_quirk_mask & (1 << tex->texture_index)) tex->component = 2; @@ -2793,7 +2793,7 @@ crocus_create_vs_state(struct pipe_context *ctx, screen->devinfo.ver <= 5) ish->nos |= (1ull << CROCUS_NOS_RASTERIZER); - if (!screen->devinfo.is_haswell) + if (screen->devinfo.verx10 < 75) ish->nos |= (1ull << CROCUS_NOS_VERTEX_ELEMENTS); if (screen->precompile) { diff --git a/src/gallium/drivers/crocus/crocus_resource.c b/src/gallium/drivers/crocus/crocus_resource.c index 4367dae..612fc50 100644 --- a/src/gallium/drivers/crocus/crocus_resource.c +++ b/src/gallium/drivers/crocus/crocus_resource.c @@ -564,7 +564,7 @@ crocus_resource_configure_aux(struct crocus_screen *screen, /* Disable HiZ for LOD > 0 unless the width/height are 8x4 aligned. * For LOD == 0, we can grow the dimensions to make it work. */ - if (!devinfo->is_haswell || + if (devinfo->verx10 < 75 || (level == 0 || ((width & 7) == 0 && (height & 3) == 0))) res->aux.has_hiz |= 1 << level; } diff --git a/src/gallium/drivers/crocus/crocus_screen.c b/src/gallium/drivers/crocus/crocus_screen.c index 05e3d06..e582ee1 100644 --- a/src/gallium/drivers/crocus/crocus_screen.c +++ b/src/gallium/drivers/crocus/crocus_screen.c @@ -239,7 +239,7 @@ crocus_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return devinfo->ver >= 7; case PIPE_CAP_QUERY_BUFFER_OBJECT: case PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR: - return devinfo->is_haswell; + return devinfo->verx10 >= 75; case PIPE_CAP_CULL_DISTANCE: case PIPE_CAP_QUERY_PIPELINE_STATISTICS_SINGLE: case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: @@ -283,7 +283,7 @@ crocus_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS: return BRW_MAX_SOL_BINDINGS; case PIPE_CAP_GLSL_FEATURE_LEVEL: { - if (devinfo->is_haswell) + if (devinfo->verx10 >= 75) return 460; else if (devinfo->ver >= 7) return 420; @@ -507,7 +507,7 @@ crocus_get_shader_param(struct pipe_screen *pscreen, return 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: - return devinfo->is_haswell ? CROCUS_MAX_TEXTURE_SAMPLERS : 16; + return (devinfo->verx10 >= 75) ? CROCUS_MAX_TEXTURE_SAMPLERS : 16; case PIPE_SHADER_CAP_MAX_SHADER_IMAGES: if (devinfo->ver >= 7 && (p_stage == PIPE_SHADER_FRAGMENT || -- 2.7.4