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

Submitted by Stefan Dirsch on June 26, 2018, 6:54 p.m.

Details

Message ID 20180626185430.27953-1-sndirsch@suse.de
State New
Headers show
Series "Add check for max[HV]Value to ValidMode hook" ( rev: 2 ) in X.org

Not browsing as part of any series.

Commit Message

Stefan Dirsch June 26, 2018, 6:54 p.m.
xorg-server 1.20 removed this check, so implement this in the driver
itself.

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

Patch hide | download patch | download mbox

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;
 }