diff options
author | Alon Levy <alevy@redhat.com> | 2012-06-27 15:53:41 +0300 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@gmail.com> | 2012-07-15 19:21:34 +0200 |
commit | 6c63d799a2b0f69485938dbae7975bf913284a23 (patch) | |
tree | 8e4dc4e6986d18dac769c19638e57257d91d2992 | |
parent | f493653a5e09ae0e0fe1a5f70c3aba1dc9fe86fe (diff) |
qxl_driver/qxl_initialize_x_modes: remove modes not fitting framebuffer
-rw-r--r-- | src/qxl_driver.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/qxl_driver.c b/src/qxl_driver.c index dd97a21..025f8ed 100644 --- a/src/qxl_driver.c +++ b/src/qxl_driver.c @@ -1955,11 +1955,21 @@ qxl_initialize_x_modes(qxl_screen_t *qxl, ScrnInfoPtr pScrn, unsigned int *max_x, unsigned int *max_y) { int i; + int size; *max_x = *max_y = 0; /* Create a list of modes used by the qxl_output_get_modes */ - for (i = 0; i < qxl->num_modes; i++) { - if (qxl->modes[i].orientation == 0) { + for (i = 0; i < qxl->num_modes; i++) + { + if (qxl->modes[i].orientation == 0) + { + size = qxl->modes[i].x_res * qxl->modes[i].y_res * 4; + if (size > qxl->surface0_size) { + ErrorF ("skipping mode %dx%d not fitting in surface0", + qxl->modes[i].x_res, qxl->modes[i].y_res); + continue; + } + qxl_add_mode(qxl, pScrn, qxl->modes[i].x_res, qxl->modes[i].y_res, M_T_DRIVER); if (qxl->modes[i].x_res > *max_x) |