summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sna/sna.h1
-rw-r--r--src/sna/sna_display.c26
-rw-r--r--src/sna/sna_driver.c2
3 files changed, 29 insertions, 0 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 498149da..bce8bab3 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -432,6 +432,7 @@ extern void sna_shadow_set_crtc(struct sna *sna, xf86CrtcPtr crtc, struct kgem_b
extern void sna_shadow_unset_crtc(struct sna *sna, xf86CrtcPtr crtc);
extern bool sna_pixmap_discard_shadow_damage(struct sna_pixmap *priv,
const RegionRec *region);
+extern void sna_mode_set_primary(struct sna *sna);
extern void sna_mode_close(struct sna *sna);
extern void sna_mode_fini(struct sna *sna);
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 0a6d35e6..5335f069 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3921,6 +3921,7 @@ void sna_mode_discover(struct sna *sna)
DBG(("%s: outputs changed, broadcasting\n", __FUNCTION__));
sna_mode_compute_possible_outputs(sna);
+ sna_mode_set_primary(sna);
/* Reorder user visible listing */
sort_config_outputs(sna);
@@ -5652,6 +5653,31 @@ sna_mode_wants_tear_free(struct sna *sna)
}
void
+sna_mode_set_primary(struct sna *sna)
+{
+#ifdef RANDR_12_INTERFACE
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
+ rrScrPrivPtr rr = rrGetScrPriv(xf86ScrnToScreen(sna->scrn));
+ int i;
+
+ if (rr->primaryOutput)
+ return;
+
+ for (i = 0; i < sna->mode.num_real_output; i++) {
+ xf86OutputPtr output = config->output[i];
+
+ if (!xf86ReturnOptValBool(output->options, OPTION_PRIMARY, FALSE))
+ continue;
+
+ rr->primaryOutput = output->randr_output;
+ RROutputChanged(rr->primaryOutput, 0);
+ rr->layoutChanged = TRUE;
+ break;
+ }
+#endif
+}
+
+void
sna_mode_close(struct sna *sna)
{
while (sna_mode_has_pending_events(sna))
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index 5e541253..322e9514 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -272,6 +272,8 @@ static Bool sna_create_screen_resources(ScreenPtr screen)
return FALSE;
}
+ sna_mode_set_primary(sna);
+
/* Only preserve the fbcon, not any subsequent server regens */
if (serverGeneration == 1 && (sna->flags & SNA_IS_HOSTED) == 0)
sna_copy_fbcon(sna);