mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 11:20:11 +01:00
r600/sfn: check used channels when evaluating allowed mask
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7878 v2: Fix ws in comment (iorn10) Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20283>
This commit is contained in:
parent
8c30cf4443
commit
edabd5cd84
1 changed files with 21 additions and 1 deletions
|
|
@ -468,7 +468,27 @@ AluInstr::set_sources(SrcValues src)
|
||||||
|
|
||||||
uint8_t AluInstr::allowed_src_chan_mask() const
|
uint8_t AluInstr::allowed_src_chan_mask() const
|
||||||
{
|
{
|
||||||
return 0xf;
|
if (m_alu_slots < 2)
|
||||||
|
return 0xf;
|
||||||
|
int chan_use_count[4] = {0};
|
||||||
|
|
||||||
|
for (auto s : m_src) {
|
||||||
|
auto r = s->as_register();
|
||||||
|
if (r)
|
||||||
|
++chan_use_count[r->chan()];
|
||||||
|
}
|
||||||
|
/* Each channel can only be loaded in one of three cycles,
|
||||||
|
* so if a channel is already used three times, we can't
|
||||||
|
* add another source with this channel.
|
||||||
|
* Since we want to move away from one channel to another, it
|
||||||
|
* is not important to know which is the old channel that will
|
||||||
|
* be freed by the channel switch.*/
|
||||||
|
int mask = 0;
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
if (chan_use_count[i] < 3)
|
||||||
|
mask |= 1 << i;
|
||||||
|
}
|
||||||
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t
|
uint8_t
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue