Mesa (master): st/xorg: Obey max {width|height} from kernel and Gallium

Jakob Bornecrantz wallbraker at kemper.freedesktop.org
Sat Feb 27 03:10:20 UTC 2010


Module: Mesa
Branch: master
Commit: bad4b29d77817b54ab9b19ff9c8a0e5bf2de00fa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bad4b29d77817b54ab9b19ff9c8a0e5bf2de00fa

Author: Jakob Bornecrantz <jakob at vmware.com>
Date:   Mon Feb 22 14:46:10 2010 +0100

st/xorg: Obey max {width|height} from kernel and Gallium

---

 src/gallium/state_trackers/xorg/xorg_driver.c |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 5397ee7..62cf2e0 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -428,8 +428,8 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
     xf86CrtcConfigInit(pScrn, &crtc_config_funcs);
     xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
 
-    max_width = 8192;
-    max_height = 8192;
+    max_width = 2048;  /* A very low default */
+    max_height = 2048; /* see screen_init */
     xf86CrtcSetSizeRange(pScrn, 320, 200, max_width, max_height);
 
     if (xf86ReturnOptValBool(ms->Options, OPTION_SW_CURSOR, FALSE)) {
@@ -612,6 +612,7 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 {
     ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
     modesettingPtr ms = modesettingPTR(pScrn);
+    unsigned max_width, max_height;
     VisualPtr visual;
     CustomizerPtr cust = ms->cust;
 
@@ -630,6 +631,26 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
 	return FALSE;
     }
 
+    /* get max width and height */
+    {
+	drmModeResPtr res;
+	res = drmModeGetResources(ms->fd);
+	max_width = res->max_width;
+	max_height = res->max_height;
+	drmModeFreeResources(res);
+    }
+
+    if (ms->screen) {
+	float maxf;
+	int max;
+	maxf = ms->screen->get_paramf(ms->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+	max = (1 << (int)(maxf - 1.0f));
+	max_width = max < max_width ? max : max_width;
+	max_height = max < max_height ? max : max_height;
+    }
+
+    xf86CrtcSetSizeRange(pScrn, 1, 1, max_width, max_height);
+
     pScrn->pScreen = pScreen;
 
     /* HW dependent - FIXME */




More information about the mesa-commit mailing list