intel_extreme: fix assigning pipes to displays

The previous code did not handle correctly the case where a display
requested a fixed mapping, and cloud end up assigning the same pipe to
multiple displays. But we want a separate pipe for each display,
allowing multihead support later on.

Rewrite the algorithm to first assign pipes to devices with fixed
constraints, and in a second pass assing the remaining pipes to other
displays.
This commit is contained in:
Adrien Destugues
2020-03-08 16:01:42 +01:00
parent deb591ec89
commit 7991d1b79d
@@ -433,20 +433,36 @@ assign_pipes()
// assigned when the count is > 1;
uint32 current = 0;
bool assigned[gInfo->pipe_count];
memset(assigned, 0, gInfo->pipe_count);
// Some ports need to be assigned to a fixed pipe on old hardware (or due
// to limitations in the current driver on current hardware). Assign those
// first
for (uint32 i = 0; i < gInfo->port_count; i++) {
if (gInfo->ports[i] == NULL)
continue;
pipe_index preference = gInfo->ports[i]->PipePreference();
if (preference != INTEL_PIPE_ANY) {
// Some ports *really* need to be assigned a pipe due to
// implementation bugs.
int index = (preference == INTEL_PIPE_B) ? 1 : 0;
if (assigned[index]) {
TRACE("Pipe %d is already assigned, it will drive multiple "
"displays\n", index);
}
gInfo->ports[i]->SetPipe(gInfo->pipes[index]);
assigned[index] = true;
continue;
}
}
// In a second pass, assign the remaining ports to the remaining pipes
for (uint32 i = 0; i < gInfo->port_count; i++) {
if (gInfo->ports[i]->IsConnected()) {
while (current < gInfo->pipe_count && assigned[current])
current++;
if (current >= gInfo->pipe_count) {
ERROR("%s: No pipes left to assign to port %s!\n", __func__,
gInfo->ports[i]->PortName());
@@ -454,7 +470,6 @@ assign_pipes()
}
gInfo->ports[i]->SetPipe(gInfo->pipes[current]);
current++;
}
}