2006-08-09 20:14:05 +01:00
|
|
|
/*
|
|
|
|
Copyright (C) Intel Corp. 2006. All Rights Reserved.
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
Intel funded Tungsten Graphics to
|
2006-08-09 20:14:05 +01:00
|
|
|
develop this 3D driver.
|
2013-11-25 23:39:03 +00:00
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
a copy of this software and associated documentation files (the
|
|
|
|
"Software"), to deal in the Software without restriction, including
|
|
|
|
without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
the following conditions:
|
2013-11-25 23:39:03 +00:00
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
The above copyright notice and this permission notice (including the
|
|
|
|
next paragraph) shall be included in all copies or substantial
|
|
|
|
portions of the Software.
|
2013-11-25 23:39:03 +00:00
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
|
|
|
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2013-11-25 23:39:03 +00:00
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
**********************************************************************/
|
|
|
|
/*
|
|
|
|
* Authors:
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* Keith Whitwell <keithw@vmware.com>
|
2006-08-09 20:14:05 +01:00
|
|
|
*/
|
2013-11-25 23:39:03 +00:00
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
|
|
|
|
#ifndef BRW_EU_H
|
|
|
|
#define BRW_EU_H
|
|
|
|
|
2010-12-03 19:49:29 +00:00
|
|
|
#include <stdbool.h>
|
2018-04-08 18:13:08 +01:00
|
|
|
#include <stdio.h>
|
2014-06-08 05:24:41 +01:00
|
|
|
#include "brw_inst.h"
|
2020-08-10 17:09:10 +01:00
|
|
|
#include "brw_compiler.h"
|
2017-03-09 00:44:29 +00:00
|
|
|
#include "brw_eu_defines.h"
|
2022-06-29 22:25:19 +01:00
|
|
|
#include "brw_isa_info.h"
|
2012-11-09 22:00:15 +00:00
|
|
|
#include "brw_reg.h"
|
2017-11-16 19:43:51 +00:00
|
|
|
#include "brw_disasm_info.h"
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2021-12-07 06:41:19 +00:00
|
|
|
#include "util/bitset.h"
|
|
|
|
|
2012-04-27 15:40:34 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
#define BRW_EU_MAX_INSN_STACK 5
|
|
|
|
|
2018-05-29 22:37:35 +01:00
|
|
|
struct brw_insn_state {
|
|
|
|
/* One of BRW_EXECUTE_* */
|
|
|
|
unsigned exec_size:3;
|
|
|
|
|
|
|
|
/* Group in units of channels */
|
|
|
|
unsigned group:5;
|
|
|
|
|
2021-03-29 23:40:04 +01:00
|
|
|
/* Compression control on gfx4-5 */
|
2018-05-29 22:37:35 +01:00
|
|
|
bool compressed:1;
|
|
|
|
|
|
|
|
/* One of BRW_MASK_* */
|
|
|
|
unsigned mask_control:1;
|
|
|
|
|
2021-03-29 23:46:12 +01:00
|
|
|
/* Scheduling info for Gfx12+ */
|
2018-11-09 22:13:36 +00:00
|
|
|
struct tgl_swsb swsb;
|
|
|
|
|
2018-05-29 22:37:35 +01:00
|
|
|
bool saturate:1;
|
|
|
|
|
|
|
|
/* One of BRW_ALIGN_* */
|
|
|
|
unsigned access_mode:1;
|
|
|
|
|
|
|
|
/* One of BRW_PREDICATE_* */
|
|
|
|
enum brw_predicate predicate:4;
|
|
|
|
|
|
|
|
bool pred_inv:1;
|
|
|
|
|
|
|
|
/* Flag subreg. Bottom bit is subreg, top bit is reg */
|
|
|
|
unsigned flag_subreg:2;
|
|
|
|
|
|
|
|
bool acc_wr_control:1;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-05-28 07:27:01 +01:00
|
|
|
/* A helper for accessing the last instruction emitted. This makes it easy
|
|
|
|
* to set various bits on an instruction without having to create temporary
|
|
|
|
* variable and assign the emitted instruction to those.
|
|
|
|
*/
|
|
|
|
#define brw_last_inst (&p->store[p->nr_insn - 1])
|
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
struct brw_codegen {
|
2014-06-13 22:29:25 +01:00
|
|
|
brw_inst *store;
|
2011-12-21 07:38:44 +00:00
|
|
|
int store_size;
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned nr_insn;
|
2012-02-03 10:50:42 +00:00
|
|
|
unsigned int next_insn_offset;
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2011-05-16 19:49:57 +01:00
|
|
|
void *mem_ctx;
|
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
/* Allow clients to push/pop instruction state:
|
|
|
|
*/
|
2018-05-29 22:37:35 +01:00
|
|
|
struct brw_insn_state stack[BRW_EU_MAX_INSN_STACK];
|
|
|
|
struct brw_insn_state *current;
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2017-08-31 17:41:22 +01:00
|
|
|
/** Whether or not the user wants automatic exec sizes
|
|
|
|
*
|
|
|
|
* If true, codegen will try to automatically infer the exec size of an
|
|
|
|
* instruction from the width of the destination register. If false, it
|
|
|
|
* will take whatever is set by brw_set_default_exec_size verbatim.
|
|
|
|
*
|
|
|
|
* This is set to true by default in brw_init_codegen.
|
|
|
|
*/
|
|
|
|
bool automatic_exec_sizes;
|
|
|
|
|
2011-10-07 20:26:50 +01:00
|
|
|
bool single_program_flow;
|
2022-06-29 22:13:31 +01:00
|
|
|
const struct brw_isa_info *isa;
|
2021-04-05 21:19:39 +01:00
|
|
|
const struct intel_device_info *devinfo;
|
2009-02-14 00:17:52 +00:00
|
|
|
|
2011-05-16 20:25:18 +01:00
|
|
|
/* Control flow stacks:
|
|
|
|
* - if_stack contains IF and ELSE instructions which must be patched
|
|
|
|
* (and popped) once the matching ENDIF instruction is encountered.
|
2011-12-21 06:51:59 +00:00
|
|
|
*
|
|
|
|
* Just store the instruction pointer(an index).
|
2011-05-16 20:25:18 +01:00
|
|
|
*/
|
2011-12-21 06:51:59 +00:00
|
|
|
int *if_stack;
|
2011-05-16 20:25:18 +01:00
|
|
|
int if_stack_depth;
|
|
|
|
int if_stack_array_size;
|
|
|
|
|
2011-12-06 20:13:32 +00:00
|
|
|
/**
|
|
|
|
* loop_stack contains the instruction pointers of the starts of loops which
|
|
|
|
* must be patched (and popped) once the matching WHILE instruction is
|
|
|
|
* encountered.
|
|
|
|
*/
|
|
|
|
int *loop_stack;
|
2011-12-06 20:44:41 +00:00
|
|
|
/**
|
2021-03-29 23:40:04 +01:00
|
|
|
* pre-gfx6, the BREAK and CONT instructions had to tell how many IF/ENDIF
|
2011-12-06 20:44:41 +00:00
|
|
|
* blocks they were popping out of, to fix up the mask stack. This tracks
|
|
|
|
* the IF/ENDIF nesting in each current nested loop level.
|
|
|
|
*/
|
|
|
|
int *if_depth_in_loop;
|
2011-12-06 20:13:32 +00:00
|
|
|
int loop_stack_depth;
|
|
|
|
int loop_stack_array_size;
|
2020-08-08 18:55:29 +01:00
|
|
|
|
|
|
|
struct brw_shader_reloc *relocs;
|
|
|
|
int num_relocs;
|
|
|
|
int reloc_array_size;
|
2006-08-09 20:14:05 +01:00
|
|
|
};
|
|
|
|
|
2019-06-03 10:10:09 +01:00
|
|
|
struct brw_label {
|
|
|
|
int offset;
|
|
|
|
int number;
|
|
|
|
struct brw_label *next;
|
|
|
|
};
|
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_pop_insn_state( struct brw_codegen *p );
|
|
|
|
void brw_push_insn_state( struct brw_codegen *p );
|
2018-05-29 22:50:46 +01:00
|
|
|
unsigned brw_get_default_exec_size(struct brw_codegen *p);
|
|
|
|
unsigned brw_get_default_group(struct brw_codegen *p);
|
|
|
|
unsigned brw_get_default_access_mode(struct brw_codegen *p);
|
2018-11-09 22:13:36 +00:00
|
|
|
struct tgl_swsb brw_get_default_swsb(struct brw_codegen *p);
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_set_default_exec_size(struct brw_codegen *p, unsigned value);
|
|
|
|
void brw_set_default_mask_control( struct brw_codegen *p, unsigned value );
|
|
|
|
void brw_set_default_saturate( struct brw_codegen *p, bool enable );
|
|
|
|
void brw_set_default_access_mode( struct brw_codegen *p, unsigned access_mode );
|
2021-04-05 21:19:39 +01:00
|
|
|
void brw_inst_set_compression(const struct intel_device_info *devinfo,
|
2016-05-18 23:29:07 +01:00
|
|
|
brw_inst *inst, bool on);
|
|
|
|
void brw_set_default_compression(struct brw_codegen *p, bool on);
|
2021-04-05 21:19:39 +01:00
|
|
|
void brw_inst_set_group(const struct intel_device_info *devinfo,
|
2016-05-18 23:29:07 +01:00
|
|
|
brw_inst *inst, unsigned group);
|
|
|
|
void brw_set_default_group(struct brw_codegen *p, unsigned group);
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_set_default_compression_control(struct brw_codegen *p, enum brw_compression c);
|
2018-06-07 23:32:15 +01:00
|
|
|
void brw_set_default_predicate_control(struct brw_codegen *p, enum brw_predicate pc);
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_set_default_predicate_inverse(struct brw_codegen *p, bool predicate_inverse);
|
|
|
|
void brw_set_default_flag_reg(struct brw_codegen *p, int reg, int subreg);
|
|
|
|
void brw_set_default_acc_write_control(struct brw_codegen *p, unsigned value);
|
2018-11-09 22:13:36 +00:00
|
|
|
void brw_set_default_swsb(struct brw_codegen *p, struct tgl_swsb value);
|
2015-04-16 19:06:57 +01:00
|
|
|
|
2022-06-29 22:13:31 +01:00
|
|
|
void brw_init_codegen(const struct brw_isa_info *isa,
|
|
|
|
struct brw_codegen *p, void *mem_ctx);
|
2021-04-05 21:19:39 +01:00
|
|
|
bool brw_has_jip(const struct intel_device_info *devinfo, enum opcode opcode);
|
|
|
|
bool brw_has_uip(const struct intel_device_info *devinfo, enum opcode opcode);
|
2019-06-03 10:10:09 +01:00
|
|
|
const struct brw_label *brw_find_label(const struct brw_label *root, int offset);
|
|
|
|
void brw_create_label(struct brw_label **labels, int offset, void *mem_ctx);
|
2022-06-29 22:13:31 +01:00
|
|
|
int brw_disassemble_inst(FILE *file, const struct brw_isa_info *isa,
|
2019-06-03 12:55:23 +01:00
|
|
|
const struct brw_inst *inst, bool is_compacted,
|
|
|
|
int offset, const struct brw_label *root_label);
|
2021-04-13 04:17:16 +01:00
|
|
|
const struct
|
2022-06-29 22:13:31 +01:00
|
|
|
brw_label *brw_label_assembly(const struct brw_isa_info *isa,
|
2021-04-13 04:17:16 +01:00
|
|
|
const void *assembly, int start, int end,
|
|
|
|
void *mem_ctx);
|
2022-06-29 22:13:31 +01:00
|
|
|
void brw_disassemble_with_labels(const struct brw_isa_info *isa,
|
2019-06-03 12:55:23 +01:00
|
|
|
const void *assembly, int start, int end, FILE *out);
|
2022-06-29 22:13:31 +01:00
|
|
|
void brw_disassemble(const struct brw_isa_info *isa,
|
2019-06-03 12:55:23 +01:00
|
|
|
const void *assembly, int start, int end,
|
|
|
|
const struct brw_label *root_label, FILE *out);
|
2020-08-08 18:55:29 +01:00
|
|
|
const struct brw_shader_reloc *brw_get_shader_relocs(struct brw_codegen *p,
|
|
|
|
unsigned *num_relocs);
|
2015-04-16 19:06:57 +01:00
|
|
|
const unsigned *brw_get_program( struct brw_codegen *p, unsigned *sz );
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2019-05-23 17:05:23 +01:00
|
|
|
bool brw_try_override_assembly(struct brw_codegen *p, int start_offset,
|
|
|
|
const char *identifier);
|
|
|
|
|
2020-08-08 03:59:12 +01:00
|
|
|
void brw_realign(struct brw_codegen *p, unsigned align);
|
|
|
|
int brw_append_data(struct brw_codegen *p, void *data,
|
|
|
|
unsigned size, unsigned align);
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_inst *brw_next_insn(struct brw_codegen *p, unsigned opcode);
|
2020-09-04 18:09:11 +01:00
|
|
|
void brw_add_reloc(struct brw_codegen *p, uint32_t id,
|
|
|
|
enum brw_shader_reloc_type type,
|
|
|
|
uint32_t offset, uint32_t delta);
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_set_dest(struct brw_codegen *p, brw_inst *insn, struct brw_reg dest);
|
|
|
|
void brw_set_src0(struct brw_codegen *p, brw_inst *insn, struct brw_reg reg);
|
2011-08-07 21:16:06 +01:00
|
|
|
|
2021-03-29 23:40:04 +01:00
|
|
|
void gfx6_resolve_implied_move(struct brw_codegen *p,
|
2011-08-22 18:35:24 +01:00
|
|
|
struct brw_reg *src,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned msg_reg_nr);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
|
|
|
/* Helpers for regular instructions:
|
|
|
|
*/
|
2014-06-13 22:29:25 +01:00
|
|
|
#define ALU1(OP) \
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_inst *brw_##OP(struct brw_codegen *p, \
|
2014-06-13 22:29:25 +01:00
|
|
|
struct brw_reg dest, \
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg src0);
|
|
|
|
|
2014-06-13 22:29:25 +01:00
|
|
|
#define ALU2(OP) \
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_inst *brw_##OP(struct brw_codegen *p, \
|
2014-06-13 22:29:25 +01:00
|
|
|
struct brw_reg dest, \
|
|
|
|
struct brw_reg src0, \
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg src1);
|
|
|
|
|
2014-06-13 22:29:25 +01:00
|
|
|
#define ALU3(OP) \
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_inst *brw_##OP(struct brw_codegen *p, \
|
2014-06-13 22:29:25 +01:00
|
|
|
struct brw_reg dest, \
|
|
|
|
struct brw_reg src0, \
|
|
|
|
struct brw_reg src1, \
|
2010-03-22 17:05:42 +00:00
|
|
|
struct brw_reg src2);
|
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
ALU1(MOV)
|
|
|
|
ALU2(SEL)
|
|
|
|
ALU1(NOT)
|
|
|
|
ALU2(AND)
|
|
|
|
ALU2(OR)
|
|
|
|
ALU2(XOR)
|
|
|
|
ALU2(SHR)
|
|
|
|
ALU2(SHL)
|
2016-07-07 07:38:22 +01:00
|
|
|
ALU1(DIM)
|
2006-08-09 20:14:05 +01:00
|
|
|
ALU2(ASR)
|
2019-05-29 19:43:30 +01:00
|
|
|
ALU2(ROL)
|
|
|
|
ALU2(ROR)
|
2015-11-23 04:12:17 +00:00
|
|
|
ALU3(CSEL)
|
2013-01-09 19:35:47 +00:00
|
|
|
ALU1(F32TO16)
|
|
|
|
ALU1(F16TO32)
|
2006-08-09 20:14:05 +01:00
|
|
|
ALU2(ADD)
|
2020-06-06 06:40:26 +01:00
|
|
|
ALU3(ADD3)
|
2012-07-07 16:28:46 +01:00
|
|
|
ALU2(AVG)
|
2006-08-09 20:14:05 +01:00
|
|
|
ALU2(MUL)
|
|
|
|
ALU1(FRC)
|
|
|
|
ALU1(RNDD)
|
2020-01-16 19:17:14 +00:00
|
|
|
ALU1(RNDE)
|
2019-08-22 17:15:50 +01:00
|
|
|
ALU1(RNDU)
|
2020-01-16 19:17:14 +00:00
|
|
|
ALU1(RNDZ)
|
2006-08-09 20:14:05 +01:00
|
|
|
ALU2(MAC)
|
|
|
|
ALU2(MACH)
|
|
|
|
ALU1(LZD)
|
|
|
|
ALU2(DP4)
|
|
|
|
ALU2(DPH)
|
|
|
|
ALU2(DP3)
|
|
|
|
ALU2(DP2)
|
2021-02-24 02:46:53 +00:00
|
|
|
ALU3(DP4A)
|
2006-08-09 20:14:05 +01:00
|
|
|
ALU2(LINE)
|
2010-03-10 22:46:27 +00:00
|
|
|
ALU2(PLN)
|
2010-03-22 17:05:42 +00:00
|
|
|
ALU3(MAD)
|
2012-12-02 05:49:43 +00:00
|
|
|
ALU3(LRP)
|
2013-04-10 01:56:19 +01:00
|
|
|
ALU1(BFREV)
|
|
|
|
ALU3(BFE)
|
|
|
|
ALU2(BFI1)
|
|
|
|
ALU3(BFI2)
|
|
|
|
ALU1(FBH)
|
|
|
|
ALU1(FBL)
|
|
|
|
ALU1(CBIT)
|
2013-09-19 21:01:08 +01:00
|
|
|
ALU2(ADDC)
|
|
|
|
ALU2(SUBB)
|
2006-08-09 20:14:05 +01:00
|
|
|
|
|
|
|
#undef ALU1
|
|
|
|
#undef ALU2
|
2010-03-22 17:05:42 +00:00
|
|
|
#undef ALU3
|
2006-08-09 20:14:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Helpers for SEND instruction:
|
|
|
|
*/
|
2011-08-07 21:16:06 +01:00
|
|
|
|
2018-06-11 18:49:39 +01:00
|
|
|
/**
|
|
|
|
* Construct a message descriptor immediate with the specified common
|
|
|
|
* descriptor controls.
|
|
|
|
*/
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_message_desc(const struct intel_device_info *devinfo,
|
2018-06-11 18:49:39 +01:00
|
|
|
unsigned msg_length,
|
|
|
|
unsigned response_length,
|
|
|
|
bool header_present)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 5) {
|
2018-06-11 18:49:39 +01:00
|
|
|
return (SET_BITS(msg_length, 28, 25) |
|
|
|
|
SET_BITS(response_length, 24, 20) |
|
|
|
|
SET_BITS(header_present, 19, 19));
|
|
|
|
} else {
|
|
|
|
return (SET_BITS(msg_length, 23, 20) |
|
|
|
|
SET_BITS(response_length, 19, 16));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-17 00:45:46 +00:00
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_message_desc_mlen(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-17 00:45:46 +00:00
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 5)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 28, 25);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 23, 20);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_message_desc_rlen(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-17 00:45:46 +00:00
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 5)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 24, 20);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 19, 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool
|
2021-04-13 04:17:16 +01:00
|
|
|
brw_message_desc_header_present(ASSERTED
|
|
|
|
const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 5);
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 19, 19);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_message_ex_desc(UNUSED const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
unsigned ex_msg_length)
|
|
|
|
{
|
|
|
|
return SET_BITS(ex_msg_length, 9, 6);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_message_ex_desc_ex_mlen(UNUSED const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
uint32_t ex_desc)
|
|
|
|
{
|
|
|
|
return GET_BITS(ex_desc, 9, 6);
|
|
|
|
}
|
|
|
|
|
2019-08-09 03:16:32 +01:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_urb_desc(const struct intel_device_info *devinfo,
|
2019-08-09 03:16:32 +01:00
|
|
|
unsigned msg_type,
|
|
|
|
bool per_slot_offset_present,
|
|
|
|
bool channel_mask_present,
|
|
|
|
unsigned global_offset)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 8) {
|
2019-08-09 03:16:32 +01:00
|
|
|
return (SET_BITS(per_slot_offset_present, 17, 17) |
|
|
|
|
SET_BITS(channel_mask_present, 15, 15) |
|
|
|
|
SET_BITS(global_offset, 14, 4) |
|
|
|
|
SET_BITS(msg_type, 3, 0));
|
2021-03-29 22:41:58 +01:00
|
|
|
} else if (devinfo->ver >= 7) {
|
2019-08-09 03:16:32 +01:00
|
|
|
assert(!channel_mask_present);
|
|
|
|
return (SET_BITS(per_slot_offset_present, 16, 16) |
|
|
|
|
SET_BITS(global_offset, 13, 3) |
|
|
|
|
SET_BITS(msg_type, 3, 0));
|
|
|
|
} else {
|
|
|
|
unreachable("unhandled URB write generation");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-12 19:23:46 +01:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_urb_desc_msg_type(ASSERTED const struct intel_device_info *devinfo,
|
2019-09-12 19:23:46 +01:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 7);
|
2019-09-12 19:23:46 +01:00
|
|
|
return GET_BITS(desc, 3, 0);
|
|
|
|
}
|
|
|
|
|
2021-09-15 22:21:14 +01:00
|
|
|
static inline uint32_t
|
|
|
|
brw_urb_fence_desc(const struct intel_device_info *devinfo)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return brw_urb_desc(devinfo, GFX125_URB_OPCODE_FENCE, false, false, 0);
|
|
|
|
}
|
|
|
|
|
2018-06-02 23:15:15 +01:00
|
|
|
/**
|
|
|
|
* Construct a message descriptor immediate with the specified sampler
|
|
|
|
* function controls.
|
|
|
|
*/
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_sampler_desc(const struct intel_device_info *devinfo,
|
2018-06-02 23:15:15 +01:00
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned sampler,
|
|
|
|
unsigned msg_type,
|
|
|
|
unsigned simd_mode,
|
|
|
|
unsigned return_format)
|
|
|
|
{
|
|
|
|
const unsigned desc = (SET_BITS(binding_table_index, 7, 0) |
|
|
|
|
SET_BITS(sampler, 11, 8));
|
2020-07-08 01:40:49 +01:00
|
|
|
|
|
|
|
/* From the CHV Bspec: Shared Functions - Message Descriptor -
|
|
|
|
* Sampling Engine:
|
|
|
|
*
|
|
|
|
* SIMD Mode[2] 29 This field is the upper bit of the 3-bit
|
|
|
|
* SIMD Mode field.
|
|
|
|
*/
|
|
|
|
if (devinfo->ver >= 8)
|
|
|
|
return desc | SET_BITS(msg_type, 16, 12) |
|
|
|
|
SET_BITS(simd_mode & 0x3, 18, 17) |
|
|
|
|
SET_BITS(simd_mode >> 2, 29, 29) |
|
|
|
|
SET_BITS(return_format, 30, 30);
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 7)
|
2018-06-02 23:15:15 +01:00
|
|
|
return (desc | SET_BITS(msg_type, 16, 12) |
|
|
|
|
SET_BITS(simd_mode, 18, 17));
|
2021-03-29 22:41:58 +01:00
|
|
|
else if (devinfo->ver >= 5)
|
2018-06-02 23:15:15 +01:00
|
|
|
return (desc | SET_BITS(msg_type, 15, 12) |
|
|
|
|
SET_BITS(simd_mode, 17, 16));
|
2021-09-22 13:06:58 +01:00
|
|
|
else if (devinfo->verx10 >= 45)
|
2018-06-02 23:15:15 +01:00
|
|
|
return desc | SET_BITS(msg_type, 15, 12);
|
|
|
|
else
|
|
|
|
return (desc | SET_BITS(return_format, 13, 12) |
|
|
|
|
SET_BITS(msg_type, 15, 14));
|
|
|
|
}
|
2018-06-11 18:49:39 +01:00
|
|
|
|
2018-11-17 00:45:46 +00:00
|
|
|
static inline unsigned
|
2021-04-13 04:17:16 +01:00
|
|
|
brw_sampler_desc_binding_table_index(UNUSED
|
|
|
|
const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
return GET_BITS(desc, 7, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-13 04:17:16 +01:00
|
|
|
brw_sampler_desc_sampler(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
2018-11-17 00:45:46 +00:00
|
|
|
{
|
|
|
|
return GET_BITS(desc, 11, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_sampler_desc_msg_type(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-17 00:45:46 +00:00
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 7)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 16, 12);
|
2021-09-22 13:06:58 +01:00
|
|
|
else if (devinfo->verx10 >= 45)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 15, 12);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 15, 14);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-13 04:17:16 +01:00
|
|
|
brw_sampler_desc_simd_mode(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
2018-11-17 00:45:46 +00:00
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 5);
|
2021-09-22 00:16:51 +01:00
|
|
|
if (devinfo->ver >= 8)
|
|
|
|
return GET_BITS(desc, 18, 17) | GET_BITS(desc, 29, 29) << 2;
|
|
|
|
else if (devinfo->ver >= 7)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 18, 17);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 17, 16);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_sampler_desc_return_format(ASSERTED const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
2021-09-22 00:16:51 +01:00
|
|
|
assert(devinfo->verx10 == 40 || devinfo->ver >= 8);
|
|
|
|
if (devinfo->ver >= 8)
|
|
|
|
return GET_BITS(desc, 30, 30);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 13, 12);
|
2018-11-17 00:45:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a message descriptor for the dataport
|
|
|
|
*/
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_desc(const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned msg_type,
|
|
|
|
unsigned msg_control)
|
|
|
|
{
|
2021-03-29 23:40:04 +01:00
|
|
|
/* Prior to gfx6, things are too inconsistent; use the dp_read/write_desc
|
2018-11-17 00:45:46 +00:00
|
|
|
* helpers instead.
|
|
|
|
*/
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 6);
|
2018-11-17 00:45:46 +00:00
|
|
|
const unsigned desc = SET_BITS(binding_table_index, 7, 0);
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 8) {
|
2018-11-17 00:45:46 +00:00
|
|
|
return (desc | SET_BITS(msg_control, 13, 8) |
|
|
|
|
SET_BITS(msg_type, 18, 14));
|
2021-03-29 22:41:58 +01:00
|
|
|
} else if (devinfo->ver >= 7) {
|
2018-11-17 00:45:46 +00:00
|
|
|
return (desc | SET_BITS(msg_control, 13, 8) |
|
|
|
|
SET_BITS(msg_type, 17, 14));
|
|
|
|
} else {
|
|
|
|
return (desc | SET_BITS(msg_control, 12, 8) |
|
|
|
|
SET_BITS(msg_type, 16, 13));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_desc_binding_table_index(UNUSED const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
return GET_BITS(desc, 7, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_desc_msg_type(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-17 00:45:46 +00:00
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 6);
|
|
|
|
if (devinfo->ver >= 8)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 18, 14);
|
2021-03-29 22:41:58 +01:00
|
|
|
else if (devinfo->ver >= 7)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 17, 14);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 16, 13);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_desc_msg_control(const struct intel_device_info *devinfo, uint32_t desc)
|
2018-11-17 00:45:46 +00:00
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 6);
|
|
|
|
if (devinfo->ver >= 7)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 13, 8);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 12, 8);
|
|
|
|
}
|
|
|
|
|
2018-06-07 18:50:20 +01:00
|
|
|
/**
|
|
|
|
* Construct a message descriptor immediate with the specified dataport read
|
|
|
|
* function controls.
|
|
|
|
*/
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_read_desc(const struct intel_device_info *devinfo,
|
2018-06-07 18:50:20 +01:00
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned msg_control,
|
|
|
|
unsigned msg_type,
|
|
|
|
unsigned target_cache)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 6)
|
2018-11-17 00:45:46 +00:00
|
|
|
return brw_dp_desc(devinfo, binding_table_index, msg_type, msg_control);
|
2021-09-22 13:06:58 +01:00
|
|
|
else if (devinfo->verx10 >= 45)
|
2018-11-17 00:45:46 +00:00
|
|
|
return (SET_BITS(binding_table_index, 7, 0) |
|
|
|
|
SET_BITS(msg_control, 10, 8) |
|
2018-06-07 18:50:20 +01:00
|
|
|
SET_BITS(msg_type, 13, 11) |
|
|
|
|
SET_BITS(target_cache, 15, 14));
|
|
|
|
else
|
2018-11-17 00:45:46 +00:00
|
|
|
return (SET_BITS(binding_table_index, 7, 0) |
|
|
|
|
SET_BITS(msg_control, 11, 8) |
|
2018-06-07 18:50:20 +01:00
|
|
|
SET_BITS(msg_type, 13, 12) |
|
|
|
|
SET_BITS(target_cache, 15, 14));
|
|
|
|
}
|
|
|
|
|
2018-11-17 00:45:46 +00:00
|
|
|
static inline unsigned
|
2021-04-13 04:17:16 +01:00
|
|
|
brw_dp_read_desc_msg_type(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
2018-11-17 00:45:46 +00:00
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 6)
|
2018-11-17 00:45:46 +00:00
|
|
|
return brw_dp_desc_msg_type(devinfo, desc);
|
2021-09-22 13:06:58 +01:00
|
|
|
else if (devinfo->verx10 >= 45)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 13, 11);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 13, 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_read_desc_msg_control(const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 6)
|
2018-11-17 00:45:46 +00:00
|
|
|
return brw_dp_desc_msg_control(devinfo, desc);
|
2021-09-22 13:06:58 +01:00
|
|
|
else if (devinfo->verx10 >= 45)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 10, 8);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 11, 8);
|
|
|
|
}
|
|
|
|
|
2018-07-10 00:12:59 +01:00
|
|
|
/**
|
|
|
|
* Construct a message descriptor immediate with the specified dataport write
|
|
|
|
* function controls.
|
|
|
|
*/
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_write_desc(const struct intel_device_info *devinfo,
|
2018-07-10 00:12:59 +01:00
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned msg_control,
|
|
|
|
unsigned msg_type,
|
|
|
|
unsigned send_commit_msg)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver <= 6 || !send_commit_msg);
|
2021-02-04 09:49:29 +00:00
|
|
|
if (devinfo->ver >= 6) {
|
2018-11-17 00:45:46 +00:00
|
|
|
return brw_dp_desc(devinfo, binding_table_index, msg_type, msg_control) |
|
|
|
|
SET_BITS(send_commit_msg, 17, 17);
|
2021-02-04 09:49:29 +00:00
|
|
|
} else {
|
2018-11-17 00:45:46 +00:00
|
|
|
return (SET_BITS(binding_table_index, 7, 0) |
|
|
|
|
SET_BITS(msg_control, 11, 8) |
|
2018-07-10 00:12:59 +01:00
|
|
|
SET_BITS(msg_type, 14, 12) |
|
|
|
|
SET_BITS(send_commit_msg, 15, 15));
|
2021-02-04 09:49:29 +00:00
|
|
|
}
|
2018-07-10 00:12:59 +01:00
|
|
|
}
|
|
|
|
|
2018-11-17 00:45:46 +00:00
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_write_desc_msg_type(const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 6)
|
2018-11-17 00:45:46 +00:00
|
|
|
return brw_dp_desc_msg_type(devinfo, desc);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 14, 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_write_desc_msg_control(const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 6)
|
2018-11-17 00:45:46 +00:00
|
|
|
return brw_dp_desc_msg_control(devinfo, desc);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 11, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_write_desc_write_commit(const struct intel_device_info *devinfo,
|
2018-11-17 00:45:46 +00:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver <= 6);
|
|
|
|
if (devinfo->ver >= 6)
|
2018-11-17 00:45:46 +00:00
|
|
|
return GET_BITS(desc, 17, 17);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 15, 15);
|
|
|
|
}
|
|
|
|
|
2018-06-07 23:22:58 +01:00
|
|
|
/**
|
|
|
|
* Construct a message descriptor immediate with the specified dataport
|
|
|
|
* surface function controls.
|
|
|
|
*/
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_surface_desc(const struct intel_device_info *devinfo,
|
2018-06-07 23:22:58 +01:00
|
|
|
unsigned msg_type,
|
|
|
|
unsigned msg_control)
|
|
|
|
{
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 7);
|
2018-11-17 00:45:46 +00:00
|
|
|
/* We'll OR in the binding table index later */
|
|
|
|
return brw_dp_desc(devinfo, 0, msg_type, msg_control);
|
2018-06-07 23:22:58 +01:00
|
|
|
}
|
|
|
|
|
2018-10-29 21:09:30 +00:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_untyped_atomic_desc(const struct intel_device_info *devinfo,
|
2018-10-29 21:09:30 +00:00
|
|
|
unsigned exec_size, /**< 0 for SIMD4x2 */
|
|
|
|
unsigned atomic_op,
|
|
|
|
bool response_expected)
|
|
|
|
{
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
|
|
|
|
|
|
|
unsigned msg_type;
|
2021-05-14 17:04:46 +01:00
|
|
|
if (devinfo->verx10 >= 75) {
|
2018-10-29 21:09:30 +00:00
|
|
|
if (exec_size > 0) {
|
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP;
|
|
|
|
} else {
|
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP_SIMD4X2;
|
|
|
|
}
|
|
|
|
} else {
|
2021-03-29 23:16:59 +01:00
|
|
|
msg_type = GFX7_DATAPORT_DC_UNTYPED_ATOMIC_OP;
|
2018-10-29 21:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(atomic_op, 3, 0) |
|
|
|
|
SET_BITS(0 < exec_size && exec_size <= 8, 4, 4) |
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_untyped_atomic_float_desc(const struct intel_device_info *devinfo,
|
2018-10-29 21:09:30 +00:00
|
|
|
unsigned exec_size,
|
|
|
|
unsigned atomic_op,
|
|
|
|
bool response_expected)
|
|
|
|
{
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 9);
|
2018-10-29 21:09:30 +00:00
|
|
|
|
|
|
|
assert(exec_size > 0);
|
2021-03-29 23:16:59 +01:00
|
|
|
const unsigned msg_type = GFX9_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_FLOAT_OP;
|
2018-10-29 21:09:30 +00:00
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(atomic_op, 1, 0) |
|
|
|
|
SET_BITS(exec_size <= 8, 4, 4) |
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
brw_mdc_cmask(unsigned num_channels)
|
|
|
|
{
|
|
|
|
/* See also MDC_CMASK in the SKL PRM Vol 2d. */
|
|
|
|
return 0xf & (0xf << num_channels);
|
|
|
|
}
|
|
|
|
|
2020-07-29 00:10:25 +01:00
|
|
|
static inline unsigned
|
|
|
|
lsc_cmask(unsigned num_channels)
|
|
|
|
{
|
|
|
|
assert(num_channels > 0 && num_channels <= 4);
|
|
|
|
return BITSET_MASK(num_channels);
|
|
|
|
}
|
|
|
|
|
2018-10-29 21:09:30 +00:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_untyped_surface_rw_desc(const struct intel_device_info *devinfo,
|
2018-10-29 21:09:30 +00:00
|
|
|
unsigned exec_size, /**< 0 for SIMD4x2 */
|
|
|
|
unsigned num_channels,
|
|
|
|
bool write)
|
|
|
|
{
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
|
|
|
|
|
|
|
unsigned msg_type;
|
|
|
|
if (write) {
|
2021-05-14 17:04:46 +01:00
|
|
|
if (devinfo->verx10 >= 75) {
|
2018-10-29 21:09:30 +00:00
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_WRITE;
|
|
|
|
} else {
|
2021-03-29 23:16:59 +01:00
|
|
|
msg_type = GFX7_DATAPORT_DC_UNTYPED_SURFACE_WRITE;
|
2018-10-29 21:09:30 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Read */
|
2021-05-14 17:04:46 +01:00
|
|
|
if (devinfo->verx10 >= 75) {
|
2018-10-29 21:09:30 +00:00
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_READ;
|
|
|
|
} else {
|
2021-03-29 23:16:59 +01:00
|
|
|
msg_type = GFX7_DATAPORT_DC_UNTYPED_SURFACE_READ;
|
2018-10-29 21:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SIMD4x2 is only valid for read messages on IVB; use SIMD8 instead */
|
2021-05-14 17:04:46 +01:00
|
|
|
if (write && devinfo->verx10 == 70 && exec_size == 0)
|
2018-10-29 21:09:30 +00:00
|
|
|
exec_size = 8;
|
|
|
|
|
|
|
|
/* See also MDC_SM3 in the SKL PRM Vol 2d. */
|
|
|
|
const unsigned simd_mode = exec_size == 0 ? 0 : /* SIMD4x2 */
|
|
|
|
exec_size <= 8 ? 2 : 1;
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(brw_mdc_cmask(num_channels), 3, 0) |
|
|
|
|
SET_BITS(simd_mode, 5, 4);
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
brw_mdc_ds(unsigned bit_size)
|
|
|
|
{
|
|
|
|
switch (bit_size) {
|
|
|
|
case 8:
|
2021-03-29 23:16:59 +01:00
|
|
|
return GFX7_BYTE_SCATTERED_DATA_ELEMENT_BYTE;
|
2018-10-29 21:09:30 +00:00
|
|
|
case 16:
|
2021-03-29 23:16:59 +01:00
|
|
|
return GFX7_BYTE_SCATTERED_DATA_ELEMENT_WORD;
|
2018-10-29 21:09:30 +00:00
|
|
|
case 32:
|
2021-03-29 23:16:59 +01:00
|
|
|
return GFX7_BYTE_SCATTERED_DATA_ELEMENT_DWORD;
|
2018-10-29 21:09:30 +00:00
|
|
|
default:
|
|
|
|
unreachable("Unsupported bit_size for byte scattered messages");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_byte_scattered_rw_desc(const struct intel_device_info *devinfo,
|
2018-10-29 21:09:30 +00:00
|
|
|
unsigned exec_size,
|
|
|
|
unsigned bit_size,
|
|
|
|
bool write)
|
|
|
|
{
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
|
|
|
|
2021-05-14 17:04:46 +01:00
|
|
|
assert(devinfo->verx10 >= 75);
|
2018-10-29 21:09:30 +00:00
|
|
|
const unsigned msg_type =
|
|
|
|
write ? HSW_DATAPORT_DC_PORT0_BYTE_SCATTERED_WRITE :
|
|
|
|
HSW_DATAPORT_DC_PORT0_BYTE_SCATTERED_READ;
|
|
|
|
|
|
|
|
assert(exec_size > 0);
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(exec_size == 16, 0, 0) |
|
|
|
|
SET_BITS(brw_mdc_ds(bit_size), 3, 2);
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
}
|
|
|
|
|
2015-04-08 10:41:33 +01:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_dword_scattered_rw_desc(const struct intel_device_info *devinfo,
|
2015-04-08 10:41:33 +01:00
|
|
|
unsigned exec_size,
|
|
|
|
bool write)
|
|
|
|
{
|
|
|
|
assert(exec_size == 8 || exec_size == 16);
|
|
|
|
|
|
|
|
unsigned msg_type;
|
|
|
|
if (write) {
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 6) {
|
2021-03-29 23:16:59 +01:00
|
|
|
msg_type = GFX6_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE;
|
2015-04-08 10:41:33 +01:00
|
|
|
} else {
|
|
|
|
msg_type = BRW_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE;
|
|
|
|
}
|
|
|
|
} else {
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 7) {
|
2021-03-29 23:16:59 +01:00
|
|
|
msg_type = GFX7_DATAPORT_DC_DWORD_SCATTERED_READ;
|
2021-09-22 13:06:58 +01:00
|
|
|
} else if (devinfo->verx10 >= 45) {
|
2015-04-08 10:41:33 +01:00
|
|
|
msg_type = G45_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ;
|
|
|
|
} else {
|
|
|
|
msg_type = BRW_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(1, 1, 1) | /* Legacy SIMD Mode */
|
|
|
|
SET_BITS(exec_size == 16, 0, 0);
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
}
|
|
|
|
|
2020-10-29 21:20:39 +00:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_oword_block_rw_desc(const struct intel_device_info *devinfo,
|
2020-10-29 21:20:39 +00:00
|
|
|
bool align_16B,
|
|
|
|
unsigned num_dwords,
|
|
|
|
bool write)
|
|
|
|
{
|
|
|
|
/* Writes can only have addresses aligned by OWORDs (16 Bytes). */
|
|
|
|
assert(!write || align_16B);
|
|
|
|
|
|
|
|
const unsigned msg_type =
|
2021-03-29 23:16:59 +01:00
|
|
|
write ? GFX7_DATAPORT_DC_OWORD_BLOCK_WRITE :
|
|
|
|
align_16B ? GFX7_DATAPORT_DC_OWORD_BLOCK_READ :
|
|
|
|
GFX7_DATAPORT_DC_UNALIGNED_OWORD_BLOCK_READ;
|
2020-10-29 21:20:39 +00:00
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(BRW_DATAPORT_OWORD_BLOCK_DWORDS(num_dwords), 2, 0);
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
}
|
|
|
|
|
2018-11-14 23:13:57 +00:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_a64_untyped_surface_rw_desc(const struct intel_device_info *devinfo,
|
2018-11-14 23:13:57 +00:00
|
|
|
unsigned exec_size, /**< 0 for SIMD4x2 */
|
|
|
|
unsigned num_channels,
|
|
|
|
bool write)
|
|
|
|
{
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 8);
|
2018-11-14 23:13:57 +00:00
|
|
|
|
|
|
|
unsigned msg_type =
|
2021-03-29 23:16:59 +01:00
|
|
|
write ? GFX8_DATAPORT_DC_PORT1_A64_UNTYPED_SURFACE_WRITE :
|
|
|
|
GFX8_DATAPORT_DC_PORT1_A64_UNTYPED_SURFACE_READ;
|
2018-11-14 23:13:57 +00:00
|
|
|
|
|
|
|
/* See also MDC_SM3 in the SKL PRM Vol 2d. */
|
|
|
|
const unsigned simd_mode = exec_size == 0 ? 0 : /* SIMD4x2 */
|
|
|
|
exec_size <= 8 ? 2 : 1;
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(brw_mdc_cmask(num_channels), 3, 0) |
|
|
|
|
SET_BITS(simd_mode, 5, 4);
|
|
|
|
|
2021-03-29 23:16:59 +01:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-04-29 23:14:58 +01:00
|
|
|
msg_type, msg_control);
|
2018-11-14 23:13:57 +00:00
|
|
|
}
|
|
|
|
|
2020-10-05 22:43:41 +01:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_a64_oword_block_rw_desc(const struct intel_device_info *devinfo,
|
2020-10-05 22:43:41 +01:00
|
|
|
bool align_16B,
|
|
|
|
unsigned num_dwords,
|
|
|
|
bool write)
|
|
|
|
{
|
|
|
|
/* Writes can only have addresses aligned by OWORDs (16 Bytes). */
|
|
|
|
assert(!write || align_16B);
|
|
|
|
|
|
|
|
unsigned msg_type =
|
2021-03-29 23:16:59 +01:00
|
|
|
write ? GFX9_DATAPORT_DC_PORT1_A64_OWORD_BLOCK_WRITE :
|
|
|
|
GFX9_DATAPORT_DC_PORT1_A64_OWORD_BLOCK_READ;
|
2020-10-05 22:43:41 +01:00
|
|
|
|
|
|
|
unsigned msg_control =
|
|
|
|
SET_BITS(!align_16B, 4, 3) |
|
|
|
|
SET_BITS(BRW_DATAPORT_OWORD_BLOCK_DWORDS(num_dwords), 2, 0);
|
|
|
|
|
2021-03-29 23:16:59 +01:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-10-05 22:43:41 +01:00
|
|
|
msg_type, msg_control);
|
|
|
|
}
|
|
|
|
|
2018-11-14 23:13:57 +00:00
|
|
|
/**
|
|
|
|
* Calculate the data size (see MDC_A64_DS in the "Structures" volume of the
|
|
|
|
* Skylake PRM).
|
|
|
|
*/
|
|
|
|
static inline uint32_t
|
|
|
|
brw_mdc_a64_ds(unsigned elems)
|
|
|
|
{
|
|
|
|
switch (elems) {
|
|
|
|
case 1: return 0;
|
|
|
|
case 2: return 1;
|
|
|
|
case 4: return 2;
|
|
|
|
case 8: return 3;
|
|
|
|
default:
|
|
|
|
unreachable("Unsupported elmeent count for A64 scattered message");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_a64_byte_scattered_rw_desc(const struct intel_device_info *devinfo,
|
2018-11-14 23:13:57 +00:00
|
|
|
unsigned exec_size, /**< 0 for SIMD4x2 */
|
|
|
|
unsigned bit_size,
|
|
|
|
bool write)
|
|
|
|
{
|
|
|
|
assert(exec_size <= 8 || exec_size == 16);
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 8);
|
2018-11-14 23:13:57 +00:00
|
|
|
|
|
|
|
unsigned msg_type =
|
2021-03-29 23:16:59 +01:00
|
|
|
write ? GFX8_DATAPORT_DC_PORT1_A64_SCATTERED_WRITE :
|
|
|
|
GFX9_DATAPORT_DC_PORT1_A64_SCATTERED_READ;
|
2018-11-14 23:13:57 +00:00
|
|
|
|
|
|
|
const unsigned msg_control =
|
2021-03-29 23:16:59 +01:00
|
|
|
SET_BITS(GFX8_A64_SCATTERED_SUBTYPE_BYTE, 1, 0) |
|
2018-11-14 23:13:57 +00:00
|
|
|
SET_BITS(brw_mdc_a64_ds(bit_size / 8), 3, 2) |
|
|
|
|
SET_BITS(exec_size == 16, 4, 4);
|
|
|
|
|
2021-03-29 23:16:59 +01:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-04-29 23:14:58 +01:00
|
|
|
msg_type, msg_control);
|
2018-11-14 23:13:57 +00:00
|
|
|
}
|
|
|
|
|
2018-11-26 21:15:04 +00:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_a64_untyped_atomic_desc(const struct intel_device_info *devinfo,
|
2019-06-19 12:47:19 +01:00
|
|
|
ASSERTED unsigned exec_size, /**< 0 for SIMD4x2 */
|
2018-11-26 21:15:04 +00:00
|
|
|
unsigned bit_size,
|
|
|
|
unsigned atomic_op,
|
|
|
|
bool response_expected)
|
|
|
|
{
|
|
|
|
assert(exec_size == 8);
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 8);
|
2021-01-12 04:18:11 +00:00
|
|
|
assert(bit_size == 16 || bit_size == 32 || bit_size == 64);
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 12 || bit_size >= 32);
|
2018-11-26 21:15:04 +00:00
|
|
|
|
2021-01-12 04:18:11 +00:00
|
|
|
const unsigned msg_type = bit_size == 16 ?
|
2021-03-29 23:16:59 +01:00
|
|
|
GFX12_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_HALF_INT_OP :
|
|
|
|
GFX8_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_OP;
|
2018-11-26 21:15:04 +00:00
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(atomic_op, 3, 0) |
|
|
|
|
SET_BITS(bit_size == 64, 4, 4) |
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
2021-03-29 23:16:59 +01:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-04-29 23:14:58 +01:00
|
|
|
msg_type, msg_control);
|
2018-11-26 21:15:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_a64_untyped_atomic_float_desc(const struct intel_device_info *devinfo,
|
2019-06-19 12:47:19 +01:00
|
|
|
ASSERTED unsigned exec_size,
|
2021-01-12 04:18:11 +00:00
|
|
|
unsigned bit_size,
|
2018-11-26 21:15:04 +00:00
|
|
|
unsigned atomic_op,
|
|
|
|
bool response_expected)
|
|
|
|
{
|
|
|
|
assert(exec_size == 8);
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 9);
|
2021-01-12 04:18:11 +00:00
|
|
|
assert(bit_size == 16 || bit_size == 32);
|
2021-03-29 22:41:58 +01:00
|
|
|
assert(devinfo->ver >= 12 || bit_size == 32);
|
2018-11-26 21:15:04 +00:00
|
|
|
|
|
|
|
assert(exec_size > 0);
|
2021-01-12 04:18:11 +00:00
|
|
|
const unsigned msg_type = bit_size == 32 ?
|
2021-03-29 23:16:59 +01:00
|
|
|
GFX9_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_FLOAT_OP :
|
|
|
|
GFX12_DATAPORT_DC_PORT1_A64_UNTYPED_ATOMIC_HALF_FLOAT_OP;
|
2018-11-26 21:15:04 +00:00
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(atomic_op, 1, 0) |
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
2021-03-29 23:16:59 +01:00
|
|
|
return brw_dp_desc(devinfo, GFX8_BTI_STATELESS_NON_COHERENT,
|
2020-04-29 23:14:58 +01:00
|
|
|
msg_type, msg_control);
|
2018-11-26 21:15:04 +00:00
|
|
|
}
|
|
|
|
|
2018-10-29 21:09:30 +00:00
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_typed_atomic_desc(const struct intel_device_info *devinfo,
|
2018-10-29 21:09:30 +00:00
|
|
|
unsigned exec_size,
|
|
|
|
unsigned exec_group,
|
|
|
|
unsigned atomic_op,
|
|
|
|
bool response_expected)
|
|
|
|
{
|
|
|
|
assert(exec_size > 0 || exec_group == 0);
|
|
|
|
assert(exec_group % 8 == 0);
|
|
|
|
|
|
|
|
unsigned msg_type;
|
2021-05-14 17:04:46 +01:00
|
|
|
if (devinfo->verx10 >= 75) {
|
2018-10-29 21:09:30 +00:00
|
|
|
if (exec_size == 0) {
|
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP_SIMD4X2;
|
|
|
|
} else {
|
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* SIMD4x2 typed surface R/W messages only exist on HSW+ */
|
|
|
|
assert(exec_size > 0);
|
2021-03-29 23:16:59 +01:00
|
|
|
msg_type = GFX7_DATAPORT_RC_TYPED_ATOMIC_OP;
|
2018-10-29 21:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const bool high_sample_mask = (exec_group / 8) % 2 == 1;
|
|
|
|
|
|
|
|
const unsigned msg_control =
|
|
|
|
SET_BITS(atomic_op, 3, 0) |
|
|
|
|
SET_BITS(high_sample_mask, 4, 4) |
|
|
|
|
SET_BITS(response_expected, 5, 5);
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_dp_typed_surface_rw_desc(const struct intel_device_info *devinfo,
|
2018-10-29 21:09:30 +00:00
|
|
|
unsigned exec_size,
|
|
|
|
unsigned exec_group,
|
|
|
|
unsigned num_channels,
|
|
|
|
bool write)
|
|
|
|
{
|
|
|
|
assert(exec_size > 0 || exec_group == 0);
|
|
|
|
assert(exec_group % 8 == 0);
|
|
|
|
|
|
|
|
/* Typed surface reads and writes don't support SIMD16 */
|
|
|
|
assert(exec_size <= 8);
|
|
|
|
|
|
|
|
unsigned msg_type;
|
|
|
|
if (write) {
|
2021-05-14 17:04:46 +01:00
|
|
|
if (devinfo->verx10 >= 75) {
|
2018-10-29 21:09:30 +00:00
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_WRITE;
|
|
|
|
} else {
|
2021-03-29 23:16:59 +01:00
|
|
|
msg_type = GFX7_DATAPORT_RC_TYPED_SURFACE_WRITE;
|
2018-10-29 21:09:30 +00:00
|
|
|
}
|
|
|
|
} else {
|
2021-05-14 17:04:46 +01:00
|
|
|
if (devinfo->verx10 >= 75) {
|
2018-10-29 21:09:30 +00:00
|
|
|
msg_type = HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_READ;
|
|
|
|
} else {
|
2021-03-29 23:16:59 +01:00
|
|
|
msg_type = GFX7_DATAPORT_RC_TYPED_SURFACE_READ;
|
2018-10-29 21:09:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* See also MDC_SG3 in the SKL PRM Vol 2d. */
|
|
|
|
unsigned msg_control;
|
2021-05-14 17:04:46 +01:00
|
|
|
if (devinfo->verx10 >= 75) {
|
2018-10-29 21:09:30 +00:00
|
|
|
/* See also MDC_SG3 in the SKL PRM Vol 2d. */
|
|
|
|
const unsigned slot_group = exec_size == 0 ? 0 : /* SIMD4x2 */
|
|
|
|
1 + ((exec_group / 8) % 2);
|
|
|
|
|
|
|
|
msg_control =
|
|
|
|
SET_BITS(brw_mdc_cmask(num_channels), 3, 0) |
|
|
|
|
SET_BITS(slot_group, 5, 4);
|
|
|
|
} else {
|
|
|
|
/* SIMD4x2 typed surface R/W messages only exist on HSW+ */
|
|
|
|
assert(exec_size > 0);
|
|
|
|
const unsigned slot_group = ((exec_group / 8) % 2);
|
|
|
|
|
|
|
|
msg_control =
|
|
|
|
SET_BITS(brw_mdc_cmask(num_channels), 3, 0) |
|
|
|
|
SET_BITS(slot_group, 5, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
return brw_dp_surface_desc(devinfo, msg_type, msg_control);
|
|
|
|
}
|
|
|
|
|
2021-02-04 09:49:29 +00:00
|
|
|
static inline uint32_t
|
|
|
|
brw_fb_desc(const struct intel_device_info *devinfo,
|
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned msg_type,
|
|
|
|
unsigned msg_control)
|
|
|
|
{
|
|
|
|
/* Prior to gen6, things are too inconsistent; use the fb_(read|write)_desc
|
|
|
|
* helpers instead.
|
|
|
|
*/
|
|
|
|
assert(devinfo->ver >= 6);
|
|
|
|
const unsigned desc = SET_BITS(binding_table_index, 7, 0);
|
|
|
|
if (devinfo->ver >= 7) {
|
|
|
|
return (desc | SET_BITS(msg_control, 13, 8) |
|
|
|
|
SET_BITS(msg_type, 17, 14));
|
|
|
|
} else {
|
|
|
|
return (desc | SET_BITS(msg_control, 12, 8) |
|
|
|
|
SET_BITS(msg_type, 16, 13));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
brw_fb_desc_binding_table_index(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
return GET_BITS(desc, 7, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
brw_fb_desc_msg_control(const struct intel_device_info *devinfo, uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->ver >= 6);
|
|
|
|
if (devinfo->ver >= 7)
|
|
|
|
return GET_BITS(desc, 13, 8);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 12, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
brw_fb_desc_msg_type(const struct intel_device_info *devinfo, uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->ver >= 6);
|
|
|
|
if (devinfo->ver >= 7)
|
|
|
|
return GET_BITS(desc, 17, 14);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 16, 13);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
brw_fb_read_desc(const struct intel_device_info *devinfo,
|
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned msg_control,
|
|
|
|
unsigned exec_size,
|
|
|
|
bool per_sample)
|
|
|
|
{
|
|
|
|
assert(devinfo->ver >= 9);
|
2021-05-03 15:50:44 +01:00
|
|
|
assert(exec_size == 8 || exec_size == 16);
|
|
|
|
|
2021-02-04 09:49:29 +00:00
|
|
|
return brw_fb_desc(devinfo, binding_table_index,
|
|
|
|
GFX9_DATAPORT_RC_RENDER_TARGET_READ, msg_control) |
|
|
|
|
SET_BITS(per_sample, 13, 13) |
|
2021-05-03 15:50:44 +01:00
|
|
|
SET_BITS(exec_size == 8, 8, 8) /* Render Target Message Subtype */;
|
2021-02-04 09:49:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
brw_fb_write_desc(const struct intel_device_info *devinfo,
|
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned msg_control,
|
2020-10-22 11:23:06 +01:00
|
|
|
bool last_render_target,
|
|
|
|
bool coarse_write)
|
2021-02-04 09:49:29 +00:00
|
|
|
{
|
|
|
|
const unsigned msg_type =
|
|
|
|
devinfo->ver >= 6 ?
|
|
|
|
GFX6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE :
|
|
|
|
BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE;
|
|
|
|
|
2020-10-22 11:23:06 +01:00
|
|
|
assert(devinfo->ver >= 10 || !coarse_write);
|
|
|
|
|
2021-02-04 09:49:29 +00:00
|
|
|
if (devinfo->ver >= 6) {
|
|
|
|
return brw_fb_desc(devinfo, binding_table_index, msg_type, msg_control) |
|
2020-10-22 11:23:06 +01:00
|
|
|
SET_BITS(last_render_target, 12, 12) |
|
|
|
|
SET_BITS(coarse_write, 18, 18);
|
2021-02-04 09:49:29 +00:00
|
|
|
} else {
|
|
|
|
return (SET_BITS(binding_table_index, 7, 0) |
|
|
|
|
SET_BITS(msg_control, 11, 8) |
|
|
|
|
SET_BITS(last_render_target, 11, 11) |
|
|
|
|
SET_BITS(msg_type, 14, 12));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
brw_fb_write_desc_msg_type(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
if (devinfo->ver >= 6)
|
|
|
|
return brw_fb_desc_msg_type(devinfo, desc);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 14, 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
brw_fb_write_desc_msg_control(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
if (devinfo->ver >= 6)
|
|
|
|
return brw_fb_desc_msg_control(devinfo, desc);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 11, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
brw_fb_write_desc_last_render_target(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
if (devinfo->ver >= 6)
|
|
|
|
return GET_BITS(desc, 12, 12);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 11, 11);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
brw_fb_write_desc_write_commit(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->ver <= 6);
|
|
|
|
if (devinfo->ver >= 6)
|
|
|
|
return GET_BITS(desc, 17, 17);
|
|
|
|
else
|
|
|
|
return GET_BITS(desc, 15, 15);
|
|
|
|
}
|
|
|
|
|
2020-10-22 11:23:06 +01:00
|
|
|
static inline bool
|
|
|
|
brw_fb_write_desc_coarse_write(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->ver >= 10);
|
|
|
|
return GET_BITS(desc, 18, 18);
|
|
|
|
}
|
|
|
|
|
2020-07-29 00:10:25 +01:00
|
|
|
static inline bool
|
|
|
|
lsc_opcode_has_cmask(enum lsc_opcode opcode)
|
|
|
|
{
|
|
|
|
return opcode == LSC_OP_LOAD_CMASK || opcode == LSC_OP_STORE_CMASK;
|
|
|
|
}
|
|
|
|
|
2021-07-21 00:44:15 +01:00
|
|
|
static inline bool
|
|
|
|
lsc_opcode_has_transpose(enum lsc_opcode opcode)
|
|
|
|
{
|
|
|
|
return opcode == LSC_OP_LOAD || opcode == LSC_OP_STORE;
|
|
|
|
}
|
|
|
|
|
2020-07-29 00:10:25 +01:00
|
|
|
static inline uint32_t
|
|
|
|
lsc_data_size_bytes(enum lsc_data_size data_size)
|
|
|
|
{
|
|
|
|
switch (data_size) {
|
|
|
|
case LSC_DATA_SIZE_D8:
|
|
|
|
return 1;
|
|
|
|
case LSC_DATA_SIZE_D16:
|
|
|
|
return 2;
|
|
|
|
case LSC_DATA_SIZE_D32:
|
|
|
|
case LSC_DATA_SIZE_D8U32:
|
|
|
|
case LSC_DATA_SIZE_D16U32:
|
|
|
|
case LSC_DATA_SIZE_D16BF32:
|
|
|
|
return 4;
|
|
|
|
case LSC_DATA_SIZE_D64:
|
|
|
|
return 8;
|
|
|
|
default:
|
|
|
|
unreachable("Unsupported data payload size.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
lsc_addr_size_bytes(enum lsc_addr_size addr_size)
|
|
|
|
{
|
|
|
|
switch (addr_size) {
|
|
|
|
case LSC_ADDR_SIZE_A16: return 2;
|
|
|
|
case LSC_ADDR_SIZE_A32: return 4;
|
|
|
|
case LSC_ADDR_SIZE_A64: return 8;
|
|
|
|
default:
|
|
|
|
unreachable("Unsupported address size.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
lsc_vector_length(enum lsc_vect_size vect_size)
|
|
|
|
{
|
|
|
|
switch (vect_size) {
|
|
|
|
case LSC_VECT_SIZE_V1: return 1;
|
|
|
|
case LSC_VECT_SIZE_V2: return 2;
|
|
|
|
case LSC_VECT_SIZE_V3: return 3;
|
|
|
|
case LSC_VECT_SIZE_V4: return 4;
|
|
|
|
case LSC_VECT_SIZE_V8: return 8;
|
|
|
|
case LSC_VECT_SIZE_V16: return 16;
|
|
|
|
case LSC_VECT_SIZE_V32: return 32;
|
|
|
|
case LSC_VECT_SIZE_V64: return 64;
|
|
|
|
default:
|
|
|
|
unreachable("Unsupported size of vector");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline enum lsc_vect_size
|
|
|
|
lsc_vect_size(unsigned vect_size)
|
|
|
|
{
|
|
|
|
switch(vect_size) {
|
|
|
|
case 1: return LSC_VECT_SIZE_V1;
|
|
|
|
case 2: return LSC_VECT_SIZE_V2;
|
|
|
|
case 3: return LSC_VECT_SIZE_V3;
|
|
|
|
case 4: return LSC_VECT_SIZE_V4;
|
|
|
|
case 8: return LSC_VECT_SIZE_V8;
|
|
|
|
case 16: return LSC_VECT_SIZE_V16;
|
|
|
|
case 32: return LSC_VECT_SIZE_V32;
|
|
|
|
case 64: return LSC_VECT_SIZE_V64;
|
|
|
|
default:
|
|
|
|
unreachable("Unsupported vector size for dataport");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
lsc_msg_desc(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
enum lsc_opcode opcode, unsigned simd_size,
|
|
|
|
enum lsc_addr_surface_type addr_type,
|
|
|
|
enum lsc_addr_size addr_sz, unsigned num_coordinates,
|
|
|
|
enum lsc_data_size data_sz, unsigned num_channels,
|
|
|
|
bool transpose, unsigned cache_ctrl, bool has_dest)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
|
|
|
|
unsigned dest_length = !has_dest ? 0 :
|
|
|
|
DIV_ROUND_UP(lsc_data_size_bytes(data_sz) * num_channels * simd_size,
|
|
|
|
REG_SIZE);
|
|
|
|
|
|
|
|
unsigned src0_length =
|
|
|
|
DIV_ROUND_UP(lsc_addr_size_bytes(addr_sz) * num_coordinates * simd_size,
|
|
|
|
REG_SIZE);
|
|
|
|
|
2021-07-21 00:44:15 +01:00
|
|
|
assert(!transpose || lsc_opcode_has_transpose(opcode));
|
|
|
|
|
2020-07-29 00:10:25 +01:00
|
|
|
unsigned msg_desc =
|
|
|
|
SET_BITS(opcode, 5, 0) |
|
|
|
|
SET_BITS(addr_sz, 8, 7) |
|
|
|
|
SET_BITS(data_sz, 11, 9) |
|
|
|
|
SET_BITS(transpose, 15, 15) |
|
|
|
|
SET_BITS(cache_ctrl, 19, 17) |
|
|
|
|
SET_BITS(dest_length, 24, 20) |
|
|
|
|
SET_BITS(src0_length, 28, 25) |
|
|
|
|
SET_BITS(addr_type, 30, 29);
|
|
|
|
|
|
|
|
if (lsc_opcode_has_cmask(opcode))
|
|
|
|
msg_desc |= SET_BITS(lsc_cmask(num_channels), 15, 12);
|
|
|
|
else
|
|
|
|
msg_desc |= SET_BITS(lsc_vect_size(num_channels), 14, 12);
|
|
|
|
|
|
|
|
return msg_desc;
|
|
|
|
}
|
|
|
|
|
2021-02-12 21:20:44 +00:00
|
|
|
static inline enum lsc_opcode
|
|
|
|
lsc_msg_desc_opcode(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return (enum lsc_opcode) GET_BITS(desc, 5, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline enum lsc_addr_size
|
|
|
|
lsc_msg_desc_addr_size(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return (enum lsc_addr_size) GET_BITS(desc, 8, 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline enum lsc_data_size
|
|
|
|
lsc_msg_desc_data_size(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return (enum lsc_data_size) GET_BITS(desc, 11, 9);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline enum lsc_vect_size
|
|
|
|
lsc_msg_desc_vect_size(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
assert(!lsc_opcode_has_cmask(lsc_msg_desc_opcode(devinfo, desc)));
|
|
|
|
return (enum lsc_vect_size) GET_BITS(desc, 14, 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline enum lsc_cmask
|
|
|
|
lsc_msg_desc_cmask(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
assert(lsc_opcode_has_cmask(lsc_msg_desc_opcode(devinfo, desc)));
|
|
|
|
return (enum lsc_cmask) GET_BITS(desc, 15, 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
lsc_msg_desc_transpose(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return GET_BITS(desc, 15, 15);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
lsc_msg_desc_cache_ctrl(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return GET_BITS(desc, 19, 17);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
lsc_msg_desc_dest_len(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return GET_BITS(desc, 24, 20);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
lsc_msg_desc_src0_len(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return GET_BITS(desc, 28, 25);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline enum lsc_addr_surface_type
|
|
|
|
lsc_msg_desc_addr_type(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return (enum lsc_addr_surface_type) GET_BITS(desc, 30, 29);
|
|
|
|
}
|
|
|
|
|
2020-07-12 02:33:05 +01:00
|
|
|
static inline uint32_t
|
|
|
|
lsc_fence_msg_desc(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
enum lsc_fence_scope scope,
|
|
|
|
enum lsc_flush_type flush_type,
|
|
|
|
bool route_to_lsc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return SET_BITS(LSC_OP_FENCE, 5, 0) |
|
|
|
|
SET_BITS(LSC_ADDR_SIZE_A32, 8, 7) |
|
|
|
|
SET_BITS(scope, 11, 9) |
|
|
|
|
SET_BITS(flush_type, 14, 12) |
|
|
|
|
SET_BITS(route_to_lsc, 18, 18) |
|
|
|
|
SET_BITS(LSC_ADDR_SURFTYPE_FLAT, 30, 29);
|
|
|
|
}
|
|
|
|
|
2021-02-12 21:20:44 +00:00
|
|
|
static inline enum lsc_fence_scope
|
|
|
|
lsc_fence_msg_desc_scope(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return (enum lsc_fence_scope) GET_BITS(desc, 11, 9);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline enum lsc_flush_type
|
|
|
|
lsc_fence_msg_desc_flush_type(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return (enum lsc_flush_type) GET_BITS(desc, 14, 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline enum lsc_backup_fence_routing
|
|
|
|
lsc_fence_msg_desc_backup_routing(UNUSED const struct intel_device_info *devinfo,
|
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return (enum lsc_backup_fence_routing) GET_BITS(desc, 18, 18);
|
|
|
|
}
|
|
|
|
|
2020-07-29 00:10:25 +01:00
|
|
|
static inline uint32_t
|
|
|
|
lsc_bti_ex_desc(const struct intel_device_info *devinfo, unsigned bti)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return SET_BITS(bti, 31, 24) |
|
|
|
|
SET_BITS(0, 23, 12); /* base offset */
|
|
|
|
}
|
|
|
|
|
2021-02-12 21:20:44 +00:00
|
|
|
static inline unsigned
|
|
|
|
lsc_bti_ex_desc_base_offset(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t ex_desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return GET_BITS(ex_desc, 23, 12);
|
|
|
|
}
|
|
|
|
|
2020-07-29 00:10:25 +01:00
|
|
|
static inline unsigned
|
|
|
|
lsc_bti_ex_desc_index(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t ex_desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return GET_BITS(ex_desc, 31, 24);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
lsc_flat_ex_desc_base_offset(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t ex_desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return GET_BITS(ex_desc, 31, 12);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
lsc_bss_ex_desc(const struct intel_device_info *devinfo,
|
|
|
|
unsigned surface_state_index)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return SET_BITS(surface_state_index, 31, 6);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline unsigned
|
|
|
|
lsc_bss_ex_desc_index(const struct intel_device_info *devinfo,
|
|
|
|
uint32_t ex_desc)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_lsc);
|
|
|
|
return GET_BITS(ex_desc, 31, 6);
|
|
|
|
}
|
|
|
|
|
2020-10-21 20:46:50 +01:00
|
|
|
static inline uint32_t
|
|
|
|
brw_mdc_sm2(unsigned exec_size)
|
|
|
|
{
|
|
|
|
assert(exec_size == 8 || exec_size == 16);
|
|
|
|
return exec_size > 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
brw_mdc_sm2_exec_size(uint32_t sm2)
|
|
|
|
{
|
|
|
|
assert(sm2 <= 1);
|
|
|
|
return 8 << sm2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_btd_spawn_desc(ASSERTED const struct intel_device_info *devinfo,
|
2020-10-21 20:46:50 +01:00
|
|
|
unsigned exec_size, unsigned msg_type)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_ray_tracing);
|
|
|
|
|
|
|
|
return SET_BITS(0, 19, 19) | /* No header */
|
|
|
|
SET_BITS(msg_type, 17, 14) |
|
|
|
|
SET_BITS(brw_mdc_sm2(exec_size), 8, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_btd_spawn_msg_type(UNUSED const struct intel_device_info *devinfo,
|
2020-10-21 20:46:50 +01:00
|
|
|
uint32_t desc)
|
|
|
|
{
|
|
|
|
return GET_BITS(desc, 17, 14);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_btd_spawn_exec_size(UNUSED const struct intel_device_info *devinfo,
|
2020-10-21 20:46:50 +01:00
|
|
|
uint32_t desc)
|
2020-08-06 21:45:45 +01:00
|
|
|
{
|
|
|
|
return brw_mdc_sm2_exec_size(GET_BITS(desc, 8, 8));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_rt_trace_ray_desc(ASSERTED const struct intel_device_info *devinfo,
|
2020-08-06 21:45:45 +01:00
|
|
|
unsigned exec_size)
|
|
|
|
{
|
|
|
|
assert(devinfo->has_ray_tracing);
|
|
|
|
|
|
|
|
return SET_BITS(0, 19, 19) | /* No header */
|
|
|
|
SET_BITS(0, 17, 14) | /* Message type */
|
|
|
|
SET_BITS(brw_mdc_sm2(exec_size), 8, 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_rt_trace_ray_desc_exec_size(UNUSED const struct intel_device_info *devinfo,
|
2020-08-06 21:45:45 +01:00
|
|
|
uint32_t desc)
|
2020-10-21 20:46:50 +01:00
|
|
|
{
|
|
|
|
return brw_mdc_sm2_exec_size(GET_BITS(desc, 8, 8));
|
|
|
|
}
|
|
|
|
|
2018-07-10 00:16:16 +01:00
|
|
|
/**
|
|
|
|
* Construct a message descriptor immediate with the specified pixel
|
|
|
|
* interpolator function controls.
|
|
|
|
*/
|
|
|
|
static inline uint32_t
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_pixel_interp_desc(UNUSED const struct intel_device_info *devinfo,
|
2018-07-10 00:16:16 +01:00
|
|
|
unsigned msg_type,
|
|
|
|
bool noperspective,
|
2020-10-22 11:23:06 +01:00
|
|
|
bool coarse_pixel_rate,
|
2018-07-10 00:16:16 +01:00
|
|
|
unsigned simd_mode,
|
|
|
|
unsigned slot_group)
|
|
|
|
{
|
2020-10-22 11:23:06 +01:00
|
|
|
assert(devinfo->ver >= 10 || !coarse_pixel_rate);
|
2018-07-10 00:16:16 +01:00
|
|
|
return (SET_BITS(slot_group, 11, 11) |
|
|
|
|
SET_BITS(msg_type, 13, 12) |
|
|
|
|
SET_BITS(!!noperspective, 14, 14) |
|
2020-10-22 11:23:06 +01:00
|
|
|
SET_BITS(coarse_pixel_rate, 15, 15) |
|
2018-07-10 00:16:16 +01:00
|
|
|
SET_BITS(simd_mode, 16, 16));
|
|
|
|
}
|
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_urb_WRITE(struct brw_codegen *p,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg dest,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned msg_reg_nr,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg src0,
|
i965: Allow C++ type safety in the use of enum brw_urb_write_flags.
(From a suggestion by Francisco Jerez)
If an enum represents a bitfield of flags, e.g.:
enum E {
A = 1,
B = 2,
C = 4,
D = 8,
};
then C++ normally prohibits statements like this:
enum E x = A | B;
because A and B are implicitly converted to ints before OR-ing them,
and an int can't be stored in an enum without a type cast. C, on the
other hand, allows an int to be implicitly converted to an enum
without casting.
In the past we've dealt with this situation by storing flag bitfields
as ints. This avoids ugly casting at the expense of some type safety
that C++ would normally have offered (e.g. we get no warning if we
accidentally use the wrong enum type).
However, we can get the best of both worlds if we override the |
operator. The ugly casting is confined to the operator overload, and
we still get the benefit of C++ making sure we don't use the wrong
enum type.
v2: Remove unnecessary comment and unnecessary use of "enum" keyword.
Use static_cast.
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2013-08-23 21:19:19 +01:00
|
|
|
enum brw_urb_write_flags flags,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned msg_length,
|
|
|
|
unsigned response_length,
|
|
|
|
unsigned offset,
|
|
|
|
unsigned swizzle);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
i965: Factor out logic to build a send message instruction with indirect descriptor.
This is going to be useful because the Gen7+ uniform and varying pull
constant, texturing, typed and untyped surface read, write, and atomic
generation code on the vec4 and fs back-end all require the same logic
to handle conditionally indirect surface indices. In pseudocode:
| if (surface.file == BRW_IMMEDIATE_VALUE) {
| inst = brw_SEND(p, dst, payload);
| set_descriptor_control_bits(inst, surface, ...);
| } else {
| inst = brw_OR(p, addr, surface, 0);
| set_descriptor_control_bits(inst, ...);
| inst = brw_SEND(p, dst, payload);
| set_indirect_send_descriptor(inst, addr);
| }
This patch abstracts out this frequently recurring pattern so we can
now write:
| inst = brw_send_indirect_message(p, sfid, dst, payload, surface)
| set_descriptor_control_bits(inst, ...);
without worrying about handling the immediate and indirect surface
index cases explicitly.
v2: Rebase. Improve documentatation and commit message. (Topi)
Preserve UW destination type cargo-cult. (Topi, Ken, Matt)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-03-19 13:44:24 +00:00
|
|
|
/**
|
|
|
|
* Send message to shared unit \p sfid with a possibly indirect descriptor \p
|
|
|
|
* desc. If \p desc is not an immediate it will be transparently loaded to an
|
2018-06-02 23:08:18 +01:00
|
|
|
* address register using an OR instruction.
|
i965: Factor out logic to build a send message instruction with indirect descriptor.
This is going to be useful because the Gen7+ uniform and varying pull
constant, texturing, typed and untyped surface read, write, and atomic
generation code on the vec4 and fs back-end all require the same logic
to handle conditionally indirect surface indices. In pseudocode:
| if (surface.file == BRW_IMMEDIATE_VALUE) {
| inst = brw_SEND(p, dst, payload);
| set_descriptor_control_bits(inst, surface, ...);
| } else {
| inst = brw_OR(p, addr, surface, 0);
| set_descriptor_control_bits(inst, ...);
| inst = brw_SEND(p, dst, payload);
| set_indirect_send_descriptor(inst, addr);
| }
This patch abstracts out this frequently recurring pattern so we can
now write:
| inst = brw_send_indirect_message(p, sfid, dst, payload, surface)
| set_descriptor_control_bits(inst, ...);
without worrying about handling the immediate and indirect surface
index cases explicitly.
v2: Rebase. Improve documentatation and commit message. (Topi)
Preserve UW destination type cargo-cult. (Topi, Ken, Matt)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-03-19 13:44:24 +00:00
|
|
|
*/
|
2018-06-02 23:08:18 +01:00
|
|
|
void
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_send_indirect_message(struct brw_codegen *p,
|
i965: Factor out logic to build a send message instruction with indirect descriptor.
This is going to be useful because the Gen7+ uniform and varying pull
constant, texturing, typed and untyped surface read, write, and atomic
generation code on the vec4 and fs back-end all require the same logic
to handle conditionally indirect surface indices. In pseudocode:
| if (surface.file == BRW_IMMEDIATE_VALUE) {
| inst = brw_SEND(p, dst, payload);
| set_descriptor_control_bits(inst, surface, ...);
| } else {
| inst = brw_OR(p, addr, surface, 0);
| set_descriptor_control_bits(inst, ...);
| inst = brw_SEND(p, dst, payload);
| set_indirect_send_descriptor(inst, addr);
| }
This patch abstracts out this frequently recurring pattern so we can
now write:
| inst = brw_send_indirect_message(p, sfid, dst, payload, surface)
| set_descriptor_control_bits(inst, ...);
without worrying about handling the immediate and indirect surface
index cases explicitly.
v2: Rebase. Improve documentatation and commit message. (Topi)
Preserve UW destination type cargo-cult. (Topi, Ken, Matt)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-03-19 13:44:24 +00:00
|
|
|
unsigned sfid,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg payload,
|
2018-06-02 23:07:31 +01:00
|
|
|
struct brw_reg desc,
|
2019-02-07 23:45:51 +00:00
|
|
|
unsigned desc_imm,
|
|
|
|
bool eot);
|
i965: Factor out logic to build a send message instruction with indirect descriptor.
This is going to be useful because the Gen7+ uniform and varying pull
constant, texturing, typed and untyped surface read, write, and atomic
generation code on the vec4 and fs back-end all require the same logic
to handle conditionally indirect surface indices. In pseudocode:
| if (surface.file == BRW_IMMEDIATE_VALUE) {
| inst = brw_SEND(p, dst, payload);
| set_descriptor_control_bits(inst, surface, ...);
| } else {
| inst = brw_OR(p, addr, surface, 0);
| set_descriptor_control_bits(inst, ...);
| inst = brw_SEND(p, dst, payload);
| set_indirect_send_descriptor(inst, addr);
| }
This patch abstracts out this frequently recurring pattern so we can
now write:
| inst = brw_send_indirect_message(p, sfid, dst, payload, surface)
| set_descriptor_control_bits(inst, ...);
without worrying about handling the immediate and indirect surface
index cases explicitly.
v2: Rebase. Improve documentatation and commit message. (Topi)
Preserve UW destination type cargo-cult. (Topi, Ken, Matt)
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-03-19 13:44:24 +00:00
|
|
|
|
2018-11-15 21:17:06 +00:00
|
|
|
void
|
|
|
|
brw_send_indirect_split_message(struct brw_codegen *p,
|
|
|
|
unsigned sfid,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg payload0,
|
|
|
|
struct brw_reg payload1,
|
|
|
|
struct brw_reg desc,
|
|
|
|
unsigned desc_imm,
|
|
|
|
struct brw_reg ex_desc,
|
2019-02-07 23:45:51 +00:00
|
|
|
unsigned ex_desc_imm,
|
|
|
|
bool eot);
|
2018-11-15 21:17:06 +00:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_ff_sync(struct brw_codegen *p,
|
2009-07-13 03:48:43 +01:00
|
|
|
struct brw_reg dest,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned msg_reg_nr,
|
2009-07-13 03:48:43 +01:00
|
|
|
struct brw_reg src0,
|
2011-10-07 20:26:50 +01:00
|
|
|
bool allocate,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned response_length,
|
2011-10-07 20:26:50 +01:00
|
|
|
bool eot);
|
2009-07-13 03:48:43 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_svb_write(struct brw_codegen *p,
|
i965 gen6: Initial implementation of transform feedback.
This patch adds basic transform feedback capability for Gen6 hardware.
This consists of several related pieces of functionality:
(1) In gen6_sol.c, we set up binding table entries for use by
transform feedback. We use one binding table entry per transform
feedback varying (this allows us to avoid doing pointer arithmetic in
the shader, since we can set up the binding table entries with the
appropriate offsets and surface pitches to place each varying at the
correct address).
(2) In brw_context.c, we advertise the hardware capabilities, which
are as follows:
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 64
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 4
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 16
OpenGL 3.0 requires these values to be at least 64, 4, and 4,
respectively. The reason we advertise a larger value than required
for MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS is that we have already
set aside 64 binding table entries, so we might as well make them all
available in both separate attribs and interleaved modes.
(3) We set aside a single SVBI ("streamed vertex buffer index") for
use by transform feedback. The hardware supports four independent
SVBI's, but we only need one, since vertices are added to all
transform feedback buffers at the same rate. Note: at the moment this
index is reset to 0 only when the driver is initialized. It needs to
be reset to 0 whenever BeginTransformFeedback() is called, and
otherwise preserved.
(4) In brw_gs_emit.c and brw_gs.c, we modify the geometry shader
program to output transform feedback data as a side effect.
(5) In gen6_gs_state.c, we configure the geometry shader stage to
handle the SVBI pointer correctly.
Note: ordering of vertices is not yet correct for triangle strips
(alternate triangles are improperly oriented). This will be addressed
in a future patch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-28 14:55:01 +00:00
|
|
|
struct brw_reg dest,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned msg_reg_nr,
|
i965 gen6: Initial implementation of transform feedback.
This patch adds basic transform feedback capability for Gen6 hardware.
This consists of several related pieces of functionality:
(1) In gen6_sol.c, we set up binding table entries for use by
transform feedback. We use one binding table entry per transform
feedback varying (this allows us to avoid doing pointer arithmetic in
the shader, since we can set up the binding table entries with the
appropriate offsets and surface pitches to place each varying at the
correct address).
(2) In brw_context.c, we advertise the hardware capabilities, which
are as follows:
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 64
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 4
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 16
OpenGL 3.0 requires these values to be at least 64, 4, and 4,
respectively. The reason we advertise a larger value than required
for MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS is that we have already
set aside 64 binding table entries, so we might as well make them all
available in both separate attribs and interleaved modes.
(3) We set aside a single SVBI ("streamed vertex buffer index") for
use by transform feedback. The hardware supports four independent
SVBI's, but we only need one, since vertices are added to all
transform feedback buffers at the same rate. Note: at the moment this
index is reset to 0 only when the driver is initialized. It needs to
be reset to 0 whenever BeginTransformFeedback() is called, and
otherwise preserved.
(4) In brw_gs_emit.c and brw_gs.c, we modify the geometry shader
program to output transform feedback data as a side effect.
(5) In gen6_gs_state.c, we configure the geometry shader stage to
handle the SVBI pointer correctly.
Note: ordering of vertices is not yet correct for triangle strips
(alternate triangles are improperly oriented). This will be addressed
in a future patch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-28 14:55:01 +00:00
|
|
|
struct brw_reg src0,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned binding_table_index,
|
i965 gen6: Initial implementation of transform feedback.
This patch adds basic transform feedback capability for Gen6 hardware.
This consists of several related pieces of functionality:
(1) In gen6_sol.c, we set up binding table entries for use by
transform feedback. We use one binding table entry per transform
feedback varying (this allows us to avoid doing pointer arithmetic in
the shader, since we can set up the binding table entries with the
appropriate offsets and surface pitches to place each varying at the
correct address).
(2) In brw_context.c, we advertise the hardware capabilities, which
are as follows:
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 64
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 4
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 16
OpenGL 3.0 requires these values to be at least 64, 4, and 4,
respectively. The reason we advertise a larger value than required
for MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS is that we have already
set aside 64 binding table entries, so we might as well make them all
available in both separate attribs and interleaved modes.
(3) We set aside a single SVBI ("streamed vertex buffer index") for
use by transform feedback. The hardware supports four independent
SVBI's, but we only need one, since vertices are added to all
transform feedback buffers at the same rate. Note: at the moment this
index is reset to 0 only when the driver is initialized. It needs to
be reset to 0 whenever BeginTransformFeedback() is called, and
otherwise preserved.
(4) In brw_gs_emit.c and brw_gs.c, we modify the geometry shader
program to output transform feedback data as a side effect.
(5) In gen6_gs_state.c, we configure the geometry shader stage to
handle the SVBI pointer correctly.
Note: ordering of vertices is not yet correct for triangle strips
(alternate triangles are improperly oriented). This will be addressed
in a future patch.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2011-11-28 14:55:01 +00:00
|
|
|
bool send_commit_msg);
|
|
|
|
|
2017-01-13 22:16:12 +00:00
|
|
|
brw_inst *brw_fb_WRITE(struct brw_codegen *p,
|
|
|
|
struct brw_reg payload,
|
|
|
|
struct brw_reg implied_header,
|
|
|
|
unsigned msg_control,
|
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned msg_length,
|
|
|
|
unsigned response_length,
|
|
|
|
bool eot,
|
|
|
|
bool last_render_target,
|
|
|
|
bool header_present);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2021-03-29 23:40:04 +01:00
|
|
|
brw_inst *gfx9_fb_READ(struct brw_codegen *p,
|
2016-07-22 03:13:55 +01:00
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg payload,
|
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned msg_length,
|
|
|
|
unsigned response_length,
|
|
|
|
bool per_sample);
|
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_SAMPLE(struct brw_codegen *p,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg dest,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned msg_reg_nr,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg src0,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned binding_table_index,
|
|
|
|
unsigned sampler,
|
|
|
|
unsigned msg_type,
|
|
|
|
unsigned response_length,
|
|
|
|
unsigned msg_length,
|
|
|
|
unsigned header_present,
|
|
|
|
unsigned simd_mode,
|
|
|
|
unsigned return_format);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_adjust_sampler_state_pointer(struct brw_codegen *p,
|
2014-08-10 00:49:31 +01:00
|
|
|
struct brw_reg header,
|
2015-01-22 21:46:44 +00:00
|
|
|
struct brw_reg sampler_index);
|
2014-08-10 00:49:31 +01:00
|
|
|
|
2021-03-29 23:40:04 +01:00
|
|
|
void gfx4_math(struct brw_codegen *p,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg dest,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned function,
|
|
|
|
unsigned msg_reg_nr,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg src,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned precision );
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2021-03-29 23:40:04 +01:00
|
|
|
void gfx6_math(struct brw_codegen *p,
|
2010-08-22 09:33:57 +01:00
|
|
|
struct brw_reg dest,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned function,
|
2010-08-22 09:33:57 +01:00
|
|
|
struct brw_reg src0,
|
|
|
|
struct brw_reg src1);
|
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_oword_block_read(struct brw_codegen *p,
|
2010-10-19 17:25:51 +01:00
|
|
|
struct brw_reg dest,
|
|
|
|
struct brw_reg mrf,
|
2010-10-22 20:57:00 +01:00
|
|
|
uint32_t offset,
|
|
|
|
uint32_t bind_table_index);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-11-23 17:18:26 +00:00
|
|
|
unsigned brw_scratch_surface_idx(const struct brw_codegen *p);
|
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_oword_block_read_scratch(struct brw_codegen *p,
|
2010-10-22 20:57:00 +01:00
|
|
|
struct brw_reg dest,
|
|
|
|
struct brw_reg mrf,
|
|
|
|
int num_regs,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned offset);
|
2010-10-22 20:57:00 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_oword_block_write_scratch(struct brw_codegen *p,
|
2010-10-22 20:57:00 +01:00
|
|
|
struct brw_reg mrf,
|
|
|
|
int num_regs,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned offset);
|
2009-03-31 17:50:55 +01:00
|
|
|
|
2021-03-29 23:40:04 +01:00
|
|
|
void gfx7_block_read_scratch(struct brw_codegen *p,
|
2013-10-16 19:51:22 +01:00
|
|
|
struct brw_reg dest,
|
|
|
|
int num_regs,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned offset);
|
2013-10-16 19:51:22 +01:00
|
|
|
|
2014-06-30 16:00:25 +01:00
|
|
|
/**
|
|
|
|
* Return the generation-specific jump distance scaling factor.
|
|
|
|
*
|
|
|
|
* Given the number of instructions to jump, we need to scale by
|
|
|
|
* some number to obtain the actual jump distance to program in an
|
|
|
|
* instruction.
|
|
|
|
*/
|
|
|
|
static inline unsigned
|
2021-04-05 21:19:39 +01:00
|
|
|
brw_jump_scale(const struct intel_device_info *devinfo)
|
2014-06-30 16:00:25 +01:00
|
|
|
{
|
2014-07-03 23:01:58 +01:00
|
|
|
/* Broadwell measures jump targets in bytes. */
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 8)
|
2014-07-03 23:01:58 +01:00
|
|
|
return 16;
|
|
|
|
|
2014-06-30 16:00:25 +01:00
|
|
|
/* Ironlake and later measure jump targets in 64-bit data chunks (in order
|
|
|
|
* (to support compaction), so each 128-bit instruction requires 2 chunks.
|
|
|
|
*/
|
2021-03-29 22:41:58 +01:00
|
|
|
if (devinfo->ver >= 5)
|
2014-06-30 16:00:25 +01:00
|
|
|
return 2;
|
|
|
|
|
2021-03-29 23:46:12 +01:00
|
|
|
/* Gfx4 simply uses the number of 128-bit instructions. */
|
2014-06-30 16:00:25 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-11-05 02:11:37 +00:00
|
|
|
void brw_barrier(struct brw_codegen *p, struct brw_reg src);
|
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
/* If/else/endif. Works by manipulating the execution flags on each
|
|
|
|
* channel.
|
|
|
|
*/
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_inst *brw_IF(struct brw_codegen *p, unsigned execute_size);
|
2021-03-29 23:40:04 +01:00
|
|
|
brw_inst *gfx6_IF(struct brw_codegen *p, enum brw_conditional_mod conditional,
|
2014-06-13 22:29:25 +01:00
|
|
|
struct brw_reg src0, struct brw_reg src1);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_ELSE(struct brw_codegen *p);
|
|
|
|
void brw_ENDIF(struct brw_codegen *p);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
|
|
|
/* DO/WHILE loops:
|
|
|
|
*/
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_inst *brw_DO(struct brw_codegen *p, unsigned execute_size);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_inst *brw_WHILE(struct brw_codegen *p);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_inst *brw_BREAK(struct brw_codegen *p);
|
|
|
|
brw_inst *brw_CONT(struct brw_codegen *p);
|
2020-04-25 20:59:30 +01:00
|
|
|
brw_inst *brw_HALT(struct brw_codegen *p);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2014-06-05 14:03:07 +01:00
|
|
|
/* Forward jumps:
|
|
|
|
*/
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_land_fwd_jump(struct brw_codegen *p, int jmp_insn_idx);
|
2014-06-05 14:03:07 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_inst *brw_JMPI(struct brw_codegen *p, struct brw_reg index,
|
2014-06-13 22:29:25 +01:00
|
|
|
unsigned predicate_control);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_NOP(struct brw_codegen *p);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2014-11-05 02:05:04 +00:00
|
|
|
void brw_WAIT(struct brw_codegen *p);
|
|
|
|
|
2019-09-04 01:51:17 +01:00
|
|
|
void brw_SYNC(struct brw_codegen *p, enum tgl_sync_function func);
|
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
/* Special case: there is never a destination, execution size will be
|
|
|
|
* taken from src0:
|
|
|
|
*/
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_CMP(struct brw_codegen *p,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg dest,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned conditional,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg src0,
|
|
|
|
struct brw_reg src1);
|
|
|
|
|
2021-02-13 22:11:30 +00:00
|
|
|
void brw_CMPN(struct brw_codegen *p,
|
|
|
|
struct brw_reg dest,
|
|
|
|
unsigned conditional,
|
|
|
|
struct brw_reg src0,
|
|
|
|
struct brw_reg src1);
|
|
|
|
|
2013-09-11 22:01:50 +01:00
|
|
|
void
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_untyped_atomic(struct brw_codegen *p,
|
2015-04-23 12:21:31 +01:00
|
|
|
struct brw_reg dst,
|
2014-09-12 00:13:15 +01:00
|
|
|
struct brw_reg payload,
|
2015-04-23 12:21:31 +01:00
|
|
|
struct brw_reg surface,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned atomic_op,
|
|
|
|
unsigned msg_length,
|
2017-12-12 20:05:03 +00:00
|
|
|
bool response_expected,
|
|
|
|
bool header_present);
|
2013-09-11 22:01:50 +01:00
|
|
|
|
2013-09-11 22:03:13 +01:00
|
|
|
void
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_untyped_surface_read(struct brw_codegen *p,
|
2015-04-23 12:21:31 +01:00
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg payload,
|
|
|
|
struct brw_reg surface,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned msg_length,
|
2015-02-26 10:56:19 +00:00
|
|
|
unsigned num_channels);
|
2013-09-11 22:03:13 +01:00
|
|
|
|
2015-04-23 12:24:14 +01:00
|
|
|
void
|
|
|
|
brw_untyped_surface_write(struct brw_codegen *p,
|
|
|
|
struct brw_reg payload,
|
|
|
|
struct brw_reg surface,
|
|
|
|
unsigned msg_length,
|
2017-12-12 20:05:03 +00:00
|
|
|
unsigned num_channels,
|
|
|
|
bool header_present);
|
2015-04-23 12:24:14 +01:00
|
|
|
|
intel/fs,vec4: Pull stall logic for memory fences up into the IR
Instead of emitting the stall MOV "inside" the
SHADER_OPCODE_MEMORY_FENCE generation, use the scheduling fences when
creating the IR.
For IvyBridge, every (data cache) fence is accompained by a render
cache fence, that now is explicit in the IR, two
SHADER_OPCODE_MEMORY_FENCEs are emitted (with different SFIDs).
Because Begin and End interlock intrinsics are effectively memory
barriers, move its handling alongside the other memory barrier
intrinsics. The SHADER_OPCODE_INTERLOCK is still used to distinguish
if we are going to use a SENDC (for Begin) or regular SEND (for End).
This change is a preparation to allow emitting both SENDs in Gen11+
before we can stall on them.
Shader-db results for IVB (i965):
total instructions in shared programs: 11971190 -> 11971200 (<.01%)
instructions in affected programs: 11482 -> 11492 (0.09%)
helped: 0
HURT: 8
HURT stats (abs) min: 1 max: 3 x̄: 1.25 x̃: 1
HURT stats (rel) min: 0.03% max: 0.50% x̄: 0.14% x̃: 0.10%
95% mean confidence interval for instructions value: 0.66 1.84
95% mean confidence interval for instructions %-change: 0.01% 0.27%
Instructions are HURT.
Unlike the previous code, that used the `mov g1 g2` trick to force
both `g1` and `g2` to stall, the scheduling fence will generate `mov
null g1` and `mov null g2`. During review it was decided it was not
worth keeping the special codepath for the small effect will have.
Shader-db results for HSW (i965), BDW and SKL don't have a change
on instruction count, but do report changes in cycles count, showing
SKL results below
total cycles in shared programs: 341738444 -> 341710570 (<.01%)
cycles in affected programs: 7240002 -> 7212128 (-0.38%)
helped: 46
HURT: 5
helped stats (abs) min: 14 max: 1940 x̄: 676.22 x̃: 154
helped stats (rel) min: <.01% max: 2.62% x̄: 1.28% x̃: 0.95%
HURT stats (abs) min: 2 max: 1768 x̄: 646.40 x̃: 362
HURT stats (rel) min: <.01% max: 0.83% x̄: 0.28% x̃: 0.08%
95% mean confidence interval for cycles value: -777.71 -315.38
95% mean confidence interval for cycles %-change: -1.42% -0.83%
Cycles are helped.
This seems to be the effect of allocating two registers separatedly
instead of a single one with size 2, which causes different register
allocation, affecting the cycle estimates.
while ICL also has not change on instruction count but report changes
negative changes in cycles
total cycles in shared programs: 352665369 -> 352707484 (0.01%)
cycles in affected programs: 9608288 -> 9650403 (0.44%)
helped: 4
HURT: 104
helped stats (abs) min: 24 max: 128 x̄: 88.50 x̃: 101
helped stats (rel) min: <.01% max: 0.85% x̄: 0.46% x̃: 0.49%
HURT stats (abs) min: 2 max: 2016 x̄: 408.36 x̃: 48
HURT stats (rel) min: <.01% max: 3.31% x̄: 0.88% x̃: 0.45%
95% mean confidence interval for cycles value: 256.67 523.24
95% mean confidence interval for cycles %-change: 0.63% 1.03%
Cycles are HURT.
AFAICT this is the result of the case above.
Shader-db results for TGL have similar cycles result as ICL, but also
affect instructions
total instructions in shared programs: 17690586 -> 17690597 (<.01%)
instructions in affected programs: 64617 -> 64628 (0.02%)
helped: 55
HURT: 32
helped stats (abs) min: 1 max: 16 x̄: 4.13 x̃: 3
helped stats (rel) min: 0.05% max: 2.78% x̄: 0.86% x̃: 0.74%
HURT stats (abs) min: 1 max: 65 x̄: 7.44 x̃: 2
HURT stats (rel) min: 0.05% max: 4.58% x̄: 1.13% x̃: 0.69%
95% mean confidence interval for instructions value: -2.03 2.28
95% mean confidence interval for instructions %-change: -0.41% 0.15%
Inconclusive result (value mean confidence interval includes 0).
Now that more is done in the IR, more dependencies are visible and
more SWSB annotations are emitted. Mixed with different register
allocation decisions like above, some shaders will see more `sync
nops` while others able to avoid them.
Most of the new `sync nops` are also redundant and could be dropped,
which will be fixed in a separate change.
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3278>
2020-01-17 23:07:44 +00:00
|
|
|
void
|
2015-04-23 12:30:28 +01:00
|
|
|
brw_memory_fence(struct brw_codegen *p,
|
2018-04-27 15:06:56 +01:00
|
|
|
struct brw_reg dst,
|
2019-05-22 18:20:01 +01:00
|
|
|
struct brw_reg src,
|
2019-05-22 18:36:17 +01:00
|
|
|
enum opcode send_op,
|
intel/fs,vec4: Pull stall logic for memory fences up into the IR
Instead of emitting the stall MOV "inside" the
SHADER_OPCODE_MEMORY_FENCE generation, use the scheduling fences when
creating the IR.
For IvyBridge, every (data cache) fence is accompained by a render
cache fence, that now is explicit in the IR, two
SHADER_OPCODE_MEMORY_FENCEs are emitted (with different SFIDs).
Because Begin and End interlock intrinsics are effectively memory
barriers, move its handling alongside the other memory barrier
intrinsics. The SHADER_OPCODE_INTERLOCK is still used to distinguish
if we are going to use a SENDC (for Begin) or regular SEND (for End).
This change is a preparation to allow emitting both SENDs in Gen11+
before we can stall on them.
Shader-db results for IVB (i965):
total instructions in shared programs: 11971190 -> 11971200 (<.01%)
instructions in affected programs: 11482 -> 11492 (0.09%)
helped: 0
HURT: 8
HURT stats (abs) min: 1 max: 3 x̄: 1.25 x̃: 1
HURT stats (rel) min: 0.03% max: 0.50% x̄: 0.14% x̃: 0.10%
95% mean confidence interval for instructions value: 0.66 1.84
95% mean confidence interval for instructions %-change: 0.01% 0.27%
Instructions are HURT.
Unlike the previous code, that used the `mov g1 g2` trick to force
both `g1` and `g2` to stall, the scheduling fence will generate `mov
null g1` and `mov null g2`. During review it was decided it was not
worth keeping the special codepath for the small effect will have.
Shader-db results for HSW (i965), BDW and SKL don't have a change
on instruction count, but do report changes in cycles count, showing
SKL results below
total cycles in shared programs: 341738444 -> 341710570 (<.01%)
cycles in affected programs: 7240002 -> 7212128 (-0.38%)
helped: 46
HURT: 5
helped stats (abs) min: 14 max: 1940 x̄: 676.22 x̃: 154
helped stats (rel) min: <.01% max: 2.62% x̄: 1.28% x̃: 0.95%
HURT stats (abs) min: 2 max: 1768 x̄: 646.40 x̃: 362
HURT stats (rel) min: <.01% max: 0.83% x̄: 0.28% x̃: 0.08%
95% mean confidence interval for cycles value: -777.71 -315.38
95% mean confidence interval for cycles %-change: -1.42% -0.83%
Cycles are helped.
This seems to be the effect of allocating two registers separatedly
instead of a single one with size 2, which causes different register
allocation, affecting the cycle estimates.
while ICL also has not change on instruction count but report changes
negative changes in cycles
total cycles in shared programs: 352665369 -> 352707484 (0.01%)
cycles in affected programs: 9608288 -> 9650403 (0.44%)
helped: 4
HURT: 104
helped stats (abs) min: 24 max: 128 x̄: 88.50 x̃: 101
helped stats (rel) min: <.01% max: 0.85% x̄: 0.46% x̃: 0.49%
HURT stats (abs) min: 2 max: 2016 x̄: 408.36 x̃: 48
HURT stats (rel) min: <.01% max: 3.31% x̄: 0.88% x̃: 0.45%
95% mean confidence interval for cycles value: 256.67 523.24
95% mean confidence interval for cycles %-change: 0.63% 1.03%
Cycles are HURT.
AFAICT this is the result of the case above.
Shader-db results for TGL have similar cycles result as ICL, but also
affect instructions
total instructions in shared programs: 17690586 -> 17690597 (<.01%)
instructions in affected programs: 64617 -> 64628 (0.02%)
helped: 55
HURT: 32
helped stats (abs) min: 1 max: 16 x̄: 4.13 x̃: 3
helped stats (rel) min: 0.05% max: 2.78% x̄: 0.86% x̃: 0.74%
HURT stats (abs) min: 1 max: 65 x̄: 7.44 x̃: 2
HURT stats (rel) min: 0.05% max: 4.58% x̄: 1.13% x̃: 0.69%
95% mean confidence interval for instructions value: -2.03 2.28
95% mean confidence interval for instructions %-change: -0.41% 0.15%
Inconclusive result (value mean confidence interval includes 0).
Now that more is done in the IR, more dependencies are visible and
more SWSB annotations are emitted. Mixed with different register
allocation decisions like above, some shaders will see more `sync
nops` while others able to avoid them.
Most of the new `sync nops` are also redundant and could be dropped,
which will be fixed in a separate change.
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3278>
2020-01-17 23:07:44 +00:00
|
|
|
enum brw_message_target sfid,
|
2021-10-27 22:11:27 +01:00
|
|
|
uint32_t desc,
|
intel/fs,vec4: Pull stall logic for memory fences up into the IR
Instead of emitting the stall MOV "inside" the
SHADER_OPCODE_MEMORY_FENCE generation, use the scheduling fences when
creating the IR.
For IvyBridge, every (data cache) fence is accompained by a render
cache fence, that now is explicit in the IR, two
SHADER_OPCODE_MEMORY_FENCEs are emitted (with different SFIDs).
Because Begin and End interlock intrinsics are effectively memory
barriers, move its handling alongside the other memory barrier
intrinsics. The SHADER_OPCODE_INTERLOCK is still used to distinguish
if we are going to use a SENDC (for Begin) or regular SEND (for End).
This change is a preparation to allow emitting both SENDs in Gen11+
before we can stall on them.
Shader-db results for IVB (i965):
total instructions in shared programs: 11971190 -> 11971200 (<.01%)
instructions in affected programs: 11482 -> 11492 (0.09%)
helped: 0
HURT: 8
HURT stats (abs) min: 1 max: 3 x̄: 1.25 x̃: 1
HURT stats (rel) min: 0.03% max: 0.50% x̄: 0.14% x̃: 0.10%
95% mean confidence interval for instructions value: 0.66 1.84
95% mean confidence interval for instructions %-change: 0.01% 0.27%
Instructions are HURT.
Unlike the previous code, that used the `mov g1 g2` trick to force
both `g1` and `g2` to stall, the scheduling fence will generate `mov
null g1` and `mov null g2`. During review it was decided it was not
worth keeping the special codepath for the small effect will have.
Shader-db results for HSW (i965), BDW and SKL don't have a change
on instruction count, but do report changes in cycles count, showing
SKL results below
total cycles in shared programs: 341738444 -> 341710570 (<.01%)
cycles in affected programs: 7240002 -> 7212128 (-0.38%)
helped: 46
HURT: 5
helped stats (abs) min: 14 max: 1940 x̄: 676.22 x̃: 154
helped stats (rel) min: <.01% max: 2.62% x̄: 1.28% x̃: 0.95%
HURT stats (abs) min: 2 max: 1768 x̄: 646.40 x̃: 362
HURT stats (rel) min: <.01% max: 0.83% x̄: 0.28% x̃: 0.08%
95% mean confidence interval for cycles value: -777.71 -315.38
95% mean confidence interval for cycles %-change: -1.42% -0.83%
Cycles are helped.
This seems to be the effect of allocating two registers separatedly
instead of a single one with size 2, which causes different register
allocation, affecting the cycle estimates.
while ICL also has not change on instruction count but report changes
negative changes in cycles
total cycles in shared programs: 352665369 -> 352707484 (0.01%)
cycles in affected programs: 9608288 -> 9650403 (0.44%)
helped: 4
HURT: 104
helped stats (abs) min: 24 max: 128 x̄: 88.50 x̃: 101
helped stats (rel) min: <.01% max: 0.85% x̄: 0.46% x̃: 0.49%
HURT stats (abs) min: 2 max: 2016 x̄: 408.36 x̃: 48
HURT stats (rel) min: <.01% max: 3.31% x̄: 0.88% x̃: 0.45%
95% mean confidence interval for cycles value: 256.67 523.24
95% mean confidence interval for cycles %-change: 0.63% 1.03%
Cycles are HURT.
AFAICT this is the result of the case above.
Shader-db results for TGL have similar cycles result as ICL, but also
affect instructions
total instructions in shared programs: 17690586 -> 17690597 (<.01%)
instructions in affected programs: 64617 -> 64628 (0.02%)
helped: 55
HURT: 32
helped stats (abs) min: 1 max: 16 x̄: 4.13 x̃: 3
helped stats (rel) min: 0.05% max: 2.78% x̄: 0.86% x̃: 0.74%
HURT stats (abs) min: 1 max: 65 x̄: 7.44 x̃: 2
HURT stats (rel) min: 0.05% max: 4.58% x̄: 1.13% x̃: 0.69%
95% mean confidence interval for instructions value: -2.03 2.28
95% mean confidence interval for instructions %-change: -0.41% 0.15%
Inconclusive result (value mean confidence interval includes 0).
Now that more is done in the IR, more dependencies are visible and
more SWSB annotations are emitted. Mixed with different register
allocation decisions like above, some shaders will see more `sync
nops` while others able to avoid them.
Most of the new `sync nops` are also redundant and could be dropped,
which will be fixed in a separate change.
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3278>
2020-01-17 23:07:44 +00:00
|
|
|
bool commit_enable,
|
2019-07-10 20:02:23 +01:00
|
|
|
unsigned bti);
|
2015-04-23 12:30:28 +01:00
|
|
|
|
2013-11-17 08:47:22 +00:00
|
|
|
void
|
2015-04-16 19:06:57 +01:00
|
|
|
brw_pixel_interpolator_query(struct brw_codegen *p,
|
2013-11-17 08:47:22 +00:00
|
|
|
struct brw_reg dest,
|
|
|
|
struct brw_reg mrf,
|
|
|
|
bool noperspective,
|
2020-10-22 11:23:06 +01:00
|
|
|
bool coarse_pixel_rate,
|
2013-11-17 08:47:22 +00:00
|
|
|
unsigned mode,
|
2015-07-17 14:40:03 +01:00
|
|
|
struct brw_reg data,
|
2013-11-17 08:47:22 +00:00
|
|
|
unsigned msg_length,
|
|
|
|
unsigned response_length);
|
|
|
|
|
2015-04-23 12:42:53 +01:00
|
|
|
void
|
|
|
|
brw_find_live_channel(struct brw_codegen *p,
|
2016-09-14 23:09:33 +01:00
|
|
|
struct brw_reg dst,
|
2022-03-17 07:46:21 +00:00
|
|
|
struct brw_reg mask,
|
|
|
|
bool last);
|
2015-04-23 12:42:53 +01:00
|
|
|
|
2015-02-20 18:14:24 +00:00
|
|
|
void
|
|
|
|
brw_broadcast(struct brw_codegen *p,
|
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src,
|
|
|
|
struct brw_reg idx);
|
|
|
|
|
2017-07-01 07:12:59 +01:00
|
|
|
void
|
2019-09-12 23:34:35 +01:00
|
|
|
brw_float_controls_mode(struct brw_codegen *p,
|
|
|
|
unsigned mode, unsigned mask);
|
2017-07-01 07:12:59 +01:00
|
|
|
|
2020-08-08 18:55:29 +01:00
|
|
|
void
|
2022-06-29 22:13:31 +01:00
|
|
|
brw_update_reloc_imm(const struct brw_isa_info *isa,
|
2020-08-08 18:55:29 +01:00
|
|
|
brw_inst *inst,
|
|
|
|
uint32_t value);
|
|
|
|
|
|
|
|
void
|
|
|
|
brw_MOV_reloc_imm(struct brw_codegen *p,
|
|
|
|
struct brw_reg dst,
|
|
|
|
enum brw_reg_type src_type,
|
|
|
|
uint32_t id);
|
|
|
|
|
2013-11-25 23:39:03 +00:00
|
|
|
/***********************************************************************
|
2006-08-09 20:14:05 +01:00
|
|
|
* brw_eu_util.c:
|
|
|
|
*/
|
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_copy_indirect_to_indirect(struct brw_codegen *p,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_indirect dst_ptr,
|
|
|
|
struct brw_indirect src_ptr,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned count);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_copy_from_indirect(struct brw_codegen *p,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_indirect ptr,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned count);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_copy4(struct brw_codegen *p,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned count);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_copy8(struct brw_codegen *p,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src,
|
2013-11-25 23:51:24 +00:00
|
|
|
unsigned count);
|
2006-08-09 20:14:05 +01:00
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_math_invert( struct brw_codegen *p,
|
2006-08-09 20:14:05 +01:00
|
|
|
struct brw_reg dst,
|
|
|
|
struct brw_reg src);
|
|
|
|
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_set_src1(struct brw_codegen *p, brw_inst *insn, struct brw_reg reg);
|
2010-03-11 01:16:39 +00:00
|
|
|
|
2018-06-02 21:48:42 +01:00
|
|
|
void brw_set_desc_ex(struct brw_codegen *p, brw_inst *insn,
|
|
|
|
unsigned desc, unsigned ex_desc);
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
brw_set_desc(struct brw_codegen *p, brw_inst *insn, unsigned desc)
|
|
|
|
{
|
|
|
|
brw_set_desc_ex(p, insn, desc, 0);
|
|
|
|
}
|
|
|
|
|
2016-08-29 23:57:41 +01:00
|
|
|
void brw_set_uip_jip(struct brw_codegen *p, int start_offset);
|
2010-03-11 01:16:39 +00:00
|
|
|
|
2018-06-07 23:32:15 +01:00
|
|
|
enum brw_conditional_mod brw_negate_cmod(enum brw_conditional_mod cmod);
|
|
|
|
enum brw_conditional_mod brw_swap_cmod(enum brw_conditional_mod cmod);
|
2011-04-09 19:22:42 +01:00
|
|
|
|
2012-02-01 00:55:20 +00:00
|
|
|
/* brw_eu_compact.c */
|
2015-04-16 19:06:57 +01:00
|
|
|
void brw_compact_instructions(struct brw_codegen *p, int start_offset,
|
2017-11-16 01:08:42 +00:00
|
|
|
struct disasm_info *disasm);
|
2022-06-29 22:13:31 +01:00
|
|
|
void brw_uncompact_instruction(const struct brw_isa_info *isa,
|
2015-04-15 21:19:21 +01:00
|
|
|
brw_inst *dst, brw_compact_inst *src);
|
2022-06-29 22:13:31 +01:00
|
|
|
bool brw_try_compact_instruction(const struct brw_isa_info *isa,
|
2017-07-31 23:35:49 +01:00
|
|
|
brw_compact_inst *dst, const brw_inst *src);
|
2012-02-01 00:55:20 +00:00
|
|
|
|
2022-06-29 22:13:31 +01:00
|
|
|
void brw_debug_compact_uncompact(const struct brw_isa_info *isa,
|
2015-04-15 21:19:21 +01:00
|
|
|
brw_inst *orig, brw_inst *uncompacted);
|
2012-02-01 00:55:20 +00:00
|
|
|
|
2015-06-29 22:08:51 +01:00
|
|
|
/* brw_eu_validate.c */
|
2022-06-29 22:13:31 +01:00
|
|
|
bool brw_validate_instruction(const struct brw_isa_info *isa,
|
2019-11-12 00:11:34 +00:00
|
|
|
const brw_inst *inst, int offset,
|
2022-07-19 08:27:29 +01:00
|
|
|
unsigned inst_size,
|
2019-11-12 00:11:34 +00:00
|
|
|
struct disasm_info *disasm);
|
2022-06-29 22:13:31 +01:00
|
|
|
bool brw_validate_instructions(const struct brw_isa_info *isa,
|
2017-09-25 11:34:08 +01:00
|
|
|
const void *assembly, int start_offset, int end_offset,
|
2017-11-16 01:08:42 +00:00
|
|
|
struct disasm_info *disasm);
|
2015-06-29 22:08:51 +01:00
|
|
|
|
2014-05-17 21:00:12 +01:00
|
|
|
static inline int
|
2021-04-05 21:19:39 +01:00
|
|
|
next_offset(const struct intel_device_info *devinfo, void *store, int offset)
|
2014-05-17 21:00:12 +01:00
|
|
|
{
|
2014-06-13 22:29:25 +01:00
|
|
|
brw_inst *insn = (brw_inst *)((char *)store + offset);
|
2014-05-17 21:00:12 +01:00
|
|
|
|
2015-04-15 02:00:06 +01:00
|
|
|
if (brw_inst_cmpt_control(devinfo, insn))
|
2014-05-17 21:00:12 +01:00
|
|
|
return offset + 8;
|
|
|
|
else
|
|
|
|
return offset + 16;
|
|
|
|
}
|
|
|
|
|
2015-11-23 01:58:51 +00:00
|
|
|
/** Maximum SEND message length */
|
|
|
|
#define BRW_MAX_MSG_LENGTH 15
|
|
|
|
|
|
|
|
/** First MRF register used by pull loads */
|
|
|
|
#define FIRST_SPILL_MRF(gen) ((gen) == 6 ? 21 : 13)
|
|
|
|
|
|
|
|
/** First MRF register used by spills */
|
|
|
|
#define FIRST_PULL_LOAD_MRF(gen) ((gen) == 6 ? 16 : 13)
|
|
|
|
|
2012-04-27 15:40:34 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-08-09 20:14:05 +01:00
|
|
|
#endif
|