mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
etnaviv: Move struct etna_inst to src/etnaviv
We will use struct etna_inst as starting point for our new assembler. The goal is to do a smooth translation for the gallium driver. Also apply clang-format rules and use SPDX license tag. Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28183>
This commit is contained in:
parent
59f9a54f36
commit
36c826d7ec
2 changed files with 68 additions and 52 deletions
66
src/etnaviv/isa/asm.h
Normal file
66
src/etnaviv/isa/asm.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2015 Etnaviv Project
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Authors:
|
||||
* Wladimir J. van der Laan <laanwj@gmail.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* Number of source operands per instruction */
|
||||
#define ETNA_NUM_SRC (3)
|
||||
|
||||
/*** operands ***/
|
||||
|
||||
/* destination operand */
|
||||
struct etna_inst_dst {
|
||||
unsigned use : 1; /* 0: not in use, 1: in use */
|
||||
unsigned amode : 3; /* INST_AMODE_* */
|
||||
unsigned reg : 7; /* register number 0..127 */
|
||||
unsigned write_mask : 4; /* INST_COMPS_* */
|
||||
};
|
||||
|
||||
/* texture operand */
|
||||
struct etna_inst_tex {
|
||||
unsigned id : 5; /* sampler id */
|
||||
unsigned amode : 3; /* INST_AMODE_* */
|
||||
unsigned swiz : 8; /* INST_SWIZ */
|
||||
};
|
||||
|
||||
/* source operand */
|
||||
struct etna_inst_src {
|
||||
unsigned use : 1; /* 0: not in use, 1: in use */
|
||||
unsigned rgroup : 3; /* INST_RGROUP_* */
|
||||
union {
|
||||
struct __attribute__((__packed__)) {
|
||||
unsigned reg : 9; /* register or uniform number 0..511 */
|
||||
unsigned swiz : 8; /* INST_SWIZ */
|
||||
unsigned neg : 1; /* negate (flip sign) if set */
|
||||
unsigned abs : 1; /* absolute (remove sign) if set */
|
||||
unsigned amode : 3; /* INST_AMODE_* */
|
||||
};
|
||||
struct __attribute__((__packed__)) {
|
||||
unsigned imm_val : 20;
|
||||
unsigned imm_type : 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/*** instruction ***/
|
||||
struct etna_inst {
|
||||
uint8_t opcode; /* INST_OPCODE_* */
|
||||
uint8_t type; /* INST_TYPE_* */
|
||||
unsigned cond : 5; /* INST_CONDITION_* */
|
||||
unsigned sat : 1; /* saturate result between 0..1 */
|
||||
unsigned sel_bit0 : 1; /* select low half mediump */
|
||||
unsigned sel_bit1 : 1; /* select high half mediump */
|
||||
unsigned dst_full : 1; /* write to highp register */
|
||||
struct etna_inst_dst dst; /* destination operand */
|
||||
struct etna_inst_tex tex; /* texture operand */
|
||||
struct etna_inst_src src[ETNA_NUM_SRC]; /* source operand */
|
||||
unsigned imm; /* takes place of src[2] for BRANCH/CALL */
|
||||
};
|
||||
|
|
@ -32,10 +32,10 @@
|
|||
#include "util/u_math.h"
|
||||
#include "hw/isa.xml.h"
|
||||
|
||||
#include <etnaviv/isa/asm.h>
|
||||
|
||||
/* Size of an instruction in 32-bit words */
|
||||
#define ETNA_INST_SIZE (4)
|
||||
/* Number of source operands per instruction */
|
||||
#define ETNA_NUM_SRC (3)
|
||||
|
||||
/* Broadcast swizzle to all four components */
|
||||
#define INST_SWIZ_BROADCAST(x) \
|
||||
|
|
@ -52,56 +52,6 @@
|
|||
INST_SWIZ_COMP_##c2, \
|
||||
INST_SWIZ_COMP_##c3)
|
||||
|
||||
/*** operands ***/
|
||||
|
||||
/* destination operand */
|
||||
struct etna_inst_dst {
|
||||
unsigned use:1; /* 0: not in use, 1: in use */
|
||||
unsigned amode:3; /* INST_AMODE_* */
|
||||
unsigned reg:7; /* register number 0..127 */
|
||||
unsigned write_mask:4; /* INST_COMPS_* */
|
||||
};
|
||||
|
||||
/* texture operand */
|
||||
struct etna_inst_tex {
|
||||
unsigned id:5; /* sampler id */
|
||||
unsigned amode:3; /* INST_AMODE_* */
|
||||
unsigned swiz:8; /* INST_SWIZ */
|
||||
};
|
||||
|
||||
/* source operand */
|
||||
struct etna_inst_src {
|
||||
unsigned use:1; /* 0: not in use, 1: in use */
|
||||
unsigned rgroup:3; /* INST_RGROUP_* */
|
||||
union {
|
||||
struct __attribute__((__packed__)) {
|
||||
unsigned reg:9; /* register or uniform number 0..511 */
|
||||
unsigned swiz:8; /* INST_SWIZ */
|
||||
unsigned neg:1; /* negate (flip sign) if set */
|
||||
unsigned abs:1; /* absolute (remove sign) if set */
|
||||
unsigned amode:3; /* INST_AMODE_* */
|
||||
};
|
||||
struct __attribute__((__packed__)) {
|
||||
unsigned imm_val : 20;
|
||||
unsigned imm_type : 2;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/*** instruction ***/
|
||||
struct etna_inst {
|
||||
uint8_t opcode; /* INST_OPCODE_* */
|
||||
uint8_t type; /* INST_TYPE_* */
|
||||
unsigned cond:5; /* INST_CONDITION_* */
|
||||
unsigned sat:1; /* saturate result between 0..1 */
|
||||
unsigned sel_bit0:1; /* select low half mediump */
|
||||
unsigned sel_bit1:1; /* select high half mediump */
|
||||
unsigned dst_full:1; /* write to highp register */
|
||||
struct etna_inst_dst dst; /* destination operand */
|
||||
struct etna_inst_tex tex; /* texture operand */
|
||||
struct etna_inst_src src[ETNA_NUM_SRC]; /* source operand */
|
||||
unsigned imm; /* takes place of src[2] for BRANCH/CALL */
|
||||
};
|
||||
|
||||
/* Compose two swizzles (computes swz1.swz2) */
|
||||
static inline uint32_t inst_swiz_compose(uint32_t swz1, uint32_t swz2)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue