Set screen dpi correctly

This commit is contained in:
David Reveman 2006-03-09 13:50:35 +00:00
parent 9ef5e9800e
commit 154e85bea5
2 changed files with 23 additions and 4 deletions

View file

@ -1,5 +1,8 @@
2006-03-09 David Reveman <davidr@novell.com>
* hw/xgl/xglscreen.c (xglScreenInit): Use xglScreenInfo.widthMm
and xglScreenInfo.heightMm if set.
* Makefile.am:
* configure.ac:
* include/dix-config.h.in:

View file

@ -118,6 +118,7 @@ xglScreenInit (ScreenPtr pScreen)
xglScreenPtr pScreenPriv;
xglVisualPtr v;
int i, depth, bpp = 0;
int dpiX, dpiY;
#ifdef RENDER
PictureScreenPtr pPictureScreen;
@ -174,12 +175,27 @@ xglScreenInit (ScreenPtr pScreen)
pScreenPriv->lines = xglScreenInfo.lines;
pScreenPriv->accel = xglScreenInfo.accel;
if (monitorResolution == 0)
monitorResolution = XGL_DEFAULT_DPI;
if (monitorResolution)
{
dpiX = dpiY = monitorResolution;
}
else
{
dpiX = xglScreenInfo.widthMm;
dpiY = xglScreenInfo.heightMm;
if (dpiX && dpiY)
{
dpiX = (xglScreenInfo.width * 254 + dpiX * 5) / (dpiX * 10);
dpiY = (xglScreenInfo.height * 254 + dpiY * 5) / (dpiY * 10);
}
else
dpiX = dpiY = XGL_DEFAULT_DPI;
}
if (!fbSetupScreen (pScreen, NULL,
xglScreenInfo.width, xglScreenInfo.height,
monitorResolution, monitorResolution,
dpiX, dpiY,
xglScreenInfo.width, bpp))
return FALSE;
@ -190,7 +206,7 @@ xglScreenInit (ScreenPtr pScreen)
if (!fbFinishScreenInit (pScreen, NULL,
xglScreenInfo.width, xglScreenInfo.height,
monitorResolution, monitorResolution,
dpiX, dpiY,
xglScreenInfo.width, bpp))
return FALSE;