summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--docs/contents.html2
-rw-r--r--docs/envvars.html2
-rw-r--r--docs/helpwanted.html31
-rw-r--r--docs/news.html3
-rw-r--r--docs/relnotes-7.3.html14
-rw-r--r--docs/relnotes-7.4.html69
-rw-r--r--docs/relnotes.html1
-rw-r--r--docs/systems.html25
-rw-r--r--progs/SConscript1
-rw-r--r--progs/demos/SConscript26
-rw-r--r--progs/demos/fogcoord.c28
-rw-r--r--progs/demos/gloss.c2
-rw-r--r--progs/demos/multiarb.c2
-rw-r--r--progs/demos/rain.cxx2
-rw-r--r--progs/demos/stex3d.c4
-rw-r--r--progs/demos/winpos.c18
-rw-r--r--progs/trivial/fs-tri.c39
-rw-r--r--progs/util/SConscript15
-rw-r--r--scons/generic.py40
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c6
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch.c4
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_emit.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c4
-rw-r--r--src/gallium/auxiliary/pipebuffer/Makefile4
-rw-r--r--src/gallium/auxiliary/pipebuffer/SConscript2
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer.h53
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c152
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h21
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c20
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr.h16
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c24
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c27
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c2
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c29
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c303
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c25
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c21
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_validate.c84
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_validate.h10
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_winsys.c170
-rw-r--r--src/gallium/auxiliary/util/Makefile3
-rw-r--r--src/gallium/auxiliary/util/SConscript1
-rw-r--r--src/gallium/auxiliary/util/u_blit.c5
-rw-r--r--src/gallium/auxiliary/util/u_draw_quad.c3
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c3
-rw-r--r--src/gallium/auxiliary/util/u_math.h4
-rw-r--r--src/gallium/auxiliary/util/u_simple_screen.c143
-rw-r--r--src/gallium/auxiliary/util/u_simple_screen.h47
-rw-r--r--src/gallium/auxiliary/util/u_simple_shaders.c2
-rw-r--r--src/gallium/auxiliary/util/u_timed_winsys.c7
-rw-r--r--src/gallium/drivers/cell/ppu/cell_context.c2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_draw_arrays.c4
-rw-r--r--src/gallium/drivers/cell/ppu/cell_gen_fragment.c42
-rw-r--r--src/gallium/drivers/cell/ppu/cell_pipe_state.c2
-rw-r--r--src/gallium/drivers/cell/ppu/cell_screen.c4
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_per_fragment.c16
-rw-r--r--src/gallium/drivers/cell/ppu/cell_state_shader.c8
-rw-r--r--src/gallium/drivers/cell/ppu/cell_texture.c14
-rw-r--r--src/gallium/drivers/cell/ppu/cell_vertex_shader.c2
-rw-r--r--src/gallium/drivers/failover/fo_context.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_batch.h2
-rw-r--r--src/gallium/drivers/i915simple/i915_blit.c32
-rw-r--r--src/gallium/drivers/i915simple/i915_blit.h6
-rw-r--r--src/gallium/drivers/i915simple/i915_context.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_debug.c11
-rw-r--r--src/gallium/drivers/i915simple/i915_debug.h7
-rw-r--r--src/gallium/drivers/i915simple/i915_debug_fp.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_prim_vbuf.c2
-rw-r--r--src/gallium/drivers/i915simple/i915_screen.c4
-rw-r--r--src/gallium/drivers/i915simple/i915_state.c20
-rw-r--r--src/gallium/drivers/i915simple/i915_surface.c8
-rw-r--r--src/gallium/drivers/i915simple/i915_texture.c6
-rw-r--r--src/gallium/drivers/i965simple/brw_blit.c2
-rw-r--r--src/gallium/drivers/i965simple/brw_cc.c14
-rw-r--r--src/gallium/drivers/i965simple/brw_context.c2
-rw-r--r--src/gallium/drivers/i965simple/brw_curbe.c8
-rw-r--r--src/gallium/drivers/i965simple/brw_draw.c2
-rw-r--r--src/gallium/drivers/i965simple/brw_draw_upload.c2
-rw-r--r--src/gallium/drivers/i965simple/brw_screen.c4
-rw-r--r--src/gallium/drivers/i965simple/brw_state.c2
-rw-r--r--src/gallium/drivers/i965simple/brw_state_pool.c2
-rw-r--r--src/gallium/drivers/i965simple/brw_surface.c2
-rw-r--r--src/gallium/drivers/i965simple/brw_tex_layout.c14
-rw-r--r--src/gallium/drivers/i965simple/brw_wm.c4
-rw-r--r--src/gallium/drivers/nouveau/nouveau_winsys.h2
-rw-r--r--src/gallium/drivers/nv04/nv04_context.c7
-rw-r--r--src/gallium/drivers/nv04/nv04_context.h17
-rw-r--r--src/gallium/drivers/nv04/nv04_miptree.c93
-rw-r--r--src/gallium/drivers/nv04/nv04_prim_vbuf.c2
-rw-r--r--src/gallium/drivers/nv04/nv04_screen.c9
-rw-r--r--src/gallium/drivers/nv04/nv04_state.c83
-rw-r--r--src/gallium/drivers/nv04/nv04_state.h5
-rw-r--r--src/gallium/drivers/nv04/nv04_state_emit.c80
-rw-r--r--src/gallium/drivers/nv04/nv04_surface.c2
-rw-r--r--src/gallium/drivers/nv04/nv04_vbo.c15
-rw-r--r--src/gallium/drivers/nv10/nv10_context.c2
-rw-r--r--src/gallium/drivers/nv10/nv10_prim_vbuf.c2
-rw-r--r--src/gallium/drivers/nv10/nv10_screen.c2
-rw-r--r--src/gallium/drivers/nv10/nv10_state.c13
-rw-r--r--src/gallium/drivers/nv10/nv10_surface.c2
-rw-r--r--src/gallium/drivers/nv20/nv20_clear.c1
-rw-r--r--src/gallium/drivers/nv20/nv20_context.c26
-rw-r--r--src/gallium/drivers/nv20/nv20_prim_vbuf.c2
-rw-r--r--src/gallium/drivers/nv20/nv20_screen.c2
-rw-r--r--src/gallium/drivers/nv20/nv20_state.c13
-rw-r--r--src/gallium/drivers/nv20/nv20_state_emit.c13
-rw-r--r--src/gallium/drivers/nv20/nv20_surface.c2
-rw-r--r--src/gallium/drivers/nv20/nv20_vbo.c1
-rw-r--r--src/gallium/drivers/nv30/nv30_context.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_miptree.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_screen.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_state.c12
-rw-r--r--src/gallium/drivers/nv30/nv30_state_emit.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_state_fb.c4
-rw-r--r--src/gallium/drivers/nv30/nv30_surface.c2
-rw-r--r--src/gallium/drivers/nv30/nv30_vbo.c4
-rw-r--r--src/gallium/drivers/nv40/nv40_context.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_draw.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_screen.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_state.c12
-rw-r--r--src/gallium/drivers/nv40/nv40_state_emit.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_state_fb.c4
-rw-r--r--src/gallium/drivers/nv40/nv40_surface.c2
-rw-r--r--src/gallium/drivers/nv40/nv40_vbo.c4
-rw-r--r--src/gallium/drivers/nv50/nv50_clear.c4
-rw-r--r--src/gallium/drivers/nv50/nv50_context.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_query.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c3
-rw-r--r--src/gallium/drivers/nv50/nv50_state.c10
-rw-r--r--src/gallium/drivers/nv50/nv50_state_validate.c4
-rw-r--r--src/gallium/drivers/nv50/nv50_surface.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_vbo.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_clear.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_context.c10
-rw-r--r--src/gallium/drivers/softpipe/sp_draw_arrays.c8
-rw-r--r--src/gallium/drivers/softpipe/sp_flush.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_alpha_test.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_blend.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_bufloop.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_colormask.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_coverage.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_output.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_stencil.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c4
-rw-r--r--src/gallium/drivers/softpipe/sp_setup.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_state_fs.c7
-rw-r--r--src/gallium/drivers/softpipe/sp_state_surface.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_texture.c12
-rw-r--r--src/gallium/drivers/trace/tr_context.c4
-rw-r--r--src/gallium/drivers/trace/tr_state.c13
-rw-r--r--src/gallium/drivers/trace/tr_winsys.h2
-rw-r--r--src/gallium/include/pipe/internal/p_winsys_screen.h (renamed from src/gallium/include/pipe/p_winsys.h)3
-rw-r--r--src/gallium/include/pipe/p_inlines.h51
-rw-r--r--src/gallium/include/pipe/p_screen.h107
-rw-r--r--src/gallium/include/pipe/p_state.h13
-rw-r--r--src/gallium/state_trackers/egl/egl_context.c1
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c13
-rw-r--r--src/gallium/state_trackers/egl/egl_tracker.c2
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_basic_csc.c3
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_context.c4
-rw-r--r--src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c7
-rw-r--r--src/gallium/state_trackers/python/st_device.c2
-rw-r--r--src/gallium/state_trackers/python/st_softpipe_winsys.c2
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_device.c11
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_framebuffer.c2
-rw-r--r--src/gallium/state_trackers/wgl/shared/stw_winsys.h3
-rw-r--r--src/gallium/winsys/drm/intel/common/intel_be_device.c2
-rw-r--r--src/gallium/winsys/drm/intel/common/intel_be_device.h2
-rw-r--r--src/gallium/winsys/drm/intel/egl/Makefile3
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c21
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_context.c6
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_device.c2
-rw-r--r--src/gallium/winsys/drm/intel/gem/intel_be_device.h2
-rw-r--r--src/gallium/winsys/drm/nouveau/common/nouveau_context.c2
-rw-r--r--src/gallium/winsys/drm/nouveau/common/nouveau_fence.c9
-rw-r--r--src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c4
-rw-r--r--src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c2
-rw-r--r--src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.h2
-rw-r--r--src/gallium/winsys/drm/nouveau/common/nouveau_winsys_softpipe.c2
-rw-r--r--src/gallium/winsys/egl_xlib/egl_xlib.c2
-rw-r--r--src/gallium/winsys/egl_xlib/sw_winsys.c2
-rw-r--r--src/gallium/winsys/gdi/gdi_softpipe_winsys.c4
-rw-r--r--src/gallium/winsys/xlib/xlib_brw_context.c2
-rw-r--r--src/gallium/winsys/xlib/xlib_brw_screen.c2
-rw-r--r--src/gallium/winsys/xlib/xlib_cell.c2
-rw-r--r--src/gallium/winsys/xlib/xlib_softpipe.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.h10
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_pass0.c14
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.h1
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_draw.c6
-rw-r--r--src/mesa/main/version.h6
-rw-r--r--src/mesa/state_tracker/st_atom_constbuf.c2
-rw-r--r--src/mesa/state_tracker/st_atom_depth.c10
-rw-r--r--src/mesa/state_tracker/st_atom_framebuffer.c6
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c4
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c2
-rw-r--r--src/mesa/state_tracker/st_cb_feedback.c1
-rw-r--r--src/mesa/state_tracker/st_cb_flush.c10
-rw-r--r--src/mesa/state_tracker/st_cb_strings.c6
-rw-r--r--src/mesa/state_tracker/st_draw.c6
-rw-r--r--src/mesa/state_tracker/st_draw_feedback.c2
204 files changed, 1830 insertions, 918 deletions
diff --git a/Makefile b/Makefile
index c1581a0bd2..875f93bd4a 100644
--- a/Makefile
+++ b/Makefile
@@ -182,10 +182,10 @@ ultrix-gcc:
# Rules for making release tarballs
-DIRECTORY = Mesa-7.3-rc3
-LIB_NAME = MesaLib-7.3-rc3
-DEMO_NAME = MesaDemos-7.3-rc3
-GLUT_NAME = MesaGLUT-7.3-rc3
+DIRECTORY = Mesa-7.4
+LIB_NAME = MesaLib-7.4
+DEMO_NAME = MesaDemos-7.4
+GLUT_NAME = MesaGLUT-7.4
MAIN_FILES = \
$(DIRECTORY)/Makefile* \
diff --git a/docs/contents.html b/docs/contents.html
index b348d3d17f..1dca3a228d 100644
--- a/docs/contents.html
+++ b/docs/contents.html
@@ -48,7 +48,7 @@ a:visited {
<li><a href="lists.html" target="MainFrame">Mailing Lists</a>
<li><a href="bugs.html" target="MainFrame">Bug Database</a>
<li><a href="webmaster.html" target="MainFrame">Webmaster</a>
-<li><a href="http://dri.freedesktop.org/" target="MainFrame">Wiki</a>
+<li><a href="http://dri.freedesktop.org/" target="_parent">Mesa/DRI Wiki</a>
</ul>
<b>User Topics</b>
diff --git a/docs/envvars.html b/docs/envvars.html
index 7b64dc9fef..7fd9fe7c0a 100644
--- a/docs/envvars.html
+++ b/docs/envvars.html
@@ -29,7 +29,7 @@ Setting this variable automatically sets the MESA_TEX_PROG variable as well.
<p>
The following are only applicable to the Xlib software driver.
-See <A HREF="README.X11">README.X11</A> for details.
+See the <A HREF="xlibdriver.html">Xlib software driver page</A> for details.
</p>
<ul>
<li>MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode
diff --git a/docs/helpwanted.html b/docs/helpwanted.html
index 4cd92b97a9..34afe49f75 100644
--- a/docs/helpwanted.html
+++ b/docs/helpwanted.html
@@ -15,17 +15,40 @@ Here are some specific ideas and areas where help would be appreciated:
<ol>
<li>
-Enable -Wstrict-aliasing=2 -fstrict-aliasing and track down aliasing
+<b>Driver patching and testing.</b>
+Patches are often posted to the mesa3d-dev mailing list, but aren't
+immediately checked into git because not enough people are testing them.
+Just applying patches, testing and reporting back is helpful.
+<li>
+<b>Driver debugging.</b>
+There are plenty of open bugs in the bug database.
+<li>
+<b>Remove aliasing warnings.</b>
+Enable gcc -Wstrict-aliasing=2 -fstrict-aliasing and track down aliasing
issues in the code.
<li>
-Windows 98/NT driver building, maintenance and testing
+<b>Windows driver building, testing and maintenance.</b>
+The Visual Studio project files aren't always updated in a timely manner
+when new source files are added or old ones are removed.
+Fixing these tends to delay new Mesa releases.
+<li>
+<b>Maintenance and testing of lesser-used drivers.</b>
+Drivers such as DOS/DJGPP, GGI, etc that aren't being maintained are being
+deprecated starting in Mesa 7.3.
+<li>
+<b>Contribute more tests to
+<a href="http://glean.sourceforge.net/" target="_parent">glean</a>.</b>
<li>
-Maintenance and testing of lesser-used drivers, such as DOS/DJGPP, GGI, etc.
+<b>Automatic testing.
+</b>
+It would be great if someone would set up an automated system for grabbing
+the latest Mesa code and run tests (such as glean) then report issues to
+the mailing list.
</ol>
<p>
-If you want to help with Mesa, first join the Mesa developer's
+If you want to do something new in Mesa, first join the Mesa developer's
mailing list.
Then post a message to propose what you want to do, just to make sure
there's no issues.
diff --git a/docs/news.html b/docs/news.html
index 784aea364a..b177f3bca2 100644
--- a/docs/news.html
+++ b/docs/news.html
@@ -11,10 +11,11 @@
<H1>News</H1>
-<h2>January TBD, 2009</h2>
+<h2>January 22, 2009</h2>
<p>
<a href="relnotes-7.3.html">Mesa 7.3</a> is released.
This is a new development release.
+Mesa 7.4 will follow and will have bug fixes relative to 7.3.
</p>
diff --git a/docs/relnotes-7.3.html b/docs/relnotes-7.3.html
index 78ae00d0d5..df8988443e 100644
--- a/docs/relnotes-7.3.html
+++ b/docs/relnotes-7.3.html
@@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
-<H1>Mesa 7.3 Release Notes / TBD January 2009</H1>
+<H1>Mesa 7.3 Release Notes / 22 January 2009</H1>
<p>
Mesa 7.3 is a new development release.
@@ -22,13 +22,21 @@ Some drivers don't support all the features required in OpenGL 2.1.
</p>
<p>
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
-for DRI ardware acceleration.
+for DRI hardware acceleration.
</p>
<h2>MD5 checksums</h2>
<pre>
-tbd
+8ed03191432b22d118d88d6db497f304 MesaLib-7.3.tar.gz
+781e7811a6ed5c97b2b8defefc8ffbc9 MesaLib-7.3.tar.bz2
+3ccba9a1734ed6d4b3389e1535d90fbf MesaLib-7.3.zip
+d312e974b31043b13b61bac5fbf00b87 MesaDemos-7.3.tar.gz
+3f0741394069bdf2329565a387396cda MesaDemos-7.3.tar.bz2
+4d0887fd4c66a824295cdd619f6d34cb MesaDemos-7.3.zip
+2d7661b66022bcb8878728f3d5bd33ab MesaGLUT-7.3.tar.gz
+abe8036a724c1a483bdad6b5a55ddc1a MesaGLUT-7.3.tar.bz2
+5f247819b47e2a7c62d07a6afe5262fb MesaGLUT-7.3.zip
</pre>
diff --git a/docs/relnotes-7.4.html b/docs/relnotes-7.4.html
new file mode 100644
index 0000000000..60ada854c1
--- /dev/null
+++ b/docs/relnotes-7.4.html
@@ -0,0 +1,69 @@
+<HTML>
+
+<TITLE>Mesa Release Notes</TITLE>
+
+<head><link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<BODY>
+
+<body bgcolor="#eeeeee">
+
+<H1>Mesa 7.4 Release Notes / date TBD</H1>
+
+<p>
+Mesa 7.4 is a stable development release fixing bugs since the 7.3 release.
+</p>
+<p>
+Mesa 7.4 implements the OpenGL 2.1 API, but the version reported by
+glGetString(GL_VERSION) depends on the particular driver being used.
+Some drivers don't support all the features required in OpenGL 2.1.
+</p>
+<p>
+See the <a href="install.html">Compiling/Installing page</a> for prerequisites
+for DRI ardware acceleration.
+</p>
+
+
+<h2>MD5 checksums</h2>
+<pre>
+tbd
+</pre>
+
+
+<h2>New features</h2>
+<ul>
+</ul>
+
+
+<h2>Bug fixes</h2>
+<ul>
+<li>Assorted i965 driver bug fixes
+</ul>
+
+<h2>Changes</h2>
+<ul>
+</ul>
+
+
+
+<h2>Driver Status</h2>
+
+<pre>
+Driver Status
+---------------------- ----------------------
+DRI drivers varies with the driver
+XMesa/GLX (on Xlib) implements OpenGL 2.1
+OSMesa (off-screen) implements OpenGL 2.1
+Windows/Win32 implements OpenGL 2.1
+Glide (3dfx Voodoo1/2) implements OpenGL 1.3
+SVGA unsupported
+Wind River UGL unsupported
+DJGPP unsupported
+GGI unsupported
+BeOS unsupported
+Allegro unsupported
+D3D unsupported
+</pre>
+
+</body>
+</html>
diff --git a/docs/relnotes.html b/docs/relnotes.html
index 020e48551e..61c6a20c29 100644
--- a/docs/relnotes.html
+++ b/docs/relnotes.html
@@ -20,6 +20,7 @@ The release notes summarize what's new or changed in each Mesa release.
</p>
<UL>
+<LI><A HREF="relnotes-7.4.html">7.4 release notes</A>
<LI><A HREF="relnotes-7.3.html">7.3 release notes</A>
<LI><A HREF="relnotes-7.2.html">7.2 release notes</A>
<LI><A HREF="relnotes-7.1.html">7.1 release notes</A>
diff --git a/docs/systems.html b/docs/systems.html
index 340f528af1..5137b074e2 100644
--- a/docs/systems.html
+++ b/docs/systems.html
@@ -27,16 +27,27 @@ the Amiga, Apple Macintosh, BeOS, NeXT, OS/2, MS-DOS, VMS, Windows
</p>
<p>
-Details about particular drivers follows.
-Be warned that some drivers may be out of date and no longer function.
+Details about particular drivers follows:
</p>
<UL>
-<LI><a href="xlibdriver.html">Xlib driver</a> for the X Window System
-<li><a href="http://dri.freedesktop.org/" target="_parent">
-DRI hardware drivers</a> for the X window system
+<li><a href="http://dri.freedesktop.org/" target="_parent"> DRI hardware
+drivers</a> for the X Window System
+<LI><a href="xlibdriver.html">Xlib software driver</a> for the X Window System
+and Unix-like operating systems
<LI>Microsoft Windows <A HREF="README.WIN32">(README.WIN32)</A>
<LI>DEC VMS <A HREF="README.VMS">(README.VMS)</A>
+</UL>
+
+
+<h2>Deprecated Systems</h2>
+
+<p>
+These drivers have not been maintained and are being deprecated.
+They can be saved if someone steps up to help.
+</p>
+
+<UL>
<LI>3dfx/Glide <A HREF="README.3DFX">(README.3DFX)</A>
<LI>GGI <A HREF="README.GGI">(README.GGI)</A>
<LI>Amiga Amiwin <A HREF="README.AMIWIN">(README.AMIWIN)</A>
@@ -49,6 +60,10 @@ DRI hardware drivers</a> for the X window system
<LI>OpenStep <A HREF="README.OpenStep">(README.OpenStep)</A>
<LI>OS/2 <A HREF="README.OS2">(README.OS2)</A>
<LI>WindML <A HREF="README.WINDML">(README.WINDML)</A>
+</UL>
+
+And for historical reference:
+<UL>
<LI><a href="http://utah-glx.sourceforge.net/" target="_parent">Utah GLX drivers</a>
</UL>
diff --git a/progs/SConscript b/progs/SConscript
index ffb6de4f16..631923a38f 100644
--- a/progs/SConscript
+++ b/progs/SConscript
@@ -1,4 +1,5 @@
SConscript([
+ 'util/SConscript',
'demos/SConscript',
'trivial/SConscript',
'vp/SConscript',
diff --git a/progs/demos/SConscript b/progs/demos/SConscript
index 112da7bedb..bc166dd789 100644
--- a/progs/demos/SConscript
+++ b/progs/demos/SConscript
@@ -1,11 +1,22 @@
-Import('env')
+Import('*')
if not env['GLUT']:
Return()
env = env.Clone()
-env.Prepend(LIBS = ['$GLUT_LIB'])
+env.Prepend(CPPPATH = [
+ '../util',
+])
+
+env.Prepend(LIBS = [
+ util,
+ '$GLUT_LIB'
+])
+
+if env['platform'] == 'windows':
+ env.Append(CPPDEFINES = ['NOMINMAX'])
+ env.Prepend(LIBS = ['winmm'])
progs = [
'arbfplight',
@@ -38,7 +49,6 @@ progs = [
'multiarb',
'paltex',
'pointblast',
- 'rain',
'ray',
'readpix',
'reflect',
@@ -65,7 +75,15 @@ progs = [
]
for prog in progs:
- prog = env.Program(
+ env.Program(
target = prog,
source = prog + '.c',
)
+
+env.Program(
+ target = 'rain',
+ source = [
+ 'rain.cxx',
+ 'particles.cxx',
+ ]
+)
diff --git a/progs/demos/fogcoord.c b/progs/demos/fogcoord.c
index 00c73c6f04..6f50993c98 100644
--- a/progs/demos/fogcoord.c
+++ b/progs/demos/fogcoord.c
@@ -7,19 +7,16 @@
* Daniel Borca
*/
-#define GL_GLEXT_PROTOTYPES
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
+#include <GL/glew.h>
#include <GL/glut.h>
#define DEPTH 5.0f
-static PFNGLFOGCOORDFEXTPROC glFogCoordf_ext;
static PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointer_ext;
-static GLboolean have_fog_coord;
-
static GLfloat camz;
static GLint fogMode;
@@ -45,10 +42,11 @@ Reset(void)
}
-static void APIENTRY
-glFogCoordf_nop (GLfloat f)
+static void
+glFogCoordf_ext (GLfloat f)
{
- (void)f;
+ if (fogCoord)
+ glFogCoordfEXT(f);
}
@@ -120,14 +118,11 @@ SetFogMode(GLint fogMode)
static GLboolean
SetFogCoord(GLboolean fogCoord)
{
- glFogCoordf_ext = glFogCoordf_nop;
-
- if (!have_fog_coord) {
+ if (!GLEW_EXT_fog_coord) {
return GL_FALSE;
}
if (fogCoord) {
- glFogCoordf_ext = (PFNGLFOGCOORDFEXTPROC)glutGetProcAddress("glFogCoordfEXT");
glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
}
else {
@@ -340,7 +335,7 @@ Key( unsigned char key, int x, int y )
SetFogMode(fogMode);
break;
case 'c':
- fogCoord = SetFogCoord(fogCoord ^ GL_TRUE);
+ fogCoord = SetFogCoord(fogCoord ^ GL_TRUE);
break;
case 't':
Texture = !Texture;
@@ -372,8 +367,7 @@ Init(void)
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
- have_fog_coord = glutExtensionSupported("GL_EXT_fog_coord");
- if (!have_fog_coord) {
+ if (!GLEW_EXT_fog_coord) {
printf("GL_EXT_fog_coord not supported!\n");
}
@@ -400,10 +394,9 @@ Init(void)
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, texcoord_pointer);
- if (have_fog_coord) {
- glFogCoordPointer_ext = (PFNGLFOGCOORDPOINTEREXTPROC)glutGetProcAddress("glFogCoordPointerEXT");
+ if (GLEW_EXT_fog_coord) {
glEnableClientState(GL_FOG_COORDINATE_ARRAY_EXT);
- glFogCoordPointer_ext(GL_FLOAT, 0, fogcoord_pointer);
+ glFogCoordPointerEXT(GL_FLOAT, 0, fogcoord_pointer);
}
Reset();
@@ -417,6 +410,7 @@ main( int argc, char *argv[] )
glutInitWindowSize( 600, 600 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0]);
+ glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
diff --git a/progs/demos/gloss.c b/progs/demos/gloss.c
index 9974f0dab2..b2126e3267 100644
--- a/progs/demos/gloss.c
+++ b/progs/demos/gloss.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <math.h>
#include <string.h>
+#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.h"
@@ -438,6 +439,7 @@ int main( int argc, char *argv[] )
glutInitWindowSize(WinWidth, WinHeight);
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );
glutCreateWindow(argv[0] );
+ glewInit();
glutReshapeFunc( Reshape );
glutKeyboardFunc( Key );
glutDisplayFunc( Display );
diff --git a/progs/demos/multiarb.c b/progs/demos/multiarb.c
index 451fd11efe..85c4e3a266 100644
--- a/progs/demos/multiarb.c
+++ b/progs/demos/multiarb.c
@@ -14,6 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <GL/glew.h>
#include <GL/glut.h>
#include "readtex.h"
@@ -326,6 +327,7 @@ int main( int argc, char *argv[] )
glutInitWindowPosition( 0, 0 );
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
glutCreateWindow(argv[0] );
+ glewInit();
Init( argc, argv );
diff --git a/progs/demos/rain.cxx b/progs/demos/rain.cxx
index 59b6471ef8..265d90cd95 100644
--- a/progs/demos/rain.cxx
+++ b/progs/demos/rain.cxx
@@ -24,8 +24,6 @@ extern "C" {
#ifdef _WIN32
#include <windows.h>
#include <mmsystem.h>
-#include "particles.cxx"
-#include "readtex.c"
#endif
#ifdef XMESA
diff --git a/progs/demos/stex3d.c b/progs/demos/stex3d.c
index 83ae3684ae..c0bbea0960 100644
--- a/progs/demos/stex3d.c
+++ b/progs/demos/stex3d.c
@@ -18,7 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
-#include <GL/gl.h>
+#include <GL/glew.h>
#include <GL/glut.h>
@@ -662,6 +662,8 @@ main(int argc, char **argv)
exit(0);
}
+ glewInit();
+
init();
printHelp();
diff --git a/progs/demos/winpos.c b/progs/demos/winpos.c
index b58e330864..13a9c7e9a8 100644
--- a/progs/demos/winpos.c
+++ b/progs/demos/winpos.c
@@ -11,7 +11,7 @@
#ifdef _WIN32
#include <windows.h>
#endif
-#define GL_GLEXT_PROTOTYPES
+#include "GL/glew.h"
#include "GL/glut.h"
#include "readtex.h"
@@ -29,8 +29,7 @@ static GLubyte *Image;
static int ImgWidth, ImgHeight;
static GLenum ImgFormat;
-typedef void (APIENTRY * PFNWINDOWPOSFUNC)(GLfloat x, GLfloat y);
-static PFNWINDOWPOSFUNC WindowPosFunc;
+static PFNGLWINDOWPOS2FPROC WindowPosFunc;
static void draw( void )
{
@@ -71,19 +70,16 @@ static void reshape( int width, int height )
static void init( void )
{
-#ifdef GL_ARB_window_pos
- if (glutExtensionSupported("GL_ARB_window_pos")) {
+ if (GLEW_ARB_window_pos) {
printf("Using GL_ARB_window_pos\n");
- WindowPosFunc = &glWindowPos2fARB;
+ WindowPosFunc = glWindowPos2fARB;
}
else
-#elif defined(GL_MESA_window_pos)
- if (glutExtensionSupported("GL_MESA_window_pos")) {
+ if (GLEW_MESA_window_pos) {
printf("Using GL_MESA_window_pos\n");
- WindowPosFunc = &glWindowPos2fMESA;
+ WindowPosFunc = glWindowPos2fMESA;
}
else
-#endif
{
printf("Sorry, GL_ARB/MESA_window_pos extension not available.\n");
exit(1);
@@ -109,6 +105,8 @@ int main( int argc, char *argv[] )
exit(0);
}
+ glewInit();
+
init();
glutReshapeFunc( reshape );
diff --git a/progs/trivial/fs-tri.c b/progs/trivial/fs-tri.c
index 3be4d42e54..6e86df1dcf 100644
--- a/progs/trivial/fs-tri.c
+++ b/progs/trivial/fs-tri.c
@@ -5,10 +5,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
-#include <GL/gl.h>
+#include <GL/glew.h>
#include <GL/glut.h>
-#include <GL/glext.h>
-#include "extfuncs.h"
static GLuint fragShader;
@@ -56,9 +54,9 @@ Reshape(int width, int height)
static void
CleanUp(void)
{
- glDeleteShader_func(fragShader);
- glDeleteShader_func(vertShader);
- glDeleteProgram_func(program);
+ glDeleteShader(fragShader);
+ glDeleteShader(vertShader);
+ glDeleteProgram(program);
glutDestroyWindow(win);
}
@@ -110,15 +108,15 @@ LoadAndCompileShader(GLuint shader, const char *text)
{
GLint stat;
- glShaderSource_func(shader, 1, (const GLchar **) &text, NULL);
+ glShaderSource(shader, 1, (const GLchar **) &text, NULL);
- glCompileShader_func(shader);
+ glCompileShader(shader);
- glGetShaderiv_func(shader, GL_COMPILE_STATUS, &stat);
+ glGetShaderiv(shader, GL_COMPILE_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetShaderInfoLog_func(shader, 1000, &len, log);
+ glGetShaderInfoLog(shader, 1000, &len, log);
fprintf(stderr, "fslight: problem compiling shader:\n%s\n", log);
exit(1);
}
@@ -129,11 +127,11 @@ static void
CheckLink(GLuint prog)
{
GLint stat;
- glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
+ glGetProgramiv(prog, GL_LINK_STATUS, &stat);
if (!stat) {
GLchar log[1000];
GLsizei len;
- glGetProgramInfoLog_func(prog, 1000, &len, log);
+ glGetProgramInfoLog(prog, 1000, &len, log);
fprintf(stderr, "Linker error:\n%s\n", log);
}
}
@@ -165,24 +163,22 @@ Init(void)
exit(1);
}
- GetExtensionFuncs();
-
- fragShader = glCreateShader_func(GL_FRAGMENT_SHADER);
+ fragShader = glCreateShader(GL_FRAGMENT_SHADER);
LoadAndCompileShader(fragShader, fragShaderText);
#if 0
- vertShader = glCreateShader_func(GL_VERTEX_SHADER);
+ vertShader = glCreateShader(GL_VERTEX_SHADER);
LoadAndCompileShader(vertShader, vertShaderText);
#endif
- program = glCreateProgram_func();
- glAttachShader_func(program, fragShader);
+ program = glCreateProgram();
+ glAttachShader(program, fragShader);
#if 0
- glAttachShader_func(program, vertShader);
+ glAttachShader(program, vertShader);
#endif
- glLinkProgram_func(program);
+ glLinkProgram(program);
CheckLink(program);
- glUseProgram_func(program);
+ glUseProgram(program);
assert(glGetError() == 0);
@@ -200,6 +196,7 @@ main(int argc, char *argv[])
glutInitWindowSize(200, 200);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
win = glutCreateWindow(argv[0]);
+ glewInit();
glutReshapeFunc(Reshape);
glutKeyboardFunc(Key);
glutSpecialFunc(SpecialKey);
diff --git a/progs/util/SConscript b/progs/util/SConscript
new file mode 100644
index 0000000000..8ad2466291
--- /dev/null
+++ b/progs/util/SConscript
@@ -0,0 +1,15 @@
+Import('env')
+
+env = env.Clone()
+
+util = env.StaticLibrary(
+ target = ['util'],
+ source = [
+ 'readtex.c',
+ 'trackball.c',
+ 'showbuffer.c',
+ 'shaderutil.c',
+ ],
+)
+
+Export('util')
diff --git a/scons/generic.py b/scons/generic.py
index df7ef42402..05f7356b76 100644
--- a/scons/generic.py
+++ b/scons/generic.py
@@ -303,7 +303,7 @@ def generate(env):
#'_UNICODE',
#'UNICODE',
# http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
- 'WIN32_LEAN_AND_MEAN',
+ #'WIN32_LEAN_AND_MEAN',
'VC_EXTRALEAN',
'_CRT_SECURE_NO_DEPRECATE',
]
@@ -362,24 +362,26 @@ def generate(env):
])
# C compiler options
- cflags = []
+ cflags = [] # C
+ cxxflags = [] # C++
+ ccflags = [] # C & C++
if gcc:
if debug:
- cflags += ['-O0', '-g3']
+ ccflags += ['-O0', '-g3']
else:
- cflags += ['-O3', '-g0']
+ ccflags += ['-O3', '-g0']
if env['profile']:
- cflags += ['-pg']
+ ccflags += ['-pg']
if env['machine'] == 'x86':
- cflags += [
+ ccflags += [
'-m32',
#'-march=pentium4',
'-mmmx', '-msse', '-msse2', # enable SIMD intrinsics
#'-mfpmath=sse',
]
if env['machine'] == 'x86_64':
- cflags += ['-m64']
- cflags += [
+ ccflags += ['-m64']
+ ccflags += [
'-Wall',
'-Wmissing-prototypes',
'-Wno-long-long',
@@ -387,43 +389,46 @@ def generate(env):
'-pedantic',
'-fmessage-length=0', # be nice to Eclipse
]
+ cflags += [
+ '-Wmissing-prototypes',
+ ]
if msvc:
# See also:
# - http://msdn.microsoft.com/en-us/library/19z1t1wy.aspx
# - cl /?
if debug:
- cflags += [
+ ccflags += [
'/Od', # disable optimizations
'/Oi', # enable intrinsic functions
'/Oy-', # disable frame pointer omission
]
else:
- cflags += [
+ ccflags += [
'/Ox', # maximum optimizations
'/Oi', # enable intrinsic functions
'/Ot', # favor code speed
#'/fp:fast', # fast floating point
]
if env['profile']:
- cflags += [
+ ccflags += [
'/Gh', # enable _penter hook function
'/GH', # enable _pexit hook function
]
- cflags += [
+ ccflags += [
'/W3', # warning level
#'/Wp64', # enable 64 bit porting warnings
]
if env['machine'] == 'x86':
- cflags += [
+ ccflags += [
#'/QIfist', # Suppress _ftol
#'/arch:SSE2', # use the SSE2 instructions
]
if platform == 'windows':
- cflags += [
+ ccflags += [
# TODO
]
if platform == 'winddk':
- cflags += [
+ ccflags += [
'/Zl', # omit default library name in .OBJ
'/Zp8', # 8bytes struct member alignment
'/Gy', # separate functions for linker
@@ -442,7 +447,7 @@ def generate(env):
]
if platform == 'wince':
# See also C:\WINCE600\public\common\oak\misc\makefile.def
- cflags += [
+ ccflags += [
'/Zl', # omit default library name in .OBJ
'/GF', # enable read-only string pooling
'/GR-', # disable C++ RTTI
@@ -459,8 +464,9 @@ def generate(env):
# See http://scons.tigris.org/issues/show_bug.cgi?id=1656
env.EnsureSConsVersion(0, 98, 0)
env['PDB'] = '${TARGET.base}.pdb'
+ env.Append(CCFLAGS = ccflags)
env.Append(CFLAGS = cflags)
- env.Append(CXXFLAGS = cflags)
+ env.Append(CXXFLAGS = cxxflags)
if env['platform'] == 'windows' and msvc:
# Choose the appropriate MSVC CRT
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 68508f24de..a9157aad71 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -783,7 +783,7 @@ copy_framebuffer_state(struct pipe_framebuffer_state *dst,
dst->width = src->width;
dst->height = src->height;
- dst->num_cbufs = src->num_cbufs;
+ dst->nr_cbufs = src->nr_cbufs;
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
pipe_surface_reference(&dst->cbufs[i], src->cbufs[i]);
}
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index 18f24e5980..4e5ffa0930 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -228,7 +228,7 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count)
for (j = 0; j < draw->pt.nr_vertex_elements; j++) {
uint buf = draw->pt.vertex_element[j].vertex_buffer_index;
ubyte *ptr = (ubyte *) draw->pt.user.vbuffer[buf];
- ptr += draw->pt.vertex_buffer[buf].pitch * ii;
+ ptr += draw->pt.vertex_buffer[buf].stride * ii;
ptr += draw->pt.vertex_element[j].src_offset;
debug_printf(" Attr %u: ", j);
@@ -301,8 +301,8 @@ draw_arrays(struct draw_context *draw, unsigned prim,
}
debug_printf("Buffers:\n");
for (i = 0; i < draw->pt.nr_vertex_buffers; i++) {
- debug_printf(" pitch=%u offset=%u ptr=%p\n",
- draw->pt.vertex_buffer[i].pitch,
+ debug_printf(" stride=%u offset=%u ptr=%p\n",
+ draw->pt.vertex_buffer[i].stride,
draw->pt.vertex_buffer[i].buffer_offset,
draw->pt.user.vbuffer[i]);
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch.c b/src/gallium/auxiliary/draw/draw_pt_fetch.c
index 6377f896fb..058caf7dcc 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch.c
@@ -144,7 +144,7 @@ void draw_pt_fetch_run( struct pt_fetch *fetch,
i,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
- draw->pt.vertex_buffer[i].pitch );
+ draw->pt.vertex_buffer[i].stride );
}
translate->run_elts( translate,
@@ -180,7 +180,7 @@ void draw_pt_fetch_run_linear( struct pt_fetch *fetch,
i,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
- draw->pt.vertex_buffer[i].pitch );
+ draw->pt.vertex_buffer[i].stride );
}
translate->run( translate,
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
index 0227652632..dcb7744b17 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_emit.c
@@ -195,7 +195,7 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
i,
((char *)draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
- draw->pt.vertex_buffer[i].pitch );
+ draw->pt.vertex_buffer[i].stride );
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
index 1649cdc6cd..84ffe3296a 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -121,7 +121,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
}
for (i = 0; i < 5 && i < nr_vbs; i++) {
- if (draw->pt.vertex_buffer[i].pitch == 0)
+ if (draw->pt.vertex_buffer[i].stride == 0)
fse->key.const_vbuffers |= (1<<i);
}
@@ -189,7 +189,7 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
i,
((const ubyte *) draw->pt.user.vbuffer[i] +
draw->pt.vertex_buffer[i].buffer_offset),
- draw->pt.vertex_buffer[i].pitch );
+ draw->pt.vertex_buffer[i].stride );
}
*max_vertices = (draw->render->max_vertex_buffer_bytes /
diff --git a/src/gallium/auxiliary/pipebuffer/Makefile b/src/gallium/auxiliary/pipebuffer/Makefile
index f9b39d9ce0..3b501c51df 100644
--- a/src/gallium/auxiliary/pipebuffer/Makefile
+++ b/src/gallium/auxiliary/pipebuffer/Makefile
@@ -11,10 +11,10 @@ C_SOURCES = \
pb_bufmgr_debug.c \
pb_bufmgr_fenced.c \
pb_bufmgr_mm.c \
+ pb_bufmgr_ondemand.c \
pb_bufmgr_pool.c \
pb_bufmgr_slab.c \
- pb_validate.c \
- pb_winsys.c
+ pb_validate.c
include ../../Makefile.template
diff --git a/src/gallium/auxiliary/pipebuffer/SConscript b/src/gallium/auxiliary/pipebuffer/SConscript
index 56a40dda0d..8e9f06abe4 100644
--- a/src/gallium/auxiliary/pipebuffer/SConscript
+++ b/src/gallium/auxiliary/pipebuffer/SConscript
@@ -10,10 +10,10 @@ pipebuffer = env.ConvenienceLibrary(
'pb_bufmgr_debug.c',
'pb_bufmgr_fenced.c',
'pb_bufmgr_mm.c',
+ 'pb_bufmgr_ondemand.c',
'pb_bufmgr_pool.c',
'pb_bufmgr_slab.c',
'pb_validate.c',
- 'pb_winsys.c',
])
auxiliaries.insert(0, pipebuffer)
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index 4f1a8a3894..d8f1f02d68 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
@@ -37,7 +37,7 @@
* There is no obligation of a winsys driver to use this library. And a pipe
* driver should be completly agnostic about it.
*
- * \author Jos� Fonseca <jrfonseca@tungstengraphics.com>
+ * \author Jose Fonseca <jrfonseca@tungstengraphics.com>
*/
#ifndef PB_BUFFER_H_
@@ -46,6 +46,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
+#include "pipe/p_error.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
@@ -56,6 +57,8 @@ extern "C" {
struct pb_vtbl;
+struct pb_validate;
+
/**
* Buffer description.
@@ -104,6 +107,13 @@ struct pb_vtbl
void (*unmap)( struct pb_buffer *buf );
+ enum pipe_error (*validate)( struct pb_buffer *buf,
+ struct pb_validate *vl,
+ unsigned flags );
+
+ void (*fence)( struct pb_buffer *buf,
+ struct pipe_fence_handle *fence );
+
/**
* Get the base buffer and the offset.
*
@@ -118,6 +128,7 @@ struct pb_vtbl
void (*get_base_buffer)( struct pb_buffer *buf,
struct pb_buffer **base_buf,
unsigned *offset );
+
};
@@ -148,6 +159,7 @@ pb_map(struct pb_buffer *buf,
assert(buf);
if(!buf)
return NULL;
+ assert(buf->base.refcount > 0);
return buf->vtbl->map(buf, flags);
}
@@ -158,6 +170,7 @@ pb_unmap(struct pb_buffer *buf)
assert(buf);
if(!buf)
return;
+ assert(buf->base.refcount > 0);
buf->vtbl->unmap(buf);
}
@@ -173,7 +186,33 @@ pb_get_base_buffer( struct pb_buffer *buf,
offset = 0;
return;
}
+ assert(buf->base.refcount > 0);
+ assert(buf->vtbl->get_base_buffer);
buf->vtbl->get_base_buffer(buf, base_buf, offset);
+ assert(*base_buf);
+ assert(*offset < (*base_buf)->base.size);
+}
+
+
+static INLINE enum pipe_error
+pb_validate(struct pb_buffer *buf, struct pb_validate *vl, unsigned flags)
+{
+ assert(buf);
+ if(!buf)
+ return PIPE_ERROR;
+ assert(buf->vtbl->validate);
+ return buf->vtbl->validate(buf, vl, flags);
+}
+
+
+static INLINE void
+pb_fence(struct pb_buffer *buf, struct pipe_fence_handle *fence)
+{
+ assert(buf);
+ if(!buf)
+ return;
+ assert(buf->vtbl->fence);
+ buf->vtbl->fence(buf, fence);
}
@@ -216,7 +255,13 @@ pb_reference(struct pb_buffer **dst,
static INLINE boolean
pb_check_alignment(size_t requested, size_t provided)
{
- return requested <= provided && (provided % requested) == 0 ? TRUE : FALSE;
+ if(!requested)
+ return TRUE;
+ if(requested > provided)
+ return FALSE;
+ if(provided % requested != 0)
+ return FALSE;
+ return TRUE;
}
@@ -240,10 +285,6 @@ pb_malloc_buffer_create(size_t size,
const struct pb_desc *desc);
-void
-pb_init_winsys(struct pipe_winsys *winsys);
-
-
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index 17b2781052..61afdfe82a 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -29,7 +29,7 @@
* \file
* Implementation of fenced buffers.
*
- * \author José Fonseca <jrfonseca-at-tungstengraphics-dot-com>
+ * \author Jose Fonseca <jrfonseca-at-tungstengraphics-dot-com>
* \author Thomas Hellström <thomas-at-tungstengraphics-dot-com>
*/
@@ -44,7 +44,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_error.h"
#include "pipe/p_debug.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_thread.h"
#include "util/u_memory.h"
#include "util/u_double_list.h"
@@ -59,13 +59,6 @@
*/
#define SUPER(__derived) (&(__derived)->base)
-#define PIPE_BUFFER_USAGE_CPU_READ_WRITE \
- ( PIPE_BUFFER_USAGE_CPU_READ | PIPE_BUFFER_USAGE_CPU_WRITE )
-#define PIPE_BUFFER_USAGE_GPU_READ_WRITE \
- ( PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE )
-#define PIPE_BUFFER_USAGE_WRITE \
- ( PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_GPU_WRITE )
-
struct fenced_buffer_list
{
@@ -97,6 +90,8 @@ struct fenced_buffer
unsigned flags;
unsigned mapcount;
+ struct pb_validate *vl;
+ unsigned validation_flags;
struct pipe_fence_handle *fence;
struct list_head head;
@@ -108,7 +103,6 @@ static INLINE struct fenced_buffer *
fenced_buffer(struct pb_buffer *buf)
{
assert(buf);
- assert(buf->vtbl == &fenced_buffer_vtbl);
return (struct fenced_buffer *)buf;
}
@@ -274,6 +268,7 @@ fenced_buffer_map(struct pb_buffer *buf,
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
void *map;
+ assert(flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE);
assert(!(flags & ~PIPE_BUFFER_USAGE_CPU_READ_WRITE));
flags &= PIPE_BUFFER_USAGE_CPU_READ_WRITE;
@@ -315,6 +310,93 @@ fenced_buffer_unmap(struct pb_buffer *buf)
}
+static enum pipe_error
+fenced_buffer_validate(struct pb_buffer *buf,
+ struct pb_validate *vl,
+ unsigned flags)
+{
+ struct fenced_buffer *fenced_buf = fenced_buffer(buf);
+ enum pipe_error ret;
+
+ if(!vl) {
+ /* invalidate */
+ fenced_buf->vl = NULL;
+ fenced_buf->validation_flags = 0;
+ return PIPE_OK;
+ }
+
+ assert(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
+ assert(!(flags & ~PIPE_BUFFER_USAGE_GPU_READ_WRITE));
+ flags &= PIPE_BUFFER_USAGE_GPU_READ_WRITE;
+
+ /* Buffer cannot be validated in two different lists */
+ if(fenced_buf->vl && fenced_buf->vl != vl)
+ return PIPE_ERROR_RETRY;
+
+ /* Do not validate if buffer is still mapped */
+ if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) {
+ /* TODO: wait for the thread that mapped the buffer to unmap it */
+ return PIPE_ERROR_RETRY;
+ }
+
+ if(fenced_buf->vl == vl &&
+ (fenced_buf->validation_flags & flags) == flags) {
+ /* Nothing to do -- buffer already validated */
+ return PIPE_OK;
+ }
+
+ /* Final sanity checking */
+ assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE));
+ assert(!fenced_buf->mapcount);
+
+ ret = pb_validate(fenced_buf->buffer, vl, flags);
+ if (ret != PIPE_OK)
+ return ret;
+
+ fenced_buf->vl = vl;
+ fenced_buf->validation_flags |= flags;
+
+ return PIPE_OK;
+}
+
+
+static void
+fenced_buffer_fence(struct pb_buffer *buf,
+ struct pipe_fence_handle *fence)
+{
+ struct fenced_buffer *fenced_buf;
+ struct fenced_buffer_list *fenced_list;
+ struct pipe_winsys *winsys;
+
+ fenced_buf = fenced_buffer(buf);
+ fenced_list = fenced_buf->list;
+ winsys = fenced_list->winsys;
+
+ if(fence == fenced_buf->fence) {
+ /* Nothing to do */
+ return;
+ }
+
+ assert(fenced_buf->vl);
+ assert(fenced_buf->validation_flags);
+
+ pipe_mutex_lock(fenced_list->mutex);
+ if (fenced_buf->fence)
+ _fenced_buffer_remove(fenced_list, fenced_buf);
+ if (fence) {
+ winsys->fence_reference(winsys, &fenced_buf->fence, fence);
+ fenced_buf->flags |= fenced_buf->validation_flags;
+ _fenced_buffer_add(fenced_buf);
+ }
+ pipe_mutex_unlock(fenced_list->mutex);
+
+ pb_fence(fenced_buf->buffer, fence);
+
+ fenced_buf->vl = NULL;
+ fenced_buf->validation_flags = 0;
+}
+
+
static void
fenced_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
@@ -325,11 +407,13 @@ fenced_buffer_get_base_buffer(struct pb_buffer *buf,
}
-const struct pb_vtbl
+static const struct pb_vtbl
fenced_buffer_vtbl = {
fenced_buffer_destroy,
fenced_buffer_map,
fenced_buffer_unmap,
+ fenced_buffer_validate,
+ fenced_buffer_fence,
fenced_buffer_get_base_buffer
};
@@ -362,52 +446,6 @@ fenced_buffer_create(struct fenced_buffer_list *fenced_list,
}
-void
-buffer_fence(struct pb_buffer *buf,
- struct pipe_fence_handle *fence)
-{
- struct fenced_buffer *fenced_buf;
- struct fenced_buffer_list *fenced_list;
- struct pipe_winsys *winsys;
- /* FIXME: receive this as a parameter */
- unsigned flags = fence ? PIPE_BUFFER_USAGE_GPU_READ_WRITE : 0;
-
- /* This is a public function, so be extra cautious with the buffer passed,
- * as happens frequently to receive null buffers, or pointer to buffers
- * other than fenced buffers. */
- assert(buf);
- if(!buf)
- return;
- assert(buf->vtbl == &fenced_buffer_vtbl);
- if(buf->vtbl != &fenced_buffer_vtbl)
- return;
-
- fenced_buf = fenced_buffer(buf);
- fenced_list = fenced_buf->list;
- winsys = fenced_list->winsys;
-
- if(!fence || fence == fenced_buf->fence) {
- /* Handle the same fence case specially, not only because it is a fast
- * path, but mostly to avoid serializing two writes with the same fence,
- * as that would bring the hardware down to synchronous operation without
- * any benefit.
- */
- fenced_buf->flags |= flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE;
- return;
- }
-
- pipe_mutex_lock(fenced_list->mutex);
- if (fenced_buf->fence)
- _fenced_buffer_remove(fenced_list, fenced_buf);
- if (fence) {
- winsys->fence_reference(winsys, &fenced_buf->fence, fence);
- fenced_buf->flags |= flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE;
- _fenced_buffer_add(fenced_buf);
- }
- pipe_mutex_unlock(fenced_list->mutex);
-}
-
-
struct fenced_buffer_list *
fenced_buffer_list_create(struct pipe_winsys *winsys)
{
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
index 50d5891bdb..b15c676194 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h
@@ -44,7 +44,7 @@
* Between the handle's destruction, and the fence signalling, the buffer is
* stored in a fenced buffer list.
*
- * \author José Fonseca <jrfonseca@tungstengraphics.com>
+ * \author Jose Fonseca <jrfonseca@tungstengraphics.com>
*/
#ifndef PB_BUFFER_FENCED_H_
@@ -71,14 +71,6 @@ struct fenced_buffer_list;
/**
- * The fenced buffer's virtual function table.
- *
- * NOTE: Made public for debugging purposes.
- */
-extern const struct pb_vtbl fenced_buffer_vtbl;
-
-
-/**
* Create a fenced buffer list.
*
* See also fenced_bufmgr_create for a more convenient way to use this.
@@ -108,17 +100,6 @@ fenced_buffer_create(struct fenced_buffer_list *fenced,
struct pb_buffer *buffer);
-/**
- * Set a buffer's fence.
- *
- * NOTE: Although it takes a generic pb_buffer argument, it will fail
- * on everything but buffers returned by fenced_buffer_create.
- */
-void
-buffer_fence(struct pb_buffer *buf,
- struct pipe_fence_handle *fence);
-
-
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
index 1bf22a2ec0..53f497cfb0 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
@@ -81,6 +81,24 @@ malloc_buffer_unmap(struct pb_buffer *buf)
}
+static enum pipe_error
+malloc_buffer_validate(struct pb_buffer *buf,
+ struct pb_validate *vl,
+ unsigned flags)
+{
+ assert(0);
+ return PIPE_ERROR;
+}
+
+
+static void
+malloc_buffer_fence(struct pb_buffer *buf,
+ struct pipe_fence_handle *fence)
+{
+ assert(0);
+}
+
+
static void
malloc_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
@@ -96,6 +114,8 @@ malloc_buffer_vtbl = {
malloc_buffer_destroy,
malloc_buffer_map,
malloc_buffer_unmap,
+ malloc_buffer_validate,
+ malloc_buffer_fence,
malloc_buffer_get_base_buffer
};
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
index cafbee045a..0a8264a924 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h
@@ -43,7 +43,7 @@
* - the fenced buffer manager, which will delay buffer destruction until the
* the moment the card finishing processing it.
*
- * \author José Fonseca <jrfonseca@tungstengraphics.com>
+ * \author Jose Fonseca <jrfonseca@tungstengraphics.com>
*/
#ifndef PB_BUFMGR_H_
@@ -183,6 +183,20 @@ pb_alt_manager_create(struct pb_manager *provider1,
/**
+ * Ondemand buffer manager.
+ *
+ * Buffers are created in malloc'ed memory (fast and cached), and the constents
+ * is transfered to a buffer from the provider (typically in slow uncached
+ * memory) when there is an attempt to validate the buffer.
+ *
+ * Ideal for situations where one does not know before hand whether a given
+ * buffer will effectively be used by the hardware or not.
+ */
+struct pb_manager *
+pb_ondemand_manager_create(struct pb_manager *provider);
+
+
+/**
* Debug buffer manager to detect buffer under- and overflows.
*
* Band size should be a multiple of the largest alignment
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 8f118874ec..a168853713 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -29,14 +29,13 @@
* \file
* Buffer cache.
*
- * \author José Fonseca <jrfonseca-at-tungstengraphics-dot-com>
+ * \author Jose Fonseca <jrfonseca-at-tungstengraphics-dot-com>
* \author Thomas Hellström <thomas-at-tungstengraphics-dot-com>
*/
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_thread.h"
#include "util/u_memory.h"
#include "util/u_double_list.h"
@@ -183,6 +182,25 @@ pb_cache_buffer_unmap(struct pb_buffer *_buf)
}
+static enum pipe_error
+pb_cache_buffer_validate(struct pb_buffer *_buf,
+ struct pb_validate *vl,
+ unsigned flags)
+{
+ struct pb_cache_buffer *buf = pb_cache_buffer(_buf);
+ return pb_validate(buf->buffer, vl, flags);
+}
+
+
+static void
+pb_cache_buffer_fence(struct pb_buffer *_buf,
+ struct pipe_fence_handle *fence)
+{
+ struct pb_cache_buffer *buf = pb_cache_buffer(_buf);
+ pb_fence(buf->buffer, fence);
+}
+
+
static void
pb_cache_buffer_get_base_buffer(struct pb_buffer *_buf,
struct pb_buffer **base_buf,
@@ -198,6 +216,8 @@ pb_cache_buffer_vtbl = {
pb_cache_buffer_destroy,
pb_cache_buffer_map,
pb_cache_buffer_unmap,
+ pb_cache_buffer_validate,
+ pb_cache_buffer_fence,
pb_cache_buffer_get_base_buffer
};
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 1675e6e182..26d9c24aec 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -29,13 +29,12 @@
* \file
* Debug buffer manager to detect buffer under- and overflows.
*
- * \author José Fonseca <jrfonseca@tungstengraphics.com>
+ * \author Jose Fonseca <jrfonseca@tungstengraphics.com>
*/
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_thread.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -255,11 +254,35 @@ pb_debug_buffer_get_base_buffer(struct pb_buffer *_buf,
}
+static enum pipe_error
+pb_debug_buffer_validate(struct pb_buffer *_buf,
+ struct pb_validate *vl,
+ unsigned flags)
+{
+ struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
+
+ pb_debug_buffer_check(buf);
+
+ return pb_validate(buf->buffer, vl, flags);
+}
+
+
+static void
+pb_debug_buffer_fence(struct pb_buffer *_buf,
+ struct pipe_fence_handle *fence)
+{
+ struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
+ pb_fence(buf->buffer, fence);
+}
+
+
const struct pb_vtbl
pb_debug_buffer_vtbl = {
pb_debug_buffer_destroy,
pb_debug_buffer_map,
pb_debug_buffer_unmap,
+ pb_debug_buffer_validate,
+ pb_debug_buffer_fence,
pb_debug_buffer_get_base_buffer
};
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
index e2594ea236..513ed28ca6 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c
@@ -30,7 +30,7 @@
* \file
* A buffer manager that wraps buffers in fenced buffers.
*
- * \author José Fonseca <jrfonseca@tungstengraphics.dot.com>
+ * \author Jose Fonseca <jrfonseca@tungstengraphics.dot.com>
*/
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index a976d3041a..2f5a5d8ea0 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -29,7 +29,7 @@
* \file
* Buffer manager using the old texture memory manager.
*
- * \author José Fonseca <jrfonseca@tungstengraphics.com>
+ * \author Jose Fonseca <jrfonseca@tungstengraphics.com>
*/
@@ -124,6 +124,27 @@ mm_buffer_unmap(struct pb_buffer *buf)
}
+static enum pipe_error
+mm_buffer_validate(struct pb_buffer *buf,
+ struct pb_validate *vl,
+ unsigned flags)
+{
+ struct mm_buffer *mm_buf = mm_buffer(buf);
+ struct mm_pb_manager *mm = mm_buf->mgr;
+ return pb_validate(mm->buffer, vl, flags);
+}
+
+
+static void
+mm_buffer_fence(struct pb_buffer *buf,
+ struct pipe_fence_handle *fence)
+{
+ struct mm_buffer *mm_buf = mm_buffer(buf);
+ struct mm_pb_manager *mm = mm_buf->mgr;
+ pb_fence(mm->buffer, fence);
+}
+
+
static void
mm_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
@@ -141,6 +162,8 @@ mm_buffer_vtbl = {
mm_buffer_destroy,
mm_buffer_map,
mm_buffer_unmap,
+ mm_buffer_validate,
+ mm_buffer_fence,
mm_buffer_get_base_buffer
};
@@ -154,8 +177,8 @@ mm_bufmgr_create_buffer(struct pb_manager *mgr,
struct mm_buffer *mm_buf;
/* We don't handle alignments larger then the one initially setup */
- assert(desc->alignment % (1 << mm->align2) == 0);
- if(desc->alignment % (1 << mm->align2))
+ assert(pb_check_alignment(desc->alignment, 1 << mm->align2));
+ if(!pb_check_alignment(desc->alignment, 1 << mm->align2))
return NULL;
pipe_mutex_lock(mm->mutex);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
new file mode 100644
index 0000000000..ba02a84e62
--- /dev/null
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
@@ -0,0 +1,303 @@
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * A variation of malloc buffers which get transferred to real graphics memory
+ * when there is an attempt to validate them.
+ *
+ * @author Jose Fonseca <jrfonseca@tungstengraphics.com>
+ */
+
+
+#include "pipe/p_debug.h"
+#include "util/u_memory.h"
+#include "pb_buffer.h"
+#include "pb_bufmgr.h"
+
+
+struct pb_ondemand_manager;
+
+
+struct pb_ondemand_buffer
+{
+ struct pb_buffer base;
+
+ struct pb_ondemand_manager *mgr;
+
+ /** Regular malloc'ed memory */
+ void *data;
+ unsigned mapcount;
+
+ /** Real buffer */
+ struct pb_buffer *buffer;
+ size_t size;
+ struct pb_desc desc;
+};
+
+
+struct pb_ondemand_manager
+{
+ struct pb_manager base;
+
+ struct pb_manager *provider;
+};
+
+
+extern const struct pb_vtbl pb_ondemand_buffer_vtbl;
+
+static INLINE struct pb_ondemand_buffer *
+pb_ondemand_buffer(struct pb_buffer *buf)
+{
+ assert(buf);
+ assert(buf->vtbl == &pb_ondemand_buffer_vtbl);
+ return (struct pb_ondemand_buffer *)buf;
+}
+
+static INLINE struct pb_ondemand_manager *
+pb_ondemand_manager(struct pb_manager *mgr)
+{
+ assert(mgr);
+ return (struct pb_ondemand_manager *)mgr;
+}
+
+
+static void
+pb_ondemand_buffer_destroy(struct pb_buffer *_buf)
+{
+ struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
+
+ pb_reference(&buf->buffer, NULL);
+
+ align_free(buf->data);
+
+ FREE(buf);
+}
+
+
+static void *
+pb_ondemand_buffer_map(struct pb_buffer *_buf,
+ unsigned flags)
+{
+ struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
+
+ if(buf->buffer) {
+ assert(!buf->data);
+ return pb_map(buf->buffer, flags);
+ }
+ else {
+ assert(buf->data);
+ ++buf->mapcount;
+ return buf->data;
+ }
+}
+
+
+static void
+pb_ondemand_buffer_unmap(struct pb_buffer *_buf)
+{
+ struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
+
+ if(buf->buffer) {
+ assert(!buf->data);
+ pb_unmap(buf->buffer);
+ }
+ else {
+ assert(buf->data);
+ assert(buf->mapcount);
+ if(buf->mapcount)
+ --buf->mapcount;
+ }
+}
+
+
+static enum pipe_error
+pb_ondemand_buffer_instantiate(struct pb_ondemand_buffer *buf)
+{
+ if(!buf->buffer) {
+ struct pb_manager *provider = buf->mgr->provider;
+ uint8_t *map;
+
+ assert(!buf->mapcount);
+
+ buf->buffer = provider->create_buffer(provider, buf->size, &buf->desc);
+ if(!buf->buffer)
+ return PIPE_ERROR_OUT_OF_MEMORY;
+
+ map = pb_map(buf->buffer, PIPE_BUFFER_USAGE_CPU_READ);
+ if(!map) {
+ pb_reference(&buf->buffer, NULL);
+ return PIPE_ERROR;
+ }
+
+ memcpy(map, buf->data, buf->size);
+
+ pb_unmap(buf->buffer);
+
+ if(!buf->mapcount) {
+ FREE(buf->data);
+ buf->data = NULL;
+ }
+ }
+
+ return PIPE_OK;
+}
+
+static enum pipe_error
+pb_ondemand_buffer_validate(struct pb_buffer *_buf,
+ struct pb_validate *vl,
+ unsigned flags)
+{
+ struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
+ enum pipe_error ret;
+
+ assert(!buf->mapcount);
+ if(buf->mapcount)
+ return PIPE_ERROR;
+
+ ret = pb_ondemand_buffer_instantiate(buf);
+ if(ret != PIPE_OK)
+ return ret;
+
+ return pb_validate(buf->buffer, vl, flags);
+}
+
+
+static void
+pb_ondemand_buffer_fence(struct pb_buffer *_buf,
+ struct pipe_fence_handle *fence)
+{
+ struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
+
+ assert(buf->buffer);
+ if(!buf->buffer)
+ return;
+
+ pb_fence(buf->buffer, fence);
+}
+
+
+static void
+pb_ondemand_buffer_get_base_buffer(struct pb_buffer *_buf,
+ struct pb_buffer **base_buf,
+ unsigned *offset)
+{
+ struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
+
+ if(pb_ondemand_buffer_instantiate(buf) != PIPE_OK) {
+ assert(0);
+ *base_buf = &buf->base;
+ *offset = 0;
+ return;
+ }
+
+ pb_get_base_buffer(buf->buffer, base_buf, offset);
+}
+
+
+const struct pb_vtbl
+pb_ondemand_buffer_vtbl = {
+ pb_ondemand_buffer_destroy,
+ pb_ondemand_buffer_map,
+ pb_ondemand_buffer_unmap,
+ pb_ondemand_buffer_validate,
+ pb_ondemand_buffer_fence,
+ pb_ondemand_buffer_get_base_buffer
+};
+
+
+static struct pb_buffer *
+pb_ondemand_manager_create_buffer(struct pb_manager *_mgr,
+ size_t size,
+ const struct pb_desc *desc)
+{
+ struct pb_ondemand_manager *mgr = pb_ondemand_manager(_mgr);
+ struct pb_ondemand_buffer *buf;
+
+ buf = CALLOC_STRUCT(pb_ondemand_buffer);
+ if(!buf)
+ return NULL;
+
+ buf->base.base.refcount = 1;
+ buf->base.base.alignment = desc->alignment;
+ buf->base.base.usage = desc->usage;
+ buf->base.base.size = size;
+ buf->base.vtbl = &pb_ondemand_buffer_vtbl;
+
+ buf->mgr = mgr;
+
+ buf->data = align_malloc(size, desc->alignment < sizeof(void*) ? sizeof(void*) : desc->alignment);
+ if(!buf->data) {
+ FREE(buf);
+ return NULL;
+ }
+
+ buf->size = size;
+ buf->desc = *desc;
+
+ return &buf->base;
+}
+
+
+static void
+pb_ondemand_manager_flush(struct pb_manager *_mgr)
+{
+ struct pb_ondemand_manager *mgr = pb_ondemand_manager(_mgr);
+
+ mgr->provider->flush(mgr->provider);
+}
+
+
+static void
+pb_ondemand_manager_destroy(struct pb_manager *_mgr)
+{
+ struct pb_ondemand_manager *mgr = pb_ondemand_manager(_mgr);
+
+ FREE(mgr);
+}
+
+
+struct pb_manager *
+pb_ondemand_manager_create(struct pb_manager *provider)
+{
+ struct pb_ondemand_manager *mgr;
+
+ if(!provider)
+ return NULL;
+
+ mgr = CALLOC_STRUCT(pb_ondemand_manager);
+ if(!mgr)
+ return NULL;
+
+ mgr->base.destroy = pb_ondemand_manager_destroy;
+ mgr->base.create_buffer = pb_ondemand_manager_create_buffer;
+ mgr->base.flush = pb_ondemand_manager_flush;
+
+ mgr->provider = provider;
+
+ return &mgr->base;
+}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
index 61ac291ed7..a6ff37653e 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
@@ -30,7 +30,7 @@
* \file
* Batch buffer pool management.
*
- * \author José Fonseca <jrfonseca-at-tungstengraphics-dot-com>
+ * \author Jose Fonseca <jrfonseca-at-tungstengraphics-dot-com>
* \author Thomas Hellström <thomas-at-tungstengraphics-dot-com>
*/
@@ -138,6 +138,27 @@ pool_buffer_unmap(struct pb_buffer *buf)
}
+static enum pipe_error
+pool_buffer_validate(struct pb_buffer *buf,
+ struct pb_validate *vl,
+ unsigned flags)
+{
+ struct pool_buffer *pool_buf = pool_buffer(buf);
+ struct pool_pb_manager *pool = pool_buf->mgr;
+ return pb_validate(pool->buffer, vl, flags);
+}
+
+
+static void
+pool_buffer_fence(struct pb_buffer *buf,
+ struct pipe_fence_handle *fence)
+{
+ struct pool_buffer *pool_buf = pool_buffer(buf);
+ struct pool_pb_manager *pool = pool_buf->mgr;
+ pb_fence(pool->buffer, fence);
+}
+
+
static void
pool_buffer_get_base_buffer(struct pb_buffer *buf,
struct pb_buffer **base_buf,
@@ -155,6 +176,8 @@ pool_buffer_vtbl = {
pool_buffer_destroy,
pool_buffer_map,
pool_buffer_unmap,
+ pool_buffer_validate,
+ pool_buffer_fence,
pool_buffer_get_base_buffer
};
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index 2a80154920..9b9fedccb4 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -248,6 +248,25 @@ pb_slab_buffer_unmap(struct pb_buffer *_buf)
}
+static enum pipe_error
+pb_slab_buffer_validate(struct pb_buffer *_buf,
+ struct pb_validate *vl,
+ unsigned flags)
+{
+ struct pb_slab_buffer *buf = pb_slab_buffer(_buf);
+ return pb_validate(buf->slab->bo, vl, flags);
+}
+
+
+static void
+pb_slab_buffer_fence(struct pb_buffer *_buf,
+ struct pipe_fence_handle *fence)
+{
+ struct pb_slab_buffer *buf = pb_slab_buffer(_buf);
+ pb_fence(buf->slab->bo, fence);
+}
+
+
static void
pb_slab_buffer_get_base_buffer(struct pb_buffer *_buf,
struct pb_buffer **base_buf,
@@ -264,6 +283,8 @@ pb_slab_buffer_vtbl = {
pb_slab_buffer_destroy,
pb_slab_buffer_map,
pb_slab_buffer_unmap,
+ pb_slab_buffer_validate,
+ pb_slab_buffer_fence,
pb_slab_buffer_get_base_buffer
};
diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.c b/src/gallium/auxiliary/pipebuffer/pb_validate.c
index 1e54fc39d4..94532bb4ce 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_validate.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_validate.c
@@ -46,9 +46,16 @@
#define PB_VALIDATE_INITIAL_SIZE 1 /* 512 */
+struct pb_validate_entry
+{
+ struct pb_buffer *buf;
+ unsigned flags;
+};
+
+
struct pb_validate
{
- struct pb_buffer **buffers;
+ struct pb_validate_entry *entries;
unsigned used;
unsigned size;
};
@@ -56,43 +63,50 @@ struct pb_validate
enum pipe_error
pb_validate_add_buffer(struct pb_validate *vl,
- struct pb_buffer *buf)
+ struct pb_buffer *buf,
+ unsigned flags)
{
assert(buf);
if(!buf)
return PIPE_ERROR;
+ assert(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
+ assert(!(flags & ~PIPE_BUFFER_USAGE_GPU_READ_WRITE));
+ flags &= PIPE_BUFFER_USAGE_GPU_READ_WRITE;
+
/* We only need to store one reference for each buffer, so avoid storing
- * consecutive references for the same buffer. It might not be the more
- * common pasttern, but it is easy to implement.
+ * consecutive references for the same buffer. It might not be the most
+ * common pattern, but it is easy to implement.
*/
- if(vl->used && vl->buffers[vl->used - 1] == buf) {
+ if(vl->used && vl->entries[vl->used - 1].buf == buf) {
+ vl->entries[vl->used - 1].flags |= flags;
return PIPE_OK;
}
/* Grow the table */
if(vl->used == vl->size) {
unsigned new_size;
- struct pb_buffer **new_buffers;
+ struct pb_validate_entry *new_entries;
new_size = vl->size * 2;
if(!new_size)
return PIPE_ERROR_OUT_OF_MEMORY;
- new_buffers = (struct pb_buffer **)REALLOC(vl->buffers,
- vl->size*sizeof(struct pb_buffer *),
- new_size*sizeof(struct pb_buffer *));
- if(!new_buffers)
+ new_entries = (struct pb_validate_entry *)REALLOC(vl->entries,
+ vl->size*sizeof(struct pb_validate_entry),
+ new_size*sizeof(struct pb_validate_entry));
+ if(!new_entries)
return PIPE_ERROR_OUT_OF_MEMORY;
- memset(new_buffers + vl->size, 0, (new_size - vl->size)*sizeof(struct pb_buffer *));
+ memset(new_entries + vl->size, 0, (new_size - vl->size)*sizeof(struct pb_validate_entry));
vl->size = new_size;
- vl->buffers = new_buffers;
+ vl->entries = new_entries;
}
- assert(!vl->buffers[vl->used]);
- pb_reference(&vl->buffers[vl->used], buf);
+ assert(!vl->entries[vl->used].buf);
+ pb_reference(&vl->entries[vl->used].buf, buf);
+ vl->entries[vl->used].flags = flags;
++vl->used;
return PIPE_OK;
@@ -100,10 +114,36 @@ pb_validate_add_buffer(struct pb_validate *vl,
enum pipe_error
+pb_validate_foreach(struct pb_validate *vl,
+ enum pipe_error (*callback)(struct pb_buffer *buf, void *data),
+ void *data)
+{
+ unsigned i;
+ for(i = 0; i < vl->used; ++i) {
+ enum pipe_error ret;
+ ret = callback(vl->entries[i].buf, data);
+ if(ret != PIPE_OK)
+ return ret;
+ }
+ return PIPE_OK;
+}
+
+
+enum pipe_error
pb_validate_validate(struct pb_validate *vl)
{
- /* FIXME: go through each buffer, ensure its not mapped, its address is
- * available -- requires a new pb_buffer interface */
+ unsigned i;
+
+ for(i = 0; i < vl->used; ++i) {
+ enum pipe_error ret;
+ ret = pb_validate(vl->entries[i].buf, vl, vl->entries[i].flags);
+ if(ret != PIPE_OK) {
+ while(i--)
+ pb_validate(vl->entries[i].buf, NULL, 0);
+ return ret;
+ }
+ }
+
return PIPE_OK;
}
@@ -114,8 +154,8 @@ pb_validate_fence(struct pb_validate *vl,
{
unsigned i;
for(i = 0; i < vl->used; ++i) {
- buffer_fence(vl->buffers[i], fence);
- pb_reference(&vl->buffers[i], NULL);
+ pb_fence(vl->entries[i].buf, fence);
+ pb_reference(&vl->entries[i].buf, NULL);
}
vl->used = 0;
}
@@ -126,8 +166,8 @@ pb_validate_destroy(struct pb_validate *vl)
{
unsigned i;
for(i = 0; i < vl->used; ++i)
- pb_reference(&vl->buffers[i], NULL);
- FREE(vl->buffers);
+ pb_reference(&vl->entries[i].buf, NULL);
+ FREE(vl->entries);
FREE(vl);
}
@@ -142,8 +182,8 @@ pb_validate_create()
return NULL;
vl->size = PB_VALIDATE_INITIAL_SIZE;
- vl->buffers = (struct pb_buffer **)CALLOC(vl->size, sizeof(struct pb_buffer *));
- if(!vl->buffers) {
+ vl->entries = (struct pb_validate_entry *)CALLOC(vl->size, sizeof(struct pb_validate_entry));
+ if(!vl->entries) {
FREE(vl);
return NULL;
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.h b/src/gallium/auxiliary/pipebuffer/pb_validate.h
index 3db1d5330b..dfb84df1ce 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_validate.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_validate.h
@@ -58,7 +58,13 @@ struct pb_validate;
enum pipe_error
pb_validate_add_buffer(struct pb_validate *vl,
- struct pb_buffer *buf);
+ struct pb_buffer *buf,
+ unsigned flags);
+
+enum pipe_error
+pb_validate_foreach(struct pb_validate *vl,
+ enum pipe_error (*callback)(struct pb_buffer *buf, void *data),
+ void *data);
/**
* Validate all buffers for hardware access.
@@ -71,7 +77,7 @@ pb_validate_validate(struct pb_validate *vl);
/**
* Fence all buffers and clear the list.
*
- * Should be called right before issuing commands to the hardware.
+ * Should be called right after issuing commands to the hardware.
*/
void
pb_validate_fence(struct pb_validate *vl,
diff --git a/src/gallium/auxiliary/pipebuffer/pb_winsys.c b/src/gallium/auxiliary/pipebuffer/pb_winsys.c
deleted file mode 100644
index 28d137dbc4..0000000000
--- a/src/gallium/auxiliary/pipebuffer/pb_winsys.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
- *
- **************************************************************************/
-
-/**
- * \file
- * Implementation of client buffer (also designated as "user buffers"), which
- * are just state-tracker owned data masqueraded as buffers.
- *
- * \author José Fonseca <jrfonseca@tungstengraphics.com>
- */
-
-
-#include "pipe/p_winsys.h"
-#include "util/u_memory.h"
-
-#include "pb_buffer.h"
-
-
-/**
- * User buffers are special buffers that initially reference memory
- * held by the user but which may if necessary copy that memory into
- * device memory behind the scenes, for submission to hardware.
- *
- * These are particularly useful when the referenced data is never
- * submitted to hardware at all, in the particular case of software
- * vertex processing.
- */
-struct pb_user_buffer
-{
- struct pb_buffer base;
- void *data;
-};
-
-
-extern const struct pb_vtbl pb_user_buffer_vtbl;
-
-
-static INLINE struct pb_user_buffer *
-pb_user_buffer(struct pb_buffer *buf)
-{
- assert(buf);
- assert(buf->vtbl == &pb_user_buffer_vtbl);
- return (struct pb_user_buffer *)buf;
-}
-
-
-static void
-pb_user_buffer_destroy(struct pb_buffer *buf)
-{
- assert(buf);
- FREE(buf);
-}
-
-
-static void *
-pb_user_buffer_map(struct pb_buffer *buf,
- unsigned flags)
-{
- return pb_user_buffer(buf)->data;
-}
-
-
-static void
-pb_user_buffer_unmap(struct pb_buffer *buf)
-{
- /* No-op */
-}
-
-
-static void
-pb_user_buffer_get_base_buffer(struct pb_buffer *buf,
- struct pb_buffer **base_buf,
- unsigned *offset)
-{
- *base_buf = buf;
- *offset = 0;
-}
-
-
-const struct pb_vtbl
-pb_user_buffer_vtbl = {
- pb_user_buffer_destroy,
- pb_user_buffer_map,
- pb_user_buffer_unmap,
- pb_user_buffer_get_base_buffer
-};
-
-
-static struct pipe_buffer *
-pb_winsys_user_buffer_create(struct pipe_winsys *winsys,
- void *data,
- unsigned bytes)
-{
- struct pb_user_buffer *buf = CALLOC_STRUCT(pb_user_buffer);
-
- if(!buf)
- return NULL;
-
- buf->base.base.refcount = 1;
- buf->base.base.size = bytes;
- buf->base.base.alignment = 0;
- buf->base.base.usage = 0;
-
- buf->base.vtbl = &pb_user_buffer_vtbl;
- buf->data = data;
-
- return &buf->base.base;
-}
-
-
-static void *
-pb_winsys_buffer_map(struct pipe_winsys *winsys,
- struct pipe_buffer *buf,
- unsigned flags)
-{
- (void)winsys;
- return pb_map(pb_buffer(buf), flags);
-}
-
-
-static void
-pb_winsys_buffer_unmap(struct pipe_winsys *winsys,
- struct pipe_buffer *buf)
-{
- (void)winsys;
- pb_unmap(pb_buffer(buf));
-}
-
-
-static void
-pb_winsys_buffer_destroy(struct pipe_winsys *winsys,
- struct pipe_buffer *buf)
-{
- (void)winsys;
- pb_destroy(pb_buffer(buf));
-}
-
-
-void
-pb_init_winsys(struct pipe_winsys *winsys)
-{
- winsys->user_buffer_create = pb_winsys_user_buffer_create;
- winsys->buffer_map = pb_winsys_buffer_map;
- winsys->buffer_unmap = pb_winsys_buffer_unmap;
- winsys->buffer_destroy = pb_winsys_buffer_destroy;
-}
diff --git a/src/gallium/auxiliary/util/Makefile b/src/gallium/auxiliary/util/Makefile
index 6773ed73cf..44c2377721 100644
--- a/src/gallium/auxiliary/util/Makefile
+++ b/src/gallium/auxiliary/util/Makefile
@@ -23,7 +23,8 @@ C_SOURCES = \
u_stream_wd.c \
u_tile.c \
u_time.c \
- u_timed_winsys.c
+ u_timed_winsys.c \
+ u_simple_screen.c
include ../../Makefile.template
diff --git a/src/gallium/auxiliary/util/SConscript b/src/gallium/auxiliary/util/SConscript
index 5df932c0f7..35f683fb8e 100644
--- a/src/gallium/auxiliary/util/SConscript
+++ b/src/gallium/auxiliary/util/SConscript
@@ -24,6 +24,7 @@ util = env.ConvenienceLibrary(
'u_tile.c',
'u_time.c',
'u_timed_winsys.c',
+ 'u_simple_screen.c',
])
auxiliaries.insert(0, util)
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index 2cef3338b5..841e9c01e7 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -37,7 +37,6 @@
#include "pipe/p_debug.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_blit.h"
@@ -415,7 +414,7 @@ util_blit_pixels(struct blit_state *ctx,
memset(&fb, 0, sizeof(fb));
fb.width = dst->width;
fb.height = dst->height;
- fb.num_cbufs = 1;
+ fb.nr_cbufs = 1;
fb.cbufs[0] = dst;
cso_set_framebuffer(ctx->cso, &fb);
@@ -526,7 +525,7 @@ util_blit_pixels_tex(struct blit_state *ctx,
memset(&fb, 0, sizeof(fb));
fb.width = dst->width;
fb.height = dst->height;
- fb.num_cbufs = 1;
+ fb.nr_cbufs = 1;
fb.cbufs[0] = dst;
cso_set_framebuffer(ctx->cso, &fb);
diff --git a/src/gallium/auxiliary/util/u_draw_quad.c b/src/gallium/auxiliary/util/u_draw_quad.c
index d7bb74b87b..f282f3d289 100644
--- a/src/gallium/auxiliary/util/u_draw_quad.c
+++ b/src/gallium/auxiliary/util/u_draw_quad.c
@@ -29,7 +29,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#include "util/u_draw_quad.h"
@@ -53,7 +52,7 @@ util_draw_vertex_buffer(struct pipe_context *pipe,
/* tell pipe about the vertex buffer */
vbuffer.buffer = vbuf;
- vbuffer.pitch = num_attribs * 4 * sizeof(float); /* vertex size */
+ vbuffer.stride = num_attribs * 4 * sizeof(float); /* vertex size */
vbuffer.buffer_offset = offset;
pipe->set_vertex_buffers(pipe, 1, &vbuffer);
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index b5eb896b7a..301a58ed7b 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -38,7 +38,6 @@
#include "pipe/p_debug.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_memory.h"
@@ -1490,7 +1489,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx,
/* init framebuffer state */
memset(&fb, 0, sizeof(fb));
- fb.num_cbufs = 1;
+ fb.nr_cbufs = 1;
/* set min/mag to same filter for faster sw speed */
ctx->sampler.mag_img_filter = filter;
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index aa4fa17b59..ab6f39ac31 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -341,6 +341,10 @@ unsigned ffs( unsigned u )
}
#endif
+#ifdef __MINGW32__
+#define ffs __builtin_ffs
+#endif
+
/**
* Return float bits.
diff --git a/src/gallium/auxiliary/util/u_simple_screen.c b/src/gallium/auxiliary/util/u_simple_screen.c
new file mode 100644
index 0000000000..089bbbc48a
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_simple_screen.c
@@ -0,0 +1,143 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ *
+ **************************************************************************/
+
+#include "u_simple_screen.h"
+
+#include "pipe/p_screen.h"
+#include "pipe/internal/p_winsys_screen.h"
+
+
+static struct pipe_buffer *
+pass_buffer_create(struct pipe_screen *screen,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size)
+{
+ return screen->winsys->buffer_create(screen->winsys,
+ alignment, usage, size);
+}
+
+static struct pipe_buffer *
+pass_user_buffer_create(struct pipe_screen *screen,
+ void *ptr,
+ unsigned bytes)
+{
+ return screen->winsys->user_buffer_create(screen->winsys,
+ ptr, bytes);
+}
+
+static struct pipe_buffer *
+pass_surface_buffer_create(struct pipe_screen *screen,
+ unsigned width, unsigned height,
+ enum pipe_format format,
+ unsigned usage,
+ unsigned *stride)
+{
+ return screen->winsys->surface_buffer_create(screen->winsys,
+ width, height,
+ format, usage, stride);
+}
+
+static void *
+pass_buffer_map(struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned usage)
+{
+ return screen->winsys->buffer_map(screen->winsys,
+ buf, usage);
+}
+
+static void
+pass_buffer_unmap(struct pipe_screen *screen,
+ struct pipe_buffer *buf)
+{
+ screen->winsys->buffer_unmap(screen->winsys, buf);
+}
+
+static void
+pass_buffer_destroy(struct pipe_screen *screen,
+ struct pipe_buffer *buf)
+{
+ screen->winsys->buffer_destroy(screen->winsys, buf);
+}
+
+
+static void
+pass_flush_frontbuffer(struct pipe_screen *screen,
+ struct pipe_surface *surf,
+ void *context_private)
+{
+ screen->winsys->flush_frontbuffer(screen->winsys,
+ surf, context_private);
+}
+
+static void
+pass_fence_reference(struct pipe_screen *screen,
+ struct pipe_fence_handle **ptr,
+ struct pipe_fence_handle *fence)
+{
+ screen->winsys->fence_reference(screen->winsys,
+ ptr, fence);
+}
+
+static int
+pass_fence_signalled(struct pipe_screen *screen,
+ struct pipe_fence_handle *fence,
+ unsigned flag)
+{
+ return screen->winsys->fence_signalled(screen->winsys,
+ fence, flag);
+}
+
+static int
+pass_fence_finish(struct pipe_screen *screen,
+ struct pipe_fence_handle *fence,
+ unsigned flag)
+{
+ return screen->winsys->fence_finish(screen->winsys,
+ fence, flag);
+}
+
+void u_simple_screen_init(struct pipe_screen *screen)
+{
+ screen->buffer_create = pass_buffer_create;
+ screen->user_buffer_create = pass_user_buffer_create;
+ screen->surface_buffer_create = pass_surface_buffer_create;
+
+ screen->buffer_map = pass_buffer_map;
+ screen->buffer_unmap = pass_buffer_unmap;
+ screen->buffer_destroy = pass_buffer_destroy;
+ screen->flush_frontbuffer = pass_flush_frontbuffer;
+ screen->fence_reference = pass_fence_reference;
+ screen->fence_signalled = pass_fence_signalled;
+ screen->fence_finish = pass_fence_finish;
+}
+
+const char* u_simple_screen_winsys_name(struct pipe_screen *screen)
+{
+ return screen->winsys->get_name(screen->winsys);
+}
diff --git a/src/gallium/auxiliary/util/u_simple_screen.h b/src/gallium/auxiliary/util/u_simple_screen.h
new file mode 100644
index 0000000000..6612a8a7c0
--- /dev/null
+++ b/src/gallium/auxiliary/util/u_simple_screen.h
@@ -0,0 +1,47 @@
+/**************************************************************************
+ *
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ *
+ **************************************************************************/
+
+#ifndef U_SIMPLE_SCREEN_H
+#define U_SIMPLE_SCREEN_H
+
+struct pipe_screen;
+struct pipe_winsys;
+
+/**
+ * The following function initializes a simple passthrough screen.
+ *
+ * All the relevant screen function pointers will forwarded to the
+ * winsys.
+ */
+void u_simple_screen_init(struct pipe_screen *screen);
+
+/**
+ * Returns the name of the winsys associated with this screen.
+ */
+const char* u_simple_screen_winsys_name(struct pipe_screen *screen);
+
+#endif
diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c
index f06d13c2c4..706155e99a 100644
--- a/src/gallium/auxiliary/util/u_simple_shaders.c
+++ b/src/gallium/auxiliary/util/u_simple_shaders.c
@@ -37,7 +37,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/p_screen.h"
#include "pipe/p_shader_tokens.h"
#include "util/u_memory.h"
diff --git a/src/gallium/auxiliary/util/u_timed_winsys.c b/src/gallium/auxiliary/util/u_timed_winsys.c
index dc3c9be595..f237e12d73 100644
--- a/src/gallium/auxiliary/util/u_timed_winsys.c
+++ b/src/gallium/auxiliary/util/u_timed_winsys.c
@@ -29,7 +29,7 @@
* Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
*/
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "u_timed_winsys.h"
#include "util/u_memory.h"
#include "util/u_time.h"
@@ -121,7 +121,8 @@ timed_buffer_create(struct pipe_winsys *winsys,
struct pipe_winsys *backend = timed_winsys(winsys)->backend;
uint64_t start = time_start();
- struct pipe_buffer *buf = backend->buffer_create( backend, alignment, usage, size );
+ struct pipe_buffer *buf =
+ backend->buffer_create( backend, alignment, usage, size );
time_finish(winsys, start, 0, __FUNCTION__);
@@ -300,9 +301,9 @@ struct pipe_winsys *u_timed_winsys_create( struct pipe_winsys *backend )
ws->base.buffer_unmap = timed_buffer_unmap;
ws->base.buffer_destroy = timed_buffer_destroy;
ws->base.buffer_create = timed_buffer_create;
+ ws->base.surface_buffer_create = timed_surface_buffer_create;
ws->base.flush_frontbuffer = timed_flush_frontbuffer;
ws->base.get_name = timed_get_name;
- ws->base.surface_buffer_create = timed_surface_buffer_create;
ws->base.fence_reference = timed_fence_reference;
ws->base.fence_signalled = timed_fence_signalled;
ws->base.fence_finish = timed_fence_finish;
diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c
index 8f502823f9..ae82ded334 100644
--- a/src/gallium/drivers/cell/ppu/cell_context.c
+++ b/src/gallium/drivers/cell/ppu/cell_context.c
@@ -36,7 +36,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_format.h"
#include "util/u_memory.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_screen.h"
#include "draw/draw_context.h"
diff --git a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
index 880d535320..67949b73dd 100644
--- a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
+++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c
@@ -33,7 +33,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "cell_context.h"
@@ -53,7 +53,7 @@ cell_map_constant_buffers(struct cell_context *sp)
for (i = 0; i < 2; i++) {
if (sp->constants[i].size) {
sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ PIPE_BUFFER_USAGE_CPU_READ);
cell_flush_buffer_range(sp, sp->mapped_constants[i],
sp->constants[i].buffer->size);
}
diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
index 0ea8f017ef..9bdc71b676 100644
--- a/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_gen_fragment.c
@@ -1187,7 +1187,7 @@ gen_stencil_test(struct spe_function *f,
*/
switch (state->func) {
case PIPE_FUNC_EQUAL:
- if (state->value_mask == stencil_max_value) {
+ if (state->valuemask == stencil_max_value) {
/* stencil_pass = fragment_mask & (s == reference) */
spe_compare_equal_uint(f, stencil_pass_reg, fbS_reg, state->ref_value);
spe_and(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
@@ -1195,16 +1195,16 @@ gen_stencil_test(struct spe_function *f,
else {
/* stencil_pass = fragment_mask & ((s&mask) == (reference&mask)) */
uint tmp_masked_stencil = spe_allocate_available_register(f);
- spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
+ spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->valuemask);
spe_compare_equal_uint(f, stencil_pass_reg, tmp_masked_stencil,
- state->value_mask & state->ref_value);
+ state->valuemask & state->ref_value);
spe_and(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_masked_stencil);
}
break;
case PIPE_FUNC_NOTEQUAL:
- if (state->value_mask == stencil_max_value) {
+ if (state->valuemask == stencil_max_value) {
/* stencil_pass = fragment_mask & ~(s == reference) */
spe_compare_equal_uint(f, stencil_pass_reg, fbS_reg, state->ref_value);
spe_andc(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
@@ -1212,16 +1212,16 @@ gen_stencil_test(struct spe_function *f,
else {
/* stencil_pass = fragment_mask & ~((s&mask) == (reference&mask)) */
int tmp_masked_stencil = spe_allocate_available_register(f);
- spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
+ spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->valuemask);
spe_compare_equal_uint(f, stencil_pass_reg, tmp_masked_stencil,
- state->value_mask & state->ref_value);
+ state->valuemask & state->ref_value);
spe_andc(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_masked_stencil);
}
break;
case PIPE_FUNC_LESS:
- if (state->value_mask == stencil_max_value) {
+ if (state->valuemask == stencil_max_value) {
/* stencil_pass = fragment_mask & (reference < s) */
spe_compare_greater_uint(f, stencil_pass_reg, fbS_reg, state->ref_value);
spe_and(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
@@ -1229,16 +1229,16 @@ gen_stencil_test(struct spe_function *f,
else {
/* stencil_pass = fragment_mask & ((reference&mask) < (s & mask)) */
int tmp_masked_stencil = spe_allocate_available_register(f);
- spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
+ spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->valuemask);
spe_compare_greater_uint(f, stencil_pass_reg, tmp_masked_stencil,
- state->value_mask & state->ref_value);
+ state->valuemask & state->ref_value);
spe_and(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_masked_stencil);
}
break;
case PIPE_FUNC_GREATER:
- if (state->value_mask == stencil_max_value) {
+ if (state->valuemask == stencil_max_value) {
/* stencil_pass = fragment_mask & (reference > s) */
/* There's no convenient Compare Less Than Immediate instruction, so
* we'll have to do this one the harder way, by loading a register and
@@ -1255,8 +1255,8 @@ gen_stencil_test(struct spe_function *f,
/* stencil_pass = fragment_mask & ((reference&mask) > (s&mask)) */
int tmp_reg = spe_allocate_available_register(f);
int tmp_masked_stencil = spe_allocate_available_register(f);
- spe_load_uint(f, tmp_reg, state->value_mask & state->ref_value);
- spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
+ spe_load_uint(f, tmp_reg, state->valuemask & state->ref_value);
+ spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->valuemask);
spe_clgt(f, stencil_pass_reg, tmp_reg, tmp_masked_stencil);
spe_and(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_reg);
@@ -1265,7 +1265,7 @@ gen_stencil_test(struct spe_function *f,
break;
case PIPE_FUNC_GEQUAL:
- if (state->value_mask == stencil_max_value) {
+ if (state->valuemask == stencil_max_value) {
/* stencil_pass = fragment_mask & (reference >= s)
* = fragment_mask & ~(s > reference) */
spe_compare_greater_uint(f, stencil_pass_reg, fbS_reg,
@@ -1275,16 +1275,16 @@ gen_stencil_test(struct spe_function *f,
else {
/* stencil_pass = fragment_mask & ~((s&mask) > (reference&mask)) */
int tmp_masked_stencil = spe_allocate_available_register(f);
- spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
+ spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->valuemask);
spe_compare_greater_uint(f, stencil_pass_reg, tmp_masked_stencil,
- state->value_mask & state->ref_value);
+ state->valuemask & state->ref_value);
spe_andc(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_masked_stencil);
}
break;
case PIPE_FUNC_LEQUAL:
- if (state->value_mask == stencil_max_value) {
+ if (state->valuemask == stencil_max_value) {
/* stencil_pass = fragment_mask & (reference <= s) ]
* = fragment_mask & ~(reference > s) */
/* As above, we have to do this by loading a register */
@@ -1298,8 +1298,8 @@ gen_stencil_test(struct spe_function *f,
/* stencil_pass = fragment_mask & ~((reference&mask) > (s&mask)) */
int tmp_reg = spe_allocate_available_register(f);
int tmp_masked_stencil = spe_allocate_available_register(f);
- spe_load_uint(f, tmp_reg, state->ref_value & state->value_mask);
- spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->value_mask);
+ spe_load_uint(f, tmp_reg, state->ref_value & state->valuemask);
+ spe_and_uint(f, tmp_masked_stencil, fbS_reg, state->valuemask);
spe_clgt(f, stencil_pass_reg, tmp_reg, tmp_masked_stencil);
spe_andc(f, stencil_pass_reg, fragment_mask_reg, stencil_pass_reg);
spe_release_register(f, tmp_reg);
@@ -1600,14 +1600,14 @@ gen_stencil_depth_test(struct spe_function *f,
need_to_calculate_stencil_values = FALSE;
need_to_writemask_stencil_values = FALSE;
}
- else if (stencil->write_mask == 0x0) {
+ else if (stencil->writemask == 0x0) {
/* All changes are writemasked out, so no need to calculate
* what those changes might be, and no need to write anything back.
*/
need_to_calculate_stencil_values = FALSE;
need_to_writemask_stencil_values = FALSE;
}
- else if (stencil->write_mask == 0xff) {
+ else if (stencil->writemask == 0xff) {
/* Still trivial, but a little less so. We need to write the stencil
* values, but we don't need to mask them.
*/
@@ -1627,7 +1627,7 @@ gen_stencil_depth_test(struct spe_function *f,
*/
spe_comment(f, 0, "Computing stencil writemask");
stencil_writemask_reg = spe_allocate_available_register(f);
- spe_load_uint(f, stencil_writemask_reg, dsa->stencil[facing].write_mask);
+ spe_load_uint(f, stencil_writemask_reg, dsa->stencil[facing].writemask);
}
/* At least one-sided stenciling must be on. Generate code that
diff --git a/src/gallium/drivers/cell/ppu/cell_pipe_state.c b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
index 81efd137c7..ca358ed031 100644
--- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c
+++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c
@@ -307,7 +307,7 @@ cell_set_framebuffer_state(struct pipe_context *pipe,
*/
cell->framebuffer.width = fb->width;
cell->framebuffer.height = fb->height;
- cell->framebuffer.num_cbufs = fb->num_cbufs;
+ cell->framebuffer.nr_cbufs = fb->nr_cbufs;
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
pipe_surface_reference(&cell->framebuffer.cbufs[i], fb->cbufs[i]);
}
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c
index 6fc2257e2a..512d85d352 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.c
+++ b/src/gallium/drivers/cell/ppu/cell_screen.c
@@ -27,7 +27,8 @@
#include "util/u_memory.h"
-#include "pipe/p_winsys.h"
+#include "util/u_simple_screen.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
@@ -169,6 +170,7 @@ cell_create_screen(struct pipe_winsys *winsys)
screen->is_format_supported = cell_is_format_supported;
cell_init_screen_texture_funcs(screen);
+ u_simple_screen_init(screen);
return screen;
}
diff --git a/src/gallium/drivers/cell/ppu/cell_state_per_fragment.c b/src/gallium/drivers/cell/ppu/cell_state_per_fragment.c
index 78cb446c14..d97c22b2ef 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_per_fragment.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_per_fragment.c
@@ -297,7 +297,7 @@ emit_stencil_test(struct pipe_depth_stencil_alpha_state *dsa,
int face_stencil = spe_allocate_available_register(f);
int stencil_src = stencil;
const unsigned ref = (dsa->stencil[face].ref_value
- & dsa->stencil[face].value_mask);
+ & dsa->stencil[face].valuemask);
boolean complement = FALSE;
int stored;
int tmp = spe_allocate_available_register(f);
@@ -305,9 +305,9 @@ emit_stencil_test(struct pipe_depth_stencil_alpha_state *dsa,
if ((dsa->stencil[face].func != PIPE_FUNC_NEVER)
&& (dsa->stencil[face].func != PIPE_FUNC_ALWAYS)
- && (dsa->stencil[face].value_mask != 0x0ff)) {
+ && (dsa->stencil[face].valuemask != 0x0ff)) {
stored = spe_allocate_available_register(f);
- spe_andi(f, stored, stencil, dsa->stencil[face].value_mask);
+ spe_andi(f, stored, stencil, dsa->stencil[face].valuemask);
} else {
stored = stencil;
}
@@ -395,7 +395,7 @@ emit_stencil_test(struct pipe_depth_stencil_alpha_state *dsa,
* - For depth-pass if the stencil test is NEVER
* - Any of the 3 conditions if the operation is KEEP
*/
- if (dsa->stencil[face].write_mask != 0) {
+ if (dsa->stencil[face].writemask != 0) {
if ((dsa->stencil[face].func != PIPE_FUNC_ALWAYS)
&& (dsa->stencil[face].fail_op != PIPE_STENCIL_OP_KEEP)) {
if (complement) {
@@ -449,10 +449,10 @@ emit_stencil_test(struct pipe_depth_stencil_alpha_state *dsa,
*/
if (stencil_src == stencil) {
spe_release_register(f, face_stencil);
- } else if (dsa->stencil[face].write_mask != 0x0ff) {
+ } else if (dsa->stencil[face].writemask != 0x0ff) {
int tmp = spe_allocate_available_register(f);
- spe_il(f, tmp, dsa->stencil[face].write_mask);
+ spe_il(f, tmp, dsa->stencil[face].writemask);
spe_selb(f, stencil_src, stencil, stencil_src, tmp);
spe_release_register(f, tmp);
@@ -580,8 +580,8 @@ cell_generate_depth_stencil_test(struct cell_depth_stencil_alpha_state *cdsa)
dsa->stencil[i].zpass_op);
printf("# ref value / value mask / write mask: %02x %02x %02x\n",
dsa->stencil[i].ref_value,
- dsa->stencil[i].value_mask,
- dsa->stencil[i].write_mask);
+ dsa->stencil[i].valuemask,
+ dsa->stencil[i].writemask);
}
printf("\t.text\n");
diff --git a/src/gallium/drivers/cell/ppu/cell_state_shader.c b/src/gallium/drivers/cell/ppu/cell_state_shader.c
index cda39f8d59..990f23e170 100644
--- a/src/gallium/drivers/cell/ppu/cell_state_shader.c
+++ b/src/gallium/drivers/cell/ppu/cell_state_shader.c
@@ -28,7 +28,7 @@
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_parse.h"
@@ -194,9 +194,9 @@ cell_set_constant_buffer(struct pipe_context *pipe,
draw_flush(cell->draw);
/* note: reference counting */
- winsys_buffer_reference(ws,
- &cell->constants[shader].buffer,
- buf->buffer);
+ pipe_buffer_reference(pipe->screen,
+ &cell->constants[shader].buffer,
+ buf->buffer);
cell->constants[shader].size = buf->size;
if (shader == PIPE_SHADER_VERTEX)
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c
index 9f83ab8fa4..4f16e2c6af 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -34,7 +34,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -113,7 +113,7 @@ cell_texture_create(struct pipe_screen *screen,
cell_texture_layout(ct);
ct->buffer = ws->buffer_create(ws, 32, PIPE_BUFFER_USAGE_PIXEL,
- ct->buffer_size);
+ ct->buffer_size);
if (!ct->buffer) {
FREE(ct);
@@ -154,7 +154,7 @@ cell_texture_release(struct pipe_screen *screen,
*/
if (ct->tiled_buffer[i]) {
ct->tiled_mapped[i] = NULL;
- winsys_buffer_reference(screen->winsys, &ct->tiled_buffer[i], NULL);
+ pipe_buffer_reference(screen, &ct->tiled_buffer[i], NULL);
}
}
@@ -325,11 +325,11 @@ cell_twiddle_texture(struct pipe_screen *screen,
struct pipe_winsys *ws = screen->winsys;
uint bytes = bufWidth * bufHeight * 4 * numFaces;
ct->tiled_buffer[level] = ws->buffer_create(ws, 16,
- PIPE_BUFFER_USAGE_PIXEL,
- bytes);
+ PIPE_BUFFER_USAGE_PIXEL,
+ bytes);
/* and map it */
ct->tiled_mapped[level] = ws->buffer_map(ws, ct->tiled_buffer[level],
- PIPE_BUFFER_USAGE_GPU_READ);
+ PIPE_BUFFER_USAGE_GPU_READ);
}
dst = (uint *) ((ubyte *) ct->tiled_mapped[level] + offset);
@@ -406,7 +406,7 @@ cell_get_tex_surface(struct pipe_screen *screen,
if (ps) {
assert(ps->refcount);
assert(ps->winsys);
- winsys_buffer_reference(ws, &ps->buffer, ct->buffer);
+ pipe_buffer_reference(screen, &ps->buffer, ct->buffer);
ps->format = pt->format;
ps->block = pt->block;
ps->width = pt->width[level];
diff --git a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
index 2b10c116fa..403cf6d50f 100644
--- a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
+++ b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c
@@ -31,7 +31,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "cell_context.h"
diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c
index 10c4ffc209..0742b27b8f 100644
--- a/src/gallium/drivers/failover/fo_context.c
+++ b/src/gallium/drivers/failover/fo_context.c
@@ -27,7 +27,7 @@
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
#include "pipe/p_context.h"
diff --git a/src/gallium/drivers/i915simple/i915_batch.h b/src/gallium/drivers/i915simple/i915_batch.h
index 45bf4f4028..a433cf054d 100644
--- a/src/gallium/drivers/i915simple/i915_batch.h
+++ b/src/gallium/drivers/i915simple/i915_batch.h
@@ -108,7 +108,7 @@ i915_batchbuffer_flush( struct i915_batchbuffer *batch,
#define OUT_RELOC( buf, flags, delta ) \
i915_batchbuffer_reloc( i915->batch, buf, flags, delta )
-#define FLUSH_BATCH(fence) do { \
+#define FLUSH_BATCH(fence) do { \
i915->winsys->batch_flush( i915->winsys, fence ); \
i915->hardware_dirty = ~0; \
} while (0)
diff --git a/src/gallium/drivers/i915simple/i915_blit.c b/src/gallium/drivers/i915simple/i915_blit.c
index 45fae4c999..448a4708ce 100644
--- a/src/gallium/drivers/i915simple/i915_blit.c
+++ b/src/gallium/drivers/i915simple/i915_blit.c
@@ -38,7 +38,7 @@
void
i915_fill_blit(struct i915_context *i915,
unsigned cpp,
- short dst_pitch,
+ unsigned short dst_pitch,
struct pipe_buffer *dst_buffer,
unsigned dst_offset,
short x, short y,
@@ -47,15 +47,23 @@ i915_fill_blit(struct i915_context *i915,
{
unsigned BR13, CMD;
+
+ I915_DBG(i915,
+ "%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
+ __FUNCTION__,
+ dst_buffer, dst_pitch, dst_offset, x, y, w, h);
+
switch (cpp) {
case 1:
case 2:
case 3:
- BR13 = dst_pitch | (0xF0 << 16) | (1 << 24);
+ BR13 = (((int) dst_pitch) & 0xffff) |
+ (0xF0 << 16) | (1 << 24);
CMD = XY_COLOR_BLT_CMD;
break;
case 4:
- BR13 = dst_pitch | (0xF0 << 16) | (1 << 24) | (1 << 25);
+ BR13 = (((int) dst_pitch) & 0xffff) |
+ (0xF0 << 16) | (1 << 24) | (1 << 25);
CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA |
XY_COLOR_BLT_WRITE_RGB);
break;
@@ -63,10 +71,6 @@ i915_fill_blit(struct i915_context *i915,
return;
}
-// DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
-// __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h);
-
-
if (!BEGIN_BATCH(6, 1)) {
FLUSH_BATCH(NULL);
assert(BEGIN_BATCH(6, 1));
@@ -77,6 +81,7 @@ i915_fill_blit(struct i915_context *i915,
OUT_BATCH(((y + h) << 16) | (x + w));
OUT_RELOC( dst_buffer, I915_BUFFER_ACCESS_WRITE, dst_offset);
OUT_BATCH(color);
+ FLUSH_BATCH(NULL);
}
@@ -84,10 +89,10 @@ void
i915_copy_blit( struct i915_context *i915,
unsigned do_flip,
unsigned cpp,
- short src_pitch,
+ unsigned short src_pitch,
struct pipe_buffer *src_buffer,
unsigned src_offset,
- short dst_pitch,
+ unsigned short dst_pitch,
struct pipe_buffer *dst_buffer,
unsigned dst_offset,
short src_x, short src_y,
@@ -105,20 +110,16 @@ i915_copy_blit( struct i915_context *i915,
src_buffer, src_pitch, src_offset, src_x, src_y,
dst_buffer, dst_pitch, dst_offset, dst_x, dst_y, w, h);
- src_pitch *= (short) cpp;
- dst_pitch *= (short) cpp;
-
switch (cpp) {
case 1:
case 2:
case 3:
- BR13 = (((int) dst_pitch) & 0xffff) |
+ BR13 = (((int) dst_pitch) & 0xffff) |
(0xCC << 16) | (1 << 24);
CMD = XY_SRC_COPY_BLT_CMD;
break;
case 4:
- BR13 =
- (((int) dst_pitch) & 0xffff) |
+ BR13 = (((int) dst_pitch) & 0xffff) |
(0xCC << 16) | (1 << 24) | (1 << 25);
CMD =
(XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
@@ -152,6 +153,7 @@ i915_copy_blit( struct i915_context *i915,
OUT_BATCH((src_y << 16) | src_x);
OUT_BATCH(((int) src_pitch & 0xffff));
OUT_RELOC(src_buffer, I915_BUFFER_ACCESS_READ, src_offset);
+ FLUSH_BATCH(NULL);
}
diff --git a/src/gallium/drivers/i915simple/i915_blit.h b/src/gallium/drivers/i915simple/i915_blit.h
index 6e5b44e124..0bb3453861 100644
--- a/src/gallium/drivers/i915simple/i915_blit.h
+++ b/src/gallium/drivers/i915simple/i915_blit.h
@@ -33,10 +33,10 @@
extern void i915_copy_blit(struct i915_context *i915,
unsigned do_flip,
unsigned cpp,
- short src_pitch,
+ unsigned short src_pitch,
struct pipe_buffer *src_buffer,
unsigned src_offset,
- short dst_pitch,
+ unsigned short dst_pitch,
struct pipe_buffer *dst_buffer,
unsigned dst_offset,
short srcx, short srcy,
@@ -45,7 +45,7 @@ extern void i915_copy_blit(struct i915_context *i915,
extern void i915_fill_blit(struct i915_context *i915,
unsigned cpp,
- short dst_pitch,
+ unsigned short dst_pitch,
struct pipe_buffer *dst_buffer,
unsigned dst_offset,
short x, short y,
diff --git a/src/gallium/drivers/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c
index 6dd3eda85d..3e3a596884 100644
--- a/src/gallium/drivers/i915simple/i915_context.c
+++ b/src/gallium/drivers/i915simple/i915_context.c
@@ -34,7 +34,7 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_memory.h"
#include "pipe/p_screen.h"
diff --git a/src/gallium/drivers/i915simple/i915_debug.c b/src/gallium/drivers/i915simple/i915_debug.c
index 7a4e7051d2..a300b61c3b 100644
--- a/src/gallium/drivers/i915simple/i915_debug.c
+++ b/src/gallium/drivers/i915simple/i915_debug.c
@@ -29,7 +29,8 @@
#include "i915_context.h"
#include "i915_winsys.h"
#include "i915_debug.h"
-#include "pipe/p_winsys.h"
+#include "i915_batch.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_debug.h"
@@ -863,19 +864,17 @@ static boolean i915_debug_packet( struct debug_stream *stream )
void
-i915_dump_batchbuffer( struct i915_context *i915 )
+i915_dump_batchbuffer( struct i915_batchbuffer *batch )
{
struct debug_stream stream;
- /* TODO fix me */
- unsigned *start = 0;/*i915->batch_start;*/
- unsigned *end = 0;/*i915->winsys->batch_start( i915->winsys, 0, 0 );*/
+ unsigned *start = (unsigned*)batch->map;
+ unsigned *end = (unsigned*)batch->ptr;
unsigned long bytes = (unsigned long) (end - start) * 4;
boolean done = FALSE;
stream.offset = 0;
stream.ptr = (char *)start;
stream.print_addresses = 0;
- stream.winsys = i915->pipe.winsys;
if (!start || !end) {
debug_printf( "\n\nBATCH: ???\n");
diff --git a/src/gallium/drivers/i915simple/i915_debug.h b/src/gallium/drivers/i915simple/i915_debug.h
index afb63edabf..16ca7277c7 100644
--- a/src/gallium/drivers/i915simple/i915_debug.h
+++ b/src/gallium/drivers/i915simple/i915_debug.h
@@ -41,7 +41,6 @@ struct debug_stream
char *ptr; /* pointer to gtt offset zero */
char *end; /* pointer to gtt offset zero */
unsigned print_addresses;
- struct pipe_winsys *winsys;
};
@@ -73,7 +72,7 @@ void i915_print_ureg(const char *msg, unsigned ureg);
#if defined(DEBUG) && defined(FILE_DEBUG_FLAG)
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
static INLINE void
I915_DBG(
@@ -105,9 +104,9 @@ I915_DBG(
#endif
-void i915_dump_batchbuffer( struct i915_context *i915 );
-
+struct i915_batchbuffer;
+void i915_dump_batchbuffer( struct i915_batchbuffer *i915 );
void i915_debug_init( struct i915_context *i915 );
diff --git a/src/gallium/drivers/i915simple/i915_debug_fp.c b/src/gallium/drivers/i915simple/i915_debug_fp.c
index 48be3e1472..9c5b117b6d 100644
--- a/src/gallium/drivers/i915simple/i915_debug_fp.c
+++ b/src/gallium/drivers/i915simple/i915_debug_fp.c
@@ -28,7 +28,7 @@
#include "i915_reg.h"
#include "i915_debug.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
diff --git a/src/gallium/drivers/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c
index a8e97e7c30..f49f6d6ed1 100644
--- a/src/gallium/drivers/i915simple/i915_prim_vbuf.c
+++ b/src/gallium/drivers/i915simple/i915_prim_vbuf.c
@@ -42,7 +42,7 @@
#include "draw/draw_vbuf.h"
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
diff --git a/src/gallium/drivers/i915simple/i915_screen.c b/src/gallium/drivers/i915simple/i915_screen.c
index 1c976082df..5bb127f3d5 100644
--- a/src/gallium/drivers/i915simple/i915_screen.c
+++ b/src/gallium/drivers/i915simple/i915_screen.c
@@ -27,7 +27,8 @@
#include "util/u_memory.h"
-#include "pipe/p_winsys.h"
+#include "util/u_simple_screen.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_string.h"
@@ -279,6 +280,7 @@ i915_create_screen(struct pipe_winsys *winsys, uint pci_id)
i915screen->screen.surface_unmap = i915_surface_unmap;
i915_init_screen_texture_functions(&i915screen->screen);
+ u_simple_screen_init(&i915screen->screen);
return &i915screen->screen;
}
diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c
index d2487d8277..273e74002a 100644
--- a/src/gallium/drivers/i915simple/i915_state.c
+++ b/src/gallium/drivers/i915simple/i915_state.c
@@ -30,7 +30,7 @@
#include "draw/draw_context.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -318,8 +318,8 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
struct i915_depth_stencil_state *cso = CALLOC_STRUCT( i915_depth_stencil_state );
{
- int testmask = depth_stencil->stencil[0].value_mask & 0xff;
- int writemask = depth_stencil->stencil[0].write_mask & 0xff;
+ int testmask = depth_stencil->stencil[0].valuemask & 0xff;
+ int writemask = depth_stencil->stencil[0].writemask & 0xff;
cso->stencil_modes4 |= (_3DSTATE_MODES_4_CMD |
ENABLE_STENCIL_TEST_MASK |
@@ -350,8 +350,8 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
int dfop = i915_translate_stencil_op(depth_stencil->stencil[1].zfail_op);
int dpop = i915_translate_stencil_op(depth_stencil->stencil[1].zpass_op);
int ref = depth_stencil->stencil[1].ref_value & 0xff;
- int tmask = depth_stencil->stencil[1].value_mask & 0xff;
- int wmask = depth_stencil->stencil[1].write_mask & 0xff;
+ int tmask = depth_stencil->stencil[1].valuemask & 0xff;
+ int wmask = depth_stencil->stencil[1].writemask & 0xff;
cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS |
BFO_ENABLE_STENCIL_FUNCS |
@@ -394,7 +394,7 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
if (depth_stencil->alpha.enabled) {
int test = i915_translate_compare_func(depth_stencil->alpha.func);
- ubyte refByte = float_to_ubyte(depth_stencil->alpha.ref);
+ ubyte refByte = float_to_ubyte(depth_stencil->alpha.ref_value);
cso->depth_LIS6 |= (S6_ALPHA_TEST_ENABLE |
(test << S6_ALPHA_TEST_FUNC_SHIFT) |
@@ -535,13 +535,13 @@ static void i915_set_constant_buffer(struct pipe_context *pipe,
*/
if (buf) {
void *mapped;
- if (buf->size &&
+ if (buf->buffer && buf->buffer->size &&
(mapped = ws->buffer_map(ws, buf->buffer,
- PIPE_BUFFER_USAGE_CPU_READ))) {
- memcpy(i915->current.constants[shader], mapped, buf->size);
+ PIPE_BUFFER_USAGE_CPU_READ))) {
+ memcpy(i915->current.constants[shader], mapped, buf->buffer->size);
ws->buffer_unmap(ws, buf->buffer);
i915->current.num_user_constants[shader]
- = buf->size / (4 * sizeof(float));
+ = buf->buffer->size / (4 * sizeof(float));
}
else {
i915->current.num_user_constants[shader] = 0;
diff --git a/src/gallium/drivers/i915simple/i915_surface.c b/src/gallium/drivers/i915simple/i915_surface.c
index 62f1926644..5ffdb76682 100644
--- a/src/gallium/drivers/i915simple/i915_surface.c
+++ b/src/gallium/drivers/i915simple/i915_surface.c
@@ -31,7 +31,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_tile.h"
#include "util/u_rect.h"
@@ -79,8 +79,8 @@ i915_surface_copy(struct pipe_context *pipe,
i915_copy_blit( i915_context(pipe),
do_flip,
dst->block.size,
- (short) src->stride, src->buffer, src->offset,
- (short) dst->stride, dst->buffer, dst->offset,
+ (unsigned short) src->stride, src->buffer, src->offset,
+ (unsigned short) dst->stride, dst->buffer, dst->offset,
(short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
}
}
@@ -106,7 +106,7 @@ i915_surface_fill(struct pipe_context *pipe,
assert(dst->block.height == 1);
i915_fill_blit( i915_context(pipe),
dst->block.size,
- (short) dst->stride,
+ (unsigned short) dst->stride,
dst->buffer, dst->offset,
(short) dstx, (short) dsty,
(short) width, (short) height,
diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c
index 4acc4b0214..803ef3a187 100644
--- a/src/gallium/drivers/i915simple/i915_texture.c
+++ b/src/gallium/drivers/i915simple/i915_texture.c
@@ -34,7 +34,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -606,8 +606,8 @@ i915_texture_create(struct pipe_screen *screen,
tex_size = tex->stride * tex->total_nblocksy;
tex->buffer = ws->buffer_create(ws, 64,
- PIPE_BUFFER_USAGE_PIXEL,
- tex_size);
+ PIPE_BUFFER_USAGE_PIXEL,
+ tex_size);
if (!tex->buffer)
goto fail;
diff --git a/src/gallium/drivers/i965simple/brw_blit.c b/src/gallium/drivers/i965simple/brw_blit.c
index 8494f70493..4d11f8d2ab 100644
--- a/src/gallium/drivers/i965simple/brw_blit.c
+++ b/src/gallium/drivers/i965simple/brw_blit.c
@@ -35,7 +35,7 @@
#include "brw_reg.h"
#include "pipe/p_context.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#define FILE_DEBUG_FLAG DEBUG_BLIT
diff --git a/src/gallium/drivers/i965simple/brw_cc.c b/src/gallium/drivers/i965simple/brw_cc.c
index 79d4150383..3668123e2e 100644
--- a/src/gallium/drivers/i965simple/brw_cc.c
+++ b/src/gallium/drivers/i965simple/brw_cc.c
@@ -166,8 +166,8 @@ static void upload_cc_unit( struct brw_context *brw )
cc.cc0.stencil_pass_depth_pass_op = brw_translate_stencil_op(
brw->attribs.DepthStencil->stencil[0].zpass_op);
cc.cc1.stencil_ref = brw->attribs.DepthStencil->stencil[0].ref_value;
- cc.cc1.stencil_write_mask = brw->attribs.DepthStencil->stencil[0].write_mask;
- cc.cc1.stencil_test_mask = brw->attribs.DepthStencil->stencil[0].value_mask;
+ cc.cc1.stencil_write_mask = brw->attribs.DepthStencil->stencil[0].writemask;
+ cc.cc1.stencil_test_mask = brw->attribs.DepthStencil->stencil[0].valuemask;
if (brw->attribs.DepthStencil->stencil[1].enabled) {
cc.cc0.bf_stencil_enable = brw->attribs.DepthStencil->stencil[1].enabled;
@@ -180,14 +180,14 @@ static void upload_cc_unit( struct brw_context *brw )
cc.cc0.bf_stencil_pass_depth_pass_op = brw_translate_stencil_op(
brw->attribs.DepthStencil->stencil[1].zpass_op);
cc.cc1.bf_stencil_ref = brw->attribs.DepthStencil->stencil[1].ref_value;
- cc.cc2.bf_stencil_write_mask = brw->attribs.DepthStencil->stencil[1].write_mask;
- cc.cc2.bf_stencil_test_mask = brw->attribs.DepthStencil->stencil[1].value_mask;
+ cc.cc2.bf_stencil_write_mask = brw->attribs.DepthStencil->stencil[1].writemask;
+ cc.cc2.bf_stencil_test_mask = brw->attribs.DepthStencil->stencil[1].valuemask;
}
/* Not really sure about this:
*/
- if (brw->attribs.DepthStencil->stencil[0].write_mask ||
- brw->attribs.DepthStencil->stencil[1].write_mask)
+ if (brw->attribs.DepthStencil->stencil[0].writemask ||
+ brw->attribs.DepthStencil->stencil[1].writemask)
cc.cc0.stencil_write_enable = 1;
}
@@ -233,7 +233,7 @@ static void upload_cc_unit( struct brw_context *brw )
cc.cc3.alpha_test_func =
brw_translate_compare_func(brw->attribs.DepthStencil->alpha.func);
- cc.cc7.alpha_ref.ub[0] = float_to_ubyte(brw->attribs.DepthStencil->alpha.ref);
+ cc.cc7.alpha_ref.ub[0] = float_to_ubyte(brw->attribs.DepthStencil->alpha.ref_value);
cc.cc3.alpha_test_format = BRW_ALPHATEST_FORMAT_UNORM8;
}
diff --git a/src/gallium/drivers/i965simple/brw_context.c b/src/gallium/drivers/i965simple/brw_context.c
index 96920df008..c74cbf8d73 100644
--- a/src/gallium/drivers/i965simple/brw_context.c
+++ b/src/gallium/drivers/i965simple/brw_context.c
@@ -37,7 +37,7 @@
#include "brw_tex_layout.h"
#include "brw_winsys.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_context.h"
#include "util/u_memory.h"
#include "pipe/p_screen.h"
diff --git a/src/gallium/drivers/i965simple/brw_curbe.c b/src/gallium/drivers/i965simple/brw_curbe.c
index 824ee7fd6d..904cde8e30 100644
--- a/src/gallium/drivers/i965simple/brw_curbe.c
+++ b/src/gallium/drivers/i965simple/brw_curbe.c
@@ -38,7 +38,7 @@
#include "brw_util.h"
#include "brw_wm.h"
#include "pipe/p_state.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -257,13 +257,13 @@ static void upload_constant_buffer(struct brw_context *brw)
if (brw->vs.prog_data->num_consts) {
/* map the vertex constant buffer and copy to curbe: */
void *data = ws->buffer_map(ws, cbuffer->buffer, 0);
- /* FIXME: this is wrong. the cbuffer->size currently
+ /* FIXME: this is wrong. the cbuffer->buffer->size currently
* represents size of consts + immediates. so if we'll
* have both we'll copy over the end of the buffer
* with the subsequent memcpy */
- memcpy(&buf[offset], data, cbuffer->size);
+ memcpy(&buf[offset], data, cbuffer->buffer->size);
ws->buffer_unmap(ws, cbuffer->buffer);
- offset += cbuffer->size;
+ offset += cbuffer->buffer->size;
}
/*immediates*/
if (brw->vs.prog_data->num_imm) {
diff --git a/src/gallium/drivers/i965simple/brw_draw.c b/src/gallium/drivers/i965simple/brw_draw.c
index 7598e3dc8a..648aaa0da5 100644
--- a/src/gallium/drivers/i965simple/brw_draw.c
+++ b/src/gallium/drivers/i965simple/brw_draw.c
@@ -34,7 +34,7 @@
#include "brw_state.h"
#include "pipe/p_context.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
static unsigned hw_prim[PIPE_PRIM_POLYGON+1] = {
_3DPRIM_POINTLIST,
diff --git a/src/gallium/drivers/i965simple/brw_draw_upload.c b/src/gallium/drivers/i965simple/brw_draw_upload.c
index 7c20ea52af..2d9ca3f2ea 100644
--- a/src/gallium/drivers/i965simple/brw_draw_upload.c
+++ b/src/gallium/drivers/i965simple/brw_draw_upload.c
@@ -223,7 +223,7 @@ boolean brw_upload_vertex_buffers( struct brw_context *brw )
break;
}
- vbp.vb[i].vb0.bits.pitch = brw->vb.vbo_array[i]->pitch;
+ vbp.vb[i].vb0.bits.pitch = brw->vb.vbo_array[i]->stride;
vbp.vb[i].vb0.bits.pad = 0;
vbp.vb[i].vb0.bits.access_type = BRW_VERTEXBUFFER_ACCESS_VERTEXDATA;
vbp.vb[i].vb0.bits.vb_index = i;
diff --git a/src/gallium/drivers/i965simple/brw_screen.c b/src/gallium/drivers/i965simple/brw_screen.c
index ab7cd624b2..b22e105f10 100644
--- a/src/gallium/drivers/i965simple/brw_screen.c
+++ b/src/gallium/drivers/i965simple/brw_screen.c
@@ -27,8 +27,9 @@
#include "util/u_memory.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_string.h"
+#include "util/u_simple_screen.h"
#include "brw_context.h"
#include "brw_screen.h"
@@ -239,6 +240,7 @@ brw_create_screen(struct pipe_winsys *winsys, uint pci_id)
brwscreen->screen.is_format_supported = brw_is_format_supported;
brw_init_screen_texture_funcs(&brwscreen->screen);
+ u_simple_screen_init(&brwscreen->screen);
return &brwscreen->screen;
}
diff --git a/src/gallium/drivers/i965simple/brw_state.c b/src/gallium/drivers/i965simple/brw_state.c
index af46cb546f..b47f5373f3 100644
--- a/src/gallium/drivers/i965simple/brw_state.c
+++ b/src/gallium/drivers/i965simple/brw_state.c
@@ -30,7 +30,7 @@
*/
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
#include "pipe/p_shader_tokens.h"
diff --git a/src/gallium/drivers/i965simple/brw_state_pool.c b/src/gallium/drivers/i965simple/brw_state_pool.c
index 007dc8f9de..e91263cb1f 100644
--- a/src/gallium/drivers/i965simple/brw_state_pool.c
+++ b/src/gallium/drivers/i965simple/brw_state_pool.c
@@ -42,7 +42,7 @@
* the pool.
*/
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
diff --git a/src/gallium/drivers/i965simple/brw_surface.c b/src/gallium/drivers/i965simple/brw_surface.c
index b89756c47b..3159eba2fd 100644
--- a/src/gallium/drivers/i965simple/brw_surface.c
+++ b/src/gallium/drivers/i965simple/brw_surface.c
@@ -30,7 +30,7 @@
#include "brw_state.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_tile.h"
#include "util/u_rect.h"
diff --git a/src/gallium/drivers/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c
index 12e2e02cfd..6af0d5cf4b 100644
--- a/src/gallium/drivers/i965simple/brw_tex_layout.c
+++ b/src/gallium/drivers/i965simple/brw_tex_layout.c
@@ -37,7 +37,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
#include "brw_context.h"
@@ -296,9 +296,9 @@ brw_texture_create_screen(struct pipe_screen *screen,
if (brw_miptree_layout(tex))
tex->buffer = ws->buffer_create(ws, 64,
- PIPE_BUFFER_USAGE_PIXEL,
- tex->stride *
- tex->total_nblocksy);
+ PIPE_BUFFER_USAGE_PIXEL,
+ tex->stride *
+ tex->total_nblocksy);
if (!tex->buffer) {
FREE(tex);
@@ -322,7 +322,6 @@ brw_texture_release_screen(struct pipe_screen *screen,
__FUNCTION__, (void *) *pt, (*pt)->refcount - 1);
*/
if (--(*pt)->refcount <= 0) {
- struct pipe_winsys *ws = screen->winsys;
struct brw_texture *tex = (struct brw_texture *)*pt;
uint i;
@@ -330,7 +329,7 @@ brw_texture_release_screen(struct pipe_screen *screen,
DBG("%s deleting %p\n", __FUNCTION__, (void *) tex);
*/
- winsys_buffer_reference(ws, &tex->buffer, NULL);
+ pipe_buffer_reference(screen, &tex->buffer, NULL);
for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++)
if (tex->image_offset[i])
@@ -347,7 +346,6 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice)
{
- struct pipe_winsys *ws = screen->winsys;
struct brw_texture *tex = (struct brw_texture *)pt;
struct pipe_surface *ps;
unsigned offset; /* in bytes */
@@ -369,7 +367,7 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
if (ps) {
ps->refcount = 1;
pipe_texture_reference(&ps->texture, pt);
- winsys_buffer_reference(ws, &ps->buffer, tex->buffer);
+ pipe_buffer_reference(screen, &ps->buffer, tex->buffer);
ps->format = pt->format;
ps->width = pt->width[level];
ps->height = pt->height[level];
diff --git a/src/gallium/drivers/i965simple/brw_wm.c b/src/gallium/drivers/i965simple/brw_wm.c
index 8de565b96c..10161f2d2f 100644
--- a/src/gallium/drivers/i965simple/brw_wm.c
+++ b/src/gallium/drivers/i965simple/brw_wm.c
@@ -111,8 +111,8 @@ static void brw_wm_populate_key( struct brw_context *brw,
if (brw->attribs.DepthStencil->stencil[0].enabled) {
lookup |= IZ_STENCIL_TEST_ENABLE_BIT;
- if (brw->attribs.DepthStencil->stencil[0].write_mask ||
- brw->attribs.DepthStencil->stencil[1].write_mask)
+ if (brw->attribs.DepthStencil->stencil[0].writemask ||
+ brw->attribs.DepthStencil->stencil[1].writemask)
lookup |= IZ_STENCIL_WRITE_ENABLE_BIT;
}
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h
index 5535ebb6a9..25e0b05be1 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -2,7 +2,7 @@
#define NOUVEAU_WINSYS_H
#include <stdint.h>
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "nouveau/nouveau_bo.h"
diff --git a/src/gallium/drivers/nv04/nv04_context.c b/src/gallium/drivers/nv04/nv04_context.c
index 9f75253363..d6710cd892 100644
--- a/src/gallium/drivers/nv04/nv04_context.c
+++ b/src/gallium/drivers/nv04/nv04_context.c
@@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "nv04_context.h"
#include "nv04_screen.h"
@@ -35,8 +35,9 @@ nv04_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield)
static boolean
nv04_init_hwctx(struct nv04_context *nv04)
{
- BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_NOTIFY, 1);
- OUT_RING(0);
+ // requires a valid handle
+// BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_NOTIFY, 1);
+// OUT_RING(0);
BEGIN_RING(fahrenheit, NV04_DX5_TEXTURED_TRIANGLE_NOP, 1);
OUT_RING(0);
diff --git a/src/gallium/drivers/nv04/nv04_context.h b/src/gallium/drivers/nv04/nv04_context.h
index 3e6a085270..2842b2c90d 100644
--- a/src/gallium/drivers/nv04/nv04_context.h
+++ b/src/gallium/drivers/nv04/nv04_context.h
@@ -34,6 +34,8 @@
#define NV04_NEW_CONTROL (1 << 5)
#define NV04_NEW_VIEWPORT (1 << 6)
#define NV04_NEW_SAMPLER (1 << 7)
+#define NV04_NEW_FRAMEBUFFER (1 << 8)
+#define NV04_NEW_VTXARRAYS (1 << 9)
struct nv04_context {
struct pipe_context pipe;
@@ -61,8 +63,9 @@ struct nv04_context {
unsigned vp_samplers;
uint32_t rt_enable;
- struct pipe_buffer *rt[4];
- struct pipe_buffer *zeta;
+ struct pipe_framebuffer_state *framebuffer;
+ struct pipe_surface *rt;
+ struct pipe_surface *zeta;
struct {
struct pipe_buffer *buffer;
@@ -75,6 +78,9 @@ struct nv04_context {
unsigned delta;
} vb[16];
+ float *constbuf[PIPE_SHADER_TYPES][32][4];
+ unsigned constbuf_nr[PIPE_SHADER_TYPES];
+
struct vertex_info vertex_info;
struct {
@@ -94,9 +100,8 @@ struct nv04_context {
struct pipe_buffer *constant_buf;
} fragprog;
- struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
- unsigned num_vertex_buffers;
- unsigned num_vertex_elements;
+ struct pipe_vertex_buffer vtxbuf[PIPE_MAX_ATTRIBS];
+ struct pipe_vertex_element vtxelt[PIPE_MAX_ATTRIBS];
struct pipe_viewport_state viewport;
};
@@ -109,7 +114,7 @@ nv04_context(struct pipe_context *pipe)
extern void nv04_init_state_functions(struct nv04_context *nv04);
extern void nv04_init_surface_functions(struct nv04_context *nv04);
-extern void nv04_init_miptree_functions(struct pipe_screen *screen);
+extern void nv04_screen_init_miptree_functions(struct pipe_screen *screen);
/* nv04_clear.c */
extern void nv04_clear(struct pipe_context *pipe, struct pipe_surface *ps,
diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c
index 094c38256b..01cb8ecbf3 100644
--- a/src/gallium/drivers/nv04/nv04_miptree.c
+++ b/src/gallium/drivers/nv04/nv04_miptree.c
@@ -11,7 +11,7 @@ nv04_miptree_layout(struct nv04_miptree *nv04mt)
struct pipe_texture *pt = &nv04mt->base;
uint width = pt->width[0], height = pt->height[0];
uint offset = 0;
- int nr_faces, l, f;
+ int nr_faces, l;
nr_faces = 1;
@@ -22,31 +22,26 @@ nv04_miptree_layout(struct nv04_miptree *nv04mt)
pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width);
pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height);
- nv04mt->level[l].pitch = pt->width[0] * pt->block.size;
+ nv04mt->level[l].pitch = pt->width[0];
nv04mt->level[l].pitch = (nv04mt->level[l].pitch + 63) & ~63;
- nv04mt->level[l].image_offset =
- CALLOC(nr_faces, sizeof(unsigned));
-
width = MAX2(1, width >> 1);
height = MAX2(1, height >> 1);
-
}
- for (f = 0; f < nr_faces; f++) {
- for (l = 0; l <= pt->last_level; l++) {
- nv04mt->level[l].image_offset[f] = offset;
- offset += nv04mt->level[l].pitch * pt->height[l];
- }
+ for (l = 0; l <= pt->last_level; l++) {
+
+ nv04mt->level[l].image_offset = offset;
+ offset += nv04mt->level[l].pitch * pt->height[l];
}
nv04mt->total_size = offset;
}
static struct pipe_texture *
-nv04_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
+nv04_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt)
{
- struct pipe_winsys *ws = screen->winsys;
+ struct pipe_winsys *ws = pscreen->winsys;
struct nv04_miptree *mt;
mt = MALLOC(sizeof(struct nv04_miptree));
@@ -54,13 +49,19 @@ nv04_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
return NULL;
mt->base = *pt;
mt->base.refcount = 1;
- mt->base.screen = screen;
+ mt->base.screen = pscreen;
+ mt->shadow_tex = NULL;
+ mt->shadow_surface = NULL;
+
+ //mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR;
nv04_miptree_layout(mt);
- mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL,
- mt->total_size);
+ mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL |
+ NOUVEAU_BUFFER_USAGE_TEXTURE,
+ mt->total_size);
if (!mt->buffer) {
+ printf("failed %d byte alloc\n",mt->total_size);
FREE(mt);
return NULL;
}
@@ -69,22 +70,29 @@ nv04_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt)
}
static void
-nv04_miptree_release(struct pipe_screen *screen, struct pipe_texture **pt)
+nv04_miptree_release(struct pipe_screen *pscreen, struct pipe_texture **ppt)
{
- struct pipe_texture *mt = *pt;
-
- *pt = NULL;
- if (--mt->refcount <= 0) {
- struct nv04_miptree *nv04mt = (struct nv04_miptree *)mt;
- int l;
-
- pipe_buffer_reference(screen, &nv04mt->buffer, NULL);
- for (l = 0; l <= mt->last_level; l++) {
- if (nv04mt->level[l].image_offset)
- FREE(nv04mt->level[l].image_offset);
- }
- FREE(nv04mt);
+ struct pipe_texture *pt = *ppt;
+ struct nv04_miptree *mt = (struct nv04_miptree *)pt;
+ int l;
+
+ *ppt = NULL;
+ if (--pt->refcount)
+ return;
+
+ pipe_buffer_reference(pscreen, &mt->buffer, NULL);
+ for (l = 0; l <= pt->last_level; l++) {
+ if (mt->level[l].image_offset)
+ FREE(mt->level[l].image_offset);
}
+
+ if (mt->shadow_tex) {
+ assert(mt->shadow_surface);
+ pscreen->tex_surface_release(pscreen, &mt->shadow_surface);
+ nv04_miptree_release(pscreen, &mt->shadow_tex);
+ }
+
+ FREE(mt);
}
static struct pipe_surface *
@@ -92,7 +100,6 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
unsigned face, unsigned level, unsigned zslice,
unsigned flags)
{
- struct pipe_winsys *ws = pscreen->winsys;
struct nv04_miptree *nv04mt = (struct nv04_miptree *)pt;
struct pipe_surface *ps;
@@ -102,19 +109,20 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
pipe_texture_reference(&ps->texture, pt);
pipe_buffer_reference(pscreen, &ps->buffer, nv04mt->buffer);
ps->format = pt->format;
- ps->block = pt->block;
ps->width = pt->width[level];
ps->height = pt->height[level];
+ ps->block = pt->block;
ps->nblocksx = pt->nblocksx[level];
ps->nblocksy = pt->nblocksy[level];
ps->stride = nv04mt->level[level].pitch;
+ ps->usage = flags;
+ ps->status = PIPE_SURFACE_STATUS_DEFINED;
ps->refcount = 1;
+ ps->face = face;
+ ps->level = level;
+ ps->zslice = zslice;
- if (pt->target == PIPE_TEXTURE_CUBE) {
- ps->offset = nv04mt->level[level].image_offset[face];
- } else {
- ps->offset = nv04mt->level[level].image_offset[0];
- }
+ ps->offset = nv04mt->level[level].image_offset;
return ps;
}
@@ -123,10 +131,19 @@ static void
nv04_miptree_surface_del(struct pipe_screen *pscreen,
struct pipe_surface **psurface)
{
+ struct pipe_surface *ps = *psurface;
+
+ *psurface = NULL;
+ if (--ps->refcount > 0)
+ return;
+
+ pipe_texture_reference(&ps->texture, NULL);
+ pipe_buffer_reference(pscreen->winsys, &ps->buffer, NULL);
+ FREE(ps);
}
void
-nv04_init_miptree_functions(struct pipe_screen *pscreen)
+nv04_screen_init_miptree_functions(struct pipe_screen *pscreen)
{
pscreen->texture_create = nv04_miptree_create;
pscreen->texture_release = nv04_miptree_release;
diff --git a/src/gallium/drivers/nv04/nv04_prim_vbuf.c b/src/gallium/drivers/nv04/nv04_prim_vbuf.c
index 19979fff79..18a8872ae3 100644
--- a/src/gallium/drivers/nv04/nv04_prim_vbuf.c
+++ b/src/gallium/drivers/nv04/nv04_prim_vbuf.c
@@ -1,7 +1,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_compiler.h"
#include "draw/draw_vbuf.h"
diff --git a/src/gallium/drivers/nv04/nv04_screen.c b/src/gallium/drivers/nv04/nv04_screen.c
index 65eacde6b2..2ae6784077 100644
--- a/src/gallium/drivers/nv04/nv04_screen.c
+++ b/src/gallium/drivers/nv04/nv04_screen.c
@@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
+#include "util/u_simple_screen.h"
#include "nv04_context.h"
#include "nv04_screen.h"
@@ -52,6 +53,13 @@ nv04_screen_get_param(struct pipe_screen *screen, int param)
return 0;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
return 0;
+ case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
+ return 0;
+ case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
+ return 1;
+ case NOUVEAU_CAP_HW_VTXBUF:
+ case NOUVEAU_CAP_HW_IDXBUF:
+ return 0;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
@@ -208,6 +216,7 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv04_surface_unmap;
nv04_screen_init_miptree_functions(&screen->pipe);
+ u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}
diff --git a/src/gallium/drivers/nv04/nv04_state.c b/src/gallium/drivers/nv04/nv04_state.c
index ff1933b550..87c635f962 100644
--- a/src/gallium/drivers/nv04/nv04_state.c
+++ b/src/gallium/drivers/nv04/nv04_state.c
@@ -227,7 +227,7 @@ nv04_depth_stencil_alpha_state_create(struct pipe_context *pipe,
hw = MALLOC(sizeof(struct nv04_depth_stencil_alpha_state));
- hw->control = float_to_ubyte(cso->alpha.ref);
+ hw->control = float_to_ubyte(cso->alpha.ref_value);
hw->control |= ( nv04_compare_func(cso->alpha.func) << NV04_DX5_TEXTURED_TRIANGLE_CONTROL_ALPHA_FUNC_SHIFT );
hw->control |= cso->alpha.enabled ? NV04_DX5_TEXTURED_TRIANGLE_CONTROL_ALPHA_TEST_ENABLE : 0;
hw->control |= NV04_DX5_TEXTURED_TRIANGLE_CONTROL_ORIGIN;
@@ -334,14 +334,21 @@ nv04_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
const struct pipe_constant_buffer *buf )
{
struct nv04_context *nv04 = nv04_context(pipe);
-
- if (shader == PIPE_SHADER_VERTEX) {
- nv04->vertprog.constant_buf = buf->buffer;
- nv04->dirty |= NV04_NEW_VERTPROG;
- } else
- if (shader == PIPE_SHADER_FRAGMENT) {
- nv04->fragprog.constant_buf = buf->buffer;
- nv04->dirty |= NV04_NEW_FRAGPROG;
+ struct pipe_winsys *ws = pipe->winsys;
+
+ assert(shader < PIPE_SHADER_TYPES);
+ assert(index == 0);
+
+ if (buf) {
+ void *mapped;
+ if (buf->buffer && buf->buffer->size &&
+ (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+ {
+ memcpy(nv04->constbuf[shader], mapped, buf->buffer->size);
+ nv04->constbuf_nr[shader] =
+ buf->buffer->size / (4 * sizeof(float));
+ ws->buffer_unmap(ws, buf->buffer);
+ }
}
}
@@ -350,53 +357,11 @@ nv04_set_framebuffer_state(struct pipe_context *pipe,
const struct pipe_framebuffer_state *fb)
{
struct nv04_context *nv04 = nv04_context(pipe);
- struct pipe_surface *rt, *zeta;
- uint32_t rt_format, w, h;
- int colour_format = 0, zeta_format = 0;
-
- w = fb->cbufs[0]->width;
- h = fb->cbufs[0]->height;
- colour_format = fb->cbufs[0]->format;
- rt = fb->cbufs[0];
-
- if (fb->zsbuf) {
- if (colour_format) {
- assert(w == fb->zsbuf->width);
- assert(h == fb->zsbuf->height);
- } else {
- w = fb->zsbuf->width;
- h = fb->zsbuf->height;
- }
-
- zeta_format = fb->zsbuf->format;
- zeta = fb->zsbuf;
- }
-
- switch (colour_format) {
- case PIPE_FORMAT_A8R8G8B8_UNORM:
- case 0:
- rt_format = 0x108;
- break;
- case PIPE_FORMAT_R5G6B5_UNORM:
- rt_format = 0x103;
- break;
- default:
- assert(0);
- }
-
- BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_FORMAT, 1);
- OUT_RING(rt_format);
+
+ nv04->framebuffer = (struct pipe_framebuffer_state*)fb;
- /* FIXME pitches have to be aligned ! */
- BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
- OUT_RING(rt->stride|(zeta->stride<<16));
- OUT_RELOCl(rt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- if (fb->zsbuf) {
- BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1);
- OUT_RELOCl(zeta->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- }
+ nv04->dirty |= NV04_NEW_FRAMEBUFFER;
}
-
static void
nv04_set_polygon_stipple(struct pipe_context *pipe,
const struct pipe_poly_stipple *stipple)
@@ -433,10 +398,8 @@ nv04_set_vertex_buffers(struct pipe_context *pipe, unsigned count,
{
struct nv04_context *nv04 = nv04_context(pipe);
- draw_flush(nv04->draw);
-
- memcpy(nv04->vertex_buffer, buffers, count * sizeof(buffers[0]));
- nv04->num_vertex_buffers = count;
+ memcpy(nv04->vtxbuf, buffers, count * sizeof(buffers[0]));
+ nv04->dirty |= NV04_NEW_VTXARRAYS;
draw_set_vertex_buffers(nv04->draw, count, buffers);
}
@@ -447,9 +410,9 @@ nv04_set_vertex_elements(struct pipe_context *pipe, unsigned count,
{
struct nv04_context *nv04 = nv04_context(pipe);
- draw_flush(nv04->draw);
+ memcpy(nv04->vtxelt, elements, sizeof(*elements) * count);
+ nv04->dirty |= NV04_NEW_VTXARRAYS;
- nv04->num_vertex_elements = count;
draw_set_vertex_elements(nv04->draw, count, elements);
}
diff --git a/src/gallium/drivers/nv04/nv04_state.h b/src/gallium/drivers/nv04/nv04_state.h
index 399f750dbe..15d4685ec1 100644
--- a/src/gallium/drivers/nv04/nv04_state.h
+++ b/src/gallium/drivers/nv04/nv04_state.h
@@ -35,9 +35,12 @@ struct nv04_miptree {
struct pipe_buffer *buffer;
uint total_size;
+ struct pipe_texture *shadow_tex;
+ struct pipe_surface *shadow_surface;
+
struct {
uint pitch;
- uint *image_offset;
+ uint image_offset;
} level[PIPE_MAX_TEXTURE_LEVELS];
};
diff --git a/src/gallium/drivers/nv04/nv04_state_emit.c b/src/gallium/drivers/nv04/nv04_state_emit.c
index 0ad40a092e..26491758a0 100644
--- a/src/gallium/drivers/nv04/nv04_state_emit.c
+++ b/src/gallium/drivers/nv04/nv04_state_emit.c
@@ -12,7 +12,9 @@ static void nv04_vertex_layout(struct pipe_context* pipe)
memset(&vinfo, 0, sizeof(vinfo));
for (i = 0; i < fp->info.num_inputs; i++) {
- switch (i) {
+ int isn = fp->info.input_semantic_name[i];
+ int isi = fp->info.input_semantic_index[i];
+ switch (isn) {
case TGSI_SEMANTIC_POSITION:
draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, src++);
break;
@@ -28,6 +30,8 @@ static void nv04_vertex_layout(struct pipe_context* pipe)
break;
}
}
+
+ printf("%d vertex input\n",fp->info.num_inputs);
draw_compute_vertex_size(&vinfo);
}
@@ -86,6 +90,56 @@ static void nv04_emit_sampler(struct nv04_context *nv04, int unit)
OUT_RING(nv04->sampler[unit]->filter);
}
+static void nv04_state_emit_framebuffer(struct nv04_context* nv04)
+{
+ struct pipe_framebuffer_state* fb = nv04->framebuffer;
+ struct pipe_surface *rt, *zeta;
+ uint32_t rt_format, w, h;
+ int colour_format = 0, zeta_format = 0;
+
+ w = fb->cbufs[0]->width;
+ h = fb->cbufs[0]->height;
+ colour_format = fb->cbufs[0]->format;
+ rt = fb->cbufs[0];
+
+ if (fb->zsbuf) {
+ if (colour_format) {
+ assert(w == fb->zsbuf->width);
+ assert(h == fb->zsbuf->height);
+ } else {
+ w = fb->zsbuf->width;
+ h = fb->zsbuf->height;
+ }
+
+ zeta_format = fb->zsbuf->format;
+ zeta = fb->zsbuf;
+ }
+
+ switch (colour_format) {
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case 0:
+ rt_format = 0x108;
+ break;
+ case PIPE_FORMAT_R5G6B5_UNORM:
+ rt_format = 0x103;
+ break;
+ default:
+ assert(0);
+ }
+
+ BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_FORMAT, 1);
+ OUT_RING(rt_format);
+
+ /* FIXME pitches have to be aligned ! */
+ BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
+ OUT_RING(rt->stride|(zeta->stride<<16));
+ OUT_RELOCl(rt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ if (fb->zsbuf) {
+ BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1);
+ OUT_RELOCl(zeta->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ }
+}
+
void
nv04_emit_hw_state(struct nv04_context *nv04)
{
@@ -98,7 +152,7 @@ nv04_emit_hw_state(struct nv04_context *nv04)
if (nv04->dirty & NV04_NEW_FRAGPROG) {
nv04_fragprog_bind(nv04, nv04->fragprog.current);
- /*XXX: clear NV04_NEW_FRAGPROG if no new program uploaded */
+ nv04->dirty &= ~NV04_NEW_FRAGPROG;
nv04->dirty_samplers |= (1<<10);
nv04->dirty_samplers = 0;
}
@@ -116,6 +170,11 @@ nv04_emit_hw_state(struct nv04_context *nv04)
nv04_emit_blend(nv04);
}
+ if (nv04->dirty & NV04_NEW_VTXARRAYS) {
+ nv04->dirty &= ~NV04_NEW_VTXARRAYS;
+ nv04_vertex_layout(nv04);
+ }
+
if (nv04->dirty & NV04_NEW_SAMPLER) {
nv04->dirty &= ~NV04_NEW_SAMPLER;
@@ -127,6 +186,11 @@ nv04_emit_hw_state(struct nv04_context *nv04)
// nv04_state_emit_viewport(nv04);
}
+ if (nv04->dirty & NV04_NEW_FRAMEBUFFER) {
+ nv04->dirty &= ~NV04_NEW_FRAMEBUFFER;
+ nv04_state_emit_framebuffer(nv04);
+ }
+
/* Emit relocs for every referenced buffer.
* This is to ensure the bufmgr has an accurate idea of how
* the buffer is used. This isn't very efficient, but we don't
@@ -135,13 +199,13 @@ nv04_emit_hw_state(struct nv04_context *nv04)
*/
/* Render target */
-/* BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
- OUT_RING(rt->stride|(zeta->stride<<16));
- OUT_RELOCl(rt->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- if (fb->zsbuf) {
+ BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_PITCH, 2);
+ OUT_RING(nv04->rt->stride|(nv04->zeta->stride<<16));
+ OUT_RELOCl(nv04->rt, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ if (nv04->zeta) {
BEGIN_RING(context_surfaces_3d, NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA, 1);
- OUT_RELOCl(zeta->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- }*/
+ OUT_RELOCl(nv04->zeta, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
+ }
/* Texture images */
for (i = 0; i < 1; i++) {
diff --git a/src/gallium/drivers/nv04/nv04_surface.c b/src/gallium/drivers/nv04/nv04_surface.c
index 9d9943ed4e..0d0983f9d4 100644
--- a/src/gallium/drivers/nv04/nv04_surface.c
+++ b/src/gallium/drivers/nv04/nv04_surface.c
@@ -28,7 +28,7 @@
#include "nv04_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"
diff --git a/src/gallium/drivers/nv04/nv04_vbo.c b/src/gallium/drivers/nv04/nv04_vbo.c
index 91f919d48e..d21a0e34f7 100644
--- a/src/gallium/drivers/nv04/nv04_vbo.c
+++ b/src/gallium/drivers/nv04/nv04_vbo.c
@@ -17,14 +17,16 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
struct draw_context *draw = nv04->draw;
unsigned i;
+ nv04_emit_hw_state(nv04);
+
/*
* Map vertex buffers
*/
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
- if (nv04->vertex_buffer[i].buffer) {
+ if (nv04->vtxbuf[i].buffer) {
void *buf
= pipe->winsys->buffer_map(pipe->winsys,
- nv04->vertex_buffer[i].buffer,
+ nv04->vtxbuf[i].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_vertex_buffer(draw, i, buf);
}
@@ -41,6 +43,10 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
draw_set_mapped_element_buffer(draw, 0, NULL);
}
+ draw_set_mapped_constant_buffer(draw,
+ nv04->constbuf[PIPE_SHADER_VERTEX],
+ nv04->constbuf_nr[PIPE_SHADER_VERTEX]);
+
/* draw! */
draw_arrays(nv04->draw, prim, start, count);
@@ -48,8 +54,8 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
* unmap vertex/index buffers
*/
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
- if (nv04->vertex_buffer[i].buffer) {
- pipe->winsys->buffer_unmap(pipe->winsys, nv04->vertex_buffer[i].buffer);
+ if (nv04->vtxbuf[i].buffer) {
+ pipe->winsys->buffer_unmap(pipe->winsys, nv04->vtxbuf[i].buffer);
draw_set_mapped_vertex_buffer(draw, i, NULL);
}
}
@@ -64,6 +70,7 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
boolean nv04_draw_arrays( struct pipe_context *pipe,
unsigned prim, unsigned start, unsigned count)
{
+ printf("coucou in draw arrays\n");
return nv04_draw_elements(pipe, NULL, 0, prim, start, count);
}
diff --git a/src/gallium/drivers/nv10/nv10_context.c b/src/gallium/drivers/nv10/nv10_context.c
index 4eb4ed9185..ef2c0c5d9f 100644
--- a/src/gallium/drivers/nv10/nv10_context.c
+++ b/src/gallium/drivers/nv10/nv10_context.c
@@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "nv10_context.h"
#include "nv10_screen.h"
diff --git a/src/gallium/drivers/nv10/nv10_prim_vbuf.c b/src/gallium/drivers/nv10/nv10_prim_vbuf.c
index e7e81d3dff..7435d87315 100644
--- a/src/gallium/drivers/nv10/nv10_prim_vbuf.c
+++ b/src/gallium/drivers/nv10/nv10_prim_vbuf.c
@@ -40,7 +40,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "nv10_context.h"
#include "nv10_state.h"
diff --git a/src/gallium/drivers/nv10/nv10_screen.c b/src/gallium/drivers/nv10/nv10_screen.c
index 4d9fbd4b5f..12516fd71e 100644
--- a/src/gallium/drivers/nv10/nv10_screen.c
+++ b/src/gallium/drivers/nv10/nv10_screen.c
@@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
+#include "util/u_simple_screen.h"
#include "nv10_context.h"
#include "nv10_screen.h"
@@ -204,6 +205,7 @@ nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv10_surface_unmap;
nv10_screen_init_miptree_functions(&screen->pipe);
+ u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}
diff --git a/src/gallium/drivers/nv10/nv10_state.c b/src/gallium/drivers/nv10/nv10_state.c
index d2375aa2f6..119af66dfd 100644
--- a/src/gallium/drivers/nv10/nv10_state.c
+++ b/src/gallium/drivers/nv10/nv10_state.c
@@ -342,17 +342,17 @@ nv10_depth_stencil_alpha_state_create(struct pipe_context *pipe,
hw->depth.test_enable = cso->depth.enabled ? 1 : 0;
hw->stencil.enable = cso->stencil[0].enabled ? 1 : 0;
- hw->stencil.wmask = cso->stencil[0].write_mask;
+ hw->stencil.wmask = cso->stencil[0].writemask;
hw->stencil.func = nvgl_comparison_op(cso->stencil[0].func);
hw->stencil.ref = cso->stencil[0].ref_value;
- hw->stencil.vmask = cso->stencil[0].value_mask;
+ hw->stencil.vmask = cso->stencil[0].valuemask;
hw->stencil.fail = nvgl_stencil_op(cso->stencil[0].fail_op);
hw->stencil.zfail = nvgl_stencil_op(cso->stencil[0].zfail_op);
hw->stencil.zpass = nvgl_stencil_op(cso->stencil[0].zpass_op);
hw->alpha.enabled = cso->alpha.enabled ? 1 : 0;
hw->alpha.func = nvgl_comparison_op(cso->alpha.func);
- hw->alpha.ref = float_to_ubyte(cso->alpha.ref);
+ hw->alpha.ref = float_to_ubyte(cso->alpha.ref_value);
return (void *)hw;
}
@@ -467,11 +467,12 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
if (buf) {
void *mapped;
- if (buf->size && (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+ if (buf->buffer && buf->buffer->size &&
+ (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
{
- memcpy(nv10->constbuf[shader], mapped, buf->size);
+ memcpy(nv10->constbuf[shader], mapped, buf->buffer->size);
nv10->constbuf_nr[shader] =
- buf->size / (4 * sizeof(float));
+ buf->buffer->size / (4 * sizeof(float));
ws->buffer_unmap(ws, buf->buffer);
}
}
diff --git a/src/gallium/drivers/nv10/nv10_surface.c b/src/gallium/drivers/nv10/nv10_surface.c
index be44c7bed5..78fd7b42da 100644
--- a/src/gallium/drivers/nv10/nv10_surface.c
+++ b/src/gallium/drivers/nv10/nv10_surface.c
@@ -28,7 +28,7 @@
#include "nv10_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"
diff --git a/src/gallium/drivers/nv20/nv20_clear.c b/src/gallium/drivers/nv20/nv20_clear.c
index 81b6f3e78a..29f4afd87c 100644
--- a/src/gallium/drivers/nv20/nv20_clear.c
+++ b/src/gallium/drivers/nv20/nv20_clear.c
@@ -9,4 +9,5 @@ nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
+ ps->status = PIPE_SURFACE_STATUS_CLEAR;
}
diff --git a/src/gallium/drivers/nv20/nv20_context.c b/src/gallium/drivers/nv20/nv20_context.c
index c8fb690ee9..1659aec8fa 100644
--- a/src/gallium/drivers/nv20/nv20_context.c
+++ b/src/gallium/drivers/nv20/nv20_context.c
@@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "nv20_context.h"
#include "nv20_screen.h"
@@ -263,7 +263,7 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
BEGIN_RING(kelvin, NV20TCL_DEPTH_FUNC, 1);
OUT_RING (NV20TCL_DEPTH_FUNC_LESS);
BEGIN_RING(kelvin, NV20TCL_DEPTH_WRITE_ENABLE, 1);
- OUT_RING (1);
+ OUT_RING (0);
BEGIN_RING(kelvin, NV20TCL_DEPTH_TEST_ENABLE, 1);
OUT_RING (0);
BEGIN_RING(kelvin, NV20TCL_POLYGON_OFFSET_FACTOR, 2);
@@ -349,7 +349,7 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
memset(projectionmatrix, 0, sizeof(projectionmatrix));
projectionmatrix[0*4+0] = 1.0;
projectionmatrix[1*4+1] = 1.0;
- projectionmatrix[2*4+2] = 1.0;
+ projectionmatrix[2*4+2] = 16777215.0;
projectionmatrix[3*4+3] = 1.0;
BEGIN_RING(kelvin, NV20TCL_PROJECTION_MATRIX(0), 16);
for (i = 0; i < 16; i++) {
@@ -357,20 +357,20 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
}
BEGIN_RING(kelvin, NV20TCL_DEPTH_RANGE_NEAR, 2);
- OUT_RINGf (0.0);
- OUT_RINGf (16777216.0); /* bpp dependant? */
+ OUT_RINGf (0.0);
+ OUT_RINGf (16777216.0); /* [0, 1] scaled approx to [0, 2^24] */
BEGIN_RING(kelvin, NV20TCL_VIEWPORT_SCALE0_X, 4);
- OUT_RINGf (0.0); /* x-offset */
- OUT_RINGf (0.0); /* y-offset */
- OUT_RINGf (16777215.0 * 0.5);
- OUT_RING (0);
+ OUT_RINGf (0.0); /* x-offset, w/2 + 1.031250 */
+ OUT_RINGf (0.0); /* y-offset, h/2 + 0.030762 */
+ OUT_RINGf (0.0);
+ OUT_RINGf (16777215.0);
BEGIN_RING(kelvin, NV20TCL_VIEWPORT_SCALE1_X, 4);
- OUT_RINGf (0.0); /* no effect? */
- OUT_RINGf (0.0); /* no effect? */
- OUT_RINGf (16777215.0 * 0.5);
- OUT_RINGf (65535.0);
+ OUT_RINGf (0.0); /* no effect?, w/2 */
+ OUT_RINGf (0.0); /* no effect?, h/2 */
+ OUT_RINGf (16777215.0 * 0.5);
+ OUT_RINGf (65535.0);
FIRE_RING (NULL);
}
diff --git a/src/gallium/drivers/nv20/nv20_prim_vbuf.c b/src/gallium/drivers/nv20/nv20_prim_vbuf.c
index 74540845a8..4dd7052814 100644
--- a/src/gallium/drivers/nv20/nv20_prim_vbuf.c
+++ b/src/gallium/drivers/nv20/nv20_prim_vbuf.c
@@ -40,7 +40,7 @@
#include "pipe/p_debug.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "nv20_context.h"
#include "nv20_state.h"
diff --git a/src/gallium/drivers/nv20/nv20_screen.c b/src/gallium/drivers/nv20/nv20_screen.c
index 2ca6e6b149..f09b364b8d 100644
--- a/src/gallium/drivers/nv20/nv20_screen.c
+++ b/src/gallium/drivers/nv20/nv20_screen.c
@@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
+#include "util/u_simple_screen.h"
#include "nv20_context.h"
#include "nv20_screen.h"
@@ -200,6 +201,7 @@ nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv20_surface_unmap;
nv20_screen_init_miptree_functions(&screen->pipe);
+ u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}
diff --git a/src/gallium/drivers/nv20/nv20_state.c b/src/gallium/drivers/nv20/nv20_state.c
index 21bde5b81f..ecec4f49a0 100644
--- a/src/gallium/drivers/nv20/nv20_state.c
+++ b/src/gallium/drivers/nv20/nv20_state.c
@@ -335,17 +335,17 @@ nv20_depth_stencil_alpha_state_create(struct pipe_context *pipe,
hw->depth.test_enable = cso->depth.enabled ? 1 : 0;
hw->stencil.enable = cso->stencil[0].enabled ? 1 : 0;
- hw->stencil.wmask = cso->stencil[0].write_mask;
+ hw->stencil.wmask = cso->stencil[0].writemask;
hw->stencil.func = nvgl_comparison_op(cso->stencil[0].func);
hw->stencil.ref = cso->stencil[0].ref_value;
- hw->stencil.vmask = cso->stencil[0].value_mask;
+ hw->stencil.vmask = cso->stencil[0].valuemask;
hw->stencil.fail = nvgl_stencil_op(cso->stencil[0].fail_op);
hw->stencil.zfail = nvgl_stencil_op(cso->stencil[0].zfail_op);
hw->stencil.zpass = nvgl_stencil_op(cso->stencil[0].zpass_op);
hw->alpha.enabled = cso->alpha.enabled ? 1 : 0;
hw->alpha.func = nvgl_comparison_op(cso->alpha.func);
- hw->alpha.ref = float_to_ubyte(cso->alpha.ref);
+ hw->alpha.ref = float_to_ubyte(cso->alpha.ref_value);
return (void *)hw;
}
@@ -460,11 +460,12 @@ nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
if (buf) {
void *mapped;
- if (buf->size && (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
+ if (buf->buffer && buf->buffer->size &&
+ (mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
{
- memcpy(nv20->constbuf[shader], mapped, buf->size);
+ memcpy(nv20->constbuf[shader], mapped, buf->buffer->size);
nv20->constbuf_nr[shader] =
- buf->size / (4 * sizeof(float));
+ buf->buffer->size / (4 * sizeof(float));
ws->buffer_unmap(ws, buf->buffer);
}
}
diff --git a/src/gallium/drivers/nv20/nv20_state_emit.c b/src/gallium/drivers/nv20/nv20_state_emit.c
index cbdc674b09..ea20078a50 100644
--- a/src/gallium/drivers/nv20/nv20_state_emit.c
+++ b/src/gallium/drivers/nv20/nv20_state_emit.c
@@ -73,6 +73,9 @@ static void nv20_state_emit_dsa(struct nv20_context* nv20)
BEGIN_RING(kelvin, NV20TCL_DEPTH_TEST_ENABLE, 1);
OUT_RING (d->depth.test_enable);
+ BEGIN_RING(kelvin, NV20TCL_DEPTH_UNK17D8, 1);
+ OUT_RING (1);
+
#if 0
BEGIN_RING(kelvin, NV20TCL_STENCIL_ENABLE, 1);
OUT_RING (d->stencil.enable);
@@ -352,16 +355,14 @@ nv20_emit_hw_state(struct nv20_context *nv20)
*/
/* Render target */
-/* XXX figre out who's who for NV10TCL_DMA_* and fill accordingly
- * BEGIN_RING(kelvin, NV20TCL_DMA_COLOR0, 1);
- * OUT_RELOCo(nv20->rt[0], NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); */
+ BEGIN_RING(kelvin, NV20TCL_DMA_COLOR, 1);
+ OUT_RELOCo(nv20->rt[0], NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(kelvin, NV20TCL_COLOR_OFFSET, 1);
OUT_RELOCl(nv20->rt[0], 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
if (nv20->zeta) {
-/* XXX
- * BEGIN_RING(kelvin, NV20TCL_DMA_ZETA, 1);
- * OUT_RELOCo(nv20->zeta, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); */
+ BEGIN_RING(kelvin, NV20TCL_DMA_ZETA, 1);
+ OUT_RELOCo(nv20->zeta, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(kelvin, NV20TCL_ZETA_OFFSET, 1);
OUT_RELOCl(nv20->zeta, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
/* XXX for when we allocate LMA on nv17 */
diff --git a/src/gallium/drivers/nv20/nv20_surface.c b/src/gallium/drivers/nv20/nv20_surface.c
index 7bc68d0ca2..9b4c028eae 100644
--- a/src/gallium/drivers/nv20/nv20_surface.c
+++ b/src/gallium/drivers/nv20/nv20_surface.c
@@ -28,7 +28,7 @@
#include "nv20_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"
diff --git a/src/gallium/drivers/nv20/nv20_vbo.c b/src/gallium/drivers/nv20/nv20_vbo.c
index 4edc4efebd..24d8f4bef0 100644
--- a/src/gallium/drivers/nv20/nv20_vbo.c
+++ b/src/gallium/drivers/nv20/nv20_vbo.c
@@ -64,6 +64,7 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
draw_set_mapped_element_buffer(draw, 0, NULL);
}
+ draw_flush(nv20->draw);
return TRUE;
}
diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c
index 2bff28aca9..61654f8756 100644
--- a/src/gallium/drivers/nv30/nv30_context.c
+++ b/src/gallium/drivers/nv30/nv30_context.c
@@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "nv30_context.h"
#include "nv30_screen.h"
diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c
index 54fb3585f8..79baac714c 100644
--- a/src/gallium/drivers/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nv30/nv30_miptree.c
@@ -181,7 +181,7 @@ nv30_miptree_surface_del(struct pipe_screen *pscreen,
return;
pipe_texture_reference(&ps->texture, NULL);
- pipe_buffer_reference(pscreen->winsys, &ps->buffer, NULL);
+ pipe_buffer_reference(pscreen, &ps->buffer, NULL);
FREE(ps);
}
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 1fac6d3df8..0f10d914ad 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
+#include "util/u_simple_screen.h"
#include "nv30_context.h"
#include "nv30_screen.h"
@@ -381,6 +382,7 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv30_surface_unmap;
nv30_screen_init_miptree_functions(&screen->pipe);
+ u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}
diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c
index 47e1a625af..26147565a5 100644
--- a/src/gallium/drivers/nv30/nv30_state.c
+++ b/src/gallium/drivers/nv30/nv30_state.c
@@ -444,15 +444,15 @@ nv30_depth_stencil_alpha_state_create(struct pipe_context *pipe,
so_method(so, rankine, NV34TCL_ALPHA_FUNC_ENABLE, 3);
so_data (so, cso->alpha.enabled ? 1 : 0);
so_data (so, nvgl_comparison_op(cso->alpha.func));
- so_data (so, float_to_ubyte(cso->alpha.ref));
+ so_data (so, float_to_ubyte(cso->alpha.ref_value));
if (cso->stencil[0].enabled) {
so_method(so, rankine, NV34TCL_STENCIL_FRONT_ENABLE, 8);
so_data (so, cso->stencil[0].enabled ? 1 : 0);
- so_data (so, cso->stencil[0].write_mask);
+ so_data (so, cso->stencil[0].writemask);
so_data (so, nvgl_comparison_op(cso->stencil[0].func));
so_data (so, cso->stencil[0].ref_value);
- so_data (so, cso->stencil[0].value_mask);
+ so_data (so, cso->stencil[0].valuemask);
so_data (so, nvgl_stencil_op(cso->stencil[0].fail_op));
so_data (so, nvgl_stencil_op(cso->stencil[0].zfail_op));
so_data (so, nvgl_stencil_op(cso->stencil[0].zpass_op));
@@ -464,10 +464,10 @@ nv30_depth_stencil_alpha_state_create(struct pipe_context *pipe,
if (cso->stencil[1].enabled) {
so_method(so, rankine, NV34TCL_STENCIL_BACK_ENABLE, 8);
so_data (so, cso->stencil[1].enabled ? 1 : 0);
- so_data (so, cso->stencil[1].write_mask);
+ so_data (so, cso->stencil[1].writemask);
so_data (so, nvgl_comparison_op(cso->stencil[1].func));
so_data (so, cso->stencil[1].ref_value);
- so_data (so, cso->stencil[1].value_mask);
+ so_data (so, cso->stencil[1].valuemask);
so_data (so, nvgl_stencil_op(cso->stencil[1].fail_op));
so_data (so, nvgl_stencil_op(cso->stencil[1].zfail_op));
so_data (so, nvgl_stencil_op(cso->stencil[1].zpass_op));
@@ -592,7 +592,7 @@ nv30_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
struct nv30_context *nv30 = nv30_context(pipe);
nv30->constbuf[shader] = buf->buffer;
- nv30->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
+ nv30->constbuf_nr[shader] = buf->buffer->size / (4 * sizeof(float));
if (shader == PIPE_SHADER_VERTEX) {
nv30->dirty |= NV30_NEW_VERTPROG;
diff --git a/src/gallium/drivers/nv30/nv30_state_emit.c b/src/gallium/drivers/nv30/nv30_state_emit.c
index 9480695d6e..f77b08ff69 100644
--- a/src/gallium/drivers/nv30/nv30_state_emit.c
+++ b/src/gallium/drivers/nv30/nv30_state_emit.c
@@ -24,7 +24,7 @@ nv30_state_do_validate(struct nv30_context *nv30,
const struct pipe_framebuffer_state *fb = &nv30->framebuffer;
unsigned i;
- for (i = 0; i < fb->num_cbufs; i++)
+ for (i = 0; i < fb->nr_cbufs; i++)
fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
if (fb->zsbuf)
fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c
index 73bdf7e56c..8536acc570 100644
--- a/src/gallium/drivers/nv30/nv30_state_fb.c
+++ b/src/gallium/drivers/nv30/nv30_state_fb.c
@@ -14,7 +14,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
unsigned h = fb->height;
rt_enable = 0;
- for (i = 0; i < fb->num_cbufs; i++) {
+ for (i = 0; i < fb->nr_cbufs; i++) {
if (colour_format) {
assert(colour_format == fb->cbufs[i]->format);
} else {
@@ -34,7 +34,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
if (!(rt[0]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
- for (i = 1; i < fb->num_cbufs; i++)
+ for (i = 1; i < fb->nr_cbufs; i++)
assert(!(rt[i]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
/* FIXME: NV34TCL_RT_FORMAT_LOG2_[WIDTH/HEIGHT] */
diff --git a/src/gallium/drivers/nv30/nv30_surface.c b/src/gallium/drivers/nv30/nv30_surface.c
index d3376a73bf..806131dcc9 100644
--- a/src/gallium/drivers/nv30/nv30_surface.c
+++ b/src/gallium/drivers/nv30/nv30_surface.c
@@ -28,7 +28,7 @@
#include "nv30_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"
diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c
index 556f981d4a..2d6d48ac16 100644
--- a/src/gallium/drivers/nv30/nv30_vbo.c
+++ b/src/gallium/drivers/nv30/nv30_vbo.c
@@ -503,7 +503,7 @@ nv30_vbo_validate(struct nv30_context *nv30)
ve = &nv30->vtxelt[hw];
vb = &nv30->vtxbuf[ve->vertex_buffer_index];
- if (!vb->pitch) {
+ if (!vb->stride) {
if (!sattr)
sattr = so_new(16 * 5, 0);
@@ -524,7 +524,7 @@ nv30_vbo_validate(struct nv30_context *nv30)
so_reloc(vtxbuf, vb->buffer, vb->buffer_offset + ve->src_offset,
vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
0, NV34TCL_VTXBUF_ADDRESS_DMA1);
- so_data (vtxfmt, ((vb->pitch << NV34TCL_VTXFMT_STRIDE_SHIFT) |
+ so_data (vtxfmt, ((vb->stride << NV34TCL_VTXFMT_STRIDE_SHIFT) |
(ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | type));
}
diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c
index cc63dd734b..5d325f5067 100644
--- a/src/gallium/drivers/nv40/nv40_context.c
+++ b/src/gallium/drivers/nv40/nv40_context.c
@@ -1,6 +1,6 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "nv40_context.h"
#include "nv40_screen.h"
diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c
index 8e56cdc2fe..c83ff91d7e 100644
--- a/src/gallium/drivers/nv40/nv40_draw.c
+++ b/src/gallium/drivers/nv40/nv40_draw.c
@@ -242,7 +242,7 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
for (i = 0; i < nv40->vtxbuf_nr; i++) {
map = ws->buffer_map(ws, nv40->vtxbuf[i].buffer,
- PIPE_BUFFER_USAGE_CPU_READ);
+ PIPE_BUFFER_USAGE_CPU_READ);
draw_set_mapped_vertex_buffer(nv40->draw, i, map);
}
diff --git a/src/gallium/drivers/nv40/nv40_screen.c b/src/gallium/drivers/nv40/nv40_screen.c
index ab128fecda..46fe133d71 100644
--- a/src/gallium/drivers/nv40/nv40_screen.c
+++ b/src/gallium/drivers/nv40/nv40_screen.c
@@ -1,4 +1,5 @@
#include "pipe/p_screen.h"
+#include "util/u_simple_screen.h"
#include "nv40_context.h"
#include "nv40_screen.h"
@@ -363,6 +364,7 @@ nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
screen->pipe.surface_unmap = nv40_surface_unmap;
nv40_screen_init_miptree_functions(&screen->pipe);
+ u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}
diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c
index 255c4b294d..2eff25aa83 100644
--- a/src/gallium/drivers/nv40/nv40_state.c
+++ b/src/gallium/drivers/nv40/nv40_state.c
@@ -454,15 +454,15 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe,
so_method(so, curie, NV40TCL_ALPHA_TEST_ENABLE, 3);
so_data (so, cso->alpha.enabled ? 1 : 0);
so_data (so, nvgl_comparison_op(cso->alpha.func));
- so_data (so, float_to_ubyte(cso->alpha.ref));
+ so_data (so, float_to_ubyte(cso->alpha.ref_value));
if (cso->stencil[0].enabled) {
so_method(so, curie, NV40TCL_STENCIL_FRONT_ENABLE, 8);
so_data (so, cso->stencil[0].enabled ? 1 : 0);
- so_data (so, cso->stencil[0].write_mask);
+ so_data (so, cso->stencil[0].writemask);
so_data (so, nvgl_comparison_op(cso->stencil[0].func));
so_data (so, cso->stencil[0].ref_value);
- so_data (so, cso->stencil[0].value_mask);
+ so_data (so, cso->stencil[0].valuemask);
so_data (so, nvgl_stencil_op(cso->stencil[0].fail_op));
so_data (so, nvgl_stencil_op(cso->stencil[0].zfail_op));
so_data (so, nvgl_stencil_op(cso->stencil[0].zpass_op));
@@ -474,10 +474,10 @@ nv40_depth_stencil_alpha_state_create(struct pipe_context *pipe,
if (cso->stencil[1].enabled) {
so_method(so, curie, NV40TCL_STENCIL_BACK_ENABLE, 8);
so_data (so, cso->stencil[1].enabled ? 1 : 0);
- so_data (so, cso->stencil[1].write_mask);
+ so_data (so, cso->stencil[1].writemask);
so_data (so, nvgl_comparison_op(cso->stencil[1].func));
so_data (so, cso->stencil[1].ref_value);
- so_data (so, cso->stencil[1].value_mask);
+ so_data (so, cso->stencil[1].valuemask);
so_data (so, nvgl_stencil_op(cso->stencil[1].fail_op));
so_data (so, nvgl_stencil_op(cso->stencil[1].zfail_op));
so_data (so, nvgl_stencil_op(cso->stencil[1].zpass_op));
@@ -607,7 +607,7 @@ nv40_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
struct nv40_context *nv40 = nv40_context(pipe);
nv40->constbuf[shader] = buf->buffer;
- nv40->constbuf_nr[shader] = buf->size / (4 * sizeof(float));
+ nv40->constbuf_nr[shader] = buf->buffer->size / (4 * sizeof(float));
if (shader == PIPE_SHADER_VERTEX) {
nv40->dirty |= NV40_NEW_VERTPROG;
diff --git a/src/gallium/drivers/nv40/nv40_state_emit.c b/src/gallium/drivers/nv40/nv40_state_emit.c
index 52ec4c044b..ce859def10 100644
--- a/src/gallium/drivers/nv40/nv40_state_emit.c
+++ b/src/gallium/drivers/nv40/nv40_state_emit.c
@@ -41,7 +41,7 @@ nv40_state_do_validate(struct nv40_context *nv40,
const struct pipe_framebuffer_state *fb = &nv40->framebuffer;
unsigned i;
- for (i = 0; i < fb->num_cbufs; i++)
+ for (i = 0; i < fb->nr_cbufs; i++)
fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
if (fb->zsbuf)
fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c
index 28592d71c3..a2e09e18a4 100644
--- a/src/gallium/drivers/nv40/nv40_state_fb.c
+++ b/src/gallium/drivers/nv40/nv40_state_fb.c
@@ -14,7 +14,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
unsigned h = fb->height;
rt_enable = 0;
- for (i = 0; i < fb->num_cbufs; i++) {
+ for (i = 0; i < fb->nr_cbufs; i++) {
if (colour_format) {
assert(colour_format == fb->cbufs[i]->format);
} else {
@@ -35,7 +35,7 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40)
if (!(rt[0]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) {
assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
- for (i = 1; i < fb->num_cbufs; i++)
+ for (i = 1; i < fb->nr_cbufs; i++)
assert(!(rt[i]->texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR));
rt_format = NV40TCL_RT_FORMAT_TYPE_SWIZZLED |
diff --git a/src/gallium/drivers/nv40/nv40_surface.c b/src/gallium/drivers/nv40/nv40_surface.c
index 576af7c59e..aa51d04051 100644
--- a/src/gallium/drivers/nv40/nv40_surface.c
+++ b/src/gallium/drivers/nv40/nv40_surface.c
@@ -28,7 +28,7 @@
#include "nv40_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"
diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c
index 09f6e79d32..8f1834628f 100644
--- a/src/gallium/drivers/nv40/nv40_vbo.c
+++ b/src/gallium/drivers/nv40/nv40_vbo.c
@@ -501,7 +501,7 @@ nv40_vbo_validate(struct nv40_context *nv40)
ve = &nv40->vtxelt[hw];
vb = &nv40->vtxbuf[ve->vertex_buffer_index];
- if (!vb->pitch) {
+ if (!vb->stride) {
if (!sattr)
sattr = so_new(16 * 5, 0);
@@ -522,7 +522,7 @@ nv40_vbo_validate(struct nv40_context *nv40)
so_reloc(vtxbuf, vb->buffer, vb->buffer_offset + ve->src_offset,
vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
0, NV40TCL_VTXBUF_ADDRESS_DMA1);
- so_data (vtxfmt, ((vb->pitch << NV40TCL_VTXFMT_STRIDE_SHIFT) |
+ so_data (vtxfmt, ((vb->stride << NV40TCL_VTXFMT_STRIDE_SHIFT) |
(ncomp << NV40TCL_VTXFMT_SIZE_SHIFT) | type));
}
diff --git a/src/gallium/drivers/nv50/nv50_clear.c b/src/gallium/drivers/nv50/nv50_clear.c
index a31a42d6b5..6380f397ea 100644
--- a/src/gallium/drivers/nv50/nv50_clear.c
+++ b/src/gallium/drivers/nv50/nv50_clear.c
@@ -39,10 +39,10 @@ nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
if (ps->format == PIPE_FORMAT_Z24S8_UNORM ||
ps->format == PIPE_FORMAT_Z16_UNORM) {
- fb.num_cbufs = 0;
+ fb.nr_cbufs = 0;
fb.zsbuf = ps;
} else {
- fb.num_cbufs = 1;
+ fb.nr_cbufs = 1;
fb.cbufs[0] = ps;
fb.zsbuf = NULL;
}
diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c
index b02c53f209..99776239d2 100644
--- a/src/gallium/drivers/nv50/nv50_context.c
+++ b/src/gallium/drivers/nv50/nv50_context.c
@@ -22,7 +22,7 @@
#include "draw/draw_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "nv50_context.h"
#include "nv50_screen.h"
diff --git a/src/gallium/drivers/nv50/nv50_query.c b/src/gallium/drivers/nv50/nv50_query.c
index b923c820eb..1b3a41340a 100644
--- a/src/gallium/drivers/nv50/nv50_query.c
+++ b/src/gallium/drivers/nv50/nv50_query.c
@@ -62,7 +62,7 @@ nv50_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
struct nv50_query *q = nv50_query(pq);
if (q) {
- pipe_buffer_reference(pipe, &q->buffer, NULL);
+ pipe_buffer_reference(pipe->screen, &q->buffer, NULL);
FREE(q);
}
}
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index ef46233f83..6cddddacd5 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -22,6 +22,8 @@
#include "pipe/p_screen.h"
+#include "util/u_simple_screen.h"
+
#include "nv50_context.h"
#include "nv50_screen.h"
@@ -323,6 +325,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
nv50_screen_init_miptree_functions(&screen->pipe);
nv50_surface_init_screen_functions(&screen->pipe);
+ u_simple_screen_init(&screen->pipe);
return &screen->pipe;
}
diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c
index 38c1d938b8..787ff958ec 100644
--- a/src/gallium/drivers/nv50/nv50_state.c
+++ b/src/gallium/drivers/nv50/nv50_state.c
@@ -403,8 +403,8 @@ nv50_depth_stencil_alpha_state_create(struct pipe_context *pipe,
so_data (so, nvgl_comparison_op(cso->stencil[0].func));
so_method(so, tesla, NV50TCL_STENCIL_BACK_FUNC_REF, 3);
so_data (so, cso->stencil[0].ref_value);
- so_data (so, cso->stencil[0].write_mask);
- so_data (so, cso->stencil[0].value_mask);
+ so_data (so, cso->stencil[0].writemask);
+ so_data (so, cso->stencil[0].valuemask);
} else {
so_method(so, tesla, NV50TCL_STENCIL_BACK_ENABLE, 1);
so_data (so, 0);
@@ -418,8 +418,8 @@ nv50_depth_stencil_alpha_state_create(struct pipe_context *pipe,
so_data (so, nvgl_stencil_op(cso->stencil[1].zpass_op));
so_data (so, nvgl_comparison_op(cso->stencil[1].func));
so_data (so, cso->stencil[1].ref_value);
- so_data (so, cso->stencil[1].write_mask);
- so_data (so, cso->stencil[1].value_mask);
+ so_data (so, cso->stencil[1].writemask);
+ so_data (so, cso->stencil[1].valuemask);
} else {
so_method(so, tesla, NV50TCL_STENCIL_FRONT_ENABLE, 1);
so_data (so, 0);
@@ -429,7 +429,7 @@ nv50_depth_stencil_alpha_state_create(struct pipe_context *pipe,
so_method(so, tesla, NV50TCL_ALPHA_TEST_ENABLE, 1);
so_data (so, 1);
so_method(so, tesla, NV50TCL_ALPHA_TEST_REF, 2);
- so_data (so, fui(cso->alpha.ref));
+ so_data (so, fui(cso->alpha.ref_value));
so_data (so, nvgl_comparison_op(cso->alpha.func));
} else {
so_method(so, tesla, NV50TCL_ALPHA_TEST_ENABLE, 1);
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 198e25f448..4dc4c04493 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -31,7 +31,7 @@ nv50_state_validate_fb(struct nv50_context *nv50)
struct pipe_framebuffer_state *fb = &nv50->framebuffer;
unsigned i, w, h, gw = 0;
- for (i = 0; i < fb->num_cbufs; i++) {
+ for (i = 0; i < fb->nr_cbufs; i++) {
if (!gw) {
w = fb->cbufs[i]->width;
h = fb->cbufs[i]->height;
@@ -178,7 +178,7 @@ nv50_state_validate(struct nv50_context *nv50)
struct nouveau_stateobj *so;
unsigned i;
- for (i = 0; i < fb->num_cbufs; i++)
+ for (i = 0; i < fb->nr_cbufs; i++)
fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
if (fb->zsbuf)
diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c
index 3f45a2fe18..ed6602ba36 100644
--- a/src/gallium/drivers/nv50/nv50_surface.c
+++ b/src/gallium/drivers/nv50/nv50_surface.c
@@ -22,7 +22,7 @@
#include "nv50_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_tile.h"
diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c
index 435dc9777d..c482a4c241 100644
--- a/src/gallium/drivers/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nv50/nv50_vbo.c
@@ -226,7 +226,7 @@ nv50_vbo_validate(struct nv50_context *nv50)
}
so_method(vtxbuf, tesla, 0x900 + (i * 16), 3);
- so_data (vtxbuf, 0x20000000 | vb->pitch);
+ so_data (vtxbuf, 0x20000000 | vb->stride);
so_reloc (vtxbuf, vb->buffer, vb->buffer_offset +
ve->src_offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0);
diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c
index dfa46c9fb7..ad108ec446 100644
--- a/src/gallium/drivers/softpipe/sp_clear.c
+++ b/src/gallium/drivers/softpipe/sp_clear.c
@@ -85,7 +85,7 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
#endif
}
- for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) {
+ for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[i])) {
unsigned cv;
if (ps->format != PIPE_FORMAT_A8R8G8B8_UNORM) {
diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c
index 800f944838..c2d882a819 100644
--- a/src/gallium/drivers/softpipe/sp_context.c
+++ b/src/gallium/drivers/softpipe/sp_context.c
@@ -57,7 +57,7 @@ softpipe_map_surfaces(struct softpipe_context *sp)
{
unsigned i;
- for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
+ for (i = 0; i < sp->framebuffer.nr_cbufs; i++) {
sp_tile_cache_map_surfaces(sp->cbuf_cache[i]);
}
@@ -73,11 +73,11 @@ softpipe_unmap_surfaces(struct softpipe_context *sp)
{
uint i;
- for (i = 0; i < sp->framebuffer.num_cbufs; i++)
+ for (i = 0; i < sp->framebuffer.nr_cbufs; i++)
sp_flush_tile_cache(sp, sp->cbuf_cache[i]);
sp_flush_tile_cache(sp, sp->zsbuf_cache);
- for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
+ for (i = 0; i < sp->framebuffer.nr_cbufs; i++) {
sp_tile_cache_unmap_surfaces(sp->cbuf_cache[i]);
}
sp_tile_cache_unmap_surfaces(sp->zsbuf_cache);
@@ -87,7 +87,7 @@ softpipe_unmap_surfaces(struct softpipe_context *sp)
static void softpipe_destroy( struct pipe_context *pipe )
{
struct softpipe_context *softpipe = softpipe_context( pipe );
- struct pipe_winsys *ws = pipe->winsys;
+ struct pipe_screen *screen = pipe->screen;
uint i;
if (softpipe->draw)
@@ -116,7 +116,7 @@ static void softpipe_destroy( struct pipe_context *pipe )
for (i = 0; i < Elements(softpipe->constants); i++) {
if (softpipe->constants[i].buffer) {
- winsys_buffer_reference(ws, &softpipe->constants[i].buffer, NULL);
+ pipe_buffer_reference(screen, &softpipe->constants[i].buffer, NULL);
}
}
diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c
index 424bd56846..ecc9d00319 100644
--- a/src/gallium/drivers/softpipe/sp_draw_arrays.c
+++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c
@@ -33,7 +33,7 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "sp_context.h"
@@ -49,14 +49,14 @@ softpipe_map_constant_buffers(struct softpipe_context *sp)
struct pipe_winsys *ws = sp->pipe.winsys;
uint i;
for (i = 0; i < PIPE_SHADER_TYPES; i++) {
- if (sp->constants[i].size)
+ if (sp->constants[i].buffer && sp->constants[i].buffer->size)
sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer,
PIPE_BUFFER_USAGE_CPU_READ);
}
draw_set_mapped_constant_buffer(sp->draw,
sp->mapped_constants[PIPE_SHADER_VERTEX],
- sp->constants[PIPE_SHADER_VERTEX].size);
+ sp->constants[PIPE_SHADER_VERTEX].buffer->size);
}
static void
@@ -73,7 +73,7 @@ softpipe_unmap_constant_buffers(struct softpipe_context *sp)
draw_set_mapped_constant_buffer(sp->draw, NULL, 0);
for (i = 0; i < 2; i++) {
- if (sp->constants[i].size)
+ if (sp->constants[i].buffer && sp->constants[i].buffer->size)
ws->buffer_unmap(ws, sp->constants[i].buffer);
sp->mapped_constants[i] = NULL;
}
diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c
index 401764bb43..c21faf57f3 100644
--- a/src/gallium/drivers/softpipe/sp_flush.c
+++ b/src/gallium/drivers/softpipe/sp_flush.c
@@ -57,7 +57,7 @@ softpipe_flush( struct pipe_context *pipe,
}
if (flags & PIPE_FLUSH_RENDER_CACHE) {
- for (i = 0; i < softpipe->framebuffer.num_cbufs; i++)
+ for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++)
if (softpipe->cbuf_cache[i])
sp_flush_tile_cache(softpipe, softpipe->cbuf_cache[i]);
diff --git a/src/gallium/drivers/softpipe/sp_quad_alpha_test.c b/src/gallium/drivers/softpipe/sp_quad_alpha_test.c
index 5bebd141e9..85c9f037a3 100644
--- a/src/gallium/drivers/softpipe/sp_quad_alpha_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_alpha_test.c
@@ -14,7 +14,7 @@ static void
alpha_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
- const float ref = softpipe->depth_stencil->alpha.ref;
+ const float ref = softpipe->depth_stencil->alpha.ref_value;
unsigned passMask = 0x0, j;
const uint cbuf = 0; /* only output[0].alpha is tested */
const float *aaaa = quad->output.color[cbuf][3];
diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c
index 6f64c6e584..fb1d430a4f 100644
--- a/src/gallium/drivers/softpipe/sp_quad_blend.c
+++ b/src/gallium/drivers/softpipe/sp_quad_blend.c
@@ -105,7 +105,7 @@ logicop_quad(struct quad_stage *qs, struct quad_header *quad)
uint cbuf;
/* loop over colorbuffer outputs */
- for (cbuf = 0; cbuf < softpipe->framebuffer.num_cbufs; cbuf++) {
+ for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) {
float dest[4][QUAD_SIZE];
ubyte src[4][4], dst[4][4], res[4][4];
uint *src4 = (uint *) src;
@@ -239,7 +239,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
}
/* loop over colorbuffer outputs */
- for (cbuf = 0; cbuf < softpipe->framebuffer.num_cbufs; cbuf++) {
+ for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) {
float source[4][QUAD_SIZE], dest[4][QUAD_SIZE];
struct softpipe_cached_tile *tile
= sp_get_cached_tile(softpipe,
diff --git a/src/gallium/drivers/softpipe/sp_quad_bufloop.c b/src/gallium/drivers/softpipe/sp_quad_bufloop.c
index 92e9af09c1..d7d6a6974d 100644
--- a/src/gallium/drivers/softpipe/sp_quad_bufloop.c
+++ b/src/gallium/drivers/softpipe/sp_quad_bufloop.c
@@ -17,7 +17,7 @@ cbuf_loop_quad(struct quad_stage *qs, struct quad_header *quad)
unsigned i;
assert(sizeof(quad->outputs.color) == sizeof(tmp));
- assert(softpipe->framebuffer.num_cbufs <= PIPE_MAX_COLOR_BUFS);
+ assert(softpipe->framebuffer.nr_cbufs <= PIPE_MAX_COLOR_BUFS);
/* make copy of original colors since they can get modified
* by blending and masking.
@@ -28,7 +28,7 @@ cbuf_loop_quad(struct quad_stage *qs, struct quad_header *quad)
*/
memcpy(tmp, quad->outputs.color, sizeof(tmp));
- for (i = 0; i < softpipe->framebuffer.num_cbufs; i++) {
+ for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
/* set current cbuffer */
#if 0 /* obsolete & going away */
softpipe->current_cbuf = i;
diff --git a/src/gallium/drivers/softpipe/sp_quad_colormask.c b/src/gallium/drivers/softpipe/sp_quad_colormask.c
index f32bdfab78..563c2fc739 100644
--- a/src/gallium/drivers/softpipe/sp_quad_colormask.c
+++ b/src/gallium/drivers/softpipe/sp_quad_colormask.c
@@ -51,7 +51,7 @@ colormask_quad(struct quad_stage *qs, struct quad_header *quad)
uint cbuf;
/* loop over colorbuffer outputs */
- for (cbuf = 0; cbuf < softpipe->framebuffer.num_cbufs; cbuf++) {
+ for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) {
float dest[4][QUAD_SIZE];
struct softpipe_cached_tile *tile
= sp_get_cached_tile(softpipe,
diff --git a/src/gallium/drivers/softpipe/sp_quad_coverage.c b/src/gallium/drivers/softpipe/sp_quad_coverage.c
index ee29aa7dfe..c27fd1482d 100644
--- a/src/gallium/drivers/softpipe/sp_quad_coverage.c
+++ b/src/gallium/drivers/softpipe/sp_quad_coverage.c
@@ -53,7 +53,7 @@ coverage_quad(struct quad_stage *qs, struct quad_header *quad)
uint cbuf;
/* loop over colorbuffer outputs */
- for (cbuf = 0; cbuf < softpipe->framebuffer.num_cbufs; cbuf++) {
+ for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) {
float (*quadColor)[4] = quad->output.color[cbuf];
unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
diff --git a/src/gallium/drivers/softpipe/sp_quad_output.c b/src/gallium/drivers/softpipe/sp_quad_output.c
index b7aac7f84a..a37c8b4c39 100644
--- a/src/gallium/drivers/softpipe/sp_quad_output.c
+++ b/src/gallium/drivers/softpipe/sp_quad_output.c
@@ -48,7 +48,7 @@ output_quad(struct quad_stage *qs, struct quad_header *quad)
uint cbuf;
/* loop over colorbuffer outputs */
- for (cbuf = 0; cbuf < softpipe->framebuffer.num_cbufs; cbuf++) {
+ for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) {
struct softpipe_cached_tile *tile
= sp_get_cached_tile(softpipe,
softpipe->cbuf_cache[cbuf],
diff --git a/src/gallium/drivers/softpipe/sp_quad_stencil.c b/src/gallium/drivers/softpipe/sp_quad_stencil.c
index abb5487748..7495515764 100644
--- a/src/gallium/drivers/softpipe/sp_quad_stencil.c
+++ b/src/gallium/drivers/softpipe/sp_quad_stencil.c
@@ -222,8 +222,8 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
zFailOp = softpipe->depth_stencil->stencil[face].zfail_op;
zPassOp = softpipe->depth_stencil->stencil[face].zpass_op;
ref = softpipe->depth_stencil->stencil[face].ref_value;
- wrtMask = softpipe->depth_stencil->stencil[face].write_mask;
- valMask = softpipe->depth_stencil->stencil[face].value_mask;
+ wrtMask = softpipe->depth_stencil->stencil[face].writemask;
+ valMask = softpipe->depth_stencil->stencil[face].valuemask;
assert(ps); /* shouldn't get here if there's no stencil buffer */
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 11b08b3a82..7380a6ae2b 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -27,7 +27,8 @@
#include "util/u_memory.h"
-#include "pipe/p_winsys.h"
+#include "util/u_simple_screen.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
@@ -174,6 +175,7 @@ softpipe_create_screen(struct pipe_winsys *winsys)
screen->base.is_format_supported = softpipe_is_format_supported;
softpipe_init_screen_texture_funcs(&screen->base);
+ u_simple_screen_init(&screen->base);
return &screen->base;
}
diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c
index 13d8017393..b1adb9cb7a 100644
--- a/src/gallium/drivers/softpipe/sp_setup.c
+++ b/src/gallium/drivers/softpipe/sp_setup.c
@@ -1497,7 +1497,7 @@ void setup_prepare( struct setup_context *setup )
}
/* Mark surfaces as defined now */
- for (i = 0; i < sp->framebuffer.num_cbufs; i++){
+ for (i = 0; i < sp->framebuffer.nr_cbufs; i++){
if (sp->framebuffer.cbufs[i]) {
sp->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
}
diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c
index e5b609cf6c..4d01a9dbe1 100644
--- a/src/gallium/drivers/softpipe/sp_state_fs.c
+++ b/src/gallium/drivers/softpipe/sp_state_fs.c
@@ -32,7 +32,7 @@
#include "pipe/p_defines.h"
#include "util/u_memory.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_shader_tokens.h"
#include "draw/draw_context.h"
#include "tgsi/tgsi_dump.h"
@@ -146,16 +146,15 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
const struct pipe_constant_buffer *buf)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct pipe_winsys *ws = pipe->winsys;
+ struct pipe_screen *screen = pipe->screen;
assert(shader < PIPE_SHADER_TYPES);
assert(index == 0);
/* note: reference counting */
- winsys_buffer_reference(ws,
+ pipe_buffer_reference(screen,
&softpipe->constants[shader].buffer,
buf ? buf->buffer : NULL);
- softpipe->constants[shader].size = buf ? buf->size : 0;
softpipe->dirty |= SP_NEW_CONSTANTS;
}
diff --git a/src/gallium/drivers/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c
index b5376e522d..1493c65884 100644
--- a/src/gallium/drivers/softpipe/sp_state_surface.c
+++ b/src/gallium/drivers/softpipe/sp_state_surface.c
@@ -64,7 +64,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe,
}
}
- sp->framebuffer.num_cbufs = fb->num_cbufs;
+ sp->framebuffer.nr_cbufs = fb->nr_cbufs;
/* zbuf changing? */
if (sp->framebuffer.zsbuf != fb->zsbuf) {
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index faf9e871f9..5952378152 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -33,7 +33,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_math.h"
#include "util/u_memory.h"
@@ -106,11 +106,11 @@ softpipe_displaytarget_layout(struct pipe_screen *screen,
spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]);
spt->buffer = ws->surface_buffer_create( ws,
- spt->base.width[0],
- spt->base.height[0],
- spt->base.format,
- usage,
- &spt->stride[0]);
+ spt->base.width[0],
+ spt->base.height[0],
+ spt->base.format,
+ usage,
+ &spt->stride[0]);
return spt->buffer != NULL;
}
diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
index f0d51ad82e..ec8be27077 100644
--- a/src/gallium/drivers/trace/tr_context.c
+++ b/src/gallium/drivers/trace/tr_context.c
@@ -722,9 +722,9 @@ trace_context_set_framebuffer_state(struct pipe_context *_pipe,
/* Unwrap the input state */
memcpy(&unwrapped_state, state, sizeof(unwrapped_state));
- for(i = 0; i < state->num_cbufs; ++i)
+ for(i = 0; i < state->nr_cbufs; ++i)
unwrapped_state.cbufs[i] = trace_surface_unwrap(tr_ctx, state->cbufs[i]);
- for(i = state->num_cbufs; i < PIPE_MAX_COLOR_BUFS; ++i)
+ for(i = state->nr_cbufs; i < PIPE_MAX_COLOR_BUFS; ++i)
unwrapped_state.cbufs[i] = NULL;
unwrapped_state.zsbuf = trace_surface_unwrap(tr_ctx, state->zsbuf);
state = &unwrapped_state;
diff --git a/src/gallium/drivers/trace/tr_state.c b/src/gallium/drivers/trace/tr_state.c
index 986d939e0c..b23ccc1a3d 100644
--- a/src/gallium/drivers/trace/tr_state.c
+++ b/src/gallium/drivers/trace/tr_state.c
@@ -223,7 +223,6 @@ void trace_dump_constant_buffer(const struct pipe_constant_buffer *state)
trace_dump_struct_begin("pipe_constant_buffer");
trace_dump_member(ptr, state, buffer);
- trace_dump_member(uint, state, size);
trace_dump_struct_end();
}
@@ -280,9 +279,9 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_
trace_dump_member(uint, &state->stencil[i], fail_op);
trace_dump_member(uint, &state->stencil[i], zpass_op);
trace_dump_member(uint, &state->stencil[i], zfail_op);
- trace_dump_member(uint, &state->stencil[i], ref_value);
- trace_dump_member(uint, &state->stencil[i], value_mask);
- trace_dump_member(uint, &state->stencil[i], write_mask);
+ trace_dump_member(uint, &state->stencil[i], ref_value);
+ trace_dump_member(uint, &state->stencil[i], valuemask);
+ trace_dump_member(uint, &state->stencil[i], writemask);
trace_dump_struct_end();
trace_dump_elem_end();
}
@@ -293,7 +292,7 @@ void trace_dump_depth_stencil_alpha_state(const struct pipe_depth_stencil_alpha_
trace_dump_struct_begin("pipe_alpha_state");
trace_dump_member(bool, &state->alpha, enabled);
trace_dump_member(uint, &state->alpha, func);
- trace_dump_member(float, &state->alpha, ref);
+ trace_dump_member(float, &state->alpha, ref_value);
trace_dump_struct_end();
trace_dump_member_end();
@@ -351,7 +350,7 @@ void trace_dump_framebuffer_state(const struct pipe_framebuffer_state *state)
trace_dump_member(uint, state, width);
trace_dump_member(uint, state, height);
- trace_dump_member(uint, state, num_cbufs);
+ trace_dump_member(uint, state, nr_cbufs);
trace_dump_member_array(ptr, state, cbufs);
trace_dump_member(ptr, state, zsbuf);
@@ -435,7 +434,7 @@ void trace_dump_vertex_buffer(const struct pipe_vertex_buffer *state)
trace_dump_struct_begin("pipe_vertex_buffer");
- trace_dump_member(uint, state, pitch);
+ trace_dump_member(uint, state, stride);
trace_dump_member(uint, state, max_index);
trace_dump_member(uint, state, buffer_offset);
trace_dump_member(ptr, state, buffer);
diff --git a/src/gallium/drivers/trace/tr_winsys.h b/src/gallium/drivers/trace/tr_winsys.h
index 062ddf66a0..0fd2a40556 100644
--- a/src/gallium/drivers/trace/tr_winsys.h
+++ b/src/gallium/drivers/trace/tr_winsys.h
@@ -31,7 +31,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_debug.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
/**
diff --git a/src/gallium/include/pipe/p_winsys.h b/src/gallium/include/pipe/internal/p_winsys_screen.h
index 3ae83e8105..ee835578b2 100644
--- a/src/gallium/include/pipe/p_winsys.h
+++ b/src/gallium/include/pipe/internal/p_winsys_screen.h
@@ -36,7 +36,7 @@
#define P_WINSYS_H
-#include "p_format.h"
+#include "pipe/p_format.h"
#ifdef __cplusplus
@@ -178,7 +178,6 @@ struct pipe_winsys
};
-
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h
index 7378392616..1219c817b4 100644
--- a/src/gallium/include/pipe/p_inlines.h
+++ b/src/gallium/include/pipe/p_inlines.h
@@ -31,7 +31,6 @@
#include "p_context.h"
#include "p_defines.h"
#include "p_screen.h"
-#include "p_winsys.h"
#ifdef __cplusplus
@@ -89,29 +88,6 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
}
-/* XXX: thread safety issues!
- */
-static INLINE void
-winsys_buffer_reference(struct pipe_winsys *winsys,
- struct pipe_buffer **ptr,
- struct pipe_buffer *buf)
-{
- if (buf) {
- assert(buf->refcount);
- buf->refcount++;
- }
-
- if (*ptr) {
- assert((*ptr)->refcount);
- if(--(*ptr)->refcount == 0)
- winsys->buffer_destroy( winsys, *ptr );
- }
-
- *ptr = buf;
-}
-
-
-
/**
* \sa pipe_surface_reference
*/
@@ -152,20 +128,20 @@ pipe_texture_release(struct pipe_texture **ptr)
/**
- * Convenience wrappers for winsys buffer functions.
+ * Convenience wrappers for screen buffer functions.
*/
static INLINE struct pipe_buffer *
pipe_buffer_create( struct pipe_screen *screen,
unsigned alignment, unsigned usage, unsigned size )
{
- return screen->winsys->buffer_create(screen->winsys, alignment, usage, size);
+ return screen->buffer_create(screen, alignment, usage, size);
}
static INLINE struct pipe_buffer *
pipe_user_buffer_create( struct pipe_screen *screen, void *ptr, unsigned size )
{
- return screen->winsys->user_buffer_create(screen->winsys, ptr, size);
+ return screen->user_buffer_create(screen, ptr, size);
}
static INLINE void *
@@ -173,25 +149,36 @@ pipe_buffer_map(struct pipe_screen *screen,
struct pipe_buffer *buf,
unsigned usage)
{
- return screen->winsys->buffer_map(screen->winsys, buf, usage);
+ return screen->buffer_map(screen, buf, usage);
}
static INLINE void
pipe_buffer_unmap(struct pipe_screen *screen,
struct pipe_buffer *buf)
{
- screen->winsys->buffer_unmap(screen->winsys, buf);
+ screen->buffer_unmap(screen, buf);
}
-/* XXX when we're using this everywhere, get rid of
- * winsys_buffer_reference() above.
+/* XXX: thread safety issues!
*/
static INLINE void
pipe_buffer_reference(struct pipe_screen *screen,
struct pipe_buffer **ptr,
struct pipe_buffer *buf)
{
- winsys_buffer_reference(screen->winsys, ptr, buf);
+ if (buf) {
+ assert(buf->refcount);
+ buf->refcount++;
+ }
+
+ if (*ptr) {
+ assert((*ptr)->refcount);
+ if(--(*ptr)->refcount == 0) {
+ screen->buffer_destroy( screen, *ptr );
+ }
+ }
+
+ *ptr = buf;
}
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 3bedc75294..0bd7d12e22 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -48,6 +48,8 @@ extern "C" {
#endif
+/** Opaque type */
+struct pipe_fence_handle;
/**
* Gallium screen/adapter context. Basically everything
@@ -103,7 +105,7 @@ struct pipe_screen {
*/
struct pipe_texture * (*texture_blanket)(struct pipe_screen *,
const struct pipe_texture *templat,
- const unsigned *pitch,
+ const unsigned *stride,
struct pipe_buffer *buffer);
void (*texture_release)(struct pipe_screen *,
@@ -128,7 +130,108 @@ struct pipe_screen {
void (*surface_unmap)( struct pipe_screen *,
struct pipe_surface *surface );
-
+
+
+ /**
+ * Buffer management. Buffer attributes are mostly fixed over its lifetime.
+ *
+ */
+ struct pipe_buffer *(*buffer_create)( struct pipe_screen *screen,
+ unsigned alignment,
+ unsigned usage,
+ unsigned size );
+
+ /**
+ * Create a buffer that wraps user-space data.
+ *
+ * Effectively this schedules a delayed call to buffer_create
+ * followed by an upload of the data at *some point in the future*,
+ * or perhaps never. Basically the allocate/upload is delayed
+ * until the buffer is actually passed to hardware.
+ *
+ * The intention is to provide a quick way to turn regular data
+ * into a buffer, and secondly to avoid a copy operation if that
+ * data subsequently turns out to be only accessed by the CPU.
+ *
+ * Common example is OpenGL vertex buffers that are subsequently
+ * processed either by software TNL in the driver or by passing to
+ * hardware.
+ *
+ * XXX: What happens if the delayed call to buffer_create() fails?
+ *
+ * Note that ptr may be accessed at any time upto the time when the
+ * buffer is destroyed, so the data must not be freed before then.
+ */
+ struct pipe_buffer *(*user_buffer_create)(struct pipe_screen *screen,
+ void *ptr,
+ unsigned bytes);
+
+ /**
+ * Allocate storage for a display target surface.
+ *
+ * Often surfaces which are meant to be blitted to the front screen (i.e.,
+ * display targets) must be allocated with special characteristics, memory
+ * pools, or obtained directly from the windowing system.
+ *
+ * This callback is invoked by the pipe_screenwhen creating a texture marked
+ * with the PIPE_TEXTURE_USAGE_DISPLAY_TARGET flag to get the underlying
+ * buffer storage.
+ */
+ struct pipe_buffer *(*surface_buffer_create)(struct pipe_screen *screen,
+ unsigned width, unsigned height,
+ enum pipe_format format,
+ unsigned usage,
+ unsigned *stride);
+
+
+ /**
+ * Map the entire data store of a buffer object into the client's address.
+ * flags is bitmask of PIPE_BUFFER_USAGE_CPU_READ/WRITE flags.
+ */
+ void *(*buffer_map)( struct pipe_screen *screen,
+ struct pipe_buffer *buf,
+ unsigned usage );
+
+ void (*buffer_unmap)( struct pipe_screen *screen,
+ struct pipe_buffer *buf );
+
+ void (*buffer_destroy)( struct pipe_screen *screen,
+ struct pipe_buffer *buf );
+
+
+ /**
+ * Do any special operations to ensure frontbuffer contents are
+ * displayed, eg copy fake frontbuffer.
+ */
+ void (*flush_frontbuffer)( struct pipe_screen *screen,
+ struct pipe_surface *surf,
+ void *context_private );
+
+
+
+ /** Set ptr = fence, with reference counting */
+ void (*fence_reference)( struct pipe_screen *screen,
+ struct pipe_fence_handle **ptr,
+ struct pipe_fence_handle *fence );
+
+ /**
+ * Checks whether the fence has been signalled.
+ * \param flags driver-specific meaning
+ * \return zero on success.
+ */
+ int (*fence_signalled)( struct pipe_screen *screen,
+ struct pipe_fence_handle *fence,
+ unsigned flag );
+
+ /**
+ * Wait for the fence to finish.
+ * \param flags driver-specific meaning
+ * \return zero on success.
+ */
+ int (*fence_finish)( struct pipe_screen *screen,
+ struct pipe_fence_handle *fence,
+ unsigned flag );
+
};
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index abe7cbe9e7..13fa9ba848 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -162,7 +162,6 @@ struct pipe_clip_state
struct pipe_constant_buffer
{
struct pipe_buffer *buffer;
- unsigned size; /** in bytes (XXX: redundant!) */
};
@@ -188,9 +187,9 @@ struct pipe_stencil_state
unsigned fail_op:3; /**< PIPE_STENCIL_OP_x */
unsigned zpass_op:3; /**< PIPE_STENCIL_OP_x */
unsigned zfail_op:3; /**< PIPE_STENCIL_OP_x */
- ubyte ref_value;
- ubyte value_mask;
- ubyte write_mask;
+ ubyte ref_value;
+ ubyte valuemask;
+ ubyte writemask;
};
@@ -198,7 +197,7 @@ struct pipe_alpha_state
{
unsigned enabled:1;
unsigned func:3; /**< PIPE_FUNC_x */
- float ref; /**< reference value */
+ float ref_value; /**< reference value */
};
@@ -241,7 +240,7 @@ struct pipe_framebuffer_state
unsigned width, height;
/** multiple colorbuffers for multiple render targets */
- unsigned num_cbufs;
+ unsigned nr_cbufs;
struct pipe_surface *cbufs[PIPE_MAX_COLOR_BUFS];
struct pipe_surface *zsbuf; /**< Z/stencil buffer */
@@ -337,7 +336,7 @@ struct pipe_texture
*/
struct pipe_vertex_buffer
{
- unsigned pitch; /**< stride to same attrib in next vertex, in bytes */
+ unsigned stride; /**< stride to same attrib in next vertex, in bytes */
unsigned max_index; /**< number of vertices in this buffer */
unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */
struct pipe_buffer *buffer; /**< the actual buffer */
diff --git a/src/gallium/state_trackers/egl/egl_context.c b/src/gallium/state_trackers/egl/egl_context.c
index 217fe00338..8564972b91 100644
--- a/src/gallium/state_trackers/egl/egl_context.c
+++ b/src/gallium/state_trackers/egl/egl_context.c
@@ -10,7 +10,6 @@
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
-#include "pipe/p_winsys.h"
#include "state_tracker/st_public.h"
#include "state_tracker/drm_api.h"
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index 71292bf2a9..091d437d81 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -80,7 +80,6 @@ drm_create_texture(_EGLDriver *drv,
unsigned stride = 1024;
unsigned pitch = 0;
unsigned size = 0;
- void *ptr;
/* ugly */
if (stride < w)
@@ -98,14 +97,6 @@ drm_create_texture(_EGLDriver *drv,
if (!buf)
goto err_buf;
-#if DEBUG
- ptr = pipe_buffer_map(screen, buf, PIPE_BUFFER_USAGE_CPU_WRITE);
- memset(ptr, 0xFF, size);
- pipe_buffer_unmap(screen, buf);
-#else
- (void)ptr;
-#endif
-
memset(&templat, 0, sizeof(templat));
templat.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
@@ -280,6 +271,7 @@ drm_show_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy,
struct drm_device *dev = (struct drm_device *)drv;
struct drm_surface *surf = lookup_drm_surface(surface);
struct drm_screen *scrn = lookup_drm_screen(dpy, screen);
+ struct pipe_context *pipe;
_EGLMode *mode = _eglLookupMode(dpy, m);
int ret;
unsigned int i, k;
@@ -391,8 +383,7 @@ drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
if (!_eglSwapBuffers(drv, dpy, draw))
return EGL_FALSE;
- back_surf = st_get_framebuffer_surface(surf->stfb,
- ST_SURFACE_BACK_LEFT);
+ st_get_framebuffer_surface(surf->stfb, ST_SURFACE_BACK_LEFT, &back_surf);
if (back_surf) {
diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c
index 3ca5acb68b..dec82c3a00 100644
--- a/src/gallium/state_trackers/egl/egl_tracker.c
+++ b/src/gallium/state_trackers/egl/egl_tracker.c
@@ -10,7 +10,7 @@
#include "state_tracker/drm_api.h"
#include "pipe/p_screen.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
/** HACK */
void* driDriverAPI;
diff --git a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
index da119ff1bd..122c42ed0e 100644
--- a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
+++ b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c
@@ -2,7 +2,6 @@
#include "vl_basic_csc.h"
#include <assert.h>
#include <pipe/p_context.h>
-#include <pipe/p_winsys.h>
#include <pipe/p_state.h>
#include <pipe/p_inlines.h>
#include <tgsi/tgsi_parse.h>
@@ -657,7 +656,7 @@ static int vlInit
csc->framebuffer_tex = NULL;
csc->framebuffer.width = 0;
csc->framebuffer.height = 0;
- csc->framebuffer.num_cbufs = 1;
+ csc->framebuffer.nr_cbufs = 1;
csc->framebuffer.cbufs[0] = NULL;
csc->framebuffer.zsbuf = NULL;
diff --git a/src/gallium/state_trackers/g3dvl/vl_context.c b/src/gallium/state_trackers/g3dvl/vl_context.c
index fbea1363d8..c4c4e23c15 100644
--- a/src/gallium/state_trackers/g3dvl/vl_context.c
+++ b/src/gallium/state_trackers/g3dvl/vl_context.c
@@ -81,8 +81,8 @@ static int vlInitCommon(struct vlContext *context)
dsa.stencil[i].zpass_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[i].zfail_op = PIPE_STENCIL_OP_KEEP;
dsa.stencil[i].ref_value = 0;
- dsa.stencil[i].value_mask = 0;
- dsa.stencil[i].write_mask = 0;
+ dsa.stencil[i].valuemask = 0;
+ dsa.stencil[i].writemask = 0;
}
dsa.alpha.enabled = 0;
dsa.alpha.func = PIPE_FUNC_ALWAYS;
diff --git a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
index f0f8294473..d53482f579 100644
--- a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
+++ b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c
@@ -2,7 +2,6 @@
#include "vl_r16snorm_mc_buf.h"
#include <assert.h>
#include <pipe/p_context.h>
-#include <pipe/p_winsys.h>
#include <pipe/p_screen.h>
#include <pipe/p_state.h>
#include <pipe/p_inlines.h>
@@ -649,9 +648,9 @@ static int vlFlush
pipe->set_framebuffer_state(pipe, &mc->render_target);
pipe->set_viewport_state(pipe, &mc->viewport);
- vs_consts = pipe->winsys->buffer_map
+ vs_consts = pipe_buffer_map
(
- pipe->winsys,
+ pipe->screen,
mc->vs_const_buf.buffer,
PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD
);
@@ -1052,7 +1051,7 @@ static int vlInit
mc->render_target.width = vlRoundUpPOT(mc->picture_width);
mc->render_target.height = vlRoundUpPOT(mc->picture_height);
- mc->render_target.num_cbufs = 1;
+ mc->render_target.nr_cbufs = 1;
/* FB for MC stage is a vlSurface created by the user, set at render time */
mc->render_target.zsbuf = NULL;
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 95c1378a03..20dd8d269d 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -26,7 +26,7 @@
**************************************************************************/
-#include "pipe/p_winsys.h"
+#include "pipe/p_screen.h"
#include "pipe/p_context.h"
#include "pipe/p_shader_tokens.h"
#include "pipe/p_inlines.h"
diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c
index 01d88ee499..4d798df99b 100644
--- a/src/gallium/state_trackers/python/st_softpipe_winsys.c
+++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c
@@ -36,7 +36,7 @@
*/
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"/* port to just p_screen */
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c
index 88eeae7de7..6873e813ee 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_device.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_device.c
@@ -28,7 +28,6 @@
#include <windows.h>
#include "pipe/p_debug.h"
-#include "pipe/p_winsys.h"
#include "pipe/p_screen.h"
#include "shared/stw_device.h"
@@ -42,19 +41,18 @@ struct stw_device *stw_dev = NULL;
/**
- * XXX: Dispatch pipe_winsys::flush_front_buffer to our
+ * XXX: Dispatch pipe_screen::flush_front_buffer to our
* stw_winsys::flush_front_buffer.
*/
static void
-st_flush_frontbuffer(struct pipe_winsys *ws,
+st_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_surface *surf,
void *context_private )
{
const struct stw_winsys *stw_winsys = stw_dev->stw_winsys;
- struct pipe_winsys *winsys = stw_dev->screen->winsys;
HDC hdc = (HDC)context_private;
- stw_winsys->flush_frontbuffer(winsys, surf, hdc);
+ stw_winsys->flush_frontbuffer(screen, surf, hdc);
}
@@ -74,8 +72,7 @@ stw_shared_init(const struct stw_winsys *stw_winsys)
if(!stw_dev->screen)
goto error1;
- /* XXX: pipe_winsys::flush_frontbuffer should go away */
- stw_dev->screen->winsys->flush_frontbuffer = st_flush_frontbuffer;
+ stw_dev->screen->flush_frontbuffer = st_flush_frontbuffer;
pixelformat_init();
diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
index 90f181e28b..c70b31a488 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
@@ -204,7 +204,7 @@ stw_swap_buffers(
st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surf );
- stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen->winsys,
+ stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen,
surf,
hdc );
diff --git a/src/gallium/state_trackers/wgl/shared/stw_winsys.h b/src/gallium/state_trackers/wgl/shared/stw_winsys.h
index 8557327ccd..a85a9a2257 100644
--- a/src/gallium/state_trackers/wgl/shared/stw_winsys.h
+++ b/src/gallium/state_trackers/wgl/shared/stw_winsys.h
@@ -34,7 +34,6 @@
struct pipe_screen;
struct pipe_context;
-struct pipe_winsys;
struct pipe_surface;
struct stw_winsys
@@ -46,7 +45,7 @@ struct stw_winsys
(*create_context)( struct pipe_screen *screen );
void
- (*flush_frontbuffer)( struct pipe_winsys *winsys,
+ (*flush_frontbuffer)( struct pipe_screen *screen,
struct pipe_surface *surf,
HDC hDC );
};
diff --git a/src/gallium/winsys/drm/intel/common/intel_be_device.c b/src/gallium/winsys/drm/intel/common/intel_be_device.c
index 14aeaf61db..85ab1a2684 100644
--- a/src/gallium/winsys/drm/intel/common/intel_be_device.c
+++ b/src/gallium/winsys/drm/intel/common/intel_be_device.c
@@ -10,7 +10,7 @@
#include "ws_dri_bufpool.h"
#include "ws_dri_fencemgr.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
diff --git a/src/gallium/winsys/drm/intel/common/intel_be_device.h b/src/gallium/winsys/drm/intel/common/intel_be_device.h
index 3f8b3f585c..534d638b6a 100644
--- a/src/gallium/winsys/drm/intel/common/intel_be_device.h
+++ b/src/gallium/winsys/drm/intel/common/intel_be_device.h
@@ -1,7 +1,7 @@
#ifndef INTEL_DRM_DEVICE_H
#define INTEL_DRM_DEVICE_H
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_context.h"
/*
diff --git a/src/gallium/winsys/drm/intel/egl/Makefile b/src/gallium/winsys/drm/intel/egl/Makefile
index 4b22d17ccf..7147d89e0d 100644
--- a/src/gallium/winsys/drm/intel/egl/Makefile
+++ b/src/gallium/winsys/drm/intel/egl/Makefile
@@ -4,10 +4,11 @@ include $(TOP)/configs/current
LIBNAME = EGL_i915.so
PIPE_DRIVERS = \
+ ../gem/libinteldrm.a \
$(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
$(TOP)/src/gallium/drivers/i915simple/libi915simple.a \
$(TOP)/src/gallium/state_trackers/egl/libegldrm.a \
- ../gem/libinteldrm.a
+
DRIVER_SOURCES = \
intel_context.c \
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c b/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
index e83a4c42cd..d9556e1f38 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_batchbuffer.c
@@ -1,4 +1,5 @@
+#include "i915simple/i915_debug.h"
#include "intel_be_batchbuffer.h"
#include "intel_be_context.h"
#include "intel_be_device.h"
@@ -66,13 +67,15 @@ intel_be_offset_relocation(struct intel_be_batchbuffer *batch,
assert(batch->base.relocs < batch->base.max_relocs);
offset = (unsigned)(batch->base.ptr - batch->base.map);
- batch->base.ptr += 4;
- ret = drm_intel_bo_emit_reloc(bo, pre_add,
- batch->bo, offset,
+ ret = drm_intel_bo_emit_reloc(batch->bo, offset,
+ bo, pre_add,
read_domains,
write_domain);
+ ((uint32_t*)batch->base.ptr)[0] = bo->offset + pre_add;
+ batch->base.ptr += 4;
+
if (!ret)
batch->base.relocs++;
@@ -93,14 +96,12 @@ intel_be_batchbuffer_flush(struct intel_be_batchbuffer *batch,
assert((used & 3) == 0);
if (used & 4) {
- ((uint32_t *) batch->base.ptr)[0] = ((0<<29)|(4<<23)); // MI_FLUSH;
- ((uint32_t *) batch->base.ptr)[1] = 0;
- ((uint32_t *) batch->base.ptr)[2] = (0xA<<23); // MI_BATCH_BUFFER_END;
- batch->base.ptr += 12;
+ i915_batchbuffer_dword(i915, (0x0<<29)|(0x4<<23)|(1<<0)); // MI_FLUSH | FLUSH_MAP_CACHE;
+ i915_batchbuffer_dword(i915, (0x0<<29)|(0x0<<23)); // MI_NOOP
+ i915_batchbuffer_dword(i915, (0x0<<29)|(0xA<<23)); // MI_BATCH_BUFFER_END;
} else {
- ((uint32_t *) batch->base.ptr)[0] = ((0<<29)|(4<<23)); // MI_FLUSH;
- ((uint32_t *) batch->base.ptr)[1] = (0xA<<23); // MI_BATCH_BUFFER_END;
- batch->base.ptr += 8;
+ i915_batchbuffer_dword(i915, (0x0<<29)|(0x4<<23)|(1<<0)); //MI_FLUSH | FLUSH_MAP_CACHE;
+ i915_batchbuffer_dword(i915, (0x0<<29)|(0xA<<23)); // MI_BATCH_BUFFER_END;
}
used = batch->base.ptr - batch->base.map;
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_context.c b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
index 3e472e1e43..95e761d78d 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_context.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_context.c
@@ -26,11 +26,11 @@ intel_be_batch_reloc(struct i915_winsys *sws,
if (access_flags & I915_BUFFER_ACCESS_WRITE) {
write = I915_GEM_DOMAIN_RENDER;
+ read = I915_GEM_DOMAIN_RENDER;
}
if (access_flags & I915_BUFFER_ACCESS_READ) {
- read = I915_GEM_DOMAIN_SAMPLER |
- I915_GEM_DOMAIN_VERTEX;
+ read |= I915_GEM_DOMAIN_VERTEX;
}
ret = intel_be_offset_relocation(intel->batch,
@@ -38,6 +38,8 @@ intel_be_batch_reloc(struct i915_winsys *sws,
bo,
read,
write);
+ assert(ret == 0);
+
/* TODO change return type */
/* return ret; */
}
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.c b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
index 5406636bcb..82c1cb2f32 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.c
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.c
@@ -1,7 +1,7 @@
#include "intel_be_device.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
diff --git a/src/gallium/winsys/drm/intel/gem/intel_be_device.h b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
index 96e94c47e7..f06890163c 100644
--- a/src/gallium/winsys/drm/intel/gem/intel_be_device.h
+++ b/src/gallium/winsys/drm/intel/gem/intel_be_device.h
@@ -2,7 +2,7 @@
#ifndef INTEL_DRM_DEVICE_H
#define INTEL_DRM_DEVICE_H
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_context.h"
#include "drm.h"
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_context.c b/src/gallium/winsys/drm/nouveau/common/nouveau_context.c
index 2f245046d4..e093877381 100644
--- a/src/gallium/winsys/drm/nouveau/common/nouveau_context.c
+++ b/src/gallium/winsys/drm/nouveau/common/nouveau_context.c
@@ -84,6 +84,8 @@ nouveau_context_init(struct nouveau_screen *nv_screen,
int i;
switch (dev->chipset & 0xf0) {
+ case 0x00:
+ /* NV04 */
case 0x10:
case 0x20:
/* NV10 */
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_fence.c b/src/gallium/winsys/drm/nouveau/common/nouveau_fence.c
index e7b0b4ff07..451011e112 100644
--- a/src/gallium/winsys/drm/nouveau/common/nouveau_fence.c
+++ b/src/gallium/winsys/drm/nouveau/common/nouveau_fence.c
@@ -148,9 +148,12 @@ nouveau_fence_emit(struct nouveau_fence *fence)
NOUVEAU_ERR("AII wrap unhandled\n");
/*XXX: assumes subc 0 is populated */
- RING_SPACE_CH(fence->channel, 2);
- OUT_RING_CH (fence->channel, 0x00040050);
- OUT_RING_CH (fence->channel, nvfence->sequence);
+ /* Not the way to fence on nv4 */
+ if (nvchan->base.device->chipset >= 0x10) {
+ RING_SPACE_CH(fence->channel, 2);
+ OUT_RING_CH (fence->channel, 0x00040050);
+ OUT_RING_CH (fence->channel, nvfence->sequence);
+ }
if (nvchan->fence_tail) {
nouveau_fence(nvchan->fence_tail)->next = fence;
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c
index 364340e1d3..722694e4a4 100644
--- a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c
+++ b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c
@@ -100,6 +100,10 @@ nouveau_pipe_create(struct nouveau_context *nv)
return NULL;
switch (chipset & 0xf0) {
+ case 0x00:
+ hws_create = nv04_screen_create;
+ hw_create = nv04_create;
+ break;
case 0x10:
hws_create = nv10_screen_create;
hw_create = nv10_create;
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
index 5b3101fbba..8e889b9f36 100644
--- a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
+++ b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.c
@@ -1,4 +1,4 @@
-#include <pipe/p_winsys.h>
+#include "pipe/internal/p_winsys_screen.h"
#include <pipe/p_defines.h>
#include <pipe/p_inlines.h>
#include <util/u_memory.h>
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.h b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.h
index 14c728690d..d97ffdf337 100644
--- a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.h
+++ b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_pipe.h
@@ -2,7 +2,7 @@
#define NOUVEAU_PIPE_WINSYS_H
#include "pipe/p_context.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "nouveau_context.h"
struct nouveau_pipe_buffer {
diff --git a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_softpipe.c b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_softpipe.c
index 04def600f4..396e4f2a2e 100644
--- a/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_softpipe.c
+++ b/src/gallium/winsys/drm/nouveau/common/nouveau_winsys_softpipe.c
@@ -29,7 +29,7 @@
* Authors: Keith Whitwell <keithw-at-tungstengraphics-dot-com>
*/
-#include <pipe/p_winsys.h>
+#include "pipe/internal/p_winsys_screen.h"
#include <pipe/p_screen.h>
#include <pipe/p_defines.h>
#include <pipe/p_format.h>
diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c
index 82aa60ae58..4876339107 100644
--- a/src/gallium/winsys/egl_xlib/egl_xlib.c
+++ b/src/gallium/winsys/egl_xlib/egl_xlib.c
@@ -38,7 +38,7 @@
#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
#include "pipe/p_state.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "util/u_memory.h"
#include "softpipe/sp_winsys.h"
diff --git a/src/gallium/winsys/egl_xlib/sw_winsys.c b/src/gallium/winsys/egl_xlib/sw_winsys.c
index a09ad5e8e9..739bfa1c1a 100644
--- a/src/gallium/winsys/egl_xlib/sw_winsys.c
+++ b/src/gallium/winsys/egl_xlib/sw_winsys.c
@@ -35,7 +35,7 @@
*/
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_state.h"
#include "pipe/p_inlines.h"
#include "util/u_math.h"
diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
index cc12007193..1abe84b6a0 100644
--- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
+++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c
@@ -38,7 +38,7 @@
#include <windows.h>
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
@@ -268,7 +268,7 @@ gdi_softpipe_context_create(struct pipe_screen *screen)
static void
-gdi_softpipe_flush_frontbuffer(struct pipe_winsys *winsys,
+gdi_softpipe_flush_frontbuffer(struct pipe_screen *screen,
struct pipe_surface *surface,
HDC hDC)
{
diff --git a/src/gallium/winsys/xlib/xlib_brw_context.c b/src/gallium/winsys/xlib/xlib_brw_context.c
index 528473925a..09599507f4 100644
--- a/src/gallium/winsys/xlib/xlib_brw_context.c
+++ b/src/gallium/winsys/xlib/xlib_brw_context.c
@@ -36,7 +36,7 @@
//#include "glxheader.h"
//#include "xmesaP.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
diff --git a/src/gallium/winsys/xlib/xlib_brw_screen.c b/src/gallium/winsys/xlib/xlib_brw_screen.c
index 1fd7da8a2f..5344c502ef 100644
--- a/src/gallium/winsys/xlib/xlib_brw_screen.c
+++ b/src/gallium/winsys/xlib/xlib_brw_screen.c
@@ -36,7 +36,7 @@
//#include "state_trackers/xlib/glxheader.h"
//#include "state_trackers/xlib/xmesaP.h"
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_inlines.h"
#include "util/u_math.h"
#include "util/u_memory.h"
diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c
index 5af9ee3bb5..bf69593c5c 100644
--- a/src/gallium/winsys/xlib/xlib_cell.c
+++ b/src/gallium/winsys/xlib/xlib_cell.c
@@ -41,7 +41,7 @@
#undef ASSERT
#undef Elements
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c
index c0bf37050a..01d24584e2 100644
--- a/src/gallium/winsys/xlib/xlib_softpipe.c
+++ b/src/gallium/winsys/xlib/xlib_softpipe.c
@@ -38,7 +38,7 @@
#undef ASSERT
#undef Elements
-#include "pipe/p_winsys.h"
+#include "pipe/internal/p_winsys_screen.h"
#include "pipe/p_format.h"
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h
index ded079695e..f990bde839 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.h
+++ b/src/mesa/drivers/dri/i965/brw_wm.h
@@ -60,16 +60,16 @@ struct brw_wm_prog_key {
GLuint aa_dest_stencil_reg:3;
GLuint dest_depth_reg:3;
GLuint nr_depth_regs:3;
- GLuint projtex_mask:8;
- GLuint shadowtex_mask:8;
GLuint computes_depth:1; /* could be derived from program string */
GLuint source_depth_to_render_target:1;
GLuint flat_shade:1;
GLuint runtime_check_aads_emit:1;
- GLuint yuvtex_mask:8;
- GLuint yuvtex_swap_mask:8; /* UV swaped */
- GLuint pad1:16;
+ GLuint projtex_mask:16;
+ GLuint shadowtex_mask:16;
+ GLuint yuvtex_mask:16;
+ GLuint yuvtex_swap_mask:16; /* UV swaped */
+ // GLuint pad1:16;
GLuint program_string_id:32;
GLuint origin_x, origin_y;
diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
index 205a7160d3..fca7b7a50c 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
@@ -379,14 +379,22 @@ static void pass0_precalc_mov( struct brw_wm_compile *c,
{
const struct prog_dst_register *dst = &inst->DstReg;
GLuint writemask = inst->DstReg.WriteMask;
+ struct brw_wm_ref *refs[4];
GLuint i;
/* Get the effect of a MOV by manipulating our register table:
+ * First get all refs, then assign refs. This ensures that "in-place"
+ * swizzles such as:
+ * MOV t, t.xxyx
+ * are handled correctly. Previously, these two steps were done in
+ * one loop and the above case was incorrectly handled.
*/
for (i = 0; i < 4; i++) {
- if (writemask & (1<<i)) {
- pass0_set_fpreg_ref( c, dst->File, dst->Index, i,
- get_new_ref(c, inst->SrcReg[0], i, NULL));
+ refs[i] = get_new_ref(c, inst->SrcReg[0], i, NULL);
+ }
+ for (i = 0; i < 4; i++) {
+ if (writemask & (1 << i)) {
+ pass0_set_fpreg_ref( c, dst->File, dst->Index, i, refs[i]);
}
}
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 048286c196..348da347dd 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -168,6 +168,7 @@ struct intel_context
GLint saved_vp_x, saved_vp_y;
GLsizei saved_vp_width, saved_vp_height;
+ GLenum saved_matrix_mode;
} meta;
GLint refcount;
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c
index cf2f32d384..5e32288844 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel.c
@@ -181,6 +181,7 @@ intel_meta_set_passthrough_transform(struct intel_context *intel)
intel->meta.saved_vp_y = ctx->Viewport.Y;
intel->meta.saved_vp_width = ctx->Viewport.Width;
intel->meta.saved_vp_height = ctx->Viewport.Height;
+ intel->meta.saved_matrix_mode = ctx->Transform.MatrixMode;
_mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
@@ -202,6 +203,8 @@ intel_meta_restore_transform(struct intel_context *intel)
_mesa_MatrixMode(GL_MODELVIEW);
_mesa_PopMatrix();
+ _mesa_MatrixMode(intel->meta.saved_matrix_mode);
+
_mesa_Viewport(intel->meta.saved_vp_x, intel->meta.saved_vp_y,
intel->meta.saved_vp_width, intel->meta.saved_vp_height);
}
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
index 0e83afa645..bb36649dac 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c
@@ -92,7 +92,7 @@ intel_texture_drawpixels(GLcontext * ctx,
return GL_FALSE;
}
- /* We don't have a way to generate fragments with stencil values which *
+ /* We don't have a way to generate fragments with stencil values which
* will set the resulting stencil value.
*/
if (format == GL_STENCIL_INDEX)
@@ -225,6 +225,10 @@ intel_stencil_drawpixels(GLcontext * ctx,
return GL_FALSE;
}
+ /* We don't support stencil testing/ops here */
+ if (ctx->Stencil.Enabled)
+ return GL_FALSE;
+
/* We use FBOs for our wrapping of the depthbuffer into a color
* destination.
*/
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h
index 3d874c8ba8..84dcb263c6 100644
--- a/src/mesa/main/version.h
+++ b/src/mesa/main/version.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 7.3
+ * Version: 7.4
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
@@ -29,9 +29,9 @@
/* Mesa version */
#define MESA_MAJOR 7
-#define MESA_MINOR 3
+#define MESA_MINOR 4
#define MESA_PATCH 0
-#define MESA_VERSION_STRING "7.3-rc3"
+#define MESA_VERSION_STRING "7.4"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c
index d02e51cb9a..514b10cd02 100644
--- a/src/mesa/state_tracker/st_atom_constbuf.c
+++ b/src/mesa/state_tracker/st_atom_constbuf.c
@@ -92,8 +92,6 @@ void st_upload_constants( struct st_context *st,
pipe_buffer_unmap(pipe->screen, cbuf->buffer);
}
- cbuf->size = paramBytes;
-
st->pipe->set_constant_buffer(st->pipe, id, 0, cbuf);
}
else {
diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c
index 0e791ceb20..2d617bd95d 100644
--- a/src/mesa/state_tracker/st_atom_depth.c
+++ b/src/mesa/state_tracker/st_atom_depth.c
@@ -112,8 +112,8 @@ update_depth_stencil_alpha(struct st_context *st)
dsa->stencil[0].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[0]);
dsa->stencil[0].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[0]);
dsa->stencil[0].ref_value = st->ctx->Stencil.Ref[0] & 0xff;
- dsa->stencil[0].value_mask = st->ctx->Stencil.ValueMask[0] & 0xff;
- dsa->stencil[0].write_mask = st->ctx->Stencil.WriteMask[0] & 0xff;
+ dsa->stencil[0].valuemask = st->ctx->Stencil.ValueMask[0] & 0xff;
+ dsa->stencil[0].writemask = st->ctx->Stencil.WriteMask[0] & 0xff;
if (st->ctx->Stencil._TestTwoSide) {
dsa->stencil[1].enabled = 1;
@@ -122,8 +122,8 @@ update_depth_stencil_alpha(struct st_context *st)
dsa->stencil[1].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[1]);
dsa->stencil[1].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[1]);
dsa->stencil[1].ref_value = st->ctx->Stencil.Ref[1] & 0xff;
- dsa->stencil[1].value_mask = st->ctx->Stencil.ValueMask[1] & 0xff;
- dsa->stencil[1].write_mask = st->ctx->Stencil.WriteMask[1] & 0xff;
+ dsa->stencil[1].valuemask = st->ctx->Stencil.ValueMask[1] & 0xff;
+ dsa->stencil[1].writemask = st->ctx->Stencil.WriteMask[1] & 0xff;
}
else {
dsa->stencil[1] = dsa->stencil[0];
@@ -134,7 +134,7 @@ update_depth_stencil_alpha(struct st_context *st)
if (st->ctx->Color.AlphaEnabled) {
dsa->alpha.enabled = 1;
dsa->alpha.func = st_compare_func_to_pipe(st->ctx->Color.AlphaFunc);
- dsa->alpha.ref = st->ctx->Color.AlphaRef;
+ dsa->alpha.ref_value = st->ctx->Color.AlphaRef;
}
cso_set_depth_stencil_alpha(st->cso_context, dsa);
diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index 902bdf94f2..625efdd66b 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -108,7 +108,7 @@ update_framebuffer_state( struct st_context *st )
/* Examine Mesa's ctx->DrawBuffer->_ColorDrawBuffers state
* to determine which surfaces to draw to
*/
- framebuffer->num_cbufs = 0;
+ framebuffer->nr_cbufs = 0;
for (i = 0; i < fb->_NumColorDrawBuffers; i++) {
strb = st_renderbuffer(fb->_ColorDrawBuffers[i]);
@@ -119,8 +119,8 @@ update_framebuffer_state( struct st_context *st )
}
if (strb->surface) {
- framebuffer->cbufs[framebuffer->num_cbufs] = strb->surface;
- framebuffer->num_cbufs++;
+ framebuffer->cbufs[framebuffer->nr_cbufs] = strb->surface;
+ framebuffer->nr_cbufs++;
}
}
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index fca1107d72..668c3f9ebf 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -287,8 +287,8 @@ clear_with_quad(GLcontext *ctx,
depth_stencil.stencil[0].zpass_op = PIPE_STENCIL_OP_REPLACE;
depth_stencil.stencil[0].zfail_op = PIPE_STENCIL_OP_REPLACE;
depth_stencil.stencil[0].ref_value = ctx->Stencil.Clear;
- depth_stencil.stencil[0].value_mask = 0xff;
- depth_stencil.stencil[0].write_mask = ctx->Stencil.WriteMask[0] & 0xff;
+ depth_stencil.stencil[0].valuemask = 0xff;
+ depth_stencil.stencil[0].writemask = ctx->Stencil.WriteMask[0] & 0xff;
}
cso_set_depth_stencil_alpha(st->cso_context, &depth_stencil);
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index 0c69e16623..d18946de7d 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -42,7 +42,7 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_inlines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/p_screen.h"
#include "st_context.h"
#include "st_cb_fbo.h"
#include "st_cb_texture.h"
diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c
index 19021411cf..c7e8aa7cc5 100644
--- a/src/mesa/state_tracker/st_cb_feedback.c
+++ b/src/mesa/state_tracker/st_cb_feedback.c
@@ -52,7 +52,6 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
#include "cso_cache/cso_cache.h"
#include "draw/draw_context.h"
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index 072f2e92ad..f8621ab125 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -42,7 +42,7 @@
#include "st_public.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
+#include "pipe/p_screen.h"
#include "util/u_gen_mipmap.h"
#include "util/u_blit.h"
@@ -55,7 +55,7 @@ is_front_buffer_dirty(struct st_context *st)
/**
- * Tell the winsys to display the front color buffer on-screen.
+ * Tell the screen to display the front color buffer on-screen.
*/
static void
display_front_buffer(struct st_context *st)
@@ -67,7 +67,7 @@ display_front_buffer(struct st_context *st)
/* Hook for copying "fake" frontbuffer if necessary:
*/
- st->pipe->winsys->flush_frontbuffer( st->pipe->winsys, front_surf,
+ st->pipe->screen->flush_frontbuffer( st->pipe->screen, front_surf,
st->pipe->priv );
/*
@@ -103,8 +103,8 @@ void st_finish( struct st_context *st )
st_flush(st, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_FRAME, &fence);
if(fence) {
- st->pipe->winsys->fence_finish(st->pipe->winsys, fence, 0);
- st->pipe->winsys->fence_reference(st->pipe->winsys, &fence, NULL);
+ st->pipe->screen->fence_finish(st->pipe->screen, fence, 0);
+ st->pipe->screen->fence_reference(st->pipe->screen, &fence, NULL);
}
}
diff --git a/src/mesa/state_tracker/st_cb_strings.c b/src/mesa/state_tracker/st_cb_strings.c
index 09545aa8fb..2036ccafbf 100644
--- a/src/mesa/state_tracker/st_cb_strings.c
+++ b/src/mesa/state_tracker/st_cb_strings.c
@@ -36,7 +36,6 @@
#include "main/version.h"
#include "pipe/p_context.h"
#include "pipe/p_screen.h"
-#include "pipe/p_winsys.h"
#include "st_context.h"
#include "st_cb_strings.h"
@@ -67,10 +66,9 @@ st_get_string(GLcontext * ctx, GLenum name)
}
case GL_RENDERER:
- util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s, %s on %s",
+ util_snprintf(st->renderer, sizeof(st->renderer), "Gallium %s on %s",
ST_VERSION_STRING,
- screen->get_name( screen ),
- screen->winsys->get_name( screen->winsys ));
+ screen->get_name( screen ));
return (GLubyte *) st->renderer;
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 31383b4887..630ad2bcdf 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -381,7 +381,7 @@ setup_interleaved_attribs(GLcontext *ctx,
pipe_buffer_reference(pipe->screen, &vbuffer->buffer, stobj->buffer);
vbuffer->buffer_offset = (unsigned) arrays[mesaAttr]->Ptr;
}
- vbuffer->pitch = stride; /* in bytes */
+ vbuffer->stride = stride; /* in bytes */
vbuffer->max_index = max_index;
}
@@ -472,7 +472,7 @@ setup_non_interleaved_attribs(GLcontext *ctx,
assert(velements[attr].src_offset <= 2048); /* 11-bit field */
/* common-case setup */
- vbuffer[attr].pitch = stride; /* in bytes */
+ vbuffer[attr].stride = stride; /* in bytes */
vbuffer[attr].max_index = max_index;
velements[attr].vertex_buffer_index = attr;
velements[attr].nr_components = arrays[mesaAttr]->Size;
@@ -569,7 +569,7 @@ st_draw_vbo(GLcontext *ctx,
{
GLuint i;
for (i = 0; i < num_vbuffers; i++) {
- printf("buffers[%d].pitch = %u\n", i, vbuffer[i].pitch);
+ printf("buffers[%d].stride = %u\n", i, vbuffer[i].stride);
printf("buffers[%d].max_index = %u\n", i, vbuffer[i].max_index);
printf("buffers[%d].buffer_offset = %u\n", i, vbuffer[i].buffer_offset);
printf("buffers[%d].buffer = %p\n", i, (void*) vbuffer[i].buffer);
diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c
index 834c3844c4..5c9c4506c2 100644
--- a/src/mesa/state_tracker/st_draw_feedback.c
+++ b/src/mesa/state_tracker/st_draw_feedback.c
@@ -171,7 +171,7 @@ st_feedback_draw_vbo(GLcontext *ctx,
}
/* common-case setup */
- vbuffers[attr].pitch = arrays[mesaAttr]->StrideB; /* in bytes */
+ vbuffers[attr].stride = arrays[mesaAttr]->StrideB; /* in bytes */
vbuffers[attr].max_index = max_index;
velements[attr].vertex_buffer_index = attr;
velements[attr].nr_components = arrays[mesaAttr]->Size;