xserver: Branch 'server-1.2-branch' - 30 commits

Adam Jackson ajax at kemper.freedesktop.org
Wed Oct 11 23:13:26 EEST 2006


 dix/globals.c                       |    2 
 fb/Makefile.am                      |   10 
 fb/fb.h                             |  118 ------
 fb/fb24_32.c                        |   74 +---
 fb/fballpriv.c                      |    5 
 fb/fbarc.c                          |    1 
 fb/fbbits.c                         |   16 
 fb/fbbits.h                         |   35 -
 fb/fbblt.c                          |  138 +++----
 fb/fbbltone.c                       |   96 ++---
 fb/fbcompose.c                      |  663 +++++++++++++++++-------------------
 fb/fbcopy.c                         |   10 
 fb/fbedge.c                         |   16 
 fb/fbedgeimp.h                      |   10 
 fb/fbfill.c                         |   13 
 fb/fbgc.c                           |   13 
 fb/fbgetsp.c                        |    2 
 fb/fbglyph.c                        |   18 
 fb/fbimage.c                        |    6 
 fb/fbpict.c                         |  109 +----
 fb/fbpict.h                         |   29 -
 fb/fbpixmap.c                       |   12 
 fb/fbpoint.c                        |    7 
 fb/fbpseudocolor.c                  |    6 
 fb/fbpush.c                         |    7 
 fb/fbscreen.c                       |   40 --
 fb/fbseg.c                          |   28 -
 fb/fbsetsp.c                        |    1 
 fb/fbsolid.c                        |   42 +-
 fb/fbstipple.c                      |    6 
 fb/fbtile.c                         |    6 
 fb/fbtrap.c                         |    4 
 fb/fbwindow.c                       |    8 
 fb/wfbrename.h                      |  198 ----------
 hw/xfree86/common/xf86AutoConfig.c  |    3 
 hw/xfree86/common/xf86Config.c      |   51 ++
 hw/xfree86/common/xf86Helper.c      |    6 
 hw/xfree86/common/xf86Mode.c        |  545 ++++++++++++-----------------
 hw/xfree86/common/xf86str.h         |    1 
 hw/xfree86/ddc/ddcProperty.c        |  585 +++++++++++++++++++++++++------
 hw/xfree86/ddc/interpret_edid.c     |   39 ++
 hw/xfree86/ddc/xf86DDC.h            |    3 
 hw/xfree86/dixmods/Makefile.am      |    6 
 hw/xfree86/dixmods/fbmodule.c       |    6 
 hw/xfree86/dri/dri.c                |   22 -
 hw/xfree86/os-support/drm/xf86drm.c |   16 
 hw/xfree86/os-support/xf86drm.h     |    3 
 47 files changed, 1428 insertions(+), 1607 deletions(-)

New commits:
diff-tree 4b5ca6b3dfeb3b1bb7718902b34b6870fd526c79 (from 6e2958c5c5893542677b1ec8cc7479f8b45fb829)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Mon Oct 2 02:15:36 2006 +0300

    symlink-mesa.sh: expand *.{c,h}
    (cherry picked from d7c89c7c1c8c1e110345d9d8d300adbf5fe5804a commit)

diff --git a/GL/symlink-mesa.sh b/GL/symlink-mesa.sh
index 88dddfc..c14c683 100755
--- a/GL/symlink-mesa.sh
+++ b/GL/symlink-mesa.sh
@@ -62,7 +62,7 @@ symlink_mesa_glapi() {
     src_dir src/mesa/glapi
     dst_dir mesa/glapi
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -71,7 +71,7 @@ symlink_mesa_main() {
     src_dir src/mesa/main
     dst_dir mesa/main
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -80,7 +80,7 @@ symlink_mesa_math() {
     src_dir src/mesa/math
     dst_dir mesa/math
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -89,7 +89,7 @@ symlink_mesa_ac() {
     src_dir src/mesa/array_cache
     dst_dir mesa/array_cache
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -98,7 +98,7 @@ symlink_mesa_swrast() {
     src_dir src/mesa/swrast
     dst_dir mesa/swrast
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -107,7 +107,7 @@ symlink_mesa_ss() {
     src_dir src/mesa/swrast_setup
     dst_dir mesa/swrast_setup
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -116,7 +116,7 @@ symlink_mesa_tnl() {
     src_dir src/mesa/tnl
     dst_dir mesa/tnl
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -125,7 +125,7 @@ symlink_mesa_shader() {
     src_dir src/mesa/shader
     dst_dir mesa/shader
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -134,7 +134,7 @@ symlink_mesa_shader_grammar() {
     src_dir src/mesa/shader/grammar
     dst_dir mesa/shader/grammar
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -143,7 +143,7 @@ symlink_mesa_shader_slang() {
     src_dir src/mesa/shader/slang
     dst_dir mesa/shader/slang
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }
@@ -152,7 +152,7 @@ symlink_mesa_shader_slang_library() {
     src_dir src/mesa/shader/slang/library
     dst_dir mesa/shader/slang/library
 
-    for src in $REAL_SRC_DIR/*.{c,h}; do
+    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
         action `basename $src`
     done
 }        
diff-tree 6e2958c5c5893542677b1ec8cc7479f8b45fb829 (from 4c7d76cbac42acf486b4fe2166220362a551f8f4)
Author: Ivan Pascal <pascal at info.tsu.ru>
Date:   Mon Oct 2 02:17:14 2006 +0300

    xkb: fix wrapping when switching between groups
    Use XkbCharToInt as that's what we're doing.
    (cherry picked from d6ea96b13e2ea01c51998c41ae2a3677bdedf61c commit)

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index ee0abbe..26ff35e 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -754,12 +754,12 @@ unsigned char	grp;
 
 
     grp= state->locked_group;
-    if (grp>=ctrls->num_groups || grp < 0)
-	state->locked_group= XkbAdjustGroup(grp,ctrls);
+    if (grp>=ctrls->num_groups)
+	state->locked_group= XkbAdjustGroup(XkbCharToInt(grp),ctrls);
 
     grp= state->locked_group+state->base_group+state->latched_group;
-    if (grp>=ctrls->num_groups || grp < 0)
-	 state->group= XkbAdjustGroup(grp,ctrls);
+    if (grp>=ctrls->num_groups)
+	 state->group= XkbAdjustGroup(XkbCharToInt(grp),ctrls);
     else state->group= grp;
     XkbComputeCompatState(xkbi);
     return;
diff-tree 4c7d76cbac42acf486b4fe2166220362a551f8f4 (from e95920b7d79bcd7d3d22ccbb6ebeb6ef0da96ef2)
Author: Brian <brian at yutani.localnet.net>
Date:   Thu Sep 28 15:09:40 2006 -0600

    Replace hard-coded filesnames with loops (all .c and .h files).
    Should fix problems with Mesa adding/removing source files, for the most part.
    Patch by Dan Nicholson.
    (cherry picked from 84eb2c0a06de60e88e14bb03fabe661d7cd8f1d3 commit)

diff --git a/GL/symlink-mesa.sh b/GL/symlink-mesa.sh
index a836866..88dddfc 100755
--- a/GL/symlink-mesa.sh
+++ b/GL/symlink-mesa.sh
@@ -62,417 +62,99 @@ symlink_mesa_glapi() {
     src_dir src/mesa/glapi
     dst_dir mesa/glapi
 
-    action dispatch.h
-    action glapi.c
-    action glapi.h
-    action glapioffsets.h
-    action glapitable.h
-    action glapitemp.h
-    action glprocs.h
-    action glthread.c
-    action glthread.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_main() {
     src_dir src/mesa/main
     dst_dir mesa/main
 
-    action accum.c
-    action accum.h
-    action api_arrayelt.c
-    action api_arrayelt.h
-    action api_eval.h
-    action api_loopback.c
-    action api_loopback.h
-    action api_noop.c
-    action api_noop.h
-    action api_validate.c
-    action api_validate.h
-    action arrayobj.c
-    action arrayobj.h
-    action attrib.c
-    action attrib.h
-    action bitset.h
-    action blend.c
-    action blend.h
-    action bufferobj.c
-    action bufferobj.h
-    action buffers.c
-    action buffers.h
-    action clip.c
-    action clip.h
-    action colormac.h
-    action colortab.c
-    action colortab.h
-    action config.h
-    action context.c
-    action context.h
-    action convolve.c
-    action convolve.h
-    action dd.h
-    action debug.c
-    action debug.h
-    action depth.c
-    action depth.h
-    action depthstencil.c
-    action depthstencil.h
-    action dlist.c
-    action dlist.h
-    action drawpix.c
-    action drawpix.h
-    action enable.c
-    action enable.h
-    action enums.c
-    action enums.h
-    action eval.c
-    action eval.h
-    action execmem.c
-    action extensions.c
-    action extensions.h
-    action fbobject.c
-    action fbobject.h
-    action feedback.c
-    action feedback.h
-    action fog.c
-    action fog.h
-    action framebuffer.c
-    action framebuffer.h
-    action get.c
-    action get.h
-    action getstring.c
-    action glheader.h
-    action hash.c
-    action hash.h
-    action hint.c
-    action hint.h
-    action histogram.c
-    action histogram.h
-    action image.c
-    action image.h
-    action imports.c
-    action imports.h
-    action light.c
-    action light.h
-    action lines.c
-    action lines.h
-    action macros.h
-    action matrix.c
-    action matrix.h
-    action mm.c
-    action mm.h
-    action mtypes.h
-    action occlude.c
-    action occlude.h
-    action pixel.c
-    action pixel.h
-    action points.c
-    action points.h
-    action polygon.c
-    action polygon.h
-    action rastpos.c
-    action rastpos.h
-    action rbadaptors.c
-    action rbadaptors.h
-    action renderbuffer.c
-    action renderbuffer.h
-    action simple_list.h
-    action state.c
-    action state.h
-    action stencil.c
-    action stencil.h
-    action texcompress.c
-    action texcompress.h
-    action texcompress_fxt1.c
-    action texcompress_s3tc.c
-    action texenvprogram.c
-    action texenvprogram.h
-    action texformat.c
-    action texformat.h
-    action texformat_tmp.h
-    action teximage.c
-    action teximage.h
-    action texobj.c
-    action texobj.h
-    action texrender.c
-    action texrender.h
-    action texstate.c
-    action texstate.h
-    action texstore.c
-    action texstore.h
-    action varray.c
-    action varray.h
-    action version.h
-    action vsnprintf.c
-    action vtxfmt.c
-    action vtxfmt.h
-    action vtxfmt_tmp.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_math() {
     src_dir src/mesa/math
     dst_dir mesa/math
 
-    action m_clip_tmp.h
-    action m_copy_tmp.h
-    action m_debug.h
-    action m_debug_clip.c
-    action m_debug_norm.c
-    action m_debug_util.h
-    action m_debug_xform.c
-    action m_dotprod_tmp.h
-    action m_eval.c
-    action m_eval.h
-    action m_matrix.c
-    action m_matrix.h
-    action m_norm_tmp.h
-    action m_trans_tmp.h
-    action m_translate.c
-    action m_translate.h
-    action m_vector.c
-    action m_vector.h
-    action m_xform.c
-    action m_xform.h
-    action m_xform_tmp.h
-    action mathmod.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_ac() {
     src_dir src/mesa/array_cache
     dst_dir mesa/array_cache
 
-    action ac_context.c
-    action ac_context.h
-    action ac_import.c
-    action acache.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_swrast() {
     src_dir src/mesa/swrast
     dst_dir mesa/swrast
 
-    action s_aaline.c
-    action s_aaline.h
-    action s_aalinetemp.h
-    action s_aatriangle.c
-    action s_aatriangle.h
-    action s_aatritemp.h
-    action s_accum.c
-    action s_accum.h
-    action s_alpha.c
-    action s_alpha.h
-    action s_arbshader.c
-    action s_arbshader.h
-    action s_atifragshader.c
-    action s_atifragshader.h
-    action s_bitmap.c
-    action s_blend.c
-    action s_blend.h
-    action s_blit.c
-    action s_buffers.c
-    action s_context.c
-    action s_context.h
-    action s_copypix.c
-    action s_depth.c
-    action s_depth.h
-    action s_drawpix.c
-    action s_drawpix.h
-    action s_feedback.c
-    action s_feedback.h
-    action s_fog.c
-    action s_fog.h
-    action s_imaging.c
-    action s_lines.c
-    action s_lines.h
-    action s_linetemp.h
-    action s_logic.c
-    action s_logic.h
-    action s_masking.c
-    action s_masking.h
-    action s_nvfragprog.c
-    action s_nvfragprog.h
-    action s_points.c
-    action s_points.h
-    action s_pointtemp.h
-    action s_readpix.c
-    action s_span.c
-    action s_span.h
-    action s_spantemp.h
-    action s_stencil.c
-    action s_stencil.h
-    action s_texcombine.c
-    action s_texcombine.h
-    action s_texfilter.c
-    action s_texfilter.h
-    action s_texstore.c
-    action s_triangle.c
-    action s_triangle.h
-    action s_trispan.h
-    action s_tritemp.h
-    action s_zoom.c
-    action s_zoom.h
-    action swrast.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_ss() {
     src_dir src/mesa/swrast_setup
     dst_dir mesa/swrast_setup
 
-    action ss_context.c
-    action ss_context.h
-    action ss_triangle.c
-    action ss_triangle.h
-    action ss_tritmp.h
-    action ss_vb.h
-    action swrast_setup.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_tnl() {
     src_dir src/mesa/tnl
     dst_dir mesa/tnl
 
-    action t_array_api.c
-    action t_array_api.h
-    action t_array_import.c
-    action t_array_import.h
-    action t_context.c
-    action t_context.h
-    action t_pipeline.c
-    action t_pipeline.h
-    action t_save_api.c
-    action t_save_api.h
-    action t_save_loopback.c
-    action t_save_playback.c
-    action t_vb_arbprogram.c
-    action t_vb_arbprogram.h
-    action t_vb_arbprogram_sse.c
-    action t_vb_arbshader.c
-    action t_vb_cliptmp.h
-    action t_vb_cull.c
-    action t_vb_fog.c
-    action t_vb_light.c
-    action t_vb_lighttmp.h
-    action t_vb_normals.c
-    action t_vb_points.c
-    action t_vb_program.c
-    action t_vb_render.c
-    action t_vb_rendertmp.h
-    action t_vb_texgen.c
-    action t_vb_texmat.c
-    action t_vb_vertex.c
-    action t_vertex.c
-    action t_vertex.h
-    action t_vertex_generic.c
-    action t_vertex_sse.c
-    action t_vp_build.c
-    action t_vp_build.h
-    action t_vtx_api.c
-    action t_vtx_api.h
-    action t_vtx_eval.c
-    action t_vtx_exec.c
-    action t_vtx_generic.c
-    action t_vtx_x86.c
-    action tnl.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_shader() {
     src_dir src/mesa/shader
     dst_dir mesa/shader
 
-    action arbprogparse.c
-    action arbprogparse.h
-    action arbprogram.c
-    action arbprogram.h
-    action arbprogram_syn.h
-    action atifragshader.c
-    action atifragshader.h
-    action nvfragparse.c
-    action nvfragparse.h
-    action nvprogram.c
-    action nvprogram.h
-    action nvvertexec.c
-    action nvvertexec.h
-    action nvvertparse.c
-    action nvvertparse.h
-    action program.c
-    action program.h
-    action program_instruction.h
-    action shaderobjects.c
-    action shaderobjects.h
-    action shaderobjects_3dlabs.c
-    action shaderobjects_3dlabs.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_shader_grammar() {
     src_dir src/mesa/shader/grammar
     dst_dir mesa/shader/grammar
 
-    action grammar.c
-    action grammar.h
-    action grammar_syn.h
-    action grammar_mesa.c
-    action grammar_mesa.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_shader_slang() {
     src_dir src/mesa/shader/slang
     dst_dir mesa/shader/slang
 
-    action slang_analyse.c
-    action slang_analyse.h
-    action slang_assemble.c
-    action slang_assemble.h
-    action slang_assemble_assignment.c
-    action slang_assemble_assignment.h
-    action slang_assemble_conditional.c
-    action slang_assemble_conditional.h
-    action slang_assemble_constructor.c
-    action slang_assemble_constructor.h
-    action slang_assemble_typeinfo.c
-    action slang_assemble_typeinfo.h
-    action slang_compile.c
-    action slang_compile.h
-    action slang_compile_function.c
-    action slang_compile_function.h
-    action slang_compile_operation.c
-    action slang_compile_operation.h
-    action slang_compile_struct.c
-    action slang_compile_struct.h
-    action slang_compile_variable.c
-    action slang_compile_variable.h
-    action slang_execute.c
-    action slang_execute.h
-    action slang_execute_x86.c
-    action slang_export.c
-    action slang_export.h
-    action slang_library_noise.c
-    action slang_library_noise.h
-    action slang_library_texsample.c
-    action slang_library_texsample.h
-    action slang_link.c
-    action slang_link.h
-    action slang_mesa.h
-    action slang_preprocess.c
-    action slang_preprocess.h
-    action slang_storage.c
-    action slang_storage.h
-    action slang_utility.c
-    action slang_utility.h
-    action traverse_wrap.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }
 
 symlink_mesa_shader_slang_library() {
     src_dir src/mesa/shader/slang/library
     dst_dir mesa/shader/slang/library
 
-    action slang_builtin_vec4_gc.h
-    action slang_common_builtin_gc.h
-    action slang_core_gc.h
-    action slang_fragment_builtin_gc.h
-    action slang_shader_syn.h
-    action slang_pp_directives_syn.h
-    action slang_pp_expression_syn.h
-    action slang_pp_version_syn.h
-    action slang_vertex_builtin_gc.h
+    for src in $REAL_SRC_DIR/*.{c,h}; do
+        action `basename $src`
+    done
 }        
 
 symlink_mesa_x() {
diff-tree e95920b7d79bcd7d3d22ccbb6ebeb6ef0da96ef2 (from d3c668878140c60ce9c5db6f65ea2cb8fd8a2b4e)
Author: Jeff Smith <whydoubt at yahoo.com>
Date:   Thu Sep 28 15:34:17 2006 -0400

    Bug #8449: Yet another Mesa symlink script resync.
    (cherry picked from cf6e9687ffcc52af0d64e9098186570719a575a2 commit)

diff --git a/GL/symlink-mesa.sh b/GL/symlink-mesa.sh
index 7b5ed5c..a836866 100755
--- a/GL/symlink-mesa.sh
+++ b/GL/symlink-mesa.sh
@@ -464,10 +464,13 @@ symlink_mesa_shader_slang_library() {
     src_dir src/mesa/shader/slang/library
     dst_dir mesa/shader/slang/library
 
+    action slang_builtin_vec4_gc.h
     action slang_common_builtin_gc.h
     action slang_core_gc.h
     action slang_fragment_builtin_gc.h
     action slang_shader_syn.h
+    action slang_pp_directives_syn.h
+    action slang_pp_expression_syn.h
     action slang_pp_version_syn.h
     action slang_vertex_builtin_gc.h
 }        
diff-tree d3c668878140c60ce9c5db6f65ea2cb8fd8a2b4e (from 32c293aa1c718b4884b803ec528afd2911454994)
Author: Brian <brian at yutani.localnet.net>
Date:   Sat Sep 23 10:38:10 2006 -0600

    Check for visual==NULL in dmxBECreateColormap() before calling XCreateColormap()
    to prevent potential segfault.
    (cherry picked from f7c1d942416db8d0d4c5a21f5ece1ccacb926b69 commit)

diff --git a/hw/dmx/dmxcmap.c b/hw/dmx/dmxcmap.c
index b4279e7..9a9781f 100644
--- a/hw/dmx/dmxcmap.c
+++ b/hw/dmx/dmxcmap.c
@@ -40,6 +40,7 @@
 #endif
 
 #include "dmx.h"
+#include "dmxlog.h"
 #include "dmxsync.h"
 #include "dmxcmap.h"
 #include "dmxvisual.h"
@@ -83,12 +84,18 @@ Bool dmxBECreateColormap(ColormapPtr pCo
     VisualPtr           pVisual   = pColormap->pVisual;
     Visual             *visual    = dmxLookupVisual(pScreen, pVisual);
 
-    pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
-				      dmxScreen->scrnWin,
-				      visual,
-				      (pVisual->class & DynamicClass ?
-				       AllocAll : AllocNone));
-    return (pCmapPriv->cmap != 0);
+    if (visual) {
+       pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
+                                         dmxScreen->scrnWin,
+                                         visual,
+                                         (pVisual->class & DynamicClass ?
+                                          AllocAll : AllocNone));
+       return (pCmapPriv->cmap != 0);
+    }
+    else {
+       dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n");
+       return 0;
+    }
 }
 
 /** Create colormap on back-end server associated with \a pColormap's
diff-tree 32c293aa1c718b4884b803ec528afd2911454994 (from 26a94bab11033c1746962ffba6de57cfbec6f3be)
Author: Brian <brian at yutani.localnet.net>
Date:   Sat Sep 23 10:35:25 2006 -0600

    The fbcmap.c file used by Xdmx _must_ be compiled with XFree86Server defined.
    Otherwise, Xdmx generates a slew of protocol errors.
    (cherry picked from 945b7c63946f5257d0f9b0dcf2f8f4882fb2c6f8 commit)

diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index d36647b..89136b9 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -16,6 +16,9 @@ GLX_INCS = -I$(top_srcdir)/hw/xfree86/di
 GLX_DEFS = @GL_CFLAGS@ 
 endif
 
+# It's essential that fbcmap.c be compiled with this flag for DMX to work!!
+DMX_CFLAGS = -DXFree86Server=1
+
 if BUILDDOCS
 SUBDIRS += doc
 endif
@@ -86,6 +89,7 @@ Xdmx_CFLAGS = \
               $(DIX_CFLAGS) \
               $(GLX_INCS) \
               $(GLX_DEFS) \
+              $(DMX_CFLAGS) \
               @DMXMODULES_CFLAGS@
 
 # Man page
diff-tree 26a94bab11033c1746962ffba6de57cfbec6f3be (from c559940c108642068b6107b33ce1e9a0760b5d5f)
Author: Brian <brian at yutani.localnet.net>
Date:   Sat Sep 23 10:28:24 2006 -0600

    Replace broken DMXDBG3() with DMXDBG2()
    (cherry picked from 891e9c3e6cbd0869a57395b96c8e18ff522c2bb4 commit)

diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index a49fc9f..e74a052 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -664,8 +664,8 @@ static Bool _dmxUnrealizeCursor(ScreenPt
 {
     DMXScreenInfo    *dmxScreen = &dmxScreens[pScreen->myNum];
 
-    DMXDBG3("_dmxUnrealizeCursor(%d,%p) %p\n",
-            pScreen->myNum, pCursor, pCursorPriv);
+    DMXDBG2("_dmxUnrealizeCursor(%d,%p)\n",
+            pScreen->myNum, pCursor);
 
     if (dmxScreen->beDisplay) {
 	if (dmxBEFreeCursor(pScreen, pCursor))
diff-tree c559940c108642068b6107b33ce1e9a0760b5d5f (from b84fb534fb5e494a57ee76317e8f136a87170f5f)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 21 20:42:47 2006 -0400

    Close with Pclose() that which we open with Popen().
    (cherry picked from ce78b0cd2b1c35d60eb5683a1d00222aa4797c79 commit)

diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index f94a869..034f694 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -269,7 +269,7 @@ char	tmpname[PATH_MAX];
 #ifndef WIN32
     if (haveDir)
 	fclose(in);
-    else if ((rval=pclose(in))!=0) {
+    else if ((rval=Pclose(in))!=0) {
 	if (xkbDebugFlags)
 	    ErrorF("xkbcomp returned exit code %d\n",rval);
     }
diff-tree b84fb534fb5e494a57ee76317e8f136a87170f5f (from 27f0a0066f5adecf00e00654fdcf854b8fa7c393)
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Thu Sep 21 14:45:17 2006 -0700

    Bug 8386: Grow parser buffers to fit an entire line if it's longer than CONFIG_BUF_LEN.
    (cherry picked from c1655f0fd457f9bdf0857c5e0904639925bb01f1 commit)

diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index 5b29ab8..f81c45a 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -157,9 +157,128 @@ xf86strToUL (char *str)
 	return (tot);
 }
 
+/*
+ * xf86getNextLine --
+ *
+ *  read from the configFile FILE stream until we encounter a new
+ *  line; this is effectively just a big wrapper for fgets(3).
+ *
+ *  xf86getToken() assumes that we will read up to the next
+ *  newline; we need to grow configBuf and configRBuf as needed to
+ *  support that.
+ */
+
+static char*
+xf86getNextLine(void)
+{
+	static int configBufLen = CONFIG_BUF_LEN;
+	char *tmpConfigBuf, *tmpConfigRBuf;
+	int c, i, pos = 0, eolFound = 0;
+	char *ret = NULL;
+
+	/*
+	 * reallocate the string if it was grown last time (i.e., is no
+	 * longer CONFIG_BUF_LEN); we malloc the new strings first, so
+	 * that if either of the mallocs fail, we can fall back on the
+	 * existing buffer allocations
+	 */
+
+	if (configBufLen != CONFIG_BUF_LEN) {
+
+		tmpConfigBuf = xf86confmalloc(CONFIG_BUF_LEN);
+		tmpConfigRBuf = xf86confmalloc(CONFIG_BUF_LEN);
+
+		if (!tmpConfigBuf || !tmpConfigRBuf) {
+
+			/*
+			 * at least one of the mallocs failed; keep the old buffers
+			 * and free any partial allocations
+			 */
+
+			xf86conffree(tmpConfigBuf);
+			xf86conffree(tmpConfigRBuf);
+
+		} else {
+
+			/*
+			 * malloc succeeded; free the old buffers and use the new
+			 * buffers
+			 */
+
+			configBufLen = CONFIG_BUF_LEN;
+
+			xf86conffree(configBuf);
+			xf86conffree(configRBuf);
+
+			configBuf = tmpConfigBuf;
+			configRBuf = tmpConfigRBuf;
+		}
+	}
+
+	/* read in another block of chars */
+
+	do {
+		ret = fgets(configBuf + pos, configBufLen - pos - 1, configFile);
+
+		if (!ret) break;
+
+		/* search for EOL in the new block of chars */
+
+		for (i = pos; i < (configBufLen - 1); i++) {
+			c = configBuf[i];
+
+			if (c == '\0') break;
+
+			if ((c == '\n') || (c == '\r')) {
+				eolFound = 1;
+				break;
+			}
+		}
+
+		/*
+		 * if we didn't find EOL, then grow the string and
+		 * read in more
+		 */
+
+		if (!eolFound) {
+
+			tmpConfigBuf = xf86confrealloc(configBuf, configBufLen + CONFIG_BUF_LEN);
+			tmpConfigRBuf = xf86confrealloc(configRBuf, configBufLen + CONFIG_BUF_LEN);
+
+			if (!tmpConfigBuf || !tmpConfigRBuf) {
+
+				/*
+				 * at least one of the reallocations failed; use the
+				 * new allocation that succeeded, but we have to
+				 * fallback to the previous configBufLen size and use
+				 * the string we have, even though we don't have an
+				 * EOL
+				 */
+
+				if (tmpConfigBuf) configBuf = tmpConfigBuf;
+				if (tmpConfigRBuf) configRBuf = tmpConfigRBuf;
+
+				break;
+
+			} else {
+
+				/* reallocation succeeded */
+
+				configBuf = tmpConfigBuf;
+				configRBuf = tmpConfigRBuf;
+				pos = i;
+				configBufLen += CONFIG_BUF_LEN;
+			}
+		}
+
+	} while (!eolFound);
+
+	return (ret);
+}
+
 /* 
  * xf86getToken --
- *      Read next Token form the config file. Handle the global variable
+ *      Read next Token from the config file. Handle the global variable
  *      pushToken.
  */
 int
@@ -193,7 +312,7 @@ again:
 		{
 			char *ret;
 			if (configFile)
-				ret = fgets (configBuf, CONFIG_BUF_LEN - 1, configFile);
+				ret = xf86getNextLine();
 			else {
 				if (builtinConfig[builtinIndex] == NULL)
 					ret = NULL;
diff-tree 27f0a0066f5adecf00e00654fdcf854b8fa7c393 (from 0790665ff02bb091177ea81ea4b545fd8d078b61)
Author: Drew Parsons <dparsons at debian.org>
Date:   Thu Sep 21 22:19:44 2006 +1000

    * Install Xprint's Xsession script to $(sysconfdir)/X11/Xsession.d
    * Removing outdated references to CDE and dt, rename script to
      92xprint-xpserverlist.
    (cherry picked from 8b4ed47c5d39f219866e3c72fa973c6fc4c70f18 commit)

diff --git a/hw/xprint/etc/Xsession.d/92xprint-xpserverlist b/hw/xprint/etc/Xsession.d/92xprint-xpserverlist
new file mode 100644
index 0000000..60d964a
--- /dev/null
+++ b/hw/xprint/etc/Xsession.d/92xprint-xpserverlist
@@ -0,0 +1,30 @@
+#!/bin/sh 
+#####################################################################
+###  File:              92xprint-xpserverlist
+###
+###  Default Location:  /etc/X11/Xsession.d/
+###
+###  Purpose:           Setup Xprint env vars
+###                     
+###  Description:       This script is invoked by means of the Xsession file
+###                     at user login. 
+###
+###  Invoked by:        /etc/X11/Xsession
+###
+###  (c) Copyright 2003-2004 Roland Mainz <roland.mainz at nrubsig.org>
+###
+###  please send bugfixes or comments to https://bugs.freedesktop.org
+###
+#####################################################################
+
+
+#
+# Obtain list of Xprint servers
+#
+
+if [ -x "/etc/init.d/xprint" ] ; then
+  XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`"
+  export XPSERVERLIST
+fi
+
+##########################         eof       #####################
diff --git a/hw/xprint/etc/Xsession.d/Makefile.am b/hw/xprint/etc/Xsession.d/Makefile.am
index e0277d9..96a5ee7 100644
--- a/hw/xprint/etc/Xsession.d/Makefile.am
+++ b/hw/xprint/etc/Xsession.d/Makefile.am
@@ -1 +1,2 @@
-EXTRA_DIST = cde_xsessiond_xprint.sh
+xpcdir = $(sysconfdir)/X11/Xsession.d
+dist_xpc_DATA = 92xprint-xpserverlist
diff-tree 0790665ff02bb091177ea81ea4b545fd8d078b61 (from e862a70a384f07cb3742632ef6921a0ab8b2aa91)
Author: Donnie Berkholz <donnie at supernova.(none)>
Date:   Wed Sep 20 15:39:39 2006 -0700

    Really fix sparc on 64-bit kernel/32-bit userland.
    
    Commit b3a3020fd018df8bc5a8193d36e1a1c7ae8af8ba used a sparc64 ifdef instead of
    sparc. But for 32-bit userland, __sparc64__ is not defined so the wrong code is
    used.
    (cherry picked from d812f486a01a6276aed7b4ebd3cd8eb8ddfe10d3 commit)

diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index a97e6f0..c6dad1f 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -85,7 +85,7 @@ static pciBusFuncs_t linuxFuncs0 = {
 /* pciAddrHostToBus */	pciAddrNOOP,
 /* linuxTransAddrBusToHost is busted on sparc64 but the PCI rework tree
  * makes it all moot, so we kludge it for now */
-#if defined(__sparc64__)
+#if defined(__sparc__)
 /* pciAddrBusToHost */  pciAddrNOOP,
 #else
 /* pciAddrBusToHost */	linuxTransAddrBusToHost,
diff-tree e862a70a384f07cb3742632ef6921a0ab8b2aa91 (from 99d798d06b48cdacb5b8b7369bf49f659dd3970a)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Sat Sep 16 03:49:11 2006 -0400

    Don't install librac.a.
    
    Thanks, automake.
    (cherry picked from f057de4f73fa593fa3fc5f05f65b89e76273b158 commit)

diff --git a/hw/xfree86/rac/Makefile.am b/hw/xfree86/rac/Makefile.am
index 328ed19..2d8d879 100644
--- a/hw/xfree86/rac/Makefile.am
+++ b/hw/xfree86/rac/Makefile.am
@@ -1,4 +1,4 @@
-module_LIBRARIES = librac.a
+noinst_LIBRARIES = librac.a
 librac_a_SOURCES = xf86RAC.c
 
 sdk_HEADERS = xf86RAC.h
diff-tree 99d798d06b48cdacb5b8b7369bf49f659dd3970a (from parents)
Merge: 61f3eb816b47f31e856eca32bca7e2e947faf533 46af6d1e953f1eefb6edbba3d29fb9700e42c2bb
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Wed Oct 11 15:59:54 2006 -0400

    Merge branch 'autoconfig-for-7.2' into server-1.2-branch

diff-tree 61f3eb816b47f31e856eca32bca7e2e947faf533 (from cde68728860179dc84e615ccb378ce992513fd62)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Wed Oct 11 15:56:45 2006 -0400

    Back out merge of master to 1.2 branch.  Undoes 89987ca...
    
    Dear git: please make 'git-revert' work on merge commits kthnxbye.

diff --git a/GL/symlink-mesa.sh b/GL/symlink-mesa.sh
index c14c683..7b5ed5c 100755
--- a/GL/symlink-mesa.sh
+++ b/GL/symlink-mesa.sh
@@ -62,99 +62,414 @@ symlink_mesa_glapi() {
     src_dir src/mesa/glapi
     dst_dir mesa/glapi
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action dispatch.h
+    action glapi.c
+    action glapi.h
+    action glapioffsets.h
+    action glapitable.h
+    action glapitemp.h
+    action glprocs.h
+    action glthread.c
+    action glthread.h
 }
 
 symlink_mesa_main() {
     src_dir src/mesa/main
     dst_dir mesa/main
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action accum.c
+    action accum.h
+    action api_arrayelt.c
+    action api_arrayelt.h
+    action api_eval.h
+    action api_loopback.c
+    action api_loopback.h
+    action api_noop.c
+    action api_noop.h
+    action api_validate.c
+    action api_validate.h
+    action arrayobj.c
+    action arrayobj.h
+    action attrib.c
+    action attrib.h
+    action bitset.h
+    action blend.c
+    action blend.h
+    action bufferobj.c
+    action bufferobj.h
+    action buffers.c
+    action buffers.h
+    action clip.c
+    action clip.h
+    action colormac.h
+    action colortab.c
+    action colortab.h
+    action config.h
+    action context.c
+    action context.h
+    action convolve.c
+    action convolve.h
+    action dd.h
+    action debug.c
+    action debug.h
+    action depth.c
+    action depth.h
+    action depthstencil.c
+    action depthstencil.h
+    action dlist.c
+    action dlist.h
+    action drawpix.c
+    action drawpix.h
+    action enable.c
+    action enable.h
+    action enums.c
+    action enums.h
+    action eval.c
+    action eval.h
+    action execmem.c
+    action extensions.c
+    action extensions.h
+    action fbobject.c
+    action fbobject.h
+    action feedback.c
+    action feedback.h
+    action fog.c
+    action fog.h
+    action framebuffer.c
+    action framebuffer.h
+    action get.c
+    action get.h
+    action getstring.c
+    action glheader.h
+    action hash.c
+    action hash.h
+    action hint.c
+    action hint.h
+    action histogram.c
+    action histogram.h
+    action image.c
+    action image.h
+    action imports.c
+    action imports.h
+    action light.c
+    action light.h
+    action lines.c
+    action lines.h
+    action macros.h
+    action matrix.c
+    action matrix.h
+    action mm.c
+    action mm.h
+    action mtypes.h
+    action occlude.c
+    action occlude.h
+    action pixel.c
+    action pixel.h
+    action points.c
+    action points.h
+    action polygon.c
+    action polygon.h
+    action rastpos.c
+    action rastpos.h
+    action rbadaptors.c
+    action rbadaptors.h
+    action renderbuffer.c
+    action renderbuffer.h
+    action simple_list.h
+    action state.c
+    action state.h
+    action stencil.c
+    action stencil.h
+    action texcompress.c
+    action texcompress.h
+    action texcompress_fxt1.c
+    action texcompress_s3tc.c
+    action texenvprogram.c
+    action texenvprogram.h
+    action texformat.c
+    action texformat.h
+    action texformat_tmp.h
+    action teximage.c
+    action teximage.h
+    action texobj.c
+    action texobj.h
+    action texrender.c
+    action texrender.h
+    action texstate.c
+    action texstate.h
+    action texstore.c
+    action texstore.h
+    action varray.c
+    action varray.h
+    action version.h
+    action vsnprintf.c
+    action vtxfmt.c
+    action vtxfmt.h
+    action vtxfmt_tmp.h
 }
 
 symlink_mesa_math() {
     src_dir src/mesa/math
     dst_dir mesa/math
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action m_clip_tmp.h
+    action m_copy_tmp.h
+    action m_debug.h
+    action m_debug_clip.c
+    action m_debug_norm.c
+    action m_debug_util.h
+    action m_debug_xform.c
+    action m_dotprod_tmp.h
+    action m_eval.c
+    action m_eval.h
+    action m_matrix.c
+    action m_matrix.h
+    action m_norm_tmp.h
+    action m_trans_tmp.h
+    action m_translate.c
+    action m_translate.h
+    action m_vector.c
+    action m_vector.h
+    action m_xform.c
+    action m_xform.h
+    action m_xform_tmp.h
+    action mathmod.h
 }
 
 symlink_mesa_ac() {
     src_dir src/mesa/array_cache
     dst_dir mesa/array_cache
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action ac_context.c
+    action ac_context.h
+    action ac_import.c
+    action acache.h
 }
 
 symlink_mesa_swrast() {
     src_dir src/mesa/swrast
     dst_dir mesa/swrast
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action s_aaline.c
+    action s_aaline.h
+    action s_aalinetemp.h
+    action s_aatriangle.c
+    action s_aatriangle.h
+    action s_aatritemp.h
+    action s_accum.c
+    action s_accum.h
+    action s_alpha.c
+    action s_alpha.h
+    action s_arbshader.c
+    action s_arbshader.h
+    action s_atifragshader.c
+    action s_atifragshader.h
+    action s_bitmap.c
+    action s_blend.c
+    action s_blend.h
+    action s_blit.c
+    action s_buffers.c
+    action s_context.c
+    action s_context.h
+    action s_copypix.c
+    action s_depth.c
+    action s_depth.h
+    action s_drawpix.c
+    action s_drawpix.h
+    action s_feedback.c
+    action s_feedback.h
+    action s_fog.c
+    action s_fog.h
+    action s_imaging.c
+    action s_lines.c
+    action s_lines.h
+    action s_linetemp.h
+    action s_logic.c
+    action s_logic.h
+    action s_masking.c
+    action s_masking.h
+    action s_nvfragprog.c
+    action s_nvfragprog.h
+    action s_points.c
+    action s_points.h
+    action s_pointtemp.h
+    action s_readpix.c
+    action s_span.c
+    action s_span.h
+    action s_spantemp.h
+    action s_stencil.c
+    action s_stencil.h
+    action s_texcombine.c
+    action s_texcombine.h
+    action s_texfilter.c
+    action s_texfilter.h
+    action s_texstore.c
+    action s_triangle.c
+    action s_triangle.h
+    action s_trispan.h
+    action s_tritemp.h
+    action s_zoom.c
+    action s_zoom.h
+    action swrast.h
 }
 
 symlink_mesa_ss() {
     src_dir src/mesa/swrast_setup
     dst_dir mesa/swrast_setup
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action ss_context.c
+    action ss_context.h
+    action ss_triangle.c
+    action ss_triangle.h
+    action ss_tritmp.h
+    action ss_vb.h
+    action swrast_setup.h
 }
 
 symlink_mesa_tnl() {
     src_dir src/mesa/tnl
     dst_dir mesa/tnl
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action t_array_api.c
+    action t_array_api.h
+    action t_array_import.c
+    action t_array_import.h
+    action t_context.c
+    action t_context.h
+    action t_pipeline.c
+    action t_pipeline.h
+    action t_save_api.c
+    action t_save_api.h
+    action t_save_loopback.c
+    action t_save_playback.c
+    action t_vb_arbprogram.c
+    action t_vb_arbprogram.h
+    action t_vb_arbprogram_sse.c
+    action t_vb_arbshader.c
+    action t_vb_cliptmp.h
+    action t_vb_cull.c
+    action t_vb_fog.c
+    action t_vb_light.c
+    action t_vb_lighttmp.h
+    action t_vb_normals.c
+    action t_vb_points.c
+    action t_vb_program.c
+    action t_vb_render.c
+    action t_vb_rendertmp.h
+    action t_vb_texgen.c
+    action t_vb_texmat.c
+    action t_vb_vertex.c
+    action t_vertex.c
+    action t_vertex.h
+    action t_vertex_generic.c
+    action t_vertex_sse.c
+    action t_vp_build.c
+    action t_vp_build.h
+    action t_vtx_api.c
+    action t_vtx_api.h
+    action t_vtx_eval.c
+    action t_vtx_exec.c
+    action t_vtx_generic.c
+    action t_vtx_x86.c
+    action tnl.h
 }
 
 symlink_mesa_shader() {
     src_dir src/mesa/shader
     dst_dir mesa/shader
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action arbprogparse.c
+    action arbprogparse.h
+    action arbprogram.c
+    action arbprogram.h
+    action arbprogram_syn.h
+    action atifragshader.c
+    action atifragshader.h
+    action nvfragparse.c
+    action nvfragparse.h
+    action nvprogram.c
+    action nvprogram.h
+    action nvvertexec.c
+    action nvvertexec.h
+    action nvvertparse.c
+    action nvvertparse.h
+    action program.c
+    action program.h
+    action program_instruction.h
+    action shaderobjects.c
+    action shaderobjects.h
+    action shaderobjects_3dlabs.c
+    action shaderobjects_3dlabs.h
 }
 
 symlink_mesa_shader_grammar() {
     src_dir src/mesa/shader/grammar
     dst_dir mesa/shader/grammar
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action grammar.c
+    action grammar.h
+    action grammar_syn.h
+    action grammar_mesa.c
+    action grammar_mesa.h
 }
 
 symlink_mesa_shader_slang() {
     src_dir src/mesa/shader/slang
     dst_dir mesa/shader/slang
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action slang_analyse.c
+    action slang_analyse.h
+    action slang_assemble.c
+    action slang_assemble.h
+    action slang_assemble_assignment.c
+    action slang_assemble_assignment.h
+    action slang_assemble_conditional.c
+    action slang_assemble_conditional.h
+    action slang_assemble_constructor.c
+    action slang_assemble_constructor.h
+    action slang_assemble_typeinfo.c
+    action slang_assemble_typeinfo.h
+    action slang_compile.c
+    action slang_compile.h
+    action slang_compile_function.c
+    action slang_compile_function.h
+    action slang_compile_operation.c
+    action slang_compile_operation.h
+    action slang_compile_struct.c
+    action slang_compile_struct.h
+    action slang_compile_variable.c
+    action slang_compile_variable.h
+    action slang_execute.c
+    action slang_execute.h
+    action slang_execute_x86.c
+    action slang_export.c
+    action slang_export.h
+    action slang_library_noise.c
+    action slang_library_noise.h
+    action slang_library_texsample.c
+    action slang_library_texsample.h
+    action slang_link.c
+    action slang_link.h
+    action slang_mesa.h
+    action slang_preprocess.c
+    action slang_preprocess.h
+    action slang_storage.c
+    action slang_storage.h
+    action slang_utility.c
+    action slang_utility.h
+    action traverse_wrap.h
 }
 
 symlink_mesa_shader_slang_library() {
     src_dir src/mesa/shader/slang/library
     dst_dir mesa/shader/slang/library
 
-    for src in $REAL_SRC_DIR/*.c $REAL_SRC_DIR/*.h; do
-        action `basename $src`
-    done
+    action slang_common_builtin_gc.h
+    action slang_core_gc.h
+    action slang_fragment_builtin_gc.h
+    action slang_shader_syn.h
+    action slang_pp_version_syn.h
+    action slang_vertex_builtin_gc.h
 }        
 
 symlink_mesa_x() {
diff --git a/fb/Makefile.am b/fb/Makefile.am
index 9a56b93..11b2d2f 100644
--- a/fb/Makefile.am
+++ b/fb/Makefile.am
@@ -1,4 +1,4 @@
-noinst_LTLIBRARIES = libfb.la libwfb.la libfbmmx.la
+noinst_LTLIBRARIES = libfb.la libfbmmx.la
 
 INCLUDES = \
 	-I$(top_srcdir)/hw/xfree86/os-support \
@@ -7,11 +7,11 @@ INCLUDES = \
 AM_CFLAGS = $(DIX_CFLAGS)
 
 if XORG
-sdk_HEADERS = fb.h fbrop.h fbpseudocolor.h fboverlay.h wfbrename.h
+sdk_HEADERS = fb.h fbrop.h fbpseudocolor.h fboverlay.h
 endif
 
 if MMX_CAPABLE
-libfb_la_CFLAGS = $(AM_CFLAGS) -DUSE_MMX
+AM_CFLAGS += -DUSE_MMX
 
 libfbmmx_la_CFLAGS =				\
 	$(DIX_CFLAGS)				\
@@ -23,8 +23,6 @@ libfbmmx_la_CFLAGS =				\
         --param large-function-growth=10000
 endif
 
-libwfb_la_CFLAGS = $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
-
 libfbmmx_la_SOURCES =	\
 	fbmmx.c		\
 	fbmmx.h
@@ -72,8 +70,6 @@ libfb_la_SOURCES = 	\
 	fbedge.c	\
 	fbedgeimp.h
 
-libwfb_la_SOURCES = $(libfb_la_SOURCES)
-
 libfb_la_LIBADD = libfbmmx.la
 
 EXTRA_DIST = fbcmap.c
diff --git a/fb/fb.h b/fb/fb.h
index de0b3a8..3742cf0 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -44,39 +44,6 @@
 #include "picture.h"
 #endif
 
-#ifdef FB_ACCESS_WRAPPER
-
-#include "wfbrename.h"
-#define FBPREFIX(x) wfb##x
-#define WRITE(ptr, val) ((*wfbWriteMemory)((ptr), (val), sizeof(*(ptr))))
-#define READ(ptr) ((*wfbReadMemory)((ptr), sizeof(*(ptr))))
-
-#define MEMCPY_WRAPPED(dst, src, size) do {                       \
-    size_t _i;                                                    \
-    CARD8 *_dst = (CARD8*)(dst), *_src = (CARD8*)(src);           \
-    for(_i = 0; _i < size; _i++) {                                \
-        WRITE(_dst +_i, READ(_src + _i));                         \
-    }                                                             \
-} while(0)
-
-#define MEMSET_WRAPPED(dst, val, size) do {                       \
-    size_t _i;                                                    \
-    CARD8 *_dst = (CARD8*)(dst);                                  \
-    for(_i = 0; _i < size; _i++) {                                \
-        WRITE(_dst +_i, (val));                                   \
-    }                                                             \
-} while(0)
-
-#else
-
-#define FBPREFIX(x) fb##x
-#define WRITE(ptr, val) (*(ptr) = (val))
-#define READ(ptr) (*(ptr))
-#define MEMCPY_WRAPPED(dst, src, size) memcpy((dst), (src), (size))
-#define MEMSET_WRAPPED(dst, val, size) memset((dst), (val), (size))
-
-#endif
-
 /*
  * This single define controls the basic size of data manipulated
  * by this software; it must be log2(sizeof (FbBits) * 8)
@@ -255,8 +222,8 @@ extern void fbSetBits (FbStip *bits, int
 
 #define FbPtrOffset(p,o,t)		((t *) ((CARD8 *) (p) + (o)))
 #define FbSelectPatternPart(xor,o,t)	((xor) >> (FbPatternOffset (o,t) << 3))
-#define FbStorePart(dst,off,t,xor)	(WRITE(FbPtrOffset(dst,off,t), \
-					 FbSelectPart(xor,off,t)))
+#define FbStorePart(dst,off,t,xor)	(*FbPtrOffset(dst,off,t) = \
+					 FbSelectPart(xor,off,t))
 #ifndef FbSelectPart
 #define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t)
 #endif
@@ -436,7 +403,7 @@ extern void fbSetBits (FbStip *bits, int
 	FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \
 	break; \
     default: \
-	WRITE(dst, FbDoMaskRRop(READ(dst), and, xor, l)); \
+	*dst = FbDoMaskRRop(*dst, and, xor, l); \
 	break; \
     } \
 }
@@ -456,7 +423,7 @@ extern void fbSetBits (FbStip *bits, int
 	break; \
     FbDoRightMaskByteRRop6Cases(dst,xor) \
     default: \
-	WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, r)); \
+	*dst = FbDoMaskRRop (*dst, and, xor, r); \
     } \
 }
 #endif
@@ -488,20 +455,20 @@ extern void fbSetBits (FbStip *bits, int
  * The term "lane" comes from the hardware term "byte-lane" which
  */
 
-#define FbLaneCase1(n,a,o)  ((n) == 0x01 ? (void) \
-			     WRITE((CARD8 *) ((a)+FbPatternOffset(o,CARD8)), \
-			      fgxor) : (void) 0)
-#define FbLaneCase2(n,a,o)  ((n) == 0x03 ? (void) \
-			     WRITE((CARD16 *) ((a)+FbPatternOffset(o,CARD16)), \
+#define FbLaneCase1(n,a,o)  ((n) == 0x01 ? \
+			     (*(CARD8 *) ((a)+FbPatternOffset(o,CARD8)) = \
+			      fgxor) : 0)
+#define FbLaneCase2(n,a,o)  ((n) == 0x03 ? \
+			     (*(CARD16 *) ((a)+FbPatternOffset(o,CARD16)) = \
 			      fgxor) : \
 			     ((void)FbLaneCase1((n)&1,a,o), \
 				    FbLaneCase1((n)>>1,a,(o)+1)))
-#define FbLaneCase4(n,a,o)  ((n) == 0x0f ? (void) \
-			     WRITE((CARD32 *) ((a)+FbPatternOffset(o,CARD32)), \
+#define FbLaneCase4(n,a,o)  ((n) == 0x0f ? \
+			     (*(CARD32 *) ((a)+FbPatternOffset(o,CARD32)) = \
 			      fgxor) : \
 			     ((void)FbLaneCase2((n)&3,a,o), \
 				    FbLaneCase2((n)>>2,a,(o)+2)))
-#define FbLaneCase8(n,a,o)  ((n) == 0x0ff ? (void) (*(FbBits *) ((a)+(o)) = fgxor) : \
+#define FbLaneCase8(n,a,o)  ((n) == 0x0ff ? (*(FbBits *) ((a)+(o)) = fgxor) : \
 			     ((void)FbLaneCase4((n)&15,a,o), \
 				    FbLaneCase4((n)>>4,a,(o)+4)))
 
@@ -621,32 +588,6 @@ extern WindowPtr    *WindowTable;
 #define FB_SCREEN_PRIVATE
 #endif
 
-/* Framebuffer access wrapper */
-typedef FbBits (*ReadMemoryProcPtr)(const void *src, int size);
-typedef void (*WriteMemoryProcPtr)(void *dst, FbBits value, int size);
-typedef void (*SetupWrapProcPtr)(ReadMemoryProcPtr  *pRead,
-                                 WriteMemoryProcPtr *pWrite,
-                                 DrawablePtr         pDraw);
-typedef void (*FinishWrapProcPtr)(DrawablePtr pDraw);
-
-#ifdef FB_ACCESS_WRAPPER
-
-#define fbPrepareAccess(pDraw) \
-	fbGetScreenPrivate((pDraw)->pScreen)->setupWrap( \
-		&wfbReadMemory, \
-		&wfbWriteMemory, \
-		(pDraw))
-#define fbFinishAccess(pDraw) \
-	fbGetScreenPrivate((pDraw)->pScreen)->finishWrap(pDraw)
-
-#else
-
-#define fbPrepareAccess(pPix)
-#define fbFinishAccess(pDraw)
-
-#endif
-
-
 #ifdef FB_SCREEN_PRIVATE
 extern int	fbScreenPrivateIndex;
 extern int	fbGetScreenPrivateIndex(void);
@@ -655,10 +596,6 @@ extern int	fbGetScreenPrivateIndex(void)
 typedef struct {
     unsigned char	win32bpp;	/* window bpp for 32-bpp images */
     unsigned char	pix32bpp;	/* pixmap bpp for 32-bpp images */
-#ifdef FB_ACCESS_WRAPPER
-    SetupWrapProcPtr	setupWrap;	/* driver hook to set pixmap access wrapping */
-    FinishWrapProcPtr	finishWrap;	/* driver hook to clean up pixmap access wrapping */
-#endif
 } FbScreenPrivRec, *FbScreenPrivPtr;
 
 #define fbGetScreenPrivate(pScreen) ((FbScreenPrivPtr) \
@@ -737,7 +674,6 @@ typedef struct {
 	(xoff) = __fbPixOffXPix(_pPix); \
 	(yoff) = __fbPixOffYPix(_pPix); \
     } \
-    fbPrepareAccess(pDrawable); \
     (pointer) = (FbBits *) _pPix->devPrivate.ptr; \
     (stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \
     (bpp) = _pPix->drawable.bitsPerPixel;  (void)(bpp); \
@@ -754,7 +690,6 @@ typedef struct {
 	(xoff) = __fbPixOffXPix(_pPix); \
 	(yoff) = __fbPixOffYPix(_pPix); \
     } \
-    fbPrepareAccess(pDrawable); \
     (pointer) = (FbStip *) _pPix->devPrivate.ptr; \
     (stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \
     (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
@@ -1804,30 +1739,6 @@ fbSetupScreen(ScreenPtr	pScreen, 
 	      int	bpp);		/* bits per pixel of frame buffer */
 
 Bool
-wfbFinishScreenInit(ScreenPtr	pScreen,
-		    pointer	pbits,
-		    int		xsize,
-		    int		ysize,
-		    int		dpix,
-		    int		dpiy,
-		    int		width,
-		    int		bpp,
-		    SetupWrapProcPtr setupWrap,
-		    FinishWrapProcPtr finishWrap);
-
-Bool
-wfbScreenInit(ScreenPtr	pScreen,
-	      pointer	pbits,
-	      int	xsize,
-	      int	ysize,
-	      int	dpix,
-	      int	dpiy,
-	      int	width,
-	      int	bpp,
-	      SetupWrapProcPtr setupWrap,
-	      FinishWrapProcPtr finishWrap);
-
-Bool
 fbFinishScreenInit(ScreenPtr	pScreen,
 		   pointer	pbits,
 		   int		xsize,
@@ -2083,11 +1994,6 @@ fbReplicatePixel (Pixel p, int bpp);
 void
 fbReduceRasterOp (int rop, FbBits fg, FbBits pm, FbBits *andp, FbBits *xorp);
 
-#ifdef FB_ACCESS_WRAPPER
-extern ReadMemoryProcPtr wfbReadMemory;
-extern WriteMemoryProcPtr wfbWriteMemory;
-#endif
-
 /*
  * fbwindow.c
  */
diff --git a/fb/fb24_32.c b/fb/fb24_32.c
index 00b739b..572da48 100644
--- a/fb/fb24_32.c
+++ b/fb/fb24_32.c
@@ -38,18 +38,18 @@
  * by reading/writing aligned CARD32s where it's easy
  */
 
-#define Get8(a)	((CARD32) READ(a))
+#define Get8(a)	((CARD32) *(a))
 
 #if BITMAP_BIT_ORDER == MSBFirst
 #define Get24(a)    ((Get8(a) << 16) | (Get8((a)+1) << 8) | Get8((a)+2))
-#define Put24(a,p)  ((WRITE((a+0), (CARD8) ((p) >> 16))), \
-		     (WRITE((a+1), (CARD8) ((p) >> 8))), \
-		     (WRITE((a+2), (CARD8) (p))))
+#define Put24(a,p)  (((a)[0] = (CARD8) ((p) >> 16)), \
+		     ((a)[1] = (CARD8) ((p) >> 8)), \
+		     ((a)[2] = (CARD8) (p)))
 #else
 #define Get24(a)    (Get8(a) | (Get8((a)+1) << 8) | (Get8((a)+2)<<16))
-#define Put24(a,p)  ((WRITE((a+0), (CARD8) (p))), \
-		     (WRITE((a+1), (CARD8) ((p) >> 8))), \
-		     (WRITE((a+2), (CARD8) ((p) >> 16))))
+#define Put24(a,p)  (((a)[0] = (CARD8) (p)), \
+		     ((a)[1] = (CARD8) ((p) >> 8)), \
+		     ((a)[2] = (CARD8) ((p) >> 16)))
 #endif
 
 typedef void (*fb24_32BltFunc) (CARD8	    *srcLine,
@@ -106,7 +106,7 @@ fb24_32BltDown (CARD8	    *srcLine,
 	    while (((long) dst & 3) && w)
 	    {
 		w--;
-		pixel = READ(src++);
+		pixel = *src++;
 		pixel = FbDoDestInvarientMergeRop(pixel);
 		Put24 (dst, pixel);
 		dst += 3;
@@ -115,35 +115,35 @@ fb24_32BltDown (CARD8	    *srcLine,
 	    while (w >= 4)
 	    {
 		CARD32  s0, s1;
-		s0 = READ(src++);
+		s0 = *src++;
 		s0 = FbDoDestInvarientMergeRop(s0);
-		s1 = READ(src++);
+		s1 = *src++;
 		s1 = FbDoDestInvarientMergeRop(s1);
 #if BITMAP_BIT_ORDER == LSBFirst
-		WRITE((CARD32 *)dst, (s0 & 0xffffff) | (s1 << 24));
+		*(CARD32 *)(dst) = (s0 & 0xffffff) | (s1 << 24);
 #else
-		WRITE((CARD32 *)dst, (s0 << 8) | ((s1 & 0xffffff) >> 16));
+		*(CARD32 *)(dst) = (s0 << 8) | ((s1 & 0xffffff) >> 16);
 #endif
-		s0 = READ(src++);
+		s0 = *src++;
 		s0 = FbDoDestInvarientMergeRop(s0);
 #if BITMAP_BIT_ORDER == LSBFirst
-		WRITE((CARD32 *)(dst+4), ((s1 & 0xffffff) >> 8) | (s0 << 16));
+		*(CARD32 *)(dst+4) = ((s1 & 0xffffff) >> 8) | (s0 << 16);
 #else
-		WRITE((CARD32 *)(dst+4), (s1 << 16) | ((s0 & 0xffffff) >> 8));
+		*(CARD32 *)(dst+4) = (s1 << 16) | ((s0 & 0xffffff) >> 8);
 #endif
-		s1 = READ(src++);
+		s1 = *src++;
 		s1 = FbDoDestInvarientMergeRop(s1);
 #if BITMAP_BIT_ORDER == LSBFirst
-		WRITE((CARD32 *)(dst+8), ((s0 & 0xffffff) >> 16) | (s1 << 8));
+		*(CARD32 *)(dst+8) = ((s0 & 0xffffff) >> 16) | (s1 << 8);
 #else
-		WRITE((CARD32 *)(dst+8), (s0 << 24) | (s1 & 0xffffff));
+		*(CARD32 *)(dst+8) = (s0 << 24) | (s1 & 0xffffff);
 #endif
 		dst += 12;
 		w -= 4;
 	    }
 	    while (w--)
 	    {
-		pixel = READ(src++);
+		pixel = *src++;
 		pixel = FbDoDestInvarientMergeRop(pixel);
 		Put24 (dst, pixel);
 		dst += 3;
@@ -153,7 +153,7 @@ fb24_32BltDown (CARD8	    *srcLine,
 	{
 	    while (w--)
 	    {
-		pixel = READ(src++);
+		pixel = *src++;
 		dpixel = Get24 (dst);
 		pixel = FbDoMergeRop(pixel, dpixel);
 		Put24 (dst, pixel);
@@ -205,40 +205,40 @@ fb24_32BltUp (CARD8	    *srcLine,
 		w--;
 		pixel = Get24(src);
 		src += 3;
-		WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+		*dst++ = FbDoDestInvarientMergeRop(pixel);
 	    }
 	    /* Do four aligned pixels at a time */
 	    while (w >= 4)
 	    {
 		CARD32  s0, s1;
 
-		s0 = READ((CARD32 *)src);
+		s0 = *(CARD32 *)(src);
 #if BITMAP_BIT_ORDER == LSBFirst
 		pixel = s0 & 0xffffff;
 #else
 		pixel = s0 >> 8;
 #endif
-		WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
-		s1 = READ((CARD32 *)(src+4));
+		*dst++ = FbDoDestInvarientMergeRop(pixel);
+		s1 = *(CARD32 *)(src+4);
 #if BITMAP_BIT_ORDER == LSBFirst
 		pixel = (s0 >> 24) | ((s1 << 8) & 0xffffff);
 #else
 		pixel = ((s0 << 16) & 0xffffff) | (s1 >> 16);
 #endif
-		WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
-		s0 = READ((CARD32 *)(src+8));
+		*dst++ = FbDoDestInvarientMergeRop(pixel);
+		s0 = *(CARD32 *)(src+8);
 #if BITMAP_BIT_ORDER == LSBFirst
 		pixel = (s1 >> 16) | ((s0 << 16) & 0xffffff);
 #else
 		pixel = ((s1 << 8) & 0xffffff) | (s0 >> 24);
 #endif
-		WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+		*dst++ = FbDoDestInvarientMergeRop(pixel);
 #if BITMAP_BIT_ORDER == LSBFirst
 		pixel = s0 >> 8;
 #else
 		pixel = s0 & 0xffffff;
 #endif
-		WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+		*dst++ = FbDoDestInvarientMergeRop(pixel);
 		src += 12;
 		w -= 4;
 	    }
@@ -247,7 +247,7 @@ fb24_32BltUp (CARD8	    *srcLine,
 		w--;
 		pixel = Get24(src);
 		src += 3;
-		WRITE(dst++, FbDoDestInvarientMergeRop(pixel));
+		*dst++ = FbDoDestInvarientMergeRop(pixel);
 	    }
 	}
 	else
@@ -256,7 +256,7 @@ fb24_32BltUp (CARD8	    *srcLine,
 	    {
 		pixel = Get24(src);
 		src += 3;
-		WRITE(dst, FbDoMergeRop(pixel, READ(dst)));
+		*dst = FbDoMergeRop(pixel, *dst);
 		dst++;
 	    }
 	}
@@ -305,8 +305,6 @@ fb24_32GetSpans(DrawablePtr	pDrawable, 
 	ppt++;
 	pwidth++;
     }
-
-    fbFinishAccess (pDrawable);
 }
 
 void
@@ -368,8 +366,6 @@ fb24_32SetSpans (DrawablePtr	    pDrawab
 	ppt++;
 	pwidth++;
     }
-
-    fbFinishAccess (pDrawable);
 }
 
 /*
@@ -433,8 +429,6 @@ fb24_32PutZImage (DrawablePtr	pDrawable,
 			alu,
 			pm);
     }
-
-    fbFinishAccess (pDrawable);
 }
 
 void
@@ -469,8 +463,6 @@ fb24_32GetImage (DrawablePtr     pDrawab
     fb24_32BltUp (src + (y + srcYoff) * srcStride, srcStride, x + srcXoff,
 		  (CARD8 *) d, dstStride, 0,
 		  w, h, GXcopy, pm);
-
-    fbFinishAccess (pDrawable);
 }
 
 void
@@ -527,9 +519,6 @@ fb24_32CopyMtoN (DrawablePtr pSrcDrawabl
 		pPriv->pm);
 	pbox++;
     }
-
-    fbFinishAccess (pSrcDrawable);
-    fbFinishAccess (pDstDrawable);
 }
 
 PixmapPtr
@@ -574,9 +563,6 @@ fb24_32ReformatTile(PixmapPtr pOldTile, 
 	    GXcopy,
 	    FB_ALLONES);
 
-    fbFinishAccess (&pOldTile->drawable);
-    fbFinishAccess (&pNewTile->drawable);
-
     return pNewTile;
 }
 
diff --git a/fb/fballpriv.c b/fb/fballpriv.c
index 4f807ed..3c05ff3 100644
--- a/fb/fballpriv.c
+++ b/fb/fballpriv.c
@@ -90,8 +90,3 @@ fbAllocatePrivates(ScreenPtr pScreen, in
 #endif
     return TRUE;
 }
-
-#ifdef FB_ACCESS_WRAPPER
-ReadMemoryProcPtr wfbReadMemory;
-WriteMemoryProcPtr wfbWriteMemory;
-#endif
diff --git a/fb/fbarc.c b/fb/fbarc.c
index d2c1a76..8f4d296 100644
--- a/fb/fbarc.c
+++ b/fb/fbarc.c
@@ -109,7 +109,6 @@ fbPolyArc (DrawablePtr	pDrawable,
 		    miPolyArc(pDrawable, pGC, 1, parcs);
 		parcs++;
 	    }
-	    fbFinishAccess (pDrawable);
 	}
 	else
 #endif
diff --git a/fb/fbbits.c b/fb/fbbits.c
index cefe943..56b58df 100644
--- a/fb/fbbits.c
+++ b/fb/fbbits.c
@@ -103,14 +103,14 @@
 #define BITSUNIT    BYTE
 #define BITSMUL	    3
 
-#define FbDoTypeStore(b,t,x,s)	WRITE(((t *) (b)), (x) >> (s))
-#define FbDoTypeRRop(b,t,a,x,s) WRITE((t *) (b), FbDoRRop(READ((t *) (b)),\
-							  (a) >> (s), \
-							  (x) >> (s)))
-#define FbDoTypeMaskRRop(b,t,a,x,m,s) WRITE((t *) (b), FbDoMaskRRop(READ((t *) (b)),\
-								    (a) >> (s), \
-								    (x) >> (s), \
-								    (m) >> (s)))
+#define FbDoTypeStore(b,t,x,s)	(*((t *) (b)) = (x) >> (s))
+#define FbDoTypeRRop(b,t,a,x,s) (*((t *) (b)) = FbDoRRop(*((t *) (b)),\
+							 (a) >> (s), \
+							 (x) >> (s)))
+#define FbDoTypeMaskRRop(b,t,a,x,m,s) (*((t *) (b)) = FbDoMaskRRop(*((t *) (b)),\
+								   (a) >> (s), \
+								   (x) >> (s), \
+								   (m) >> (s))
 #if BITMAP_BIT_ORDER == LSBFirst
 #define BITSSTORE(b,x)	((unsigned long) (b) & 1 ? \
 			 (FbDoTypeStore (b, CARD8, x, 0), \
diff --git a/fb/fbbits.h b/fb/fbbits.h
index 603c029..e5c006d 100644
--- a/fb/fbbits.h
+++ b/fb/fbbits.h
@@ -42,13 +42,13 @@
 #ifdef BITSSTORE
 #define STORE(b,x)  BITSSTORE(b,x)
 #else
-#define STORE(b,x)  WRITE((b), (x))
+#define STORE(b,x)  (*(b) = (x))
 #endif
 
 #ifdef BITSRROP
 #define RROP(b,a,x)	BITSRROP(b,a,x)
 #else
-#define RROP(b,a,x)	WRITE((b), FbDoRRop (READ(b), (a), (x)))
+#define RROP(b,a,x)	(*(b) = FbDoRRop (*(b), (a), (x)))
 #endif
 
 #ifdef BITSUNIT
@@ -119,8 +119,6 @@ BRESSOLID (DrawablePtr	pDrawable,
 	    e += e3;
 	}
     }
-
-    fbFinishAccess (pDrawable);
 }
 #endif
 
@@ -265,8 +263,6 @@ onOffOdd:
 		dashlen = len;
 	}
     }
-
-    fbFinishAccess (pDrawable);
 }
 #endif
 
@@ -545,18 +541,18 @@ ARC (FbBits	*dst,
 # define WRITE_ADDR4(n)	    ((n))
 #endif
 
-#define WRITE1(d,n,fg)	    WRITE(d + WRITE_ADDR1(n), (BITS) (fg))
+#define WRITE1(d,n,fg)	    ((d)[WRITE_ADDR1(n)] = (BITS) (fg))
 
 #ifdef BITS2
-# define WRITE2(d,n,fg)	    WRITE((BITS2 *) &((d)[WRITE_ADDR2(n)]), (BITS2) (fg))
+# define WRITE2(d,n,fg)	    (*((BITS2 *) &((d)[WRITE_ADDR2(n)])) = (BITS2) (fg))
 #else
-# define WRITE2(d,n,fg)	    (WRITE1(d,n,fg), WRITE1(d,(n)+1,fg))
+# define WRITE2(d,n,fg)	    WRITE1(d,(n)+1,WRITE1(d,n,fg))
 #endif
 
 #ifdef BITS4
-# define WRITE4(d,n,fg)	    WRITE((BITS4 *) &((d)[WRITE_ADDR4(n)]), (BITS4) (fg))
+# define WRITE4(d,n,fg)	    (*((BITS4 *) &((d)[WRITE_ADDR4(n)])) = (BITS4) (fg))
 #else
-# define WRITE4(d,n,fg)	    (WRITE2(d,n,fg), WRITE2(d,(n)+2,fg))
+# define WRITE4(d,n,fg)	    WRITE2(d,(n)+2,WRITE2(d,n,fg))
 #endif
 
 void
@@ -714,10 +710,8 @@ POLYLINE (DrawablePtr	pDrawable,
 		       intToX(pt2) + xoff, intToY(pt2) + yoff,
 		       npt == 0 && pGC->capStyle != CapNotLast,
 		       &dashoffset);
-	    if (!npt) {
-		fbFinishAccess (pDrawable);
+	    if (!npt)
 		return;
-	    }
 	    pt1 = pt2;
 	    pt2 = *pts++;
 	    npt--;
@@ -782,7 +776,6 @@ POLYLINE (DrawablePtr	pDrawable,
 		    {
 			RROP(bits,and,xor);
 		    }
-		    fbFinishAccess (pDrawable);
 		    return;
 		}
 		pt1 = pt2;
@@ -793,8 +786,6 @@ POLYLINE (DrawablePtr	pDrawable,
     	    }
 	}
     }
-
-    fbFinishAccess (pDrawable);
 }
 #endif
 
@@ -892,20 +883,20 @@ POLYSEGMENT (DrawablePtr    pDrawable,
 		FbMaskBits (dstX, width, startmask, nmiddle, endmask);
 		if (startmask)
 		{
-		    WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, startmask));
+		    *dstLine = FbDoMaskRRop (*dstLine, andBits, xorBits, startmask);
 		    dstLine++;
 		}
 		if (!andBits)
 		    while (nmiddle--)
-			WRITE(dstLine++, xorBits);
+			*dstLine++ = xorBits;
 		else
 		    while (nmiddle--)
 		    {
-			WRITE(dstLine, FbDoRRop (READ(dstLine), andBits, xorBits));
+			*dstLine = FbDoRRop (*dstLine, andBits, xorBits);
 			dstLine++;
 		    }
 		if (endmask)
-		    WRITE(dstLine, FbDoMaskRRop (READ(dstLine), andBits, xorBits, endmask));
+		    *dstLine = FbDoMaskRRop (*dstLine, andBits, xorBits, endmask);
 	    }
 	    else
 	    {
@@ -959,8 +950,6 @@ POLYSEGMENT (DrawablePtr    pDrawable,
 	    }
 	}
     }
-
-    fbFinishAccess (pDrawable);
 }
 #endif
 
diff --git a/fb/fbblt.c b/fb/fbblt.c
index e18981a..d176a7c 100644
--- a/fb/fbblt.c
+++ b/fb/fbblt.c
@@ -92,10 +92,10 @@ fbBlt (FbBits   *srcLine,
 
         if (!upsidedown)
             for (i = 0; i < height; i++)
-                MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
+                memcpy(dst + i * dstStride, src + i * srcStride, width);
         else
             for (i = height - 1; i >= 0; i--)
-                MEMCPY_WRAPPED(dst + i * dstStride, src + i * srcStride, width);
+                memcpy(dst + i * dstStride, src + i * srcStride, width);
 
         return;
     }
@@ -137,7 +137,7 @@ fbBlt (FbBits   *srcLine,
 	    {
 		if (endmask)
 		{
-		    bits = READ(--src);
+		    bits = *--src;
 		    --dst;
 		    FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
 		}
@@ -145,20 +145,20 @@ fbBlt (FbBits   *srcLine,
 		if (destInvarient)
 		{
 		    while (n--)
-			WRITE(--dst, FbDoDestInvarientMergeRop(READ(--src)));
+			*--dst = FbDoDestInvarientMergeRop(*--src);
 		}
 		else
 		{
 		    while (n--)
 		    {
-			bits = READ(--src);
+			bits = *--src;
 			--dst;
-			WRITE(dst, FbDoMergeRop (bits, READ(dst)));
+			*dst = FbDoMergeRop (bits, *dst);
 		    }
 		}
 		if (startmask)
 		{
-		    bits = READ(--src);
+		    bits = *--src;
 		    --dst;
 		    FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
 		}
@@ -167,7 +167,7 @@ fbBlt (FbBits   *srcLine,
 	    {
 		if (startmask)
 		{
-		    bits = READ(src++);
+		    bits = *src++;
 		    FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask);
 		    dst++;
 		}
@@ -198,20 +198,20 @@ fbBlt (FbBits   *srcLine,
 		    }
 #endif
 		    while (n--)
-			WRITE(dst++, FbDoDestInvarientMergeRop(READ(src++)));
+			*dst++ = FbDoDestInvarientMergeRop(*src++);
 		}
 		else
 		{
 		    while (n--)
 		    {
-			bits = READ(src++);
-			WRITE(dst, FbDoMergeRop (bits, READ(dst)));
+			bits = *src++;
+			*dst = FbDoMergeRop (bits, *dst);
 			dst++;
 		    }
 		}
 		if (endmask)
 		{
-		    bits = READ(src);
+		    bits = *src;
 		    FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask);
 		}
 	    }
@@ -240,13 +240,13 @@ fbBlt (FbBits   *srcLine,
 	    if (reverse)
 	    {
 		if (srcX < dstX)
-		    bits1 = READ(--src);
+		    bits1 = *--src;
 		if (endmask)
 		{
 		    bits = FbScrRight(bits1, rightShift); 
 		    if (FbScrRight(endmask, leftShift))
 		    {
-			bits1 = READ(--src);
+			bits1 = *--src;
 			bits |= FbScrLeft(bits1, leftShift);
 		    }
 		    --dst;
@@ -258,10 +258,10 @@ fbBlt (FbBits   *srcLine,
 		    while (n--)
 		    {
 			bits = FbScrRight(bits1, rightShift); 
-			bits1 = READ(--src);
+			bits1 = *--src;
 			bits |= FbScrLeft(bits1, leftShift);
 			--dst;
-			WRITE(dst, FbDoDestInvarientMergeRop(bits));
+			*dst = FbDoDestInvarientMergeRop(bits);
 		    }
 		}
 		else
@@ -269,10 +269,10 @@ fbBlt (FbBits   *srcLine,
 		    while (n--)
 		    {
 			bits = FbScrRight(bits1, rightShift); 
-			bits1 = READ(--src);
+			bits1 = *--src;
 			bits |= FbScrLeft(bits1, leftShift);
 			--dst;
-			WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+			*dst = FbDoMergeRop(bits, *dst);
 		    }
 		}
 		if (startmask)
@@ -280,7 +280,7 @@ fbBlt (FbBits   *srcLine,
 		    bits = FbScrRight(bits1, rightShift); 
 		    if (FbScrRight(startmask, leftShift))
 		    {
-			bits1 = READ(--src);
+			bits1 = *--src;
 			bits |= FbScrLeft(bits1, leftShift);
 		    }
 		    --dst;
@@ -290,13 +290,13 @@ fbBlt (FbBits   *srcLine,
 	    else
 	    {
 		if (srcX > dstX)
-		    bits1 = READ(src++);
+		    bits1 = *src++;
 		if (startmask)
 		{
 		    bits = FbScrLeft(bits1, leftShift); 
 		    if (FbScrLeft(startmask, rightShift))
 		    {
-			bits1 = READ(src++);
+			bits1 = *src++;
 			bits |= FbScrRight(bits1, rightShift);
 		    }
 		    FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask);
@@ -308,9 +308,9 @@ fbBlt (FbBits   *srcLine,
 		    while (n--)
 		    {
 			bits = FbScrLeft(bits1, leftShift); 
-			bits1 = READ(src++);
+			bits1 = *src++;
 			bits |= FbScrRight(bits1, rightShift);
-			WRITE(dst, FbDoDestInvarientMergeRop(bits));
+			*dst = FbDoDestInvarientMergeRop(bits);
 			dst++;
 		    }
 		}
@@ -319,9 +319,9 @@ fbBlt (FbBits   *srcLine,
 		    while (n--)
 		    {
 			bits = FbScrLeft(bits1, leftShift); 
-			bits1 = READ(src++);
+			bits1 = *src++;
 			bits |= FbScrRight(bits1, rightShift);
-			WRITE(dst, FbDoMergeRop(bits, READ(dst)));
+			*dst = FbDoMergeRop(bits, *dst);
 			dst++;
 		    }
 		}
@@ -330,7 +330,7 @@ fbBlt (FbBits   *srcLine,
 		    bits = FbScrLeft(bits1, leftShift); 
 		    if (FbScrLeft(endmask, rightShift))
 		    {
-			bits1 = READ(src);
+			bits1 = *src;
 			bits |= FbScrRight(bits1, rightShift);
 		    }
 		    FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask);
@@ -425,45 +425,45 @@ fbBlt24Line (FbBits	    *src,
 	{
 	    if (endmask)
 	    {
-		bits = READ(--src);
+		bits = *--src;
 		--dst;
-		WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
+		*dst = FbDoMaskMergeRop (bits, *dst, mask & endmask);
 		mask = FbPrev24Pix (mask);
 	    }
 	    while (n--)
 	    {
-		bits = READ(--src);
+		bits = *--src;
 		--dst;
-		WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask));
+		*dst = FbDoMaskMergeRop (bits, *dst, mask);
 		mask = FbPrev24Pix (mask);
 	    }
 	    if (startmask)
 	    {
-		bits = READ(--src);
+		bits = *--src;
 		--dst;
-		WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & startmask));
+		*dst = FbDoMaskMergeRop(bits, *dst, mask & startmask);
 	    }
 	}
 	else
 	{
 	    if (startmask)
 	    {
-		bits = READ(src++);
-		WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
+		bits = *src++;
+		*dst = FbDoMaskMergeRop (bits, *dst, mask & startmask);
 		dst++;
 		mask = FbNext24Pix(mask);
 	    }
 	    while (n--)
 	    {
-		bits = READ(src++);
-		WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask));
+		bits = *src++;
+		*dst = FbDoMaskMergeRop (bits, *dst, mask);
 		dst++;
 		mask = FbNext24Pix(mask);
 	    }
 	    if (endmask)
 	    {
-		bits = READ(src);
-		WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask & endmask));
+		bits = *src;
+		*dst = FbDoMaskMergeRop(bits, *dst, mask & endmask);
 	    }
 	}
     }
@@ -484,26 +484,26 @@ fbBlt24Line (FbBits	    *src,
 	if (reverse)
 	{
 	    if (srcX < dstX)
-		bits1 = READ(--src);
+		bits1 = *--src;
 	    if (endmask)
 	    {
 		bits = FbScrRight(bits1, rightShift); 
 		if (FbScrRight(endmask, leftShift))
 		{
-		    bits1 = READ(--src);
+		    bits1 = *--src;
 		    bits |= FbScrLeft(bits1, leftShift);
 		}
 		--dst;
-		WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
+		*dst = FbDoMaskMergeRop (bits, *dst, mask & endmask);
 		mask = FbPrev24Pix(mask);
 	    }
 	    while (n--)
 	    {
 		bits = FbScrRight(bits1, rightShift); 
-		bits1 = READ(--src);
+		bits1 = *--src;
 		bits |= FbScrLeft(bits1, leftShift);
 		--dst;
-		WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+		*dst = FbDoMaskMergeRop(bits, *dst, mask);
 		mask = FbPrev24Pix(mask);
 	    }
 	    if (startmask)
@@ -511,32 +511,32 @@ fbBlt24Line (FbBits	    *src,
 		bits = FbScrRight(bits1, rightShift); 
 		if (FbScrRight(startmask, leftShift))
 		{
-		    bits1 = READ(--src);
+		    bits1 = *--src;
 		    bits |= FbScrLeft(bits1, leftShift);
 		}
 		--dst;
-		WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
+		*dst = FbDoMaskMergeRop (bits, *dst, mask & startmask);
 	    }
 	}
 	else
 	{
 	    if (srcX > dstX)
-		bits1 = READ(src++);
+		bits1 = *src++;
 	    if (startmask)
 	    {
 		bits = FbScrLeft(bits1, leftShift); 
-		bits1 = READ(src++);
+		bits1 = *src++;
 		bits |= FbScrRight(bits1, rightShift);
-		WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & startmask));
+		*dst = FbDoMaskMergeRop (bits, *dst, mask & startmask);
 		dst++;
 		mask = FbNext24Pix(mask);
 	    }
 	    while (n--)
 	    {
 		bits = FbScrLeft(bits1, leftShift); 
-		bits1 = READ(src++);
+		bits1 = *src++;
 		bits |= FbScrRight(bits1, rightShift);
-		WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), mask));
+		*dst = FbDoMaskMergeRop(bits, *dst, mask);
 		dst++;
 		mask = FbNext24Pix(mask);
 	    }
@@ -545,10 +545,10 @@ fbBlt24Line (FbBits	    *src,
 		bits = FbScrLeft(bits1, leftShift); 
 		if (FbScrLeft(endmask, rightShift))
 		{
-		    bits1 = READ(src);
+		    bits1 = *src;
 		    bits |= FbScrRight(bits1, rightShift);
 		}
-		WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), mask & endmask));
+		*dst = FbDoMaskMergeRop (bits, *dst, mask & endmask);
 	    }
 	}
     }
@@ -707,8 +707,8 @@ fbBltOdd (FbBits    *srcLine,
 	{
 	    if (startmask)
 	    {
-		bits = READ(src++);
-		WRITE(dst, FbDoMaskMergeRop (bits, READ(dst), startmask));
+		bits = *src++;
+		*dst = FbDoMaskMergeRop (bits, *dst, startmask);
 		dst++;
 	    }
 	    n = nmiddle;
@@ -716,8 +716,8 @@ fbBltOdd (FbBits    *srcLine,
 	    {
 		while (n--)
 		{
-		    bits = READ(src++);
-		    WRITE(dst, FbDoDestInvarientMergeRop(bits));
+		    bits = *src++;
+		    *dst = FbDoDestInvarientMergeRop(bits);
 		    dst++;
 		}
 	    }
@@ -725,28 +725,28 @@ fbBltOdd (FbBits    *srcLine,
 	    {
 		while (n--)
 		{
-		    bits = READ(src++);
-		    WRITE(dst, FbDoMergeRop (bits, READ(dst)));
+		    bits = *src++;
+		    *dst = FbDoMergeRop (bits, *dst);
 		    dst++;
 		}
 	    }
 	    if (endmask)
 	    {
-		bits = READ(src);
-		WRITE(dst, FbDoMaskMergeRop(bits, READ(dst), endmask));
+		bits = *src;
+		*dst = FbDoMaskMergeRop(bits, *dst, endmask);
 	    }
 	}
 	else
 	{
 	    bits = 0;
 	    if (srcX > dstX)
-		bits = READ(src++);
+		bits = *src++;
 	    if (startmask)
 	    {
 		bits1 = FbScrLeft(bits, leftShift);
-		bits = READ(src++);
+		bits = *src++;
 		bits1 |= FbScrRight(bits, rightShift);
-		WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), startmask));
+		*dst = FbDoMaskMergeRop (bits1, *dst, startmask);
 		dst++;
 	    }
 	    n = nmiddle;
@@ -755,9 +755,9 @@ fbBltOdd (FbBits    *srcLine,
 		while (n--)
 		{
 		    bits1 = FbScrLeft(bits, leftShift);
-		    bits = READ(src++);
+		    bits = *src++;
 		    bits1 |= FbScrRight(bits, rightShift);
-		    WRITE(dst, FbDoDestInvarientMergeRop(bits1));
+		    *dst = FbDoDestInvarientMergeRop(bits1);
 		    dst++;
 		}
 	    }
@@ -766,9 +766,9 @@ fbBltOdd (FbBits    *srcLine,
 		while (n--)
 		{
 		    bits1 = FbScrLeft(bits, leftShift);
-		    bits = READ(src++);
+		    bits = *src++;
 		    bits1 |= FbScrRight(bits, rightShift);
-		    WRITE(dst, FbDoMergeRop(bits1, READ(dst)));
+		    *dst = FbDoMergeRop(bits1, *dst);
 		    dst++;
 		}
 	    }
@@ -777,10 +777,10 @@ fbBltOdd (FbBits    *srcLine,
 		bits1 = FbScrLeft(bits, leftShift);
 		if (FbScrLeft(endmask, rightShift))
 		{
-		    bits = READ(src);
+		    bits = *src;
 		    bits1 |= FbScrRight(bits, rightShift);
 		}
-		WRITE(dst, FbDoMaskMergeRop (bits1, READ(dst), endmask));
+		*dst = FbDoMaskMergeRop (bits1, *dst, endmask);
 	    }
 	}
     }
diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index d2c180f..f06357a 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -51,12 +51,12 @@
 
 #define LoadBits {\
     if (leftShift) { \
-	bitsRight = (src < srcEnd ? READ(src++) : 0); \
+	bitsRight = (src < srcEnd ? *src++ : 0); \
 	bits = (FbStipLeft (bitsLeft, leftShift) | \
 		FbStipRight(bitsRight, rightShift)); \
 	bitsLeft = bitsRight; \
     } else \
-	bits = (src < srcEnd ? READ(src++) : 0); \
+	bits = (src < srcEnd ? *src++ : 0); \
 }
     
 #ifndef FBNOPIXADDR
@@ -285,7 +285,7 @@ fbBltOne (FbStip    *src,
 	
 	bitsLeft = 0;
 	if (srcX > dstS)
-	    bitsLeft = READ(src++);
+	    bitsLeft = *src++;
 	if (n)
 	{
 	    /*
@@ -338,7 +338,7 @@ fbBltOne (FbStip    *src,
 			else
 #endif
 			    mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
-			WRITE(dst, FbOpaqueStipple (mask, fgxor, bgxor));
+			*dst = FbOpaqueStipple (mask, fgxor, bgxor);
 			dst++;
 			bits = FbStipLeft(bits, pixelsPerDst);
 		    }
@@ -368,8 +368,8 @@ fbBltOne (FbStip    *src,
 			    if (left || !transparent)
 			    {
 				mask = fbBits[left];
-				WRITE(dst, FbStippleRRop (READ(dst), mask,
-						          fgand, fgxor, bgand, bgxor));
+				*dst = FbStippleRRop (*dst, mask,
+						      fgand, fgxor, bgand, bgxor);
 			    }
 			    dst++;
 			    bits = FbStipLeft(bits, pixelsPerDst);
@@ -537,7 +537,7 @@ const FbBits	fbStipple24Bits[3][1 << FbS
 	stip = FbLeftStipBits(bits, len); \
     } else { \
 	stip = FbLeftStipBits(bits, remain); \
-	bits = (src < srcEnd ? READ(src++) : 0); \
+	bits = (src < srcEnd ? *src++ : 0); \
 	__len = (len) - remain; \
 	stip = FbMergePartStip24Bits(stip, FbLeftStipBits(bits, __len), \
 				     remain, __len); \
@@ -548,7 +548,7 @@ const FbBits	fbStipple24Bits[3][1 << FbS
 }
 
 #define fbInitStipBits(offset,len,stip) {\
-    bits = FbStipLeft (READ(src++),offset); \
+    bits = FbStipLeft (*src++,offset); \
     remain = FB_STIP_UNIT - offset; \
     fbFirstStipBits(len,stip); \
     stip = FbMergeStip24Bits (0, stip, len); \
@@ -631,11 +631,10 @@ fbBltOne24 (FbStip	*srcLine,
 	    if (leftMask)
 	    {
 		mask = fbStipple24Bits[rot >> 3][stip];
-		WRITE(dst, (READ(dst) & ~leftMask) |
-			    (FbOpaqueStipple (mask,
-					      FbRot24(fgxor, rot),
-					      FbRot24(bgxor, rot))
-			     & leftMask));
+		*dst = (*dst & ~leftMask) | (FbOpaqueStipple (mask,
+							      FbRot24(fgxor, rot),
+							      FbRot24(bgxor, rot))
+					     & leftMask);
 		dst++;
 		fbNextStipBits(rot,stip);
 	    }
@@ -643,20 +642,19 @@ fbBltOne24 (FbStip	*srcLine,
 	    while (nl--)
 	    {
 		mask = fbStipple24Bits[rot>>3][stip];
-		WRITE(dst, FbOpaqueStipple (mask,
-					    FbRot24(fgxor, rot),
-					    FbRot24(bgxor, rot)));
+		*dst = FbOpaqueStipple (mask, 
+					FbRot24(fgxor, rot),
+					FbRot24(bgxor, rot));
 		dst++;
 		fbNextStipBits(rot,stip);
 	    }
 	    if (rightMask)
 	    {
 		mask = fbStipple24Bits[rot >> 3][stip];
-		WRITE(dst, (READ(dst) & ~rightMask) |
-			    (FbOpaqueStipple (mask,
-					      FbRot24(fgxor, rot),
-					      FbRot24(bgxor, rot))
-			     & rightMask));
+		*dst = (*dst & ~rightMask) | (FbOpaqueStipple (mask,
+							       FbRot24(fgxor, rot),
+							       FbRot24(bgxor, rot))
+					      & rightMask);
 	    }
 	    dst += dstStride;
 	    src += srcStride;
@@ -676,7 +674,7 @@ fbBltOne24 (FbStip	*srcLine,
 		if (stip)
 		{
 		    mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
-		    WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
+		    *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask);
 		}
 		dst++;
 		fbNextStipBits (rot, stip);
@@ -687,7 +685,7 @@ fbBltOne24 (FbStip	*srcLine,
 		if (stip)
 		{
 		    mask = fbStipple24Bits[rot>>3][stip];
-		    WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor,rot) & mask));
+		    *dst = (*dst & ~mask) | (FbRot24(fgxor,rot) & mask);
 		}
 		dst++;
 		fbNextStipBits (rot, stip);
@@ -697,7 +695,7 @@ fbBltOne24 (FbStip	*srcLine,
 		if (stip)
 		{
 		    mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
-		    WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
+		    *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask);
 		}
 	    }
 	    dst += dstStride;
@@ -714,12 +712,12 @@ fbBltOne24 (FbStip	*srcLine,
 	    if (leftMask)
 	    {
 		mask = fbStipple24Bits[rot >> 3][stip];
-		WRITE(dst, FbStippleRRopMask (READ(dst), mask,
-					      FbRot24(fgand, rot),
-					      FbRot24(fgxor, rot),
-					      FbRot24(bgand, rot),
-					      FbRot24(bgxor, rot),
-					      leftMask));
+		*dst = FbStippleRRopMask (*dst, mask,
+					  FbRot24(fgand, rot),
+					  FbRot24(fgxor, rot),
+					  FbRot24(bgand, rot),
+					  FbRot24(bgxor, rot),
+					  leftMask);
 		dst++;
 		fbNextStipBits(rot,stip);
 	    }
@@ -727,23 +725,23 @@ fbBltOne24 (FbStip	*srcLine,
 	    while (nl--)
 	    {
 		mask = fbStipple24Bits[rot >> 3][stip];
-		WRITE(dst, FbStippleRRop (READ(dst), mask,
-					  FbRot24(fgand, rot),
-					  FbRot24(fgxor, rot),
-					  FbRot24(bgand, rot),
-					  FbRot24(bgxor, rot)));
+		*dst = FbStippleRRop (*dst, mask,
+				      FbRot24(fgand, rot),
+				      FbRot24(fgxor, rot),
+				      FbRot24(bgand, rot),
+				      FbRot24(bgxor, rot));
 		dst++;
 		fbNextStipBits(rot,stip);
 	    }
 	    if (rightMask)
 	    {
 		mask = fbStipple24Bits[rot >> 3][stip];
-		WRITE(dst, FbStippleRRopMask (READ(dst), mask,
-					      FbRot24(fgand, rot),
-					      FbRot24(fgxor, rot),
-					      FbRot24(bgand, rot),
-					      FbRot24(bgxor, rot),
-					      rightMask));
+		*dst = FbStippleRRopMask (*dst, mask,
+					  FbRot24(fgand, rot),
+					  FbRot24(fgxor, rot),
+					  FbRot24(bgand, rot),
+					  FbRot24(bgxor, rot),
+					  rightMask);
 	    }
 	    dst += dstStride;
 	}
@@ -834,7 +832,7 @@ fbBltPlane (FbBits	    *src,
 	if (srcBpp == 24)
 	    srcMask0 = FbRot24(pm,rot0) & FbBitsMask(0, srcBpp);
 #endif
-    	srcBits = READ(s++);
+    	srcBits = *s++;
 
 	dstMask = dstMaskFirst;
 	dstUnion = 0;
@@ -846,7 +844,7 @@ fbBltPlane (FbBits	    *src,
 	{
 	    if (!srcMask)
 	    {
-		srcBits = READ(s++);
+		srcBits = *s++;
 #ifdef FB_24BIT
 		if (srcBpp == 24)
 		    srcMask0 = FbNext24Pix(srcMask0) & FbBitsMask(0,24);
@@ -855,9 +853,9 @@ fbBltPlane (FbBits	    *src,
 	    }
 	    if (!dstMask)
 	    {
-		WRITE(d, FbStippleRRopMask(READ(d), dstBits,
-					   fgand, fgxor, bgand, bgxor,
-					   dstUnion));
+		*d = FbStippleRRopMask(*d, dstBits,
+				       fgand, fgxor, bgand, bgxor,
+				       dstUnion);
 		d++;
 		dstMask = FbStipMask(0,1);
 		dstUnion = 0;
@@ -873,9 +871,9 @@ fbBltPlane (FbBits	    *src,
 	    dstMask = FbStipRight(dstMask,1);
 	}
 	if (dstUnion)
-	    WRITE(d, FbStippleRRopMask(READ(d),dstBits,
-				       fgand, fgxor, bgand, bgxor,
-				       dstUnion));
+	    *d = FbStippleRRopMask(*d,dstBits,
+				   fgand, fgxor, bgand, bgxor,
+				   dstUnion);
     }
 }
 
diff --git a/fb/fbcompose.c b/fb/fbcompose.c
index 6ea9483..b1903e9 100644
--- a/fb/fbcompose.c
+++ b/fb/fbcompose.c
@@ -53,7 +53,7 @@ typedef FASTCALL void (*fetchProc)(const
 static FASTCALL void
 fbFetch_a8r8g8b8 (const FbBits *bits, int x, int width, CARD32 *buffer, miIndexedPtr indexed)
 {
-    MEMCPY_WRAPPED(buffer, (const CARD32 *)bits + x, width*sizeof(CARD32));
+    memcpy(buffer, (const CARD32 *)bits + x, width*sizeof(CARD32));
 }
 
 static FASTCALL void
@@ -62,7 +62,7 @@ fbFetch_x8r8g8b8 (const FbBits *bits, in
     const CARD32 *pixel = (const CARD32 *)bits + x;
     const CARD32 *end = pixel + width;
     while (pixel < end) {
-        WRITE(buffer++, READ(pixel++) | 0xff000000);
+        *buffer++ = *pixel++ | 0xff000000;
     }
 }
 
@@ -72,9 +72,9 @@ fbFetch_a8b8g8r8 (const FbBits *bits, in
     const CARD32 *pixel = (CARD32 *)bits + x;
     const CARD32 *end = pixel + width;
     while (pixel < end) {
-        WRITE(buffer++, ((READ(pixel) & 0xff00ff00) |
-                         ((READ(pixel) >> 16) & 0xff) |
-                         ((READ(pixel) & 0xff) << 16)));
+        *buffer++ =  ((*pixel & 0xff00ff00) |
+                      ((*pixel >> 16) & 0xff) |
+                      ((*pixel & 0xff) << 16));
         ++pixel;
     }
 }
@@ -85,10 +85,10 @@ fbFetch_x8b8g8r8 (const FbBits *bits, in
     const CARD32 *pixel = (CARD32 *)bits + x;
     const CARD32 *end = pixel + width;
     while (pixel < end) {
-        WRITE(buffer++, 0xff000000 |
-                        ((READ(pixel) & 0x0000ff00) |
-                         ((READ(pixel) >> 16) & 0xff) |
-                         ((READ(pixel) & 0xff) << 16)));
+        *buffer++ =  0xff000000 |
+                     ((*pixel & 0x0000ff00) |
+                      ((*pixel >> 16) & 0xff) |
+                      ((*pixel & 0xff) << 16));
         ++pixel;
     }
 }
@@ -101,7 +101,7 @@ fbFetch_r8g8b8 (const FbBits *bits, int 
     while (pixel < end) {
         CARD32 b = Fetch24(pixel) | 0xff000000;
         pixel += 3;
-        WRITE(buffer++, b);
+        *buffer++ = b;
     }
 }
 
@@ -113,13 +113,13 @@ fbFetch_b8g8r8 (const FbBits *bits, int 
     while (pixel < end) {
         CARD32 b = 0xff000000;
 #if IMAGE_BYTE_ORDER == MSBFirst
-        b |= (READ(pixel++));
-        b |= (READ(pixel++) << 8);
-        b |= (READ(pixel++) << 16);
+        b |= (*pixel++);
+        b |= (*pixel++ << 8);
+        b |= (*pixel++ << 16);
 #else
-        b |= (READ(pixel++) << 16);
-        b |= (READ(pixel++) << 8);
-        b |= (READ(pixel++));
+        b |= (*pixel++ << 16);
+        b |= (*pixel++ << 8);
+        b |= (*pixel++);
 #endif
     }
 }
@@ -130,13 +130,13 @@ fbFetch_r5g6b5 (const FbBits *bits, int 
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32 r = (((p) << 3) & 0xf8) | 
                    (((p) << 5) & 0xfc00) |
                    (((p) << 8) & 0xf80000);
         r |= (r >> 5) & 0x70007;
         r |= (r >> 6) & 0x300;
-        WRITE(buffer++, 0xff000000 | r);
+        *buffer++ = 0xff000000 | r;
     }
 }
 
@@ -146,13 +146,13 @@ fbFetch_b5g6r5 (const FbBits *bits, int 
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b;
 
         b = ((p & 0xf800) | ((p & 0xe000) >> 5)) >> 8;
         g = ((p & 0x07e0) | ((p & 0x0600) >> 6)) << 5;
         r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14;
-        WRITE(buffer++, (0xff000000 | r | g | b));
+        *buffer++ = (0xff000000 | r | g | b);
     }
 }
 
@@ -162,14 +162,14 @@ fbFetch_a1r5g5b5 (const FbBits *bits, in
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b, a;
 
         a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24;
         r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9;
         g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
         b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2;
-        WRITE(buffer++, (a | r | g | b));
+        *buffer++ = (a | r | g | b);
     }
 }
 
@@ -179,13 +179,13 @@ fbFetch_x1r5g5b5 (const FbBits *bits, in
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b;
 
         r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9;
         g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
         b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2;
-        WRITE(buffer++, (0xff000000 | r | g | b));
+        *buffer++ = (0xff000000 | r | g | b);
     }
 }
 
@@ -195,14 +195,14 @@ fbFetch_a1b5g5r5 (const FbBits *bits, in
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b, a;
 
         a = (CARD32) ((CARD8) (0 - ((p & 0x8000) >> 15))) << 24;
         b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7;
         g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
         r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14;
-        WRITE(buffer++, (a | r | g | b));
+        *buffer++ = (a | r | g | b);
     }
 }
 
@@ -212,13 +212,13 @@ fbFetch_x1b5g5r5 (const FbBits *bits, in
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b;
 
         b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7;
         g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
         r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14;
-        WRITE(buffer++, (0xff000000 | r | g | b));
+        *buffer++ = (0xff000000 | r | g | b);
     }
 }
 
@@ -228,14 +228,14 @@ fbFetch_a4r4g4b4 (const FbBits *bits, in
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b, a;
 
         a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16;
         r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12;
         g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
         b = ((p & 0x000f) | ((p & 0x000f) << 4));
-        WRITE(buffer++, (a | r | g | b));
+        *buffer++ = (a | r | g | b);
     }
 }
 
@@ -245,13 +245,13 @@ fbFetch_x4r4g4b4 (const FbBits *bits, in
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b;
 
         r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12;
         g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
         b = ((p & 0x000f) | ((p & 0x000f) << 4));
-        WRITE(buffer++, (0xff000000 | r | g | b));
+        *buffer++ = (0xff000000 | r | g | b);
     }
 }
 
@@ -261,14 +261,14 @@ fbFetch_a4b4g4r4 (const FbBits *bits, in
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b, a;
 
         a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16;
         b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4;
         g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
         r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16;
-        WRITE(buffer++, (a | r | g | b));
+        *buffer++ = (a | r | g | b);
     }
 }
 
@@ -278,13 +278,13 @@ fbFetch_x4b4g4r4 (const FbBits *bits, in
     const CARD16 *pixel = (const CARD16 *)bits + x;
     const CARD16 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b;
 
         b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4;
         g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
         r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16;
-        WRITE(buffer++, (0xff000000 | r | g | b));
+        *buffer++ = (0xff000000 | r | g | b);
     }
 }
 
@@ -294,7 +294,7 @@ fbFetch_a8 (const FbBits *bits, int x, i
     const CARD8 *pixel = (const CARD8 *)bits + x;
     const CARD8 *end = pixel + width;
     while (pixel < end) {
-        WRITE(buffer++, READ(pixel++) << 24);
+        *buffer++ = (*pixel++) << 24;
     }
 }
 
@@ -304,7 +304,7 @@ fbFetch_r3g3b2 (const FbBits *bits, int 
     const CARD8 *pixel = (const CARD8 *)bits + x;
     const CARD8 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b;
 
         r = ((p & 0xe0) | ((p & 0xe0) >> 3) | ((p & 0xc0) >> 6)) << 16;
@@ -313,7 +313,7 @@ fbFetch_r3g3b2 (const FbBits *bits, int 
              ((p & 0x03) << 2) |
              ((p & 0x03) << 4) |
              ((p & 0x03) << 6));
-        WRITE(buffer++, (0xff000000 | r | g | b));
+        *buffer++ = (0xff000000 | r | g | b);
     }
 }
 
@@ -323,7 +323,7 @@ fbFetch_b2g3r3 (const FbBits *bits, int 
     const CARD8 *pixel = (const CARD8 *)bits + x;
     const CARD8 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32  r,g,b;
 
         b = (((p & 0xc0)     ) |
@@ -334,7 +334,7 @@ fbFetch_b2g3r3 (const FbBits *bits, int 
         r = (((p & 0x07)     ) |
              ((p & 0x07) << 3) |
              ((p & 0x06) << 6)) << 16;
-        WRITE(buffer++, (0xff000000 | r | g | b));
+        *buffer++ = (0xff000000 | r | g | b);
 	}
 }
 
@@ -344,14 +344,14 @@ fbFetch_a2r2g2b2 (const FbBits *bits, in
     const CARD8 *pixel = (const CARD8 *)bits + x;
     const CARD8 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32   a,r,g,b;
 
         a = ((p & 0xc0) * 0x55) << 18;
         r = ((p & 0x30) * 0x55) << 12;
         g = ((p & 0x0c) * 0x55) << 6;
         b = ((p & 0x03) * 0x55);
-        WRITE(buffer++, a|r|g|b);
+        *buffer++ = a|r|g|b;
     }
 }
 
@@ -361,14 +361,14 @@ fbFetch_a2b2g2r2 (const FbBits *bits, in
     const CARD8 *pixel = (const CARD8 *)bits + x;
     const CARD8 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
+        CARD32  p = *pixel++;
         CARD32   a,r,g,b;
 
         a = ((p & 0xc0) * 0x55) << 18;
         b = ((p & 0x30) * 0x55) >> 6;
         g = ((p & 0x0c) * 0x55) << 6;
         r = ((p & 0x03) * 0x55) << 16;
-        WRITE(buffer++, a|r|g|b);
+        *buffer++ = a|r|g|b;
     }
 }
 
@@ -378,8 +378,8 @@ fbFetch_c8 (const FbBits *bits, int x, i
     const CARD8 *pixel = (const CARD8 *)bits + x;
     const CARD8 *end = pixel + width;
     while (pixel < end) {
-        CARD32  p = READ(pixel++);
-        WRITE(buffer++, indexed->rgba[p]);
+        CARD32  p = *pixel++;
+        *buffer++ = indexed->rgba[p];
     }
 }
 
@@ -389,8 +389,8 @@ fbFetch_x4a4 (const FbBits *bits, int x,
     const CARD8 *pixel = (const CARD8 *)bits + x;
     const CARD8 *end = pixel + width;
     while (pixel < end) {
-	CARD8 p = READ(pixel++) & 0xf;
-        WRITE(buffer++, (p | (p << 4)) << 24);
+	CARD8 p = (*pixel++) & 0xf;
+        *buffer++ = (p | (p << 4)) << 24;
     }
 }
 
@@ -409,7 +409,7 @@ fbFetch_a4 (const FbBits *bits, int x, i
         CARD32  p = Fetch4(bits, i + x);
 
         p |= p << 4;
-        WRITE(buffer++, p << 24);
+        *buffer++ = p << 24;
     }
 }
 
@@ -424,7 +424,7 @@ fbFetch_r1g2b1 (const FbBits *bits, int 
         r = ((p & 0x8) * 0xff) << 13;
         g = ((p & 0x6) * 0x55) << 7;
         b = ((p & 0x1) * 0xff);
-        WRITE(buffer++, 0xff000000|r|g|b);
+        *buffer++ = 0xff000000|r|g|b;
     }
 }
 
@@ -439,7 +439,7 @@ fbFetch_b1g2r1 (const FbBits *bits, int 
         b = ((p & 0x8) * 0xff) >> 3;
         g = ((p & 0x6) * 0x55) << 7;
         r = ((p & 0x1) * 0xff) << 16;
-        WRITE(buffer++, 0xff000000|r|g|b);
+        *buffer++ = 0xff000000|r|g|b;
     }
 }
 
@@ -455,7 +455,7 @@ fbFetch_a1r1g1b1 (const FbBits *bits, in
         r = ((p & 0x4) * 0xff) << 14;
         g = ((p & 0x2) * 0xff) << 7;
         b = ((p & 0x1) * 0xff);
-        WRITE(buffer++, a|r|g|b);
+        *buffer++ = a|r|g|b;
     }
 }
 
@@ -471,7 +471,7 @@ fbFetch_a1b1g1r1 (const FbBits *bits, in
         r = ((p & 0x4) * 0xff) >> 3;
         g = ((p & 0x2) * 0xff) << 7;
         b = ((p & 0x1) * 0xff) << 16;
-        WRITE(buffer++, a|r|g|b);
+        *buffer++ = a|r|g|b;
     }
 }
 
@@ -482,7 +482,7 @@ fbFetch_c4 (const FbBits *bits, int x, i
     for (i = 0; i < width; ++i) {
         CARD32  p = Fetch4(bits, i + x);
 
-        WRITE(buffer++, indexed->rgba[p]);
+        *buffer++ = indexed->rgba[p];
     }
 }
 
@@ -503,7 +503,7 @@ fbFetch_a1 (const FbBits *bits, int x, i
         a |= a << 1;
         a |= a << 2;
         a |= a << 4;
-        WRITE(buffer++, a << 24);
+        *buffer++ = a << 24;
     }
 }
 
@@ -520,7 +520,7 @@ fbFetch_g1 (const FbBits *bits, int x, i
         a = p >> ((i+x) & 0x1f);
 #endif
         a = a & 1;
-        WRITE(buffer++, indexed->rgba[a]);
+        *buffer++ = indexed->rgba[a];
     }
 }
 
@@ -585,19 +585,19 @@ typedef FASTCALL CARD32 (*fetchPixelProc
 static FASTCALL CARD32
 fbFetchPixel_a8r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    return READ((CARD32 *)bits + offset);
+    return ((CARD32 *)bits)[offset];
 }
 
 static FASTCALL CARD32
 fbFetchPixel_x8r8g8b8 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    return READ((CARD32 *)bits + offset) | 0xff000000;
+    return ((CARD32 *)bits)[offset] | 0xff000000;
 }
 
 static FASTCALL CARD32
 fbFetchPixel_a8b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD32 *)bits + offset);
+    CARD32  pixel = ((CARD32 *)bits)[offset];
 
     return ((pixel & 0xff000000) |
 	    ((pixel >> 16) & 0xff) |
@@ -608,7 +608,7 @@ fbFetchPixel_a8b8g8r8 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_x8b8g8r8 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD32 *)bits + offset);
+    CARD32  pixel = ((CARD32 *)bits)[offset];
 
     return ((0xff000000) |
 	    ((pixel >> 16) & 0xff) |
@@ -622,14 +622,14 @@ fbFetchPixel_r8g8b8 (const FbBits *bits,
     CARD8   *pixel = ((CARD8 *) bits) + (offset*3);
 #if IMAGE_BYTE_ORDER == MSBFirst
     return (0xff000000 |
-	    (READ(pixel + 0) << 16) |
-	    (READ(pixel + 1) << 8) |
-	    (READ(pixel + 2)));
+	    (pixel[0] << 16) |
+	    (pixel[1] << 8) |
+	    (pixel[2]));
 #else
     return (0xff000000 |
-            (READ(pixel + 2) << 16) |
-            (READ(pixel + 1) << 8) |
-            (READ(pixel + 0)));
+            (pixel[2] << 16) |
+            (pixel[1] << 8) |
+            (pixel[0]));
 #endif
 }
 
@@ -639,21 +639,21 @@ fbFetchPixel_b8g8r8 (const FbBits *bits,
     CARD8   *pixel = ((CARD8 *) bits) + (offset*3);
 #if IMAGE_BYTE_ORDER == MSBFirst
     return (0xff000000 |
-	    (READ(pixel + 2) << 16) |
-	    (READ(pixel + 1) << 8) |
-	    (READ(pixel + 0)));
+	    (pixel[2] << 16) |
+	    (pixel[1] << 8) |
+	    (pixel[0]));
 #else
     return (0xff000000 |
-	    (READ(pixel + 0) << 16) |
-	    (READ(pixel + 1) << 8) |
-	    (READ(pixel + 2)));
+	    (pixel[0] << 16) |
+	    (pixel[1] << 8) |
+	    (pixel[2]));
 #endif
 }
 
 static FASTCALL CARD32
 fbFetchPixel_r5g6b5 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  r,g,b;
 
     r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8;
@@ -665,7 +665,7 @@ fbFetchPixel_r5g6b5 (const FbBits *bits,
 static FASTCALL CARD32
 fbFetchPixel_b5g6r5 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  r,g,b;
 
     b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8;
@@ -677,7 +677,7 @@ fbFetchPixel_b5g6r5 (const FbBits *bits,
 static FASTCALL CARD32
 fbFetchPixel_a1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  a,r,g,b;
 
     a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24;
@@ -690,7 +690,7 @@ fbFetchPixel_a1r5g5b5 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_x1r5g5b5 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  r,g,b;
 
     r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9;
@@ -702,7 +702,7 @@ fbFetchPixel_x1r5g5b5 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_a1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  a,r,g,b;
 
     a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24;
@@ -715,7 +715,7 @@ fbFetchPixel_a1b5g5r5 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_x1b5g5r5 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  r,g,b;
 
     b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7;
@@ -727,7 +727,7 @@ fbFetchPixel_x1b5g5r5 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_a4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  a,r,g,b;
 
     a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16;
@@ -740,7 +740,7 @@ fbFetchPixel_a4r4g4b4 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_x4r4g4b4 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  r,g,b;
 
     r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12;
@@ -752,7 +752,7 @@ fbFetchPixel_x4r4g4b4 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_a4b4g4r4 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  a,r,g,b;
 
     a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16;
@@ -765,7 +765,7 @@ fbFetchPixel_a4b4g4r4 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_x4b4g4r4 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32  pixel = READ((CARD16 *) bits + offset);
+    CARD32  pixel = ((CARD16 *) bits)[offset];
     CARD32  r,g,b;
 
     b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4;
@@ -777,7 +777,7 @@ fbFetchPixel_x4b4g4r4 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_a8 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32   pixel = READ((CARD8 *) bits + offset);
+    CARD32   pixel = ((CARD8 *) bits)[offset];
 
     return pixel << 24;
 }
@@ -785,7 +785,7 @@ fbFetchPixel_a8 (const FbBits *bits, int
 static FASTCALL CARD32
 fbFetchPixel_r3g3b2 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32   pixel = READ((CARD8 *) bits + offset);
+    CARD32   pixel = ((CARD8 *) bits)[offset];
     CARD32  r,g,b;
 
     r = ((pixel & 0xe0) | ((pixel & 0xe0) >> 3) | ((pixel & 0xc0) >> 6)) << 16;
@@ -800,7 +800,7 @@ fbFetchPixel_r3g3b2 (const FbBits *bits,
 static FASTCALL CARD32
 fbFetchPixel_b2g3r3 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32   pixel = READ((CARD8 *) bits + offset);
+    CARD32   pixel = ((CARD8 *) bits)[offset];
     CARD32  r,g,b;
 
     b = (((pixel & 0xc0)     ) |
@@ -817,7 +817,7 @@ fbFetchPixel_b2g3r3 (const FbBits *bits,
 static FASTCALL CARD32
 fbFetchPixel_a2r2g2b2 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32   pixel = READ((CARD8 *) bits + offset);
+    CARD32   pixel = ((CARD8 *) bits)[offset];
     CARD32   a,r,g,b;
 
     a = ((pixel & 0xc0) * 0x55) << 18;
@@ -830,7 +830,7 @@ fbFetchPixel_a2r2g2b2 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_a2b2g2r2 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32   pixel = READ((CARD8 *) bits + offset);
+    CARD32   pixel = ((CARD8 *) bits)[offset];
     CARD32   a,r,g,b;
 
     a = ((pixel & 0xc0) * 0x55) << 18;
@@ -843,14 +843,14 @@ fbFetchPixel_a2b2g2r2 (const FbBits *bit
 static FASTCALL CARD32
 fbFetchPixel_c8 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32   pixel = READ((CARD8 *) bits + offset);
+    CARD32   pixel = ((CARD8 *) bits)[offset];
     return indexed->rgba[pixel];
 }
 
 static FASTCALL CARD32
 fbFetchPixel_x4a4 (const FbBits *bits, int offset, miIndexedPtr indexed)
 {
-    CARD32   pixel = READ((CARD8 *) bits + offset);
+    CARD32   pixel = ((CARD8 *) bits)[offset];
 
     return ((pixel & 0xf) | ((pixel & 0xf) << 4)) << 24;
 }
@@ -1027,7 +1027,7 @@ typedef FASTCALL void (*storeProc) (FbBi
 static FASTCALL void
 fbStore_a8r8g8b8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed)
 {
-    MEMCPY_WRAPPED(((CARD32 *)bits) + x, values, width*sizeof(CARD32));
+    memcpy(((CARD32 *)bits) + x, values, width*sizeof(CARD32));
 }
 
 static FASTCALL void
@@ -1036,7 +1036,7 @@ fbStore_x8r8g8b8 (FbBits *bits, const CA
     int i;
     CARD32 *pixel = (CARD32 *)bits + x;
     for (i = 0; i < width; ++i)
-        WRITE(pixel++, READ(values + i) & 0xffffff);
+        *pixel++ = values[i] & 0xffffff;
 }
 
 static FASTCALL void
@@ -1045,7 +1045,7 @@ fbStore_a8b8g8r8 (FbBits *bits, const CA
     int i;
     CARD32 *pixel = (CARD32 *)bits + x;
     for (i = 0; i < width; ++i)
-        WRITE(pixel++, (READ(values + i) & 0xff00ff00) | ((READ(values + i) >> 16) & 0xff) | ((READ(values + i) & 0xff) << 16));
+        *pixel++ = (values[i] & 0xff00ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16);
 }
 
 static FASTCALL void
@@ -1054,7 +1054,7 @@ fbStore_x8b8g8r8 (FbBits *bits, const CA
     int i;
     CARD32 *pixel = (CARD32 *)bits + x;
     for (i = 0; i < width; ++i)
-        WRITE(pixel++, (READ(values + i) & 0x0000ff00) | ((READ(values + i) >> 16) & 0xff) | ((READ(values + i) & 0xff) << 16));
+        *pixel++ = (values[i] & 0x0000ff00) | ((values[i] >> 16) & 0xff) | ((values[i] & 0xff) << 16);
 }
 
 static FASTCALL void
@@ -1063,7 +1063,7 @@ fbStore_r8g8b8 (FbBits *bits, const CARD
     int i;
     CARD8 *pixel = ((CARD8 *) bits) + 3*x;
     for (i = 0; i < width; ++i) {
-        Store24(pixel, READ(values + i));
+        Store24(pixel, values[i]);
         pixel += 3;
     }
 }
@@ -1074,15 +1074,14 @@ fbStore_b8g8r8 (FbBits *bits, const CARD
     int i;
     CARD8 *pixel = ((CARD8 *) bits) + 3*x;
     for (i = 0; i < width; ++i) {
-        CARD32 val = READ(values + i);
 #if IMAGE_BYTE_ORDER == MSBFirst
-        WRITE(pixel++, Blue(val));
-        WRITE(pixel++, Green(val));
-        WRITE(pixel++, Red(val));
+        *pixel++ = Blue(values[i]);
+        *pixel++ = Green(values[i]);
+        *pixel++ = Red(values[i]);
 #else
-        WRITE(pixel++, Red(val));
-        WRITE(pixel++, Green(val));
-        WRITE(pixel++, Blue(val));
+        *pixel++ = Red(values[i]);
+        *pixel++ = Green(values[i]);
+        *pixel++ = Blue(values[i]);
 #endif
     }
 }
@@ -1093,10 +1092,10 @@ fbStore_r5g6b5 (FbBits *bits, const CARD
     int i;
     CARD16 *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(values + i);
-        WRITE(pixel++, ((s >> 3) & 0x001f) |
-                       ((s >> 5) & 0x07e0) |
-                       ((s >> 8) & 0xf800));
+        CARD32 s = values[i];
+        *pixel++ = ((s >> 3) & 0x001f) |
+                   ((s >> 5) & 0x07e0) |
+                   ((s >> 8) & 0xf800);
     }
 }
 
@@ -1106,10 +1105,10 @@ fbStore_b5g6r5 (FbBits *bits, const CARD
     int i;
     CARD16  *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Split(READ(values + i));
-        WRITE(pixel++, ((b << 8) & 0xf800) |
-                       ((g << 3) & 0x07e0) |
-                       ((r >> 3)         ));
+        Split(values[i]);
+        *pixel++ = (((b << 8) & 0xf800) |
+                    ((g << 3) & 0x07e0) |
+                    ((r >> 3)         ));
     }
 }
 
@@ -1119,11 +1118,11 @@ fbStore_a1r5g5b5 (FbBits *bits, const CA
     int i;
     CARD16  *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Splita(READ(values + i));
-        WRITE(pixel++, ((a << 8) & 0x8000) |
-                       ((r << 7) & 0x7c00) |
-                       ((g << 2) & 0x03e0) |
-                       ((b >> 3)         ));
+        Splita(values[i]);
+        *pixel++ = (((a << 8) & 0x8000) |
+                    ((r << 7) & 0x7c00) |
+                    ((g << 2) & 0x03e0) |
+                    ((b >> 3)         ));
     }
 }
 
@@ -1133,10 +1132,10 @@ fbStore_x1r5g5b5 (FbBits *bits, const CA
     int i;
     CARD16  *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Split(READ(values + i));
-        WRITE(pixel++, ((r << 7) & 0x7c00) |
-                       ((g << 2) & 0x03e0) |
-                       ((b >> 3)         ));
+        Split(values[i]);
+        *pixel++ = (((r << 7) & 0x7c00) |
+                    ((g << 2) & 0x03e0) |
+                    ((b >> 3)         ));
     }
 }
 
@@ -1146,11 +1145,11 @@ fbStore_a1b5g5r5 (FbBits *bits, const CA
     int i;
     CARD16  *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Splita(READ(values + i));
-        WRITE(pixel++, ((a << 8) & 0x8000) |
-                       ((b << 7) & 0x7c00) |
-                       ((g << 2) & 0x03e0) |
-                       ((r >> 3)         ));
+        Splita(values[i]);
+        *pixel++ = (((a << 8) & 0x8000) |
+                    ((b << 7) & 0x7c00) |
+                    ((g << 2) & 0x03e0) |
+                    ((r >> 3)         ));
 	}
 }
 
@@ -1160,10 +1159,10 @@ fbStore_x1b5g5r5 (FbBits *bits, const CA
     int i;
     CARD16  *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Split(READ(values + i));
-        WRITE(pixel++, ((b << 7) & 0x7c00) |
-                       ((g << 2) & 0x03e0) |
-                       ((r >> 3)         ));
+        Split(values[i]);
+        *pixel++ = (((b << 7) & 0x7c00) |
+                    ((g << 2) & 0x03e0) |
+                    ((r >> 3)         ));
     }
 }
 
@@ -1173,11 +1172,11 @@ fbStore_a4r4g4b4 (FbBits *bits, const CA
     int i;
     CARD16  *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Splita(READ(values + i));
-        WRITE(pixel++, ((a << 8) & 0xf000) |
-                       ((r << 4) & 0x0f00) |
-                       ((g     ) & 0x00f0) |
-                       ((b >> 4)         ));
+        Splita(values[i]);
+        *pixel++ = (((a << 8) & 0xf000) |
+                    ((r << 4) & 0x0f00) |
+                    ((g     ) & 0x00f0) |
+                    ((b >> 4)         ));
     }
 }
 
@@ -1187,10 +1186,10 @@ fbStore_x4r4g4b4 (FbBits *bits, const CA
     int i;
     CARD16  *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Split(READ(values + i));
-        WRITE(pixel++, ((r << 4) & 0x0f00) |
-                       ((g     ) & 0x00f0) |
-                       ((b >> 4)         ));
+        Split(values[i]);
+        *pixel++ = (((r << 4) & 0x0f00) |
+                    ((g     ) & 0x00f0) |
+                    ((b >> 4)         ));
     }
 }
 
@@ -1200,11 +1199,11 @@ fbStore_a4b4g4r4 (FbBits *bits, const CA
     int i;
     CARD16  *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Splita(READ(values + i));
-        WRITE(pixel++, ((a << 8) & 0xf000) |
-                       ((b << 4) & 0x0f00) |
-                       ((g     ) & 0x00f0) |
-                       ((r >> 4)         ));
+        Splita(values[i]);
+        *pixel++ = (((a << 8) & 0xf000) |
+                    ((b << 4) & 0x0f00) |
+                    ((g     ) & 0x00f0) |
+                    ((r >> 4)         ));
     }
 }
 
@@ -1214,10 +1213,10 @@ fbStore_x4b4g4r4 (FbBits *bits, const CA
     int i;
     CARD16  *pixel = ((CARD16 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Split(READ(values + i));
-        WRITE(pixel++, ((b << 4) & 0x0f00) |
-                       ((g     ) & 0x00f0) |
-                       ((r >> 4)         ));
+        Split(values[i]);
+        *pixel++ = (((b << 4) & 0x0f00) |
+                    ((g     ) & 0x00f0) |
+                    ((r >> 4)         ));
     }
 }
 
@@ -1227,7 +1226,7 @@ fbStore_a8 (FbBits *bits, const CARD32 *
     int i;
     CARD8   *pixel = ((CARD8 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        WRITE(pixel++, READ(values + i) >> 24);
+        *pixel++ = values[i] >> 24;
     }
 }
 
@@ -1237,10 +1236,10 @@ fbStore_r3g3b2 (FbBits *bits, const CARD
     int i;
     CARD8   *pixel = ((CARD8 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Split(READ(values + i));
-        WRITE(pixel++, ((r     ) & 0xe0) |
-                       ((g >> 3) & 0x1c) |
-                       ((b >> 6)       ));
+        Split(values[i]);
+        *pixel++ = (((r     ) & 0xe0) |
+                    ((g >> 3) & 0x1c) |
+                    ((b >> 6)       ));
     }
 }
 
@@ -1250,10 +1249,10 @@ fbStore_b2g3r3 (FbBits *bits, const CARD
     int i;
     CARD8   *pixel = ((CARD8 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Split(READ(values + i));
-        WRITE(pixel++, ((b     ) & 0xe0) |
-                       ((g >> 3) & 0x1c) |
-                       ((r >> 6)       ));
+        Split(values[i]);
+        *pixel++ = (((b     ) & 0xe0) |
+                    ((g >> 3) & 0x1c) |
+                    ((r >> 6)       ));
     }
 }
 
@@ -1263,11 +1262,11 @@ fbStore_a2r2g2b2 (FbBits *bits, const CA
     int i;
     CARD8   *pixel = ((CARD8 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        Splita(READ(values + i));
-        WRITE(pixel++, ((a     ) & 0xc0) |
-                       ((r >> 2) & 0x30) |
-                       ((g >> 4) & 0x0c) |
-                       ((b >> 6)       ));
+        Splita(values[i]);
+        *pixel++ = (((a     ) & 0xc0) |
+                    ((r >> 2) & 0x30) |
+                    ((g >> 4) & 0x0c) |
+                    ((b >> 6)       ));
     }
 }
 
@@ -1277,7 +1276,7 @@ fbStore_c8 (FbBits *bits, const CARD32 *
     int i;
     CARD8   *pixel = ((CARD8 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        WRITE(pixel++, miIndexToEnt24(indexed,READ(values + i)));
+        *pixel++ = miIndexToEnt24(indexed,values[i]);
     }
 }
 
@@ -1287,7 +1286,7 @@ fbStore_x4a4 (FbBits *bits, const CARD32
     int i;
     CARD8   *pixel = ((CARD8 *) bits) + x;
     for (i = 0; i < width; ++i) {
-        WRITE(pixel++, READ(values + i) >> 28);
+        *pixel++ = values[i] >> 28;
     }
 }
 
@@ -1307,7 +1306,7 @@ fbStore_a4 (FbBits *bits, const CARD32 *
 {
     int i;
     for (i = 0; i < width; ++i) {
-        Store4(bits, i + x, READ(values + i)>>28);
+        Store4(bits, i + x, values[i]>>28);
     }
 }
 
@@ -1318,7 +1317,7 @@ fbStore_r1g2b1 (FbBits *bits, const CARD
     for (i = 0; i < width; ++i) {
         CARD32  pixel;
 
-        Split(READ(values + i));
+        Split(values[i]);
         pixel = (((r >> 4) & 0x8) |
                  ((g >> 5) & 0x6) |
                  ((b >> 7)      ));
@@ -1333,7 +1332,7 @@ fbStore_b1g2r1 (FbBits *bits, const CARD
     for (i = 0; i < width; ++i) {
         CARD32  pixel;
 
-        Split(READ(values + i));
+        Split(values[i]);
         pixel = (((b >> 4) & 0x8) |
                  ((g >> 5) & 0x6) |
                  ((r >> 7)      ));
@@ -1347,7 +1346,7 @@ fbStore_a1r1g1b1 (FbBits *bits, const CA
     int i;
     for (i = 0; i < width; ++i) {
         CARD32  pixel;
-        Splita(READ(values + i));
+        Splita(values[i]);
         pixel = (((a >> 4) & 0x8) |
                  ((r >> 5) & 0x4) |
                  ((g >> 6) & 0x2) |
@@ -1362,7 +1361,7 @@ fbStore_a1b1g1r1 (FbBits *bits, const CA
     int i;
     for (i = 0; i < width; ++i) {
         CARD32  pixel;
-        Splita(READ(values + i));
+        Splita(values[i]);
         pixel = (((a >> 4) & 0x8) |
                  ((b >> 5) & 0x4) |
                  ((g >> 6) & 0x2) |
@@ -1378,7 +1377,7 @@ fbStore_c4 (FbBits *bits, const CARD32 *
     for (i = 0; i < width; ++i) {
         CARD32  pixel;
 
-        pixel = miIndexToEnt24(indexed, READ(values + i));
+        pixel = miIndexToEnt24(indexed, values[i]);
         Store4(bits, i + x, pixel);
     }
 }
@@ -1391,8 +1390,8 @@ fbStore_a1 (FbBits *bits, const CARD32 *
         CARD32  *pixel = ((CARD32 *) bits) + ((i+x) >> 5);
         CARD32  mask = FbStipMask((i+x) & 0x1f, 1);
 
-        CARD32 v = READ(values + i) & 0x80000000 ? mask : 0;
-        WRITE(pixel, (READ(pixel) & ~mask) | v);
+        CARD32 v = values[i] & 0x80000000 ? mask : 0;
+        *pixel = (*pixel & ~mask) | v;
     }
 }
 
@@ -1404,8 +1403,8 @@ fbStore_g1 (FbBits *bits, const CARD32 *
         CARD32  *pixel = ((CARD32 *) bits) + ((i+x) >> 5);
         CARD32  mask = FbStipMask((i+x) & 0x1f, 1);
 
-        CARD32 v = miIndexToEntY24(indexed,READ(values + i)) ? mask : 0;
-        WRITE(pixel, (READ(pixel) & ~mask) | v);
+        CARD32 v = miIndexToEntY24(indexed,values[i]) ? mask : 0;
+        *pixel = (*pixel & ~mask) | v;
     }
 }
 
@@ -1470,10 +1469,10 @@ fbCombineMaskU (CARD32 *src, const CARD3
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 a = READ(mask + i) >> 24;
-        CARD32 s = READ(src + i);
+        CARD32 a = mask[i] >> 24;
+        CARD32 s = src[i];
         FbByteMul(s, a);
-        WRITE(src + i, s);
+        src[i] = s;
     }
 }
 
@@ -1484,13 +1483,13 @@ fbCombineMaskU (CARD32 *src, const CARD3
 static FASTCALL void
 fbCombineClear (CARD32 *dest, const CARD32 *src, int width)
 {
-    MEMSET_WRAPPED(dest, 0, width*sizeof(CARD32));
+    memset(dest, 0, width*sizeof(CARD32));
 }
 
 static FASTCALL void
 fbCombineSrcU (CARD32 *dest, const CARD32 *src, int width)
 {
-    MEMCPY_WRAPPED(dest, src, width*sizeof(CARD32));
+    memcpy(dest, src, width*sizeof(CARD32));
 }
 
 
@@ -1499,12 +1498,12 @@ fbCombineOverU (CARD32 *dest, const CARD
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 d = READ(dest + i);
+        CARD32 s = src[i];
+        CARD32 d = dest[i];
         CARD32 ia = Alpha(~s);
 
         FbByteMulAdd(d, ia, s);
-        WRITE(dest + i, d);
+        dest[i] = d;
     }
 }
 
@@ -1513,11 +1512,11 @@ fbCombineOverReverseU (CARD32 *dest, con
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 d = READ(dest + i);
-        CARD32 ia = Alpha(~READ(dest + i));
+        CARD32 s = src[i];
+        CARD32 d = dest[i];
+        CARD32 ia = Alpha(~dest[i]);
         FbByteMulAdd(s, ia, d);
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -1526,10 +1525,10 @@ fbCombineInU (CARD32 *dest, const CARD32
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 a = Alpha(READ(dest + i));
+        CARD32 s = src[i];
+        CARD32 a = Alpha(dest[i]);
         FbByteMul(s, a);
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -1538,10 +1537,10 @@ fbCombineInReverseU (CARD32 *dest, const
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 d = READ(dest + i);
-        CARD32 a = Alpha(READ(src + i));
+        CARD32 d = dest[i];
+        CARD32 a = Alpha(src[i]);
         FbByteMul(d, a);
-        WRITE(dest + i, d);
+        dest[i] = d;
     }
 }
 
@@ -1550,10 +1549,10 @@ fbCombineOutU (CARD32 *dest, const CARD3
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 a = Alpha(~READ(dest + i));
+        CARD32 s = src[i];
+        CARD32 a = Alpha(~dest[i]);
         FbByteMul(s, a);
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -1562,10 +1561,10 @@ fbCombineOutReverseU (CARD32 *dest, cons
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 d = READ(dest + i);
-        CARD32 a = Alpha(~READ(src + i));
+        CARD32 d = dest[i];
+        CARD32 a = Alpha(~src[i]);
         FbByteMul(d, a);
-        WRITE(dest + i, d);
+        dest[i] = d;
     }
 }
 
@@ -1574,13 +1573,13 @@ fbCombineAtopU (CARD32 *dest, const CARD
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 d = READ(dest + i);
+        CARD32 s = src[i];
+        CARD32 d = dest[i];
         CARD32 dest_a = Alpha(d);
         CARD32 src_ia = Alpha(~s);
 
         FbByteAddMul(s, dest_a, d, src_ia);
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -1589,13 +1588,13 @@ fbCombineAtopReverseU (CARD32 *dest, con
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 d = READ(dest + i);
+        CARD32 s = src[i];
+        CARD32 d = dest[i];
         CARD32 src_a = Alpha(s);
         CARD32 dest_ia = Alpha(~d);
 
         FbByteAddMul(s, dest_ia, d, src_a);
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -1604,13 +1603,13 @@ fbCombineXorU (CARD32 *dest, const CARD3
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 d = READ(dest + i);
+        CARD32 s = src[i];
+        CARD32 d = dest[i];
         CARD32 src_ia = Alpha(~s);
         CARD32 dest_ia = Alpha(~d);
 
         FbByteAddMul(s, dest_ia, d, src_ia);
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -1619,10 +1618,10 @@ fbCombineAddU (CARD32 *dest, const CARD3
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 d = READ(dest + i);
+        CARD32 s = src[i];
+        CARD32 d = dest[i];
         FbByteAdd(d, s);
-        WRITE(dest + i, d);
+        dest[i] = d;
     }
 }
 
@@ -1631,8 +1630,8 @@ fbCombineSaturateU (CARD32 *dest, const 
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32  s = READ(src + i);
-        CARD32 d = READ(dest + i);
+        CARD32  s = src[i];
+        CARD32 d = dest[i];
         CARD16  sa, da;
 
         sa = s >> 24;
@@ -1643,7 +1642,7 @@ fbCombineSaturateU (CARD32 *dest, const 
             FbByteMul(s, sa);
         }
         FbByteAdd(d, s);
-        WRITE(dest + i, d);
+        dest[i] = d;
     }
 }
 
@@ -1717,8 +1716,8 @@ fbCombineDisjointGeneralU (CARD32 *dest,
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 d = READ(dest + i);
+        CARD32 s = src[i];
+        CARD32 d = dest[i];
         CARD32 m,n,o,p;
         CARD16 Fa, Fb, t, u, v;
         CARD8 sa = s >> 24;
@@ -1758,7 +1757,7 @@ fbCombineDisjointGeneralU (CARD32 *dest,
         o = FbGen (s,d,16,Fa,Fb,t, u, v);
         p = FbGen (s,d,24,Fa,Fb,t, u, v);
         s = m|n|o|p;
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -1767,19 +1766,19 @@ fbCombineDisjointOverU (CARD32 *dest, co
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32  s = READ(src + i);
+        CARD32  s = src[i];
         CARD16  a = s >> 24;
 
         if (a != 0x00)
         {
             if (a != 0xff)
             {
-                CARD32 d = READ(dest + i);
+                CARD32 d = dest[i];
                 a = fbCombineDisjointOutPart (d >> 24, a);
                 FbByteMulAdd(d, a, s);
                 s = d;
             }
-            WRITE(dest + i, s);
+            dest[i] = s;
         }
     }
 }
@@ -1856,8 +1855,8 @@ fbCombineConjointGeneralU (CARD32 *dest,
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32  s = READ(src + i);
-        CARD32 d = READ(dest + i);
+        CARD32  s = src[i];
+        CARD32 d = dest[i];
         CARD32  m,n,o,p;
         CARD16  Fa, Fb, t, u, v;
         CARD8 sa = s >> 24;
@@ -1897,7 +1896,7 @@ fbCombineConjointGeneralU (CARD32 *dest,
         o = FbGen (s,d,16,Fa,Fb,t, u, v);
         p = FbGen (s,d,24,Fa,Fb,t, u, v);
         s = m|n|o|p;
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -2010,32 +2009,32 @@ fbCombineMaskC (CARD32 *src, CARD32 *mas
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 a = READ(mask + i);
+        CARD32 a = mask[i];
 
         CARD32	x;
         CARD16	xa;
 
         if (!a)
         {
-            WRITE(src + i, 0);
+            src[i] = 0;
             continue;
         }
 
-        x = READ(src + i);
+        x = src[i];
         if (a == 0xffffffff)
         {
             x = x >> 24;
             x |= x << 8;
             x |= x << 16;
-            WRITE(mask + i, x);
+            mask[i] = x;
             continue;
         }
 
         xa = x >> 24;
         FbByteMulC(x, a);
-        WRITE(src + i, x);
+        src[i] = x;
         FbByteMul(a, xa);
-        WRITE(mask + i, a);
+        mask[i] = a;
     }
 }
 
@@ -2044,21 +2043,21 @@ fbCombineMaskValueC (CARD32 *src, const 
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 a = READ(mask + i);
+        CARD32 a = mask[i];
         CARD32	x;
 
         if (!a)
         {
-            WRITE(src + i, 0);
+            src[i] = 0;
             continue;
         }
 
         if (a == 0xffffffff)
             continue;
 
-        x = READ(src + i);
+        x = src[i];
         FbByteMulC(x, a);
-        WRITE(src + i, x);
+        src[i] = x;
     }
 }
 
@@ -2068,13 +2067,13 @@ fbCombineMaskAlphaC (const CARD32 *src, 
 {
     int i;
     for (i = 0; i < width; ++i) {
-        CARD32 a = READ(mask + i);
+        CARD32 a = mask[i];
         CARD32	x;
 
         if (!a)
             continue;
 
-        x = READ(src + i) >> 24;
+        x = src[i] >> 24;
         if (x == 0xff)
             continue;
         if (a == 0xffffffff)
@@ -2082,12 +2081,12 @@ fbCombineMaskAlphaC (const CARD32 *src, 
             x = x >> 24;
             x |= x << 8;
             x |= x << 16;
-            WRITE(mask + i, x);
+            mask[i] = x;
             continue;
         }
 
         FbByteMul(a, x);
-        WRITE(mask + i, a);
+        mask[i] = a;
     }
 }
 
@@ -2101,7 +2100,7 @@ static FASTCALL void
 fbCombineSrcC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width)
 {
     fbCombineMaskValueC(src, mask, width);
-    MEMCPY_WRAPPED(dest, src, width*sizeof(CARD32));
+    memcpy(dest, src, width*sizeof(CARD32));
 }
 
 static FASTCALL void
@@ -2110,18 +2109,18 @@ fbCombineOverC (CARD32 *dest, CARD32 *sr
     int i;
     fbCombineMaskC(src, mask, width);
     for (i = 0; i < width; ++i) {
-        CARD32  s = READ(src + i);
-        CARD32  a = ~READ(mask + i);
+        CARD32  s = src[i];
+        CARD32  a = ~mask[i];
 
         if (a != 0xffffffff)
         {
             if (a)
             {
-                CARD32 d = READ(dest + i);
+                CARD32 d = dest[i];
                 FbByteMulAddC(d, a, s);
                 s = d;
             }
-            WRITE(dest + i, s);
+            dest[i] = s;
         }
     }
 }
@@ -2132,17 +2131,17 @@ fbCombineOverReverseC (CARD32 *dest, CAR
     int i;
     fbCombineMaskValueC(src, mask, width);
     for (i = 0; i < width; ++i) {
-        CARD32 d = READ(dest + i);
+        CARD32 d = dest[i];
         CARD32 a = ~d >> 24;
 
         if (a)
         {
-            CARD32 s = READ(src + i);
+            CARD32 s = src[i];
             if (a != 0xff)
             {
                 FbByteMulAdd(s, a, d);
             }
-            WRITE(dest + i, s);
+            dest[i] = s;
         }
     }
 }
@@ -2153,18 +2152,18 @@ fbCombineInC (CARD32 *dest, CARD32 *src,
     int i;
     fbCombineMaskValueC(src, mask, width);
     for (i = 0; i < width; ++i) {
-        CARD32 d = READ(dest + i);
+        CARD32 d = dest[i];
         CARD16 a = d >> 24;
         CARD32 s = 0;
         if (a)
         {
-            s = READ(src + i);
+            s = src[i];
             if (a != 0xff)
             {
                 FbByteMul(s, a);
             }
         }
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -2174,17 +2173,17 @@ fbCombineInReverseC (CARD32 *dest, CARD3
     int i;
     fbCombineMaskAlphaC(src, mask, width);
     for (i = 0; i < width; ++i) {
-        CARD32 a = READ(mask + i);
+        CARD32 a = mask[i];
 
         if (a != 0xffffffff)
         {
             CARD32 d = 0;
             if (a)
             {
-                d = READ(dest + i);
+                d = dest[i];
                 FbByteMulC(d, a);
             }
-            WRITE(dest + i, d);
+            dest[i] = d;
         }
     }
 }
@@ -2195,18 +2194,18 @@ fbCombineOutC (CARD32 *dest, CARD32 *src
     int i;
     fbCombineMaskValueC(src, mask, width);
     for (i = 0; i < width; ++i) {
-        CARD32 d = READ(dest + i);
+        CARD32 d = dest[i];
         CARD16 a = ~d >> 24;
         CARD32 s = 0;
         if (a)
         {
-            s = READ(src + i);
+            s = src[i];
             if (a != 0xff)
             {
                 FbByteMul(s, a);
             }
         }
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -2216,17 +2215,17 @@ fbCombineOutReverseC (CARD32 *dest, CARD
     int i;
     fbCombineMaskAlphaC(src, mask, width);
     for (i = 0; i < width; ++i) {
-        CARD32 a = ~READ(mask + i);
+        CARD32 a = ~mask[i];
 
         if (a != 0xffffffff)
         {
             CARD32 d = 0;
             if (a)
             {
-                d = READ(dest + i);
+                d = dest[i];
                 FbByteMulC(d, a);
             }
-            WRITE(dest + i, d);
+            dest[i] = d;
         }
     }
 }
@@ -2237,12 +2236,12 @@ fbCombineAtopC (CARD32 *dest, CARD32 *sr
     int i;
     fbCombineMaskC(src, mask, width);
     for (i = 0; i < width; ++i) {
-        CARD32 d = READ(dest + i);
-        CARD32 s = READ(src + i);
-        CARD32 ad = ~READ(mask + i);
+        CARD32 d = dest[i];
+        CARD32 s = src[i];
+        CARD32 ad = ~mask[i];
         CARD16 as = d >> 24;
         FbByteAddMulC(d, ad, s, as);
-        WRITE(dest + i, d);
+        dest[i] = d;
     }
 }
 
@@ -2253,12 +2252,12 @@ fbCombineAtopReverseC (CARD32 *dest, CAR
     fbCombineMaskC(src, mask, width);
     for (i = 0; i < width; ++i) {
 
-        CARD32 d = READ(dest + i);
-        CARD32 s = READ(src + i);
-        CARD32 ad = READ(mask + i);
+        CARD32 d = dest[i];
+        CARD32 s = src[i];
+        CARD32 ad = mask[i];
         CARD16 as = ~d >> 24;
         FbByteAddMulC(d, ad, s, as);
-        WRITE(dest + i, d);
+        dest[i] = d;
     }
 }
 
@@ -2268,12 +2267,12 @@ fbCombineXorC (CARD32 *dest, CARD32 *src
     int i;
     fbCombineMaskC(src, mask, width);
     for (i = 0; i < width; ++i) {
-        CARD32 d = READ(dest + i);
-        CARD32 s = READ(src + i);
-        CARD32 ad = ~READ(mask + i);
+        CARD32 d = dest[i];
+        CARD32 s = src[i];
+        CARD32 ad = ~mask[i];
         CARD16 as = ~d >> 24;
         FbByteAddMulC(d, ad, s, as);
-        WRITE(dest + i, d);
+        dest[i] = d;
     }
 }
 
@@ -2283,10 +2282,10 @@ fbCombineAddC (CARD32 *dest, CARD32 *src
     int i;
     fbCombineMaskValueC(src, mask, width);
     for (i = 0; i < width; ++i) {
-        CARD32 s = READ(src + i);
-        CARD32 d = READ(dest + i);
+        CARD32 s = src[i];
+        CARD32 d = dest[i];
         FbByteAdd(d, s);
-        WRITE(dest + i, d);
+        dest[i] = d;
     }
 }
 
@@ -2301,12 +2300,12 @@ fbCombineSaturateC (CARD32 *dest, CARD32
         CARD16  t, u, v;
         CARD32  m,n,o,p;
 
-        d = READ(dest + i);
-        s = READ(src + i);
-        sa = (READ(mask + i) >> 24);
-        sr = (READ(mask + i) >> 16) & 0xff;
-        sg = (READ(mask + i) >>  8) & 0xff;
-        sb = (READ(mask + i)      ) & 0xff;
+        d = dest[i];
+        s = src[i];
+        sa = (mask[i] >> 24);
+        sr = (mask[i] >> 16) & 0xff;
+        sg = (mask[i] >>  8) & 0xff;
+        sb = (mask[i]      ) & 0xff;
         da = ~d >> 24;
 
         if (sb <= da)
@@ -2329,7 +2328,7 @@ fbCombineSaturateC (CARD32 *dest, CARD32
         else
             p = FbGen (s, d, 24, (da << 8) / sa, 0xff, t, u, v);
 
-        WRITE(dest + i, m|n|o|p);
+        dest[i] = m|n|o|p;
     }
 }
 
@@ -2346,9 +2345,9 @@ fbCombineDisjointGeneralC (CARD32 *dest,
         CARD32  sa;
         CARD8   da;
 
-        s = READ(src + i);
-        sa = READ(mask + i);
-        d = READ(dest + i);
+        s = src[i];
+        sa = mask[i];
+        d = dest[i];
         da = d >> 24;
 
         switch (combine & CombineA) {
@@ -2401,7 +2400,7 @@ fbCombineDisjointGeneralC (CARD32 *dest,
         o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v);
         p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v);
         s = m|n|o|p;
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -2466,9 +2465,9 @@ fbCombineConjointGeneralC (CARD32 *dest,
         CARD32  sa;
         CARD8   da;
 
-        s = READ(src + i);
-        sa = READ(mask + i);
-        d = READ(dest + i);
+        s = src[i];
+        sa = mask[i];
+        d = dest[i];
         da = d >> 24;
 
         switch (combine & CombineA) {
@@ -2521,7 +2520,7 @@ fbCombineConjointGeneralC (CARD32 *dest,
         o = FbGen (s,d,16,FbGet8(Fa,16),FbGet8(Fb,16),t, u, v);
         p = FbGen (s,d,24,FbGet8(Fa,24),FbGet8(Fb,24),t, u, v);
         s = m|n|o|p;
-        WRITE(dest + i, s);
+        dest[i] = s;
     }
 }
 
@@ -2652,8 +2651,7 @@ static void fbFetchSolid(PicturePtr pict
 
     end = buffer + width;
     while (buffer < end)
-        WRITE(buffer++, color);
-    fbFinishAccess (pict->pDrawable);
+        *buffer++ = color;
 }
 
 static void fbFetch(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
@@ -2672,7 +2670,6 @@ static void fbFetch(PicturePtr pict, int
     bits += y*stride;
 
     fetch(bits, x, width, buffer, indexed);
-    fbFinishAccess (pict->pDrawable);
 }
 
 #define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
@@ -2720,7 +2717,7 @@ static void fbFetchSourcePict(PicturePtr
     if (pGradient->type == SourcePictTypeSolidFill) {
         register CARD32 color = pGradient->solidFill.color;
         while (buffer < end) {
-            WRITE(buffer++, color);
+            *buffer++ = color;
         }
     } else if (pGradient->type == SourcePictTypeLinear) {
         PictVector v, unit;
@@ -2762,7 +2759,7 @@ static void fbFetchSourcePict(PicturePtr
                 inc = (a * unit.vector[0] + b * unit.vector[1]) >> 16;
             }
             while (buffer < end) {
-                WRITE(buffer++, gradientPixel(pGradient, t, pict->repeatType));
+                *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
                 t += inc;
             }
         } else {
@@ -2777,7 +2774,7 @@ static void fbFetchSourcePict(PicturePtr
                     y = ((xFixed_48_16)v.vector[1] << 16) / v.vector[2];
                     t = ((a*x + b*y) >> 16) + off;
                 }
-                WRITE(buffer++, gradientPixel(pGradient, t, pict->repeatType));
+                *buffer++ = gradientPixel(pGradient, t, pict->repeatType);
                 v.vector[0] += unit.vector[0];
                 v.vector[1] += unit.vector[1];
                 v.vector[2] += unit.vector[2];
@@ -2821,9 +2818,9 @@ static void fbFetchSourcePict(PicturePtr
                     double c = -(rx*rx + ry*ry);
                     double det = (b * b) - (4 * pGradient->radial.a * c);
                     double s = (-b + sqrt(det))/(2. * pGradient->radial.a);
-                    WRITE(buffer, gradientPixel(pGradient,
-                                                (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
-                                                pict->repeatType));
+                    *buffer = gradientPixel(pGradient,
+                                            (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
+                                            pict->repeatType);
                     ++buffer;
                     rx += cx;
                     ry += cy;
@@ -2844,9 +2841,9 @@ static void fbFetchSourcePict(PicturePtr
                     c = -(x*x + y*y);
                     det = (b * b) - (4 * pGradient->radial.a * c);
                     s = (-b + sqrt(det))/(2. * pGradient->radial.a);
-                    WRITE(buffer, gradientPixel(pGradient,
-                                                (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
-                                                pict->repeatType));
+                    *buffer = gradientPixel(pGradient,
+                                            (xFixed_48_16)((s*pGradient->radial.m + pGradient->radial.b)*65536),
+                                            pict->repeatType);
                     ++buffer;
                     rx += cx;
                     ry += cy;
@@ -2861,8 +2858,8 @@ static void fbFetchSourcePict(PicturePtr
 
                 while (buffer < end) {
                     double angle = atan2(ry, rx) + a;
-                    WRITE(buffer, gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
-                                                pict->repeatType));
+                    *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
+                                            pict->repeatType);
                     ++buffer;
                     rx += cx;
                     ry += cy;
@@ -2880,8 +2877,8 @@ static void fbFetchSourcePict(PicturePtr
                     x -= pGradient->conical.center.x/65536.;
                     y -= pGradient->conical.center.y/65536.;
                     angle = atan2(y, x) + a;
-                    WRITE(buffer, gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
-                                                pict->repeatType));
+                    *buffer = gradientPixel(pGradient, (xFixed_48_16) (angle * (65536. / (2*M_PI))),
+                                            pict->repeatType);
                     ++buffer;
                     rx += cx;
                     ry += cy;
@@ -2924,10 +2921,8 @@ static void fbFetchTransformed(PicturePt
 
     /* when using convolution filters one might get here without a transform */
     if (pict->transform) {
-        if (!PictureTransformPoint3d (pict->transform, &v)) {
-            fbFinishAccess (pict->pDrawable);
+        if (!PictureTransformPoint3d (pict->transform, &v))
             return;
-        }
         unit.vector[0] = pict->transform->matrix[0][0];
         unit.vector[1] = pict->transform->matrix[1][0];
         unit.vector[2] = pict->transform->matrix[2][0];
@@ -2944,7 +2939,7 @@ static void fbFetchTransformed(PicturePt
             if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
                 for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
-                        WRITE(buffer + i, 0);
+                        buffer[i] = 0;
                     } else {
                         if (!affine) {
                             y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height);
@@ -2953,7 +2948,7 @@ static void fbFetchTransformed(PicturePt
                             y = MOD(v.vector[1]>>16, pict->pDrawable->height);
                             x = MOD(v.vector[0]>>16, pict->pDrawable->width);
                         }
-                        WRITE(buffer + i, fetch(bits + (y + dy)*stride, x + dx, indexed));
+                        buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed);
                     }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
@@ -2962,7 +2957,7 @@ static void fbFetchTransformed(PicturePt
             } else {
                 for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
-                        WRITE(buffer + i, 0);
+                        buffer[i] = 0;
                     } else {
                         if (!affine) {
                             y = MOD(DIV(v.vector[1],v.vector[2]), pict->pDrawable->height);
@@ -2972,9 +2967,9 @@ static void fbFetchTransformed(PicturePt
                             x = MOD(v.vector[0]>>16, pict->pDrawable->width);
                         }
                         if (POINT_IN_REGION (0, pict->pCompositeClip, x + dx, y + dy, &box))
-                            WRITE(buffer + i, fetch(bits + (y + dy)*stride, x + dx, indexed));
+                            buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed);
                         else
-                            WRITE(buffer + i, 0);
+                            buffer[i] = 0;
                     }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
@@ -2986,7 +2981,7 @@ static void fbFetchTransformed(PicturePt
                 box = pict->pCompositeClip->extents;
                 for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
-                        WRITE(buffer + i, 0);
+                        buffer[i] = 0;
                     } else {
                         if (!affine) {
                             y = DIV(v.vector[1],v.vector[2]);
@@ -2995,8 +2990,8 @@ static void fbFetchTransformed(PicturePt
                             y = v.vector[1]>>16;
                             x = v.vector[0]>>16;
                         }
-                        WRITE(buffer + i, ((x < box.x1-dx) | (x >= box.x2-dx) | (y < box.y1-dy) | (y >= box.y2-dy)) ?
-                                          0 : fetch(bits + (y + dy)*stride, x + dx, indexed));
+                        buffer[i] = ((x < box.x1-dx) | (x >= box.x2-dx) | (y < box.y1-dy) | (y >= box.y2-dy)) ?
+                                    0 : fetch(bits + (y + dy)*stride, x + dx, indexed);
                     }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
@@ -3005,7 +3000,7 @@ static void fbFetchTransformed(PicturePt
             } else {
                 for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
-                        WRITE(buffer + i, 0);
+                        buffer[i] = 0;
                     } else {
                         if (!affine) {
                             y = DIV(v.vector[1],v.vector[2]);
@@ -3015,9 +3010,9 @@ static void fbFetchTransformed(PicturePt
                             x = v.vector[0]>>16;
                         }
                         if (POINT_IN_REGION (0, pict->pCompositeClip, x + dx, y + dy, &box))
-                            WRITE(buffer + i, fetch(bits + (y + dy)*stride, x + dx, indexed));
+                            buffer[i] = fetch(bits + (y + dy)*stride, x + dx, indexed);
                         else
-                            WRITE(buffer + i, 0);
+                            buffer[i] = 0;
                     }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
@@ -3036,7 +3031,7 @@ static void fbFetchTransformed(PicturePt
             if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) {
                 for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
-                        WRITE(buffer + i, 0);
+                        buffer[i] = 0;
                     } else {
                         int x1, x2, y1, y2, distx, idistx, disty, idisty;
                         FbBits *b;
@@ -3088,7 +3083,7 @@ static void fbFetchTransformed(PicturePt
                         ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
                         fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
                         r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
-                        WRITE(buffer + i, r);
+                        buffer[i] = r;
                     }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
@@ -3097,7 +3092,7 @@ static void fbFetchTransformed(PicturePt
             } else {
                 for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
-                        WRITE(buffer + i, 0);
+                        buffer[i] = 0;
                     } else {
                         int x1, x2, y1, y2, distx, idistx, disty, idisty;
                         FbBits *b;
@@ -3153,7 +3148,7 @@ static void fbFetchTransformed(PicturePt
                         ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
                         fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
                         r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
-                        WRITE(buffer + i, r);
+                        buffer[i] = r;
                     }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
@@ -3165,7 +3160,7 @@ static void fbFetchTransformed(PicturePt
                 box = pict->pCompositeClip->extents;
                 for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
-                        WRITE(buffer + i, 0);
+                        buffer[i] = 0;
                     } else {
                         int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off;
                         FbBits *b;
@@ -3219,7 +3214,7 @@ static void fbFetchTransformed(PicturePt
                         ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
                         fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
                         r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
-                        WRITE(buffer + i, r);
+                        buffer[i] = r;
                     }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
@@ -3228,7 +3223,7 @@ static void fbFetchTransformed(PicturePt
             } else {
                 for (i = 0; i < width; ++i) {
                     if (!v.vector[2]) {
-                        WRITE(buffer + i, 0);
+                        buffer[i] = 0;
                     } else {
                         int x1, x2, y1, y2, distx, idistx, disty, idisty, x_off;
                         FbBits *b;
@@ -3280,7 +3275,7 @@ static void fbFetchTransformed(PicturePt
                         ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
                         fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
                         r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
-                        WRITE(buffer + i, r);
+                        buffer[i] = r;
                     }
                     v.vector[0] += unit.vector[0];
                     v.vector[1] += unit.vector[1];
@@ -3297,7 +3292,7 @@ static void fbFetchTransformed(PicturePt
         params += 2;
         for (i = 0; i < width; ++i) {
             if (!v.vector[2]) {
-                WRITE(buffer + i, 0);
+                buffer[i] = 0;
             } else {
                 int x1, x2, y1, y2, x, y;
                 INT32 srtot, sgtot, sbtot, satot;
@@ -3347,18 +3342,16 @@ static void fbFetchTransformed(PicturePt
                 if (sgtot < 0) sgtot = 0; else if (sgtot > 0xff) sgtot = 0xff;
                 if (sbtot < 0) sbtot = 0; else if (sbtot > 0xff) sbtot = 0xff;
 
-                WRITE(buffer + i, ((satot << 24) |
-                                  (srtot << 16) |
-                                  (sgtot <<  8) |
-                                  (sbtot       )));
+                buffer[i] = ((satot << 24) |
+                             (srtot << 16) |
+                             (sgtot <<  8) |
+                             (sbtot       ));
             }
             v.vector[0] += unit.vector[0];
             v.vector[1] += unit.vector[1];
             v.vector[2] += unit.vector[2];
         }
     }
-
-    fbFinishAccess (pict->pDrawable);
 }
 
 
@@ -3379,10 +3372,10 @@ static void fbFetchExternalAlpha(Picture
     fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x, y - pict->alphaOrigin.y, width, alpha_buffer);
     for (i = 0; i < width; ++i) {
         int a = alpha_buffer[i]>>24;
-        WRITE(buffer + i, (a << 24)
-                          | (div_255(Red(READ(buffer + i)) * a) << 16)
-                          | (div_255(Green(READ(buffer + i)) * a) << 8)
-                          | (div_255(Blue(READ(buffer + i)) * a)));
+        buffer[i] = (a << 24)
+                 | (div_255(Red(buffer[i]) * a) << 16)
+                 | (div_255(Green(buffer[i]) * a) << 8)
+                 | (div_255(Blue(buffer[i]) * a));
     }
 
     if (alpha_buffer != _alpha_buffer)
@@ -3404,7 +3397,6 @@ static void fbStore(PicturePtr pict, int
 
     bits += y*stride;
     store(bits, buffer, x, width, indexed);
-    fbFinishAccess (pict->pDrawable);
 }
 
 static void fbStoreExternalAlpha(PicturePtr pict, int x, int y, int width, CARD32 *buffer)
@@ -3444,9 +3436,6 @@ static void fbStoreExternalAlpha(Picture
 
     store(bits, buffer, x, width, indexed);
     astore(alpha_bits, buffer, ax - pict->alphaOrigin.x, width, aindexed);
-
-    fbFinishAccess (pict->alphaMap->pDrawable);
-    fbFinishAccess (pict->pDrawable);
 }
 
 typedef void (*scanStoreProc)(PicturePtr , int , int , int , CARD32 *);
diff --git a/fb/fbcopy.c b/fb/fbcopy.c
index 164cd3d..0d1cb7f 100644
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -103,8 +103,6 @@ fbCopyNtoN (DrawablePtr	pSrcDrawable,
 #endif
 	pbox++;
     }    
-    fbFinishAccess (pDstDrawable);
-    fbFinishAccess (pSrcDrawable);
 }
 
 void
@@ -175,9 +173,6 @@ fbCopy1toN (DrawablePtr	pSrcDrawable,
 	}
 	pbox++;
     }
-
-    fbFinishAccess (pDstDrawable);
-    fbFinishAccess (pSrcDrawable);
 }
 
 void
@@ -226,8 +221,6 @@ fbCopyNto1 (DrawablePtr	pSrcDrawable,
 			(FbStip) pPriv->and, (FbStip) pPriv->xor,
 			(FbStip) pPriv->bgand, (FbStip) pPriv->bgxor,
 			bitplane);
-	    fbFinishAccess (pDstDrawable);
-	    fbFinishAccess (pSrcDrawable);
 	}
 	else
 	{
@@ -288,9 +281,6 @@ fbCopyNto1 (DrawablePtr	pSrcDrawable,
 		      pPriv->and, pPriv->xor,
 		      pPriv->bgand, pPriv->bgxor);
 	    xfree (tmp);
-
-	    fbFinishAccess (pDstDrawable);
-	    fbFinishAccess (pSrcDrawable);
 	}
 	pbox++;
     }
diff --git a/fb/fbedge.c b/fb/fbedge.c
index 70fc423..b6ca829 100644
--- a/fb/fbedge.c
+++ b/fb/fbedge.c
@@ -60,9 +60,9 @@
 #define StepAlpha	((__ap += __ao), (__ao ^= 1))
 
 #define AddAlpha(a) {						\
-    CARD8   __o = READ(__ap);					\
+    CARD8   __o = *__ap;					\
     CARD8   __a = (a) + Get4(__o, __ao);			\
-    WRITE(__ap, Put4 (__o, __ao, __a | (0 - ((__a) >> 4))));	\
+    *__ap = Put4 (__o, __ao, __a | (0 - ((__a) >> 4)));		\
 }
 
 #include "fbedgeimp.h"
@@ -102,7 +102,7 @@ add_saturate_8 (CARD8 *buf, int value, i
 {
     while (length--)
     {
-        WRITE(buf, clip255 (READ(buf) + value));
+        *buf = clip255 (*buf + value);
         buf++;
     }
 }
@@ -164,11 +164,11 @@ fbRasterizeEdges8 (FbBits	*buf,
             /* Add coverage across row */
             if (lxi == rxi)
             {
-                WRITE(ap +lxi, clip255 (READ(ap + lxi) + rxs - lxs));
+                ap[lxi] = clip255 (ap[lxi] + rxs - lxs);
             }
             else
             {
-                WRITE(ap + lxi, clip255 (READ(ap + lxi) + N_X_FRAC(8) - lxs));
+                ap[lxi] = clip255 (ap[lxi] + N_X_FRAC(8) - lxs);
 
                 /* Move forward so that lxi/rxi is the pixel span */
                 lxi++;
@@ -238,7 +238,7 @@ fbRasterizeEdges8 (FbBits	*buf,
                  * necessary to avoid a buffer overrun, (when rx
                  * is exactly on a pixel boundary). */
                 if (rxs)
-                    WRITE(ap + rxi, clip255 (READ(ap + rxi) + rxs));
+                    ap[rxi] = clip255 (ap[rxi] + rxs);
             }
 	}
 
@@ -247,7 +247,7 @@ fbRasterizeEdges8 (FbBits	*buf,
             if (fill_start != fill_end) {
                 if (fill_size == N_Y_FRAC(8))
                 {
-                    MEMSET_WRAPPED (ap + fill_start, 0xff, fill_end - fill_start);
+                    memset (ap + fill_start, 0xff, fill_end - fill_start);
                 }
                 else
                 {
@@ -273,7 +273,7 @@ fbRasterizeEdges8 (FbBits	*buf,
             {
                 if (fill_size == N_Y_FRAC(8))
                 {
-                    MEMSET_WRAPPED (ap + fill_start, 0xff, fill_end - fill_start);
+                    memset (ap + fill_start, 0xff, fill_end - fill_start);
                 }
                 else
                 {
diff --git a/fb/fbedgeimp.h b/fb/fbedgeimp.h
index 57da31a..8773935 100644
--- a/fb/fbedgeimp.h
+++ b/fb/fbedgeimp.h
@@ -76,14 +76,12 @@ rasterizeEdges (FbBits		*buf,
 		x &= FB_MASK;
 
 		FbMaskBits (x, width, startmask, nmiddle, endmask);
-		if (startmask) {
-		    WRITE(a, READ(a) | startmask);
-		    a++;
-		}
+		if (startmask)
+		    *a++ |= startmask;
 		while (nmiddle--)
-		    WRITE(a++, FB_ALLONES);
+		    *a++ = FB_ALLONES;
 		if (endmask)
-		    WRITE(a, READ(a) | endmask);
+		    *a |= endmask;
 	    }
 #else
 	    {
diff --git a/fb/fbfill.c b/fb/fbfill.c
index 7ef3a70..ad5025c 100644
--- a/fb/fbfill.c
+++ b/fb/fbfill.c
@@ -49,10 +49,8 @@ fbFill (DrawablePtr pDrawable,
     case FillSolid:
 #ifdef USE_MMX
 	if (!pPriv->and && fbHaveMMX())
-	    if (fbSolidFillmmx (pDrawable, x, y, width, height, pPriv->xor)) {
-		fbFinishAccess (pDrawable);
+	    if (fbSolidFillmmx (pDrawable, x, y, width, height, pPriv->xor))
 		return;
-	    }
 #endif	    
 	fbSolid (dst + (y + dstYoff) * dstStride, 
 		 dstStride, 
@@ -94,7 +92,6 @@ fbFill (DrawablePtr pDrawable,
 		    
 		    (pGC->patOrg.x + pDrawable->x + dstXoff),
 		    pGC->patOrg.y + pDrawable->y - y);
-	    fbFinishAccess (&pStip->drawable);
 	}
 	else
 	{
@@ -132,7 +129,6 @@ fbFill (DrawablePtr pDrawable,
 		       bgand, bgxor,
 		       pGC->patOrg.x + pDrawable->x + dstXoff,
 		       pGC->patOrg.y + pDrawable->y - y);
-	    fbFinishAccess (&pStip->drawable);
 	}
 	break;
     }
@@ -161,12 +157,10 @@ fbFill (DrawablePtr pDrawable,
 		dstBpp,
 		(pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp,
 		pGC->patOrg.y + pDrawable->y - y);
-	fbFinishAccess (&pTile->drawable);
 	break;
     }
     }
     fbValidateDrawable (pDrawable);
-    fbFinishAccess (pDrawable);
 }
 
 void
@@ -221,10 +215,8 @@ fbSolidBoxClipped (DrawablePtr	pDrawable
 		if (fbSolidFillmmx (pDrawable,
 		                    partX1, partY1,
 				    (partX2 - partX1), (partY2 - partY1),
-				    xor)) {
-			fbFinishAccess (pDrawable);
+				    xor))
 			return;
-		}
 	}
 #endif
 	fbSolid (dst + (partY1 + dstYoff) * dstStride,
@@ -236,5 +228,4 @@ fbSolidBoxClipped (DrawablePtr	pDrawable
 		 (partY2 - partY1),
 		 and, xor);
     }
-    fbFinishAccess (pDrawable);
 }
diff --git a/fb/fbgc.c b/fb/fbgc.c
index 3f8bf25..5b55810 100644
--- a/fb/fbgc.c
+++ b/fb/fbgc.c
@@ -106,18 +106,16 @@ fbPadPixmap (PixmapPtr pPixmap)
     mask = FbBitsMask (0, width);
     while (height--)
     {
-	b = READ(bits) & mask;
+	b = *bits & mask;
 	w = width;
 	while (w < FB_UNIT)
 	{
 	    b = b | FbScrRight(b, w);
 	    w <<= 1;
 	}
-	WRITE(bits, b);
+	*bits = b;
 	bits += stride;
     }
-
-    fbFinishAccess (&pPixmap->drawable);
 }
 
 /*
@@ -155,7 +153,7 @@ fbLineRepeat (FbBits *bits, int len, int
     width = (width + FB_UNIT-1) >> FB_SHIFT;
     bits++;
     while (--width)
-	if (READ(bits) != first)
+	if (*bits != first)
 	    return FALSE;
     return TRUE;
 }
@@ -185,13 +183,10 @@ fbCanEvenStipple (PixmapPtr pStipple, in
     /* check to see that the stipple repeats horizontally */
     while (h--)
     {
-	if (!fbLineRepeat (bits, len, pStipple->drawable.width)) {
-	    fbFinishAccess (&pStipple->drawable);
+	if (!fbLineRepeat (bits, len, pStipple->drawable.width))
 	    return FALSE;
-	}
 	bits += stride;
     }
-    fbFinishAccess (&pStipple->drawable);
     return TRUE;
 }
 
diff --git a/fb/fbgetsp.c b/fb/fbgetsp.c
index ffd8a1d..f77ea8c 100644
--- a/fb/fbgetsp.c
+++ b/fb/fbgetsp.c
@@ -84,6 +84,4 @@ fbGetSpans(DrawablePtr	pDrawable, 
 	ppt++;
 	pwidth++;
     }
-
-    fbFinishAccess (pDrawable);
 }
diff --git a/fb/fbglyph.c b/fb/fbglyph.c
index 2c19b74..8e81940 100644
--- a/fb/fbglyph.c
+++ b/fb/fbglyph.c
@@ -62,11 +62,11 @@ fbGlyphIn (RegionPtr	pRegion,
 #ifdef FB_24BIT
 #ifndef FBNOPIXADDR
 
-#define WRITE1(d,n,fg)	WRITE((d) + (n), (CARD8) fg)
-#define WRITE2(d,n,fg)	WRITE((CARD16 *) &(d[n]), (CARD16) fg)
-#define WRITE4(d,n,fg)	WRITE((CARD32 *) &(d[n]), (CARD32) fg)
+#define WRITE1(d,n,fg)	((d)[n] = (CARD8) fg)
+#define WRITE2(d,n,fg)	(*(CARD16 *) &(d[n]) = (CARD16) fg)
+#define WRITE4(d,n,fg)	(*(CARD32 *) &(d[n]) = (CARD32) fg)
 #if FB_UNIT == 6 && IMAGE_BYTE_ORDER == LSBFirst
-#define WRITE8(d)	WRITE((FbBits *) &(d[0]), fg)
+#define WRITE8(d)	(*(FbBits *) &(d[0]) = fg)
 #else
 #define WRITE8(d)	WRITE4(d,0,_ABCA), WRITE4(d,4,_BCAB)
 #endif
@@ -157,7 +157,7 @@ fbGlyph24 (FbBits   *dstBits,
     lshift = 4 - shift;
     while (height--)
     {
-	bits = READ(stipple++);
+	bits = *stipple++;
 	n = lshift;
 	dst = dstLine;
 	while (bits)
@@ -284,7 +284,7 @@ fbPolyGlyphBlt (DrawablePtr	pDrawable,
     glyph = 0;
     if (pGC->fillStyle == FillSolid && pPriv->and == 0)
     {
-	dstBpp = pDrawable->bitsPerPixel;
+	fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
 	switch (dstBpp) {
 	case 8:	    glyph = fbGlyph8; break;
 	case 16:    glyph = fbGlyph16; break;
@@ -312,7 +312,6 @@ fbPolyGlyphBlt (DrawablePtr	pDrawable,
 	    if (glyph && gWidth <= sizeof (FbStip) * 8 &&
 		fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
 	    {
-		fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
 		(*glyph) (dst + (gy + dstYoff) * dstStride,
 			  dstStride,
 			  dstBpp,
@@ -320,7 +319,6 @@ fbPolyGlyphBlt (DrawablePtr	pDrawable,
 			  pPriv->xor,
 			  gx + dstXoff,
 			  gHeight);
-		fbFinishAccess (pDrawable);
 	    }
 	    else
 #endif
@@ -377,7 +375,7 @@ fbImageGlyphBlt (DrawablePtr	pDrawable,
     glyph = 0;
     if (pPriv->and == 0)
     {
-	dstBpp = pDrawable->bitsPerPixel;
+	fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
 	switch (dstBpp) {
 	case 8:	    glyph = fbGlyph8; break;
 	case 16:    glyph = fbGlyph16; break;
@@ -445,7 +443,6 @@ fbImageGlyphBlt (DrawablePtr	pDrawable,
 	    if (glyph && gWidth <= sizeof (FbStip) * 8 &&
 		fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight))
 	    {
-		fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
 		(*glyph) (dst + (gy + dstYoff) * dstStride,
 			  dstStride,
 			  dstBpp,
@@ -453,7 +450,6 @@ fbImageGlyphBlt (DrawablePtr	pDrawable,
 			  pPriv->fg,
 			  gx + dstXoff,
 			  gHeight);
-		fbFinishAccess (pDrawable);
 	    }
 	    else
 #endif
diff --git a/fb/fbimage.c b/fb/fbimage.c
index 06a3c84..3b4a07c 100644
--- a/fb/fbimage.c
+++ b/fb/fbimage.c
@@ -170,8 +170,6 @@ fbPutZImage (DrawablePtr	pDrawable,
 		   pm,
 		   dstBpp);
     }
-
-    fbFinishAccess (pDrawable);
 }
 	     
 void
@@ -279,8 +277,6 @@ fbPutXYImage (DrawablePtr	pDrawable,
 		      fgand, fgxor, bgand, bgxor);
 	}
     }
-
-    fbFinishAccess (pDrawable);
 }
 
 void
@@ -365,6 +361,4 @@ fbGetImage (DrawablePtr	    pDrawable,
 		    fbXorStip(GXcopy,0,FB_STIP_ALLONES),
 		    planeMask);
     }
-
-    fbFinishAccess (pDrawable);
 }
diff --git a/fb/fbpict.c b/fb/fbpict.c
index eb305b9..c208643 100644
--- a/fb/fbpict.c
+++ b/fb/fbpict.c
@@ -137,25 +137,22 @@ fbCompositeSolidMask_nx8x8888 (CARD8    
 
 	while (w--)
 	{
-	    m = READ(mask++);
+	    m = *mask++;
 	    if (m == 0xff)
 	    {
 		if (srca == 0xff)
-		    WRITE(dst, src & dstMask);
+		    *dst = src & dstMask;
 		else
-		    WRITE(dst, fbOver (src, READ(dst)) & dstMask);
+		    *dst = fbOver (src, *dst) & dstMask;
 	    }
 	    else if (m)
 	    {
 		d = fbIn (src, m);
-		WRITE(dst, fbOver (d, READ(dst)) & dstMask);
+		*dst = fbOver (d, *dst) & dstMask;
 	    }
 	    dst++;
 	}
     }
-
-    fbFinishAccess (pMask->pDrawable);
-    fbFinishAccess (pDst->pDrawable);
 }
 
 void
@@ -199,17 +196,17 @@ fbCompositeSolidMask_nx8888x8888C (CARD8
 
 	while (w--)
 	{
-	    ma = READ(mask++);
+	    ma = *mask++;
 	    if (ma == 0xffffffff)
 	    {
 		if (srca == 0xff)
-		    WRITE(dst, src & dstMask);
+		    *dst = src & dstMask;
 		else
-		    WRITE(dst, fbOver (src, READ(dst)) & dstMask);
+		    *dst = fbOver (src, *dst) & dstMask;
 	    }
 	    else if (ma)
 	    {
-		d = READ(dst);
+		d = *dst;
 #define FbInOverC(src,srca,msk,dst,i,result) { \
     CARD16  __a = FbGet8(msk,i); \
     CARD32  __t, __ta; \
@@ -224,14 +221,11 @@ fbCompositeSolidMask_nx8888x8888C (CARD8
 		FbInOverC (src, srca, ma, d, 8, n);
 		FbInOverC (src, srca, ma, d, 16, o);
 		FbInOverC (src, srca, ma, d, 24, p);
-		WRITE(dst, m|n|o|p);
+		*dst = m|n|o|p;
 	    }
 	    dst++;
 	}
     }
-
-    fbFinishAccess (pMask->pDrawable);
-    fbFinishAccess (pDst->pDrawable);
 }
 
 void
@@ -274,7 +268,7 @@ fbCompositeSolidMask_nx8x0888 (CARD8    
 
 	while (w--)
 	{
-	    m = READ(mask++);
+	    m = *mask++;
 	    if (m == 0xff)
 	    {
 		if (srca == 0xff)
@@ -294,9 +288,6 @@ fbCompositeSolidMask_nx8x0888 (CARD8    
 	    dst += 3;
 	}
     }
-
-    fbFinishAccess (pMask->pDrawable);
-    fbFinishAccess (pDst->pDrawable);
 }
 
 void
@@ -339,30 +330,27 @@ fbCompositeSolidMask_nx8x0565 (CARD8    
 
 	while (w--)
 	{
-	    m = READ(mask++);
+	    m = *mask++;
 	    if (m == 0xff)
 	    {
 		if (srca == 0xff)
 		    d = src;
 		else
 		{
-		    d = READ(dst);
+		    d = *dst;
 		    d = fbOver24 (src, cvt0565to8888(d));
 		}
-		WRITE(dst, cvt8888to0565(d));
+		*dst = cvt8888to0565(d);
 	    }
 	    else if (m)
 	    {
-		d = READ(dst);
+		d = *dst;
 		d = fbOver24 (fbIn(src,m), cvt0565to8888(d));
-		WRITE(dst, cvt8888to0565(d));
+		*dst = cvt8888to0565(d);
 	    }
 	    dst++;
 	}
     }
-
-    fbFinishAccess (pMask->pDrawable);
-    fbFinishAccess (pDst->pDrawable);
 }
 
 void
@@ -409,36 +397,33 @@ fbCompositeSolidMask_nx8888x0565C (CARD8
 
 	while (w--)
 	{
-	    ma = READ(mask++);
+	    ma = *mask++;
 	    if (ma == 0xffffffff)
 	    {
 		if (srca == 0xff)
 		{
-		    WRITE(dst, src16);
+		    *dst = src16;
 		}
 		else
 		{
-		    d = READ(dst);
+		    d = *dst;
 		    d = fbOver24 (src, cvt0565to8888(d));
-		    WRITE(dst, cvt8888to0565(d));
+		    *dst = cvt8888to0565(d);
 		}
 	    }
 	    else if (ma)
 	    {
-		d = READ(dst);
+		d = *dst;
 		d = cvt0565to8888(d);
 		FbInOverC (src, srca, ma, d, 0, m);
 		FbInOverC (src, srca, ma, d, 8, n);
 		FbInOverC (src, srca, ma, d, 16, o);
 		d = m|n|o;
-		WRITE(dst, cvt8888to0565(d));
+		*dst = cvt8888to0565(d);
 	    }
 	    dst++;
 	}
     }
-
-    fbFinishAccess (pMask->pDrawable);
-    fbFinishAccess (pDst->pDrawable);
 }
 
 void
@@ -476,18 +461,15 @@ fbCompositeSrc_8888x8888 (CARD8      op,
 
 	while (w--)
 	{
-	    s = READ(src++);
+	    s = *src++;
 	    a = s >> 24;
 	    if (a == 0xff)
-		WRITE(dst, s & dstMask);
+		*dst = s & dstMask;
 	    else if (a)
-		WRITE(dst, fbOver (s, READ(dst)) & dstMask);
+		*dst = fbOver (s, *dst) & dstMask;
 	    dst++;
 	}
     }
-
-    fbFinishAccess (pSrc->pDrawable);
-    fbFinishAccess (pDst->pDrawable);
 }
 
 void
@@ -524,7 +506,7 @@ fbCompositeSrc_8888x0888 (CARD8      op,
 
 	while (w--)
 	{
-	    s = READ(src++);
+	    s = *src++;
 	    a = s >> 24;
 	    if (a)
 	    {
@@ -537,9 +519,6 @@ fbCompositeSrc_8888x0888 (CARD8      op,
 	    dst += 3;
 	}
     }
-
-    fbFinishAccess (pSrc->pDrawable);
-    fbFinishAccess (pDst->pDrawable);
 }
 
 void
@@ -576,7 +555,7 @@ fbCompositeSrc_8888x0565 (CARD8      op,
 
 	while (w--)
 	{
-	    s = READ(src++);
+	    s = *src++;
 	    a = s >> 24;
 	    if (a)
 	    {
@@ -584,17 +563,14 @@ fbCompositeSrc_8888x0565 (CARD8      op,
 		    d = s;
 		else
 		{
-		    d = READ(dst);
+		    d = *dst;
 		    d = fbOver24 (s, cvt0565to8888(d));
 		}
-		WRITE(dst, cvt8888to0565(d));
+		*dst = cvt8888to0565(d);
 	    }
 	    dst++;
 	}
     }
-
-    fbFinishAccess (pDst->pDrawable);
-    fbFinishAccess (pSrc->pDrawable);
 }
 
 void
@@ -629,11 +605,8 @@ fbCompositeSrc_0565x0565 (CARD8      op,
 	w = width;
 
 	while (w--)
-	    WRITE(dst, READ(src++));
+	    *dst++ = *src++;
     }
-
-    fbFinishAccess (pDst->pDrawable);
-    fbFinishAccess (pSrc->pDrawable);
 }
 
 void
@@ -670,23 +643,20 @@ fbCompositeSrcAdd_8000x8000 (CARD8	op,
 
 	while (w--)
 	{
-	    s = READ(src++);
+	    s = *src++;
 	    if (s)
 	    {
 		if (s != 0xff)
 		{
-		    d = READ(dst);
+		    d = *dst;
 		    t = d + s;
 		    s = t | (0 - (t >> 8));
 		}
-		WRITE(dst, s);
+		*dst = s;
 	    }
 	    dst++;
 	}
     }
-
-    fbFinishAccess (pDst->pDrawable);
-    fbFinishAccess (pSrc->pDrawable);
 }
 
 void
@@ -724,12 +694,12 @@ fbCompositeSrcAdd_8888x8888 (CARD8	op,
 
 	while (w--)
 	{
-	    s = READ(src++);
+	    s = *src++;
 	    if (s)
 	    {
 		if (s != 0xffffffff)
 		{
-		    d = READ(dst);
+		    d = *dst;
 		    if (d)
 		    {
 			m = FbAdd(s,d,0,t);
@@ -739,14 +709,11 @@ fbCompositeSrcAdd_8888x8888 (CARD8	op,
 			s = m|n|o|p;
 		    }
 		}
-		WRITE(dst, s);
+		*dst = s;
 	    }
 	    dst++;
 	}
     }
-
-    fbFinishAccess (pDst->pDrawable);
-    fbFinishAccess (pSrc->pDrawable);
 }
 
 void
@@ -790,9 +757,6 @@ fbCompositeSrcAdd_1000x1000 (CARD8	op,
 
 	   FALSE,
 	   FALSE);
-
-    fbFinishAccess(pDst->pDrawable);
-    fbFinishAccess(pSrc->pDrawable);
 }
 
 void
@@ -857,9 +821,6 @@ fbCompositeSolidMask_nx1xn (CARD8      o
 	      src,
 	      FB_ALLONES,
 	      0x0);
-
-    fbFinishAccess (pDst->pDrawable);
-    fbFinishAccess (pMask->pDrawable);
 }
 
 # define mod(a,b)	((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
diff --git a/fb/fbpict.h b/fb/fbpict.h
index 19d5557..4ad0324 100644
--- a/fb/fbpict.h
+++ b/fb/fbpict.h
@@ -76,13 +76,13 @@
     fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \
     switch (__bpp__) { \
     case 32: \
-	(bits) = READ((CARD32 *) __bits__); \
+	(bits) = *(CARD32 *) __bits__; \
 	break; \
     case 24: \
 	(bits) = Fetch24 ((CARD8 *) __bits__); \
 	break; \
     case 16: \
-	(bits) = READ((CARD16 *) __bits__); \
+	(bits) = *(CARD16 *) __bits__; \
 	(bits) = cvt0565to8888(bits); \
 	break; \
     default: \
@@ -99,7 +99,6 @@
     /* manage missing src alpha */ \
     if ((pict)->pFormat->direct.alphaMask == 0) \
 	(bits) |= 0xff000000; \
-    fbFinishAccess ((pict)->pDrawable); \
 }
 
 #define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\
@@ -121,22 +120,22 @@
 
 #if IMAGE_BYTE_ORDER == MSBFirst
 #define Fetch24(a)  ((unsigned long) (a) & 1 ? \
-		     ((READ(a) << 16) | READ((CARD16 *) ((a)+1))) : \
-		     ((READ((CARD16 *) (a)) << 8) | READ((a)+2)))
+		     ((*(a) << 16) | *((CARD16 *) ((a)+1))) : \
+		     ((*((CARD16 *) (a)) << 8) | *((a)+2)))
 #define Store24(a,v) ((unsigned long) (a) & 1 ? \
-		      (WRITE(a, (CARD8) ((v) >> 16)), \
-		       WRITE((CARD16 *) ((a)+1), (CARD16) (v))) : \
-		      (WRITE((CARD16 *) (a), (CARD16) ((v) >> 8)), \
-		       WRITE((a)+2, (CARD8) (v))))
+		      ((*(a) = (CARD8) ((v) >> 16)), \
+		       (*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \
+		      ((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \
+		       (*((a)+2) = (CARD8) (v))))
 #else
 #define Fetch24(a)  ((unsigned long) (a) & 1 ? \
-		     (READ(a) | (READ((CARD16 *) ((a)+1)) << 8)) : \
-		     (READ((CARD16 *) (a)) | (READ((a)+2) << 16)))
+		     ((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \
+		     ((*((CARD16 *) (a))) | (*((a)+2) << 16)))
 #define Store24(a,v) ((unsigned long) (a) & 1 ? \
-		      (WRITE(a, (CARD8) (v)), \
-		       WRITE((CARD16 *) ((a)+1), (CARD16) ((v) >> 8))) : \
-		      (WRITE((CARD16 *) (a), (CARD16) (v)),\
-		       WRITE((a)+2, (CARD8) ((v) >> 16))))
+		      ((*(a) = (CARD8) (v)), \
+		       (*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \
+		      ((*((CARD16 *) (a)) = (CARD16) (v)),\
+		       (*((a)+2) = (CARD8) ((v) >> 16))))
 #endif
 		      
 /*
diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c
index c2ddcb0..f79f701 100644
--- a/fb/fbpixmap.c
+++ b/fb/fbpixmap.c
@@ -160,8 +160,6 @@ fbPixmapToRegion(PixmapPtr pPix)
     FirstRect = REGION_BOXPTR(pReg);
     rects = FirstRect;
 
-    fbPrepareAccess(&pPix->drawable);
-
     pwLine = (FbBits *) pPix->devPrivate.ptr;
     nWidth = pPix->devKind >> (FB_SHIFT-3);
 
@@ -176,7 +174,7 @@ fbPixmapToRegion(PixmapPtr pPix)
 	irectLineStart = rects - FirstRect;
 	/* If the Screen left most bit of the word is set, we're starting in
 	 * a box */
-	if(READ(pw) & mask0)
+	if(*pw & mask0)
 	{
 	    fInBox = TRUE;
 	    rx1 = 0;
@@ -187,7 +185,7 @@ fbPixmapToRegion(PixmapPtr pPix)
 	pwLineEnd = pw + (width >> FB_SHIFT);
 	for (base = 0; pw < pwLineEnd; base += FB_UNIT)
 	{
-	    w = READ(pw++);
+	    w = *pw++;
 	    if (fInBox)
 	    {
 		if (!~w)
@@ -228,7 +226,7 @@ fbPixmapToRegion(PixmapPtr pPix)
 	if(width & FB_MASK)
 	{
 	    /* Process final partial word on line */
-	    w = READ(pw++);
+	    w = *pw++;
 	    for(ib = 0; ib < (width & FB_MASK); ib++)
 	    {
 	        /* If the Screen left most bit of the word is set, we're
@@ -313,8 +311,6 @@ fbPixmapToRegion(PixmapPtr pPix)
 	    pReg->data = (RegDataPtr)NULL;
 	}
     }
-
-    fbFinishAccess(&pPix->drawable);
 #ifdef DEBUG
     if (!miValidRegion(pReg))
 	FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__);
@@ -366,7 +362,6 @@ fbValidateDrawable (DrawablePtr pDrawabl
     if (!fbValidateBits (first, stride, FB_HEAD_BITS) ||
 	!fbValidateBits (last, stride, FB_TAIL_BITS))
 	fbInitializeDrawable(pDrawable);
-    fbFinishAccess (pDrawable);
 }
 
 void
@@ -388,6 +383,5 @@ fbInitializeDrawable (DrawablePtr pDrawa
     last = bits + stride * pDrawable->height;
     fbSetBits (first, stride, FB_HEAD_BITS);
     fbSetBits (last, stride, FB_TAIL_BITS);
-    fbFinishAccess (pDrawable);
 }
 #endif /* FB_DEBUG */
diff --git a/fb/fbpoint.c b/fb/fbpoint.c
index c03ea18..7154b53 100644
--- a/fb/fbpoint.c
+++ b/fb/fbpoint.c
@@ -90,20 +90,20 @@ fbDots (FbBits	    *dstOrig,
 		FbMaskStip (x, 24, leftMask, n, rightMask);
 		if (leftMask)
 		{
-		    WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
+		    *d = FbDoMaskRRop (*d, andT, xorT, leftMask);
 		    andT = FbNext24Stip(andT);
 		    xorT = FbNext24Stip(xorT);
 		    d++;
 		}
 		if (rightMask)
-		    WRITE(d, FbDoMaskRRop(READ(d), andT, xorT, rightMask));
+		    *d = FbDoMaskRRop(*d, andT, xorT, rightMask);
 	    }
 	    else
 #endif
 	    {
 		FbStip	mask;
 		mask = FbStipMask(x, dstBpp);
-		WRITE(d, FbDoMaskRRop (READ(d), and, xor, mask));
+		*d = FbDoMaskRRop (*d, and, xor, mask);
 	    }
 	}
     }
@@ -160,5 +160,4 @@ fbPolyPoint (DrawablePtr    pDrawable,
 	 nBox--; pBox++)
 	(*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit, 
 		 pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor);
-    fbFinishAccess (pDrawable);
 }
diff --git a/fb/fbpseudocolor.c b/fb/fbpseudocolor.c
index 271e981..2233f95 100644
--- a/fb/fbpseudocolor.c
+++ b/fb/fbpseudocolor.c
@@ -875,8 +875,6 @@ xxCopyPseudocolorRegion(ScreenPtr pScree
     register CARD16     *d;
     int w;
 
-    fbPrepareAccess((DrawablePtr)pScreen->devPrivate);
-
     dst_base = (CARD16*) ((PixmapPtr)pScreen->devPrivate)->devPrivate.ptr;
     dst_stride = (int)((PixmapPtr)pScreen->devPrivate)->devKind
 	/ sizeof (CARD16);
@@ -901,8 +899,6 @@ xxCopyPseudocolorRegion(ScreenPtr pScree
 	}
 	pbox++;
     }
-
-    fbFinishAccess(&((PixmapPtr)pScreen->devPrivate)->drawable);
 }
 
 static void
@@ -1204,7 +1200,7 @@ GCFuncs xxGCFuncs = {
     xxChangeClip, xxDestroyClip, xxCopyClip
 };
 
-static GCOps xxGCOps = {
+GCOps xxGCOps = {
     xxFillSpans, xxSetSpans, 
     xxPutImage, xxCopyArea, 
     xxCopyPlane, xxPolyPoint, 
diff --git a/fb/fbpush.c b/fb/fbpush.c
index bb7bcef..0632766 100644
--- a/fb/fbpush.c
+++ b/fb/fbpush.c
@@ -58,7 +58,7 @@ fbPushPattern (DrawablePtr  pDrawable,
 	w = width;
 	s = src;
 	src += srcStride;
-	bits = READ(s++);
+	bits = *s++;
 	xspan = x;
 	while (w)
 	{
@@ -73,7 +73,7 @@ fbPushPattern (DrawablePtr  pDrawable,
 		    bitsMask = FbStipRight (bitsMask, 1);
 		    if (!bitsMask)
 		    {
-			bits = READ(s++);
+			bits = *s++;
 			bitsMask = FbBitsMask(0,1);
 		    }
 		} while (bits & bitsMask);
@@ -92,7 +92,7 @@ fbPushPattern (DrawablePtr  pDrawable,
 		    bitsMask = FbStipRight (bitsMask, 1);
 		    if (!bitsMask)
 		    {
-			bits = READ(s++);
+			bits = *s++;
 			bitsMask = FbBitsMask(0,1);
 		    }
 		} while (!(bits & bitsMask));
@@ -165,7 +165,6 @@ fbPushFill (DrawablePtr	pDrawable,
 		      fbAnd(GXnoop,(FbBits) 0,FB_ALLONES),
 		      fbXor(GXnoop,(FbBits) 0,FB_ALLONES));
 	}
-	fbFinishAccess (pDrawable);
     }
     else
     {
diff --git a/fb/fbscreen.c b/fb/fbscreen.c
index 045ca8f..b883758 100644
--- a/fb/fbscreen.c
+++ b/fb/fbscreen.c
@@ -155,19 +155,6 @@ fbSetupScreen(ScreenPtr	pScreen, 
     return TRUE;
 }
 
-#ifdef FB_ACCESS_WRAPPER
-Bool
-wfbFinishScreenInit(ScreenPtr		pScreen,
-		    pointer		pbits,
-		    int			xsize,
-		    int			ysize,
-		    int			dpix,
-		    int			dpiy,
-		    int			width,
-		    int			bpp,
-		    SetupWrapProcPtr	setupWrap,
-		    FinishWrapProcPtr	finishWrap)
-#else
 Bool
 fbFinishScreenInit(ScreenPtr	pScreen,
 		   pointer	pbits,
@@ -177,7 +164,6 @@ fbFinishScreenInit(ScreenPtr	pScreen,
 		   int		dpiy,
 		   int		width,
 		   int		bpp)
-#endif
 {
     VisualPtr	visuals;
     DepthPtr	depths;
@@ -236,10 +222,6 @@ fbFinishScreenInit(ScreenPtr	pScreen,
 	fbGetScreenPrivate(pScreen)->win32bpp = 32;
 	fbGetScreenPrivate(pScreen)->pix32bpp = 32;
     }
-#ifdef FB_ACCESS_WRAPPER
-    fbGetScreenPrivate(pScreen)->setupWrap = setupWrap;
-    fbGetScreenPrivate(pScreen)->finishWrap = finishWrap;
-#endif
 #endif
     rootdepth = 0;
     if (!fbInitVisuals (&visuals, &depths, &nvisuals, &ndepths, &rootdepth,
@@ -274,27 +256,6 @@ fbFinishScreenInit(ScreenPtr	pScreen,
 }
 
 /* dts * (inch/dot) * (25.4 mm / inch) = mm */
-#ifdef FB_ACCESS_WRAPPER
-Bool
-wfbScreenInit(ScreenPtr		pScreen,
-	      pointer		pbits,
-	      int		xsize,
-	      int		ysize,
-	      int		dpix,
-	      int		dpiy,
-	      int		width,
-	      int		bpp,
-	      SetupWrapProcPtr	setupWrap,
-	      FinishWrapProcPtr	finishWrap)
-{
-    if (!fbSetupScreen(pScreen, pbits, xsize, ysize, dpix, dpiy, width, bpp))
-	return FALSE;
-    if (!wfbFinishScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy,
-			     width, bpp, setupWrap, finishWrap))
-	return FALSE;
-    return TRUE;
-}
-#else
 Bool
 fbScreenInit(ScreenPtr	pScreen,
 	     pointer	pbits,
@@ -312,7 +273,6 @@ fbScreenInit(ScreenPtr	pScreen,
 	return FALSE;
     return TRUE;
 }
-#endif
 
 
 #ifdef FB_OLD_SCREEN
diff --git a/fb/fbseg.c b/fb/fbseg.c
index 3107637..d66e424 100644
--- a/fb/fbseg.c
+++ b/fb/fbseg.c
@@ -79,7 +79,7 @@ fbBresSolid (DrawablePtr    pDrawable,
 	    mask = fbBresShiftMask(mask,signdx,dstBpp);
 	    if (!mask)
 	    {
-		WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
+		*dst = FbDoMaskRRop (*dst, and, xor, bits);
 		bits = 0;
 		dst += signdx;
 		mask = mask0;
@@ -87,20 +87,20 @@ fbBresSolid (DrawablePtr    pDrawable,
 	    e += e1;
 	    if (e >= 0)
 	    {
-		WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
+		*dst = FbDoMaskRRop (*dst, and, xor, bits);
 		bits = 0;
 		dst += dstStride;
 		e += e3;
 	    }
 	}
 	if (bits)
-	    WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, bits));
+	    *dst = FbDoMaskRRop (*dst, and, xor, bits);
     }
     else
     {
 	while (len--)
 	{
-	    WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, mask));
+	    *dst = FbDoMaskRRop (*dst, and, xor, mask);
 	    dst += dstStride;
 	    e += e1;
 	    if (e >= 0)
@@ -115,8 +115,6 @@ fbBresSolid (DrawablePtr    pDrawable,
 	    }
 	}
     }
-
-    fbFinishAccess (pDrawable);
 }
 
 void
@@ -166,9 +164,9 @@ fbBresDash (DrawablePtr	pDrawable,
     while (len--)
     {
 	if (even)
-	    WRITE(dst, FbDoMaskRRop (READ(dst), and, xor, mask));
+	    *dst = FbDoMaskRRop (*dst, and, xor, mask);
 	else if (doOdd)
-	    WRITE(dst, FbDoMaskRRop (READ(dst), bgand, bgxor, mask));
+	    *dst = FbDoMaskRRop (*dst, bgand, bgxor, mask);
 	if (axis == X_AXIS)
 	{
 	    mask = fbBresShiftMask(mask,signdx,dstBpp);
@@ -201,8 +199,6 @@ fbBresDash (DrawablePtr	pDrawable,
 	}
 	FbDashStep (dashlen, even);
     }
-
-    fbFinishAccess (pDrawable);
 }
 
 void
@@ -375,13 +371,13 @@ fbBresSolid24RRop (DrawablePtr  pDrawabl
 	FbMaskStip (x, 24, leftMask, nl, rightMask);
 	if (leftMask)
 	{
-	    WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
+	    *d = FbDoMaskRRop (*d, andT, xorT, leftMask);
 	    d++;
 	    andT = FbNext24Stip (andT);
 	    xorT = FbNext24Stip (xorT);
 	}
 	if (rightMask)
-	    WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, rightMask));
+	    *d = FbDoMaskRRop (*d, andT, xorT, rightMask);
 	if (axis == X_AXIS)
 	{
 	    x1 += signdx;
@@ -403,8 +399,6 @@ fbBresSolid24RRop (DrawablePtr  pDrawabl
 	    }
 	}
     }
-
-    fbFinishAccess (pDrawable);
 }
 
 static void
@@ -474,13 +468,13 @@ fbBresDash24RRop (DrawablePtr	pDrawable,
 	    FbMaskStip (x, 24, leftMask, nl, rightMask);
 	    if (leftMask)
 	    {
-		WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, leftMask));
+		*d = FbDoMaskRRop (*d, andT, xorT, leftMask);
 		d++;
 		andT = FbNext24Stip (andT);
 		xorT = FbNext24Stip (xorT);
 	    }
 	    if (rightMask)
-		WRITE(d, FbDoMaskRRop (READ(d), andT, xorT, rightMask));
+		*d = FbDoMaskRRop (*d, andT, xorT, rightMask);
 	}
 	if (axis == X_AXIS)
 	{
@@ -504,8 +498,6 @@ fbBresDash24RRop (DrawablePtr	pDrawable,
 	}
 	FbDashStep (dashlen, even);
     }
-
-    fbFinishAccess (pDrawable);
 }
 #endif
 
diff --git a/fb/fbsetsp.c b/fb/fbsetsp.c
index 0633256..c59c13c 100644
--- a/fb/fbsetsp.c
+++ b/fb/fbsetsp.c
@@ -99,6 +99,5 @@ fbSetSpans (DrawablePtr	    pDrawable,
 	pwidth++;
     }
     fbValidateDrawable (pDrawable);
-    fbFinishAccess (pDrawable);
 }
 	    
diff --git a/fb/fbsolid.c b/fb/fbsolid.c
index 6b5ed0f..89effe6 100644
--- a/fb/fbsolid.c
+++ b/fb/fbsolid.c
@@ -70,12 +70,12 @@ fbSolid (FbBits	    *dst,
 	n = nmiddle;
 	if (!and)
 	    while (n--)
-		WRITE(dst++, xor);
+		*dst++ = xor;
 	else
 	    while (n--)
 	    {
-		WRITE(dst, FbDoRRop (READ(dst), and, xor));
-                dst++;
+		*dst = FbDoRRop (*dst, and, xor);
+		dst++;
 	    }
 	if (endmask)
 	    FbDoRightMaskByteRRop(dst,endbyte,endmask,and,xor);
@@ -160,26 +160,26 @@ fbSolid24 (FbBits   *dst,
     {
 	if (startmask)
 	{
-	    WRITE(dst, FbDoMaskRRop(READ(dst), andS, xorS, startmask));
-            dst++;
+	    *dst = FbDoMaskRRop(*dst, andS, xorS, startmask);
+	    dst++;
 	}
 	n = nmiddle;
 	if (!and0)
 	{
 	    while (n >= 3)
 	    {
-		WRITE(dst++, xor0);
-		WRITE(dst++, xor1);
-		WRITE(dst++, xor2);
+		*dst++ = xor0;
+		*dst++ = xor1;
+		*dst++ = xor2;
 		n -= 3;
 	    }
 	    if (n)
 	    {
-		WRITE(dst++, xor0);
+		*dst++ = xor0;
 		n--;
 		if (n)
 		{
-		    WRITE(dst++, xor1);
+		    *dst++ = xor1;
 		}
 	    }
 	}
@@ -187,28 +187,28 @@ fbSolid24 (FbBits   *dst,
 	{
 	    while (n >= 3)
 	    {
-		WRITE(dst, FbDoRRop (READ(dst), and0, xor0));
-                dst++;
-		WRITE(dst, FbDoRRop (READ(dst), and1, xor1));
-                dst++;
-		WRITE(dst, FbDoRRop (READ(dst), and2, xor2));
-                dst++;
+		*dst = FbDoRRop (*dst, and0, xor0);
+		dst++;
+		*dst = FbDoRRop (*dst, and1, xor1);
+		dst++;
+		*dst = FbDoRRop (*dst, and2, xor2);
+		dst++;
 		n -= 3;
 	    }
 	    if (n)
 	    {
-		WRITE(dst, FbDoRRop (READ(dst), and0, xor0));
-                dst++;
+		*dst = FbDoRRop (*dst, and0, xor0);
+		dst++;
 		n--;
 		if (n)
 		{
-		    WRITE(dst, FbDoRRop (READ(dst), and1, xor1));
-                    dst++;
+		    *dst = FbDoRRop (*dst, and1, xor1);
+		    dst++;
 		}
 	    }
 	}
 	if (endmask)
-	    WRITE(dst, FbDoMaskRRop (READ(dst), andE, xorE, endmask));
+	    *dst = FbDoMaskRRop (*dst, andE, xorE, endmask);
 	dst += dstStride;
     }
 }
diff --git a/fb/fbstipple.c b/fb/fbstipple.c
index de8d1f8..ce97148 100644
--- a/fb/fbstipple.c
+++ b/fb/fbstipple.c
@@ -155,7 +155,7 @@ fbEvenStipple (FbBits	*dst,
 	/*
 	 * Extract stipple bits for this scanline;
 	 */
-	bits = READ(s);
+	bits = *s;
 	s += stipStride;
 	if (s == stipEnd)
 	    s = stip;
@@ -199,12 +199,12 @@ fbEvenStipple (FbBits	*dst,
 	    n = nmiddle;
 	    if (!and)
 		while (n--)
-		    WRITE(dst++, xor);
+		    *dst++ = xor;
 	    else
 	    {
 		while (n--)
 		{
-		    WRITE(dst, FbDoRRop (READ(dst), and, xor));
+		    *dst = FbDoRRop (*dst, and, xor);
 		    dst++;
 		}
 	    }
diff --git a/fb/fbtile.c b/fb/fbtile.c
index e7df1af..0d0cfe1 100644
--- a/fb/fbtile.c
+++ b/fb/fbtile.c
@@ -80,7 +80,7 @@ fbEvenTile (FbBits	*dst,
 	/*
 	 * Pick up bits for this scanline
 	 */
-	bits = READ(t++);
+	bits = *t++;
 	if (t == tileEnd) t = tile;
 	bits = FbRotLeft(bits,rot);
 	and = fbAnd(alu,bits,pm);
@@ -94,11 +94,11 @@ fbEvenTile (FbBits	*dst,
 	n = nmiddle;
 	if (!and)
 	    while (n--)
-		WRITE(dst++, xor);
+		*dst++ = xor;
 	else
 	    while (n--)
 	    {
-		WRITE(dst, FbDoRRop (READ(dst), and, xor));
+		*dst = FbDoRRop (*dst, and, xor);
 		dst++;
 	    }
 	if (endmask)
diff --git a/fb/fbtrap.c b/fb/fbtrap.c
index 4c67bcd..8639695 100644
--- a/fb/fbtrap.c
+++ b/fb/fbtrap.c
@@ -95,8 +95,6 @@ fbAddTraps (PicturePtr	pPicture,
 	}
 	traps++;
     }
-
-    fbFinishAccess (pPicture->pDrawable);
 }
 
 void
@@ -144,8 +142,6 @@ fbRasterizeTrapezoid (PicturePtr    pPic
 	
 	fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
     }
-
-    fbFinishAccess (pPicture->pDrawable);
 }
 
 static int
diff --git a/fb/fbwindow.c b/fb/fbwindow.c
index cac662c..968b5a6 100644
--- a/fb/fbwindow.c
+++ b/fb/fbwindow.c
@@ -118,9 +118,6 @@ fbCopyWindowProc (DrawablePtr	pSrcDrawab
 	       upsidedown);
 	pbox++;
     }
-
-    fbFinishAccess (pDstDrawable);
-    fbFinishAccess (pSrcDrawable);
 }
 
 void 
@@ -252,8 +249,6 @@ fbFillRegionSolid (DrawablePtr	pDrawable
 	fbValidateDrawable (pDrawable);
 	pbox++;
     }
-
-    fbFinishAccess (pDrawable);
 }
 
 #ifdef PANORAMIX
@@ -316,9 +311,6 @@ fbFillRegionTiled (DrawablePtr	pDrawable
 		yRot - (pbox->y1 + dstYoff));
 	pbox++;
     }
-
-    fbFinishAccess (&pTile->drawable);
-    fbFinishAccess (pDrawable);
 }
 
 void
diff --git a/fb/wfbrename.h b/fb/wfbrename.h
deleted file mode 100644
index 8f875c8..0000000
--- a/fb/wfbrename.h
+++ /dev/null
@@ -1,198 +0,0 @@
-#define fb16Lane wfb16Lane
-#define fb24_32CopyMtoN wfb24_32CopyMtoN
-#define fb24_32CreateScreenResources wfb24_32CreateScreenResources
-#define fb24_32GetImage wfb24_32GetImage
-#define fb24_32GetSpans wfb24_32GetSpans
-#define fb24_32ModifyPixmapHeader wfb24_32ModifyPixmapHeader
-#define fb24_32PutZImage wfb24_32PutZImage
-#define fb24_32ReformatTile wfb24_32ReformatTile
-#define fb24_32SetSpans wfb24_32SetSpans
-#define fb32Lane wfb32Lane
-#define fb8Lane wfb8Lane
-#define fbAddTraps wfbAddTraps
-#define fbAddTriangles wfbAddTriangles
-#define fbAllocatePrivates wfbAllocatePrivates
-#define fbArc16 wfbArc16
-#define fbArc24 wfbArc24
-#define fbArc32 wfbArc32
-#define fbArc8 wfbArc8
-#define fbBlt wfbBlt
-#define fbBlt24 wfbBlt24
-#define fbBltOne wfbBltOne
-#define fbBltOne24 wfbBltOne24
-#define fbBltPlane wfbBltPlane
-#define fbBltStip wfbBltStip
-#define fbBres wfbBres
-#define fbBresDash wfbBresDash
-#define fbBresDash16 wfbBresDash16
-#define fbBresDash24 wfbBresDash24
-#define fbBresDash32 wfbBresDash32
-#define fbBresDash8 wfbBresDash8
-#define fbBresFill wfbBresFill
-#define fbBresFillDash wfbBresFillDash
-#define fbBresSolid wfbBresSolid
-#define fbBresSolid16 wfbBresSolid16
-#define fbBresSolid24 wfbBresSolid24
-#define fbBresSolid32 wfbBresSolid32
-#define fbBresSolid8 wfbBresSolid8
-#define fbChangeWindowAttributes wfbChangeWindowAttributes
-#define fbClearVisualTypes wfbClearVisualTypes
-#define fbCloseScreen wfbCloseScreen
-#define fbComposite wfbComposite
-#define fbCompositeGeneral wfbCompositeGeneral
-#define fbCompositeSolidMask_nx1xn wfbCompositeSolidMask_nx1xn
-#define fbCompositeSolidMask_nx8888x0565C wfbCompositeSolidMask_nx8888x0565C
-#define fbCompositeSolidMask_nx8888x8888C wfbCompositeSolidMask_nx8888x8888C
-#define fbCompositeSolidMask_nx8x0565 wfbCompositeSolidMask_nx8x0565
-#define fbCompositeSolidMask_nx8x0888 wfbCompositeSolidMask_nx8x0888
-#define fbCompositeSolidMask_nx8x8888 wfbCompositeSolidMask_nx8x8888
-#define fbCompositeSrc_0565x0565 wfbCompositeSrc_0565x0565
-#define fbCompositeSrc_8888x0565 wfbCompositeSrc_8888x0565
-#define fbCompositeSrc_8888x0888 wfbCompositeSrc_8888x0888
-#define fbCompositeSrc_8888x8888 wfbCompositeSrc_8888x8888
-#define fbCompositeSrcAdd_1000x1000 wfbCompositeSrcAdd_1000x1000
-#define fbCompositeSrcAdd_8000x8000 wfbCompositeSrcAdd_8000x8000
-#define fbCompositeSrcAdd_8888x8888 wfbCompositeSrcAdd_8888x8888
-#define fbCopy1toN wfbCopy1toN
-#define fbCopyArea wfbCopyArea
-#define fbCopyNto1 wfbCopyNto1
-#define fbCopyNtoN wfbCopyNtoN
-#define fbCopyPlane wfbCopyPlane
-#define fbCopyRegion wfbCopyRegion
-#define fbCopyWindow wfbCopyWindow
-#define fbCopyWindowProc wfbCopyWindowProc
-#define fbCreateDefColormap wfbCreateDefColormap
-#define fbCreateGC wfbCreateGC
-#define fbCreatePixmap wfbCreatePixmap
-#define fbCreatePixmapBpp wfbCreatePixmapBpp
-#define fbCreateWindow wfbCreateWindow
-#define fbDestroyPixmap wfbDestroyPixmap
-#define fbDestroyWindow wfbDestroyWindow
-#define fbDoCopy wfbDoCopy
-#define fbDots wfbDots
-#define fbDots16 wfbDots16
-#define fbDots24 wfbDots24
-#define fbDots32 wfbDots32
-#define fbDots8 wfbDots8
-#define fbEvenStipple wfbEvenStipple
-#define fbEvenTile wfbEvenTile
-#define fbExpandDirectColors wfbExpandDirectColors
-#define fbFill wfbFill
-#define fbFillRegionSolid wfbFillRegionSolid
-#define fbFillRegionTiled wfbFillRegionTiled
-#define fbFillSpans wfbFillSpans
-#define fbFixCoordModePrevious wfbFixCoordModePrevious
-#define fbGCFuncs wfbGCFuncs
-#define fbGCOps wfbGCOps
-#define fbGCPrivateIndex wfbGCPrivateIndex
-#define fbGeneration wfbGeneration
-#define fbGetGCPrivateIndex wfbGetGCPrivateIndex
-#define fbGetImage wfbGetImage
-#define fbGetScreenPrivateIndex wfbGetScreenPrivateIndex
-#define fbGetSpans wfbGetSpans
-#define _fbGetWindowPixmap _wfbGetWindowPixmap
-#define fbGetWinPrivateIndex wfbGetWinPrivateIndex
-#define fbGlyph16 wfbGlyph16
-#define fbGlyph24 wfbGlyph24
-#define fbGlyph32 wfbGlyph32
-#define fbGlyph8 wfbGlyph8
-#define fbGlyphIn wfbGlyphIn
-#define fbHasVisualTypes wfbHasVisualTypes
-#define fbImageGlyphBlt wfbImageGlyphBlt
-#define fbIn wfbIn
-#define fbInitializeColormap wfbInitializeColormap
-#define fbInitVisuals wfbInitVisuals
-#define fbInstallColormap wfbInstallColormap
-#define fbLaneTable wfbLaneTable
-#define fbListInstalledColormaps wfbListInstalledColormaps
-#define fbMapWindow wfbMapWindow
-#define FbMergeRopBits wFbMergeRopBits
-#define fbOddStipple wfbOddStipple
-#define fbOddTile wfbOddTile
-#define fbOver wfbOver
-#define fbOver24 wfbOver24
-#define fbOverlayCloseScreen wfbOverlayCloseScreen
-#define fbOverlayCopyWindow wfbOverlayCopyWindow
-#define fbOverlayCreateScreenResources wfbOverlayCreateScreenResources
-#define fbOverlayCreateWindow wfbOverlayCreateWindow
-#define fbOverlayFinishScreenInit wfbOverlayFinishScreenInit
-#define fbOverlayGeneration wfbOverlayGeneration
-#define fbOverlayGetScreenPrivateIndex wfbOverlayGetScreenPrivateIndex
-#define fbOverlayPaintKey wfbOverlayPaintKey
-#define fbOverlayPaintWindow wfbOverlayPaintWindow
-#define fbOverlayScreenPrivateIndex wfbOverlayScreenPrivateIndex
-#define fbOverlaySetupScreen wfbOverlaySetupScreen
-#define fbOverlayUpdateLayerRegion wfbOverlayUpdateLayerRegion
-#define fbOverlayWindowExposures wfbOverlayWindowExposures
-#define fbOverlayWindowLayer wfbOverlayWindowLayer
-#define fbPadPixmap wfbPadPixmap
-#define fbPaintWindow wfbPaintWindow
-#define fbPictureInit wfbPictureInit
-#define fbPixmapToRegion wfbPixmapToRegion
-#define fbPolyArc wfbPolyArc
-#define fbPolyFillRect wfbPolyFillRect
-#define fbPolyGlyphBlt wfbPolyGlyphBlt
-#define fbPolyLine wfbPolyLine
-#define fbPolyline16 wfbPolyline16
-#define fbPolyline24 wfbPolyline24
-#define fbPolyline32 wfbPolyline32
-#define fbPolyline8 wfbPolyline8
-#define fbPolyPoint wfbPolyPoint
-#define fbPolySegment wfbPolySegment
-#define fbPolySegment16 wfbPolySegment16
-#define fbPolySegment24 wfbPolySegment24
-#define fbPolySegment32 wfbPolySegment32
-#define fbPolySegment8 wfbPolySegment8
-#define fbPositionWindow wfbPositionWindow
-#define fbPushFill wfbPushFill
-#define fbPushImage wfbPushImage
-#define fbPushPattern wfbPushPattern
-#define fbPushPixels wfbPushPixels
-#define fbPutImage wfbPutImage
-#define fbPutXYImage wfbPutXYImage
-#define fbPutZImage wfbPutZImage
-#define fbQueryBestSize wfbQueryBestSize
-#define fbRasterizeEdges wfbRasterizeEdges
-#define fbRasterizeTrapezoid wfbRasterizeTrapezoid
-#define fbRealizeFont wfbRealizeFont
-#define fbReduceRasterOp wfbReduceRasterOp
-#define fbReplicatePixel wfbReplicatePixel
-#define fbResolveColor wfbResolveColor
-#define fbRestoreAreas wfbRestoreAreas
-#define fbSaveAreas wfbSaveAreas
-#define fbScreenPrivateIndex wfbScreenPrivateIndex
-#define fbSegment wfbSegment
-#define fbSelectBres wfbSelectBres
-#define fbSetSpans wfbSetSpans
-#define fbSetupScreen wfbSetupScreen
-#define fbSetVisualTypes wfbSetVisualTypes
-#define fbSetVisualTypesAndMasks wfbSetVisualTypesAndMasks
-#define _fbSetWindowPixmap _wfbSetWindowPixmap
-#define fbSolid wfbSolid
-#define fbSolid24 wfbSolid24
-#define fbSolidBoxClipped wfbSolidBoxClipped
-#define fbStipple wfbStipple
-#define fbStipple1Bits wfbStipple1Bits
-#define fbStipple24Bits wfbStipple24Bits
-#define fbStipple2Bits wfbStipple2Bits
-#define fbStipple4Bits wfbStipple4Bits
-#define fbStipple8Bits wfbStipple8Bits
-#define fbStippleTable wfbStippleTable
-#define fbTile wfbTile
-#define fbTransparentSpan wfbTransparentSpan
-#define fbUninstallColormap wfbUninstallColormap
-#define fbUnmapWindow wfbUnmapWindow
-#define fbUnrealizeFont wfbUnrealizeFont
-#define fbValidateGC wfbValidateGC
-#define fbWinPrivateIndex wfbWinPrivateIndex
-#define fbZeroLine wfbZeroLine
-#define fbZeroSegment wfbZeroSegment
-#define xxScrPrivateIndex wfbxxScrPrivateIndex
-#define xxGCPrivateIndex wfbxxGCPrivateIndex
-#define xxColormapPrivateIndex wfbxxColormapPrivateIndex
-#define xxGeneration wfbxxGeneration
-#define xxPrintVisuals wfbxxPrintVisuals
-#define xxGCFuncs wfbxxGCFuncs
-#define xxGCOps wfbxxGCOps
-#define xxSetup wfbxxSetup
-#define composeFunctions wfbComposeFunctions
diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am
index 89136b9..d36647b 100644
--- a/hw/dmx/Makefile.am
+++ b/hw/dmx/Makefile.am
@@ -16,9 +16,6 @@ GLX_INCS = -I$(top_srcdir)/hw/xfree86/di
 GLX_DEFS = @GL_CFLAGS@ 
 endif
 
-# It's essential that fbcmap.c be compiled with this flag for DMX to work!!
-DMX_CFLAGS = -DXFree86Server=1
-
 if BUILDDOCS
 SUBDIRS += doc
 endif
@@ -89,7 +86,6 @@ Xdmx_CFLAGS = \
               $(DIX_CFLAGS) \
               $(GLX_INCS) \
               $(GLX_DEFS) \
-              $(DMX_CFLAGS) \
               @DMXMODULES_CFLAGS@
 
 # Man page
diff --git a/hw/dmx/dmxcmap.c b/hw/dmx/dmxcmap.c
index 9a9781f..b4279e7 100644
--- a/hw/dmx/dmxcmap.c
+++ b/hw/dmx/dmxcmap.c
@@ -40,7 +40,6 @@
 #endif
 
 #include "dmx.h"
-#include "dmxlog.h"
 #include "dmxsync.h"
 #include "dmxcmap.h"
 #include "dmxvisual.h"
@@ -84,18 +83,12 @@ Bool dmxBECreateColormap(ColormapPtr pCo
     VisualPtr           pVisual   = pColormap->pVisual;
     Visual             *visual    = dmxLookupVisual(pScreen, pVisual);
 
-    if (visual) {
-       pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
-                                         dmxScreen->scrnWin,
-                                         visual,
-                                         (pVisual->class & DynamicClass ?
-                                          AllocAll : AllocNone));
-       return (pCmapPriv->cmap != 0);
-    }
-    else {
-       dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n");
-       return 0;
-    }
+    pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay,
+				      dmxScreen->scrnWin,
+				      visual,
+				      (pVisual->class & DynamicClass ?
+				       AllocAll : AllocNone));
+    return (pCmapPriv->cmap != 0);
 }
 
 /** Create colormap on back-end server associated with \a pColormap's
diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c
index e74a052..a49fc9f 100644
--- a/hw/dmx/dmxcursor.c
+++ b/hw/dmx/dmxcursor.c
@@ -664,8 +664,8 @@ static Bool _dmxUnrealizeCursor(ScreenPt
 {
     DMXScreenInfo    *dmxScreen = &dmxScreens[pScreen->myNum];
 
-    DMXDBG2("_dmxUnrealizeCursor(%d,%p)\n",
-            pScreen->myNum, pCursor);
+    DMXDBG3("_dmxUnrealizeCursor(%d,%p) %p\n",
+            pScreen->myNum, pCursor, pCursorPriv);
 
     if (dmxScreen->beDisplay) {
 	if (dmxBEFreeCursor(pScreen, pCursor))
diff --git a/hw/xfree86/dixmods/Makefile.am b/hw/xfree86/dixmods/Makefile.am
index c34ddd6..65dad8a 100644
--- a/hw/xfree86/dixmods/Makefile.am
+++ b/hw/xfree86/dixmods/Makefile.am
@@ -18,7 +18,6 @@ module_LTLIBRARIES = libafb.la \
                      libcfb.la \
                      libcfb32.la \
                      libfb.la \
-                     libwfb.la \
                      libmfb.la \
                      libshadow.la
 
@@ -67,11 +66,6 @@ libfb_la_LIBADD = $(top_builddir)/fb/lib
 libfb_la_SOURCES = $(top_builddir)/fb/fbcmap.c fbmodule.c
 libfb_la_CFLAGS = -DXFree86Server $(AM_CFLAGS)
 
-libwfb_la_LDFLAGS = -avoid-version
-libwfb_la_LIBADD = $(top_builddir)/fb/libwfb.la
-libwfb_la_SOURCES = $(top_builddir)/fb/fbcmap.c fbmodule.c
-libwfb_la_CFLAGS = -DXFree86Server $(AM_CFLAGS) -DFB_ACCESS_WRAPPER
-
 libglx_la_LDFLAGS = -avoid-version
 if AIGLX
 GLXDRI_LIBRARY = $(top_builddir)/GL/glx/libglxdri.la
diff --git a/hw/xfree86/dixmods/fbmodule.c b/hw/xfree86/dixmods/fbmodule.c
index 4df2646..e8e6cd7 100644
--- a/hw/xfree86/dixmods/fbmodule.c
+++ b/hw/xfree86/dixmods/fbmodule.c
@@ -33,11 +33,7 @@
 
 static XF86ModuleVersionInfo VersRec =
 {
-#ifdef FB_ACCESS_WRAPPER
-	"wfb",
-#else
 	"fb",
-#endif
 	MODULEVENDORSTRING,
 	MODINFOSTRING1,
 	MODINFOSTRING2,
@@ -49,4 +45,4 @@ static XF86ModuleVersionInfo VersRec =
 	{0,0,0,0}       /* signature, to be patched into the file by a tool */
 };
 
-_X_EXPORT XF86ModuleData FBPREFIX(ModuleData) = { &VersRec, NULL, NULL };
+_X_EXPORT XF86ModuleData fbModuleData = { &VersRec, NULL, NULL };
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 9e52e61..7b4d5bd 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -992,10 +992,6 @@ DRICreateDrawable(ScreenPtr pScreen, Dra
 	pWin = (WindowPtr)pDrawable;
 	if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
 	    pDRIDrawablePriv->refCount++;
-
-	    if (!pDRIDrawablePriv->hwDrawable) {
-		drmCreateDrawable(pDRIPriv->drmFD, &pDRIDrawablePriv->hwDrawable);
-	    }
 	}
 	else {
 	    /* allocate a DRI Window Private record */
@@ -1004,13 +1000,13 @@ DRICreateDrawable(ScreenPtr pScreen, Dra
 	    }
 
 	    /* Only create a drm_drawable_t once */
-	    if (drmCreateDrawable(pDRIPriv->drmFD,
-				  &pDRIDrawablePriv->hwDrawable)) {
+	    if (drmCreateDrawable(pDRIPriv->drmFD, hHWDrawable)) {
 		xfree(pDRIDrawablePriv);
 		return FALSE;
 	    }
 
 	    /* add it to the list of DRI drawables for this screen */
+	    pDRIDrawablePriv->hwDrawable = *hHWDrawable;
 	    pDRIDrawablePriv->pScreen = pScreen;
 	    pDRIDrawablePriv->refCount = 1;
 	    pDRIDrawablePriv->drawableIndex = -1;
@@ -1033,15 +1029,6 @@ DRICreateDrawable(ScreenPtr pScreen, Dra
 	    /* track this in case this window is destroyed */
 	    AddResource(id, DRIDrawablePrivResType, (pointer)pWin);
 	}
-
-	if (pDRIDrawablePriv->hwDrawable) {
-	    drmUpdateDrawableInfo(pDRIPriv->drmFD,
-				  pDRIDrawablePriv->hwDrawable,
-				  DRM_DRAWABLE_CLIPRECTS,
-				  REGION_NUM_RECTS(&pWin->clipList),
-				  REGION_RECTS(&pWin->clipList));
-	    *hHWDrawable = pDRIDrawablePriv->hwDrawable;
-	}
     }
     else { /* pixmap (or for GLX 1.3, a PBuffer) */
 	/* NOT_DONE */
@@ -1826,11 +1813,6 @@ DRIClipNotify(WindowPtr pWin, int dx, in
 
 	pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
 	    = DRIDrawableValidationStamp++;
-
-	drmUpdateDrawableInfo(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable,
-			      DRM_DRAWABLE_CLIPRECTS,
-			      REGION_NUM_RECTS(&pWin->clipList),
-			      REGION_RECTS(&pWin->clipList));
     }
 
     /* call lower wrapped functions */
diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c
index c6dad1f..a97e6f0 100644
--- a/hw/xfree86/os-support/bus/linuxPci.c
+++ b/hw/xfree86/os-support/bus/linuxPci.c
@@ -85,7 +85,7 @@ static pciBusFuncs_t linuxFuncs0 = {
 /* pciAddrHostToBus */	pciAddrNOOP,
 /* linuxTransAddrBusToHost is busted on sparc64 but the PCI rework tree
  * makes it all moot, so we kludge it for now */
-#if defined(__sparc__)
+#if defined(__sparc64__)
 /* pciAddrBusToHost */  pciAddrNOOP,
 #else
 /* pciAddrBusToHost */	linuxTransAddrBusToHost,
diff --git a/hw/xfree86/os-support/drm/xf86drm.c b/hw/xfree86/os-support/drm/xf86drm.c
index 214e58b..3759920 100644
--- a/hw/xfree86/os-support/drm/xf86drm.c
+++ b/hw/xfree86/os-support/drm/xf86drm.c
@@ -1388,22 +1388,6 @@ int drmDestroyDrawable(int fd, drm_drawa
     return 0;
 }
 
-int drmUpdateDrawableInfo(int fd, drm_drawable_t handle,
-			   drm_drawable_info_type_t type, unsigned int num,
-			   void *data)
-{
-    drm_update_draw_t update;
-
-    update.handle = handle;
-    update.type = type;
-    update.num = num;
-    update.data = (unsigned long long)(unsigned long)data;
-
-    if (ioctl(fd, DRM_IOCTL_UPDATE_DRAW, &update)) return -errno;
-
-    return 0;
-}
-
 /**
  * Acquire the AGP device.
  *
diff --git a/hw/xfree86/os-support/xf86drm.h b/hw/xfree86/os-support/xf86drm.h
index 1076706..88f5e0f 100644
--- a/hw/xfree86/os-support/xf86drm.h
+++ b/hw/xfree86/os-support/xf86drm.h
@@ -543,9 +543,6 @@ extern int           drmSwitchToContext(
 extern int           drmDestroyContext(int fd, drm_context_t handle);
 extern int           drmCreateDrawable(int fd, drm_drawable_t * handle);
 extern int           drmDestroyDrawable(int fd, drm_drawable_t handle);
-extern int           drmUpdateDrawableInfo(int fd, drm_drawable_t handle,
-					   drm_drawable_info_type_t type,
-					   unsigned int num, void *data);
 extern int           drmCtlInstHandler(int fd, int irq);
 extern int           drmCtlUninstHandler(int fd);
 extern int           drmInstallSIGIOHandler(int fd,
diff --git a/hw/xfree86/parser/scan.c b/hw/xfree86/parser/scan.c
index f81c45a..5b29ab8 100644
--- a/hw/xfree86/parser/scan.c
+++ b/hw/xfree86/parser/scan.c
@@ -157,128 +157,9 @@ xf86strToUL (char *str)
 	return (tot);
 }
 
-/*
- * xf86getNextLine --
- *
- *  read from the configFile FILE stream until we encounter a new
- *  line; this is effectively just a big wrapper for fgets(3).
- *
- *  xf86getToken() assumes that we will read up to the next
- *  newline; we need to grow configBuf and configRBuf as needed to
- *  support that.
- */
-
-static char*
-xf86getNextLine(void)
-{
-	static int configBufLen = CONFIG_BUF_LEN;
-	char *tmpConfigBuf, *tmpConfigRBuf;
-	int c, i, pos = 0, eolFound = 0;
-	char *ret = NULL;
-
-	/*
-	 * reallocate the string if it was grown last time (i.e., is no
-	 * longer CONFIG_BUF_LEN); we malloc the new strings first, so
-	 * that if either of the mallocs fail, we can fall back on the
-	 * existing buffer allocations
-	 */
-
-	if (configBufLen != CONFIG_BUF_LEN) {
-
-		tmpConfigBuf = xf86confmalloc(CONFIG_BUF_LEN);
-		tmpConfigRBuf = xf86confmalloc(CONFIG_BUF_LEN);
-
-		if (!tmpConfigBuf || !tmpConfigRBuf) {
-
-			/*
-			 * at least one of the mallocs failed; keep the old buffers
-			 * and free any partial allocations
-			 */
-
-			xf86conffree(tmpConfigBuf);
-			xf86conffree(tmpConfigRBuf);
-
-		} else {
-
-			/*
-			 * malloc succeeded; free the old buffers and use the new
-			 * buffers
-			 */
-
-			configBufLen = CONFIG_BUF_LEN;
-
-			xf86conffree(configBuf);
-			xf86conffree(configRBuf);
-
-			configBuf = tmpConfigBuf;
-			configRBuf = tmpConfigRBuf;
-		}
-	}
-
-	/* read in another block of chars */
-
-	do {
-		ret = fgets(configBuf + pos, configBufLen - pos - 1, configFile);
-
-		if (!ret) break;
-
-		/* search for EOL in the new block of chars */
-
-		for (i = pos; i < (configBufLen - 1); i++) {
-			c = configBuf[i];
-
-			if (c == '\0') break;
-
-			if ((c == '\n') || (c == '\r')) {
-				eolFound = 1;
-				break;
-			}
-		}
-
-		/*
-		 * if we didn't find EOL, then grow the string and
-		 * read in more
-		 */
-
-		if (!eolFound) {
-
-			tmpConfigBuf = xf86confrealloc(configBuf, configBufLen + CONFIG_BUF_LEN);
-			tmpConfigRBuf = xf86confrealloc(configRBuf, configBufLen + CONFIG_BUF_LEN);
-
-			if (!tmpConfigBuf || !tmpConfigRBuf) {
-
-				/*
-				 * at least one of the reallocations failed; use the
-				 * new allocation that succeeded, but we have to
-				 * fallback to the previous configBufLen size and use
-				 * the string we have, even though we don't have an
-				 * EOL
-				 */
-
-				if (tmpConfigBuf) configBuf = tmpConfigBuf;
-				if (tmpConfigRBuf) configRBuf = tmpConfigRBuf;
-
-				break;
-
-			} else {
-
-				/* reallocation succeeded */
-
-				configBuf = tmpConfigBuf;
-				configRBuf = tmpConfigRBuf;
-				pos = i;
-				configBufLen += CONFIG_BUF_LEN;
-			}
-		}
-
-	} while (!eolFound);
-
-	return (ret);
-}
-
 /* 
  * xf86getToken --
- *      Read next Token from the config file. Handle the global variable
+ *      Read next Token form the config file. Handle the global variable
  *      pushToken.
  */
 int
@@ -312,7 +193,7 @@ again:
 		{
 			char *ret;
 			if (configFile)
-				ret = xf86getNextLine();
+				ret = fgets (configBuf, CONFIG_BUF_LEN - 1, configFile);
 			else {
 				if (builtinConfig[builtinIndex] == NULL)
 					ret = NULL;
diff --git a/hw/xfree86/rac/Makefile.am b/hw/xfree86/rac/Makefile.am
index 2d8d879..328ed19 100644
--- a/hw/xfree86/rac/Makefile.am
+++ b/hw/xfree86/rac/Makefile.am
@@ -1,4 +1,4 @@
-noinst_LIBRARIES = librac.a
+module_LIBRARIES = librac.a
 librac_a_SOURCES = xf86RAC.c
 
 sdk_HEADERS = xf86RAC.h
diff --git a/hw/xprint/etc/Xsession.d/92xprint-xpserverlist b/hw/xprint/etc/Xsession.d/92xprint-xpserverlist
deleted file mode 100644
index 60d964a..0000000
--- a/hw/xprint/etc/Xsession.d/92xprint-xpserverlist
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh 
-#####################################################################
-###  File:              92xprint-xpserverlist
-###
-###  Default Location:  /etc/X11/Xsession.d/
-###
-###  Purpose:           Setup Xprint env vars
-###                     
-###  Description:       This script is invoked by means of the Xsession file
-###                     at user login. 
-###
-###  Invoked by:        /etc/X11/Xsession
-###
-###  (c) Copyright 2003-2004 Roland Mainz <roland.mainz at nrubsig.org>
-###
-###  please send bugfixes or comments to https://bugs.freedesktop.org
-###
-#####################################################################
-
-
-#
-# Obtain list of Xprint servers
-#
-
-if [ -x "/etc/init.d/xprint" ] ; then
-  XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`"
-  export XPSERVERLIST
-fi
-
-##########################         eof       #####################
diff --git a/hw/xprint/etc/Xsession.d/Makefile.am b/hw/xprint/etc/Xsession.d/Makefile.am
index 96a5ee7..e0277d9 100644
--- a/hw/xprint/etc/Xsession.d/Makefile.am
+++ b/hw/xprint/etc/Xsession.d/Makefile.am
@@ -1,2 +1 @@
-xpcdir = $(sysconfdir)/X11/Xsession.d
-dist_xpc_DATA = 92xprint-xpserverlist
+EXTRA_DIST = cde_xsessiond_xprint.sh
diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 034f694..f94a869 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -269,7 +269,7 @@ char	tmpname[PATH_MAX];
 #ifndef WIN32
     if (haveDir)
 	fclose(in);
-    else if ((rval=Pclose(in))!=0) {
+    else if ((rval=pclose(in))!=0) {
 	if (xkbDebugFlags)
 	    ErrorF("xkbcomp returned exit code %d\n",rval);
     }
diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 26ff35e..ee0abbe 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -754,12 +754,12 @@ unsigned char	grp;
 
 
     grp= state->locked_group;
-    if (grp>=ctrls->num_groups)
-	state->locked_group= XkbAdjustGroup(XkbCharToInt(grp),ctrls);
+    if (grp>=ctrls->num_groups || grp < 0)
+	state->locked_group= XkbAdjustGroup(grp,ctrls);
 
     grp= state->locked_group+state->base_group+state->latched_group;
-    if (grp>=ctrls->num_groups)
-	 state->group= XkbAdjustGroup(XkbCharToInt(grp),ctrls);
+    if (grp>=ctrls->num_groups || grp < 0)
+	 state->group= XkbAdjustGroup(grp,ctrls);
     else state->group= grp;
     XkbComputeCompatState(xkbi);
     return;
diff-tree 46af6d1e953f1eefb6edbba3d29fb9700e42c2bb (from 63acf18b7e4ce3a9f7deab3a9088a1c41cab0191)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 19:28:44 2006 -0400

    Always believe the monitor when it reports a reduced-blanking mode.
    
    CVT reduced blanking modes are typically only seen on digital connections to
    LCDs, but there are some monitors that report them as supported over the
    VGA connector too, which is perfectly legitimate, electrically speaking.

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index ac3fb8c..456331d 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -832,7 +832,7 @@ xf86CheckModeForMonitor(DisplayModePtr m
             ((mode->HSyncEnd - mode->HDisplay) == 80) &&
             ((mode->HSyncEnd - mode->HSyncStart) == 32) &&
             ((mode->VSyncStart - mode->VDisplay) == 3)) {
-            if (!monitor->reducedblanking)
+            if (!monitor->reducedblanking && !(mode->type & M_T_DRIVER))
                 return MODE_NO_REDUCED;
         }
     }
diff-tree 63acf18b7e4ce3a9f7deab3a9088a1c41cab0191 (from a8f9936f55c5364bb02e8c3187507eb1f70e2ef2)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 19:26:37 2006 -0400

    In xf86MatchPciInstances, fail gracefully when there's no PCI device at all.
    
    This allows the autoconfig logic to fall through sanely on non-PCI machines,
    which importantly includes Xen virtual machines.

diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index 851a345..c226bf2 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -1635,6 +1635,8 @@ xf86MatchPciInstances(const char *driver
 
     *foundEntities = NULL;
 
+    if (!xf86PciVideoInfo)
+	return 0;
 
     /* Each PCI device will contribute at least one entry.  Each device
      * section can contribute at most one entry.  The sum of the two is
diff-tree a8f9936f55c5364bb02e8c3187507eb1f70e2ef2 (from 81ef1b6d6063c20db4963abf7b7848e235aa4ebb)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 19:24:41 2006 -0400

    Prefer driver-provided modes when matching name strings to modelines.
    
    Well, kinda.  Strictly we prefer M_T_BUILTIN strongest since those are modes
    where the driver has said it absolutely can't do anything else (VBE).  Then
    we look for user-defined modes, ie, modelines from the config file.  Then
    we consider modes reported by the monitor via EDID.  Finally if nothing has
    matched yet we consider the default mode pool.
    
    Within each of the above-mentioned classes, modes with the M_T_PREFERRED bit
    take priority over other modes in the same class.
    
    This logic ensures that the timings sent to the monitor exactly match the
    timings it reported as supported, which occasionally don't match the numbers
    you might get for that mode from CVT or GTF.

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index a3ef420..ac3fb8c 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -445,6 +445,17 @@ xf86LookupMode(ScrnInfoPtr scrp, Display
     ModeStatus status = MODE_NOMODE;
     Bool allowDiv2 = (strategy & LOOKUP_CLKDIV2) != 0;
     Bool haveBuiltin;
+    int n;
+    const int types[] = {
+	M_T_BUILTIN | M_T_PREFERRED,
+	M_T_BUILTIN,
+	M_T_USERDEF | M_T_PREFERRED,
+	M_T_USERDEF,
+	M_T_DRIVER | M_T_PREFERRED,
+	M_T_DRIVER,
+	0
+    };
+    const int ntypes = sizeof(types) / sizeof(int);
 
     strategy &= ~(LOOKUP_CLKDIV2 | LOOKUP_OPTIONAL_TOLERANCES);
 
@@ -464,143 +475,141 @@ xf86LookupMode(ScrnInfoPtr scrp, Display
 	cp->ClockMulFactor = max(1, cp->ClockMulFactor);
     }
 
-    haveBuiltin = FALSE;
     /* Scan the mode pool for matching names */
-    for (p = scrp->modePool; p != NULL; p = p->next) {
-	if (strcmp(p->name, modep->name) == 0) {
-	    /*
-	     * Requested mode is a built-in mode. Don't let the user
-	     * override it.
-	     * Since built-in modes always come before user specified
-	     * modes it will always be found first.  
-	     */
-	    if (p->type & M_T_BUILTIN) {
-		haveBuiltin = TRUE;
-	    }
+    for (n = 0; n < ntypes; n++) {
+	int type = types[n];
+	for (p = scrp->modePool; p != NULL; p = p->next) {
 
-	    if (haveBuiltin && !(p->type & M_T_BUILTIN))
+	    /* scan through the modes in the sort order above */
+	    if ((p->type & type) != type)
 		continue;
 
-	    /* Skip over previously rejected modes */
-	    if (p->status != MODE_OK) {
-		if (!found)
-		    status = p->status;
-		continue;
-	    }
-		
-	    /* Skip over previously considered modes */
-	    if (p->prev)
-		continue;
+	    if (strcmp(p->name, modep->name) == 0) {
 
-	    if (p->type & M_T_BUILTIN) {
-		return xf86HandleBuiltinMode(scrp, p,modep, clockRanges,
-					     allowDiv2);
-	    }
+		/* Skip over previously rejected modes */
+		if (p->status != MODE_OK) {
+		    if (!found)
+			status = p->status;
+		    continue;
+		}
 
-	    /* Check clock is in range */
-	    cp = xf86FindClockRangeForMode(clockRanges, p);
-	    if (cp == NULL) {
-		/*
-		 * XXX Could do more here to provide a more detailed
-		 * reason for not finding a mode.
-		 */
-		p->status = MODE_CLOCK_RANGE;
-		if (!found)
-		    status = MODE_CLOCK_RANGE;
-		continue;
-	    }
+		/* Skip over previously considered modes */
+		if (p->prev)
+		    continue;
 
-	    /*
-	     * If programmable clock and strategy is not LOOKUP_BEST_REFRESH,
-	     * the required mode has been found, otherwise record the refresh
-	     * and continue looking.
-	     */
-	    if (scrp->progClock) {
-		found = TRUE;
-		if (strategy != LOOKUP_BEST_REFRESH) {
-		    bestMode = p;
-		    DivFactor = cp->ClockDivFactor;
-		    MulFactor = cp->ClockMulFactor;
-		    ModePrivFlags = cp->PrivFlags;
-		    break;
+		if (p->type & M_T_BUILTIN) {
+		    return xf86HandleBuiltinMode(scrp, p,modep, clockRanges,
+			    allowDiv2);
 		}
-		refresh = ModeVRefresh(p);
-		if (p->Flags & V_INTERLACE)
-		    refresh /= INTERLACE_REFRESH_WEIGHT;
-		if (refresh > bestRefresh) {
-		    bestMode = p;
-		    DivFactor = cp->ClockDivFactor;
-		    MulFactor = cp->ClockMulFactor;
-		    ModePrivFlags = cp->PrivFlags;
-		    bestRefresh = refresh;
+
+		/* Check clock is in range */
+		cp = xf86FindClockRangeForMode(clockRanges, p);
+		if (cp == NULL) {
+		    /*
+		     * XXX Could do more here to provide a more detailed
+		     * reason for not finding a mode.
+		     */
+		    p->status = MODE_CLOCK_RANGE;
+		    if (!found)
+			status = MODE_CLOCK_RANGE;
+		    continue;
 		}
-		continue;
-	    }
 
-	    /*
-	     * Clock is in range, so if it is not a programmable clock, find
-	     * a matching clock.
-	     */
+		/*
+		 * If programmable clock and strategy is not
+		 * LOOKUP_BEST_REFRESH, the required mode has been found,
+		 * otherwise record the refresh and continue looking.
+		 */
+		if (scrp->progClock) {
+		    found = TRUE;
+		    if (strategy != LOOKUP_BEST_REFRESH) {
+			bestMode = p;
+			DivFactor = cp->ClockDivFactor;
+			MulFactor = cp->ClockMulFactor;
+			ModePrivFlags = cp->PrivFlags;
+			break;
+		    }
+		    refresh = ModeVRefresh(p);
+		    if (p->Flags & V_INTERLACE)
+			refresh /= INTERLACE_REFRESH_WEIGHT;
+		    if (refresh > bestRefresh) {
+			bestMode = p;
+			DivFactor = cp->ClockDivFactor;
+			MulFactor = cp->ClockMulFactor;
+			ModePrivFlags = cp->PrivFlags;
+			bestRefresh = refresh;
+		    }
+		    continue;
+		}
 
-	    i = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
-		cp->ClockDivFactor, cp->ClockMulFactor, &k);
-	    /*
-	     * If the clock is too far from the requested clock, this
-	     * mode is no good.
-	     */
-	    if (k & V_CLKDIV2)
-		gap = abs((p->Clock * 2) -
-		    ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor));
-	    else
-		gap = abs(p->Clock -
-		    ((scrp->clock[i] * cp->ClockDivFactor) / cp->ClockMulFactor));
-	    if (gap > minimumGap) {
-		p->status = MODE_NOCLOCK;
-		if (!found)
-		    status = MODE_NOCLOCK;
-		continue;
-	    }
-	    found = TRUE;
+		/*
+		 * Clock is in range, so if it is not a programmable clock, find
+		 * a matching clock.
+		 */
 
-	    if (strategy == LOOKUP_BEST_REFRESH) {
-		refresh = ModeVRefresh(p);
-		if (p->Flags & V_INTERLACE)
-		    refresh /= INTERLACE_REFRESH_WEIGHT;
-		if (refresh > bestRefresh) {
-		    bestMode = p;
-		    DivFactor = cp->ClockDivFactor;
-		    MulFactor = cp->ClockMulFactor;
-		    ModePrivFlags = cp->PrivFlags;
-		    extraFlags = k;
-		    clockIndex = i;
-		    bestRefresh = refresh;
+		i = xf86GetNearestClock(scrp, p->Clock, allowDiv2,
+			cp->ClockDivFactor, cp->ClockMulFactor, &k);
+		/*
+		 * If the clock is too far from the requested clock, this
+		 * mode is no good.
+		 */
+		if (k & V_CLKDIV2)
+		    gap = abs((p->Clock * 2) -
+			    ((scrp->clock[i] * cp->ClockDivFactor) /
+				cp->ClockMulFactor));
+		else
+		    gap = abs(p->Clock -
+			    ((scrp->clock[i] * cp->ClockDivFactor) /
+				cp->ClockMulFactor));
+		if (gap > minimumGap) {
+		    p->status = MODE_NOCLOCK;
+		    if (!found)
+			status = MODE_NOCLOCK;
+		    continue;
 		}
-		continue;
-	    }
-	    if (strategy == LOOKUP_CLOSEST_CLOCK) {
-		if (gap < minimumGap) {
-		    bestMode = p;
-		    DivFactor = cp->ClockDivFactor;
-		    MulFactor = cp->ClockMulFactor;
-		    ModePrivFlags = cp->PrivFlags;
-		    extraFlags = k;
-		    clockIndex = i;
-		    minimumGap = gap;
+		found = TRUE;
+
+		if (strategy == LOOKUP_BEST_REFRESH) {
+		    refresh = ModeVRefresh(p);
+		    if (p->Flags & V_INTERLACE)
+			refresh /= INTERLACE_REFRESH_WEIGHT;
+		    if (refresh > bestRefresh) {
+			bestMode = p;
+			DivFactor = cp->ClockDivFactor;
+			MulFactor = cp->ClockMulFactor;
+			ModePrivFlags = cp->PrivFlags;
+			extraFlags = k;
+			clockIndex = i;
+			bestRefresh = refresh;
+		    }
+		    continue;
 		}
-		continue;
+		if (strategy == LOOKUP_CLOSEST_CLOCK) {
+		    if (gap < minimumGap) {
+			bestMode = p;
+			DivFactor = cp->ClockDivFactor;
+			MulFactor = cp->ClockMulFactor;
+			ModePrivFlags = cp->PrivFlags;
+			extraFlags = k;
+			clockIndex = i;
+			minimumGap = gap;
+		    }
+		    continue;
+		}
+		/*
+		 * If strategy is neither LOOKUP_BEST_REFRESH or
+		 * LOOKUP_CLOSEST_CLOCK the required mode has been found.
+		 */
+		bestMode = p;
+		DivFactor = cp->ClockDivFactor;
+		MulFactor = cp->ClockMulFactor;
+		ModePrivFlags = cp->PrivFlags;
+		extraFlags = k;
+		clockIndex = i;
+		break;
 	    }
-	    /*
-	     * If strategy is neither LOOKUP_BEST_REFRESH or
-	     * LOOKUP_CLOSEST_CLOCK the required mode has been found.
-	     */
-	    bestMode = p;
-	    DivFactor = cp->ClockDivFactor;
-	    MulFactor = cp->ClockMulFactor;
-	    ModePrivFlags = cp->PrivFlags;
-	    extraFlags = k;
-	    clockIndex = i;
-	    break;
 	}
+	if (found) break;
     }
     if (!found || bestMode == NULL)
 	return status;
@@ -611,7 +620,8 @@ xf86LookupMode(ScrnInfoPtr scrp, Display
 	modep->ClockIndex	= -1;
 	modep->SynthClock	= (modep->Clock * MulFactor) / DivFactor;
     } else {
-	modep->Clock		= (scrp->clock[clockIndex] * DivFactor) / MulFactor;
+	modep->Clock		= (scrp->clock[clockIndex] * DivFactor) /
+				    MulFactor;
 	modep->ClockIndex	= clockIndex;
 	modep->SynthClock	= scrp->clock[clockIndex];
 	if (extraFlags & V_CLKDIV2) {
diff-tree 81ef1b6d6063c20db4963abf7b7848e235aa4ebb (from 43d9edd31e31b33b9da4a50d8ab05004881c8d5a)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 19:18:58 2006 -0400

    Mark EDID modes as driver modes.  Infer virtual size from driver modes.
    
    This allows the server to guess an appropriate initial virtual size and
    resolution.  The heuristic is to select the largest driver-reported mode
    that matches the monitor's physical aspect ratio.  We revalidate this
    estimate after mode validation, since we may have filtered away all
    modes that would fill that size.
    
    Also, the EDID preferred timing is now marked as M_T_PREFERRED as well.

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index c66a3fb..a3ef420 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -45,6 +45,7 @@
 #include "globals.h"
 #include "xf86.h"
 #include "xf86Priv.h"
+#include "edid.h"
 
 static void
 printModeRejectMessage(int index, DisplayModePtr p, int status)
@@ -55,6 +56,8 @@ printModeRejectMessage(int index, Displa
 	type = "built-in ";
     else if (p->type & M_T_DEFAULT)
 	type = "default ";
+    else if (p->type & M_T_DRIVER)
+	type = "driver ";
     else
 	type = "";
 
@@ -1177,6 +1180,58 @@ xf86CheckModeForDriver(ScrnInfoPtr scrp,
     return MODE_OK;
 }
 
+static int 
+inferVirtualSize(ScrnInfoPtr scrp, DisplayModePtr modes, int *vx, int *vy)
+{
+    float aspect = 0.0;
+    MonPtr mon = scrp->monitor;
+    int x = 0, y = 0;
+    DisplayModePtr mode;
+
+    if (!mon) return 0;
+
+    /*
+     * technically this triggers if _either_ is zero, which is not what EDID
+     * says, but if only one is zero this is best effort.  also we don't
+     * know that all projectors are 4:3, but we certainly suspect it.
+     */
+    if (!mon->widthmm || !mon->heightmm)
+	aspect = 4.0/3.0;
+    else
+	aspect = (float)mon->widthmm / (float)mon->heightmm;
+
+    /* find the largest M_T_DRIVER mode with that aspect ratio */
+    for (mode = modes; mode; mode = mode->next) {
+	float mode_aspect, metaspect;
+	if (!(mode->type & (M_T_DRIVER|M_T_USERDEF)))
+	    continue;
+	mode_aspect = (float)mode->HDisplay / (float)mode->VDisplay;
+	metaspect = aspect / mode_aspect;
+	/* 5% slop or so, since we only get size in centimeters */
+	if (fabs(1.0 - metaspect) < 0.05) {
+	    if ((mode->HDisplay > x) && (mode->VDisplay > y)) {
+		x = mode->HDisplay;
+		y = mode->VDisplay;
+	    }
+	}
+    }
+
+    if (!x || !y) {
+	xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+		   "Unable to estimate virtual size\n");
+	return 0;
+    }
+
+    *vx = x;
+    *vy = y;
+
+    xf86DrvMsg(scrp->scrnIndex, X_INFO,
+	       "Estimated virtual size for aspect ratio %.4f is %dx%d\n",
+	       aspect, *vx, *vy);
+
+    return 1;
+}
+
 /*
  * xf86ValidateModes
  *
@@ -1248,6 +1303,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
     int numTimings = 0;
     range hsync[MAX_HSYNC];
     range vrefresh[MAX_VREFRESH];
+    Bool inferred_virtual = FALSE;
 
 #ifdef DEBUG
     ErrorF("xf86ValidateModes(%p, %p, %p, %p,\n\t\t  %p, %d, %d, %d, %d, %d, %d, %d, %d, 0x%x)\n",
@@ -1440,6 +1496,13 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
 	virtX = virtualX;
 	virtY = virtualY;
 	scrp->virtualFrom = X_CONFIG;
+    } else if (!modeNames || !*modeNames) {
+	/* No virtual size given in the config, try to infer */
+	/* XXX this doesn't take m{in,ax}Pitch into account; oh well */
+	inferred_virtual = inferVirtualSize(scrp, availModes, &virtX, &virtY);
+	if (inferred_virtual)
+	    linePitch = miScanLineWidth(virtX, virtY, minPitch, apertureSize,
+					BankFormat, pitchInc);
     }
 
     /* Print clock ranges and scaled clocks */
@@ -1456,7 +1519,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
 	for (p = availModes; p != NULL; p = p->next) {
 	    status = xf86InitialCheckModeForDriver(scrp, p, clockRanges,
 						   strategy, maxPitch,
-						   virtualX, virtualY);
+						   virtX, virtY);
 
 	    if (status == MODE_OK) {
 		status = xf86CheckModeForMonitor(p, scrp->monitor);
@@ -1733,6 +1796,30 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
 
 #undef _VIRTUALX
 
+    /*
+     * If we estimated the virtual size above, we may have filtered away all
+     * the modes that maximally match that size; scan again to find out and
+     * fix up if so.
+     */
+    if (inferred_virtual) {
+	int vx = 0, vy = 0;
+	for (p = scrp->modes; p; p = p->next) {
+	    if (p->HDisplay > vx && p->VDisplay > vy) {
+		vx = p->HDisplay;
+		vy = p->VDisplay;
+	    }
+	}
+	if (vx < virtX || vy < virtY) {
+	    xf86DrvMsg(scrp->scrnIndex, X_WARNING,
+		       "Shrinking virtual size estimate from %dx%d to %dx%d\n",
+		       virtX, virtY, vx, vy);
+	    virtX = vx;
+	    virtY = vy;
+	    linePitch = miScanLineWidth(vx, vy, linePitch, apertureSize,
+					BankFormat, pitchInc);
+	}
+    }
+
     /* Update the ScrnInfoRec parameters */
     
     scrp->virtualX = virtX;
@@ -1955,6 +2042,8 @@ xf86PrintModes(ScrnInfoPtr scrp)
 	    prefix = "Built-in mode";
 	else if (p->type & M_T_DEFAULT)
 	    prefix = "Default mode";
+	else if (p->type & M_T_DRIVER)
+	    prefix = "Driver mode";
 	else
 	    prefix = "Mode";
 	if (p->type & M_T_USERDEF)
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index 59873fa..a1650bc 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -127,9 +127,8 @@ PrintModeline(int scrnIndex,DisplayModeP
 /*
  * TODO:
  *  - for those with access to the VESA DMT standard; review please.
- *  - swap M_T_DEFAULT for M_T_EDID_...
  */
-#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT
+#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DRIVER
 #define MODESUFFIX   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
 
 DisplayModeRec DDCEstablishedModes[17] = {
@@ -182,6 +181,7 @@ DDCModesFromStandardTiming(int scrnIndex
         if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
             Mode =  xf86CVTMode(timing[i].hsize, timing[i].vsize,
                                 timing[i].refresh, FALSE, FALSE);
+	    Mode->type = M_T_DRIVER;
             Modes = xf86ModesAdd(Modes, Mode);
         }
 
@@ -192,7 +192,8 @@ DDCModesFromStandardTiming(int scrnIndex
  *
  */
 static DisplayModePtr
-DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing)
+DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
+			  int preferred)
 {
     DisplayModePtr Mode;
 
@@ -205,9 +206,8 @@ DDCModeFromDetailedTiming(int scrnIndex,
     
     /* We only do seperate sync currently */
     if (timing->sync != 0x03) {
-         xf86DrvMsg(scrnIndex, X_INFO, "%s: Ignoring: We only handle seperate"
-                    " sync.\n", __func__);
-         return NULL;
+         xf86DrvMsg(scrnIndex, X_INFO, "%s: %dx%d Warning: We only handle seperate"
+                    " sync.\n", __func__, timing->h_active, timing->v_active);
     }
     
     Mode = xnfalloc(sizeof(DisplayModeRec));
@@ -217,7 +217,9 @@ DDCModeFromDetailedTiming(int scrnIndex,
     xf86snprintf(Mode->name, 20, "%dx%d", timing->h_active,
                  timing->v_active);
     
-    Mode->type = M_T_DEFAULT; /* get ourselves a nice type of our own */
+    Mode->type = M_T_DRIVER;
+    if (preferred)
+	Mode->type |= M_T_PREFERRED;
     
     Mode->Clock = timing->clock / 1000.0;
     
@@ -302,12 +304,15 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr 
     DisplayModePtr Modes = NULL, Mode;
     int i, clock;
     Bool have_hsync = FALSE, have_vrefresh = FALSE;
+    int preferred;
     
     if (!Monitor || !DDC)
         return;
 
     Monitor->DDC = DDC;
 
+    preferred = PREFERRED_TIMING_MODE(DDC->features.msc);
+
     Monitor->widthmm = 10 * DDC->features.hsize;
     Monitor->heightmm = 10 * DDC->features.vsize;
     
@@ -367,7 +372,9 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr 
             break;
         case DT:
             Mode = DDCModeFromDetailedTiming(scrnIndex, 
-                                             &DDC->det_mon[i].section.d_timings);
+                                             &DDC->det_mon[i].section.d_timings,
+					     preferred);
+	    preferred = 0;
             Modes = xf86ModesAdd(Modes, Mode);
             break;
         case DS_STD_TIMINGS:
diff-tree 43d9edd31e31b33b9da4a50d8ab05004881c8d5a (from 739224d05eb4f356c9cab9dcb8a44a8d78287765)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 19:09:02 2006 -0400

    Attempt to add the 'mouse' driver in more situations.
    
    Always add a mouse driver instance configured to send core events, unless
    a core pointer already exists using either the mouse or void drivers.  This
    handles the laptop case where the config file only specifies, say,
    synaptics, which causes the touchpad to work but not the pointing stick.
    We don't double-instantiate the mouse driver to avoid the mouse moving twice
    as fast, and we skip this logic when the user asked for a void core pointer
    since that probably means they want to run with no pointer at all.

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index fe55c8c..dbe158e 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -1450,12 +1450,13 @@ checkCoreInputDevices(serverLayoutPtr se
     IDevPtr corePointer = NULL, coreKeyboard = NULL;
     Bool foundPointer = FALSE, foundKeyboard = FALSE;
     const char *pointerMsg = NULL, *keyboardMsg = NULL;
-    IDevPtr indp;
+    IDevPtr indp, i;
     IDevRec Pointer, Keyboard;
     XF86ConfInputPtr confInput;
     XF86ConfInputRec defPtr, defKbd;
     int count = 0;
     MessageType from = X_DEFAULT;
+    int found = 0;
 
     /*
      * First check if a core pointer or core keyboard have been specified
@@ -1607,6 +1608,35 @@ checkCoreInputDevices(serverLayoutPtr se
 	return FALSE;
     }
 
+    /*
+     * always synthesize a 'mouse' section configured to send core
+     * events, unless a 'void' section is found, in which case the user
+     * probably wants to run footless.
+     */
+    for (i = servlayoutp->inputs; i->driver; i++) {
+	if (!strcmp(i->driver, "void") || !strcmp(i->driver, "mouse")) {
+	    found = 1; break;
+	}
+    }
+    if (!found) {
+	xf86Msg(X_INFO, "No default mouse found, adding one\n");
+	bzero(&defPtr, sizeof(defPtr));
+	defPtr.inp_identifier = "<default pointer>";
+	defPtr.inp_driver = "mouse";
+	confInput = &defPtr;
+	foundPointer = configInput(&Pointer, confInput, from);
+        if (foundPointer) {
+	    count++;
+	    indp = xnfrealloc(servlayoutp->inputs,
+			      (count + 1) * sizeof(IDevRec));
+	    indp[count - 1] = Pointer;
+	    indp[count - 1].extraOptions =
+				xf86addNewOption(NULL, "AlwaysCore", NULL);
+	    indp[count].identifier = NULL;
+	    servlayoutp->inputs = indp;
+	}
+    }
+
     confInput = NULL;
 
     /* 1. Check for the -keyboard command line option. */
diff-tree 739224d05eb4f356c9cab9dcb8a44a8d78287765 (from beac2bf1e48e6b77dbf7d95f086abc5abcd90cf0)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 19:03:32 2006 -0400

    Load the default module set when no Module section is given in the config.
    
    Also, synchronize that list with the list for the pseudoconfig file used
    when starting with no config file.  These really need to be better unified.

diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
index 4dcc997..4f6a98a 100644
--- a/hw/xfree86/common/xf86AutoConfig.c
+++ b/hw/xfree86/common/xf86AutoConfig.c
@@ -48,6 +48,9 @@
 	"\tLoad\t\"dbe\"\n" \
 	"\tLoad\t\"glx\"\n" \
 	"\tLoad\t\"freetype\"\n" \
+	"\tLoad\t\"type1\"\n" \
+	"\tLoad\t\"record\"\n" \
+	"\tLoad\t\"dri\"\n" \
 	"EndSection\n\n"
 
 #define BUILTIN_DEVICE_NAME \
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index f89db67..fe55c8c 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -63,7 +63,7 @@
 #include "xf86Config.h"
 #include "xf86Priv.h"
 #include "xf86_OSlib.h"
-
+#include "configProcs.h"
 #include "globals.h"
 #include "extension.h"
 
@@ -280,9 +280,21 @@ xf86ModulelistFromConfig(pointer **optli
 	        count++;
 	    modp = (XF86LoadPtr) modp->list.next;
 	}
+    } else {
+	xf86configptr->conf_modules = xnfcalloc(1, sizeof(XF86ConfModuleRec));
+    }
+
+    if (count == 0) {
+	XF86ConfModulePtr ptr = xf86configptr->conf_modules;
+	ptr = xf86addNewLoadDirective(ptr, "extmod", XF86_LOAD_MODULE, NULL);
+	ptr = xf86addNewLoadDirective(ptr, "dbe", XF86_LOAD_MODULE, NULL);
+	ptr = xf86addNewLoadDirective(ptr, "glx", XF86_LOAD_MODULE, NULL);
+	ptr = xf86addNewLoadDirective(ptr, "freetype", XF86_LOAD_MODULE, NULL);
+	ptr = xf86addNewLoadDirective(ptr, "type1", XF86_LOAD_MODULE, NULL);
+	ptr = xf86addNewLoadDirective(ptr, "record", XF86_LOAD_MODULE, NULL);
+	ptr = xf86addNewLoadDirective(ptr, "dri", XF86_LOAD_MODULE, NULL);
+	count = 7;
     }
-    if (count == 0)
-	return NULL;
 
     /*
      * allocate the memory and walk the list again to fill in the pointers
diff-tree beac2bf1e48e6b77dbf7d95f086abc5abcd90cf0 (from 71a15a7d5721073eccb3a275f353b3aa584c0d68)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 19:01:13 2006 -0400

    Expand the default sync ranges to be large enough for 800x600 at 60.

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index c3b016f..c66a3fb 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -1294,8 +1294,8 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
 		    scrp->monitor->hsync[i].hi = hsync[i].hi;
 		}
 	    } else {
-		scrp->monitor->hsync[0].lo = 28;
-		scrp->monitor->hsync[0].hi = 33;
+		scrp->monitor->hsync[0].lo = 31.5;
+		scrp->monitor->hsync[0].hi = 37.9;
 		scrp->monitor->nHsync = 1;
 	    }
 	    type = "default ";
@@ -1323,8 +1323,8 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
 		    scrp->monitor->vrefresh[i].hi = vrefresh[i].hi;
 		}
 	    } else {
-		scrp->monitor->vrefresh[0].lo = 43;
-		scrp->monitor->vrefresh[0].hi = 72;
+		scrp->monitor->vrefresh[0].lo = 50;
+		scrp->monitor->vrefresh[0].hi = 70;
 		scrp->monitor->nVrefresh = 1;
 	    }
 	    type = "default ";
diff-tree 71a15a7d5721073eccb3a275f353b3aa584c0d68 (from 7939c8dfb7c7bed4febcdc12922fb2e17619ea36)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 19:00:10 2006 -0400

    Publish the raw EDID block as a property on the root window.
    
    This was removed in the patch for bug #5386, but is still useful.

diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index c76afbc..59873fa 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -27,6 +27,10 @@
 
 #include "xf86.h"
 #include "xf86DDC.h"
+#include <X11/Xatom.h>
+#include "property.h"
+#include "propertyst.h"
+#include "xf86DDC.h"
 
 /*
  * xf86Mode.c should have a some more DisplayModePtr list handling.
@@ -407,9 +411,88 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr 
     }
 }
 
-/*
- * Empty shell that keeps most drivers happy.
- */
+#define EDID1_ATOM_NAME         "XFree86_DDC_EDID1_RAWDATA"
+#define EDID2_ATOM_NAME         "XFree86_DDC_EDID2_RAWDATA"
+#define VDIF_ATOM_NAME          "XFree86_DDC_VDIF_RAWDATA"
+
+static void
+addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
+{
+    Atom EDID1Atom=-1, EDID2Atom=-1;
+    CARD8 *EDID1rawdata = NULL;
+    CARD8 *EDID2rawdata = NULL;
+    int i, scrnIndex = pScrn->scrnIndex;
+    Bool makeEDID1prop = FALSE;
+    Bool makeEDID2prop = FALSE;
+
+    if (DDC->ver.version == 1) {
+	makeEDID1prop = TRUE;
+    } else if (DDC->ver.version == 2) {
+	int checksum1;
+	int checksum2;
+	makeEDID2prop = TRUE;
+
+	/* Some monitors (eg Panasonic PanaSync4)
+	 * report version==2 because they used EDID v2 spec document,
+	 * although they use EDID v1 data structure :-(
+	 *
+	 * Try using checksum to determine when we have such a monitor.
+	 */
+	checksum2 = 0;
+	for (i = 0; i < 256; i++)
+	    checksum2 += DDC->rawData[i];
+	if (checksum2 % 256) {
+	    xf86DrvMsg(scrnIndex, X_INFO, "Monitor EDID v2 checksum failed\n");
+	    xf86DrvMsg(scrnIndex, X_INFO,
+		    "XFree86_DDC_EDID2_RAWDATA property may be bad\n");
+	    checksum1 = 0;
+	    for (i = 0; i < 128; i++)
+		checksum1 += DDC->rawData[i];
+	    if (!(checksum1 % 256)) {
+		xf86DrvMsg(scrnIndex, X_INFO,
+			"Monitor EDID v1 checksum passed,\n");
+		xf86DrvMsg(scrnIndex, X_INFO,
+			"XFree86_DDC_EDID1_RAWDATA property created\n");
+		makeEDID1prop = TRUE;
+	    }
+	}
+    } else {
+	xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n",
+		DDC->ver.version, DDC->ver.revision);
+	return;
+    }
+
+    if (makeEDID1prop) {
+	if ((EDID1rawdata = xalloc(128*sizeof(CARD8)))==NULL)
+	    return;
+
+	EDID1Atom = MakeAtom(EDID1_ATOM_NAME, sizeof(EDID1_ATOM_NAME), TRUE);
+	memcpy(EDID1rawdata, DDC->rawData, 128);
+	xf86RegisterRootWindowProperty(scrnIndex, EDID1Atom, XA_INTEGER, 8,
+		128, (unsigned char *)EDID1rawdata);
+    } 
+
+    if (makeEDID2prop) {
+	if ((EDID2rawdata = xalloc(256*sizeof(CARD8)))==NULL)
+	    return;
+
+	memcpy(EDID2rawdata, DDC->rawData, 256);
+	EDID2Atom = MakeAtom(EDID2_ATOM_NAME, sizeof(EDID2_ATOM_NAME), TRUE);
+	xf86RegisterRootWindowProperty(scrnIndex, EDID2Atom, XA_INTEGER, 8,
+		256, (unsigned char *)EDID2rawdata);
+    }
+
+#if 0
+    if (DDC->vdif) {
+#define VDIF_DUMMY_STRING "setting dummy VDIF property - please insert correct values\n"
+
+	VDIFAtom = MakeAtom(VDIF_ATOM_NAME, sizeof(VDIF_ATOM_NAME), TRUE);
+	xf86RegisterRootWindowProperty(scrnIndex, VDIFAtom, XA_STRING, 8,
+		strlen(VDIF_DUMMY_STRING), VDIF_DUMMY_STRING);
+    }
+#endif
+}
+
 Bool
 xf86SetDDCproperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
 {
@@ -418,5 +501,7 @@ xf86SetDDCproperties(ScrnInfoPtr pScrn, 
 
     xf86DDCMonitorSet(pScrn->scrnIndex, pScrn->monitor, DDC);
 
+    addRootWindowProperties(pScrn, DDC);
+
     return TRUE;
 }
diff-tree 7939c8dfb7c7bed4febcdc12922fb2e17619ea36 (from 72af975f9c8de0ff6796f1ce4b76dcf841d21e99)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 18:57:57 2006 -0400

    Bump the default pixel depth to 24, and default bpp to 32.

diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
index c7d3fae..851a345 100644
--- a/hw/xfree86/common/xf86Helper.c
+++ b/hw/xfree86/common/xf86Helper.c
@@ -430,11 +430,11 @@ xf86AddPixFormat(ScrnInfoPtr pScrn, int 
 #define DO_PIX24FOR32(f) ((f & Support32bppFb) && (f & SupportConvert24to32))
 
 #ifndef GLOBAL_DEFAULT_DEPTH
-#define GLOBAL_DEFAULT_DEPTH 16
+#define GLOBAL_DEFAULT_DEPTH 24
 #endif
 
 #ifndef GLOBAL_DEFAULT_FBBPP
-#define GLOBAL_DEFAULT_FBBPP 16
+#define GLOBAL_DEFAULT_FBBPP 32
 #endif
 
 _X_EXPORT Bool
diff-tree 72af975f9c8de0ff6796f1ce4b76dcf841d21e99 (from d05e0a97bb704a4986cf638487205da759c4ce17)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 18:56:34 2006 -0400

    Fix up EDID blocks where the max pixclock exceeds the preferred mode clock.
    
    Base EDID only lets you specify the maximum dotclock in tens of MHz, which
    is too fuzzy for some monitors.  1600x1200 at 60 is just over 160MHz, but if
    the monitor really can't handle any mode at 170MHz, then 160 is more
    correct.  Fix up the EDID block before the driver can see it in this case,
    so we don't spuriously reject modes.

diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index a160554..c58bb2f 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -31,6 +31,41 @@ static void get_whitepoint_section(Uchar
 static void get_detailed_timing_section(Uchar*, struct 	detailed_timings *);
 static Bool validate_version(int scrnIndex, struct edid_version *);
 
+static void
+handle_edid_quirks(xf86MonPtr m)
+{
+    int i, j;
+    struct detailed_timings *preferred_timing;
+    struct monitor_ranges *ranges;
+
+    /*
+     * max_clock is only encoded in EDID in tens of MHz, so occasionally we
+     * find a monitor claiming a max of 160 with a mode requiring 162, or
+     * similar.  Strictly we should refuse to round up too far, but let's
+     * see how well this works.
+     */
+    for (i = 0; i < 4; i++) {
+	if (m->det_mon[i].type == DS_RANGES) {
+	    ranges = &m->det_mon[i].section.ranges;
+	    for (j = 0; j < 4; j++) {
+		if (m->det_mon[j].type == DT) {
+		    preferred_timing = &m->det_mon[j].section.d_timings;
+		    if (!ranges->max_clock) continue; /* zero is legal */
+		    if (ranges->max_clock * 1000000 < preferred_timing->clock) {
+			xf86Msg(X_WARNING,
+			    "EDID preferred timing clock %.2fMHz exceeds "
+			    "claimed max %dMHz, fixing\n",
+			    preferred_timing->clock / 1.0e6,
+			    ranges->max_clock);
+			ranges->max_clock =
+			    (preferred_timing->clock+999999)/1000000;
+			return;
+		    }
+		}
+	    }
+	}
+    }
+}
 
 xf86MonPtr
 xf86InterpretEDID(int scrnIndex, Uchar *block)
@@ -53,7 +88,9 @@ xf86InterpretEDID(int scrnIndex, Uchar *
 			   &m->ver);
     get_dt_md_section(SECTION(DET_TIMING_SECTION,block),&m->ver, m->det_mon);
     m->no_sections = (int)*(char *)SECTION(NO_EDID,block);
-    
+
+    handle_edid_quirks(m);
+
     return (m);
 
  error:
diff-tree d05e0a97bb704a4986cf638487205da759c4ce17 (from 334f7db9f653113d5d46236911d7de2ec4173f28)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 18:49:12 2006 -0400

    Enable DPMS by default.

diff --git a/dix/globals.c b/dix/globals.c
index fc77ca7..f86c602 100644
--- a/dix/globals.c
+++ b/dix/globals.c
@@ -105,7 +105,7 @@ int  ScreenSaverAllowExposures;
 #  define DEFAULT_OFF_TIME DEFAULT_SCREEN_SAVER_TIME * 4
 # endif
 # ifndef DEFAULT_DPMS_ENABLED
-#  define DEFAULT_DPMS_ENABLED FALSE
+#  define DEFAULT_DPMS_ENABLED TRUE
 # endif
 CARD32 defaultDPMSStandbyTime = DEFAULT_STANDBY_TIME;
 CARD32 defaultDPMSSuspendTime = DEFAULT_SUSPEND_TIME;
diff-tree 334f7db9f653113d5d46236911d7de2ec4173f28 (from ced46e17777b635df9371c4cfaec3f8968b4dbcf)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 18:46:10 2006 -0400

    Allow hsync and vsync ranges to be overridden independently again.

diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index 7f078ec..c76afbc 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -297,6 +297,7 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr 
 {
     DisplayModePtr Modes = NULL, Mode;
     int i, clock;
+    Bool have_hsync = FALSE, have_vrefresh = FALSE;
     
     if (!Monitor || !DDC)
         return;
@@ -319,25 +320,41 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr 
     Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2);
     Modes = xf86ModesAdd(Modes, Mode);
 
+    /* Skip EDID ranges if they were specified in the config file */
+    have_hsync = (Monitor->nHsync != 0);
+    have_vrefresh = (Monitor->nVrefresh != 0);
+
     /* Go through the detailed monitor sections */
     for (i = 0; i < DET_TIMINGS; i++)
         switch (DDC->det_mon[i].type) {
         case DS_RANGES:
-            if (Monitor->nHsync && Monitor->nVrefresh) {
-                xf86DrvMsg(scrnIndex, X_INFO, "Ignoring EDID Ranges. Using"
-                           " configured ranges.\n");
-                break;
-            }
-
-            xf86DrvMsg(scrnIndex, X_INFO, "Using EDID ranges info for Monitor"
-                       " timing.\n");
-            Monitor->nHsync = 1;
-            Monitor->hsync[0].lo = DDC->det_mon[i].section.ranges.min_h;
-            Monitor->hsync[0].hi = DDC->det_mon[i].section.ranges.max_h;
-            
-            Monitor->nVrefresh = 1;
-            Monitor->vrefresh[0].lo = DDC->det_mon[i].section.ranges.min_v;
-            Monitor->vrefresh[0].hi = DDC->det_mon[i].section.ranges.max_v;
+	    if (!have_hsync) {
+		if (!Monitor->nHsync)
+		    xf86DrvMsg(scrnIndex, X_INFO,
+			    "Using EDID range info for horizontal sync\n");
+		Monitor->hsync[Monitor->nHsync].lo =
+		    DDC->det_mon[i].section.ranges.min_h;
+		Monitor->hsync[Monitor->nHsync].hi =
+		    DDC->det_mon[i].section.ranges.max_h;
+		Monitor->nHsync++;
+	    } else {
+		xf86DrvMsg(scrnIndex, X_INFO,
+			"Using hsync ranges from config file\n");
+	    }
+
+	    if (!have_vrefresh) {
+		if (!Monitor->nVrefresh)
+		    xf86DrvMsg(scrnIndex, X_INFO,
+			    "Using EDID range info for vertical refresh\n");
+		Monitor->vrefresh[Monitor->nVrefresh].lo =
+		    DDC->det_mon[i].section.ranges.min_v;
+		Monitor->vrefresh[Monitor->nVrefresh].hi =
+		    DDC->det_mon[i].section.ranges.max_v;
+		Monitor->nVrefresh++;
+	    } else {
+		xf86DrvMsg(scrnIndex, X_INFO,
+			"Using vrefresh ranges from config file\n");
+	    }
 
 	    clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
 	    if (clock > Monitor->maxPixClock)
diff-tree ced46e17777b635df9371c4cfaec3f8968b4dbcf (from d89fee68d0e49211871cd9eb3893ed55c1d478a6)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 18:41:59 2006 -0400

    Record all standard timings from EDID as modes, instead of just the first five.

diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index ba8aaf8..7f078ec 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -174,7 +174,7 @@ DDCModesFromStandardTiming(int scrnIndex
     DisplayModePtr Modes = NULL, Mode = NULL;
     int i;
     
-    for (i = 0; i < 5; i++)
+    for (i = 0; i < STD_TIMINGS; i++)
         if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
             Mode =  xf86CVTMode(timing[i].hsize, timing[i].vsize,
                                 timing[i].refresh, FALSE, FALSE);
diff-tree d89fee68d0e49211871cd9eb3893ed55c1d478a6 (from fa8ef7166839a7435e0017683f3e3c7f7904b285)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 18:41:15 2006 -0400

    Record the maximum dot clock of the monitor, and filter by it.

diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 87b8a0b..f89db67 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -2201,6 +2201,7 @@ configMonitor(MonPtr monitorp, XF86ConfM
     monitorp->widthmm = conf_monitor->mon_width;
     monitorp->heightmm = conf_monitor->mon_height;
     monitorp->reducedblanking = FALSE;
+    monitorp->maxPixClock = 0;
     monitorp->options = conf_monitor->mon_option_lst;
 
     /*
diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index ff04583..c3b016f 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -824,6 +824,9 @@ xf86CheckModeForMonitor(DisplayModePtr m
         }
     }
 
+    if ((monitor->maxPixClock) && (mode->Clock > monitor->maxPixClock))
+	return MODE_CLOCK_HIGH;
+
     return MODE_OK;
 }
 
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index ae9d9ae..6e62e52 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -213,6 +213,7 @@ typedef struct {
     pointer		options;
     pointer		DDC;
     Bool                reducedblanking; /* Allow CVT reduced blanking modes? */
+    int			maxPixClock;	 /* in kHz, like mode->Clock */
 } MonRec, *MonPtr;
 
 /* the list of clock ranges */
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index a4f4f4e..ba8aaf8 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -296,7 +296,7 @@ void
 xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
 {
     DisplayModePtr Modes = NULL, Mode;
-    int i;
+    int i, clock;
     
     if (!Monitor || !DDC)
         return;
@@ -339,6 +339,10 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr 
             Monitor->vrefresh[0].lo = DDC->det_mon[i].section.ranges.min_v;
             Monitor->vrefresh[0].hi = DDC->det_mon[i].section.ranges.max_v;
 
+	    clock = DDC->det_mon[i].section.ranges.max_clock * 1000;
+	    if (clock > Monitor->maxPixClock)
+		Monitor->maxPixClock = clock;
+
             break;
         case DT:
             Mode = DDCModeFromDetailedTiming(scrnIndex, 
diff-tree fa8ef7166839a7435e0017683f3e3c7f7904b285 (from 511c60bc7399b07c267d686a969880e5ec92408a)
Author: Adam Jackson <ajax at benzedrine.nwnk.net>
Date:   Thu Sep 14 18:33:00 2006 -0400

    Don't translate monitor gamma to X gamma.
    
    The X gamma is used to set the output ramp of the card.  Setting a 2.2 output
    gamma going into a 2.2 monitor gives an effective gamma of 4.84, which is
    very much not what you want.

diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index ed7fb16..a4f4f4e 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -303,12 +303,6 @@ xf86DDCMonitorSet(int scrnIndex, MonPtr 
 
     Monitor->DDC = DDC;
 
-    if (DDC->features.gamma > 0.0) {
-        Monitor->gamma.red = DDC->features.gamma;
-        Monitor->gamma.green = DDC->features.gamma;
-        Monitor->gamma.blue = DDC->features.gamma;
-    }
-
     Monitor->widthmm = 10 * DDC->features.hsize;
     Monitor->heightmm = 10 * DDC->features.vsize;
     
diff-tree 511c60bc7399b07c267d686a969880e5ec92408a (from 05231e336db8f959c15dda518641976f061df1a6)
Author: Luc Verhaegen <libv at skynet.be>
Date:   Thu Sep 14 18:30:36 2006 -0400

    Bug #5386: Synthesize modelines from EDID data.

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index cd57e99..ff04583 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -45,7 +45,6 @@
 #include "globals.h"
 #include "xf86.h"
 #include "xf86Priv.h"
-#include "xf86DDC.h"
 
 static void
 printModeRejectMessage(int index, DisplayModePtr p, int status)
@@ -766,31 +765,6 @@ xf86CheckModeForMonitor(DisplayModePtr m
 	   mode, mode->name, monitor, monitor->id);
 #endif
 
-    if (monitor->DDC) {
-	xf86MonPtr DDC = (xf86MonPtr)(monitor->DDC);
-	struct detailed_monitor_section* detMon;
-	struct monitor_ranges *mon_range;
-	int i;
-
-	mon_range = NULL;
-	for (i = 0; i < 4; i++) {
-	    detMon = &DDC->det_mon[i];
-	    if(detMon->type == DS_RANGES) {
-		mon_range = &detMon->section.ranges;
-	    }
-	}
-	if (mon_range) {
-	    /* mode->Clock in kHz, DDC in MHz */
-	    if (mon_range->max_clock < 2550 &&
-		 mode->Clock / 1000.0 > mon_range->max_clock) {
-		xf86Msg(X_WARNING,
-		   "(%s,%s) mode clock %gMHz exceeds DDC maximum %dMHz\n",
-		   mode->name, monitor->id,
-		   mode->Clock/1000.0, mon_range->max_clock);
-	    }
-	}
-    }
-
     /* Some basic mode validity checks */
     if (0 >= mode->HDisplay || mode->HDisplay > mode->HSyncStart ||
 	mode->HSyncStart >= mode->HSyncEnd || mode->HSyncEnd >= mode->HTotal)
@@ -1267,7 +1241,6 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
     PixmapFormatRec *BankFormat;
     ClockRangePtr cp;
     ClockRangesPtr storeClockRanges;
-    struct monitor_ranges *mon_range = NULL;
     double targetRefresh = 0.0;
     int numTimings = 0;
     range hsync[MAX_HSYNC];
@@ -1302,166 +1275,6 @@ xf86ValidateModes(ScrnInfoPtr scrp, Disp
     }
 
     /*
-     * Probe monitor so that we can enforce/warn about its limits.
-     * If one or more DS_RANGES descriptions are present, use the parameters
-     * that they provide.  Otherwise, deduce limits based on the modes that
-     * are shown as supported via standard and detailed timings.
-     *
-     * XXX The full potential of the DDC/EDID data still isn't being tapped.
-     */
-    if (scrp->monitor->DDC) {
-	MonPtr monitor = scrp->monitor;
-	xf86MonPtr DDC = (xf86MonPtr)(scrp->monitor->DDC);
-	int i, j;
-	float hmin = 1e6, hmax = 0.0, vmin = 1e6, vmax = 0.0;
-	float h;
-	struct std_timings *t;
-	struct detailed_timings *dt;
-
-	numTimings = 0;
-	for (i = 0; i < DET_TIMINGS; i++) {
-	    switch (DDC->det_mon[i].type) {
-	    case DS_RANGES:
-		mon_range = &DDC->det_mon[i].section.ranges;
-		hsync[numTimings].lo = mon_range->min_h;
-		hsync[numTimings].hi = mon_range->max_h;
-		vrefresh[numTimings].lo = mon_range->min_v;
-		vrefresh[numTimings].hi = mon_range->max_v;
-		numTimings++;
-		break;
-
-	    case DS_STD_TIMINGS:
-		t = DDC->det_mon[i].section.std_t;
-		for (j = 0; j < 5; j++) {
-		    if (t[j].hsize > 256) { /* sanity check */
-			if (t[j].refresh < vmin)
-			    vmin = t[i].refresh;
-			if (t[j].refresh > vmax)
-			    vmax = t[i].refresh;
-			/*
-			 * For typical modes this is a reasonable estimate
-			 * of the horizontal sync rate.
-			 */
-			h = t[j].refresh * 1.07 * t[j].vsize / 1000.0;
-			if (h < hmin)
-			    hmin = h;
-			if (h > hmax)
-			    hmax = h;
-		    }
-		}
-		break;
-
-	    case DT:
-		dt = &DDC->det_mon[i].section.d_timings;
-		if (dt->clock > 15000000) { /* sanity check */
-		    float v;
-		    h = (float)dt->clock / (dt->h_active + dt->h_blanking);
-		    v = h / (dt->v_active + dt->v_blanking);
-		    h /= 1000.0;
-		    if (dt->interlaced) 
-			v /= 2.0;
-
-		    if (v < vmin)
-			vmin = v;
-		    if (v > vmax)
-			vmax = v;
-		    if (h < hmin)
-			hmin = h;
-		    if (h > hmax)
-			hmax = h;
-		}
-		break;
-	    }
-
-	    if (numTimings > MAX_HSYNC)
-		break;
-	}
-
-	if (numTimings == 0) {
-	    t = DDC->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;
-		    /*
-		     * For typical modes this is a reasonable estimate
-		     * of the horizontal sync rate.
-		     */
-		    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) {
-		hsync[numTimings].lo = hmin;
-		hsync[numTimings].hi = hmax;
-		vrefresh[numTimings].lo = vmin;
-		vrefresh[numTimings].hi = vmax;
-		numTimings++;
-	    }
-	}
-
-	if (numTimings > 0) {
-
-#ifdef DEBUG
-	    for (i = 0; i < numTimings; i++) {
-		ErrorF("DDC - Hsync %.1f-%.1f kHz - Vrefresh %.1f-%.1f Hz\n",
-		       hsync[i].lo, hsync[i].hi,
-		       vrefresh[i].lo, vrefresh[i].hi);
-	    }
-#endif
-
-#define DDC_SYNC_TOLERANCE SYNC_TOLERANCE
-	    if (monitor->nHsync > 0) {
-		for (i = 0; i < monitor->nHsync; i++) {
-		    Bool good = FALSE;
-		    for (j = 0; j < numTimings; j++) {
-			if ((1.0 - DDC_SYNC_TOLERANCE) * hsync[j].lo <=
-				monitor->hsync[i].lo &&
-			    (1.0 + DDC_SYNC_TOLERANCE) * hsync[j].hi >=
-				monitor->hsync[i].hi) {
-			    good = TRUE;
-			    break;
-			}
-		    }
-		    if (!good) {
-			xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-			  "config file hsync range %g-%gkHz not within DDC "
-			  "hsync ranges.\n",
-			  monitor->hsync[i].lo, monitor->hsync[i].hi);
-		    }
-		}
-	    }
-
-	    if (monitor->nVrefresh > 0) {
-		for (i = 0; i < monitor->nVrefresh; i++) {
-		    Bool good = FALSE;
-		    for (j = 0; j < numTimings; j++) {
-			if ((1.0 - DDC_SYNC_TOLERANCE) * vrefresh[j].lo <=
-				monitor->vrefresh[0].lo &&
-			    (1.0 + DDC_SYNC_TOLERANCE) * vrefresh[j].hi >=
-				monitor->vrefresh[0].hi) {
-			    good = TRUE;
-			    break;
-			}
-		    }
-		    if (!good) {
-			xf86DrvMsg(scrp->scrnIndex, X_WARNING,
-			  "config file vrefresh range %g-%gHz not within DDC "
-			  "vrefresh ranges.\n",
-			  monitor->vrefresh[i].lo, monitor->vrefresh[i].hi);
-		    }
-		}
-	    }
-        }
-    }
-
-    /*
      * If requested by the driver, allow missing hsync and/or vrefresh ranges
      * in the monitor section.
      */
diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c
index 22deca6..ed7fb16 100644
--- a/hw/xfree86/ddc/ddcProperty.c
+++ b/hw/xfree86/ddc/ddcProperty.c
@@ -1,159 +1,407 @@
-/* ddcProperty.c: Make the DDC monitor information available to clients
- * as properties on the root window
- * 
- * Copyright 1999 by Andrew C Aitchison <A.C.Aitchison at dpmms.cam.ac.uk>
+/*
+ * Copyright 2006 Luc Verhaegen.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sub license,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
  */
 
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
 #endif
 
-#include <string.h>
-#include "misc.h"
 #include "xf86.h"
-/* #include "xf86_OSproc.h" */
-#include <X11/Xatom.h>
-#include "property.h"
-#include "propertyst.h"
 #include "xf86DDC.h"
 
-#define EDID1_ATOM_NAME         "XFree86_DDC_EDID1_RAWDATA"
-#define EDID2_ATOM_NAME         "XFree86_DDC_EDID2_RAWDATA"
-#define VDIF_ATOM_NAME          "XFree86_DDC_VDIF_RAWDATA"
+/*
+ * xf86Mode.c should have a some more DisplayModePtr list handling.
+ */
+static DisplayModePtr
+xf86ModesAdd(DisplayModePtr Modes, DisplayModePtr Additions)
+{
+    if (!Modes) {
+        if (Additions)
+            return Additions;
+        else
+            return NULL;
+    }
 
-Bool
-xf86SetDDCproperties(ScrnInfoPtr pScrnInfo, xf86MonPtr DDC)
+    if (Additions) {
+        DisplayModePtr Mode = Modes;
+
+        while (Mode->next)
+            Mode = Mode->next;
+        
+        Mode->next = Additions;
+        Additions->prev = Mode;
+    }
+
+    return Modes;
+}
+
+static DisplayModePtr
+xf86ModeCopy(DisplayModePtr Mode)
 {
-    Atom EDID1Atom=-1, EDID2Atom=-1, VDIFAtom=-1;
-    CARD8 *EDID1rawdata = NULL;
-    CARD8 *EDID2rawdata = NULL;
-    int  i, ret;
-    Bool  makeEDID1prop = FALSE;
-    Bool  makeEDID2prop = FALSE;
+    DisplayModePtr New;
+
+    if (!Mode)
+        return NULL;
+
+    New = xnfalloc(sizeof(DisplayModeRec));
+
+    memcpy(New, Mode, sizeof(DisplayModeRec));
+    
+    New->name = xnfalloc(strlen(Mode->name) + 1);
+    memcpy(New->name, Mode->name, strlen(Mode->name) + 1);
 
-#ifdef DEBUG
-    ErrorF("xf86SetDDCproperties(%p, %p)\n", pScrnInfo, DDC);
+    /* We ignore privates as DDC code doesn't use it currently */
+    return New;
+}
+
+/*
+ * Temporary.
+ */
+static void
+add(char **p, char *new)
+{
+    *p = xnfrealloc(*p, strlen(*p) + strlen(new) + 2);
+    strcat(*p, " ");
+    strcat(*p, new);
+}
+
+static void
+PrintModeline(int scrnIndex,DisplayModePtr mode)
+{
+    char tmp[256];
+    char *flags = xnfcalloc(1, 1);
+
+    if (mode->HSkew) { 
+	snprintf(tmp, 256, "hskew %i", mode->HSkew); 
+	add(&flags, tmp);
+    }
+    if (mode->VScan) { 
+	snprintf(tmp, 256, "vscan %i", mode->VScan); 
+	add(&flags, tmp);
+    }
+    if (mode->Flags & V_INTERLACE) add(&flags, "interlace");
+    if (mode->Flags & V_CSYNC) add(&flags, "composite");
+    if (mode->Flags & V_DBLSCAN) add(&flags, "doublescan");
+    if (mode->Flags & V_BCAST) add(&flags, "bcast");
+    if (mode->Flags & V_PHSYNC) add(&flags, "+hsync");
+    if (mode->Flags & V_NHSYNC) add(&flags, "-hsync");
+    if (mode->Flags & V_PVSYNC) add(&flags, "+vsync");
+    if (mode->Flags & V_NVSYNC) add(&flags, "-vsync");
+    if (mode->Flags & V_PCSYNC) add(&flags, "+csync");
+    if (mode->Flags & V_NCSYNC) add(&flags, "-csync");
+#if 0
+    if (mode->Flags & V_CLKDIV2) add(&flags, "vclk/2");
 #endif
+    xf86DrvMsgVerb(scrnIndex, X_INFO, 3,
+		   "Modeline \"%s\"  %6.2f  %i %i %i %i  %i %i %i %i%s\n",
+		   mode->name, mode->Clock/1000., mode->HDisplay,
+		   mode->HSyncStart, mode->HSyncEnd, mode->HTotal,
+		   mode->VDisplay, mode->VSyncStart, mode->VSyncEnd,
+		   mode->VTotal, flags);
+    xfree(flags);
+}
 
-    if (pScrnInfo==NULL || pScrnInfo->monitor==NULL || DDC==NULL) {
-      return FALSE;
+/*
+ * TODO:
+ *  - for those with access to the VESA DMT standard; review please.
+ *  - swap M_T_DEFAULT for M_T_EDID_...
+ */
+#define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT
+#define MODESUFFIX   0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
+
+DisplayModeRec DDCEstablishedModes[17] = {
+    { MODEPREFIX("800x600"),    40000,  800,  840,  968, 1056, 0,  600,  601,  605,  628, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600 at 60Hz */
+    { MODEPREFIX("800x600"),    36000,  800,  824,  896, 1024, 0,  600,  601,  603,  625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600 at 56Hz */
+    { MODEPREFIX("640x480"),    31500,  640,  656,  720,  840, 0,  480,  481,  484,  500, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480 at 75Hz */
+    { MODEPREFIX("640x480"),    31500,  640,  664,  704,  832, 0,  480,  489,  491,  520, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480 at 72Hz */
+    { MODEPREFIX("640x480"),    30240,  640,  704,  768,  864, 0,  480,  483,  486,  525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480 at 67Hz */
+    { MODEPREFIX("640x480"),    25200,  640,  656,  752,  800, 0,  480,  490,  492,  525, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 640x480 at 60Hz */
+    { MODEPREFIX("720x400"),    35500,  720,  738,  846,  900, 0,  400,  421,  423,  449, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 720x400 at 88Hz */
+    { MODEPREFIX("720x400"),    28320,  720,  738,  846,  900, 0,  400,  412,  414,  449, 0, V_NHSYNC | V_PVSYNC, MODESUFFIX }, /* 720x400 at 70Hz */
+    { MODEPREFIX("1280x1024"), 135000, 1280, 1296, 1440, 1688, 0, 1024, 1025, 1028, 1066, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1280x1024 at 75Hz */
+    { MODEPREFIX("1024x768"),   78800, 1024, 1040, 1136, 1312, 0,  768,  769,  772,  800, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1024x768 at 75Hz */
+    { MODEPREFIX("1024x768"),   75000, 1024, 1048, 1184, 1328, 0,  768,  771,  777,  806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768 at 70Hz */
+    { MODEPREFIX("1024x768"),   65000, 1024, 1048, 1184, 1344, 0,  768,  771,  777,  806, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 1024x768 at 60Hz */
+    { MODEPREFIX("1024x768"),   44900, 1024, 1032, 1208, 1264, 0,  768,  768,  776,  817, 0, V_PHSYNC | V_PVSYNC | V_INTERLACE, MODESUFFIX }, /* 1024x768 at 43Hz */
+    { MODEPREFIX("832x624"),    57284,  832,  864,  928, 1152, 0,  624,  625,  628,  667, 0, V_NHSYNC | V_NVSYNC, MODESUFFIX }, /* 832x624 at 75Hz */
+    { MODEPREFIX("800x600"),    49500,  800,  816,  896, 1056, 0,  600,  601,  604,  625, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600 at 75Hz */
+    { MODEPREFIX("800x600"),    50000,  800,  856,  976, 1040, 0,  600,  637,  643,  666, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 800x600 at 72Hz */
+    { MODEPREFIX("1152x864"),  108000, 1152, 1216, 1344, 1600, 0,  864,  865,  868,  900, 0, V_PHSYNC | V_PVSYNC, MODESUFFIX }, /* 1152x864 at 75Hz */
+};
+
+static DisplayModePtr
+DDCModesFromEstablished(int scrnIndex, struct established_timings *timing)
+{
+    DisplayModePtr Modes = NULL, Mode = NULL;
+    CARD32 bits = (timing->t1) | (timing->t2 << 8) |
+        ((timing->t_manu & 0x80) << 9);
+    int i;
+
+    for (i = 0; i < 17; i++)
+        if (bits & (0x01 << i)) {
+            Mode = xf86ModeCopy(&(DDCEstablishedModes[i]));
+            Modes = xf86ModesAdd(Modes, Mode);
+        }
+
+    return Modes;
+}
+
+/*
+ *
+ */
+static DisplayModePtr
+DDCModesFromStandardTiming(int scrnIndex, struct std_timings *timing)
+{
+    DisplayModePtr Modes = NULL, Mode = NULL;
+    int i;
+    
+    for (i = 0; i < 5; i++)
+        if (timing[i].hsize && timing[i].vsize && timing[i].refresh) {
+            Mode =  xf86CVTMode(timing[i].hsize, timing[i].vsize,
+                                timing[i].refresh, FALSE, FALSE);
+            Modes = xf86ModesAdd(Modes, Mode);
+        }
+
+    return Modes;
+}
+
+/*
+ *
+ */
+static DisplayModePtr
+DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing)
+{
+    DisplayModePtr Mode;
+
+    /* We don't do stereo */
+    if (timing->stereo) {
+        xf86DrvMsg(scrnIndex, X_INFO, "%s: Ignoring: We don't handle stereo.\n",
+                   __func__);
+        return NULL;
+    }
+    
+    /* We only do seperate sync currently */
+    if (timing->sync != 0x03) {
+         xf86DrvMsg(scrnIndex, X_INFO, "%s: Ignoring: We only handle seperate"
+                    " sync.\n", __func__);
+         return NULL;
     }
+    
+    Mode = xnfalloc(sizeof(DisplayModeRec));
+    memset(Mode, 0, sizeof(DisplayModeRec));
+    
+    Mode->name = xnfalloc(10); /* "1234x1234" */
+    xf86snprintf(Mode->name, 20, "%dx%d", timing->h_active,
+                 timing->v_active);
+    
+    Mode->type = M_T_DEFAULT; /* get ourselves a nice type of our own */
+    
+    Mode->Clock = timing->clock / 1000.0;
+    
+    Mode->HDisplay = timing->h_active;
+    Mode->HSyncStart = timing->h_active + timing->h_sync_off;
+    Mode->HSyncEnd = Mode->HSyncStart + timing->h_sync_width;
+    Mode->HTotal = timing->h_active + timing->h_blanking;
+    
+    Mode->VDisplay = timing->v_active;
+    Mode->VSyncStart = timing->v_active + timing->v_sync_off;
+    Mode->VSyncEnd = Mode->VSyncStart + timing->v_sync_width;
+    Mode->VTotal = timing->v_active + timing->v_blanking;
+    
+    /* We ignore h/v_size and h/v_border for now. */
+    
+    if (timing->interlaced)
+        Mode->Flags |= V_INTERLACE;
+    
+    if (timing->misc & 0x02)
+        Mode->Flags |= V_PHSYNC;
+    else
+        Mode->Flags |= V_NHSYNC;
+    
+    if (timing->misc & 0x01)
+        Mode->Flags |= V_PVSYNC;
+    else
+        Mode->Flags |= V_NVSYNC;
+ 
+    return Mode;
+}
 
-#ifdef DEBUG
-    ErrorF("pScrnInfo->scrnIndex %d\n", pScrnInfo->scrnIndex);
+/*
+ *
+ */
+static void
+DDCGuessRangesFromModes(int scrnIndex, MonPtr Monitor, DisplayModePtr Modes)
+{
+    DisplayModePtr Mode = Modes;
 
-    ErrorF("pScrnInfo->monitor was %p\n", pScrnInfo->monitor);
-#endif
+    if (!Monitor || !Modes)
+        return;
 
-    pScrnInfo->monitor->DDC = DDC;
+    /* set up the ranges for scanning through the modes */
+    Monitor->nHsync = 1;
+    Monitor->hsync[0].lo = 1024.0;
+    Monitor->hsync[0].hi = 0.0;
 
-    if (DDC->ver.version == 1) {
-      makeEDID1prop = TRUE;
-    } else if (DDC->ver.version == 2) {
-      int checksum1;
-      int checksum2;
-      makeEDID2prop = TRUE;
-
-      /* Some monitors (eg Panasonic PanaSync4)
-       * report version==2 because they used EDID v2 spec document,
-       * although they use EDID v1 data structure :-(
-       *
-       * Try using checksum to determine when we have such a monitor.
-       */
-      checksum2 = 0;
-      for (i=0; i<256; i++) { checksum2 += DDC->rawData[i]; }
-      if ( (checksum2 % 256) != 0 ) {
-	xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v2 checksum failed\n");
-	xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID2_RAWDATA property may be bad\n");
-	checksum1 = 0;
-	for (i=0; i<128; i++) { checksum1 += DDC->rawData[i]; }
-	if ( (checksum1 % 256) == 0 ) {
-	  xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v1 checksum passed,\n");
-	  xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID1_RAWDATA property created\n");
-	  makeEDID1prop = TRUE;
-	}
-      }
-    } else {
-     xf86DrvMsg(pScrnInfo->scrnIndex, X_PROBED,
-		"unexpected EDID version %d revision %d\n",
-		DDC->ver.version, DDC->ver.revision );      
-    }
-
-    if (makeEDID1prop) {
-      if ( (EDID1rawdata = xalloc(128*sizeof(CARD8)))==NULL ) {
-	return FALSE;
-      }
-
-      EDID1Atom = MakeAtom(EDID1_ATOM_NAME, sizeof(EDID1_ATOM_NAME), TRUE);
-
-
-      for (i=0; i<128; i++) {
-	EDID1rawdata[i] = DDC->rawData[i];
-      }
-
-#ifdef DEBUG
-      ErrorF("xf86RegisterRootWindowProperty %p(%d,%d,%d,%d,%d,%p)\n",
-	     xf86RegisterRootWindowProperty,
-	     pScrnInfo->scrnIndex,
-	     EDID1Atom, XA_INTEGER, 8,
-	     128, (unsigned char *)EDID1rawdata  );
-#endif
+    Monitor->nVrefresh = 1;
+    Monitor->vrefresh[0].lo = 1024.0;
+    Monitor->vrefresh[0].hi = 0.0;
 
-      ret = xf86RegisterRootWindowProperty(pScrnInfo->scrnIndex,
-					   EDID1Atom, XA_INTEGER, 8, 
-					   128, (unsigned char *)EDID1rawdata
-					   );
-      if (ret != Success)
-      ErrorF("xf86RegisterRootWindowProperty returns %d\n", ret );
-    } 
-
-    if (makeEDID2prop) {
-      if ( (EDID2rawdata = xalloc(256*sizeof(CARD8)))==NULL ) {
-	return FALSE;
-      }
-      for (i=0; i<256; i++) {
-	EDID2rawdata[i] = DDC->rawData[i];
-      }
-
-      EDID2Atom = MakeAtom(EDID2_ATOM_NAME, sizeof(EDID2_ATOM_NAME), TRUE);
-
-#ifdef DEBUG
-      ErrorF("xf86RegisterRootWindowProperty %p(%d,%d,%d,%d,%d,%p)\n",
-	     xf86RegisterRootWindowProperty,
-	     pScrnInfo->scrnIndex,
-	     EDID2Atom, XA_INTEGER, 8,
-	     256, (unsigned char *)EDID2rawdata  );
-#endif
-      ret = xf86RegisterRootWindowProperty(pScrnInfo->scrnIndex,
-					   EDID2Atom, XA_INTEGER, 8, 
-					   256, (unsigned char *)EDID2rawdata
-					   );
-      if (ret != Success)
-      ErrorF("xf86RegisterRootWindowProperty returns %d\n", ret );
-    }
-
-    if (DDC->vdif) {
-#define VDIF_DUMMY_STRING "setting dummy VDIF property - please insert correct values\n"
-#ifdef DEBUG
-      ErrorF("xf86RegisterRootWindowProperty %p(%d,%d,%d,%d,%d,%p)\n",
-	     xf86RegisterRootWindowProperty,
-	     pScrnInfo->scrnIndex,
-	     VDIFAtom, XA_STRING, 8,
-	     strlen(VDIF_DUMMY_STRING), VDIF_DUMMY_STRING 
-	     );
-#endif
+    while (Mode) {
+        if (!Mode->HSync)
+            Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal);
 
+        if (!Mode->VRefresh)
+            Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) / 
+                ((float) (Mode->HTotal * Mode->VTotal));
 
-      VDIFAtom = MakeAtom(VDIF_ATOM_NAME, sizeof(VDIF_ATOM_NAME), TRUE);
+        if (Mode->HSync < Monitor->hsync[0].lo)
+            Monitor->hsync[0].lo = Mode->HSync;
 
-      ret = xf86RegisterRootWindowProperty(pScrnInfo->scrnIndex,
-					   VDIFAtom, XA_STRING, 8, 
-					   strlen(VDIF_DUMMY_STRING),
-					   VDIF_DUMMY_STRING 
-					   );
-      if (ret != Success)
-      ErrorF("xf86RegisterRootWindowProperty returns %d\n", ret );
+        if (Mode->HSync > Monitor->hsync[0].hi)
+            Monitor->hsync[0].hi = Mode->HSync;
+
+        if (Mode->VRefresh < Monitor->vrefresh[0].lo)
+            Monitor->vrefresh[0].lo = Mode->VRefresh;
+
+        if (Mode->VRefresh > Monitor->vrefresh[0].hi)
+            Monitor->vrefresh[0].hi = Mode->VRefresh;
+        
+        Mode = Mode->next;
+    }
+}
+
+/*
+ * Fill out MonPtr with xf86MonPtr information.
+ */
+void
+xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC)
+{
+    DisplayModePtr Modes = NULL, Mode;
+    int i;
+    
+    if (!Monitor || !DDC)
+        return;
+
+    Monitor->DDC = DDC;
+
+    if (DDC->features.gamma > 0.0) {
+        Monitor->gamma.red = DDC->features.gamma;
+        Monitor->gamma.green = DDC->features.gamma;
+        Monitor->gamma.blue = DDC->features.gamma;
     }
 
+    Monitor->widthmm = 10 * DDC->features.hsize;
+    Monitor->heightmm = 10 * DDC->features.vsize;
+    
+    /* If this is a digital display, then we can use reduced blanking */
+    if (DDC->features.input_type) 
+        Monitor->reducedblanking = TRUE;
+    /* Allow the user to also enable this through config */
+
+    /* Add established timings */
+    Mode = DDCModesFromEstablished(scrnIndex, &DDC->timings1);
+    Modes = xf86ModesAdd(Modes, Mode);
+
+    /* Add standard timings */
+    Mode = DDCModesFromStandardTiming(scrnIndex, DDC->timings2);
+    Modes = xf86ModesAdd(Modes, Mode);
+
+    /* Go through the detailed monitor sections */
+    for (i = 0; i < DET_TIMINGS; i++)
+        switch (DDC->det_mon[i].type) {
+        case DS_RANGES:
+            if (Monitor->nHsync && Monitor->nVrefresh) {
+                xf86DrvMsg(scrnIndex, X_INFO, "Ignoring EDID Ranges. Using"
+                           " configured ranges.\n");
+                break;
+            }
+
+            xf86DrvMsg(scrnIndex, X_INFO, "Using EDID ranges info for Monitor"
+                       " timing.\n");
+            Monitor->nHsync = 1;
+            Monitor->hsync[0].lo = DDC->det_mon[i].section.ranges.min_h;
+            Monitor->hsync[0].hi = DDC->det_mon[i].section.ranges.max_h;
+            
+            Monitor->nVrefresh = 1;
+            Monitor->vrefresh[0].lo = DDC->det_mon[i].section.ranges.min_v;
+            Monitor->vrefresh[0].hi = DDC->det_mon[i].section.ranges.max_v;
+
+            break;
+        case DT:
+            Mode = DDCModeFromDetailedTiming(scrnIndex, 
+                                             &DDC->det_mon[i].section.d_timings);
+            Modes = xf86ModesAdd(Modes, Mode);
+            break;
+        case DS_STD_TIMINGS:
+            Mode = DDCModesFromStandardTiming(scrnIndex,
+                                             DDC->det_mon[i].section.std_t);
+            Modes = xf86ModesAdd(Modes, Mode);
+            break;
+        default:
+            break;
+        }
+
+    if (Modes) {
+        /* Print Modes */
+        xf86DrvMsg(scrnIndex, X_INFO, "Printing DDC gathered Modelines:\n");
+
+        Mode = Modes;
+        while (Mode) {
+            PrintModeline(scrnIndex, Mode);
+            Mode = Mode->next;
+        }
+
+        /* Do we still need ranges to be filled in? */
+        if (!Monitor->nHsync || !Monitor->nVrefresh)
+            DDCGuessRangesFromModes(scrnIndex, Monitor, Modes);
+
+        /* look for last Mode */
+        Mode = Modes;
+
+        while (Mode->next)
+            Mode = Mode->next;
+        
+        /* add to MonPtr */
+        if (Monitor->Modes) {
+            Monitor->Last->next = Modes;
+            Modes->prev = Monitor->Last;
+            Monitor->Last = Mode;
+        } else {
+            Monitor->Modes = Modes;
+            Monitor->Last = Mode;
+        }
+    }
+}
+
+/*
+ * Empty shell that keeps most drivers happy.
+ */
+Bool
+xf86SetDDCproperties(ScrnInfoPtr pScrn, xf86MonPtr DDC)
+{
+    if (!pScrn || !pScrn->monitor || !DDC)
+        return FALSE;
+
+    xf86DDCMonitorSet(pScrn->scrnIndex, pScrn->monitor, DDC);
+
     return TRUE;
 }
diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h
index fb10836..5def97a 100644
--- a/hw/xfree86/ddc/xf86DDC.h
+++ b/hw/xfree86/ddc/xf86DDC.h
@@ -47,6 +47,9 @@ extern xf86vdifPtr xf86InterpretVdif(
     CARD8 *c
 );
 
+extern void 
+xf86DDCMonitorSet(int scrnIndex, MonPtr Monitor, xf86MonPtr DDC);
+
 extern Bool xf86SetDDCproperties(
     ScrnInfoPtr pScreen,
     xf86MonPtr DDC



More information about the xorg-commit mailing list