diff options
author | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-07-06 08:05:11 -0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-07-15 19:24:32 +0200 |
commit | 47b54dcfd9ba2aa78e0f154a288321bb0ff98dce (patch) | |
tree | ad8fe9d5296fc0ac372971b73e332fb5d9c07533 | |
parent | 6ee541636b6ed6846074afeb1c32d9e8e6a9bdda (diff) |
Split crtc_set_mode_major()
Avoid sending many monitor config changes during qxl_create_desired_modes()
-rw-r--r-- | src/qxl_driver.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/src/qxl_driver.c b/src/qxl_driver.c index 5b70c96..ba2c5b0 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -995,18 +995,44 @@ qxl_update_monitors_config(qxl_screen_t *qxl) } static Bool +crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, + Rotation rotation, int x, int y) +{ + qxl_crtc_private *crtc_private = crtc->driver_private; + qxl_screen_t *qxl = crtc_private->qxl; + + if (crtc == qxl->crtcs[0] && mode == NULL) { + /* disallow disabling of monitor 0 mode */ + ErrorF("%s: not allowing crtc 0 disablement\n", __func__); + return FALSE; + } + + crtc->mode = *mode; + crtc->x = x; + crtc->y = y; + crtc->rotation = rotation; +#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,5,99,0,0) + crtc->transformPresent = FALSE; +#endif + qxl_output_edid_set(crtc_private->output, crtc_private->head, mode); + + return TRUE; +} + +static Bool qxl_create_desired_modes(qxl_screen_t *qxl) { int i; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(qxl->pScrn); + CHECK_POINT(); for (i = 0 ; i < config->num_crtc; ++i) { xf86CrtcPtr crtc = config->crtc[i]; if (!crtc->enabled) continue; - if (!crtc->funcs->set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation, - crtc->desiredX, crtc->desiredY)) + if (!crtc_set_mode_major(crtc, &crtc->desiredMode, crtc->desiredRotation, + crtc->desiredX, crtc->desiredY)) return FALSE; } @@ -1780,22 +1806,14 @@ qxl_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, { qxl_crtc_private *crtc_private = crtc->driver_private; qxl_screen_t *qxl = crtc_private->qxl; + CHECK_POINT(); - if (crtc == qxl->crtcs[0] && mode == NULL) { - /* disallow disabling of monitor 0 mode */ - ErrorF("%s: not allowing crtc 0 disablement\n", __func__); + if (!crtc_set_mode_major(crtc, mode, rotation, x, y)) return FALSE; - } - crtc->mode = *mode; - crtc->x = x; - crtc->y = y; - crtc->rotation = rotation; -#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,5,99,0,0) - crtc->transformPresent = FALSE; -#endif - qxl_output_edid_set(crtc_private->output, crtc_private->head, mode); + check_crtc(qxl); qxl_update_monitors_config(qxl); + return TRUE; } |