summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/xorg
diff options
context:
space:
mode:
authorJakob Bornecrantz <[email protected]>2010-02-22 14:46:10 +0100
committerJakob Bornecrantz <[email protected]>2010-02-27 02:12:48 +0000
commitbad4b29d77817b54ab9b19ff9c8a0e5bf2de00fa (patch)
tree3fb83ff99938765f99dfb92894b15a3b6158dd5b /src/gallium/state_trackers/xorg
parent55e5737bae6b88c2d1bc4c0d94e11548518659b8 (diff)
st/xorg: Obey max {width|height} from kernel and Gallium
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c25
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 5397ee777aa..62cf2e0006c 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 */