[PATCH xf86-video-tseng] Add check for max[HV]Value to ValidMode hook

Stefan Dirsch sndirsch at suse.de
Tue Jun 26 18:54:30 UTC 2018


xorg-server 1.20 removed this check, so implement this in the driver
itself.

Signed-off-by: Stefan Dirsch <sndirsch at suse.de>
---
 src/tseng_driver.c | 8 ++------
 src/tseng_mode.c   | 8 ++++----
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/tseng_driver.c b/src/tseng_driver.c
index 0db62e5..8cbd4d9 100644
--- a/src/tseng_driver.c
+++ b/src/tseng_driver.c
@@ -1037,10 +1037,6 @@ TsengPreInit(ScrnInfoPtr pScrn, int flags)
     else
 	pTseng->Bytesperpixel = 1;  /* this is fake for < 8bpp, but simplifies other code */
 
-    /* hardware limits */
-    pScrn->maxHValue = Tseng_HMAX;
-    pScrn->maxVValue = Tseng_VMAX;
-
     /*
      * This must happen after pScrn->display has been set because
      * xf86SetWeight references it.
@@ -1133,8 +1129,8 @@ TsengPreInit(ScrnInfoPtr pScrn, int flags)
     /* Select valid modes from those available */
     i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
 	pScrn->display->modes, &pTseng->clockRange,
-	NULL, 32, pScrn->maxHValue, 8*pTseng->Bytesperpixel, /* H limits */
-	0, pScrn->maxVValue,	       /* V limits */
+	NULL, 32, Tseng_HMAX, 8*pTseng->Bytesperpixel, /* H limits */
+	0, Tseng_VMAX,		/* V limits */
 	pScrn->display->virtualX,
 	pScrn->display->virtualY,
 	pTseng->FbMapSize,
diff --git a/src/tseng_mode.c b/src/tseng_mode.c
index c96403e..fda2a44 100644
--- a/src/tseng_mode.c
+++ b/src/tseng_mode.c
@@ -35,6 +35,10 @@
 
 #define VGA_BANK 0x3CB
 
+/* CRTC timing limits */
+#define Tseng_HMAX (4096-8)
+#define Tseng_VMAX (2048-1)
+
 void
 vgaHWWriteBank(vgaHWPtr hwp, CARD8 value)
 {
@@ -1016,9 +1020,6 @@ TsengValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
 
     PDEBUG("	TsengValidMode\n");
 
-#ifdef FIXME
-  is this needed? xf86ValidMode gets HMAX and VMAX variables, so it could deal with this.
-  need to recheck hsize with mode->Htotal*mulFactor/divFactor
     /* Check for CRTC timing bits overflow. */
     if (mode->HTotal > Tseng_HMAX) {
 	return MODE_BAD_HVALUE;
@@ -1026,7 +1027,6 @@ TsengValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags)
     if (mode->VTotal > Tseng_VMAX) {
 	return MODE_BAD_VVALUE;
     }
-#endif
 
     return MODE_OK;
 }
-- 
2.16.3



More information about the xorg-devel mailing list