r600/sfn: Add the WaitAck instruction

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3225>
This commit is contained in:
Gert Wollny
2019-12-27 17:49:26 +01:00
committed by Marge Bot
parent e09cdb3f86
commit 24f683fe81
6 changed files with 115 additions and 0 deletions
@@ -114,6 +114,8 @@ CXX_SOURCES = \
sfn/sfn_instruction_export.h \
sfn/sfn_instruction_fetch.cpp \
sfn/sfn_instruction_fetch.h \
sfn/sfn_instruction_misc.cpp \
sfn/sfn_instruction_misc.h \
sfn/sfn_instruction_tex.cpp \
sfn/sfn_instruction_tex.h \
sfn/sfn_ir_to_assembly.cpp \
+2
View File
@@ -131,6 +131,8 @@ files_r600 = files(
'sfn/sfn_instruction_export.h',
'sfn/sfn_instruction_fetch.cpp',
'sfn/sfn_instruction_fetch.h',
'sfn/sfn_instruction_misc.cpp',
'sfn/sfn_instruction_misc.h',
'sfn/sfn_instruction_tex.cpp',
'sfn/sfn_instruction_tex.h',
'sfn/sfn_ir_to_assembly.cpp',
@@ -0,0 +1,49 @@
/* -*- mesa-c++ -*-
*
* Copyright (c) 2019 Collabora LTD
*
* Author: Gert Wollny <gert.wollny@collabora.com>
*
* 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
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, 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:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR 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.
*/
#include "sfn_instruction_misc.h"
namespace r600 {
WaitAck::WaitAck(int nack):
Instruction (wait_ack),
m_nack(nack)
{
}
bool WaitAck::is_equal_to(const Instruction& lhs) const
{
const auto& l = dynamic_cast<const WaitAck&>(lhs);
return m_nack == l.m_nack;
}
void WaitAck::do_print(std::ostream& os) const
{
os << "WAIT_ACK @" << m_nack;
}
}
@@ -0,0 +1,48 @@
/* -*- mesa-c++ -*-
*
* Copyright (c) 2018-2019 Collabora LTD
*
* Author: Gert Wollny <gert.wollny@collabora.com>
*
* 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
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, 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:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* 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 NON-INFRINGEMENT. IN NO EVENT SHALL
* THE AUTHOR(S) AND/OR THEIR 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.
*/
#ifndef SFN_INSTRUCTION_MISC_H
#define SFN_INSTRUCTION_MISC_H
#include "sfn_instruction_base.h"
namespace r600 {
class WaitAck : public Instruction {
public:
WaitAck(int nack);
ECFOpCode op() const {return cf_wait_ack;}
int n_ack() const {return m_nack;}
private:
bool is_equal_to(const Instruction& lhs) const override;
void do_print(std::ostream& os) const override;
int m_nack;
};
}
#endif // SFN_INSTRUCTION_MISC_H
@@ -27,6 +27,7 @@
#include "sfn_ir_to_assembly.h"
#include "sfn_conditionaljumptracker.h"
#include "sfn_callstack.h"
#include "sfn_instruction_misc.h"
#include "sfn_instruction_fetch.h"
#include "../r600_shader.h"
@@ -56,6 +57,7 @@ private:
bool emit_loop_end(const LoopEndInstruction& instr);
bool emit_loop_break(const LoopBreakInstruction& instr);
bool emit_loop_continue(const LoopContInstruction& instr);
bool emit_wait_ack(const WaitAck& instr);
bool emit_load_addr(PValue addr);
bool emit_fs_pixel_export(const ExportInstruction & exi);
@@ -161,6 +163,8 @@ bool AssemblyFromShaderLegacyImpl::emit(const Instruction::Pointer i)
return emit_loop_continue(static_cast<const LoopContInstruction&>(*i));
case Instruction::streamout:
return emit_streamout(static_cast<const StreamOutIntruction&>(*i));
case Instruction::wait_ack:
return emit_wait_ack(static_cast<const WaitAck&>(*i));
default:
return false;
}
@@ -736,6 +740,15 @@ bool AssemblyFromShaderLegacyImpl::emit_vtx(const FetchInstruction& fetch_instr)
return true;
}
bool AssemblyFromShaderLegacyImpl::emit_wait_ack(const WaitAck& instr)
{
int r = r600_bytecode_add_cfinst(m_bc, instr.op());
if (!r)
m_bc->cf_last->cf_addr = instr.n_ack();
return r == 0;
}
extern const std::map<ESDOp, int> ds_opcode_map;
bool AssemblyFromShaderLegacyImpl::copy_dst(r600_bytecode_alu_dst& dst,
@@ -31,6 +31,7 @@
#include "sfn_shader_fragment.h"
#include "sfn_ir_to_assembly.h"
#include "sfn_nir.h"
#include "sfn_instruction_misc.h"
#include "sfn_instruction_fetch.h"
#include <iostream>