Skip to contentSkip to conversation

atyfb: another double scan fix

PATCH New Ville Syrjälä 1 participant 1 message Feb 11, 2004 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atyfb: another double scan fix

Here's another doublescan fix for atyfb.

Previosly var<->crtc conversion would do different things depending on which way the conversion was made.
var->crtc: vdisp = ((yres-1)<<1)
crtc->var: yres = ((vdisp+1)>>1)

That's obviously wrong. And thus fbset would report incorrect yres value. The patch changes var->crtc conversion to do vdisp = ((yres<<1)-1).

I'm not entirely sure which way is the right way but at least now things work as expected.

Signature · 3 lines
Ville Syrjälä
[email protected]
http://www.sci.fi/~syrjala/
drivers/video/aty/atyfb_base.c renamed from drivers/video/aty/atyfb_base.c.pan +13 -13
@@ -600,6 +600,18 @@
     sync = var->sync;
     vmode = var->vmode;
 
+    /* In double scan mode, the vertical parameters need to be doubled.
+       But in interlaced mode, there is no need to half the vertical parameters.
+       Code has been tested in 1024x768, 43 Hz interlaced and 640x480, 60 Hz
+       double scan.
+     */
+    if ((vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+        ryres <<= 1;
+        upper <<= 1;
+        lower <<= 1;
+        vslen <<= 1;
+    }
+
     /* convert (and round up) and validate */
     xres = (xres+7) & ~7;
     xoffset = (xoffset+7) & ~7;
@@ -623,7 +635,7 @@
 
     if (vyres < yres+yoffset)
         vyres = yres+yoffset;
-    v_disp = yres-1;
+    v_disp = ryres-1;
     if (v_disp > 0x7ff)
         FAIL("v_disp too large");
     v_sync_strt = v_disp+lower;
@@ -636,18 +648,6 @@
     if (v_total > 0x7ff)
         FAIL("v_total too large");
     v_sync_pol = sync & FB_SYNC_VERT_HIGH_ACT ? 0 : 1;
-    /* In double scan mode, the vertical parameters need to be doubled.
-       But in interlaced mode, there is no need to half the vertical parameters.
-       Code has been tested in 1024x768, 43 Hz interlaced and 640x480, 60 Hz
-       double scan.
-     */
-   if ((vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
-       ryres <<= 1;
-       v_total <<= 1;
-       v_disp <<= 1;
-       v_sync_strt <<= 1;
-       v_sync_wid <<= 1;
-   };
                                                            
     c_sync = sync & FB_SYNC_COMP_HIGH_ACT ? CRTC_CSYNC_EN : 0;