summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/monitor-config.c75
1 files changed, 68 insertions, 7 deletions
diff --git a/src/core/monitor-config.c b/src/core/monitor-config.c
index 1186a2b7..55b4a1f7 100644
--- a/src/core/monitor-config.c
+++ b/src/core/monitor-config.c
@@ -1063,6 +1063,19 @@ find_primary_output (MetaOutput *outputs,
return best;
}
+static void add_output_to_configuration(MetaConfiguration *ret,
+ MetaOutput *output,
+ int idx, int x, int y)
+{
+ ret->outputs[idx].enabled = TRUE;
+ ret->outputs[idx].rect.x = x;
+ ret->outputs[idx].rect.y = y;
+ ret->outputs[idx].rect.width = output->preferred_mode->width;
+ ret->outputs[idx].rect.height = output->preferred_mode->height;
+ ret->outputs[idx].refresh_rate = output->preferred_mode->refresh_rate;
+ ret->outputs[idx].transform = WL_OUTPUT_TRANSFORM_NORMAL;
+}
+
static MetaConfiguration *
make_default_config (MetaMonitorConfig *self,
MetaOutput *outputs,
@@ -1074,6 +1087,7 @@ make_default_config (MetaMonitorConfig *self,
int x, y;
MetaConfiguration *ret;
MetaOutput *primary;
+ unsigned long output_configured_bitmap = 0;
ret = g_slice_new (MetaConfiguration);
make_config_key (ret, outputs, n_outputs, -1);
@@ -1168,15 +1182,60 @@ make_default_config (MetaMonitorConfig *self,
x = primary->preferred_mode->width;
for (i = 0; i < n_outputs; i++)
{
+ int num_h_tile, num_v_tile, ht, vt;
+ unsigned j;
+ int cur_x, cur_y, addx = 0;
+ gboolean is_prim = False;
+ if (output_configured_bitmap & (1 << i))
+ continue;
+
+ if (outputs[i].is_tiled == False)
+ continue;
+
+ /* find all the outputs in the tile group and construct them */
+ cur_x = cur_y = 0;
+ num_h_tile = outputs[i].max_h_tiles + 1;
+ num_v_tile = outputs[i].max_v_tiles + 1;
+
+ /* iterate over horizontal tiles */
+ cur_x = 0;
+ for (ht = 0; ht < num_h_tile; ht++)
+ {
+ cur_y = 0;
+ addx = 0;
+ for (vt = 0; vt < num_v_tile; vt++)
+ {
+ for (j = 0; j < n_outputs; j++)
+ {
+ if (outputs[j].tile_group_id != outputs[i].tile_group_id)
+ continue;
+
+ if (outputs[j].loc_h_tile != ht ||
+ outputs[j].loc_v_tile != vt)
+ continue;
+
+ if (ht == 0 && vt == 0 && &outputs[j] == primary)
+ is_prim = True;
+
+ add_output_to_configuration(ret, &outputs[j], j, (is_prim ? 0 : x) + cur_x, cur_y);
+ output_configured_bitmap |= (1 << j);
+ cur_y += outputs[j].tile_h;
+ if (vt == 0)
+ addx += outputs[j].tile_w;
+ }
+ }
+ cur_x += addx;
+ }
+ }
+
+ for (i = 0; i < n_outputs; i++)
+ {
MetaOutput *output = &outputs[i];
- ret->outputs[i].enabled = TRUE;
- ret->outputs[i].rect.x = (output == primary) ? 0 : x;
- ret->outputs[i].rect.y = 0;
- ret->outputs[i].rect.width = output->preferred_mode->width;
- ret->outputs[i].rect.height = output->preferred_mode->height;
- ret->outputs[i].refresh_rate = output->preferred_mode->refresh_rate;
- ret->outputs[i].transform = WL_OUTPUT_TRANSFORM_NORMAL;
+ if (output_configured_bitmap & (1 << i))
+ continue;
+
+ add_output_to_configuration(ret, output, i, (output == primary) ? 0 : x, 0);
ret->outputs[i].is_primary = (output == primary);
/* Disable outputs that would go beyond framebuffer limits */
@@ -1184,6 +1243,8 @@ make_default_config (MetaMonitorConfig *self,
ret->outputs[i].enabled = FALSE;
else if (output != primary)
x += output->preferred_mode->width;
+
+ output_configured_bitmap |= (1 << i);
}
return ret;