<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>How to avoid ``snowing'' display while performing graphics operations</TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">

<A HREF="S3.html"><EM> Information for S3 Chipset Users</EM></A>
 <b>:</b> <EM>How to avoid ``snowing'' display while performing graphics operations</EM><BR>
<b>Previous:</b> <A HREF="S37.html"><EM>Hints for LCD configuration (S3 Aurora64V+)</EM></A><BR>
<b>Next:</b> <A HREF="S39.html"><EM>New S3 SVGA driver</EM></A>


<HR NOSHADE>
  <H2><A NAME="8"></A>8. How to avoid ``snowing'' display while performing graphics operations</H2>

<p>For cards with the S3 Vision864 chip, there is an automatic correction which
depends on the pixel clock and the memory clock MCLK at which the S3 chip
operates. For most clock chips this value can't be read (only the S3 SDAC
allows reading the MCLK value so far), so this value has to be estimated 
and specified by the user (the default is 60 [MHz]).</p>
<p>With the new `<code>s3MCLK</code>' entry for your <code>XF86Config</code> file, now you can 
specify e.g.</p>
<p>
<blockquote><code>
<pre>
 s3MCLK 55
 
</pre>
</code></blockquote>
</p>
<p>for a 55 MHz MCLK which will reduce snowing. Smaller MCLK values will reduce 
performance a bit so you shouldn't use a too low value (55 or 50 should be a 
good guess in most cases).</p>
<p>Below is a small shell script which might be useful to determine the
approximate value for MCLK (about +/- 1-2 MHz error). Before running
this script you have to add the line</p>
<p>
<blockquote><code>
<pre>
 s3MNadjust -31 255
 
</pre>
</code></blockquote>
</p>
<p>to the device section in your <code>XF86Config</code> file and restart X Windows.
With this option (which is for testing and debugging only) you'll get
lots of disastrous display flickering and snowing, so it should be removed
again immediately after running the test script below.</p>
<p>Running this script will use xbench and/or x11perf to run a test to determine
the MLCK value, which is printed in MHz. Up to 4 tests are run, so you'll
get up to 4 estimates (where the first might be the most accurate one).</p>
<p>
<hr>
<pre>
#!/bin/sh

exec 2&gt; /dev/null

scale=2

calc() {
  m=`awk 'BEGIN{printf "%.'$scale'f\n",'"( $1 + $2 ) / $3; exit}" `
  [ -z "$m" ] &amp;&amp; m=` echo "scale=$scale; ( $1 + $2 ) / $3" | bc `
  [ -z "$m" ] &amp;&amp; m=` echo "$scale $1 $2 + $3 / pq" | dc `
  echo $m
}

run_xbench() { 
  r=` ( echo 1; echo 2; echo 3; echo 4 ) | xbench -only $1 | grep rate `
  [ -z "$r" ] &amp;&amp; return
  cp="$2 $3"
  set $r
  calc $3 $cp
}  

run_x11perf() {
  r=` x11perf $1 | grep trep | tr '(/)' '   ' `
  [ -z "$r" ] &amp;&amp; return
  cp="$2 $3"
  set $r
  calc `calc 1000 0 $4` $cp    
}

run_x11perf "-rect500 -rop GXxor"     3.86  5.53  #  0 1  #    4.11    5.52  #
run_xbench invrects500                4.63  5.48  #  0 1  #    4.69    5.48  #

run_x11perf "-rect500 -rop GXcopy"  -16.42 13.90  #  0 1  #  -14.99   13.88  #
run_xbench fillrects500              -7.81 13.57  #  0 1  #   -8.53   13.58  #

exit
</pre>
<hr>
</p>

 <HR NOSHADE>
<A HREF="S3.html"><EM> Information for S3 Chipset Users</EM></A>
 <b>:</b> <EM>How to avoid ``snowing'' display while performing graphics operations</EM><BR>
<b>Previous:</b> <A HREF="S37.html"><EM>Hints for LCD configuration (S3 Aurora64V+)</EM></A><BR>
<b>Next:</b> <A HREF="S39.html"><EM>New S3 SVGA driver</EM></A>



</BODY>
</HTML>
