* Haswell (GEN(7.5)) supports an arbitrary cut index, check everything
* older.
*/
- if (ilo->dev->gen >= ILO_GEN(7.5))
+ if (ilo_dev_gen(ilo->dev) >= ILO_GEN(7.5))
return true;
/* Note: indices must be unsigned byte, unsigned short or unsigned int */
case PIPE_PRIM_QUAD_STRIP:
case PIPE_PRIM_QUADS:
case PIPE_PRIM_TRIANGLE_FAN:
- if (ilo->dev->gen >= ILO_GEN(7.5)) {
+ if (ilo_dev_gen(ilo->dev) >= ILO_GEN(7.5)) {
/* Haswell and newer parts can handle these prim types. */
return true;
}
ilo_3d_pipeline_emit_flush(hw3d->pipeline);
/* don't know why */
- if (ilo->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(ilo->dev) >= ILO_GEN(7))
ilo_cp_flush(hw3d->cp, "texture barrier");
}
p->cp = cp;
p->dev = dev;
- switch (p->dev->gen) {
+ switch (ilo_dev_gen(p->dev)) {
case ILO_GEN(6):
ilo_3d_pipeline_init_gen6(p);
break;
handle_invalid_batch_bo(struct ilo_3d_pipeline *p, bool unset)
{
if (p->invalidate_flags & ILO_3D_PIPELINE_INVALIDATE_BATCH_BO) {
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
p->state.has_gen6_wa_pipe_control = false;
if (unset)
p->state.so_num_vertices = 0;
/* on GEN7+, we need SOL_RESET to reset the SO write offsets */
- if (p->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(p->dev) >= ILO_GEN(7))
ilo_cp_set_one_off_flags(p->cp, INTEL_EXEC_GEN7_SOL_RESET);
}
gen6_wa_pipe_control_post_sync(struct ilo_3d_pipeline *p,
bool caller_post_sync)
{
- assert(p->dev->gen == ILO_GEN(6));
+ assert(ilo_dev_gen(p->dev) == ILO_GEN(6));
/* emit once */
if (p->state.has_gen6_wa_pipe_control)
static void
gen6_wa_pipe_control_wm_multisample_flush(struct ilo_3d_pipeline *p)
{
- assert(p->dev->gen == ILO_GEN(6));
+ assert(ilo_dev_gen(p->dev) == ILO_GEN(6));
gen6_wa_pipe_control_post_sync(p, false);
static void
gen6_wa_pipe_control_wm_depth_flush(struct ilo_3d_pipeline *p)
{
- assert(p->dev->gen == ILO_GEN(6));
+ assert(ilo_dev_gen(p->dev) == ILO_GEN(6));
gen6_wa_pipe_control_post_sync(p, false);
static void
gen6_wa_pipe_control_wm_max_threads_stall(struct ilo_3d_pipeline *p)
{
- assert(p->dev->gen == ILO_GEN(6));
+ assert(ilo_dev_gen(p->dev) == ILO_GEN(6));
/* the post-sync workaround should cover this already */
if (p->state.has_gen6_wa_pipe_control)
static void
gen6_wa_pipe_control_vs_const_flush(struct ilo_3d_pipeline *p)
{
- assert(p->dev->gen == ILO_GEN(6));
+ assert(ilo_dev_gen(p->dev) == ILO_GEN(6));
gen6_wa_pipe_control_post_sync(p, false);
{
/* PIPELINE_SELECT */
if (session->hw_ctx_changed) {
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
gen6_PIPELINE_SELECT(&p->cp->builder, 0x0);
{
/* STATE_SIP */
if (session->hw_ctx_changed) {
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
gen6_STATE_SIP(&p->cp->builder, 0);
/* STATE_BASE_ADDRESS */
if (session->state_bo_changed || session->kernel_bo_changed ||
session->batch_bo_changed) {
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
ilo_builder_batch_state_base_address(&p->cp->builder,
const struct ilo_context *ilo,
struct gen6_pipeline_session *session)
{
- if (p->dev->gen >= ILO_GEN(7.5)) {
+ if (ilo_dev_gen(p->dev) >= ILO_GEN(7.5)) {
/* 3DSTATE_INDEX_BUFFER */
if (DIRTY(IB) || session->batch_bo_changed) {
gen6_3DSTATE_INDEX_BUFFER(&p->cp->builder,
* the classic i965 does this in upload_vs_state(), citing a spec that I
* cannot find
*/
- if (emit_3dstate_vs && p->dev->gen == ILO_GEN(6))
+ if (emit_3dstate_vs && ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
/* 3DSTATE_CONSTANT_VS */
gen6_3DSTATE_VS(&p->cp->builder, ilo->vs, num_samplers);
}
- if (emit_3dstate_constant_vs && p->dev->gen == ILO_GEN(6))
+ if (emit_3dstate_constant_vs && ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_vs_const_flush(p);
}
/* 3DSTATE_GS_SVB_INDEX */
if (emit) {
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
gen6_3DSTATE_GS_SVB_INDEX(&p->cp->builder,
{
/* 3DSTATE_DRAWING_RECTANGLE */
if (DIRTY(FB)) {
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
gen6_3DSTATE_DRAWING_RECTANGLE(&p->cp->builder, 0, 0,
const bool cc_may_kill = (ilo->dsa->dw_alpha ||
ilo->blend->alpha_to_coverage);
- if (p->dev->gen == ILO_GEN(6) && session->hw_ctx_changed)
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6) && session->hw_ctx_changed)
gen6_wa_pipe_control_wm_max_threads_stall(p);
gen6_3DSTATE_WM(&p->cp->builder, ilo->fs, num_samplers,
packed_sample_pos = (ilo->fb.num_samples > 1) ?
&p->packed_sample_position_4x : &p->packed_sample_position_1x;
- if (p->dev->gen == ILO_GEN(6)) {
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6)) {
gen6_wa_pipe_control_post_sync(p, false);
gen6_wa_pipe_control_wm_multisample_flush(p);
}
clear_params = 0;
}
- if (p->dev->gen == ILO_GEN(6)) {
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6)) {
gen6_wa_pipe_control_post_sync(p, false);
gen6_wa_pipe_control_wm_depth_flush(p);
}
/* 3DSTATE_POLY_STIPPLE_PATTERN and 3DSTATE_POLY_STIPPLE_OFFSET */
if ((DIRTY(RASTERIZER) || DIRTY(POLY_STIPPLE)) &&
ilo->rasterizer->state.poly_stipple_enable) {
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
gen6_3DSTATE_POLY_STIPPLE_PATTERN(&p->cp->builder,
/* 3DSTATE_LINE_STIPPLE */
if (DIRTY(RASTERIZER) && ilo->rasterizer->state.line_stipple_enable) {
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
gen6_3DSTATE_LINE_STIPPLE(&p->cp->builder,
/* 3DSTATE_AA_LINE_PARAMETERS */
if (DIRTY(RASTERIZER) && ilo->rasterizer->state.line_smooth) {
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
gen6_3DSTATE_AA_LINE_PARAMETERS(&p->cp->builder);
struct gen6_pipeline_session *session)
{
/* SF_CLIP_VIEWPORT and CC_VIEWPORT */
- if (p->dev->gen >= ILO_GEN(7) && DIRTY(VIEWPORT)) {
+ if (ilo_dev_gen(p->dev) >= ILO_GEN(7) && DIRTY(VIEWPORT)) {
p->state.SF_CLIP_VIEWPORT = gen7_SF_CLIP_VIEWPORT(&p->cp->builder,
ilo->viewport.cso, ilo->viewport.count);
{
const struct ilo_so_state *so = &ilo->so;
- if (p->dev->gen != ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) != ILO_GEN(6))
return;
/* SURFACE_STATEs for stream output targets */
void
ilo_3d_pipeline_emit_flush_gen6(struct ilo_3d_pipeline *p)
{
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
gen6_PIPE_CONTROL(&p->cp->builder,
ilo_3d_pipeline_emit_write_timestamp_gen6(struct ilo_3d_pipeline *p,
struct intel_bo *bo, int index)
{
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, true);
gen6_PIPE_CONTROL(&p->cp->builder,
ilo_3d_pipeline_emit_write_depth_count_gen6(struct ilo_3d_pipeline *p,
struct intel_bo *bo, int index)
{
- if (p->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6))
gen6_wa_pipe_control_post_sync(p, false);
gen6_PIPE_CONTROL(&p->cp->builder,
GEN6_REG_CL_INVOCATION_COUNT,
GEN6_REG_CL_PRIMITIVES_COUNT,
GEN6_REG_PS_INVOCATION_COUNT,
- p->dev->gen >= ILO_GEN(7) ? GEN7_REG_HS_INVOCATION_COUNT : 0,
- p->dev->gen >= ILO_GEN(7) ? GEN7_REG_DS_INVOCATION_COUNT : 0,
+ ilo_dev_gen(p->dev) >= ILO_GEN(7) ? GEN7_REG_HS_INVOCATION_COUNT : 0,
+ ilo_dev_gen(p->dev) >= ILO_GEN(7) ? GEN7_REG_DS_INVOCATION_COUNT : 0,
0,
};
int i;
size += align(GEN6_COLOR_CALC_STATE__SIZE, alignment);
/* viewport arrays */
- if (p->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(p->dev) >= ILO_GEN(7)) {
size +=
align(GEN7_SF_CLIP_VIEWPORT__SIZE * ILO_MAX_VIEWPORTS, 16) +
align(GEN6_CC_VIEWPORT__SIZE * ILO_MAX_VIEWPORTS, 8) +
switch (sh_type) {
case PIPE_SHADER_VERTEX:
if (ilo->vs) {
- if (p->dev->gen == ILO_GEN(6)) {
+ if (ilo_dev_gen(p->dev) == ILO_GEN(6)) {
const struct pipe_stream_output_info *so_info =
ilo_shader_get_kernel_so_info(ilo->vs);
}
break;
case PIPE_SHADER_GEOMETRY:
- if (ilo->gs && p->dev->gen == ILO_GEN(6)) {
+ if (ilo->gs && ilo_dev_gen(p->dev) == ILO_GEN(6)) {
const struct pipe_stream_output_info *so_info =
ilo_shader_get_kernel_so_info(ilo->gs);
struct intel_bo *bo = NULL;
uint32_t dw1 = GEN6_PIPE_CONTROL_CS_STALL;
- assert(p->dev->gen == ILO_GEN(7) || p->dev->gen == ILO_GEN(7.5));
+ assert(ilo_dev_gen(p->dev) == ILO_GEN(7) ||
+ ilo_dev_gen(p->dev) == ILO_GEN(7.5));
/* emit once */
if (p->state.has_gen6_wa_pipe_control)
static void
gen7_wa_pipe_control_vs_depth_stall(struct ilo_3d_pipeline *p)
{
- assert(p->dev->gen == ILO_GEN(7) || p->dev->gen == ILO_GEN(7.5));
+ assert(ilo_dev_gen(p->dev) == ILO_GEN(7) ||
+ ilo_dev_gen(p->dev) == ILO_GEN(7.5));
/*
* From the Ivy Bridge PRM, volume 2 part 1, page 106:
gen7_wa_pipe_control_wm_depth_stall(struct ilo_3d_pipeline *p,
bool change_depth_buffer)
{
- assert(p->dev->gen == ILO_GEN(7) || p->dev->gen == ILO_GEN(7.5));
+ assert(ilo_dev_gen(p->dev) == ILO_GEN(7) ||
+ ilo_dev_gen(p->dev) == ILO_GEN(7.5));
/*
* From the Ivy Bridge PRM, volume 2 part 1, page 276:
static void
gen7_wa_pipe_control_ps_max_threads_stall(struct ilo_3d_pipeline *p)
{
- assert(p->dev->gen == ILO_GEN(7) || p->dev->gen == ILO_GEN(7.5));
+ assert(ilo_dev_gen(p->dev) == ILO_GEN(7) ||
+ ilo_dev_gen(p->dev) == ILO_GEN(7.5));
/*
* From the Ivy Bridge PRM, volume 2 part 1, page 286:
/* 3DSTATE_URB_{VS,GS,HS,DS} */
if (DIRTY(VE) || DIRTY(VS)) {
/* the first 16KB are reserved for VS and PS PCBs */
- const int offset =
- (p->dev->gen == ILO_GEN(7.5) && p->dev->gt == 3) ? 32768 : 16384;
+ const int offset = (ilo_dev_gen(p->dev) == ILO_GEN(7.5) &&
+ p->dev->gt == 3) ? 32768 : 16384;
int vs_entry_size, vs_total_size;
vs_entry_size = (ilo->vs) ?
* Push constant buffers are only allowed to take up at most the first
* 16KB of the URB. Split the space evenly for VS and FS.
*/
- const int max_size =
- (p->dev->gen == ILO_GEN(7.5) && p->dev->gt == 3) ? 32768 : 16384;
+ const int max_size = (ilo_dev_gen(p->dev) == ILO_GEN(7.5) &&
+ p->dev->gt == 3) ? 32768 : 16384;
const int size = max_size / 2;
int offset = 0;
gen7_3DSTATE_PUSH_CONSTANT_ALLOC_PS(&p->cp->builder, offset, size);
- if (p->dev->gen == ILO_GEN(7))
+ if (ilo_dev_gen(p->dev) == ILO_GEN(7))
gen7_wa_pipe_control_cs_stall(p, true, true);
}
}
const int num_samplers = ilo->sampler[PIPE_SHADER_FRAGMENT].count;
const bool dual_blend = ilo->blend->dual_blend;
- if ((p->dev->gen == ILO_GEN(7) || p->dev->gen == ILO_GEN(7.5)) &&
+ if ((ilo_dev_gen(p->dev) == ILO_GEN(7) ||
+ ilo_dev_gen(p->dev) == ILO_GEN(7.5)) &&
session->hw_ctx_changed)
gen7_wa_pipe_control_ps_max_threads_stall(p);
* 16KB of the URB. Split the space evenly for VS and FS.
*/
const int max_size =
- (p->dev->gen == ILO_GEN(7.5) && p->dev->gt == 3) ? 32768 : 16384;
+ (ilo_dev_gen(p->dev) == ILO_GEN(7.5) && p->dev->gt == 3) ? 32768 : 16384;
const int size = max_size / 2;
int offset = 0;
{
/* the first 16KB are reserved for VS and PS PCBs */
const int offset =
- (p->dev->gen == ILO_GEN(7.5) && p->dev->gt == 3) ? 32768 : 16384;
+ (ilo_dev_gen(p->dev) == ILO_GEN(7.5) && p->dev->gt == 3) ? 32768 : 16384;
gen7_3DSTATE_URB_VS(&p->cp->builder, offset, p->dev->urb_size - offset,
blitter->ve.count * 4 * sizeof(float));
*/
switch (tex->layout.format) {
case PIPE_FORMAT_Z16_UNORM:
- if (blitter->ilo->dev->gen == ILO_GEN(6) && tex->base.width0 % 16)
+ if (ilo_dev_gen(blitter->ilo->dev) == ILO_GEN(6) &&
+ tex->base.width0 % 16)
return false;
break;
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
enum ilo_builder_writer_type which,
const struct ilo_builder_item *item)
{
- if (builder->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(builder->dev) >= ILO_GEN(7))
writer_decode_sf_clip_viewport_gen7(builder, which, item);
else
writer_decode_sf_viewport_gen6(builder, which, item);
enum ilo_builder_writer_type which,
const struct ilo_builder_item *item)
{
- if (builder->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(builder->dev) >= ILO_GEN(7))
writer_decode_surface_gen7(builder, which, item);
else
writer_decode_surface_gen6(builder, which, item);
bool has_timestamp;
bool has_gen7_sol_reset;
- int gen;
+ /* use ilo_dev_gen() */
+ int gen_opaque;
+
int gt;
int urb_size;
};
extern int ilo_debug;
+static inline int
+ilo_dev_gen(const struct ilo_dev_info *dev)
+{
+ return dev->gen_opaque;
+}
+
/**
* Print a message, for dumping or debugging.
*/
assert(!cap->rt_write_blending || cap->rt_write_blending >= cap->rt_write);
- return util_format_is_pure_integer(format) ? (dev->gen >= cap->rt_write) :
- (cap->rt_write_blending) ? (dev->gen >= cap->rt_write_blending) : false;
+ if (util_format_is_pure_integer(format))
+ return (ilo_dev_gen(dev) >= cap->rt_write);
+ else if (cap->rt_write_blending)
+ return (ilo_dev_gen(dev) >= cap->rt_write_blending);
+ else
+ return false;
}
static bool
assert(!cap->filtering || cap->filtering >= cap->sampling);
- return util_format_is_pure_integer(format) ? (dev->gen >= cap->sampling) :
- (cap->filtering) ? (dev->gen >= cap->filtering) : false;
+ if (util_format_is_pure_integer(format))
+ return (ilo_dev_gen(dev) >= cap->sampling);
+ else if (cap->filtering)
+ return (ilo_dev_gen(dev) >= cap->filtering);
+ else
+ return false;
}
static bool
const struct ilo_vf_cap *cap = (idx >= 0 && idx < Elements(ilo_vf_caps)) ?
&ilo_vf_caps[idx] : NULL;
- return (cap && cap->vertex_element && dev->gen >= cap->vertex_element);
+ return (cap && cap->vertex_element &&
+ ilo_dev_gen(dev) >= cap->vertex_element);
}
static boolean
}
break;
case PIPE_BIND_VERTEX_BUFFER:
- if (dev->gen >= ILO_GEN(7.5))
+ if (ilo_dev_gen(dev) >= ILO_GEN(7.5))
return ilo_translate_color_format(dev, format);
/*
ilo_gpe_init_rasterizer_clip(dev, state, &rasterizer->clip);
ilo_gpe_init_rasterizer_sf(dev, state, &rasterizer->sf);
- if (dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(dev) >= ILO_GEN(7))
ilo_gpe_init_rasterizer_wm_gen7(dev, state, &rasterizer->wm);
else
ilo_gpe_init_rasterizer_wm_gen6(dev, state, &rasterizer->wm);
unsigned depth, unsigned level,
struct ilo_view_surface *surf)
{
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
ilo_gpe_init_view_surface_null_gen7(dev,
width, height, depth, level, surf);
}
bool is_rt, bool render_cache_rw,
struct ilo_view_surface *surf)
{
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
ilo_gpe_init_view_surface_for_buffer_gen7(dev, buf, offset, size,
struct_size, elem_format, is_rt, render_cache_rw, surf);
}
bool is_rt,
struct ilo_view_surface *surf)
{
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
ilo_gpe_init_view_surface_for_texture_gen7(dev, tex, format,
first_level, num_levels, first_layer, num_layers,
is_rt, surf);
const struct ilo_shader_state *gs,
struct ilo_shader_cso *cso)
{
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
ilo_gpe_init_gs_cso_gen7(dev, gs, cso);
}
else {
const struct ilo_shader_state *fs,
struct ilo_shader_cso *cso)
{
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
ilo_gpe_init_fs_cso_gen7(dev, fs, cso);
}
else {
if (!vue_read_len)
vue_read_len = 1;
- switch (dev->gen) {
+ switch (ilo_dev_gen(dev)) {
case ILO_GEN(6):
/*
* From the Sandy Bridge PRM, volume 1 part 1, page 22:
dw5 = GEN6_VS_DW5_STATISTICS |
GEN6_VS_DW5_VS_ENABLE;
- if (dev->gen >= ILO_GEN(7.5))
+ if (ilo_dev_gen(dev) >= ILO_GEN(7.5))
dw5 |= (max_threads - 1) << GEN75_VS_DW5_MAX_THREADS__SHIFT;
else
dw5 |= (max_threads - 1) << GEN6_VS_DW5_MAX_THREADS__SHIFT;
dw1 = GEN6_CLIP_DW1_STATISTICS;
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
/*
* From the Ivy Bridge PRM, volume 2 part 1, page 219:
*
GEN7_SF_DW1_VIEWPORT_ENABLE;
/* XXX GEN6 path seems to work fine for GEN7 */
- if (false && dev->gen >= ILO_GEN(7)) {
+ if (false && ilo_dev_gen(dev) >= ILO_GEN(7)) {
/*
* From the Ivy Bridge PRM, volume 2 part 1, page 258:
*
dw2 |= line_width << GEN7_SF_DW2_LINE_WIDTH__SHIFT;
- if (dev->gen >= ILO_GEN(7.5) && state->line_stipple_enable)
+ if (ilo_dev_gen(dev) >= ILO_GEN(7.5) && state->line_stipple_enable)
dw2 |= GEN75_SF_DW2_LINE_STIPPLE_ENABLE;
if (state->scissor)
info->surface_type = GEN6_SURFTYPE_2D;
}
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
separate_stencil = true;
}
else {
info->stencil.tiling = s8_tex->layout.tiling;
- if (dev->gen == ILO_GEN(6)) {
+ if (ilo_dev_gen(dev) == ILO_GEN(6)) {
unsigned x, y;
assert(s8_tex->layout.walk == ILO_LAYOUT_WALK_LOD);
info->hiz.tiling = INTEL_TILING_Y;
/* offset to the level */
- if (dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(dev) == ILO_GEN(6))
info->hiz.offset = tex->layout.aux_offsets[level];
}
unsigned first_layer, unsigned num_layers,
struct ilo_zs_surface *zs)
{
- const int max_2d_size = (dev->gen >= ILO_GEN(7)) ? 16384 : 8192;
- const int max_array_size = (dev->gen >= ILO_GEN(7)) ? 2048 : 512;
+ const int max_2d_size = (ilo_dev_gen(dev) >= ILO_GEN(7)) ? 16384 : 8192;
+ const int max_array_size = (ilo_dev_gen(dev) >= ILO_GEN(7)) ? 2048 : 512;
struct ilo_zs_surface_info info;
uint32_t dw1, dw2, dw3, dw4, dw5, dw6;
dw2 = 0;
}
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
if (info.zs.bo)
dw1 |= 1 << 28;
zs->payload[6] = info.stencil.stride - 1;
zs->payload[7] = info.stencil.offset;
- if (dev->gen >= ILO_GEN(7.5))
+ if (ilo_dev_gen(dev) >= ILO_GEN(7.5))
zs->payload[6] |= GEN75_STENCIL_DW1_STENCIL_BUFFER_ENABLE;
/* do not increment reference count */
* valid to the renderer, and those failing the XY clipping have a
* better chance of passing the GB test.
*/
- const int max_extent = (dev->gen >= ILO_GEN(7)) ? 32768 : 16384;
+ const int max_extent = (ilo_dev_gen(dev) >= ILO_GEN(7)) ? 32768 : 16384;
const int half_len = 8192 / 2;
/* make sure the guardband is within the valid range */
if (state->alpha_to_coverage) {
cso->dw_alpha_mod |= 1 << 31;
- if (dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(dev) >= ILO_GEN(7))
cso->dw_alpha_mod |= 1 << 29;
}
* With Gallium interface, Base is always zero and
* pipe_sampler_view::u.tex.first_level specifies SurfMinLod.
*/
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
const float scale = 256.0f;
/* [-16.0, 16.0) in S4.8 */
assert(mip_filter == GEN6_MIPFILTER_NONE);
}
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
dw0 = 1 << 28 |
mip_filter << 20 |
lod_bias << 1;
#include "ilo_shader.h"
#include "ilo_gpe.h"
-#define ILO_GPE_VALID_GEN(dev, min_gen, max_gen) \
- assert((dev)->gen >= ILO_GEN(min_gen) && (dev)->gen <= ILO_GEN(max_gen))
+#define ILO_GPE_VALID_GEN(dev, min_gen, max_gen) \
+ assert(ilo_dev_gen(dev) >= ILO_GEN(min_gen) && \
+ ilo_dev_gen(dev) <= ILO_GEN(max_gen))
/**
* Translate winsys tiling to hardware tiling.
payload[5] = 0;
}
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
int format;
/* separate stencil */
assert(bo_offset % ((store_qword) ? 8 : 4) == 0);
/* must use GGTT on GEN6 as in PIPE_CONTROL */
- if (builder->dev->gen == ILO_GEN(6)) {
+ if (ilo_dev_gen(builder->dev) == ILO_GEN(6)) {
dw0 |= GEN6_MI_STORE_DATA_IMM_DW0_USE_GGTT;
reloc_flags |= INTEL_RELOC_GGTT;
}
assert(reg % 4 == 0 && bo_offset % 4 == 0);
/* must use GGTT on GEN6 as in PIPE_CONTROL */
- if (builder->dev->gen == ILO_GEN(6)) {
+ if (ilo_dev_gen(builder->dev) == ILO_GEN(6)) {
dw0 |= GEN6_MI_STORE_REGISTER_MEM_DW0_USE_GGTT;
reloc_flags |= INTEL_RELOC_GGTT;
}
assert(bo_offset % 64 == 0);
/* must use GGTT on GEN6 as in PIPE_CONTROL */
- if (builder->dev->gen == ILO_GEN(6)) {
+ if (ilo_dev_gen(builder->dev) == ILO_GEN(6)) {
bo_offset |= GEN6_MI_REPORT_PERF_COUNT_DW1_USE_GGTT;
reloc_flags |= INTEL_RELOC_GGTT;
}
else
dw[0] |= GEN6_VB_STATE_DW0_ACCESS_VERTEXDATA;
- if (builder->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(builder->dev) >= ILO_GEN(7))
dw[0] |= GEN7_VB_STATE_DW0_ADDR_MODIFIED;
/* use null vb if there is no buffer or the stride is out of range */
return;
/* this is moved to the new 3DSTATE_VF */
- if (builder->dev->gen >= ILO_GEN(7.5))
+ if (ilo_dev_gen(builder->dev) >= ILO_GEN(7.5))
assert(!enable_cut_index);
switch (ib->hw_index_size) {
ILO_GPE_VALID_GEN(builder->dev, 6, 7.5);
- if (builder->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(builder->dev) >= ILO_GEN(7)) {
rect_limit = 16383;
}
else {
ILO_GPE_VALID_GEN(dev, 6, 7.5);
- if (dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7)) {
shift_w = 4;
shift_h = 18;
mask = 0x3fff;
ILO_GPE_VALID_GEN(builder->dev, 6, 7.5);
- dw0 = (builder->dev->gen >= ILO_GEN(7)) ?
+ dw0 = (ilo_dev_gen(builder->dev) >= ILO_GEN(7)) ?
GEN7_RENDER_CMD(3D, 3DSTATE_DEPTH_BUFFER) :
GEN6_RENDER_CMD(3D, 3DSTATE_DEPTH_BUFFER);
dw0 |= (cmd_len - 2);
dw[0] = dw0;
dw[1] = pattern;
- if (builder->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(builder->dev) >= ILO_GEN(7)) {
/* in U1.16 */
inverse = (unsigned) (65536.0f / factor);
dw[2] = inverse << 15 | factor;
const uint32_t *packed_sample_pos,
bool pixel_location_center)
{
- const uint8_t cmd_len = (builder->dev->gen >= ILO_GEN(7)) ? 4 : 3;
+ const uint8_t cmd_len = (ilo_dev_gen(builder->dev) >= ILO_GEN(7)) ? 4 : 3;
const uint32_t dw0 = GEN6_RENDER_CMD(3D, 3DSTATE_MULTISAMPLE) |
(cmd_len - 2);
uint32_t dw1, dw2, dw3, *dw;
dw3 = 0;
break;
case 8:
- assert(builder->dev->gen >= ILO_GEN(7));
+ assert(ilo_dev_gen(builder->dev) >= ILO_GEN(7));
dw1 |= GEN7_MULTISAMPLE_DW1_NUMSAMPLES_8;
dw2 = packed_sample_pos[0];
dw3 = packed_sample_pos[1];
dw[0] = dw0;
dw[1] = dw1;
dw[2] = dw2;
- if (builder->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(builder->dev) >= ILO_GEN(7))
dw[2] = dw3;
}
ILO_GPE_VALID_GEN(builder->dev, 6, 7.5);
- dw0 = (builder->dev->gen >= ILO_GEN(7)) ?
+ dw0 = (ilo_dev_gen(builder->dev) >= ILO_GEN(7)) ?
GEN7_RENDER_CMD(3D, 3DSTATE_STENCIL_BUFFER) :
GEN6_RENDER_CMD(3D, 3DSTATE_STENCIL_BUFFER);
dw0 |= (cmd_len - 2);
ILO_GPE_VALID_GEN(builder->dev, 6, 7.5);
- dw0 = (builder->dev->gen >= ILO_GEN(7)) ?
+ dw0 = (ilo_dev_gen(builder->dev) >= ILO_GEN(7)) ?
GEN7_RENDER_CMD(3D, 3DSTATE_HIER_DEPTH_BUFFER) :
GEN6_RENDER_CMD(3D, 3DSTATE_HIER_DEPTH_BUFFER);
dw0 |= (cmd_len - 2);
GEN6_PIPE_CONTROL_WRITE_PS_DEPTH_COUNT |
GEN6_PIPE_CONTROL_WRITE_TIMESTAMP;
- if (builder->dev->gen == ILO_GEN(6))
+ if (ilo_dev_gen(builder->dev) == ILO_GEN(6))
bit_test |= GEN6_PIPE_CONTROL_NOTIFY_ENABLE;
assert(dw1 & bit_test);
* The kernel will add the mapping automatically (when write domain is
* INTEL_DOMAIN_INSTRUCTION).
*/
- if (builder->dev->gen == ILO_GEN(6) && bo) {
+ if (ilo_dev_gen(builder->dev) == ILO_GEN(6) && bo) {
bo_offset |= GEN6_PIPE_CONTROL_DW2_USE_GGTT;
reloc_flags |= INTEL_RELOC_GGTT;
}
bool for_render)
{
const int state_align = 32;
- const int state_len = (builder->dev->gen >= ILO_GEN(7)) ? 8 : 6;
+ const int state_len = (ilo_dev_gen(builder->dev) >= ILO_GEN(7)) ? 8 : 6;
uint32_t state_offset;
ILO_GPE_VALID_GEN(builder->dev, 6, 7.5);
dw[0] |= dw_filter;
- if (builder->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(builder->dev) >= ILO_GEN(7)) {
dw[3] |= dw_wrap;
}
else {
const struct ilo_sampler_cso *sampler)
{
const int state_align = 32;
- const int state_len = (builder->dev->gen >= ILO_GEN(7)) ? 4 : 12;
+ const int state_len = (ilo_dev_gen(builder->dev) >= ILO_GEN(7)) ? 4 : 12;
ILO_GPE_VALID_GEN(builder->dev, 6, 7.5);
/* in pairs */
vue_read_len = (vue_read_len + 1) / 2;
- switch (dev->gen) {
+ switch (ilo_dev_gen(dev)) {
case ILO_GEN(7.5):
max_threads = (dev->gt >= 2) ? 256 : 70;
break;
dw4 = GEN7_PS_DW4_POSOFFSET_NONE;
/* see brwCreateContext() */
- switch (dev->gen) {
+ switch (ilo_dev_gen(dev)) {
case ILO_GEN(7.5):
max_threads = (dev->gt == 3) ? 408 : (dev->gt == 2) ? 204 : 102;
dw4 |= (max_threads - 1) << GEN75_PS_DW4_MAX_THREADS__SHIFT;
dw[6] = 0;
dw[7] = 0;
- if (dev->gen >= ILO_GEN(7.5)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7.5)) {
dw[7] |= GEN_SHIFT32(GEN75_SCS_RED, GEN75_SURFACE_DW7_SCS_R) |
GEN_SHIFT32(GEN75_SCS_GREEN, GEN75_SURFACE_DW7_SCS_G) |
GEN_SHIFT32(GEN75_SCS_BLUE, GEN75_SURFACE_DW7_SCS_B) |
dw[6] = 0;
dw[7] = 0;
- if (dev->gen >= ILO_GEN(7.5)) {
+ if (ilo_dev_gen(dev) >= ILO_GEN(7.5)) {
dw[7] |= GEN_SHIFT32(GEN75_SCS_RED, GEN75_SURFACE_DW7_SCS_R) |
GEN_SHIFT32(GEN75_SCS_GREEN, GEN75_SURFACE_DW7_SCS_G) |
GEN_SHIFT32(GEN75_SCS_BLUE, GEN75_SURFACE_DW7_SCS_B) |
dw4 = GEN7_PS_DW4_8_PIXEL_DISPATCH;
/* see brwCreateContext() */
- switch (builder->dev->gen) {
+ switch (ilo_dev_gen(builder->dev)) {
case ILO_GEN(7.5):
max_threads = (builder->dev->gt == 3) ? 408 :
(builder->dev->gt == 2) ? 204 : 102;
switch (subop) {
case GEN7_RENDER_OPCODE_3DSTATE_URB_VS:
- switch (builder->dev->gen) {
+ switch (ilo_dev_gen(builder->dev)) {
case ILO_GEN(7.5):
max_entries = (builder->dev->gt >= 2) ? 1664 : 640;
min_entries = (builder->dev->gt >= 2) ? 64 : 32;
assert(num_entries >= 138);
break;
case GEN7_RENDER_OPCODE_3DSTATE_URB_GS:
- switch (builder->dev->gen) {
+ switch (ilo_dev_gen(builder->dev)) {
case ILO_GEN(7.5):
max_entries = (builder->dev->gt >= 2) ? 640 : 256;
break;
* QPitch by 4.
*/
layout->layer_height = params->h0 + params->h1 +
- ((params->dev->gen >= ILO_GEN(7)) ? 12 : 11) * layout->align_j;
+ ((ilo_dev_gen(params->dev) >= ILO_GEN(7)) ? 12 : 11) * layout->align_j;
- if (params->dev->gen == ILO_GEN(6) && templ->nr_samples > 1 &&
+ if (ilo_dev_gen(params->dev) == ILO_GEN(6) && templ->nr_samples > 1 &&
layout->height0 % 4 == 1)
layout->layer_height += 4;
layout->align_i = layout->block_width;
layout->align_j = layout->block_height;
} else if (templ->bind & PIPE_BIND_DEPTH_STENCIL) {
- if (params->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(params->dev) >= ILO_GEN(7)) {
switch (layout->format) {
case PIPE_FORMAT_Z16_UNORM:
layout->align_i = 8;
}
} else {
const bool valign_4 = (templ->nr_samples > 1) ||
- (params->dev->gen >= ILO_GEN(7) &&
+ (ilo_dev_gen(params->dev) >= ILO_GEN(7) &&
layout->tiling == INTEL_TILING_Y &&
(templ->bind & PIPE_BIND_RENDER_TARGET));
*
* "VALIGN_4 is not supported for surface format R32G32B32_FLOAT."
*/
- if (params->dev->gen >= ILO_GEN(7) && layout->block_size == 12)
+ if (ilo_dev_gen(params->dev) >= ILO_GEN(7) && layout->block_size == 12)
valid_tilings &= ~LAYOUT_TILING_Y;
}
layout_init_walk(struct ilo_layout *layout,
struct ilo_layout_params *params)
{
- if (params->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(params->dev) >= ILO_GEN(7))
layout_init_walk_gen7(layout, params);
else
layout_init_walk_gen6(layout, params);
* GEN7+ requires separate stencil buffers.
*/
if (templ->bind & PIPE_BIND_DEPTH_STENCIL) {
- if (params->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(params->dev) >= ILO_GEN(7))
require_separate_stencil = true;
else
require_separate_stencil = (layout->aux == ILO_LAYOUT_AUX_HIZ);
bool want_mcs = false;
/* MCS is for RT on GEN7+ */
- if (params->dev->gen < ILO_GEN(7))
+ if (ilo_dev_gen(params->dev) < ILO_GEN(7))
return false;
if (templ->target != PIPE_TEXTURE_2D ||
* format is PIPE_FORMAT_Z32_FLOAT_S8X24_UINT, enabling and disabling HiZ
* can result in incompatible formats.
*/
- if (params->dev->gen == ILO_GEN(6) &&
+ if (ilo_dev_gen(params->dev) == ILO_GEN(6) &&
templ->format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT &&
templ->last_level)
return false;
* at the bottom of the surface. This is in addition to the padding
* required above."
*/
- if (params->dev->gen >= ILO_GEN(7.5) &&
+ if (ilo_dev_gen(params->dev) >= ILO_GEN(7.5) &&
(params->templ->bind & PIPE_BIND_SAMPLER_VIEW) &&
layout->tiling == INTEL_TILING_NONE) {
layout->bo_height +=
*
* We will put all LODs in a single bo with ILO_LAYOUT_WALK_LOD.
*/
- if (params->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(params->dev) >= ILO_GEN(7))
hz_walk = layout->walk;
else
hz_walk = ILO_LAYOUT_WALK_LOD;
const unsigned h0 = align(params->h0, hz_align_j);
const unsigned h1 = align(params->h1, hz_align_j);
const unsigned htail =
- ((params->dev->gen >= ILO_GEN(7)) ? 12 : 11) * hz_align_j;
+ ((ilo_dev_gen(params->dev) >= ILO_GEN(7)) ? 12 : 11) * hz_align_j;
const unsigned hz_qpitch = h0 + h1 + htail;
hz_width = align(layout->lods[0].slice_width, 16);
hz_height = hz_qpitch * templ->array_size / 2;
- if (params->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(params->dev) >= ILO_GEN(7))
hz_height = align(hz_height, 8);
}
break;
case ILO_LAYOUT_AUX_HIZ:
if (!tex_create_hiz(tex)) {
/* Separate Stencil Buffer requires HiZ to be enabled */
- if (is->dev.gen == ILO_GEN(6) && tex->layout.separate_stencil)
+ if (ilo_dev_gen(&is->dev) == ILO_GEN(6) &&
+ tex->layout.separate_stencil)
return false;
}
break;
buf->bo_size = align(buf->bo_size, 256) + 16;
if ((templ->bind & PIPE_BIND_VERTEX_BUFFER) &&
- is->dev.gen < ILO_GEN(7.5)) {
+ ilo_dev_gen(&is->dev) < ILO_GEN(7.5)) {
/*
* As noted in ilo_translate_format(), we treat some 3-component formats
* as 4-component formats to work around hardware limitations. Imagine
* GEN6 8192x8192x512 2048x2048x2048
* GEN7 16384x16384x2048 2048x2048x2048
*/
- return (is->dev.gen >= ILO_GEN(7)) ? 15 : 14;
+ return (ilo_dev_gen(&is->dev) >= ILO_GEN(7)) ? 15 : 14;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return 12;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
- return (is->dev.gen >= ILO_GEN(7)) ? 15 : 14;
+ return (ilo_dev_gen(&is->dev) >= ILO_GEN(7)) ? 15 : 14;
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
return false;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
case PIPE_CAP_SM3:
return true;
case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
- if (is->dev.gen >= ILO_GEN(7) && !is->dev.has_gen7_sol_reset)
+ if (ilo_dev_gen(&is->dev) >= ILO_GEN(7) && !is->dev.has_gen7_sol_reset)
return 0;
return ILO_MAX_SO_BUFFERS;
case PIPE_CAP_PRIMITIVE_RESTART:
case PIPE_CAP_INDEP_BLEND_FUNC:
return true;
case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
- return (is->dev.gen >= ILO_GEN(7)) ? 2048 : 512;
+ return (ilo_dev_gen(&is->dev) >= ILO_GEN(7)) ? 2048 : 512;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
return ILO_MAX_SO_BINDINGS;
case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
- if (is->dev.gen >= ILO_GEN(7))
+ if (ilo_dev_gen(&is->dev) >= ILO_GEN(7))
return is->dev.has_gen7_sol_reset;
else
return false; /* TODO */
*/
if (gen_is_hsw(info->devid)) {
- dev->gen = ILO_GEN(7.5);
+ dev->gen_opaque = ILO_GEN(7.5);
dev->gt = gen_get_hsw_gt(info->devid);
dev->urb_size = ((dev->gt == 3) ? 512 :
(dev->gt == 2) ? 256 : 128) * 1024;
}
else if (gen_is_ivb(info->devid) || gen_is_vlv(info->devid)) {
- dev->gen = ILO_GEN(7);
+ dev->gen_opaque = ILO_GEN(7);
dev->gt = (gen_is_ivb(info->devid)) ? gen_get_ivb_gt(info->devid) : 1;
dev->urb_size = ((dev->gt == 2) ? 256 : 128) * 1024;
}
else if (gen_is_snb(info->devid)) {
- dev->gen = ILO_GEN(6);
+ dev->gen_opaque = ILO_GEN(6);
dev->gt = gen_get_snb_gt(info->devid);
dev->urb_size = ((dev->gt == 2) ? 64 : 32) * 1024;
}
int dst_len, dst_slot;
/* we are constructing 3DSTATE_SBE here */
- assert(shader->info.dev->gen >= ILO_GEN(6) &&
- shader->info.dev->gen <= ILO_GEN(7.5));
+ assert(ilo_dev_gen(shader->info.dev) >= ILO_GEN(6) &&
+ ilo_dev_gen(shader->info.dev) <= ILO_GEN(7.5));
assert(kernel);
/* we may need to convert on the fly */
if (tex->separate_s8 || tex->layout.format == PIPE_FORMAT_S8_UINT) {
/* on GEN6, separate stencil is enabled only when HiZ is */
- if (is->dev.gen >= ILO_GEN(7) ||
+ if (ilo_dev_gen(&is->dev) >= ILO_GEN(7) ||
ilo_texture_can_enable_hiz(tex, transfer->level,
transfer->box.z, transfer->box.depth)) {
m = ILO_TRANSFER_MAP_SW_ZS;
fs_lower_opcode_tgsi_in(fcc, inst->dst, dim, idx);
break;
case TOY_OPCODE_TGSI_CONST:
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
fs_lower_opcode_tgsi_const_gen7(fcc, inst->dst, dim, inst->src[1]);
else
fs_lower_opcode_tgsi_const_gen6(fcc, inst->dst, dim, inst->src[1]);
msg_type = GEN7_MSG_SAMPLER_SAMPLE_D_C;
ref_or_si = coords[ref_pos];
- if (tc->dev->gen < ILO_GEN(7.5))
+ if (ilo_dev_gen(tc->dev) < ILO_GEN(7.5))
tc_fail(tc, "TXD with shadow sampler not supported");
}
else {
}
/* set up sampler parameters */
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
msg_len = fs_add_sampler_params_gen7(tc, msg_type, base_mrf, param_size,
coords, num_coords, bias_or_lod, ref_or_si, ddx, ddy, num_derivs);
}
fcc->num_grf_per_vrf =
(fcc->dispatch_mode == GEN6_WM_DW5_16_PIXEL_DISPATCH) ? 2 : 1;
- if (fcc->tc.dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(fcc->tc.dev) >= ILO_GEN(7)) {
fcc->last_free_grf -= 15;
fcc->first_free_mrf = fcc->last_free_grf + 1;
fcc->last_free_mrf = fcc->first_free_mrf + 14;
vs_lower_opcode_tgsi_in(vcc, inst->dst, dim, idx);
break;
case TOY_OPCODE_TGSI_CONST:
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
vs_lower_opcode_tgsi_const_gen7(vcc, inst->dst, dim, inst->src[1]);
else
vs_lower_opcode_tgsi_const_gen6(vcc, inst->dst, dim, inst->src[1]);
indirect_idx = tsrc_from(tmp);
}
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
vs_lower_opcode_tgsi_const_gen7(vcc, inst->dst, dim, indirect_idx);
else
vs_lower_opcode_tgsi_const_gen6(vcc, inst->dst, dim, indirect_idx);
assert(num_coords <= 3);
tc_MOV(tc, tdst_writemask(tdst_d(m[0]), coords_writemask), coords);
tc_MOV(tc, tdst_writemask(tdst_d(m[0]), TOY_WRITEMASK_W), bias_or_lod);
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
num_params = 4;
}
else {
msg_type = GEN7_MSG_SAMPLER_SAMPLE_D_C;
ref_or_si = tsrc_swizzle1(coords, ref_pos);
- if (tc->dev->gen < ILO_GEN(7.5))
+ if (ilo_dev_gen(tc->dev) < ILO_GEN(7.5))
tc_fail(tc, "TXD with shadow sampler not supported");
}
else {
inst = tc_MOV(tc, header, r0);
inst->mask_ctrl = GEN6_MASKCTRL_NOMASK;
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
inst = tc_OR(tc, tdst_offset(header, 0, 5),
tsrc_rect(tsrc_offset(r0, 0, 5), TOY_RECT_010),
tsrc_rect(tsrc_imm_ud(0xff00), TOY_RECT_010));
eot = false;
}
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
/* do not forget about the header */
msg_len = 1 + num_attrs;
}
vcc->num_grf_per_vrf = 1;
- if (vcc->tc.dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(vcc->tc.dev) >= ILO_GEN(7)) {
vcc->last_free_grf -= 15;
vcc->first_free_mrf = vcc->last_free_grf + 1;
vcc->last_free_mrf = vcc->first_free_mrf + 14;
if (!vs_setup(&vcc, state, variant))
return NULL;
- if (vcc.tc.dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(vcc.tc.dev) >= ILO_GEN(7)) {
need_gs = false;
}
else {
switch (inst->opcode) {
case GEN6_OPCODE_IF:
inst->has_jip = true;
- inst->has_uip = (inst->dev->gen >= ILO_GEN(7));
+ inst->has_uip = (ilo_dev_gen(inst->dev) >= ILO_GEN(7));
break;
case GEN6_OPCODE_BREAK:
case GEN6_OPCODE_CONT:
static bool
disasm_inst_jip_in_dw1_high_gen6(const struct disasm_inst *inst)
{
- return (inst->dev->gen == ILO_GEN(6) && inst->has_jip && !inst->has_uip);
+ return (ilo_dev_gen(inst->dev) == ILO_GEN(6) &&
+ inst->has_jip && !inst->has_uip);
}
static void
inst->src1.base.file = GEN_EXTRACT(dw1, GEN6_INST_SRC1_FILE);
inst->src1.base.type = GEN_EXTRACT(dw1, GEN6_INST_SRC1_TYPE);
- if (inst->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7))
inst->nib_ctrl = (bool) (dw1 & GEN7_INST_NIBCTRL);
if (disasm_inst_jip_in_dw1_high_gen6(inst)) {
{
int count, i;
- if (inst->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7))
inst->flag_reg = GEN_EXTRACT(dw2, GEN7_INST_FLAG_REG);
inst->flag_subreg = GEN_EXTRACT(dw2, GEN6_INST_FLAG_SUBREG);
inst->flag_subreg = GEN_EXTRACT(dw1, GEN6_3SRC_FLAG_SUBREG);
- if (inst->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) {
inst->nib_ctrl = (bool) (dw1 & GEN7_3SRC_NIBCTRL);
inst->flag_reg = GEN_EXTRACT(dw1, GEN7_3SRC_FLAG_REG);
{
int op, simd;
- if (inst->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) {
op = GEN_EXTRACT(mdesc, GEN7_MSG_SAMPLER_OP);
simd = GEN_EXTRACT(mdesc, GEN7_MSG_SAMPLER_SIMD);
} {
int offset;
bool interleaved, complete, allocate, used;
- if (inst->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) {
switch (GEN_EXTRACT(mdesc, GEN7_MSG_URB_OP)) {
case GEN7_MSG_URB_WRITE_HWORD: op = "write HWord"; break;
case GEN7_MSG_URB_WRITE_OWORD: op = "write OWord"; break;
const struct disasm_inst *inst,
uint32_t mdesc)
{
- const int op = (inst->dev->gen >= ILO_GEN(7)) ?
+ const int op = (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) ?
GEN_EXTRACT(mdesc, GEN7_MSG_DP_OP) : GEN_EXTRACT(mdesc, GEN6_MSG_DP_OP);
- const bool write_commit = (inst->dev->gen == ILO_GEN(6)) ?
+ const bool write_commit = (ilo_dev_gen(inst->dev) == ILO_GEN(6)) ?
(mdesc & GEN6_MSG_DP_SEND_WRITE_COMMIT) : 0;
disasm_printer_add(printer, " (%d, %d, %d, %d)",
const struct disasm_inst *inst,
uint32_t mdesc)
{
- const int op = (inst->dev->gen >= ILO_GEN(7)) ?
+ const int op = (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) ?
GEN_EXTRACT(mdesc, GEN7_MSG_DP_OP) : GEN_EXTRACT(mdesc, GEN6_MSG_DP_OP);
const char *str;
bool is_rt_write;
- if (inst->dev->gen >= ILO_GEN(7.5)) {
+ if (ilo_dev_gen(inst->dev) >= ILO_GEN(7.5)) {
switch (op) {
case GEN75_MSG_DP_RC_MEDIA_BLOCK_READ: str = "media block read"; break;
case GEN75_MSG_DP_RC_MEMORY_FENCE: str = "memory fence"; break;
}
is_rt_write = (op == GEN75_MSG_DP_RC_RT_WRITE);
- } else if (inst->dev->gen >= ILO_GEN(7)) {
+ } else if (ilo_dev_gen(inst->dev) >= ILO_GEN(7)) {
switch (op) {
case GEN7_MSG_DP_RC_MEDIA_BLOCK_READ: str = "media block read"; break;
case GEN7_MSG_DP_RC_TYPED_SURFACE_READ: str = "typed surface read"; break;
disasm_printer_add(printer, " %s%s%s%s", str,
(mdesc & GEN6_MSG_DP_SLOTGRP_HI) ? " Hi" : "",
(mdesc & GEN6_MSG_DP_RT_LAST) ? " LastRT" : "",
- (inst->dev->gen == ILO_GEN(6) &&
+ (ilo_dev_gen(inst->dev) == ILO_GEN(6) &&
(mdesc & GEN6_MSG_DP_SEND_WRITE_COMMIT)) ? " WriteCommit" : "");
}
assert(sampler_index < 16);
assert(binding_table_index < 256);
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
ctrl = simd_mode << 17 |
message_type << 12 |
sampler_index << 8 |
{
uint32_t ctrl;
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
assert(!send_write_commit_message);
assert((message_specific_control & 0x3f00) == message_specific_control);
const bool header_present = true;
uint32_t ctrl;
- assert(tc->dev->gen >= ILO_GEN(7));
+ assert(ilo_dev_gen(tc->dev) >= ILO_GEN(7));
assert(num_registers == 1 || num_registers == 2 || num_registers == 4);
ctrl = 1 << 18 |
const bool header_present = true;
uint32_t ctrl;
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
const bool per_slot_offset = false;
ctrl = per_slot_offset << 16 |
dist--;
}
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
inst->src[1] = tsrc_imm_w(dist * 2);
else
inst->dst = tdst_imm_w(dist * 2);
/* the following instruction */
jip = (dist + 1) * 2;
- if (tc->dev->gen == ILO_GEN(6)) {
+ if (ilo_dev_gen(tc->dev) == ILO_GEN(6)) {
uip = jip;
break;
}
dist++;
}
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
/* what should the type be? */
inst->dst.type = TOY_TYPE_D;
inst->src[0].type = TOY_TYPE_D;
if (!found)
dist = 1;
- if (tc->dev->gen >= ILO_GEN(7))
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
inst->src[1] = tsrc_imm_w(dist * 2);
else
inst->dst = tdst_imm_w(dist * 2);
}
else {
/* the following instruction */
- if (tc->dev->gen == ILO_GEN(6) && inst->opcode == GEN6_OPCODE_BREAK)
+ if (ilo_dev_gen(tc->dev) == ILO_GEN(6) &&
+ inst->opcode == GEN6_OPCODE_BREAK)
dist++;
uip = dist * 2;
*
* "INT DIV function does not support SIMD16."
*/
- if (tc->dev->gen < ILO_GEN(7) ||
+ if (ilo_dev_gen(tc->dev) < ILO_GEN(7) ||
inst->cond_modifier == GEN6_MATH_INT_DIV_QUOTIENT ||
inst->cond_modifier == GEN6_MATH_INT_DIV_REMAINDER) {
struct toy_inst *inst2;
}
break;
case GEN6_OPCODE_IF:
- if (tc->dev->gen >= ILO_GEN(7) &&
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7) &&
inst->cond_modifier != GEN6_COND_NONE) {
struct toy_inst *inst2;
}
/* MRF to GRF */
- if (tc->dev->gen >= ILO_GEN(7)) {
+ if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
for (i = 0; i < Elements(inst->src); i++) {
if (inst->src[i].file != TOY_FILE_MRF)
continue;