1 /* -*- mesa-c++ -*- 2 * Copyright 2022 Collabora LTD 3 * Author: Gert Wollny <[email protected]> 4 * SPDX-License-Identifier: MIT 5 */ 6 7 #ifndef ALUREADPORTVALIDATION_H 8 #define ALUREADPORTVALIDATION_H 9 10 #include "sfn_instr_alu.h" 11 12 namespace r600 { 13 14 class AluReadportReservation { 15 public: 16 AluReadportReservation(); 17 AluReadportReservation(const AluReadportReservation& orig) = default; 18 AluReadportReservation& operator=(const AluReadportReservation& orig) = default; 19 20 bool schedule_vec_src(PVirtualValue src[3], int nsrc, AluBankSwizzle swz); 21 22 bool schedule_vec_instruction(const AluInstr& alu, AluBankSwizzle swz); 23 bool schedule_trans_instruction(const AluInstr& alu, AluBankSwizzle swz); 24 25 bool reserve_gpr(int sel, int chan, int cycle); 26 bool reserve_const(const UniformValue& value); 27 28 bool add_literal(uint32_t value); 29 30 static int cycle_vec(AluBankSwizzle swz, int src); 31 static int cycle_trans(AluBankSwizzle swz, int src); 32 33 void print(std::ostream& os) const; 34 35 static const int max_chan_channels = 4; 36 static const int max_gpr_readports = 3; 37 38 std::array<std::array<int, max_chan_channels>, max_gpr_readports> m_hw_gpr; 39 std::array<int, max_chan_channels> m_hw_const_addr; 40 std::array<int, max_chan_channels> m_hw_const_chan; 41 std::array<int, max_chan_channels> m_hw_const_bank; 42 std::array<uint32_t, max_chan_channels> m_literals; 43 uint32_t m_nliterals{0}; 44 }; 45 46 inline std::ostream& 47 operator << (std::ostream& os, const AluReadportReservation& arp) { 48 arp.print(os); 49 return os; 50 } 51 52 } // namespace r600 53 54 #endif // ALUREADPORTVALIDATION_H 55