diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-23 10:53:40 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-23 11:04:54 +0100 |
commit | d6830190bc9956f485db6c3420f7a4a79793a693 (patch) | |
tree | 8ef1f73549f4d9cf14aada566177d5b12a0a8402 /src/sna | |
parent | 70868c7aa881b15b7478f7ee4543fde0268a4ba6 (diff) |
sna: Disable all outputs when initializing as a slaved output provider
When we are constructed as a slaved device, we need to disable all
outputs or else they are not correctly hooked into the master device
upon startup.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r-- | src/sna/sna.h | 23 | ||||
-rw-r--r-- | src/sna/sna_display.c | 52 | ||||
-rw-r--r-- | src/sna/sna_driver.c | 18 |
3 files changed, 50 insertions, 43 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 6e70c56e..281418be 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -241,17 +241,18 @@ struct sna { ScrnInfoPtr scrn; unsigned flags; -#define SNA_NO_WAIT 0x1 -#define SNA_NO_FLIP 0x2 -#define SNA_NO_VSYNC 0x4 -#define SNA_TRIPLE_BUFFER 0x8 -#define SNA_TEAR_FREE 0x10 -#define SNA_FORCE_SHADOW 0x20 -#define SNA_FLUSH_GTT 0x40 -#define SNA_IS_HOSTED 0x80 -#define SNA_PERFORMANCE 0x100 -#define SNA_POWERSAVE 0x200 -#define SNA_REMOVE_OUTPUTS 0x400 +#define SNA_IS_SLAVED 0x1 +#define SNA_IS_HOSTED 0x2 +#define SNA_NO_WAIT 0x10 +#define SNA_NO_FLIP 0x20 +#define SNA_NO_VSYNC 0x40 +#define SNA_TRIPLE_BUFFER 0x80 +#define SNA_TEAR_FREE 0x100 +#define SNA_FORCE_SHADOW 0x200 +#define SNA_FLUSH_GTT 0x400 +#define SNA_PERFORMANCE 0x1000 +#define SNA_POWERSAVE 0x2000 +#define SNA_REMOVE_OUTPUTS 0x4000 #define SNA_HAS_FLIP 0x10000 #define SNA_HAS_ASYNC_FLIP 0x20000 #define SNA_LINEAR_FB 0x40000 diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index af884c48..6952d556 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -5189,36 +5189,38 @@ static bool sna_probe_initial_configuration(struct sna *sna) { ScrnInfoPtr scrn = sna->scrn; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); - const int user_overrides[] = { - OPTION_POSITION, - OPTION_BELOW, - OPTION_RIGHT_OF, - OPTION_ABOVE, - OPTION_LEFT_OF, - OPTION_ROTATE, - OPTION_PANNING, - }; int width, height; int i, j; assert((sna->flags & SNA_IS_HOSTED) == 0); - if (xf86ReturnOptValBool(sna->Options, OPTION_REPROBE, FALSE)) { - DBG(("%s: user requests reprobing\n", __FUNCTION__)); - return false; - } + if ((sna->flags & SNA_IS_SLAVED) == 0) { + const int user_overrides[] = { + OPTION_POSITION, + OPTION_BELOW, + OPTION_RIGHT_OF, + OPTION_ABOVE, + OPTION_LEFT_OF, + OPTION_ROTATE, + OPTION_PANNING, + }; + if (xf86ReturnOptValBool(sna->Options, OPTION_REPROBE, FALSE)) { + DBG(("%s: user requests reprobing\n", __FUNCTION__)); + return false; + } - /* First scan through all outputs and look for user overrides */ - for (i = 0; i < sna->mode.num_real_output; i++) { - xf86OutputPtr output = config->output[i]; + /* First scan through all outputs and look for user overrides */ + for (i = 0; i < sna->mode.num_real_output; i++) { + xf86OutputPtr output = config->output[i]; - for (j = 0; j < ARRAY_SIZE(user_overrides); j++) { - if (xf86GetOptValString(output->options, user_overrides[j])) { - DBG(("%s: user placement [%d] for %s\n", - __FUNCTION__, - user_overrides[j], - output->name)); - return false; + for (j = 0; j < ARRAY_SIZE(user_overrides); j++) { + if (xf86GetOptValString(output->options, user_overrides[j])) { + DBG(("%s: user placement [%d] for %s\n", + __FUNCTION__, + user_overrides[j], + output->name)); + return false; + } } } } @@ -5263,6 +5265,8 @@ static bool sna_probe_initial_configuration(struct sna *sna) crtc_id = (uintptr_t)output->crtc; output->crtc = NULL; + if (sna->flags & SNA_IS_SLAVED) + continue; if (crtc_id == 0) { DBG(("%s: not using output %s, disconnected\n", @@ -5331,7 +5335,7 @@ static bool sna_probe_initial_configuration(struct sna *sna) } width = height = 0; - for (i = 0; i < config->num_crtc; i++) { + for (i = 0; i < sna->mode.num_real_crtc; i++) { xf86CrtcPtr crtc = config->crtc[i]; int w, h; diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index e5e7783a..7f4540db 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -540,7 +540,7 @@ done: * As a result, we want to set up that server initialization once rather * that doing it per generation. */ -static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) +static Bool sna_pre_init(ScrnInfoPtr scrn, int probe) { struct sna *sna; char buf[1024]; @@ -550,7 +550,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) int fd; DBG(("%s flags=%x, numEntities=%d\n", - __FUNCTION__, flags, scrn->numEntities)); + __FUNCTION__, probe, scrn->numEntities)); if (scrn->numEntities != 1) return FALSE; @@ -566,17 +566,19 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) ) return FALSE; - if (flags & PROBE_DETECT) + if (probe & PROBE_DETECT) return TRUE; sna_selftest(); - if (((uintptr_t)scrn->driverPrivate) & 1) { + probe = 0; + if (((uintptr_t)scrn->driverPrivate) & 3) { if (posix_memalign((void **)&sna, 4096, sizeof(*sna))) return FALSE; memset(sna, 0, sizeof(*sna)); /* should be unnecessary */ - sna->info = (void *)((uintptr_t)scrn->driverPrivate & ~1); + probe = (uintptr_t)scrn->driverPrivate & 1; + sna->info = (void *)((uintptr_t)scrn->driverPrivate & ~3); scrn->driverPrivate = sna; sna->cpu_features = sna_cpu_detect(); @@ -585,7 +587,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) sna = to_sna(scrn); sna->scrn = scrn; sna->pEnt = pEnt; - sna->flags = 0; + sna->flags = probe; scrn->displayWidth = 640; /* default it */ @@ -710,7 +712,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags) return TRUE; cleanup: - scrn->driverPrivate = (void *)((uintptr_t)sna->info | 1); + scrn->driverPrivate = (void *)((uintptr_t)sna->info | (sna->flags & SNA_IS_SLAVED) | 2); free(sna); return FALSE; } @@ -1180,7 +1182,7 @@ static void sna_free_screen(FREE_SCREEN_ARGS_DECL) if ((uintptr_t)sna & 1) return; - scrn->driverPrivate = (void *)((uintptr_t)sna->info | 1); + scrn->driverPrivate = (void *)((uintptr_t)sna->info | (sna->flags & SNA_IS_SLAVED) | 2); sna_mode_fini(sna); sna_acpi_fini(sna); |