summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-06-16 09:24:10 +0000
committerEric Anholt <anholt@freebsd.org>2004-06-16 09:24:10 +0000
commit03b2fd85a09d9787d1895cdb7e418e7543288fd9 (patch)
tree75a069f0f8791711fe43fc718b1666932db8d007
parent283c0359be82bfac45781ad06d2ff0965daef73e (diff)
downloadxorg-driver-xf86-video-vesa-03b2fd85a09d9787d1895cdb7e418e7543288fd9.tar.gz
-rw-r--r--man/vesa.man10
-rw-r--r--src/vesa.c111
-rw-r--r--src/vesa.h2
3 files changed, 98 insertions, 25 deletions
diff --git a/man/vesa.man b/man/vesa.man
index 4ae43bb..5a9dfd5 100644
--- a/man/vesa.man
+++ b/man/vesa.man
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man,v 1.2 2001/01/27 18:20:56 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man,v 1.3 2001/12/17 20:52:34 dawes Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH VESA __drivermansuffix__ __vendorversion__
@@ -14,7 +14,7 @@ vesa \- Generic VESA video driver
.fi
.SH DESCRIPTION
.B vesa
-is an __xservername__ driver for generic VESA video cards. It can drive most
+is an XFree86 driver for generic VESA video cards. It can drive most
VESA-compatible video cards, but only makes use of the basic standard
VESA core that is common to these cards. The driver supports depths 8, 15
16 and 24.
@@ -24,7 +24,7 @@ The
driver supports most VESA-compatible video cards. There are some known
exceptions, and those should be listed here.
.SH CONFIGURATION DETAILS
-Please refer to __xconfigfile__(__filemansuffix__) for general configuration
+Please refer to XF86Config(__filemansuffix__) for general configuration
details. This section only covers configuration details specific to this
driver.
.PP
@@ -47,6 +47,6 @@ Enable or disable use of the shadow framebuffer layer. Default: on.
This option is recommended for performance reasons.
.SH "SEE ALSO"
-__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgcfg(__appmansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
+XFree86(1), XF86Config(__filemansuffix__), xf86cfg(1), xf86config(1), Xserver(1), X(__miscmansuffix__)
.SH AUTHORS
-Authors include: Paulo Ce\'sar Pereira de Andrade.
+Authors include: Paulo César Pereira de Andrade.
diff --git a/src/vesa.c b/src/vesa.c
index 298391e..a606284 100644
--- a/src/vesa.c
+++ b/src/vesa.c
@@ -28,7 +28,7 @@
* Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
* David Dawes <dawes@xfree86.org>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.40 2003/11/03 05:11:45 tsi Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.37 2003/08/23 16:09:22 dawes Exp $
*/
#include "vesa.h"
@@ -212,7 +212,7 @@ static XF86ModuleVersionInfo vesaVersionRec =
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
- XORG_VERSION_CURRENT,
+ XF86_VERSION_CURRENT,
VESA_MAJOR_VERSION, VESA_MINOR_VERSION, VESA_PATCHLEVEL,
ABI_CLASS_VIDEODRV, /* This is a video driver */
ABI_VIDEODRV_VERSION,
@@ -439,7 +439,7 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
const char *reqSym = NULL;
Gamma gzeros = {0.0, 0.0, 0.0};
rgb rzeros = {0, 0, 0};
- pointer pDDCModule;
+ pointer pVbeModule, pDDCModule;
int i;
int flags24 = 0;
int defaultDepth = 0;
@@ -462,7 +462,7 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
#endif
/* Load vbe module */
- if (!xf86LoadSubModule(pScrn, "vbe"))
+ if ((pVbeModule = xf86LoadSubModule(pScrn, "vbe")) == NULL)
return (FALSE);
xf86LoaderReqSymLists(vbeSymbols, NULL);
@@ -585,6 +585,85 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags)
VBESetModeNames(pScrn->modePool);
+ /*
+ * If DDC information is available, use it to try to set the monitor
+ * parameters if they're not already set.
+ *
+ * The common layer will already do this, but doesn't try as hard. If
+ * this proves useful, it should probably be moved into the common layer.
+ */
+ if (pVesa->monitor != NULL) {
+ MonPtr pMon;
+
+ pMon = pScrn->monitor;
+ if (pMon->nHsync == 0 || pMon->nVrefresh == 0) {
+ struct monitor_ranges *mRange;
+ float hmin = 1e6, hmax = 0.0, vmin = 1e6, vmax = 0.0;
+ float h;
+ struct std_timings *t;
+ int j, k;
+
+ j = 0;
+ for (i = 0; i < DET_TIMINGS; i++) {
+ if (pVesa->monitor->det_mon[i].type == DS_RANGES) {
+ mRange = &pVesa->monitor->det_mon[i].section.ranges;
+ pMon->hsync[j].lo = mRange->min_h;
+ pMon->hsync[j].hi = mRange->max_h;
+ pMon->vrefresh[j].lo = mRange->min_v;
+ pMon->vrefresh[j].hi = mRange->max_v;
+ j++;
+ } else if (pVesa->monitor->det_mon[i].type == DS_STD_TIMINGS) {
+ t = pVesa->monitor->det_mon[i].section.std_t;
+ for (k = 0; k < 5; k++) {
+ if (t[k].hsize > 256) { /* sanity check */
+ if (t[k].refresh < vmin)
+ vmin = t[i].refresh;
+ if (t[k].refresh > vmax)
+ vmax = t[i].refresh;
+ h = t[k].refresh * 1.07 * t[k].vsize / 1000.0;
+ if (h < hmin)
+ hmin = h;
+ if (h > hmax)
+ hmax = h;
+ }
+ }
+ }
+
+ if (j > MAX_HSYNC)
+ break;
+ }
+
+ if (j == 0) {
+ t = pVesa->monitor->timings2;
+ for (i = 0; i < STD_TIMINGS; i++) {
+ if (t[i].hsize > 256) { /* sanity check */
+ if (t[i].refresh < vmin)
+ vmin = t[i].refresh;
+ if (t[i].refresh > vmax)
+ vmax = t[i].refresh;
+ h = t[i].refresh * 1.07 * t[i].vsize / 1000.0;
+ if (h < hmin)
+ hmin = h;
+ if (h > hmax)
+ hmax = h;
+ }
+ }
+ if (hmax > 0.0) {
+ pMon->hsync[j].lo = hmin;
+ pMon->hsync[j].hi = hmax;
+ pMon->vrefresh[j].lo = vmin;
+ pMon->vrefresh[j].hi = vmax;
+ j++;
+ }
+ }
+ if (j > 0) {
+ pMon->nHsync = pMon->nVrefresh = j;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Monitor parameters set to DDC-probed values\n");
+ }
+ }
+ }
+
i = VBEValidateModes(pScrn, NULL, pScrn->display->modes,
NULL, NULL, 0, 2048, 1, 0, 2048,
pScrn->display->virtualX,
@@ -783,12 +862,6 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!VESASetMode(pScrn, pScrn->currentMode))
return (FALSE);
- /* set the viewport */
- VESAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
-
- /* Blank the screen for aesthetic reasons. */
- VESASaveScreen(pScreen, SCREEN_SAVER_ON);
-
/* mi layer */
miClearVisualTypes();
if (!xf86SetDefaultVisual(pScrn, -1))
@@ -981,12 +1054,8 @@ VESAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
static Bool
VESAEnterVT(int scrnIndex, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
-
- if (!VESASetMode(pScrn, pScrn->currentMode))
- return FALSE;
- VESAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
- return TRUE;
+ return (VESASetMode(xf86Screens[scrnIndex],
+ xf86Screens[scrnIndex]->currentMode));
}
static void
@@ -1125,7 +1194,7 @@ VESAMapVidMem(ScrnInfoPtr pScrn)
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DEBUG_VERB,
"virtual address = %p,\n"
- "\tphysical address = 0x%lx, size = %ld\n",
+ "\tphysical address = %p, size = %d\n",
pVesa->base, pScrn->memPhysBase, pVesa->mapSize);
return (pVesa->base != NULL);
@@ -1260,7 +1329,9 @@ VESALoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
static void
WriteAttr(VESAPtr pVesa, int index, int value)
{
- (void) inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET);
+ CARD8 tmp;
+
+ tmp = inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET);
index |= 0x20;
outb(pVesa->ioBase + VGA_ATTR_INDEX, index);
@@ -1270,7 +1341,9 @@ WriteAttr(VESAPtr pVesa, int index, int value)
static int
ReadAttr(VESAPtr pVesa, int index)
{
- (void) inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET);
+ CARD8 tmp;
+
+ tmp = inb(pVesa->ioBase + VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET);
index |= 0x20;
outb(pVesa->ioBase + VGA_ATTR_INDEX, index);
diff --git a/src/vesa.h b/src/vesa.h
index 78b9e1e..cc448eb 100644
--- a/src/vesa.h
+++ b/src/vesa.h
@@ -26,7 +26,7 @@
*
* Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.12 2002/08/06 13:46:27 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.14 2003/01/16 16:09:10 eich Exp $
*/
#ifndef _VESA_H_