But still default to 1024x768 if no other mode is given. Signed-off-by: Jeremy White <jwhite@xxxxxxxxxxxxxxx> --- src/qxl_driver.c | 81 ++++++++++++++---------------------------------------- 1 file changed, 20 insertions(+), 61 deletions(-) diff --git a/src/qxl_driver.c b/src/qxl_driver.c index e2d08c7..c7a07cb 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -952,13 +952,6 @@ qxl_resize_primary_to_virtual (qxl_screen_t *qxl) { ScreenPtr pScreen; long new_surface0_size; - - if ((qxl->primary_mode.x_res == qxl->virtual_x && - qxl->primary_mode.y_res == qxl->virtual_y) && - qxl->device_primary == QXL_DEVICE_PRIMARY_CREATED) - { - return TRUE; /* empty Success */ - } ErrorF ("resizing primary to %dx%d\n", qxl->virtual_x, qxl->virtual_y); @@ -1791,15 +1784,7 @@ qxl_screen_init (SCREEN_INIT_ARGS_DECL) goto out; if (!miSetPixmapDepths ()) goto out; - pScrn->displayWidth = pScrn->virtualX; -#if 0 - ErrorF ("allocated %d x %d %p\n", pScrn->virtualX, pScrn->virtualY, qxl->fb); -#endif - - pScrn->virtualX = pScrn->currentMode->HDisplay; - pScrn->virtualY = pScrn->currentMode->VDisplay; - /* Set up resources */ qxl_reset_and_create_mem_slots (qxl); ErrorF ("done reset\n"); @@ -2335,12 +2320,6 @@ qxl_init_randr (ScrnInfoPtr pScrn, qxl_screen_t *qxl) qxl_crtc->output = output; } - qxl->virtual_x = 1024; - qxl->virtual_y = 768; - - pScrn->display->virtualX = qxl->virtual_x; - pScrn->display->virtualY = qxl->virtual_y; - xf86InitialConfiguration (pScrn, TRUE); /* all crtcs are enabled here, but their mode is 0, resulting monitor config empty atm */ @@ -2352,6 +2331,7 @@ qxl_initialize_x_modes (qxl_screen_t *qxl, ScrnInfoPtr pScrn, { int i; int size; + int preferred_flag; *max_x = *max_y = 0; /* Create a list of modes used by the qxl_output_get_modes */ @@ -2366,15 +2346,24 @@ qxl_initialize_x_modes (qxl_screen_t *qxl, ScrnInfoPtr pScrn, qxl->modes[i].x_res, qxl->modes[i].y_res); continue; } - + + if (qxl->modes[i].x_res == 1024 && qxl->modes[i].y_res == 768) + preferred_flag = M_T_PREFERRED; + else + preferred_flag = 0; + qxl_add_mode (qxl, pScrn, qxl->modes[i].x_res, qxl->modes[i].y_res, - M_T_DRIVER); + M_T_DRIVER | preferred_flag); if (qxl->modes[i].x_res > *max_x) *max_x = qxl->modes[i].x_res; if (qxl->modes[i].y_res > *max_y) *max_y = qxl->modes[i].y_res; } } + + pScrn->virtualX = pScrn->displayWidth = *max_x; + pScrn->virtualY = *max_y; + pScrn->virtualFrom = X_PROBED; } static Bool @@ -2496,51 +2485,21 @@ qxl_pre_init (ScrnInfoPtr pScrn, int flags) pScrn->monitor->vrefresh[0].hi = 75; pScrn->monitor->nVrefresh = 1; } - + + /* Note that we replace the 'normal' xf86ValidateModes call, + so this function is obligated to set the same values as + that call normally does. */ qxl_initialize_x_modes (qxl, pScrn, &max_x, &max_y); -#if 0 - if (pScrn->display->virtualX == 0 && pScrn->display->virtualY == 0) - { - /* It is possible for the largest x + largest y size combined leading - to a virtual size which will not fit into the framebuffer when this - happens we prefer max width and make height as large as possible */ - if (max_x * max_y * (pScrn->bitsPerPixel / 8) > - qxl->rom->surface0_area_size) - pScrn->display->virtualY = qxl->rom->surface0_area_size / - (max_x * (pScrn->bitsPerPixel / 8)); - else - pScrn->display->virtualY = max_y; - - pScrn->display->virtualX = max_x; - } - - if (0 >= xf86ValidateModes (pScrn, pScrn->monitor->Modes, - pScrn->display->modes, clockRanges, linePitches, - 128, max_x, 128 * 4, 128, max_y, - pScrn->display->virtualX, - pScrn->display->virtualY, - 128 * 1024 * 1024, LOOKUP_BEST_REFRESH)) - goto out; -#endif - CHECK_POINT (); xf86PruneDriverModes (pScrn); qxl_init_randr (pScrn, qxl); -#if 0 - /* If no modes are specified in xorg.conf, default to 1024x768 */ - if (pScrn->display->modes == NULL || pScrn->display->modes[0] == NULL) - for (mode = pScrn->modes; mode; mode = mode->next) - if (mode->HDisplay == 1024 && mode->VDisplay == 768) - { - pScrn->currentMode = mode; - break; - } -#endif - - //xf86PrintModes (pScrn); + + qxl->virtual_x = pScrn->display->virtualX; + qxl->virtual_y = pScrn->display->virtualY; + xf86SetDpi (pScrn, 0, 0); if (!xf86LoadSubModule (pScrn, "fb") -- 1.7.10.4 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel